Skip to content

Commit 2e2d64a

Browse files
author
Al Viro
committed
do_filp_open(): DTRT when getting ERR_PTR() as pathname
The rest of the set_nameidata() callers treat IS_ERR(pathname) as "bail out immediately with PTR_ERR(pathname) as error". Makes life simpler for callers; do_filp_open() is the only exception and its callers would also benefit from such calling conventions change. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent ba33ac1 commit 2e2d64a

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/namei.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4871,6 +4871,8 @@ struct file *do_filp_open(int dfd, struct filename *pathname,
48714871
int flags = op->lookup_flags;
48724872
struct file *filp;
48734873

4874+
if (IS_ERR(pathname))
4875+
return ERR_CAST(pathname);
48744876
set_nameidata(&nd, dfd, pathname, NULL);
48754877
filp = path_openat(&nd, op, flags | LOOKUP_RCU);
48764878
if (unlikely(filp == ERR_PTR(-ECHILD)))

0 commit comments

Comments
 (0)