In the Linux kernel, the following vulnerability has been resolved: smb/server: avoid deadlock when linking with ReplaceIfExists If smb2createlink() is called with ReplaceIfExists set and the name does exist then a deadlock will happen. ksmbdvfskernpathlocked() will return with success and the parent directory will be locked. ksmbdvfsremovefile() will then remove the file. ksmbdvfslink() will then be called while the parent is still locked. It will try to lock the same parent and will deadlock. This patch moves the ksmbdvfskernpathunlock() call to *before* ksmbdvfslink() and then simplifies the code, removing the filepresent flag variable.