Right.
Great, I was hoping someone picks up the missing pieces. Maybe someone
else can do the same for the sound drivers ;-).
Sure, that absolutely makes sense.
The usb-serial driver has a few instances where it takes the BKL
in the mainline code, but this gets converted to the Big TTY Mutex
in my series. The ioctl method in there is fine as far as I can tell.
That function could be removed in favor of using generic_file_ioctl
and setting i_size to up->size.
Also, the race is only between concurrent calls of llseek on
the same file descriptor, which is undefined anyway.
The current code also doesn't protect you against partial updates
of f_pos during ->read() on 32 bit systems (nothing ever does),
and it even fails to protect against the concurrent llseek race
because the assignment is done outside of the f_pos update.
The patch looks correct, but I probably wouldn't bother with the rename,
and simply drop the BKL in the caller.
The serial_ioctl function is already called without the BKL, depite the
name. tty_operations->ioctl was converted a long time ago, so I guess this
patch can be dropped from your series.
Arnd
--