diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index 171b2713d2e5..25f257e41a96 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -109,9 +109,11 @@ static inline void spin_unlock_bucket(unsigned int hash) static void gfs2_qd_dealloc(struct rcu_head *rcu) { struct gfs2_quota_data *qd = container_of(rcu, struct gfs2_quota_data, qd_rcu); - struct gfs2_sbd *sdp = qd->qd_sbd; + struct gfs2_sbd *sdp = READ_ONCE(qd->qd_sbd); kmem_cache_free(gfs2_quotad_cachep, qd); + if (!sdp) + return; if (atomic_dec_and_test(&sdp->sd_quota_count)) wake_up(&sdp->sd_kill_wait); }