]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
fs, exportfs: escape nil dereference if no s_export_op present
authorCyrill Gorcunov <gorcunov@openvz.org>
Thu, 29 Nov 2012 03:19:19 +0000 (14:19 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 5 Dec 2012 05:23:58 +0000 (16:23 +1100)
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 <gorcunov@openvz.org>
Acked-by: Pavel Emelyanov <xemul@parallels.com>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Andrey Vagin <avagin@openvz.org>
Cc: Al Viro <viro@ZenIV.linux.org.uk>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: James Bottomley <jbottomley@parallels.com>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Matthew Helsley <matt.helsley@gmail.com>
Cc: "J. Bruce Fields" <bfields@fieldses.org>
Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
Cc: Tvrtko Ursulin <tvrtko.ursulin@onelan.co.uk>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
fs/exportfs/expfs.c

index f1f1c59c2966cc6aac49fa103cad3012bb495044..7fb6b190d75bc0e4ff051c62f526d39c47911157 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);