From nobody Mon Dec 1 21:30:50 2025 Received: from mail-il1-f200.google.com (mail-il1-f200.google.com [209.85.166.200]) (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 87BF91C861D for ; Fri, 28 Nov 2025 01:35:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.166.200 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764293751; cv=none; b=hUmdAO8bHEdxhe5L43lOhQFHDvFKeygjuc+nSV/Gn57jKZcCcZvKLX7aoxuY6pJ7QPH8LUKEnySu/lk2mf7+4CxoMhI9O5mtAu25nyP2MPu4zWPIstQs4E3JlYIg4irzYsDXn3F7OSiuhU/uDR2E34qd7z/SoPZqNm3QS0BZV2I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764293751; c=relaxed/simple; bh=BGtgc1TOhjPWOtxf2WhFTulKZNCdaW4SzpNdYd0k6kc=; h=MIME-Version:Date:In-Reply-To:Message-ID:Subject:From:To: Content-Type; b=mLY1tjjMB64FAE5iWryoz1i5Y87MQFYKgxlXC6WMff8t6CncJgW1w/l/9RjfAkwHfgVD1iI0bVNB0RuejObEdyzoZJuBrRwSylRjStX0ptRoWSH5hYv7ibA/uiMpqHux0KK7R0EV2BBlYctaEaC6xyhRUaTSKGpjHe07uLyCg84= 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.166.200 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-il1-f200.google.com with SMTP id e9e14a558f8ab-43322fcfae7so11446515ab.1 for ; Thu, 27 Nov 2025 17:35:49 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1764293748; x=1764898548; 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=0IU7mCpOo/hh6ToRoyGWKQqcxArOqJL+/B29rHi7vTo=; b=fpIHlmdjrfNVpSDvLFdNFIYgJ6hKrS5qTDSOIQUcRj5NgFx/8HvKYzEVDyqyt3IrWU Kmnt+bCaRn0I3Te2qg1fAMvydpJtIW4jupkD+WfQAoLLLq+wzMTdh5lCc9X09H9ywuby CaSunfsQbBgH5yFJvThX7QzbKrz3bkBlrgoUxj4he2IrEeZvJqOCZNXn80u+ap5SgY8N CHpC4OJsBP6QNj1GOWeR0aa9OVVjq6qZDGEgoZ7xBbbtybRPRhJCPNiif57RpkHn8XML yRzfCEOucARWKNjsQQ+GTSO9bhBOZJPIJRS6LNtrbTfOTlYroVNE3SIcUC043N93gHcy vhZg== X-Gm-Message-State: AOJu0YxpYv5j9mqwKa4wGp7uoXQzatUSbzetqdujC/giowucuDEP3L5f qgpSs+ctLDt/oWB/NeIJMTl1D7w6xifoi9i0xtCwyOOUia6OzpHL965ZPyFDTDPFaXFa2lu7GuV nzl3lvTLDMI0lYONmrXWvft7lUzSy7vKwqOt2nId/e4c1t+vmoJ09YPJAMOE= X-Google-Smtp-Source: AGHT+IGKLxbd7xXbw/5k7YaenJpqcW+QC/f+dMHbAY7V79rFBXe/+XiN6Q1WusU2atvQ8bkHEdY1XgMU6zAmT5oHT1QLFPv3fu/9 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:6e02:1f09:b0:435:b35b:4b4c with SMTP id e9e14a558f8ab-435dd04fbc7mr110519455ab.5.1764293748759; Thu, 27 Nov 2025 17:35:48 -0800 (PST) Date: Thu, 27 Nov 2025 17:35:48 -0800 In-Reply-To: <6928c5c3.a70a0220.d98e3.011a.GAE@google.com> X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <6928fc74.a70a0220.d98e3.0129.GAE@google.com> Subject: Forwarded: [PATCH] fs/namespace: fix mntput of ERR_PTR in fsmount error path 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 mntput of ERR_PTR in fsmount error path Author: kartikey406@gmail.com #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.gi= t master When vfs_create_mount() fails and returns an error pointer, the __free(path_put) cleanup attribute causes path_put() to be called on the error pointer, which then calls mntput() on an invalid pointer value (e.g., -ENOENT =3D 0xfffffffffffffff4). This results in a general protection fault in mntput() when KASAN tries to check the shadow memory for the near-null address computed from the error pointer offset. Fix this by clearing newmount.mnt to NULL after extracting the error code, preventing the path_put cleanup from operating on the error pointer. Reported-by: syzbot+94048264da5715c251f9@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=3D94048264da5715c251f9 Signed-off-by: Deepanshu Kartikey --- fs/namespace.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fs/namespace.c b/fs/namespace.c index e5240df614de..236482fd503f 100644 --- a/fs/namespace.c +++ b/fs/namespace.c @@ -4343,8 +4343,11 @@ SYSCALL_DEFINE3(fsmount, int, fs_fd, unsigned int, f= lags, warn_mandlock(); =20 newmount.mnt =3D vfs_create_mount(fc); - if (IS_ERR(newmount.mnt)) - return PTR_ERR(newmount.mnt); + if (IS_ERR(newmount.mnt)) { + ret =3D PTR_ERR(newmount.mnt); + newmount.mnt =3D NULL; + return ret; + } newmount.dentry =3D dget(fc->root); newmount.mnt->mnt_flags =3D mnt_flags; =20 --=20 2.43.0