Commit fe164452c52395b47286b0ba3dfc9b3b3041f547

Authored by Kent Overstreet
Committed by Greg Kroah-Hartman
1 parent c0684969f6

bcache: Fix a null ptr deref regression

commit 2fe80d3bbf1c8bd9efc5b8154207c8dd104e7306 upstream.

Commit c0f04d88e46d ("bcache: Fix flushes in writeback mode") was fixing
a reported data corruption bug, but it seems some last minute
refactoring or rebasing introduced a null pointer deref.

Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Reported-by: Gabriel de Perthuis <g2p.code@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Showing 1 changed file with 1 additions and 2 deletions Side-by-side Diff

drivers/md/bcache/request.c
... ... @@ -996,6 +996,7 @@
996 996 closure_bio_submit(bio, cl, s->d);
997 997 } else {
998 998 bch_writeback_add(dc);
  999 + s->op.cache_bio = bio;
999 1000  
1000 1001 if (bio->bi_rw & REQ_FLUSH) {
1001 1002 /* Also need to send a flush to the backing device */
... ... @@ -1008,8 +1009,6 @@
1008 1009 flush->bi_private = cl;
1009 1010  
1010 1011 closure_bio_submit(flush, cl, s->d);
1011   - } else {
1012   - s->op.cache_bio = bio;
1013 1012 }
1014 1013 }
1015 1014 out: