From nobody Sat Feb 7 11:05:00 2026 Received: from air.basealt.ru (air.basealt.ru [193.43.8.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 92BA8206F37; Fri, 10 Jan 2025 18:32:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.43.8.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736533952; cv=none; b=Ws8/O0PxNiODqrp1rjDn3IImTxh0q3qNq7wNwQCBG9nGKsdpRTkQ01Xy8cZ9w+btcDoks/M4o3d4XdcCb/+Xaly0TMI0D/qLf1fOGKwCGc07OO2EfetFcxEiBEWGqyjBp/mYVzFH1oO7VXjaJYImHs1c31FBKM89NZaiYqx/ZRU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736533952; c=relaxed/simple; bh=As80Mt2rdNKYY6TChTefkBCZAsji4oShiG/EViFW1R0=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ERhayzE4RY6IgVtK33MRBhKAGZMw98RheX5ypuU5rnn0FqD4lemix7Hmg9scqUl5nVFMsdVeEv6VKGn0h2KUcuROWgfPjk/SIqmuiYVpe98ETEBRYu9mbPRhunlpZQjI77XV/bZTocogoW/chNjvIfxdZcgiCSJvxRJVXn2Z70E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=altlinux.org; spf=pass smtp.mailfrom=altlinux.org; arc=none smtp.client-ip=193.43.8.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=altlinux.org Received: from altlinux.ipa.basealt.ru (unknown [178.76.204.78]) by air.basealt.ru (Postfix) with ESMTPSA id 10242233A6; Fri, 10 Jan 2025 21:32:27 +0300 (MSK) From: Vasiliy Kovalev To: stable@vger.kernel.org Cc: Bob Peterson , Andreas Gruenbacher , linux-kernel@vger.kernel.org, Juntong Deng , Greg Kroah-Hartman , Clayton Casciato , lvc-project@linuxtesting.org, kovalev@altlinux.org Subject: [PATCH 5.10 1/2] gfs2: make function gfs2_make_fs_ro() to void type Date: Fri, 10 Jan 2025 21:32:12 +0300 Message-Id: <20250110183213.105051-2-kovalev@altlinux.org> X-Mailer: git-send-email 2.33.8 In-Reply-To: <20250110183213.105051-1-kovalev@altlinux.org> References: <20250110183213.105051-1-kovalev@altlinux.org> 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" From: Yang Li commit eb602521f43876b3f76c4686de596c9804977228 upstream. It fixes the following warning detected by coccinelle: ./fs/gfs2/super.c:592:5-10: Unneeded variable: "error". Return "0" on line 628 Reported-by: Abaci Robot Signed-off-by: Yang Li Signed-off-by: Bob Peterson Signed-off-by: Andreas Gruenbacher Signed-off-by: Vasiliy Kovalev --- fs/gfs2/ops_fstype.c | 4 +--- fs/gfs2/super.c | 10 ++-------- fs/gfs2/super.h | 2 +- fs/gfs2/util.c | 2 +- 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index 648f7336043f6a..9fcb86d1a922a8 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -1564,9 +1564,7 @@ static int gfs2_reconfigure(struct fs_context *fc) return -EINVAL; =20 if (fc->sb_flags & SB_RDONLY) { - error =3D gfs2_make_fs_ro(sdp); - if (error) - errorfc(fc, "unable to remount read-only"); + gfs2_make_fs_ro(sdp); } else { error =3D gfs2_make_fs_rw(sdp); if (error) diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index 8cf4ef61cdc41d..a9e3956a5b4698 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c @@ -555,9 +555,8 @@ static void gfs2_dirty_inode(struct inode *inode, int f= lags) * Returns: errno */ =20 -int gfs2_make_fs_ro(struct gfs2_sbd *sdp) +void gfs2_make_fs_ro(struct gfs2_sbd *sdp) { - int error =3D 0; int log_write_allowed =3D test_bit(SDF_JOURNAL_LIVE, &sdp->sd_flags); =20 gfs2_flush_delete_work(sdp); @@ -592,8 +591,6 @@ int gfs2_make_fs_ro(struct gfs2_sbd *sdp) =20 if (!log_write_allowed) sdp->sd_vfs->s_flags |=3D SB_RDONLY; - - return error; } =20 /** @@ -605,7 +602,6 @@ int gfs2_make_fs_ro(struct gfs2_sbd *sdp) static void gfs2_put_super(struct super_block *sb) { struct gfs2_sbd *sdp =3D sb->s_fs_info; - int error; struct gfs2_jdesc *jd; =20 /* No more recovery requests */ @@ -626,9 +622,7 @@ static void gfs2_put_super(struct super_block *sb) spin_unlock(&sdp->sd_jindex_spin); =20 if (!sb_rdonly(sb)) { - error =3D gfs2_make_fs_ro(sdp); - if (error) - gfs2_io_error(sdp); + gfs2_make_fs_ro(sdp); } WARN_ON(gfs2_withdrawing(sdp)); =20 diff --git a/fs/gfs2/super.h b/fs/gfs2/super.h index c9fb2a65418137..c61586ca61ff9b 100644 --- a/fs/gfs2/super.h +++ b/fs/gfs2/super.h @@ -30,7 +30,7 @@ extern int gfs2_lookup_in_master_dir(struct gfs2_sbd *sdp= , char *filename, struct gfs2_inode **ipp); =20 extern int gfs2_make_fs_rw(struct gfs2_sbd *sdp); -extern int gfs2_make_fs_ro(struct gfs2_sbd *sdp); +extern void gfs2_make_fs_ro(struct gfs2_sbd *sdp); extern void gfs2_online_uevent(struct gfs2_sbd *sdp); extern int gfs2_statfs_init(struct gfs2_sbd *sdp); extern void gfs2_statfs_change(struct gfs2_sbd *sdp, s64 total, s64 free, diff --git a/fs/gfs2/util.c b/fs/gfs2/util.c index d11152dedb803e..00cb912b4744c4 100644 --- a/fs/gfs2/util.c +++ b/fs/gfs2/util.c @@ -161,7 +161,7 @@ static void signal_our_withdraw(struct gfs2_sbd *sdp) ret =3D 0; } if (!ret) - ret =3D gfs2_make_fs_ro(sdp); + gfs2_make_fs_ro(sdp); gfs2_freeze_unlock(&freeze_gh); } =20 --=20 2.33.8 From nobody Sat Feb 7 11:05:00 2026 Received: from air.basealt.ru (air.basealt.ru [193.43.8.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D89B9207E12; Fri, 10 Jan 2025 18:32:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.43.8.18 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736533952; cv=none; b=RrDUSdHhwLlTCYGqp8oqCk1tzvtwtbfHbqYwSL8fHx21kcOc5tqulEpiRlthytW6hy5cXDON6zfBX8B2AWaLyaI4wt90REoIUuDIuUvu6frFUyzfWrEuZQfOSdnl5zBLATmnqmYdRZAztF7qRBPcf9gASAThZ2tf9yR0qZ+8gFA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1736533952; c=relaxed/simple; bh=Ezk6YNVsorymjF+R0CV5it+emPw8MjhKEyF6TGSOB20=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CjfvmBD9AO7kwqGwrnqB0tZIeBIQv/zhlsNOAdHnBkHyNcZc1yQ/dkmVcaGFipNlQBrMk1COTmqyiqsLTZ2/oaX12eCf6zXiyfgellUzaEM1d29ioiccDx/rhCD3pT5RARxy1hF7f5+WQQ0oe0slUh5cQtq15tPiHomZpKx42QU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=altlinux.org; spf=pass smtp.mailfrom=altlinux.org; arc=none smtp.client-ip=193.43.8.18 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=altlinux.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=altlinux.org Received: from altlinux.ipa.basealt.ru (unknown [178.76.204.78]) by air.basealt.ru (Postfix) with ESMTPSA id A6716233A7; Fri, 10 Jan 2025 21:32:27 +0300 (MSK) From: Vasiliy Kovalev To: stable@vger.kernel.org Cc: Bob Peterson , Andreas Gruenbacher , linux-kernel@vger.kernel.org, Juntong Deng , Greg Kroah-Hartman , Clayton Casciato , lvc-project@linuxtesting.org, kovalev@altlinux.org Subject: [PATCH 5.10 2/2] gfs2: Fix slab-use-after-free in gfs2_qd_dealloc Date: Fri, 10 Jan 2025 21:32:13 +0300 Message-Id: <20250110183213.105051-3-kovalev@altlinux.org> X-Mailer: git-send-email 2.33.8 In-Reply-To: <20250110183213.105051-1-kovalev@altlinux.org> References: <20250110183213.105051-1-kovalev@altlinux.org> 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" From: Juntong Deng commit bdcb8aa434c6d36b5c215d02a9ef07551be25a37 upstream. In gfs2_put_super(), whether withdrawn or not, the quota should be cleaned up by gfs2_quota_cleanup(). Otherwise, struct gfs2_sbd will be freed before gfs2_qd_dealloc (rcu callback) has run for all gfs2_quota_data objects, resulting in use-after-free. Also, gfs2_destroy_threads() and gfs2_quota_cleanup() is already called by gfs2_make_fs_ro(), so in gfs2_put_super(), after calling gfs2_make_fs_ro(), there is no need to call them again. Reported-by: syzbot+29c47e9e51895928698c@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D29c47e9e51895928698c Signed-off-by: Juntong Deng Signed-off-by: Andreas Gruenbacher Signed-off-by: Greg Kroah-Hartman Signed-off-by: Clayton Casciato (cherry picked from commit 7ad4e0a4f61c57c3ca291ee010a9d677d0199fba) Signed-off-by: Vasiliy Kovalev --- fs/gfs2/super.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/gfs2/super.c b/fs/gfs2/super.c index a9e3956a5b4698..d4399bec7b5b12 100644 --- a/fs/gfs2/super.c +++ b/fs/gfs2/super.c @@ -623,6 +623,8 @@ static void gfs2_put_super(struct super_block *sb) =20 if (!sb_rdonly(sb)) { gfs2_make_fs_ro(sdp); + } else { + gfs2_quota_cleanup(sdp); } WARN_ON(gfs2_withdrawing(sdp)); =20 --=20 2.33.8