Skip to contentSkip to conversation

mmc: fix max_discard_sectors

PATCH In review Namjae Jeon 1 participant 1 message Apr 19, 2013

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH v2 2/9 mmc: fix max_discard_sectors

From: Namjae Jeon <[email protected]>

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.

---
 drivers/mmc/card/queue.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/card/queue.c +1 -1
index 9447a0e..54726b7 100644
@@ -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;
Signature · 1 line
1.7.9.5