From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7DF8A168D1 for ; Mon, 8 May 2023 11:02:03 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D7C58C433EF; Mon, 8 May 2023 11:02:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1683543723; bh=UGngMKOWMknlMD2mtxuq6bjR3m9AyEs+n6Lp8xOnk2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=akCi8SISeyNknKGi2vjIYz257sTTFdLq0z2HXkLzszMTDe+mArHKCBSa+aWWpTynO Smahf8cXnm0sEVgw1B17bIThla20x2hyffGFqO5zEhsMunbTAa+VcYOPugjz8AGK4K 0ILM0kujZol/hJgiurgJHHN3otPkEm9SqaG7fBy8= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jingbo Xu , Gao Xiang , Chao Yu , Sasha Levin Subject: [PATCH 6.3 149/694] erofs: fix potential overflow calculating xattr_isize Date: Mon, 8 May 2023 11:39:44 +0200 Message-Id: <20230508094437.278666345@linuxfoundation.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230508094432.603705160@linuxfoundation.org> References: <20230508094432.603705160@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Jingbo Xu [ Upstream commit 1b3567a1969b26f709d82a874498c0754ea841c3 ] Given on-disk i_xattr_icount is 16 bits and xattr_isize is calculated from i_xattr_icount multiplying 4, xattr_isize has a theoretical maximum of 256K (64K * 4). Thus declare xattr_isize as unsigned int to avoid the potential overflow. Fixes: bfb8674dc044 ("staging: erofs: add erofs in-memory stuffs") Signed-off-by: Jingbo Xu Reviewed-by: Gao Xiang Reviewed-by: Chao Yu Link: https://lore.kernel.org/r/20230414061810.6479-1-jefflexu@linux.alibaba.com Signed-off-by: Gao Xiang Signed-off-by: Sasha Levin --- fs/erofs/internal.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h index 42444b593cf16..9ebb87e342dcb 100644 --- a/fs/erofs/internal.h +++ b/fs/erofs/internal.h @@ -307,7 +307,7 @@ struct erofs_inode { unsigned char datalayout; unsigned char inode_isize; - unsigned short xattr_isize; + unsigned int xattr_isize; unsigned int xattr_shared_count; unsigned int *xattr_shared_xattrs; -- 2.39.2