From nobody Sun Dec 14 05:53:27 2025 Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0838221C9F9 for ; Sat, 13 Dec 2025 06:43:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765608193; cv=none; b=Ld30xupWeBYAH5N6jRlfVcEFa0GEna0Cpx8anEeBTVZ49rRX5uXw+UzAv3ORG/uI3opy3c09h+5ggNWGy4XBecQ+4mJbOqRnD1DTvRrZxyzzXGtcBwpPGkLKgkZtE0d0GJJISte2OrJWbeWTBYcHJ4TNmHfu80PykVwSQwf0wk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765608193; c=relaxed/simple; bh=C3lSCMOJht2Bq03lxV/OkgMVuaU29ien5FqxfFGYWjk=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OWqPn8+hMX7PTpPvSRHWA7fYRBO5IBHXwZayPEnwYiYwkyosY5iJbC9bI0WFnB4HT4QpD5NxPN7AzKySMvu30j7Xq4BR0FG7I9cCPeEUdpqZcw+Ke1urhazAz+KiJDVEuioaxhoeyt7NznVMD+1qnkt5LaL34jv4NlbxafKAEeI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=ECA9/Siz; arc=none smtp.client-ip=209.85.210.177 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="ECA9/Siz" Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-7b8bbf16b71so2006340b3a.2 for ; Fri, 12 Dec 2025 22:43:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765608191; x=1766212991; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=BRpSV6RgpSXu2TxYA6JTWEB1NQC8YeikIKjU+s/DpyA=; b=ECA9/Sizpv3LkEY1YkLzipx4ygrau05W0vroe4HSkBv+P59980nePssvzq9DUYrlBc bz/vTiRfpdI0TRzdQgEYtVEK65zYKSzdw9IWJcOtgR2xqdq9/O7KIcjMOcSl2vA+vJbF sLcYem8Qp3MW1iLsFT8caLW0YQAHzbx9tZcabcHbRuzXUJlhrnwNN3BV4/RQVoGr0CKe WW+3lBHqWPkLO5CaN6do8uuze1OJ0Ktr2efn5BcGP5lB4A5lQT96hQWadWWxKSyesjmR 18V91kZOgRC6dIncrRBnviSYnS9Ec7Qxokz7SsKz1xtuHa7ErKp5geWGp3MSFGjaKS15 DJNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765608191; x=1766212991; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=BRpSV6RgpSXu2TxYA6JTWEB1NQC8YeikIKjU+s/DpyA=; b=hxIy/+c8vf2zzVSKcBbgxpzPAQrGU8Oflrjn4cbScxt0MrRYMFpJ6/QYMx0Oy9oOCQ Jc2ui2jSh6iTAzle1CrtR+0N1xOz390Sffdz4WEojxjP1C2OCsk2sBqHKcY1mQWKuSyt WZfWmokOXYL6Q87F5vdwEjA9NkrqjExvgfZ5+B7w/HJKZ22w1Btp/BMVE0E3IeY3fpLC gXVcFPtFyPBKw1lToz4BQ6YzAFFogA2/ktmhotvyXyhAFvOTmeKIsABfW8CZakukSsVp 0mbsf06oTuSDUI681Y3QDNFLNMvfrdifUBjjF9QyDT+cGK4Zj6ID3LEIq/cWvAFOM0RB aN5w== X-Forwarded-Encrypted: i=1; AJvYcCXGKPPJCufxeeLgSyvLobpJAeTZ72tCi+mTlroNOGtE6tzjphsPXyrQzESHyZU4FKRnqtkincBV08+KrpA=@vger.kernel.org X-Gm-Message-State: AOJu0YyoovwNpPmBa8uRO+MHgjXH8KZdCmR0RB28DYlZbsBB/Y4fvnJ4 nNQTUXEOQC/J36zxR5IEfuA3vHeAztzpya4QVwwpBAXfKghtH29W7hsd1+ypZRht X-Gm-Gg: AY/fxX68oJyMyD1bu3uODrpuDMWRhLwlpI9V+922zLIWHzM21GEqfha6iQ2IehFX05P My/M5I9S19fSs5jsdWFn6h95MDs1fxpqeaYOhJYAQTcPLHoi32tAQFGJGgV91sAuxBXLGO4grTe QW9YdvUAWpHsA2iMJQI7Jgqa7FiyAFS+KWI+7RhdcCH+vk901zcIIUxEldh2tP+PHpFCXeAwZ/y pRIzm1t9RB7Zun7vpP3kMbPTNXz1p280TpfA+9dlIE7AMDHa6p9FHie9+8B/jEhubqRI/QL1L/g e6/F54hPAnosjaxW4oqkow5xNC86c5ya7AYtK+kl6ezAsbLKmpvRZuG6ZG/b4qYgQDDnk+bpvZ0 g1RPc/BCfbUV5KiaYIQygZ+MpR9kOf98jPs3E20CdGMV41YQMucZCb51NoFLFRsx/1mybKWhF7g EfDRIzQhEl5AOBJVRy4cxX161b4/G5pZnFEx/OAWMb0aepfxzrcYg97cbzT5J39awrLmE= X-Google-Smtp-Source: AGHT+IHJvu2hbqmMjZCT5aKA7vpe4OhpcjZqMpzAEvy73wqndlRBnM2g2lfzG04dZlot5WhTKjYsSg== X-Received: by 2002:a05:6a00:bc8d:b0:7ad:9e8a:1f72 with SMTP id d2e1a72fcca58-7f66f9f2ee6mr3514893b3a.14.1765608191224; Fri, 12 Dec 2025 22:43:11 -0800 (PST) Received: from deepanshu-kernel-hacker.. ([2405:201:682f:389d:f267:ca6a:aede:ba4d]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7f4c4aa9b94sm6993180b3a.37.2025.12.12.22.43.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 12 Dec 2025 22:43:10 -0800 (PST) From: Deepanshu Kartikey To: agruenba@redhat.com Cc: gfs2@lists.linux.dev, linux-kernel@vger.kernel.org, Deepanshu Kartikey , syzbot+046b605f01802054bff0@syzkaller.appspotmail.com Subject: [PATCH] gfs2: Fix slab-use-after-free in gfs2_qd_dispose Date: Sat, 13 Dec 2025 12:13:04 +0530 Message-ID: <20251213064304.148987-1-kartikey406@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" In gfs2_qd_dispose(), the quota data (qd) is removed from qd_list and qd_hlist, but not removed from the LRU list before call_rcu() is invoked to free the object. This can lead to a use-after-free when the shrinker (gfs2_qd_shrink_scan) runs concurrently with filesystem unmount. The shrinker attempts to walk the LRU list via list_lru_shrink_walk(), accessing quota data that has already been freed by the RCU callback (gfs2_qd_dealloc). Fix this by calling list_lru_del_obj() to remove the quota data from the LRU list before scheduling the RCU callback. Fixes: faada74a90563 ("gfs2: Factor out duplicate quota data disposal code") Reported-by: syzbot+046b605f01802054bff0@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D046b605f01802054bff0 Signed-off-by: Deepanshu Kartikey --- Note: Only compile-tested. No reproducer available from syzbot. --- fs/gfs2/quota.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/gfs2/quota.c b/fs/gfs2/quota.c index b1692f12a602..85b0b5105b4b 100644 --- a/fs/gfs2/quota.c +++ b/fs/gfs2/quota.c @@ -125,6 +125,8 @@ static void gfs2_qd_dispose(struct gfs2_quota_data *qd) hlist_bl_del_rcu(&qd->qd_hlist); spin_unlock_bucket(qd->qd_hash); =20 + list_lru_del_obj(&gfs2_qd_lru, &qd->qd_lru); + if (!gfs2_withdrawn(sdp)) { gfs2_assert_warn(sdp, !qd->qd_change); gfs2_assert_warn(sdp, !qd->qd_slot_ref); --=20 2.43.0