summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.10/0031-cifs-fix-dentry-refcount-leak-when-opening-a-FIFO-on.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.10/0031-cifs-fix-dentry-refcount-leak-when-opening-a-FIFO-on.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.10/0031-cifs-fix-dentry-refcount-leak-when-opening-a-FIFO-on.patch64
1 files changed, 64 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.10/0031-cifs-fix-dentry-refcount-leak-when-opening-a-FIFO-on.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.10/0031-cifs-fix-dentry-refcount-leak-when-opening-a-FIFO-on.patch
new file mode 100644
index 00000000..f84f673f
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.10/0031-cifs-fix-dentry-refcount-leak-when-opening-a-FIFO-on.patch
@@ -0,0 +1,64 @@
1From 2e91a5d7bf034e302d797ab8be9a28dad94f31bf Mon Sep 17 00:00:00 2001
2From: Jeff Layton <jlayton@redhat.com>
3Date: Thu, 23 Feb 2012 09:37:45 -0500
4Subject: [PATCH 31/95] cifs: fix dentry refcount leak when opening a FIFO on
5 lookup
6
7commit 5bccda0ebc7c0331b81ac47d39e4b920b198b2cd upstream.
8
9The cifs code will attempt to open files on lookup under certain
10circumstances. What happens though if we find that the file we opened
11was actually a FIFO or other special file?
12
13Currently, the open filehandle just ends up being leaked leading to
14a dentry refcount mismatch and oops on umount. Fix this by having the
15code close the filehandle on the server if it turns out not to be a
16regular file. While we're at it, change this spaghetti if statement
17into a switch too.
18
19Reported-by: CAI Qian <caiqian@redhat.com>
20Tested-by: CAI Qian <caiqian@redhat.com>
21Reviewed-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
22Signed-off-by: Jeff Layton <jlayton@redhat.com>
23Signed-off-by: Steve French <smfrench@gmail.com>
24Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
25---
26 fs/cifs/dir.c | 20 ++++++++++++++++++--
27 1 file changed, 18 insertions(+), 2 deletions(-)
28
29diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c
30index e4c3334..bf68b4f 100644
31--- a/fs/cifs/dir.c
32+++ b/fs/cifs/dir.c
33@@ -584,10 +584,26 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry,
34 * If either that or op not supported returned, follow
35 * the normal lookup.
36 */
37- if ((rc == 0) || (rc == -ENOENT))
38+ switch (rc) {
39+ case 0:
40+ /*
41+ * The server may allow us to open things like
42+ * FIFOs, but the client isn't set up to deal
43+ * with that. If it's not a regular file, just
44+ * close it and proceed as if it were a normal
45+ * lookup.
46+ */
47+ if (newInode && !S_ISREG(newInode->i_mode)) {
48+ CIFSSMBClose(xid, pTcon, fileHandle);
49+ break;
50+ }
51+ case -ENOENT:
52 posix_open = true;
53- else if ((rc == -EINVAL) || (rc != -EOPNOTSUPP))
54+ case -EOPNOTSUPP:
55+ break;
56+ default:
57 pTcon->broken_posix_open = true;
58+ }
59 }
60 if (!posix_open)
61 rc = cifs_get_inode_info_unix(&newInode, full_path,
62--
631.7.9.4
64