From: James Morris Date: Wed, 26 Apr 2006 15:11:00 +0000 (+0000) Subject: [PATCH] LSM: add missing hook to do_compat_readv_writev() X-Git-Tag: v2.6.16.12~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9120b4470e2e57f196a0e470898ae628725fb4c2;p=thirdparty%2Fkernel%2Fstable.git [PATCH] LSM: add missing hook to do_compat_readv_writev() 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 Signed-off-by: Al Viro Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman Signed-off-by: Chris Wright --- diff --git a/fs/compat.c b/fs/compat.c index 5333c7d7427f6..04f6fb53340cf 100644 --- a/fs/compat.c +++ b/fs/compat.c @@ -1215,6 +1215,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;