Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs: pull up trailing slashes check for O_CREAT

Perform the check for trailing slashes right in the fastpath check and
don't bother with any additional work.

Signed-off-by: Christian Brauner <brauner@kernel.org>

+4 -8
+4 -8
fs/namei.c
··· 3618 3618 struct dentry *dentry; 3619 3619 3620 3620 if (open_flag & O_CREAT) { 3621 + if (trailing_slashes(nd)) 3622 + return ERR_PTR(-EISDIR); 3623 + 3621 3624 /* Don't bother on an O_EXCL create */ 3622 3625 if (open_flag & O_EXCL) 3623 3626 return NULL; ··· 3687 3684 bool unlazied; 3688 3685 3689 3686 /* can stay in rcuwalk if not auditing */ 3690 - if (dentry && audit_dummy_context()) { 3691 - if (trailing_slashes(nd)) 3692 - return ERR_PTR(-EISDIR); 3687 + if (dentry && audit_dummy_context()) 3693 3688 goto finish_lookup; 3694 - } 3695 3689 unlazied = dentry ? try_to_unlazy_next(nd, dentry) : 3696 3690 try_to_unlazy(nd); 3697 3691 if (!unlazied) 3698 3692 return ERR_PTR(-ECHILD); 3699 - } 3700 - if (trailing_slashes(nd)) { 3701 - dput(dentry); 3702 - return ERR_PTR(-EISDIR); 3703 3693 } 3704 3694 if (dentry) 3705 3695 goto finish_lookup;