Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3081413rwb; Mon, 15 Aug 2022 17:40:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR4esdZcctuyxXMoY6Y8WXIbbCzg/p8xwGDVeDE/yyj6PofLm+sTw4G+eDAdofv+SwEuGQQX X-Received: by 2002:a17:902:e80a:b0:16f:52e:21b1 with SMTP id u10-20020a170902e80a00b0016f052e21b1mr19219307plg.161.1660610406223; Mon, 15 Aug 2022 17:40:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610406; cv=none; d=google.com; s=arc-20160816; b=HitYeU913ndElICY+Y/NAAaYl9O6Qw3YJTskF5TNclxzrQYMeXMlQdtiWSeCftU5Sc GK4Tnb2HInPbQjHsdZUai8HWspCvyyQOuv+8AMCjOKlUA8tm6ore36wkXxaNi+s4HDIr Jl4yXFPgBsJGyD61b/zbKBUzg5A1ybenKhFtKO/4XhY1NXePzb1y/HIAuf8NtqAxOhoT N3OX5lQOJGO46YglXYgdb/V2DxHLdKnaLD+jwePSDR0zBZZa8dWZdP2cZtog7PVmjBVu /4cLnw6iEOryTjzHyCj+TWych9h1kFm/qIdf1RG7JJLCpaBToot5DTHq2uN0cMDbTvQW 63fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=llh3Yl3yoiguAHtMeg4Xat1LPXQvrHnZ+GWRF/9ENWM=; b=PyxMWARZIPbXYHE00V2+7knLpylfaQhgmHbA2CFauxsSjAyDQ5KnT9nBiaW5a3wJql teq/aJa6xF4tSw+TdXNdkQ250iaVgVVMk8+t5pJNYThWcef7SG+cisH8dXzm+IINof+F l7xmvYf2endJNuU0D8ZqqbP6N6/N5PCZBbP//gqJkdrtSrOLcKzzQ9ZSNXYvY916PSQV WtcDtUVF+zwSG3QdPMAW1LA7OZ/ScBW7TceVcdzrmiGpwgHtoXmYl2get4tRqsWBW3Om rEL2E13aLxn82ADHn1EZmkJpkWKbOtRzYkbi2w2fA1cUAzyXT5ugJe4d7w/sIvmJEOY3 vraA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Uo0ppJNZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h19-20020a056a00219300b00525b292ccf0si12923437pfi.124.2022.08.15.17.39.55; Mon, 15 Aug 2022 17:40:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Uo0ppJNZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1353686AbiHOXiH (ORCPT + 99 others); Mon, 15 Aug 2022 19:38:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345797AbiHOXdt (ORCPT ); Mon, 15 Aug 2022 19:33:49 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 099B2150BBC; Mon, 15 Aug 2022 13:08:32 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 5CDDB60DE3; Mon, 15 Aug 2022 20:08:32 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 63FE9C433D6; Mon, 15 Aug 2022 20:08:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594111; bh=RmNKvD35h9Y3GLfCIV0/RmfmsLrHutDhGr23sfglY6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Uo0ppJNZVdKAcHxEFdJaH4ujDrgTYsh/NRZZ/Aw+OX6YTjj+aKrAYQUVAt4gvfjDy O5YHwxAUnmw1XJK0FrRtEUtElWBuVo+6qdgYlXGGiUa8uzVIOvop+ScEXfIRzB8opN OocK4PnPLi0n1Z006ELKxLGiWdxtskie54ZbRHKo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, stable@kernel.org, Baokun Li , "Ritesh Harjani (IBM)" , Jan Kara , Theodore Tso , Sasha Levin Subject: [PATCH 5.18 1058/1095] ext4: correct max_inline_xattr_value_size computing Date: Mon, 15 Aug 2022 20:07:37 +0200 Message-Id: <20220815180512.805385354@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Baokun Li [ Upstream commit c9fd167d57133c5b748d16913c4eabc55e531c73 ] If the ext4 inode does not have xattr space, 0 is returned in the get_max_inline_xattr_value_size function. Otherwise, the function returns a negative value when the inode does not contain EXT4_STATE_XATTR. Cc: stable@kernel.org Signed-off-by: Baokun Li Reviewed-by: Ritesh Harjani (IBM) Reviewed-by: Jan Kara Link: https://lore.kernel.org/r/20220616021358.2504451-4-libaokun1@huawei.com Signed-off-by: Theodore Ts'o Signed-off-by: Sasha Levin --- fs/ext4/inline.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/ext4/inline.c b/fs/ext4/inline.c index e9ef5cf30969..84fcd06a8e8a 100644 --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -35,6 +35,9 @@ static int get_max_inline_xattr_value_size(struct inode *inode, struct ext4_inode *raw_inode; int free, min_offs; + if (!EXT4_INODE_HAS_XATTR_SPACE(inode)) + return 0; + min_offs = EXT4_SB(inode->i_sb)->s_inode_size - EXT4_GOOD_OLD_INODE_SIZE - EXT4_I(inode)->i_extra_isize - -- 2.35.1