Commit 40b39136f07279fdc868a36cba050f4e84ce0ace
1 parent
f374ed5fa8
Exists in
master
and in
20 other branches
path_openat: clean ELOOP handling a bit
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Showing 1 changed file with 6 additions and 8 deletions Side-by-side Diff
fs/namei.c
... | ... | @@ -2320,11 +2320,12 @@ |
2320 | 2320 | struct path link = path; |
2321 | 2321 | struct inode *linki = link.dentry->d_inode; |
2322 | 2322 | void *cookie; |
2323 | - error = -ELOOP; | |
2324 | - if (!(nd.flags & LOOKUP_FOLLOW)) | |
2325 | - goto exit_dput; | |
2326 | - if (count++ == 32) | |
2327 | - goto exit_dput; | |
2323 | + if (!(nd.flags & LOOKUP_FOLLOW) || count++ == 32) { | |
2324 | + path_put_conditional(&path, &nd); | |
2325 | + path_put(&nd.path); | |
2326 | + filp = ERR_PTR(-ELOOP); | |
2327 | + break; | |
2328 | + } | |
2328 | 2329 | /* |
2329 | 2330 | * This is subtle. Instead of calling do_follow_link() we do |
2330 | 2331 | * the thing by hands. The reason is that this way we have zero |
... | ... | @@ -2355,9 +2356,6 @@ |
2355 | 2356 | release_open_intent(&nd); |
2356 | 2357 | return filp; |
2357 | 2358 | |
2358 | -exit_dput: | |
2359 | - path_put_conditional(&path, &nd); | |
2360 | - path_put(&nd.path); | |
2361 | 2359 | out_filp: |
2362 | 2360 | filp = ERR_PTR(error); |
2363 | 2361 | goto out; |