From nobody Fri Apr 3 02:56:34 2026 Received: from mail-oo1-f72.google.com (mail-oo1-f72.google.com [209.85.161.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 36E061EDA32 for ; Wed, 25 Mar 2026 00:37:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.72 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774399080; cv=none; b=edoEFgFVV7pnBKm8mUyrG/pjjSYjyvn6sp04//t0DSxYLhlQ3mSBJYDbFCpVGE2yNF90QcWSc8heVM2S3cu2V8v9/9FW1uOiNzz6v5IQ24c3tB8j395qlXgPnGmOlR/Ym1TT8boA9qJ4A2RMukEOFpCek1Z+0yTaGgqWJjj8xHo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774399080; c=relaxed/simple; bh=o2KAu42rGd8Ay+To0m0umoIQXm3bNVKHz1mkWd4zPiE=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=VK/L6OE9swhuWza8n7+ZpfkXmBn/vm246K6g8tPWoDE/5jJ+aT+Zk/jBg9CpgwXAkyoXvZy1bEza1HsW11c1zmg3TL060QaXCQQVEgOhrbcvZebbHEQRoA+o7zg7dn7jFK9ITEtSyhoSMZlCt3ACf2Hfd60oTjiyD2y9HlI2h0M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com; arc=none smtp.client-ip=209.85.161.72 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=syzkaller.appspotmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=M3KW2WVRGUFZ5GODRSRYTGD7.apphosting.bounces.google.com Received: by mail-oo1-f72.google.com with SMTP id 006d021491bc7-67dfc5db363so6604507eaf.3 for ; Tue, 24 Mar 2026 17:37:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774399078; x=1775003878; h=to:from:subject:message-id:in-reply-to:date:mime-version :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=Ka5b1LZH83yJgLn8iHk5Yszxjl7XoclqKrVB0Y3NNng=; b=rVZTUavhhkM77X6oyXk5VkDrMFlJvglkMFmg+c3zq+SD1doOVgj6Sh9hVZYOaFDIFS qo9Dq3vpxV3cy4nWjFa0UM94eeEOuXGNV6GifIsQvugsb+3VMFrCoV+1MVVAs7T4th1X rtO3bMXgwE2Xa9vUbuzPoQg7mvXSWQDxj+Sjbn8jCNNM9WkJylKS93RxZIYKO/w6YW8E yQlbU1o3suNYeJ2hy7n6CVfRvpsYlC/oSAoNdRBkgt+LPw6AeSHpTOnf5Ve3m3wt1VQW upRTRkCTFwC07rpglcXuTpYksm/vy5kE2TYrLKd3Cpl0uIFNn0sG0ubb1ZOJgX3VBlIh oyAQ== X-Gm-Message-State: AOJu0YzqEXOrnHKmNWxYPNmDcp7VTi0DwPLVcVi67GTyVUqYMweo313j bGNBsRA6vDH5cFJluBdYbc6mbUXSdFetYXeLIHNvRJiNlD+rMjZOjGFWXvlYTvND12l5xQEoTfB yccjO3uev7v2g0l+zO6hFeja0f5YnjRvC14PdG65BySp9TauYRCxKvWRHN70= Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Received: by 2002:a05:6820:174b:b0:67c:2af2:a66a with SMTP id 006d021491bc7-67dff37caf7mr1064491eaf.11.1774399078214; Tue, 24 Mar 2026 17:37:58 -0700 (PDT) Date: Tue, 24 Mar 2026 17:37:58 -0700 In-Reply-To: <69c2aff4.050a0220.3bf4de.00b3.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69c32e66.a70a0220.234938.003e.GAE@google.com> Subject: Forwarded: [PATCH] gfs2: fix duplicate kmem_cache name on concurrent mounts From: syzbot To: linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For archival purposes, forwarding an incoming command email to linux-kernel@vger.kernel.org, syzkaller-bugs@googlegroups.com. *** Subject: [PATCH] gfs2: fix duplicate kmem_cache name on concurrent mounts Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.gi= t master When gfs2_fill_super() creates the per-filesystem bufdata cache, it uses sd_fsname as part of the cache name: sdp->sd_bufdata =3D kmem_cache_create("gfs2-bufdata/", ...); At this point sd_fsname is set from sd_table_name (e.g. "syz:syz"), which is the same for all concurrent mounts of the same device. The unique suffix (.s for spectator, .N for journal ID) is only added to sd_fsname AFTER wait_on_journal() completes, since the journal ID is assigned by the locking subsystem during mount. With multiple concurrent mounts of the same device (as triggered by syzkaller with procs:5), multiple calls to gfs2_fill_super() all try to create a cache named "gfs2-bufdata/syz:syz" before any of them reaches the point where sd_fsname becomes unique, triggering: kmem_cache of name 'gfs2-bufdata/syz:syz' already exists WARNING: mm/slab_common.c:112 Fix this by moving the bufdata cache creation to after wait_on_journal() completes and sd_fsname has been updated with its unique suffix. Also move the fail_bufdata cleanup label accordingly in the error unwind path. Reported-by: syzbot+b441db1854c360b83221@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3Db441db1854c360b83221 Fixes: 767e4de3ffce ("gfs2: per-filesystem bufdata cache") Signed-off-by: Deepanshu Kartikey --- fs/gfs2/ops_fstype.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/fs/gfs2/ops_fstype.c b/fs/gfs2/ops_fstype.c index b44adb40635d..7f8e04c11494 100644 --- a/fs/gfs2/ops_fstype.c +++ b/fs/gfs2/ops_fstype.c @@ -1198,17 +1198,9 @@ static int gfs2_fill_super(struct super_block *sb, s= truct fs_context *fc) if (!sdp->sd_delete_wq) goto fail_glock_wq; =20 - char *bufdata_name =3D kasprintf(GFP_KERNEL, "gfs2-bufdata/%s", sdp->sd_f= sname); - sdp->sd_bufdata =3D kmem_cache_create(bufdata_name, - sizeof(struct gfs2_bufdata), - 0, 0, NULL); - kfree(bufdata_name); - if (!sdp->sd_bufdata) - goto fail_delete_wq; - error =3D gfs2_sys_fs_add(sdp); if (error) - goto fail_bufdata; + goto fail_delete_wq; =20 gfs2_create_debugfs_file(sdp); =20 @@ -1255,6 +1247,14 @@ static int gfs2_fill_super(struct super_block *sb, s= truct fs_context *fc) snprintf(sdp->sd_fsname, sizeof(sdp->sd_fsname), "%s.%u", sdp->sd_table_name, sdp->sd_lockstruct.ls_jid); =20 + char *bufdata_name =3D kasprintf(GFP_KERNEL, "gfs2-bufdata/%s", sdp->sd_f= sname); + sdp->sd_bufdata =3D kmem_cache_create(bufdata_name, + sizeof(struct gfs2_bufdata), + 0, 0, NULL); + kfree(bufdata_name); + if (!sdp->sd_bufdata) + goto fail_sb; + error =3D init_inodes(sdp, DO); if (error) goto fail_sb; @@ -1304,6 +1304,7 @@ static int gfs2_fill_super(struct super_block *sb, st= ruct fs_context *fc) if (sb->s_root) dput(sb->s_root); sb->s_root =3D NULL; + kmem_cache_destroy(sdp->sd_bufdata); fail_locking: init_locking(sdp, &mount_gh, UNDO); fail_lm: @@ -1313,8 +1314,6 @@ static int gfs2_fill_super(struct super_block *sb, st= ruct fs_context *fc) fail_debug: gfs2_delete_debugfs_file(sdp); gfs2_sys_fs_del(sdp); -fail_bufdata: - kmem_cache_destroy(sdp->sd_bufdata); fail_delete_wq: destroy_workqueue(sdp->sd_delete_wq); fail_glock_wq: --=20 2.43.0