diff options
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 31 |
1 files changed, 9 insertions, 22 deletions
diff --git a/fs/namei.c b/fs/namei.c index d11f404667e9..87f97ba90ad1 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1279,28 +1279,6 @@ struct dentry *lookup_one_len(const char *name, struct dentry *base, int len) | |||
1279 | return __lookup_hash(&this, base, NULL); | 1279 | return __lookup_hash(&this, base, NULL); |
1280 | } | 1280 | } |
1281 | 1281 | ||
1282 | /** | ||
1283 | * lookup_one_noperm - bad hack for sysfs | ||
1284 | * @name: pathname component to lookup | ||
1285 | * @base: base directory to lookup from | ||
1286 | * | ||
1287 | * This is a variant of lookup_one_len that doesn't perform any permission | ||
1288 | * checks. It's a horrible hack to work around the braindead sysfs | ||
1289 | * architecture and should not be used anywhere else. | ||
1290 | * | ||
1291 | * DON'T USE THIS FUNCTION EVER, thanks. | ||
1292 | */ | ||
1293 | struct dentry *lookup_one_noperm(const char *name, struct dentry *base) | ||
1294 | { | ||
1295 | int err; | ||
1296 | struct qstr this; | ||
1297 | |||
1298 | err = __lookup_one_len(name, &this, base, strlen(name)); | ||
1299 | if (err) | ||
1300 | return ERR_PTR(err); | ||
1301 | return __lookup_hash(&this, base, NULL); | ||
1302 | } | ||
1303 | |||
1304 | int user_path_at(int dfd, const char __user *name, unsigned flags, | 1282 | int user_path_at(int dfd, const char __user *name, unsigned flags, |
1305 | struct path *path) | 1283 | struct path *path) |
1306 | { | 1284 | { |
@@ -1678,6 +1656,15 @@ struct file *do_filp_open(int dfd, const char *pathname, | |||
1678 | int will_write; | 1656 | int will_write; |
1679 | int flag = open_to_namei_flags(open_flag); | 1657 | int flag = open_to_namei_flags(open_flag); |
1680 | 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 | |||
1681 | if (!acc_mode) | 1668 | if (!acc_mode) |
1682 | acc_mode = MAY_OPEN | ACC_MODE(flag); | 1669 | acc_mode = MAY_OPEN | ACC_MODE(flag); |
1683 | 1670 | ||