diff --git a/[refs] b/[refs] index 9cd5b6e81f9d..a76027260207 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: becfd1f37544798cbdfd788f32c827160fab98c1 +refs/heads/master: aae8a97d3ec30788790d1720b71d76fd8eb44b73 diff --git a/trunk/fs/namei.c b/trunk/fs/namei.c index 83e92bab79a6..33be51a2ddb7 100644 --- a/trunk/fs/namei.c +++ b/trunk/fs/namei.c @@ -2906,7 +2906,11 @@ int vfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_de return error; mutex_lock(&inode->i_mutex); - error = dir->i_op->link(old_dentry, dir, new_dentry); + /* Make sure we don't allow creating hardlink to an unlinked file */ + if (inode->i_nlink == 0) + error = -ENOENT; + else + error = dir->i_op->link(old_dentry, dir, new_dentry); mutex_unlock(&inode->i_mutex); if (!error) fsnotify_link(dir, inode, new_dentry);