From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail.parknet.co.jp (mail.parknet.co.jp [210.171.160.6]) (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 7BFD13F8EB7 for ; Wed, 3 Jun 2026 06:20:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.171.160.6 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780467646; cv=none; b=P9kUNoPhSEK872sA0ulf0o0LrYhGw4G27KbURDTbzdBGHA6J8GLge3Y1KZO+RGfHAxuzS/tcWTgfNIcifPTzlmGmC3MraZkmWPMJ+cxuhlRh00Hy5dCwYEvePEQ21aD4H6COXGJFLC869RvDhVGZvT8dOw9ZOwG14NnD0MwpU30= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780467646; c=relaxed/simple; bh=OPquFvVVhP76HdU+Kc03CSK6hut4nRU9bs1+JiG7RdA=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=XWQxt5HibL0Ma2Lx82oqecVkhM6WpPQuhqZZhmtTwjz+RnAQajLKlLatQK9S0T0eYgHQkH+Dwv+rkrqkA/iaGUbkZJ8e0Evcj/2r+KVh2jJYvunxr9F06mBaP0RB0WxM1syj4nqybnvDo82s3qUwGrmtrYxfAECtawyCaId+9/A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mail.parknet.co.jp; spf=pass smtp.mailfrom=parknet.co.jp; dkim=pass (2048-bit key) header.d=parknet.co.jp header.i=@parknet.co.jp header.b=pV1wf4Wa; dkim=permerror (0-bit key) header.d=parknet.co.jp header.i=@parknet.co.jp header.b=DJ4HhgOQ; arc=none smtp.client-ip=210.171.160.6 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=mail.parknet.co.jp Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=parknet.co.jp Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=parknet.co.jp header.i=@parknet.co.jp header.b="pV1wf4Wa"; dkim=permerror (0-bit key) header.d=parknet.co.jp header.i=@parknet.co.jp header.b="DJ4HhgOQ" Received: from ibmpc.myhome.or.jp (server.parknet.ne.jp [210.171.168.39]) by mail.parknet.co.jp (Postfix) with ESMTPSA id 50FCC26F767C; Wed, 3 Jun 2026 15:20:42 +0900 (JST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=parknet.co.jp; s=20250114; t=1780467642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DzlXnnovpT22fsxE3zCXFFw2DRG7+dXgk6kMEerTJiA=; b=pV1wf4WaCehuR7senx7EBKUr3ms0aVL8k2tCwt+zvQ1LgmloejsYd8mBKUDvvDzQkNY0jN +E5pQfG90VptX9IQQ6uQzXisiTWmAE4Ay821aXAll8WeunxsPd1X3tWDSJUfb/dMdz0qh6 swTEREKlt0OHVQq4NLNJlNdYFweLkG5KFgp+q4VDhy3RfdTUIEpjUdJZ2tBYizuAfhQwsI PXusOXIQIt/jAA2Ik/rVN1rHmiwik58wZXkkdmmeleZb2qo5jEYmvDWYHu0ClFE0NLuBJN YVDEuD35kbk726RXzD3lgluZQmiQ0fFm1nRNHxIiKuPo3Qk+bSskddxNGQwkKQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=parknet.co.jp; s=20250114-ed25519; t=1780467642; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=DzlXnnovpT22fsxE3zCXFFw2DRG7+dXgk6kMEerTJiA=; b=DJ4HhgOQ4s2XRR0JnE3u0iplxynqcBtgD8Bm0PfRxyFzh7Aoh8U3mG5+OpmVsqjHuZ0KcH Fv/4qWUb3IVL5fBg== Received: from devron.myhome.or.jp (devron.myhome.or.jp [192.168.0.3]) by ibmpc.myhome.or.jp (Postfix) with ESMTPS id B2A7CE00222; Wed, 03 Jun 2026 15:20:41 +0900 (JST) Received: by devron.myhome.or.jp (Postfix, from userid 1000) id A26FF2200151; Wed, 03 Jun 2026 15:20:41 +0900 (JST) From: OGAWA Hirofumi To: Andrew Morton Cc: Ren Wei , linux-kernel@vger.kernel.org, Yuan Tan , Yifan Wu , Juefei Pu , Xin Liu , Yemu Lu Subject: Re: [PATCH 1/1] fat: restore original value when fat_ent_write failed In-Reply-To: <20260525085649.781643-1-n05ec@lzu.edu.cn> References: <20260525085649.781643-1-n05ec@lzu.edu.cn> Date: Wed, 03 Jun 2026 15:20:41 +0900 Message-ID: <87pl28i1qe.fsf@mail.parknet.co.jp> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Ren Wei writes: > From: Yemu Lu > > fat_ent_write() may have committed the new link to the primary FAT > but then failed on the mirror copy, leaving the chain pointing to > new_dclus even though the caller will free it. Restore the original > value to keep the chain consistent. > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Cc: stable@kernel.org > Reported-by: Yuan Tan > Reported-by: Yifan Wu > Reported-by: Juefei Pu > Reported-by: Xin Liu > Signed-off-by: Yemu Lu > Signed-off-by: Ren Wei Acked-by: OGAWA Hirofumi > --- > fs/fat/misc.c | 4 ++++ > 1 file changed, 4 insertions(+) > > diff --git a/fs/fat/misc.c b/fs/fat/misc.c > index 3027ef53af21..710e2e6aa1a5 100644 > --- a/fs/fat/misc.c > +++ b/fs/fat/misc.c > @@ -133,7 +133,11 @@ int fat_chain_add(struct inode *inode, int new_dclus, int nr_cluster) > ret = fat_ent_read(inode, &fatent, last); > if (ret >= 0) { > int wait = inode_needs_sync(inode); > + int old = ret; > + > ret = fat_ent_write(inode, &fatent, new_dclus, wait); > + if (ret < 0) > + fat_ent_write(inode, &fatent, old, wait); > fatent_brelse(&fatent); > } > if (ret < 0) -- OGAWA Hirofumi