Commit 8766ce41 authored by Kostik Belousov's avatar Kostik Belousov Committed by Linus Torvalds

[PATCH] aio syscalls are not checked by lsm

Another case of missing call to security_file_permission: aio functions
(namely, io_submit) does not check credentials with security modules.

Below is the simple patch to the problem.  It seems that it is enough to
check for rights at the request submission time.
Signed-off-by: default avatarKostik Belousov <kostikbel@gmail.com>
Signed-off-by: default avatarChris Wright <chrisw@osdl.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent a9913044
...@@ -1397,6 +1397,9 @@ static ssize_t aio_setup_iocb(struct kiocb *kiocb) ...@@ -1397,6 +1397,9 @@ static ssize_t aio_setup_iocb(struct kiocb *kiocb)
if (unlikely(!access_ok(VERIFY_WRITE, kiocb->ki_buf, if (unlikely(!access_ok(VERIFY_WRITE, kiocb->ki_buf,
kiocb->ki_left))) kiocb->ki_left)))
break; break;
ret = security_file_permission(file, MAY_READ);
if (unlikely(ret))
break;
ret = -EINVAL; ret = -EINVAL;
if (file->f_op->aio_read) if (file->f_op->aio_read)
kiocb->ki_retry = aio_pread; kiocb->ki_retry = aio_pread;
...@@ -1409,6 +1412,9 @@ static ssize_t aio_setup_iocb(struct kiocb *kiocb) ...@@ -1409,6 +1412,9 @@ static ssize_t aio_setup_iocb(struct kiocb *kiocb)
if (unlikely(!access_ok(VERIFY_READ, kiocb->ki_buf, if (unlikely(!access_ok(VERIFY_READ, kiocb->ki_buf,
kiocb->ki_left))) kiocb->ki_left)))
break; break;
ret = security_file_permission(file, MAY_WRITE);
if (unlikely(ret))
break;
ret = -EINVAL; ret = -EINVAL;
if (file->f_op->aio_write) if (file->f_op->aio_write)
kiocb->ki_retry = aio_pwrite; kiocb->ki_retry = aio_pwrite;
......
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