[dm-devel] [BUG] BLKZEROOUT on dm-crypt container cause OOM / kernel panic

Mikulas Patocka mpatocka at redhat.com
Mon Aug 14 02:47:32 UTC 2017



On Wed, 9 Aug 2017, hch at lst.de wrote:

> Does commit 615d22a51c04856efe62af6e1d5b450aaf5cc2c0
> "block: Fix __blkdev_issue_zeroout loop" fix the issue for you?
> 
> --
> dm-devel mailing list
> dm-devel at redhat.com
> https://www.redhat.com/mailman/listinfo/dm-devel

I think that patch is incorrect. sector_t may be a 32-bit type and 
nr_sects << 9 may overflow.

static unsigned int __blkdev_sectors_to_bio_pages(sector_t nr_sects)
{
       sector_t bytes = (nr_sects << 9) + PAGE_SIZE - 1;

       return min(bytes >> PAGE_SHIFT, (sector_t)BIO_MAX_PAGES);
}

Mikulas




More information about the dm-devel mailing list