From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from jabberwock.ucw.cz (jabberwock.ucw.cz [46.255.230.98]) (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 50E0C250EA for ; Tue, 16 Jan 2024 20:46:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.255.230.98 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705438017; cv=none; b=WjofGofTPpVKbxlBysHBX8jHslUYn5AYlXC0LRFayj2RGVuz2koarm3RtHPZmqxge4tUwfNTj+ioN6OeuWSuqBXzUZjEmUwoL7jZjEOZ54waKptK3JK4NLaLc6QSlAYaiIu9OhVLN2W0szpJPV8Xst0q5YzLqi6EPO0aK53QQJI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705438017; c=relaxed/simple; bh=ospxE6Ywnr4fHa2us3RDJ0glfrJaABYoOmOTOUL9jbM=; h=Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; b=SJymId8BDwf2bnZamH3/DKcLN68NozXAVR2QGjVFwZ2Kh/D1mucG/54NEp3GQCyG3Jct7wN0UWZSOaut1tsXuExX6q95hTaiXTti50cXFgLJdybALoA2AYs2uHjVB+JxWE/Jy3TDYaDXIztjEQJWuhQnuGo+fd9RRxiTY394PtQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=denx.de; spf=fail smtp.mailfrom=denx.de; arc=none smtp.client-ip=46.255.230.98 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=denx.de Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=denx.de Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id DE19D1C007B; Tue, 16 Jan 2024 21:46:54 +0100 (CET) Date: Tue, 16 Jan 2024 21:46:54 +0100 From: Pavel Machek To: Sasha Levin Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Andreas Gruenbacher , gfs2@lists.linux.dev Subject: Re: [PATCH AUTOSEL 4.19 11/12] gfs2: Refcounting fix in gfs2_thaw_super Message-ID: References: <20240116002817.216837-1-sashal@kernel.org> <20240116002817.216837-11-sashal@kernel.org> Precedence: bulk X-Mailing-List: gfs2@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="w5MB4wnlx5osspG+" Content-Disposition: inline In-Reply-To: <20240116002817.216837-11-sashal@kernel.org> --w5MB4wnlx5osspG+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Andreas Gruenbacher >=20 > [ Upstream commit 4e58543e7da4859c4ba61d15493e3522b6ad71fd ] >=20 > It turns out that the .freeze_super and .thaw_super operations require > the filesystem to manage the superblock refcount itself. We are using > the freeze_super() and thaw_super() helpers to mostly take care of that > for us, but this means that the superblock may no longer be around by > when thaw_super() returns, and gfs2_thaw_super() will then access freed > memory. Take an extra superblock reference in gfs2_thaw_super() to fix > that. Patch was broken during backport. > +++ b/fs/gfs2/super.c > @@ -1013,6 +1013,7 @@ static int gfs2_freeze(struct super_block *sb) > goto out; > } > =20 > + atomic_inc(&sb->s_active); > for (;;) { > error =3D gfs2_lock_fs_check_clean(sdp, &sdp->sd_freeze_gh); > if (!error) > @@ -1034,6 +1035,7 @@ static int gfs2_freeze(struct super_block *sb) > error =3D 0; > out: > mutex_unlock(&sdp->sd_freeze_mutex); > + deactivate_super(sb); > return error; > } Notice the goto out? That now jumps around the atomic_inc, but we still do decrease. This will break 4.19, please fix or drop. BR, Pavel --=20 DENX Software Engineering GmbH, Managing Director: Erika Unter HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany --w5MB4wnlx5osspG+ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCZabrPgAKCRAw5/Bqldv6 8vXvAJ4xPIsInQY8b9aJf+YojgyqIbnsEgCfdfWZWyfqcu9gi+6i7xz/o4JIdnY= =u5qo -----END PGP SIGNATURE----- --w5MB4wnlx5osspG+--