]> git.karo-electronics.de Git - karo-tx-linux.git/commit
cifs: fix dentry refcount leak when opening a FIFO on lookup
authorJeff Layton <jlayton@redhat.com>
Thu, 23 Feb 2012 14:37:45 +0000 (09:37 -0500)
committerPaul Gortmaker <paul.gortmaker@windriver.com>
Fri, 17 Aug 2012 19:35:01 +0000 (15:35 -0400)
commit8c5fbff9c14a04599bc003f1e2ab832a28d7bfb6
treebe5bd06671dbe537f85dad4749b6c5ac18a1ddbf
parent9b8bef04268052450e00719b178f1879048a32b5
cifs: fix dentry refcount leak when opening a FIFO on lookup

commit 5bccda0ebc7c0331b81ac47d39e4b920b198b2cd upstream.

The cifs code will attempt to open files on lookup under certain
circumstances. What happens though if we find that the file we opened
was actually a FIFO or other special file?

Currently, the open filehandle just ends up being leaked leading to
a dentry refcount mismatch and oops on umount. Fix this by having the
code close the filehandle on the server if it turns out not to be a
regular file. While we're at it, change this spaghetti if statement
into a switch too.

Reported-by: CAI Qian <caiqian@redhat.com>
Tested-by: CAI Qian <caiqian@redhat.com>
Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Signed-off-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <smfrench@gmail.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
fs/cifs/dir.c