2012-11-14 15:23:42

by Cyrill Gorcunov

[permalink] [raw]
Subject: [patch 5/7] fs, exportfs: Escape nil dereference if no s_export_op present

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]>
CC: 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: Andrew Morton <[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]>
---
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);


2012-11-15 13:50:22

by Pavel Emelyanov

[permalink] [raw]
Subject: Re: [patch 5/7] fs, exportfs: Escape nil dereference if no s_export_op present

On 11/14/2012 07:19 PM, Cyrill Gorcunov wrote:
> 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]>
> CC: 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: Andrew Morton <[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]>
> ---


Acked-by: Pavel Emelyanov <[email protected]>