]> Pileus Git - ~andy/linux/blobdiff - fs/xfs/xfs_iops.c
arm64: perf: fix array out of bounds access in armpmu_map_hw_event()
[~andy/linux] / fs / xfs / xfs_iops.c
index c69bbc493cb0c7d09cd5d3f8c271e0091228968a..96dda62d497b7e04a68a1a6ddfc579aececf8374 100644 (file)
@@ -467,9 +467,6 @@ xfs_setattr_mode(
        ASSERT(tp);
        ASSERT(xfs_isilocked(ip, XFS_ILOCK_EXCL));
 
-       if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID))
-               mode &= ~S_ISGID;
-
        ip->i_d.di_mode &= S_IFMT;
        ip->i_d.di_mode |= mode & ~S_IFMT;
 
@@ -495,15 +492,18 @@ xfs_setattr_nonsize(
 
        trace_xfs_setattr(ip);
 
-       if (mp->m_flags & XFS_MOUNT_RDONLY)
-               return XFS_ERROR(EROFS);
+       /* If acls are being inherited, we already have this checked */
+       if (!(flags & XFS_ATTR_NOACL)) {
+               if (mp->m_flags & XFS_MOUNT_RDONLY)
+                       return XFS_ERROR(EROFS);
 
-       if (XFS_FORCED_SHUTDOWN(mp))
-               return XFS_ERROR(EIO);
+               if (XFS_FORCED_SHUTDOWN(mp))
+                       return XFS_ERROR(EIO);
 
-       error = -inode_change_ok(inode, iattr);
-       if (error)
-               return XFS_ERROR(error);
+               error = -inode_change_ok(inode, iattr);
+               if (error)
+                       return XFS_ERROR(error);
+       }
 
        ASSERT((mask & ATTR_SIZE) == 0);
 
@@ -539,7 +539,7 @@ xfs_setattr_nonsize(
                ASSERT(udqp == NULL);
                ASSERT(gdqp == NULL);
                error = xfs_qm_vop_dqalloc(ip, uid, gid, xfs_get_projid(ip),
-                                        qflags, &udqp, &gdqp);
+                                        qflags, &udqp, &gdqp, NULL);
                if (error)
                        return error;
        }
@@ -575,7 +575,7 @@ xfs_setattr_nonsize(
                     (XFS_IS_GQUOTA_ON(mp) && igid != gid))) {
                        ASSERT(tp);
                        error = xfs_qm_vop_chown_reserve(tp, ip, udqp, gdqp,
-                                               capable(CAP_FOWNER) ?
+                                               NULL, capable(CAP_FOWNER) ?
                                                XFS_QMOPT_FORCE_RES : 0);
                        if (error)      /* out of quota */
                                goto out_trans_cancel;