Thread (35 messages) 35 messages, 3 authors, 2012-08-26

Re: [patch 4/9] fs, exportfs: Fix nil dereference if no s_export_op present

From: J. Bruce Fields <hidden>
Date: 2012-08-23 12:12:30
Also in: lkml

On Thu, Aug 23, 2012 at 02:43:27PM +0400, Cyrill Gorcunov wrote:
If there is no s_export_op present in a target superblock
we might have nil dereference.
Is that NULL dereference possible with current code, or is it a check
you're adding to account for a new caller that you're about to add?

I believe it's the latter, but this would be a good thing to make clear
in the changelog.

--b.
quoted hunk ↗ jump to hunk
Fix it with eplicit test
if s_export_op is provided.

Signed-off-by: Cyrill Gorcunov <redacted>
CC: Pavel Emelyanov <redacted>
CC: Al Viro <viro@ZenIV.linux.org.uk>
CC: Alexey Dobriyan <redacted>
CC: Andrew Morton <akpm@linux-foundation.org>
CC: James Bottomley <redacted>
CC: "Aneesh Kumar K.V" <redacted>
CC: Alexey Dobriyan <redacted>
CC: Matthew Helsley <redacted>
CC: "J. Bruce Fields" <redacted>
CC: "Aneesh Kumar K.V" <redacted>
---
 fs/exportfs/expfs.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6.git/fs/exportfs/expfs.c
===================================================================
--- linux-2.6.git.orig/fs/exportfs/expfs.c
+++ linux-2.6.git/fs/exportfs/expfs.c
@@ -357,7 +357,7 @@ int exportfs_encode_fh(struct dentry *de
 		 */
 		parent = p->d_inode;
 	}
-	if (nop->encode_fh)
+	if (nop && nop->encode_fh)
 		error = nop->encode_fh(inode, fid->raw, max_len, parent);
 	else
 		error = export_encode_fh(inode, fid, max_len, parent);
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help