From: Manfred Spraul <manfred@colorfullife.com>
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.
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);
+ if (!ppos)
+ ppos = &in_file->f_pos;
+ retval = locks_verify_area(FLOCK_VERIFY_READ, in_inode, in_file, *ppos, count);
if (retval)
goto fput_in;
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);