From patchwork Fri Mar 22 17:10:38 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bethany Jamison X-Patchwork-Id: 1915018 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 4V1TPD6pLhz23r9 for ; Sat, 23 Mar 2024 04:10:56 +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 1rniPl-0003Ju-E8; Fri, 22 Mar 2024 17:10:45 +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 1rniPi-0003JN-6x for kernel-team@lists.ubuntu.com; Fri, 22 Mar 2024 17:10:42 +0000 Received: from mail-io1-f72.google.com (mail-io1-f72.google.com [209.85.166.72]) (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 E18B03F274 for ; Fri, 22 Mar 2024 17:10:41 +0000 (UTC) Received: by mail-io1-f72.google.com with SMTP id ca18e2360f4ac-7cc012893acso242153639f.2 for ; Fri, 22 Mar 2024 10:10:41 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711127440; x=1711732240; 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=D0xqQ+Mqy9tyKD8KU8rk/2qt1uSnZ6WLtDomQ/JceoL7Cywv5u1fq2uDdWrq22n7jb WHsEoQroBxnDSvGKENk6EaRX/7N8WHVs7Op4uqD0o9p/VPXxrh3FlaHCgn3l6aGoN3z8 cYnurlxCXpg8yUPEItVFdmDloRQtG7UnXODqVoIhMxm9AsR5OoopNpzW801Czg6NTt2Q +oCTevg657PWAYe8Rwk6bVD4PL2d+1O4JZXiXjKLZwWU3N2kQ+VUhnIOjx3srFe2KgSr /rHpFcK4nJt2gPbnnv+AkQYAy7glsoSsjTpSqEWcMfQydieWldS6Ce/HKaDVNW8TlKx/ gfhA== X-Gm-Message-State: AOJu0Yy8XdYv3b/oyhTDJNoxZexSmqvF4dtFHyxeoK9aRRPFkGDVcyyY 1CUA+OvBCFRk+OjT8/CBO5NbXsAxbcRYOefN93E9SCmcx3U9ycFlHfLWvBwGxU9HTHLtZME2wI2 86emd0IDRC/Vnn0TIn3q3ojW4YBHGBjJPlqK8ANmf/m6C5/hpJH5cnwRJX+FdD4+9pWiDkBjZB4 Q5Sj+bjxd4wg== X-Received: by 2002:a05:6602:18a:b0:7cb:fcde:9464 with SMTP id m10-20020a056602018a00b007cbfcde9464mr81371ioo.5.1711127440534; Fri, 22 Mar 2024 10:10:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHsVi9idMCBeXghhfNYtWzgigH376mWqkvgwCIHg5jrMxkT48BZOIy6+nHvse8fVHN1o5RuUA== X-Received: by 2002:a05:6602:18a:b0:7cb:fcde:9464 with SMTP id m10-20020a056602018a00b007cbfcde9464mr81351ioo.5.1711127440217; Fri, 22 Mar 2024 10:10:40 -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 k8-20020a02c768000000b00476d4739990sm606228jao.137.2024.03.22.10.10.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Mar 2024 10:10:40 -0700 (PDT) From: Bethany Jamison To: kernel-team@lists.ubuntu.com Subject: [SRU][M/J/F][PATCH v3 1/1] jfs: fix uaf in jfs_evict_inode Date: Fri, 22 Mar 2024 12:10:38 -0500 Message-Id: <20240322171038.13337-2-bethany.jamison@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240322171038.13337-1-bethany.jamison@canonical.com> References: <20240322171038.13337-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; /*