From patchwork Fri Mar 22 16:57:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bethany Jamison X-Patchwork-Id: 1915016 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 4V1T6s0VmGz1yXt for ; Sat, 23 Mar 2024 03:58:29 +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 1rniDj-0000aY-3x; Fri, 22 Mar 2024 16:58:19 +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 1rniCf-0008VB-Vo for kernel-team@lists.ubuntu.com; Fri, 22 Mar 2024 16:57:14 +0000 Received: from mail-il1-f200.google.com (mail-il1-f200.google.com [209.85.166.200]) (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 BD42B3F879 for ; Fri, 22 Mar 2024 16:57:13 +0000 (UTC) Received: by mail-il1-f200.google.com with SMTP id e9e14a558f8ab-3685eec8ba4so21344865ab.3 for ; Fri, 22 Mar 2024 09:57:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711126632; x=1711731432; 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=sONL6gB+Z45O28Js//SUkcXZAUL+skOHyOPg9L0Nzh9d09LKft9cQgTwhj8P2a/DsC Z5bDXzs68B8nnAxECN7ihry65jari/SG/ztBHLWiLPFZV5ybkwTJYXArjpbQ0QU3C9tW Xv21kY4AYv8PxrCMCMxLQYG+yN2I0rMDoNAa/7yXAjfLXjBxL+2l+eXB0uLTjwxTCMZJ Vjaz1keuKdyhVrwBu6TV89VoTMxqWV6iM+MGxp/ybDotJq6kYfQE9d1YBxSaXYtTaiOA uBpz4WeVJ8PlpIuw4pXeII+ZAUZergU3OAObSSWXQXdzp3C/zt667vrBm7HqOTctMdXW Txfw== X-Gm-Message-State: AOJu0Yw/GYKtQKrlDmrkF8apgdVPXXIB5a8nJeGQQVisSkWIIaHO2cJB FxR1m8rjrkcLRhiyeJEC0OAaalKNv3ATT/Cjd/2zCqAxa+yXp0tYoHfaQTcJ8L7vBYKo+T2VoK9 GsH/ySRM/ABla4BDm0Pq0eDZTgoE2Yrq6caDrfV3dCye5mBsP+6TzYczqWNWbbvKHpC22vE2+JL vwySjhItM3YA== X-Received: by 2002:a05:6e02:104e:b0:368:747a:9032 with SMTP id p14-20020a056e02104e00b00368747a9032mr48823ilj.9.1711126632420; Fri, 22 Mar 2024 09:57:12 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGNUpojH7WJGt//srPYGtTs/KCoYCwVAtmBzWwT5DKFR7faBRcR6S8+kXB3wXjIx/PR2BoFhQ== X-Received: by 2002:a05:6e02:104e:b0:368:747a:9032 with SMTP id p14-20020a056e02104e00b00368747a9032mr48808ilj.9.1711126632163; Fri, 22 Mar 2024 09:57:12 -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 h1-20020a02c721000000b0047bf5d0818bsm581410jao.86.2024.03.22.09.57.11 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 09:57:11 -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:57:10 -0500 Message-Id: <20240322165710.13020-2-bethany.jamison@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240322165710.13020-1-bethany.jamison@canonical.com> References: <20240322165710.13020-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; /*