NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
kern/58210: linux_sync_file missing struct file::f_data initialization
>Number: 58210
>Category: kern
>Synopsis: linux_sync_file missing struct file::f_data initialization
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: kern-bug-people
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Apr 28 15:30:00 +0000 2024
>Originator: Taylor R Campbell
>Release: current, 10
>Organization:
Sync Linux/kNetBSD Fileoperations
>Environment:
>Description:
sync_file_create doesn't record a pointer from the struct file to the struct sync_file state -- it just initializes some other members:
60 fp->f_type = DTYPE_MISC;
61 fp->f_flag = FREAD | FWRITE;
62 fp->f_ops = &sync_file_ops;
https://nxr.netbsd.org/xref/src/sys/external/bsd/drm2/linux/linux_sync_file.c?r=1.2#47
So when other operations like sync_file_poll and sync_file_close try to use it, well, it doesn't work very well:
67 static int
68 sync_file_close(struct file *fp)
69 {
70 struct sync_file *sf = fp->f_data;
71
72 if (sf->sf_polling)
https://nxr.netbsd.org/xref/src/sys/external/bsd/drm2/linux/linux_sync_file.c?r=1.2#67
(This linux_sync_file.c draft hasn't seen a lot of use, apparently.)
>How-To-Repeat:
do something that involves sync_files
>Fix:
fp->f_data = sf
Home |
Main Index |
Thread Index |
Old Index