Skip to content

Commit

Permalink
nfs: fix xattr inode op pointers when disabled
Browse files Browse the repository at this point in the history
Chris Mason reported a NULL pointer derefernence in generic_getxattr()
that was due to sb->s_xattr being NULL.

The reason is that the nfs #ifdef's for ACL support were misplaced, and
the nfs3 inode operations had the xattr operation pointers set up, even
though xattrs were not actually supported.  As a result, the xattr code
was being called without the infrastructure having been set up.

Move the #ifdef's appropriately.

Reported-and-tested-by: Chris Mason <[email protected]>
Acked-by: Al Viro [email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Christoph Hellwig authored and torvalds committed Jan 30, 2014
1 parent 9b0cd30 commit 5f13ee9
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fs/nfs/nfs3proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -924,11 +924,11 @@ static const struct inode_operations nfs3_dir_inode_operations = {
.permission = nfs_permission,
.getattr = nfs_getattr,
.setattr = nfs_setattr,
#ifdef CONFIG_NFS_V3_ACL
.listxattr = generic_listxattr,
.getxattr = generic_getxattr,
.setxattr = generic_setxattr,
.removexattr = generic_removexattr,
#ifdef CONFIG_NFS_V3_ACL
.get_acl = nfs3_get_acl,
.set_acl = nfs3_set_acl,
#endif
Expand All @@ -938,11 +938,11 @@ static const struct inode_operations nfs3_file_inode_operations = {
.permission = nfs_permission,
.getattr = nfs_getattr,
.setattr = nfs_setattr,
#ifdef CONFIG_NFS_V3_ACL
.listxattr = generic_listxattr,
.getxattr = generic_getxattr,
.setxattr = generic_setxattr,
.removexattr = generic_removexattr,
#ifdef CONFIG_NFS_V3_ACL
.get_acl = nfs3_get_acl,
.set_acl = nfs3_set_acl,
#endif
Expand Down

0 comments on commit 5f13ee9

Please sign in to comment.