cifs: fix oops while traversing open file list (try #4)
authorShirish Pargaonkar <shirishpargaonkar@gmail.com>
Mon, 21 May 2012 14:20:12 +0000 (09:20 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Sun, 10 Jun 2012 13:41:33 +0000 (14:41 +0100)
commit7a35b41ff5811ed26e5265ad2c594062e4565571
tree206a2963dbd9b0fdade046103fdf7ba3fc2bed44
parent27b4384504c58e94b0938b467261f893aeab9966
cifs: fix oops while traversing open file list (try #4)

commit 2c0c2a08bed7a3b791f88d09d16ace56acb3dd98 upstream.

While traversing the linked list of open file handles, if the identfied
file handle is invalid, a reopen is attempted and if it fails, we
resume traversing where we stopped and cifs can oops while accessing
invalid next element, for list might have changed.

So mark the invalid file handle and attempt reopen if no
valid file handle is found in rest of the list.
If reopen fails, move the invalid file handle to the end of the list
and start traversing the list again from the begining.
Repeat this four times before giving up and returning an error if
file reopen keeps failing.

Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
fs/cifs/cifsglob.h
fs/cifs/file.c