Skip to content

Commit 22150a7

Browse files
author
Andreas Gruenbacher
committed
gfs2: Fix slab-use-after-free in qd_put
Commit a475c5d ("gfs2: Free quota data objects synchronously") started freeing quota data objects during filesystem shutdown instead of putting them back onto the LRU list, but it failed to remove these objects from the LRU list, causing LRU list corruption. This caused use-after-free when the shrinker (gfs2_qd_shrink_scan) tried to access already-freed objects on the LRU list. Fix this by removing qd objects from the LRU list before freeing them in qd_put(). Initial fix from Deepanshu Kartikey <kartikey406@gmail.com>. Fixes: a475c5d ("gfs2: Free quota data objects synchronously") Reported-by: syzbot+046b605f01802054bff0@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=046b605f01802054bff0 Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
1 parent 0ec49e7 commit 22150a7

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

fs/gfs2/quota.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ static void qd_put(struct gfs2_quota_data *qd)
334334
lockref_mark_dead(&qd->qd_lockref);
335335
spin_unlock(&qd->qd_lockref.lock);
336336

337+
list_lru_del_obj(&gfs2_qd_lru, &qd->qd_lru);
337338
gfs2_qd_dispose(qd);
338339
return;
339340
}

0 commit comments

Comments
 (0)