summaryrefslogtreecommitdiff
path: root/fs/readdir.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@redhat.com>2009-07-21 19:42:03 -0400
committerSteve French <sfrench@us.ibm.com>2009-07-22 21:08:00 +0000
commit03aa3a49ad3592a9e4e1ab19c6da3e852288caf1 (patch)
treeeaaa507b6debb862f551d9d3c750b4889e3131ed /fs/readdir.c
parentce6e7fcd43aab1f77e56aa36936dd7d2d05a1ffa (diff)
cifs: fix sb->s_maxbytes so that it casts properly to a signed value
This off-by-one bug causes sendfile() to not work properly. When a task calls sendfile() on a file on a CIFS filesystem, the syscall returns -1 and sets errno to EOVERFLOW. do_sendfile uses s_maxbytes to verify the returned offset of the file. The problem there is that this value is cast to a signed value (loff_t). When this is done on the s_maxbytes value that cifs uses, it becomes negative and the comparisons against it fail. Even though s_maxbytes is an unsigned value, it seems that it's not OK to set it in such a way that it'll end up negative when it's cast to a signed value. These casts happen in other codepaths besides sendfile too, but the VFS is a little hard to follow in this area and I can't be sure if there are other bugs that this will fix. It's not clear to me why s_maxbytes isn't just declared as loff_t in the first place, but either way we still need to fix these values to make sendfile work properly. This is also an opportunity to replace the magic bit-shift values here with the standard #defines for this. This fixes the reproducer program I have that does a sendfile and will probably also fix the situation where apache is serving from a CIFS share. Acked-by: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Steve French <sfrench@us.ibm.com>
Diffstat (limited to 'fs/readdir.c')
0 files changed, 0 insertions, 0 deletions