diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2018-05-09 03:33:56 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-05-14 21:16:13 +0200 |
commit | 0ba99ca4838bc75481a4bf0e70bad20b0a5457c7 (patch) | |
tree | b39b4f4fe72a4b4ff1016a512d40998dfb1d595c /block/bio.c | |
parent | block: Add missing flush_dcache_page() call (diff) | |
download | linux-0ba99ca4838bc75481a4bf0e70bad20b0a5457c7.tar.xz linux-0ba99ca4838bc75481a4bf0e70bad20b0a5457c7.zip |
block: Add warning for bi_next not NULL in bio_endio()
Recently found a bug where a driver left bi_next not NULL and then
called bio_endio(), and then the submitter of the bio used
bio_copy_data() which was treating src and dst as lists of bios.
Fixed that bug by splitting out bio_list_copy_data(), but in case other
things are depending on bi_next in weird ways, add a warning to help
avoid more bugs like that in the future.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'block/bio.c')
-rw-r--r-- | block/bio.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/block/bio.c b/block/bio.c index 2112ad01b52c..d8bcc12d5aa4 100644 --- a/block/bio.c +++ b/block/bio.c @@ -1775,6 +1775,9 @@ again: if (!bio_integrity_endio(bio)) return; + if (WARN_ONCE(bio->bi_next, "driver left bi_next not NULL")) + bio->bi_next = NULL; + /* * Need to have a real endio function for chained bios, otherwise * various corner cases will break (like stacking block devices that |