]> git.karo-electronics.de Git - karo-tx-linux.git/commit
cifs: Fix a kernel BUG with remote OS/2 server (try #3)
authorSuresh Jayaraman <sjayaraman@suse.de>
Wed, 31 Mar 2010 06:30:03 +0000 (12:00 +0530)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 26 Apr 2010 14:47:51 +0000 (07:47 -0700)
commitc171476c7ddde592eafb085d8a5d95ce4f1b3ef2
tree1c1575d483089edf837118af633b59832ac4f35c
parent86c4129a017aaade3bc1fe3f47156ffd99e16f16
cifs: Fix a kernel BUG with remote OS/2 server (try #3)

commit 6513a81e9325d712f1bfb9a1d7b750134e49ff18 upstream.

While chasing a bug report involving a OS/2 server, I noticed the server sets
pSMBr->CountHigh to a incorrect value even in case of normal writes. This
results in 'nbytes' being computed wrongly and triggers a kernel BUG at
mm/filemap.c.

void iov_iter_advance(struct iov_iter *i, size_t bytes)
{
        BUG_ON(i->count < bytes);    <--- BUG here

Why the server is setting 'CountHigh' is not clear but only does so after
writing 64k bytes. Though this looks like the server bug, the client side
crash may not be acceptable.

The workaround is to mask off high 16 bits if the number of bytes written as
returned by the server is greater than the bytes requested by the client as
suggested by Jeff Layton.

Reviewed-by: Jeff Layton <jlayton@samba.org>
Signed-off-by: Suresh Jayaraman <sjayaraman@suse.de>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/cifs/cifssmb.c