From nobody Thu Dec 18 04:13:48 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1FE11C32771 for ; Mon, 26 Sep 2022 11:35:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238063AbiIZLfg (ORCPT ); Mon, 26 Sep 2022 07:35:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238173AbiIZLeU (ORCPT ); Mon, 26 Sep 2022 07:34:20 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8A386E2E2; Mon, 26 Sep 2022 03:43:24 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id ED922B80972; Mon, 26 Sep 2022 10:43:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5EB5AC433D7; Mon, 26 Sep 2022 10:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188995; bh=xBh58Z4hP5/JW9QmDnwWHRoFmnAs6QTEtY4ElTwJe8c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=CLFPJNX+ulF7UyOmBekEF2bM8hWfZsOUAtB+11ZxQ3LDxDQIF08h0zzajxzCZ+W7X d+63tn3nAsZgUylPASOD6wa0BRf5NGA5vuKE4BcgE8z24hrX4oepY2dDYn+8ZKEDy5 9uknRYLf/CLxEoiES/8ji0RGplyV/5PIjNg9IiEw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yuezhang Mo , Andy Wu , Aoyama Wataru , Sungjong Seo , Namjae Jeon Subject: [PATCH 5.19 040/207] exfat: fix overflow for large capacity partition Date: Mon, 26 Sep 2022 12:10:29 +0200 Message-Id: <20220926100808.419018985@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100806.522017616@linuxfoundation.org> References: <20220926100806.522017616@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" From: Yuezhang Mo commit 2e9ceb6728f1dc2fa4b5d08f37d88cbc49a20a62 upstream. Using int type for sector index, there will be overflow in a large capacity partition. For example, if storage with sector size of 512 bytes and partition capacity is larger than 2TB, there will be overflow. Fixes: 1b6138385499 ("exfat: reduce block requests when zeroing a cluster") Cc: stable@vger.kernel.org # v5.19+ Signed-off-by: Yuezhang Mo Reviewed-by: Andy Wu Reviewed-by: Aoyama Wataru Acked-by: Sungjong Seo Signed-off-by: Namjae Jeon Signed-off-by: Greg Kroah-Hartman --- fs/exfat/fatent.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/fs/exfat/fatent.c b/fs/exfat/fatent.c index ee0b7cf51157..41ae4cce1f42 100644 --- a/fs/exfat/fatent.c +++ b/fs/exfat/fatent.c @@ -270,8 +270,7 @@ int exfat_zeroed_cluster(struct inode *dir, unsigned in= t clu) struct super_block *sb =3D dir->i_sb; struct exfat_sb_info *sbi =3D EXFAT_SB(sb); struct buffer_head *bh; - sector_t blknr, last_blknr; - int i; + sector_t blknr, last_blknr, i; =20 blknr =3D exfat_cluster_to_sector(sbi, clu); last_blknr =3D blknr + sbi->sect_per_clus; --=20 2.37.3