From nobody Sat Apr 4 01:46:23 2026 Received: from mail-oo1-f71.google.com (mail-oo1-f71.google.com [209.85.161.71]) (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 A0DA1366547 for ; Sat, 21 Mar 2026 05:53:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.161.71 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774072386; cv=none; b=YIJ9ybBtY1moqzXyu16guFcmaK8tAmKi1+jvTf2IbsM7h+cWq8kpLGR5I3xltSlqG4EKWFweQNkORb7NDOFhr5EcWMUmRIkF4jw12EBt1wNuhbeql03zhDIEiR0Uwb0iS+Nk5vObw8NSPdwrqc/JyAcRRMX6wD8vnGBzwN1Tbcc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774072386; c=relaxed/simple; bh=DngrliAxktOv17bFNGL7SSVkWL1HX7DbuXraIgdE6to=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=rR7HJXwcdoWUn32yPE6AFtu0jcgR56o7vS68NHdsSN7sjdR6higuq6zeZThL7uB18h8qZtGWANX67LClLd299EbRbOUHEXoMT2jiZ7w12oi68TbiL/zLcejo56lCkBbO8NBXfwDZgqqT7+5Bqa7G+9PhhfB8avEGj77L5qqzBiU= 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.71 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-f71.google.com with SMTP id 006d021491bc7-67c258734aeso20707256eaf.1 for ; Fri, 20 Mar 2026 22:53:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774072384; x=1774677184; 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=/WB+HRCgnLk5srqp2Gw6gFIwtnaK9ZaPBLEPnA9LqEI=; b=acYRA2nPgqSTV0blPLCIfMOoJ4Y53HpJzncjIOWXsUXE2F8UriWnKi2YVLf0rQHfc+ KeoOV9OHkswghgyjeRuzo8/R50erq7L+6vKF1wi6OxFQZdBTQzE8RChghA/msTYiXH1U 5gnr27d/8V0dBImbsRXGGaBg5XDTla75+IWw3cKwX5jvxdZHqZ3U5swzuRr6AeqlXIXZ s1YbtgwXSZsFK01TKWW6GEe5i+xIrPepAeOwUC6ZbzGjGAMLZxSZwDkqCjvRZpfClZVh Tmz6MH2Jd6Hp88sIrwuq7c8406HUAgoEVPQ0aaULCdimLJkpU1LtH4U8u5rNM6HKG495 UHnw== X-Gm-Message-State: AOJu0YyPGacH6GjzGQVOixNYV83t2dSGURGRnh49rIi2tDg1/MU/7H4y lFAGpfkNLGxfFLHXQ4YEu0R6O8ZznsR+7AaB16yTne8P4E7SLgMKw3QW67GRxjlEzNmILhs+iis l3Gi0oAONOp0Sv69DFKJupMQlUkqZ7k7m5EoR0A46lMeazr52/i3CKtgRalY= 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:8599:20b0:67c:2367:ffed with SMTP id 006d021491bc7-67c2368021amr2890347eaf.59.1774072384659; Fri, 20 Mar 2026 22:53:04 -0700 (PDT) Date: Fri, 20 Mar 2026 22:53:04 -0700 In-Reply-To: <69bdce08.050a0220.3bf4de.0031.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <69be3240.050a0220.3bf4de.0040.GAE@google.com> Subject: Forwarded: [PATCH] fs/namespace: fix double hlist_del_init of mnt_mp_list in get_detached_copy() 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] fs/namespace: fix double hlist_del_init of mnt_mp_list in = get_detached_copy() Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git= master get_detached_copy() builds a new anonymous mount namespace for open_tree(OPEN_TREE_CLONE) by iterating all mounts in the cloned tree and calling mnt_add_to_ns() for each. However, child mounts in the cloned tree have their mnt_mp_list linked into the original mountpoint's m_list via mnt_set_mountpoint(). mnt_add_to_ns() only updates the namespace RB tree and never removes mnt_mp_list from that list. When both the original and new anonymous namespaces are torn down on process exit, put_mnt_ns() -> umount_tree() -> __umount_mnt() calls hlist_del_init() on mnt_mp_list for each mount. Since the same mount belongs to two namespaces, hlist_del_init() is called twice on the same node, corrupting the list and causing a general protection fault. Fix this by calling hlist_del_init() on mnt_mp_list and clearing mnt_mp for each mount inside the loop in get_detached_copy(). This detaches them from the original mountpoint's m_list. Clearing mnt_mp also prevents __umount_mnt() from passing a stale pointer to maybe_free_mountpoint() during teardown. Reported-by: syzbot+e4470cc28308f2081ec8@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3De4470cc28308f2081ec8 Signed-off-by: Deepanshu kartikey --- fs/namespace.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/namespace.c b/fs/namespace.c index 854f4fc66469..04e7ffd7fcf5 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -3063,6 +3063,10 @@ static struct mnt_namespace *get_detached_copy(const= struct path *path, unsigned =20 for (p =3D mnt; p; p =3D next_mnt(p, mnt)) { mnt_add_to_ns(ns, p); + if (p->mnt_mp) { + hlist_del_init(&p->mnt_mp_list); + p->mnt_mp =3D NULL; + } ns->nr_mounts++; } ns->root =3D mnt; --=20 2.43.0