Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1262413
| From | Jan Kara <jack@suse.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] brd: Refuse improperly aligned discard requests |
| Date | 2015-11-04 17:20 +0100 |
| Message-ID | <qr8WZ-2KK-9@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
Currently when improperly aligned discard request is submitted, we just
silently discard more / less data which results in filesystem corruption
in some cases. Refuse such misaligned requests.
Signed-off-by: Jan Kara <jack@suse.com>
---
drivers/block/brd.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/block/brd.c b/drivers/block/brd.c
index b9794aeeb878..4ef4cdf67ede 100644
--- a/drivers/block/brd.c
+++ b/drivers/block/brd.c
@@ -337,6 +337,9 @@ static void brd_make_request(struct request_queue *q, struct bio *bio)
goto io_error;
if (unlikely(bio->bi_rw & REQ_DISCARD)) {
+ if (sector & ((PAGE_SIZE >> SECTOR_SHIFT) - 1) ||
+ bio->bi_iter.bi_size & PAGE_MASK)
+ goto io_error;
discard_from_brd(brd, sector, bio->bi_iter.bi_size);
goto out;
}
--
2.1.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] brd: Refuse improperly aligned discard requests Jan Kara <jack@suse.com> - 2015-11-04 17:20 +0100
RE: [PATCH] brd: Refuse improperly aligned discard requests "Elliott, Robert (Persistent Memory)" <elliott@hpe.com> - 2015-11-05 05:30 +0100
Re: [PATCH] brd: Refuse improperly aligned discard requests Jan Kara <jack@suse.cz> - 2015-11-05 09:10 +0100
Re: [PATCH] brd: Refuse improperly aligned discard requests Jens Axboe <axboe@kernel.dk> - 2015-11-05 21:20 +0100
csiph-web