[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAC5umyj7Uy=j8OyYB5oLEwQYSWPnXrjsUL2L_mO2udzMiSsbfg@mail.gmail.com>
Date: Tue, 19 Nov 2013 08:54:18 +0900
From: Akinobu Mita <akinobu.mita@...il.com>
To: Jens Axboe <axboe@...nel.dk>
Cc: LKML <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Alexander Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH] bio: fix argument of __bio_add_page() for max_sectors > 0xffff
2013/11/19 Jens Axboe <axboe@...nel.dk>:
> On 11/18/2013 06:11 AM, Akinobu Mita wrote:
>> The data type of max_sectors and max_hw_sectors in queue settings are
>> unsigned int. But these values are passed to __bio_add_page() as an
>> argument whose data type is unsigned short. In the worst case such as
>> max_sectors is 0x10000, bio_add_page() can't add a page and IOs can't
>> proceed.
>
> Thanks, added. Even at 512b sectors, 0xffff sectors would be a huuuuge
> page. So I don't think we'd ever see this bug hit, iirc huge pages are
> still broken down for IO. But it's better to be safe...
I hit this when I was trying to change the data type of max_sectors in
scsi host settings from 16-bit to 32-bit.
BTW, I found that BLKSECTGET only returns 16-bit of max_sectors. Should
we need the change like below?
case BLKSECTGET:
- return put_ushort(arg, queue_max_sectors(bdev_get_queue(bdev)));
+ max_sectors = min(0xffff,
+ queue_max_sectors(bdev_get_queue(bdev)));
+ return put_ushort(arg, max_sectors);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists