Skip to content

Fix incorrect /dev/ prefix that breaks network interfaces#110

Open
opsiff wants to merge 1 commit into
lyonel:masterfrom
opsiff:bbs-291466
Open

Fix incorrect /dev/ prefix that breaks network interfaces#110
opsiff wants to merge 1 commit into
lyonel:masterfrom
opsiff:bbs-291466

Conversation

@opsiff
Copy link
Copy Markdown

@opsiff opsiff commented Dec 2, 2025

The commit 7ee5b45 ("PCMCIA IDE devices should now be properly reported") introduced automatic /dev/ prefixing to merge IDE and PCMCIA logical names. However, this caused network interface names to be mangled when character devices with the same name exist in /dev (e.g., vmnet1), leading to failed ioctl calls in scan_ip() and potential modprobe blocking when run as root.

Remove overzealous automatic /dev/ prefixing from setLogicalName() and move the /dev/ path handling to specific device scanning code where it's actually appropriate:

hw.cc: strip out the problematic auto-prefixing logic ide.cc: explicitly check and set /dev/ paths for IDE block devices pcmcia-legacy.cc: explicitly check and set /dev/ paths for PCMCIA devices

PS: modprobe had bug when pread/read some char devices.

Link: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/2069649
Link: https://bbs.deepin.org.cn/post/291466
Reported-by: Qi Xu xuqi@uniontech.com
Reported-by: lionheartyu dongshengyuan@uniontech.com

The commit 7ee5b45
("PCMCIA IDE devices should now be properly reported")
introduced automatic /dev/ prefixing to merge IDE and PCMCIA
logical names. However, this caused network interface names to be
mangled when character devices with the same name exist in /dev
(e.g., vmnet1), leading to failed ioctl calls in scan_ip() and
potential modprobe blocking when run as root.

Remove overzealous automatic /dev/ prefixing from setLogicalName()
and move the /dev/ path handling to specific device scanning code
where it's actually appropriate:

hw.cc: strip out the problematic auto-prefixing logic
ide.cc: explicitly check and set /dev/ paths for IDE block devices
pcmcia-legacy.cc: explicitly check and set /dev/ paths for PCMCIA
devices

PS: modprobe had bug when pread/read some char devices.

Link: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/2069649
Link: https://bbs.deepin.org.cn/post/291466
Reported-by: Qi Xu <xuqi@uniontech.com>
Reported-by: lionheartyu <dongshengyuan@uniontech.com>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
opsiff added a commit to opsiff/kmod that referenced this pull request Jan 15, 2026
use lseek SEEK_CUR to get whether it is a regular file,
lseek return -ESPIPE when fd is associated with a pipe, socket, or FIFO.

commit 883d931 upstream
("modprobe: Allow passing path to module") allow to modprobe a file,
but not handle opening a FIFO device such as modprobe /dev/tty1.

commit 8d03b6c uptream
("libkmod: Use pread where appropriate") fix some cases,
such ad open /dev/tty1, but not for /dev/vmnet0 or /dev/userio etc.

Can be reproduced in run lshw in root and install some vm such ad vmware,
more about the case are in the Link.

Link: lyonel/lshw#110
Link: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/2069649
Link: https://bbs.deepin.org.cn/post/291466
Reported-by: Qi Xu <xuqi@uniontech.com>
Reported-by: lionheartyu <dongshengyuan@uniontech.com>
Fixes: 883d931 ("modprobe: Allow passing path to module")
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
opsiff added a commit to opsiff/kmod that referenced this pull request Jan 15, 2026
use lseek SEEK_CUR to get whether it is a regular file,
lseek return -ESPIPE when fd is associated with a pipe, socket, or FIFO.

commit 883d931 upstream
("modprobe: Allow passing path to module") allow to modprobe a file,
but not handle opening a FIFO device such as modprobe /dev/tty1.

commit 8d03b6c uptream
("libkmod: Use pread where appropriate") fix some cases,
such as open /dev/tty1, but not for /dev/vmnet0 or /dev/userio etc.

Can be reproduced in run lshw in root and install some vm such ad vmware,
more about the case are in the Link.

Link: lyonel/lshw#110
Link: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/2069649
Link: https://bbs.deepin.org.cn/post/291466
Reported-by: Qi Xu <xuqi@uniontech.com>
Reported-by: lionheartyu <dongshengyuan@uniontech.com>
Fixes: 883d931 ("modprobe: Allow passing path to module")
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
opsiff added a commit to opsiff/kmod that referenced this pull request Feb 19, 2026
use lseek SEEK_CUR to get whether it is a regular file,
lseek return -ESPIPE when fd is associated with a pipe, socket, or FIFO.

commit 883d931 upstream
("modprobe: Allow passing path to module") allow to modprobe a file,
but not handle opening a FIFO device such as modprobe /dev/tty1.

commit 8d03b6c uptream
("libkmod: Use pread where appropriate") fix some cases,
such as open /dev/tty1, but not for /dev/vmnet0 or /dev/userio etc.

Can be reproduced in run lshw in root and install some vm such ad vmware,
more about the case are in the Link.

Reference: lyonel/lshw#110
Closes: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/2069649
Closes: https://bbs.deepin.org.cn/post/291466
Reported-by: Qi Xu <xuqi@uniontech.com>
Reported-by: lionheartyu <dongshengyuan@uniontech.com>
Fixes: 883d931 ("modprobe: Allow passing path to module")
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
lucasdemarchi pushed a commit to kmod-project/kmod that referenced this pull request Feb 22, 2026
use lseek SEEK_CUR to get whether it is a regular file,
lseek return -ESPIPE when fd is associated with a pipe, socket, or FIFO.

commit 883d931 upstream
("modprobe: Allow passing path to module") allow to modprobe a file,
but not handle opening a FIFO device such as modprobe /dev/tty1.

commit 8d03b6c uptream
("libkmod: Use pread where appropriate") fix some cases,
such as open /dev/tty1, but not for /dev/vmnet0 or /dev/userio etc.

Can be reproduced in run lshw in root and install some vm such ad vmware,
more about the case are in the Link.

Reference: lyonel/lshw#110
Closes: https://bugs.launchpad.net/ubuntu/+source/lshw/+bug/2069649
Closes: https://bbs.deepin.org.cn/post/291466
Reported-by: Qi Xu <xuqi@uniontech.com>
Reported-by: lionheartyu <dongshengyuan@uniontech.com>
Fixes: 883d931 ("modprobe: Allow passing path to module")
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
Reviewed-by: Lucas De Marchi <demarchi@kernel.org>
Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
Link: #407
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant