diff options
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/namei.c b/fs/namei.c index d3c190c35fcc..87f97ba90ad1 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1656,6 +1656,15 @@ struct file *do_filp_open(int dfd, const char *pathname, | |||
1656 | int will_write; | 1656 | int will_write; |
1657 | int flag = open_to_namei_flags(open_flag); | 1657 | int flag = open_to_namei_flags(open_flag); |
1658 | 1658 | ||
1659 | /* | ||
1660 | * O_SYNC is implemented as __O_SYNC|O_DSYNC. As many places only | ||
1661 | * check for O_DSYNC if the need any syncing at all we enforce it's | ||
1662 | * always set instead of having to deal with possibly weird behaviour | ||
1663 | * for malicious applications setting only __O_SYNC. | ||
1664 | */ | ||
1665 | if (open_flag & __O_SYNC) | ||
1666 | open_flag |= O_DSYNC; | ||
1667 | |||
1659 | if (!acc_mode) | 1668 | if (!acc_mode) |
1660 | acc_mode = MAY_OPEN | ACC_MODE(flag); | 1669 | acc_mode = MAY_OPEN | ACC_MODE(flag); |
1661 | 1670 | ||