diff options
-rw-r--r-- | fs/xfs/xfs_file.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/fs/xfs/xfs_file.c b/fs/xfs/xfs_file.c index f3e4fbb59985..71c2c712e609 100644 --- a/fs/xfs/xfs_file.c +++ b/fs/xfs/xfs_file.c | |||
@@ -563,6 +563,13 @@ restart: | |||
563 | if (error) | 563 | if (error) |
564 | return error; | 564 | return error; |
565 | 565 | ||
566 | /* For changing security info in file_remove_privs() we need i_mutex */ | ||
567 | if (*iolock == XFS_IOLOCK_SHARED && !IS_NOSEC(inode)) { | ||
568 | xfs_rw_iunlock(ip, *iolock); | ||
569 | *iolock = XFS_IOLOCK_EXCL; | ||
570 | xfs_rw_ilock(ip, *iolock); | ||
571 | goto restart; | ||
572 | } | ||
566 | /* | 573 | /* |
567 | * If the offset is beyond the size of the file, we need to zero any | 574 | * If the offset is beyond the size of the file, we need to zero any |
568 | * blocks that fall between the existing EOF and the start of this | 575 | * blocks that fall between the existing EOF and the start of this |
@@ -623,7 +630,9 @@ restart: | |||
623 | * setgid bits if the process is not being run by root. This keeps | 630 | * setgid bits if the process is not being run by root. This keeps |
624 | * people from modifying setuid and setgid binaries. | 631 | * people from modifying setuid and setgid binaries. |
625 | */ | 632 | */ |
626 | return file_remove_privs(file); | 633 | if (!IS_NOSEC(inode)) |
634 | return file_remove_privs(file); | ||
635 | return 0; | ||
627 | } | 636 | } |
628 | 637 | ||
629 | /* | 638 | /* |