Skip to content

Commit

Permalink
[PATCH] LSM: add missing hook to do_compat_readv_writev()
Browse files Browse the repository at this point in the history
This patch addresses a flaw in LSM, where there is no mediation of readv()
and writev() in for 32-bit compatible apps using a 64-bit kernel.

This bug was discovered and fixed initially in the native readv/writev
code [1], but was not fixed in the compat code.  Thanks to Al for spotting
this one.

  [1] http://lwn.net/Articles/154282/

Signed-off-by: James Morris <jmorris@namei.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
James Morris authored and Linus Torvalds committed Apr 26, 2006
1 parent a090d91 commit e7edf9c
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs/compat.c
Expand Up @@ -1217,6 +1217,10 @@ static ssize_t compat_do_readv_writev(int type, struct file *file,
if (ret < 0)
goto out;

ret = security_file_permission(file, type == READ ? MAY_READ:MAY_WRITE);
if (ret)
goto out;

fnv = NULL;
if (type == READ) {
fn = file->f_op->read;
Expand Down

0 comments on commit e7edf9c

Please sign in to comment.