summaryrefslogtreecommitdiffstats
path: root/fs/jfs
diff options
context:
space:
mode:
authorWilliam Burrow <wbkernel@gmail.com>2014-05-29 04:05:55 +0200
committerDave Kleikamp <dave.kleikamp@oracle.com>2014-05-29 04:19:02 +0200
commite31da3f98d3b8626b32cf7806ef4da540bf70820 (patch)
treebd183efdd97319715b1054b03341f92cb61173c2 /fs/jfs
parentfs/jfs/jfs_inode.c: atomically set inode->i_flags (diff)
downloadlinux-e31da3f98d3b8626b32cf7806ef4da540bf70820.tar.xz
linux-e31da3f98d3b8626b32cf7806ef4da540bf70820.zip
JFS: Check for NULL before calling posix_acl_equiv_mode()
Check for NULL before using the acl in the access type switch statement. This seems to be consistent with what is done in the JFFS and ext4 filesystems and with the behaviour of JFS in the 3.13 kernel. The bug seemed to be introduced in commit 2cc6a5a0. The bug results in a kernel Oops, NULL dereference could not be handled when accessing a JFS filesystem. The rdiff-backup process seemed to trigger the bug. See also reported bug #75341: https://bugzilla.kernel.org/show_bug.cgi?id=75341 Signed-off-by: William Burrow <wbkernel@gmail.com> Signed-off-by: Dave Kleikamp <dave.kleikamp@oracle.com>
Diffstat (limited to 'fs/jfs')
-rw-r--r--fs/jfs/acl.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/fs/jfs/acl.c b/fs/jfs/acl.c
index 5a8ea16eedbc..0c8ca830b113 100644
--- a/fs/jfs/acl.c
+++ b/fs/jfs/acl.c
@@ -83,13 +83,15 @@ static int __jfs_set_acl(tid_t tid, struct inode *inode, int type,
switch (type) {
case ACL_TYPE_ACCESS:
ea_name = POSIX_ACL_XATTR_ACCESS;
- rc = posix_acl_equiv_mode(acl, &inode->i_mode);
- if (rc < 0)
- return rc;
- inode->i_ctime = CURRENT_TIME;
- mark_inode_dirty(inode);
- if (rc == 0)
- acl = NULL;
+ if (acl) {
+ rc = posix_acl_equiv_mode(acl, &inode->i_mode);
+ if (rc < 0)
+ return rc;
+ inode->i_ctime = CURRENT_TIME;
+ mark_inode_dirty(inode);
+ if (rc == 0)
+ acl = NULL;
+ }
break;
case ACL_TYPE_DEFAULT:
ea_name = POSIX_ACL_XATTR_DEFAULT;