[PATCH] nfs: avoid oops when CONFIG_NFS_V3_ACL is not set

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If we don't have s_xattr set we must not call the generic xattr
inode operations:

[  198.564281] BUG: unable to handle kernel NULL pointer dereference at
+(null)
[  198.581957] IP: [<ffffffff811ab510>] generic_getxattr+0x20/0x90
[  198.595266] PGD baaf2067 PUD ba4f4067 PMD 0
[  198.605033] Oops: 0000 [#1] SMP


Signed-off-by: Christoph Hellwig <hch@xxxxxx>
Reported-by: Chris Mason <clm@xxxxxx>
Tested-by: Chris Mason <clm@xxxxxx>

diff --git a/fs/nfs/nfs3proc.c b/fs/nfs/nfs3proc.c
index d2255d7..aa9bc97 100644
--- a/fs/nfs/nfs3proc.c
+++ b/fs/nfs/nfs3proc.c
@@ -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
@@ -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
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux