From nobody Wed Dec 17 15:09:08 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 90F80C77B73 for ; Wed, 19 Apr 2023 06:46:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232262AbjDSGqb (ORCPT ); Wed, 19 Apr 2023 02:46:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55950 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229821AbjDSGq2 (ORCPT ); Wed, 19 Apr 2023 02:46:28 -0400 Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EE1A4C20 for ; Tue, 18 Apr 2023 23:46:27 -0700 (PDT) Received: by mail-lj1-x22d.google.com with SMTP id 38308e7fff4ca-2a8b62cfaceso25415631fa.2 for ; Tue, 18 Apr 2023 23:46:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1681886785; x=1684478785; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=bLzM2+BlpNCdmMN6XaJsZFT5iwLTV8yl3YYwzAnzcTg=; b=uABhSHxVmrtvg24dScLCKMHy0Au3Gc5n4nSNf40v0MmTTFCBDPc+2FfIPwCoYQCcwZ Yss0f5vVUBgwQYLjgMIUrE5/Jy0Zw+r63ZyqzTK6dm0kVhJ3MBCOg+2WpKjN8tbYAS6v DKL9Nc40N9yJWy+kTnLhhcuHxjXPpSB9paNZg5fQ2adAQFAJNU6zDf4mGyKqSxV5d9ho nbtzeJgGDkil7YDHHWKm1Mwdbz1dImphXvhwbqFNUQq7RmnnZsn5hYf50xl3Ubq3U4Re UxqqspWeDN/Fzm5M6iDgDS0QZ8xvgflIwke3qqfDSbRHyu4WAF26cEknj5f3Gc9+4ZWe C7zg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681886785; x=1684478785; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bLzM2+BlpNCdmMN6XaJsZFT5iwLTV8yl3YYwzAnzcTg=; b=Kzwx46w7MNAqMNpymhCsZbFsnezFGz2PC/CtSfUFzw0pHnyTi0yMWeayaN9QZbAS2+ qQMPqxJRa9j6sN2WG58X7EFC7jn4pp2qaEsmotxJlCFCj24HYrtKYRXd7F1D12tlrulq PfCFPcW6Sm+oM2lTHJjW6ozTzaZUAqdDKRkhVqj5IR3PdQySjrg7wU5WttFwUGEJwBhb o31MNq0OYLKIyhdKLWBoYHs41EsFnVkGAY8Gszr8jLElUvNR5U5sacB0xEGxgQUCCqqa fRQuJxhw4VHw7UCCmaICyOin4G931akD1IZ7R2oTtZZHs5bCAo+wuNdoQyVB6nUPmZeZ FJHA== X-Gm-Message-State: AAQBX9cOtJRWCtMlGRRD9aFNkuqwUO44JCzjRCcFtyKkUkTeF4psxRvN g1DpvsIucCjFrqWyN0fCrEWaNA== X-Google-Smtp-Source: AKy350aGazEo5Msk12xFNlWcFuOmgzrgc4sPBBQX2e74nnBlLH9DkTszWbLxFVKmZThG02rmBG9u4A== X-Received: by 2002:ac2:5635:0:b0:4eb:3de1:dfc0 with SMTP id b21-20020ac25635000000b004eb3de1dfc0mr3095649lff.69.1681886785350; Tue, 18 Apr 2023 23:46:25 -0700 (PDT) Received: from ta1.c.googlers.com.com (61.215.228.35.bc.googleusercontent.com. [35.228.215.61]) by smtp.gmail.com with ESMTPSA id e24-20020ac25478000000b004edce1d338csm438208lfn.89.2023.04.18.23.46.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 18 Apr 2023 23:46:23 -0700 (PDT) From: Tudor Ambarus To: stable@vger.kernel.org Cc: tytso@mit.edu, adilger.kernel@dilger.ca, linux-ext4@vger.kernel.org, linux-kernel@vger.kernel.org, joneslee@google.com, Tudor Ambarus Subject: [PATCH][for stable [4.14, 5.10] 1/3] Revert "ext4: fix use-after-free in ext4_xattr_set_entry" Date: Wed, 19 Apr 2023 06:46:08 +0000 Message-ID: <20230419064610.1918038-2-tudor.ambarus@linaro.org> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog In-Reply-To: <20230419064610.1918038-1-tudor.ambarus@linaro.org> References: <20230419064610.1918038-1-tudor.ambarus@linaro.org> 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" This reverts commit bb8592efcf8ef2f62947745d3182ea05b5256a15 which is commit 67d7d8ad99beccd9fe92d585b87f1760dc9018e3 upstream. The order in which patches are queued to stable matters. This patch has a logical dependency on commit 310c097c2bdbea253d6ee4e064f3e65580ef93ac upstream, and failing to queue the latter results in a null-ptr-deref reported at the Link below. In order to avoid conflicts on stable, revert the commit just so that we can queue its prerequisite patch first and then queue the same after. Link: https://syzkaller.appspot.com/bug?extid=3Dd5ebf56f3b1268136afd Signed-off-by: Tudor Ambarus --- fs/ext4/xattr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index f3da1f2d4cb9..948da799abab 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c @@ -2193,9 +2193,8 @@ int ext4_xattr_ibody_find(struct inode *inode, struct= ext4_xattr_info *i, struct ext4_inode *raw_inode; int error; =20 - if (!EXT4_INODE_HAS_XATTR_SPACE(inode)) + if (EXT4_I(inode)->i_extra_isize =3D=3D 0) return 0; - raw_inode =3D ext4_raw_inode(&is->iloc); header =3D IHDR(inode, raw_inode); is->s.base =3D is->s.first =3D IFIRST(header); @@ -2223,9 +2222,8 @@ int ext4_xattr_ibody_inline_set(handle_t *handle, str= uct inode *inode, struct ext4_xattr_search *s =3D &is->s; int error; =20 - if (!EXT4_INODE_HAS_XATTR_SPACE(inode)) + if (EXT4_I(inode)->i_extra_isize =3D=3D 0) return -ENOSPC; - error =3D ext4_xattr_set_entry(i, s, handle, inode, false /* is_block */); if (error) return error; --=20 2.40.0.634.g4ca3ef3211-goog