[PATCH] 2.1.131, mandatory file locking bugs

Jamie Lokier (lkd@tantalophile.demon.co.uk)
Thu, 10 Dec 1998 16:59:24 +0000


Linus, Alan,

The first patch below reorders arguments to posix_locks_conflict, to
comply with the way it should be called. (This is consistent with usage
in the rest of fs/locks.c, and the prototype argument names).
posix_locks_conflict is nearly but not quite symmetric; in this case the
behaviour is unaffected.

The second is a rather obvious bug in readv/writev with mandatory
lock checking.

-- Jamie

--- linux/fs/locks.c.devel Fri Nov 20 14:21:29 1998
+++ linux/fs/locks.c Thu Dec 10 16:19:15 1998
@@ -609,7 +609,7 @@
/* Block for writes against a "read" lock,
* and both reads and writes against a "write" lock.
*/
- if (posix_locks_conflict(fl, &tfl)) {
+ if (posix_locks_conflict(&tfl, fl)) {
if (filp && (filp->f_flags & O_NONBLOCK))
return (-EAGAIN);
if (signal_pending(current))
--- linux/fs/read_write.c.devel Fri Nov 20 14:21:29 1998
+++ linux/fs/read_write.c Thu Dec 10 16:48:41 1998
@@ -215,7 +215,8 @@
tot_len += iov[i].iov_len;

inode = file->f_dentry->d_inode;
- ret = locks_verify_area((type == VERIFY_READ
+ /* VERIFY_WRITE actually means a read, as we write to user space */
+ ret = locks_verify_area((type == VERIFY_WRITE
? FLOCK_VERIFY_READ : FLOCK_VERIFY_WRITE),
inode, file, file->f_pos, tot_len);
if (ret) goto out;

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/