Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3419608rwa; Tue, 23 Aug 2022 04:35:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR4F4THfhbyoZ2nJy2Va/rfnPcHyaboXxVnCcu84OZwnOor/A/rx/x//+OBBLRX1FrSgJ2VF X-Received: by 2002:a17:907:a057:b0:730:a2d8:d5ac with SMTP id gz23-20020a170907a05700b00730a2d8d5acmr16147014ejc.764.1661254119416; Tue, 23 Aug 2022 04:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661254119; cv=none; d=google.com; s=arc-20160816; b=Rw2gx0TyEwu9AVN7S6l5vZkLUz8MFAlWSdnuDj0xAiA7wkUmd4f9HDN7ue9BEfWAiH Z6JDyjLiSvA6CCM3ATlQGUbIRQZthD9RXltlQhUNorWe9z72udPq/XCAD1XL7bDuTcxb giMEyeZ8An9+dWP+fCG3tOCLNEFIMxD4fdo8CjEjg3BKqbXPqB2jjQsPYVBOwk1Z3egd Xl20mIS3TugJbvwJtP2RfQfKx3yz6VJ1stbOWbxQJVvRDRInpLoO6jz6wfa68TlX7cNh oCGhh1TYt6hNj9apawl2KgFJxlZukZ8N+9MXIefDp6XGUFvfCy4pdT0Z7piUwvwYX4WB lZXg== 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=1hrZL15XPGzMtSMAgKaDhw1fLW07l7MMSio+eUeB3QU=; b=dT9sJe+qNtrLr594bnTrPoRB6T6x4JVJi4jmZBlPzqDVoIVa1AsnGg9wcIR4VdOUnF zvS/L3Cd2M+3fcVeOC7r5jNvdpwGLeP2Oh1U16iDnHGXan17jEifWa1ZpqU3NWc0c/P0 lY3LjslOiCrXNJ3OpSQoXn3ADLUOXuLW3FYZUUvvENfFMoJz7jspCwGmKSAEv9u/fPTW mEeoOInDX4RhSo2cdk3uYYUCVNPh74h3hDsAlwhx7TZHaeP22RuD5MKNHVT8VVygKIC6 Ox5PPHxZDY5B5xv80VLQ76nDOCsW9Ka1WKQdVStnuJchtNXxQa59mCiOuAHKabvhpxA4 wsdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=oYdd6q0x; 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 m22-20020a509316000000b0043c77b9ca58si1909510eda.82.2022.08.23.04.28.12; Tue, 23 Aug 2022 04:28:39 -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=oYdd6q0x; 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 S1356174AbiHWKtr (ORCPT + 99 others); Tue, 23 Aug 2022 06:49:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52620 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1356535AbiHWKma (ORCPT ); Tue, 23 Aug 2022 06:42:30 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA4E18607C; Tue, 23 Aug 2022 02:09:59 -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 sin.source.kernel.org (Postfix) with ESMTPS id 3BBD9CE1B40; Tue, 23 Aug 2022 09:09:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 54B32C433C1; Tue, 23 Aug 2022 09:09:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661245796; bh=F2zdgkDF/XedTRQAuWZeDhYcXnbH11Mv0smvHCoCLAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oYdd6q0xCs7ooStLdbCmZFcqbVAxygmzOmO0Fr1T8fRbFc8M51RD2dg5aNB3/FIx0 xOANMTkNeRekYT24n0Jr2IwoUXeN5y1O3V9n+fESOpezvAloaV5EoR05zk/crJAZsa 3OPO9egKnqtoLpDlKQkf4rowklJ1rygKv8WFj+9o= 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 Subject: [PATCH 4.19 192/287] ext4: correct max_inline_xattr_value_size computing Date: Tue, 23 Aug 2022 10:26:01 +0200 Message-Id: <20220823080107.290379462@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080100.268827165@linuxfoundation.org> References: <20220823080100.268827165@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 commit c9fd167d57133c5b748d16913c4eabc55e531c73 upstream. 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: Greg Kroah-Hartman --- fs/ext4/inline.c | 3 +++ 1 file changed, 3 insertions(+) --- a/fs/ext4/inline.c +++ b/fs/ext4/inline.c @@ -34,6 +34,9 @@ static int get_max_inline_xattr_value_si 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 -