aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/bcache/journal.c
diff options
context:
space:
mode:
authorKent Overstreet <kmo@daterainc.com>2014-02-24 19:55:28 -0800
committerKent Overstreet <kmo@daterainc.com>2014-03-17 19:01:03 -0700
commit65ddf45a3102916fb622c71f7af158b19d49dc7f (patch)
tree2750fb8191169f39c5942cfce8b86a45d7f92281 /drivers/md/bcache/journal.c
parentbcache: Fix a lockdep splat in an error path (diff)
downloadlinux-dev-65ddf45a3102916fb622c71f7af158b19d49dc7f.tar.xz
linux-dev-65ddf45a3102916fb622c71f7af158b19d49dc7f.zip
bcache: Fix a null ptr deref in journal replay
Signed-off-by: Kent Overstreet <kmo@daterainc.com>
Diffstat (limited to 'drivers/md/bcache/journal.c')
-rw-r--r--drivers/md/bcache/journal.c6
1 files changed, 5 insertions, 1 deletions
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 &&