Function report

Linux Kernel

v5.5.9

Brick Technologies Co., Ltd

Source Code:fs\namei.c Create Date:2022-07-28 20:05:18
Last Modify:2020-03-12 14:18:49 Copyright©Brick
home page Tree
Annotation kernel can get tool activityDownload SCCTChinese

Name:Hardlinks are often used in delicate situations. We avoid* security-related surprises by not following symlinks on the* newname. --KAB* We don't follow them on the oldname either to be compatible* with linux 2.0, and to avoid hard-linking to directories

Proto:int do_linkat(int olddfd, const char __user *oldname, int newdfd, const char __user *newname, int flags)

Type:int

Parameter:

TypeParameterName
intolddfd
const char __user *oldname
intnewdfd
const char __user *newname
intflags
4213  struct inode * delegated_inode = NULL
4214  how = 0
4217  If (flags & ~(Follow symbolic links. | Allow empty relative pathname )) != 0 Then Return -EINVAL
4224  If flags & Allow empty relative pathname Then
4225  If Not Check operation authority Then Return -ENOENT
4227  how = accept empty path [user_... only]
4230  If flags & Follow symbolic links. Then how |= llow links at the end
4232  retry :
4233  error = user_path_at(olddfd, oldname, how, & old_path)
4234  If error Then Return error
4237  new_dentry = user_path_create(newdfd, newname, & new_path, (how & ll ->d_revalidate() to trust no cache ))
4239  error = PTR_ERR(new_dentry)
4240  If IS_ERR(new_dentry) Then Go to out
4243  error = -EXDEV
4244  If mnt != mnt Then Go to out_dput
4246  error = may_linkat - Check permissions for creating a hardlink*@link: the source to hardlink from* Block hardlink when all of:* - sysctl_protected_hardlinks enabled* - fsuid does not match inode* - hardlink source is unsafe (see safe_hardlink_source() above)* -
4247  If Value for the false possibility is greater at compile time(error) Then Go to out_dput
4249  error = security_path_link(dentry, & new_path, new_dentry)
4250  If error Then Go to out_dput
4252  error = vfs_link - create a new link*@old_dentry: object to be linked*@dir: new parent*@new_dentry: where to create the new link*@delegated_inode: returns inode needing a delegation break* The caller must hold dir->i_mutex* If vfs_link discovers a delegation on
4253  out_dput :
4254  done_path_create( & new_path, new_dentry)
4255  If delegated_inode Then
4256  error = break_deleg_wait( & delegated_inode)
4257  If Not error Then
4259  Go to retry
4262  If ry_estale - determine whether the caller should retry an operation*@error: the error that would currently be returned*@flags: flags being used for next lookup attempt* Check to see if the error code was -ESTALE, and then determine whether Then
4263  path_put - put a reference to a path*@path: path to put the reference to* Given a path decrement the reference count to the dentry and the vfsmount.
4264  how |= ll ->d_revalidate() to trust no cache
4265  Go to retry
4267  out :
4268  path_put - put a reference to a path*@path: path to put the reference to* Given a path decrement the reference count to the dentry and the vfsmount.
4270  Return error
Caller
NameDescribe
SYSCALL_DEFINE5
SYSCALL_DEFINE2
ksys_link