diff options
| author | Robert Love <rml@tech9.net> | 2002-02-05 18:46:45 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@penguin.transmeta.com> | 2002-02-05 18:46:45 -0800 |
| commit | 3ffa0b66d4bef1a4e5fe5d71e2c5dd3e72093b7f (patch) | |
| tree | 8fd249ec96b8475a2c30c0621106ecd82bf245ae /drivers/usb/devio.c | |
| parent | a0289e82ce4e460e7f9013993bdc5e69dd2fb1a6 (diff) | |
[PATCH] 2.5.4-pre1: further llseek cleanup (3/3)
The previous patch did not provide protection for device lseek methods
(drivers/* stuff). This patch pushes the BKL into each of the remaining
lseek methods -- without them we have a race.
I'd much prefer to have a a better lock to push down than the BKL, but
that will have to wait.
Before you balk at the size, remember patch #2 in this series which
removed much code ;-)
Thanks to Al for assistance, especially a listing of affected files.
Robert Love
Diffstat (limited to 'drivers/usb/devio.c')
| -rw-r--r-- | drivers/usb/devio.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/usb/devio.c b/drivers/usb/devio.c index c7883b376139..342c049e24ca 100644 --- a/drivers/usb/devio.c +++ b/drivers/usb/devio.c @@ -58,21 +58,26 @@ struct async { static loff_t usbdev_lseek(struct file *file, loff_t offset, int orig) { + loff_t ret; + + lock_kernel(); + switch (orig) { case 0: file->f_pos = offset; - return file->f_pos; - + ret = file->f_pos; + break; case 1: file->f_pos += offset; - return file->f_pos; - + ret = file->f_pos; + break; case 2: - return -EINVAL; - default: - return -EINVAL; + ret = -EINVAL; } + + unlock_kernel(); + return ret; } static ssize_t usbdev_read(struct file *file, char * buf, size_t nbytes, loff_t *ppos) |
