From: Kent Overstreet Date: Fri, 11 Oct 2013 00:31:15 +0000 (-0700) Subject: bcache: Fix a null ptr deref regression X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=84c8b3b9e17107a74f07dc5e48264034f1410b97;p=karo-tx-linux.git 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 Reported-by: Gabriel de Perthuis Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c index 2fe37fac1ca2..cbcf8b301edc 100644 --- a/drivers/md/bcache/request.c +++ b/drivers/md/bcache/request.c @@ -1055,6 +1055,7 @@ static void request_write(struct cached_dev *dc, struct search *s) } else { trace_bcache_writeback(s->orig_bio); bch_writeback_add(dc, bio_sectors(bio)); + s->op.cache_bio = bio; if (bio->bi_rw & REQ_FLUSH) { /* Also need to send a flush to the backing device */ @@ -1067,8 +1068,6 @@ static void request_write(struct cached_dev *dc, struct search *s) flush->bi_private = cl; closure_bio_submit(flush, cl, s->d); - } else { - s->op.cache_bio = bio; } } out: