fs, exportfs: escape nil dereference if no s_export_op present
authorCyrill Gorcunov <[email protected]>
Tue, 18 Dec 2012 00:05:06 +0000 (16:05 -0800)
committerLinus Torvalds <[email protected]>
Tue, 18 Dec 2012 01:15:27 +0000 (17:15 -0800)
This routine will be used to generate a file handle in fdinfo output for
inotify subsystem, where if no s_export_op present the general
export_encode_fh should be used.  Thus add a test if s_export_op present
inside exportfs_encode_fh itself.

Signed-off-by: Cyrill Gorcunov <[email protected]>
Acked-by: Pavel Emelyanov <[email protected]>
Cc: Oleg Nesterov <[email protected]>
Cc: Andrey Vagin <[email protected]>
Cc: Al Viro <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Cc: James Bottomley <[email protected]>
Cc: "Aneesh Kumar K.V" <[email protected]>
Cc: Alexey Dobriyan <[email protected]>
Cc: Matthew Helsley <[email protected]>
Cc: "J. Bruce Fields" <[email protected]>
Cc: "Aneesh Kumar K.V" <[email protected]>
Cc: Tvrtko Ursulin <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/exportfs/expfs.c

index 29ab099e3e0818a9d9c85f0449c8df2e4b9b5f70..10f137381ac7ec84ca13ea3332373f091cc58f81 100644 (file)
@@ -357,7 +357,7 @@ int exportfs_encode_fh(struct dentry *dentry, struct fid *fid, int *max_len,
                 */
                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);