On Sat, Oct 05, 2024 at 03:14:14PM -0700, Linus Torvalds wrote: > There are probably other cases that just do "get_file()" on an > existing 'struct file *" directly, but it's usually fairly hard to get > users to refer to file pointers without giving an actual file > descriptor number. But things like "split a vma" will do it (on the > file that is mapped), and probably a few other cases, but I bet it > really is just a few cases. You can keep sending SCM_RIGHTS packets filled with references to the same file, for example... Anyway, which error would you return? EBADF? Because fget() callers really expect a struct file reference or NULL. Sure, we can teach that to return ERR_PTR() and deal with all callers (not that many these days), but then there's fdget(). I've looked through those recently; more than half treats "not open" as EBADF, but there's a bunch of EINVAL, etc.