@@ -166,7 +166,7 @@ int ksmbd_vfs_create(struct ksmbd_work *work, const char *name, umode_t mode)
166166 struct dentry * dentry ;
167167 int err ;
168168
169- dentry = kern_path_create (AT_FDCWD , name , & path , 0 );
169+ dentry = kern_path_create (AT_FDCWD , name , & path , LOOKUP_NO_SYMLINKS );
170170 if (IS_ERR (dentry )) {
171171 err = PTR_ERR (dentry );
172172 if (err != - ENOENT )
@@ -203,7 +203,8 @@ int ksmbd_vfs_mkdir(struct ksmbd_work *work, const char *name, umode_t mode)
203203 struct dentry * dentry ;
204204 int err ;
205205
206- dentry = kern_path_create (AT_FDCWD , name , & path , LOOKUP_DIRECTORY );
206+ dentry = kern_path_create (AT_FDCWD , name , & path ,
207+ LOOKUP_NO_SYMLINKS | LOOKUP_DIRECTORY );
207208 if (IS_ERR (dentry )) {
208209 err = PTR_ERR (dentry );
209210 if (err != - EEXIST )
@@ -588,16 +589,11 @@ int ksmbd_vfs_remove_file(struct ksmbd_work *work, char *name)
588589 struct path path ;
589590 struct dentry * parent ;
590591 int err ;
591- int flags = 0 ;
592592
593593 if (ksmbd_override_fsids (work ))
594594 return - ENOMEM ;
595595
596- if (test_share_config_flag (work -> tcon -> share_conf ,
597- KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS ))
598- flags = LOOKUP_FOLLOW ;
599-
600- err = kern_path (name , flags , & path );
596+ err = kern_path (name , LOOKUP_NO_SYMLINKS , & path );
601597 if (err ) {
602598 ksmbd_debug (VFS , "can't get %s, err %d\n" , name , err );
603599 ksmbd_revert_fsids (work );
@@ -652,24 +648,19 @@ int ksmbd_vfs_link(struct ksmbd_work *work, const char *oldname,
652648 struct path oldpath , newpath ;
653649 struct dentry * dentry ;
654650 int err ;
655- int flags = 0 ;
656651
657652 if (ksmbd_override_fsids (work ))
658653 return - ENOMEM ;
659654
660- if (test_share_config_flag (work -> tcon -> share_conf ,
661- KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS ))
662- flags = LOOKUP_FOLLOW ;
663-
664- err = kern_path (oldname , flags , & oldpath );
655+ err = kern_path (oldname , LOOKUP_NO_SYMLINKS , & oldpath );
665656 if (err ) {
666657 pr_err ("cannot get linux path for %s, err = %d\n" ,
667658 oldname , err );
668659 goto out1 ;
669660 }
670661
671662 dentry = kern_path_create (AT_FDCWD , newname , & newpath ,
672- flags | LOOKUP_REVAL );
663+ LOOKUP_NO_SYMLINKS | LOOKUP_REVAL );
673664 if (IS_ERR (dentry )) {
674665 err = PTR_ERR (dentry );
675666 pr_err ("path create err for %s, err %d\n" , newname , err );
@@ -788,7 +779,6 @@ int ksmbd_vfs_fp_rename(struct ksmbd_work *work, struct ksmbd_file *fp,
788779 struct dentry * src_dent , * trap_dent , * src_child ;
789780 char * dst_name ;
790781 int err ;
791- int flags ;
792782
793783 dst_name = extract_last_component (newname );
794784 if (!dst_name )
@@ -797,12 +787,8 @@ int ksmbd_vfs_fp_rename(struct ksmbd_work *work, struct ksmbd_file *fp,
797787 src_dent_parent = dget_parent (fp -> filp -> f_path .dentry );
798788 src_dent = fp -> filp -> f_path .dentry ;
799789
800- flags = LOOKUP_DIRECTORY ;
801- if (test_share_config_flag (work -> tcon -> share_conf ,
802- KSMBD_SHARE_FLAG_FOLLOW_SYMLINKS ))
803- flags |= LOOKUP_FOLLOW ;
804-
805- err = kern_path (newname , flags , & dst_path );
790+ err = kern_path (newname , LOOKUP_NO_SYMLINKS | LOOKUP_DIRECTORY ,
791+ & dst_path );
806792 if (err ) {
807793 ksmbd_debug (VFS , "Cannot get path for %s [%d]\n" , newname , err );
808794 goto out ;
@@ -861,7 +847,7 @@ int ksmbd_vfs_truncate(struct ksmbd_work *work, const char *name,
861847 int err = 0 ;
862848
863849 if (name ) {
864- err = kern_path (name , 0 , & path );
850+ err = kern_path (name , LOOKUP_NO_SYMLINKS , & path );
865851 if (err ) {
866852 pr_err ("cannot get linux path for %s, err %d\n" ,
867853 name , err );
0 commit comments