From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1793629547; b=jEZJUyrJjXs2RwlvCEkT7ZQ3HAQyzFR4oodggFdaTuGUikt4iIXph7l4GNfHd96IrIEo jwFaB50X2liOyi0N8yUBvVi7t45aoC6ZJrrUMmDjpPo23gSlnvj6UufI8ofc69yQ8apgY LcBwQ2lDM9cq9LpOgGzEn9U92EBJf4ZXEzwSLBB0w+H8S8d+qv8zPJCycUHaTV8+JzKI1 uUma+bIMo0Iy4YdO7gI4b9F3SxwgCWsZxnXaKshDAjBhsMiP4SyYWOEiVvjrhyHMRyEfJ TkD9X/uPBeLjXoT0G7hrAj0xnUnNRGQKQ/hh5BQCZ3wSeVNXTDyTZTCnWTQ1oKKj0Fg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1793629547; h=Received:DKIM-Signature:From:Date:Subject:MIME-Version:Content-Type: Content-Transfer-Encoding:Message-Id:References:In-Reply-To:To:Cc: X-Mailer:X-Developer-Signature:X-Developer-Key; bh=QKQgab6F/A3kQED3xQkQ3++bbO+NbqHo8+XrgOES7ts=; b=PLwiOGiIeirlib+cWTOoXWIMA77I86uXM3vs6/Bgc0JlHClizCGnrXCh2ek82rtIA5Me dXGb4bsW9AWx3N3Ik6CGkNMytQL5jW+YxCfxLT2sMCyUe0t/gaUI/zLv4Yte+3f3bb0XH 4XbTxRrX4WkFUttyQp4IL+Y0Msq0OnQQ+u90kUkve0CW5IkH4MNEGAak7+lOwJa9ZVKQK 6K2OSn1pxLOmgBc9YkbcLkJBQkbtHMfOJqy7eoFC4mPgszc1DhH8yQMeJ/s7dKu/q1aYp I9MjOiRj9homLKWN2/8Us0reO90wfRhzFOQr7SOzbw17UBE2WkTITEN5xzQz+Ux1uyw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DsO3tGmk; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E708B606B90E; Mon, 2 Nov 2026 14:25:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=DsO3tGmk Received: by smtp.kernel.org (Postfix) with ESMTPSA id 19D251F00A16; Mon, 2 Nov 2026 14:25:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1793629546; bh=QKQgab6F/A3kQED3xQkQ3++bbO+NbqHo8+XrgOES7ts=; h=From:Date:Subject:References:In-Reply-To:To:Cc; b=DsO3tGmkPm0NrZBAy36Ik2sKieKOlgJ0mgJL9J8HUXGWM9u2I/c3pHtKiQ0Do2PYm 7gQh5TWLbJfjqkyLpRYxtlHQknQ5ICn+rBMWeVJe+1wUDcrFokW3QV5BRKEjIIM1g7 4uK1dsR4VmTwi1xfPzeMKa6KM54nvBM/9lBOIH2sBK5vfPjnFtHLtg/MR6utvOuTbr BhV4LYIsAevL+sCKBVvYYsxh9K52tALkm+ZraCF9ZgTpQRr9LK+Kf5i1yQ7qyCHV1I CDizin0EMhnII/l7E8fS5Bk+dgnSr97jORnukihffTpxsXFFOekF7M+lAIoxR9VIie WHOn5K7hwiJoA== From: Christian Brauner Date: Mon, 02 Nov 2026 15:21:32 +0100 Subject: [PATCH RFC 17/38] net: pktgen: reject device names with a '/' X-Mailing-List: netdev@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-Id: <20261102-work-procfs-bugfixes-v1-17-59422ed3e465@kernel.org> References: <20261102-work-procfs-bugfixes-v1-0-59422ed3e465@kernel.org> In-Reply-To: <20261102-work-procfs-bugfixes-v1-0-59422ed3e465@kernel.org> To: linux-fsdevel@vger.kernel.org Cc: Linus Torvalds , Jann Horn , Josef Bacik , Chris Mason , Jeff Layton , NeilBrown , Eric Dumazet , Thomas Gleixner , Al Viro , Jonathan Corbet , Christoph Hellwig , Greg Kroah-Hartman , Joel Granados , Kees Cook , Jan Kara , Jan Kara , linux-kernel@vger.kernel.org, linux-nfs@vger.kernel.org, linux-acpi@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-s390@vger.kernel.org, linux-scsi@vger.kernel.org, linux-um@lists.infradead.org, linux-wireless@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, netdev@vger.kernel.org, ntfs3@lists.linux.dev, platform-driver-x86@vger.kernel.org, coreteam@netfilter.org, kexec@lists.infradead.org, linux-pci@vger.kernel.org, linux-sound@vger.kernel.org, netfilter-devel@vger.kernel.org, dri-devel@lists.freedesktop.org, ibm-acpi-devel@lists.sourceforge.net, jfs-discussion@lists.sourceforge.net, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-cifs@vger.kernel.org, linux-fbdev@vger.kernel.org, linux-hwmon@vger.kernel.org, linux-mm@kvack.org, linux-sh@vger.kernel.org, linux-usb@vger.kernel.org, samba-technical@lists.samba.org, sparclinux@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-doc@vger.kernel.org, linux-serial@vger.kernel.org, linux-atm-general@lists.sourceforge.net, Takashi Iwai , linux-input@vger.kernel.org, linux-raid@vger.kernel.org, linux-ext4@vger.kernel.org, linux-modules@vger.kernel.org, linux-debuggers@vger.kernel.org, "Christian Brauner (Amutable)" , Chuck Lever , stable@vger.kernel.org X-Mailer: b4 0.17-dev X-Developer-Signature: v=1; a=openpgp-sha256; l=1684; i=brauner@kernel.org; h=from:subject:message-id; bh=F9CLtO30/n/hY0YqeSuPpMfy319PBmjhBXOfLkB61UI=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMWS9mJOdP/nSfLcrXttv7FH7+buGK2LZ4TruhxXmP3hSF uVMm/phfUcpC4MYF4OsmCKLQ7tJuNxynorNRpkaMHNYmUCGMHBxCsBEjPkYGR7c7BeINg2bJuR9 a7LIdeFTC7/c3ff8saxRtWV+/N3pzG2MDF/XB9+RXGXonZWutHZr+BHB7Po/GQd5V955MO/WnZP Br5kA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 "add_device" takes a name like eth0@1. Only the part in front of the '@' has to name a network device. The rest is free text and all of it becomes the name of a file in /proc/net/pktgen, where procfs takes a '/' as a directory separator. So "add_device lo@a/b" makes procfs look for a directory "lo@a" that doesn't exist and warn about it. Any user can do that in a network namespace of its own: name 'lo@a/b' WARNING: fs/proc/generic.c:174 at __xlate_proc_name+0xb1/0xf0, CPU#3: bash/241 Call Trace: __proc_create+0xd0/0x9b0 proc_create_reg+0x45/0xf0 proc_create_data+0x77/0xf0 pktgen_thread_write+0xd8d/0x1750 With panic_on_warn that takes the machine down. And if "lo@a" exists because somebody added a device of that name, procfs used to register the new entry below that regular file, and removing "lo@a" freed both. Reject names with a '/'. Reported-by: Chris Mason Fixes: e6fce5b916cd ("pktgen: multiqueue etc.") Cc: stable@vger.kernel.org Signed-off-by: Christian Brauner (Amutable) --- net/core/pktgen.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/core/pktgen.c b/net/core/pktgen.c index d63eeadddfcc..02af70d360bc 100644 --- a/net/core/pktgen.c +++ b/net/core/pktgen.c @@ -3831,6 +3831,10 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname) int err; int node = cpu_to_node(t->cpu); + /* The name becomes the name of a file in /proc/net/pktgen. */ + if (strchr(ifname, '/')) + return -EINVAL; + /* We don't allow a device to be on several threads */ if (__pktgen_NN_threads(t->net, ifname, FIND)) { -- 2.53.0