diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c index 10ff13f69ad9..38b21e407562 100644 --- a/sys/kern/vfs_extattr.c +++ b/sys/kern/vfs_extattr.c @@ -1338,8 +1338,12 @@ link(td, uap) char *link; } */ *uap; { + int error; - return (kern_link(td, uap->path, uap->link, UIO_USERSPACE)); + mtx_lock(&Giant); + error = kern_link(td, uap->path, uap->link, UIO_USERSPACE); + mtx_unlock(&Giant); + return (error); } SYSCTL_DECL(_security_bsd); diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 10ff13f69ad9..38b21e407562 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1338,8 +1338,12 @@ link(td, uap) char *link; } */ *uap; { + int error; - return (kern_link(td, uap->path, uap->link, UIO_USERSPACE)); + mtx_lock(&Giant); + error = kern_link(td, uap->path, uap->link, UIO_USERSPACE); + mtx_unlock(&Giant); + return (error); } SYSCTL_DECL(_security_bsd);