Received: by 2002:a05:6358:5282:b0:b5:90e7:25cb with SMTP id g2csp3408514rwa; Tue, 23 Aug 2022 04:24:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR4JYDKUqODe+85dYbC+/YvNrMPllgkAf7VGKuWOaqUe2DrBNki+ab4EIxD6RTBb+Px6ZHDA X-Received: by 2002:a17:902:c401:b0:16f:b59:85a7 with SMTP id k1-20020a170902c40100b0016f0b5985a7mr23834675plk.115.1661253860732; Tue, 23 Aug 2022 04:24:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661253860; cv=none; d=google.com; s=arc-20160816; b=0Rbb8kTLQdeaJ87mmZkVkzUbIq2I5lLSsS7A9DEtddqyiGFsWSY1LNU+V316askJn/ jBr+TpAK/wPs45YGoi94MU6iixTN8saIg6B7aLrIGo6CDJF0pECX+uFLyK98yol1HNQU b2rDxh6PNBEtFYDhwebFDyRcKCIcRRUjtwNyaFK4eBfmGImjscgX6zvsacoAX6P6fH2a sWbALvXsZbczqstB9v99Bih5y+ipDGd/KchDr8TgeLchRJH6vbpNsCAwr1wElm84TKF+ Pbda6s6kOAYvgnPQpX3AGVuzt6GN5qOmM8SbLsgmLQkv0clo/+nimbB93WG04bqbY7Ca uFrA== 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=LRKOALcUlEJl6kAZwo53N9TLQyMmhesxnE9HxmhtGLk=; b=HL9WvvZbPn6z3wrD8SyHSR4QVqqaF2B3LvpQ2r/2nqH0F/kY+6YTF/Jt1e4IKuCiiY v4fCV5zYb0IAgEdrrIbKcMq+wjdFEzodAEnxJxlbPehgNAeV8RsIYibU8PI0rqCP3uaR 1LoW9OofKjIY3supvvQw0weUJeS/7Blce5e7J4z3QB2paOYDBpNZtxXWujaHnufkWNFq TPz3vWUph2E6fIDJNXazDMFwX/t6irBPiAYBk1JrLjNtnTj+7PbNg9duhqUbvInDhCtZ hOGJYqfcG45U7X8EcjHErruzxmMHAdr538R2ndC+TmZb5P7I3BBXKjXG+K8b69ptPZec qRrw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=FHcv5Cpw; 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 m6-20020a654386000000b0042971e401e3si16178042pgp.307.2022.08.23.04.24.09; Tue, 23 Aug 2022 04:24:20 -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=FHcv5Cpw; 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 S243673AbiHWKHN (ORCPT + 99 others); Tue, 23 Aug 2022 06:07:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43886 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352409AbiHWKBw (ORCPT ); Tue, 23 Aug 2022 06:01:52 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 28DB81408A; Tue, 23 Aug 2022 01:49:36 -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 82C736123D; Tue, 23 Aug 2022 08:49:35 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 7600EC433D6; Tue, 23 Aug 2022 08:49:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661244574; bh=fMHn/Vf6sz9I5BG9XFOTBqc05WPfoxjFlUueGrdfOEI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FHcv5Cpwutkflnnd1wgE7PkI2tV4BZI1YSTb0ki3OrRYx15wq9t35AcK7pTWeZ09+ Tmj7HCNtjzMv8R5bKt8gvA7tPcRwkrPmunmgjTWD3hwIeAkCGyZ5XvzjUE9+nIvTGA E2S5BrFaviElXxBBr638gD6zUR+RDz5HVxm1XPoU= 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.14 157/229] ext4: correct max_inline_xattr_value_size computing Date: Tue, 23 Aug 2022 10:25:18 +0200 Message-Id: <20220823080059.288334047@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220823080053.202747790@linuxfoundation.org> References: <20220823080053.202747790@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 @@ -40,6 +40,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 -