From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de ([195.135.220.15]:40666 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751901AbbINObL (ORCPT ); Mon, 14 Sep 2015 10:31:11 -0400 From: Jiri Slaby To: stable@vger.kernel.org Cc: Akinobu Mita , Jens Axboe , Alexander Viro , Jiri Slaby Subject: [patch added to the 3.12 stable tree] bio: fix argument of __bio_add_page() for max_sectors > 0xffff Date: Mon, 14 Sep 2015 16:31:03 +0200 Message-Id: <1442241067-32390-4-git-send-email-jslaby@suse.cz> In-Reply-To: <1442241067-32390-1-git-send-email-jslaby@suse.cz> References: <1442241067-32390-1-git-send-email-jslaby@suse.cz> Sender: stable-owner@vger.kernel.org List-ID: From: Akinobu Mita This patch has been added to the 3.12 stable tree. If you have any objections, please let us know. =============== commit 34f2fd8dfe6185b0eaaf7d661281713a6170b077 upstream. 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. Cc: Jens Axboe Cc: Alexander Viro Signed-off-by: Akinobu Mita Signed-off-by: Jens Axboe Signed-off-by: Jiri Slaby --- fs/bio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/bio.c b/fs/bio.c index ea5035da4d9a..e7fb3f82f5f5 100644 --- a/fs/bio.c +++ b/fs/bio.c @@ -601,7 +601,7 @@ EXPORT_SYMBOL(bio_get_nr_vecs); static int __bio_add_page(struct request_queue *q, struct bio *bio, struct page *page, unsigned int len, unsigned int offset, - unsigned short max_sectors) + unsigned int max_sectors) { int retried_segments = 0; struct bio_vec *bvec; -- 2.5.2