[Nbd] [PATCH v2 2/9] mmc: fix max_discard_sectors
- To: dwmw2@...1270..., axboe@...161..., shli@...1285..., Paul.Clements@...124..., npiggin@...161..., neilb@...122..., cjb@...1330..., adrian.hunter@...1303..., James.Bottomley@...1336..., JBottomley@...1298...
- Cc: nbd-general@lists.sourceforge.net, Namjae Jeon <linkinjeon@...17...>, Vivek Trivedi <t.vivek@...1329...>, linux-scsi@...25..., Namjae Jeon <namjae.jeon@...1329...>, linux-mmc@...25..., linux-kernel@...25..., linux-raid@...25..., jcmvbkbc@...17..., linux-mtd@...1331...
- Subject: [Nbd] [PATCH v2 2/9] mmc: fix max_discard_sectors
- From: Namjae Jeon <linkinjeon@...17...>
- Date: Sat, 20 Apr 2013 01:40:47 +0900
- Message-id: <1366389647-19382-1-git-send-email-linkinjeon@...17...>
From: Namjae Jeon <namjae.jeon@...1329...>
https://lkml.org/lkml/2013/4/1/292
As per above discussion, there is possibility that request's __data_len
field may overflow when max_discard_sectors greater than UINT_MAX >> 9
If multiple discard requests get merged, merged discard request's
size exceeds 4GB, there is possibility that merged discard request's
__data_len field may overflow.
This patch fixes this issue.
Reported-by: Max Filippov <jcmvbkbc@...17...>
Signed-off-by: Namjae Jeon <namjae.jeon@...1329...>
Signed-off-by: Vivek Trivedi <t.vivek@...1329...>
---
drivers/mmc/card/queue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c
index 9447a0e..54726b7 100644
--- a/drivers/mmc/card/queue.c
+++ b/drivers/mmc/card/queue.c
@@ -166,7 +166,7 @@ static void mmc_queue_setup_discard(struct request_queue *q,
return;
queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, q);
- q->limits.max_discard_sectors = max_discard;
+ blk_queue_max_discard_sectors(q, max_discard);
if (card->erased_byte == 0 && !mmc_can_discard(card))
q->limits.discard_zeroes_data = 1;
q->limits.discard_granularity = card->pref_erase << 9;
--
1.7.9.5
Reply to: