提交 5f13ee9c 编写于 作者: C Christoph Hellwig 提交者: Linus Torvalds

nfs: fix xattr inode op pointers when disabled

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: NChris Mason <clm@fb.com>
Acked-by: Al Viro viro@zeniv.linux.org.uk>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 9b0cd304
...@@ -924,11 +924,11 @@ static const struct inode_operations nfs3_dir_inode_operations = { ...@@ -924,11 +924,11 @@ static const struct inode_operations nfs3_dir_inode_operations = {
.permission = nfs_permission, .permission = nfs_permission,
.getattr = nfs_getattr, .getattr = nfs_getattr,
.setattr = nfs_setattr, .setattr = nfs_setattr,
#ifdef CONFIG_NFS_V3_ACL
.listxattr = generic_listxattr, .listxattr = generic_listxattr,
.getxattr = generic_getxattr, .getxattr = generic_getxattr,
.setxattr = generic_setxattr, .setxattr = generic_setxattr,
.removexattr = generic_removexattr, .removexattr = generic_removexattr,
#ifdef CONFIG_NFS_V3_ACL
.get_acl = nfs3_get_acl, .get_acl = nfs3_get_acl,
.set_acl = nfs3_set_acl, .set_acl = nfs3_set_acl,
#endif #endif
...@@ -938,11 +938,11 @@ static const struct inode_operations nfs3_file_inode_operations = { ...@@ -938,11 +938,11 @@ static const struct inode_operations nfs3_file_inode_operations = {
.permission = nfs_permission, .permission = nfs_permission,
.getattr = nfs_getattr, .getattr = nfs_getattr,
.setattr = nfs_setattr, .setattr = nfs_setattr,
#ifdef CONFIG_NFS_V3_ACL
.listxattr = generic_listxattr, .listxattr = generic_listxattr,
.getxattr = generic_getxattr, .getxattr = generic_getxattr,
.setxattr = generic_setxattr, .setxattr = generic_setxattr,
.removexattr = generic_removexattr, .removexattr = generic_removexattr,
#ifdef CONFIG_NFS_V3_ACL
.get_acl = nfs3_get_acl, .get_acl = nfs3_get_acl,
.set_acl = nfs3_set_acl, .set_acl = nfs3_set_acl,
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册