Commit 1dbbf0b8 authored by James Morris's avatar James Morris Committed by Linus Torvalds

[PATCH] Add security_file_permission() to AIO paths.

Currently, there are no LSM hooks in the AIO codepaths, which means that
LSM based access controls are not revalidated upon AIO read and write
operations.  The patch below adds the security_file_permission() LSM hook
prior to the VFS aio_read()/aio_write() calls.
Signed-off-by: default avatarJames Morris <jmorris@redhat.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b455111c
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include <linux/aio.h> #include <linux/aio.h>
#include <linux/highmem.h> #include <linux/highmem.h>
#include <linux/workqueue.h> #include <linux/workqueue.h>
#include <linux/security.h>
#include <asm/kmap_types.h> #include <asm/kmap_types.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
...@@ -1036,6 +1037,9 @@ int fastcall io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, ...@@ -1036,6 +1037,9 @@ int fastcall io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
ret = -EFAULT; ret = -EFAULT;
if (unlikely(!access_ok(VERIFY_WRITE, buf, iocb->aio_nbytes))) if (unlikely(!access_ok(VERIFY_WRITE, buf, iocb->aio_nbytes)))
goto out_put_req; goto out_put_req;
ret = security_file_permission (file, MAY_READ);
if (ret)
goto out_put_req;
ret = -EINVAL; ret = -EINVAL;
if (file->f_op->aio_read) if (file->f_op->aio_read)
ret = file->f_op->aio_read(req, buf, ret = file->f_op->aio_read(req, buf,
...@@ -1048,6 +1052,9 @@ int fastcall io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb, ...@@ -1048,6 +1052,9 @@ int fastcall io_submit_one(struct kioctx *ctx, struct iocb __user *user_iocb,
ret = -EFAULT; ret = -EFAULT;
if (unlikely(!access_ok(VERIFY_READ, buf, iocb->aio_nbytes))) if (unlikely(!access_ok(VERIFY_READ, buf, iocb->aio_nbytes)))
goto out_put_req; goto out_put_req;
ret = security_file_permission (file, MAY_WRITE);
if (ret)
goto out_put_req;
ret = -EINVAL; ret = -EINVAL;
if (file->f_op->aio_write) if (file->f_op->aio_write)
ret = file->f_op->aio_write(req, buf, ret = file->f_op->aio_write(req, buf,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment