[PATCH RESEND v2 29/51] proc: don't walk through a non-directory when resolving a name
sashiko-bot at kernel.org
sashiko-bot at kernel.org
Thu Nov 5 11:29:45 PST 2026
> __xlate_proc_name() walks the components of a name like "a/b/c" and
> takes whatever it finds for "a" and "b" as the directory to go on in.
> It never checks that they actually are directories. So
> proc_create("file/x") hangs x into the subdir tree of the regular file
> "file". Nobody can look x up there, but remove_proc_subtree() on the
> file removes and frees x along with it, behind the back of whoever
> registered x.
>
> pktgen passes the name the writer of "add_device" picks to
> proc_create_data(), and only the part in front of the '@' has to name
> a network device:
>
> echo "add_device lo@" > /proc/net/pktgen/kpktgend_0
> echo "add_device lo@/x" > /proc/net/pktgen/kpktgend_1
> echo "rem_device_all" > /proc/net/pktgen/kpktgend_0
> [ ... ]
>
> Reported-by: Chris Mason <mason at kernel.org>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Cc: stable at vger.kernel.org
> Signed-off-by: Christian Brauner (Amutable) <brauner at kernel.org>
Sashiko has reviewed this patch and found no issues.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261104-work-procfs-bugfixes-v2-0-021c84d852e0@kernel.org?part=29
More information about the kexec
mailing list