From: Kent Overstreet Date: Tue, 25 Feb 2014 03:55:28 +0000 (-0800) Subject: bcache: Fix a null ptr deref in journal replay X-Git-Tag: v3.15-rc1~134^2^2~19 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=65ddf45a3102916fb622c71f7af158b19d49dc7f;p=karo-tx-linux.git bcache: Fix a null ptr deref in journal replay Signed-off-by: Kent Overstreet --- diff --git a/drivers/md/bcache/journal.c b/drivers/md/bcache/journal.c index e38c5997bf12..97e6a92da999 100644 --- a/drivers/md/bcache/journal.c +++ b/drivers/md/bcache/journal.c @@ -287,9 +287,13 @@ void bch_journal_mark(struct cache_set *c, struct list_head *list) k < bset_bkey_last(&i->j); k = bkey_next(k)) { unsigned j; + struct bucket *g; for (j = 0; j < KEY_PTRS(k); j++) { - struct bucket *g = PTR_BUCKET(c, k, j); + if (!ptr_available(c, k, j)) + continue; + + g = PTR_BUCKET(c, k, j); atomic_inc(&g->pin); if (g->prio == BTREE_PRIO &&