Hi,
I have a question about sysfs interface.
If you open a sysfs file created by a module, then remove it (rmmoding
the module that create this sysfs file), then try to read the opened
file, you often get strange result (segdefault or oppps).
I attach a small program to test it : open your sysfs file with it
`wait_read /sysfs/file', rmmod the module, and press enter.
I was wondering if it is to user of sysfs to prevent that (with mutex,
...) or it is a sysfs bug ?
If it is the first case, I fear that lot's of modules are broken.
Regards,
Matthieu
PS : CC me as I am not subscribed to lkml.
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
int main(int argc, char *argv[])
{
char c;
char buf[1024];
int fd, i, n;
if (argc != 2)
return -1;
fd = open(argv[1], O_RDONLY);
if (fd < 0) {
perror("wait_read - open fail");
return -1;
}
c = getc(stdin);
n = read(fd, buf, 1024);
for (i = 0; i < n; i++)
putc(buf[i], stdout);
if (n < 0)
perror("wait_read - read fail");
else
putc('\n', stdout);
close(fd);
}
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]