From patchwork Fri Mar 22 16:40:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bethany Jamison X-Patchwork-Id: 1915012 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=185.125.189.65; helo=lists.ubuntu.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=patchwork.ozlabs.org) Received: from lists.ubuntu.com (lists.ubuntu.com [185.125.189.65]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4V1Skh5httz23r9 for ; Sat, 23 Mar 2024 03:41:00 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=lists.ubuntu.com) by lists.ubuntu.com with esmtp (Exim 4.86_2) (envelope-from ) id 1rnhwl-0004g7-PF; Fri, 22 Mar 2024 16:40:47 +0000 Received: from smtp-relay-internal-0.internal ([10.131.114.225] helo=smtp-relay-internal-0.canonical.com) by lists.ubuntu.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1rnhwR-0004Ye-0b for kernel-team@lists.ubuntu.com; Fri, 22 Mar 2024 16:40:27 +0000 Received: from mail-il1-f197.google.com (mail-il1-f197.google.com [209.85.166.197]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-0.canonical.com (Postfix) with ESMTPS id AA5AC3F5CF for ; Fri, 22 Mar 2024 16:40:26 +0000 (UTC) Received: by mail-il1-f197.google.com with SMTP id e9e14a558f8ab-3686d27fcf5so11784915ab.1 for ; Fri, 22 Mar 2024 09:40:26 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711125625; x=1711730425; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=M74vkiQPvCZJLtXlgKh5QoVNYwolFHmAcSVMtyKCfUI=; b=hD/l/mn8P7HoyReTMre0YBexM8wMCjI5t80N3kiphxSNgny5NkAVyalVcZFnvgDUTW TttrgVOVhbxl42WE8lIijWPDiC+BrRceCUAceV/B+Q/7uGF4m7c1NvTbpA+pEPvSz9F7 /7VM3WSgm/1y9xPRer5fgsXnzGc4WlXfRWZhVJcGFkPSbs5+JOA3hN33kytlDp4UJUVy OnU5TBrg6ID5pwGDCVGeqs09r14hJ+S08hVvp9/hUIk0TIXV6TY2pNgs1FrFYZ9g0VgS thLhvbCs1QQ++xZyusrngJUTnnC/nlT4Ry4kFaXjoIetvPQ0s036ph7cHkGzu9r1WffB 9N0Q== X-Gm-Message-State: AOJu0YwgzTIgff6QV0dxwkZM+4JIqWluZKj9HRPWEmPyFpZap7r96ZeJ /w6kyJamzLxniXirmjBcwOux6ebAeOa+3PD2m7hjfvEUCwmvuReE0kSepeqwzsKFvpQQ0INTZcy fc4zdhrmGjx9x10FV1A7vq0AKhhYqSh7ujrkoKzt8G3M1krDZATLgMGwieWMs1R4ze6f4KqiqF3 /D1oxZvLI6UQ== X-Received: by 2002:a92:dc05:0:b0:368:64cc:d404 with SMTP id t5-20020a92dc05000000b0036864ccd404mr43681iln.0.1711125625117; Fri, 22 Mar 2024 09:40:25 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGwxYw3peT+I412pHvAz+ojnVOyhetyBAOQFHKKHiwkerYXuuTdhsOP3cSQoaSaVVgfBZp5hw== X-Received: by 2002:a92:dc05:0:b0:368:64cc:d404 with SMTP id t5-20020a92dc05000000b0036864ccd404mr43666iln.0.1711125624854; Fri, 22 Mar 2024 09:40:24 -0700 (PDT) Received: from smtp.gmail.com (104-218-69-129.dynamic.lnk.ne.allofiber.net. [104.218.69.129]) by smtp.gmail.com with ESMTPSA id b1-20020a92db01000000b0036699bc65aesm678690iln.26.2024.03.22.09.40.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 09:40:24 -0700 (PDT) From: Bethany Jamison To: kernel-team@lists.ubuntu.com Subject: [SRU][M/J/F][PATCH 1/1] jfs: fix uaf in jfs_evict_inode Date: Fri, 22 Mar 2024 11:40:22 -0500 Message-Id: <20240322164022.12210-2-bethany.jamison@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240322164022.12210-1-bethany.jamison@canonical.com> References: <20240322164022.12210-1-bethany.jamison@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Edward Adam Davis When the execution of diMount(ipimap) fails, the object ipimap that has been released may be accessed in diFreeSpecial(). Asynchronous ipimap release occurs when rcu_core() calls jfs_free_node(). Therefore, when diMount(ipimap) fails, sbi->ipimap should not be initialized as ipimap. Reported-and-tested-by: syzbot+01cf2dbcbe2022454388@syzkaller.appspotmail.com Signed-off-by: Edward Adam Davis Signed-off-by: Dave Kleikamp (cherry picked from commit e0e1958f4c365e380b17ccb35617345b31ef7bf3) CVE-2023-52600 Signed-off-by: Bethany Jamison --- fs/jfs/jfs_mount.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/jfs/jfs_mount.c b/fs/jfs/jfs_mount.c index b83aae56a1f26..631b8bd3e4384 100644 --- a/fs/jfs/jfs_mount.c +++ b/fs/jfs/jfs_mount.c @@ -172,15 +172,15 @@ int jfs_mount(struct super_block *sb) } jfs_info("jfs_mount: ipimap:0x%p", ipimap); - /* map further access of per fileset inodes by the fileset inode */ - sbi->ipimap = ipimap; - /* initialize fileset inode allocation map */ if ((rc = diMount(ipimap))) { jfs_err("jfs_mount: diMount failed w/rc = %d", rc); goto err_ipimap; } + /* map further access of per fileset inodes by the fileset inode */ + sbi->ipimap = ipimap; + return rc; /*