From: Marco Stornelli <marco.stornelli@coritel.it>
To: viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] vfs: added better file aio_read aio_write operations presence check
Date: Tue, 16 Sep 2008 11:29:41 +0200 [thread overview]
Message-ID: <48CF7C85.1070309@coritel.it> (raw)
From: Marco Stornelli <marco.stornelli@gmail.com>
If a filesystem in the file operations specifies for read and write operations only do_sync_read and do_sync_write without
init aio_read and aio_write, there will be a kernel oops, because the vfs code check the presence of (to read for example)
read OR aio_read method, then it calls read if it's pointer is not null. It's not sufficient because if the read function is
actually a do_sync_read, it calls aio_read but without checking the presence. I think a BUG_ON check can be more useful.
Signed-off-by: Marco Stornelli <marco.stornelli@gmail.com>
---
--- linux-2.6.26.5/fs/read_write.c.orig 2008-08-20 20:11:37.000000000 +0200
+++ linux-2.6.26.5/fs/read_write.c 2008-09-16 11:01:13.000000000 +0200
@@ -240,6 +240,7 @@ ssize_t do_sync_read(struct file *filp,
kiocb.ki_pos = *ppos;
kiocb.ki_left = len;
+ BUG_ON(!filp->f_op->aio_read);
for (;;) {
ret = filp->f_op->aio_read(&kiocb, &iov, 1, kiocb.ki_pos);
if (ret != -EIOCBRETRY)
@@ -295,6 +296,7 @@ ssize_t do_sync_write(struct file *filp,
kiocb.ki_pos = *ppos;
kiocb.ki_left = len;
+ BUG_ON(!filp->f_op->aio_write);
for (;;) {
ret = filp->f_op->aio_write(&kiocb, &iov, 1, kiocb.ki_pos);
if (ret != -EIOCBRETRY)
next reply other threads:[~2008-09-16 9:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-16 9:29 Marco Stornelli [this message]
2008-09-16 11:03 ` [PATCH] vfs: added better file aio_read aio_write operations presence check Manish Katiyar
2008-09-16 11:13 ` Marco Stornelli
2008-09-16 11:31 ` Manish Katiyar
2008-09-16 16:36 ` Christoph Hellwig
[not found] <bcF2N-29W-1@gated-at.bofh.it>
[not found] ` <bcGBv-4eJ-1@gated-at.bofh.it>
2008-09-16 15:36 ` Bodo Eggert
2008-09-16 15:41 ` Matthew Wilcox
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48CF7C85.1070309@coritel.it \
--to=marco.stornelli@coritel.it \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.