From: Manfred Spraul <manfred@colorfullife.com>
To: Andrew Morton <akpm@osdl.org>
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] sendfile calls lock_verify_area with wrong parameters
Date: Sun, 18 Jan 2004 13:37:09 +0100 [thread overview]
Message-ID: <400A7DF5.4060704@colorfullife.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 261 bytes --]
sendfile supports reading from a given start offset for in_file, like
pread. But for the locks_verify_area call, in_file->f_pos is always
used, even if a start offset is used. Result: wrong area is checked for
mandatory locks.
Fix attached.
--
Manfred
[-- Attachment #2: patch-locks-sendfile --]
[-- Type: text/plain, Size: 795 bytes --]
--- 2.6/fs/read_write.c 2004-01-17 12:19:38.000000000 +0100
+++ build-2.6/fs/read_write.c 2004-01-18 13:26:46.000000000 +0100
@@ -544,6 +544,8 @@
ssize_t retval;
int fput_needed_in, fput_needed_out;
+ if (!ppos)
+ ppos = &in_file->f_pos;
/*
* Get input file, and verify that it is ok..
*/
@@ -559,7 +561,7 @@
goto fput_in;
if (!in_file->f_op || !in_file->f_op->sendfile)
goto fput_in;
- retval = locks_verify_area(FLOCK_VERIFY_READ, in_inode, in_file, in_file->f_pos, count);
+ retval = locks_verify_area(FLOCK_VERIFY_READ, in_inode, in_file, *ppos, count);
if (retval)
goto fput_in;
@@ -588,9 +590,6 @@
if (retval)
goto fput_out;
- if (!ppos)
- ppos = &in_file->f_pos;
-
if (!max)
max = min(in_inode->i_sb->s_maxbytes, out_inode->i_sb->s_maxbytes);
next reply other threads:[~2004-01-18 12:37 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-01-18 12:37 Manfred Spraul [this message]
2004-01-18 13:04 ` [PATCH] sendfile calls lock_verify_area with wrong parameters Manfred Spraul
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=400A7DF5.4060704@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
/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.