* [PATCH] rsxx: fix discard with length smaller than hw blksize
@ 2014-06-30 17:31 Thadeu Lima de Souza Cascardo
2014-06-30 21:06 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Thadeu Lima de Souza Cascardo @ 2014-06-30 17:31 UTC (permalink / raw)
To: pjk1939
Cc: josh.h.morris, linux-kernel, axboe, Thadeu Lima de Souza Cascardo,
stable
When the discard length is not a multiple of RSXX_HW_BLK_SIZE, the
discard code will get into an infinite loop, even discarding data it is
not supposed to. This will also hang the system.
This can be reproduced by doing an ioctl BLKDISCARD to /dev/rsxx0 with
range from 0 to 1024.
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com>
Cc: stable@vger.kernel.org
---
drivers/block/rsxx/dma.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/drivers/block/rsxx/dma.c b/drivers/block/rsxx/dma.c
index cf8cd29..d105a4a 100644
--- a/drivers/block/rsxx/dma.c
+++ b/drivers/block/rsxx/dma.c
@@ -708,7 +708,9 @@ int rsxx_dma_queue_bio(struct rsxx_cardinfo *card,
if (bio->bi_rw & REQ_DISCARD) {
bv_len = bio->bi_iter.bi_size;
- while (bv_len > 0) {
+ if (bv_len < RSXX_HW_BLK_SIZE)
+ bio_endio(bio, 0);
+ while (bv_len >= RSXX_HW_BLK_SIZE) {
tgt = rsxx_get_dma_tgt(card, addr8);
laddr = rsxx_addr8_to_laddr(addr8, card);
--
1.7.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-06-30 21:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-30 17:31 [PATCH] rsxx: fix discard with length smaller than hw blksize Thadeu Lima de Souza Cascardo
2014-06-30 21:06 ` Jens Axboe
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.