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

From: Cyrill Gorcunov
Date: Thu Aug 23 2012 - 06:49:30 EST


If there is no s_export_op present in a target superblock
we might have nil dereference. Fix it with eplicit test
if s_export_op is provided.

Signed-off-by: Cyrill Gorcunov <gorcunov@xxxxxxxxxx>
CC: Pavel Emelyanov <xemul@xxxxxxxxxxxxx>
CC: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
CC: Alexey Dobriyan <adobriyan@xxxxxxxxx>
CC: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
CC: James Bottomley <jbottomley@xxxxxxxxxxxxx>
CC: "Aneesh Kumar K.V" <aneesh.kumar@xxxxxxxxxxxxxxxxxx>
CC: Alexey Dobriyan <adobriyan@xxxxxxxxx>
CC: Matthew Helsley <matt.helsley@xxxxxxxxx>
CC: "J. Bruce Fields" <bfields@xxxxxxxxxxxx>
CC: "Aneesh Kumar K.V" <aneesh.kumar@xxxxxxxxxxxxxxxxxx>
---
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);

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/