]> git.ipfire.org Git - thirdparty/kmod.git/commit
libkmod: Fix open file which some char device master
authorWentao Guan <guanwentao@uniontech.com>
Thu, 19 Feb 2026 15:45:10 +0000 (23:45 +0800)
committerLucas De Marchi <demarchi@kernel.org>
Sun, 22 Feb 2026 19:14:16 +0000 (13:14 -0600)
commit326b32c70c9547d37d4fe147e5927b64fd842cf3
treecfab97dcabb73935da2cdb670e77a02e52266c8c
parent0d7b50c870cebd7f6ee7a5061c4763b556511886
libkmod: Fix open file which some char device

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 883d931d1bd04b089b85b554d1df6f41dcf5fbf5 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 8d03b6c7d990af301950d3ecdc4b5c69fa525928 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: https://github.com/lyonel/lshw/pull/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: 883d931d1bd04 ("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: https://github.com/kmod-project/kmod/pull/407
Signed-off-by: Lucas De Marchi <demarchi@kernel.org>
libkmod/libkmod-file.c