Commit 4e3ba580 authored by Paulo Alcantara's avatar Paulo Alcantara Committed by Steve French

smb: client: propagate error from cifs_construct_tcon()

Propagate error from cifs_construct_tcon() in cifs_sb_tlink() instead of
always returning -EACCES.
Signed-off-by: default avatarPaulo Alcantara (Red Hat) <pc@manguebit.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 0826b134
......@@ -4211,9 +4211,9 @@ tlink_rb_insert(struct rb_root *root, struct tcon_link *new_tlink)
struct tcon_link *
cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
{
int ret;
kuid_t fsuid = current_fsuid();
struct tcon_link *tlink, *newtlink;
kuid_t fsuid = current_fsuid();
int err;
if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER))
return cifs_get_tlink(cifs_sb_master_tlink(cifs_sb));
......@@ -4248,9 +4248,9 @@ cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
spin_unlock(&cifs_sb->tlink_tree_lock);
} else {
wait_for_construction:
ret = wait_on_bit(&tlink->tl_flags, TCON_LINK_PENDING,
err = wait_on_bit(&tlink->tl_flags, TCON_LINK_PENDING,
TASK_INTERRUPTIBLE);
if (ret) {
if (err) {
cifs_put_tlink(tlink);
return ERR_PTR(-ERESTARTSYS);
}
......@@ -4261,8 +4261,9 @@ cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
/* return error if we tried this already recently */
if (time_before(jiffies, tlink->tl_time + TLINK_ERROR_EXPIRE)) {
err = PTR_ERR(tlink->tl_tcon);
cifs_put_tlink(tlink);
return ERR_PTR(-EACCES);
return ERR_PTR(err);
}
if (test_and_set_bit(TCON_LINK_PENDING, &tlink->tl_flags))
......@@ -4274,8 +4275,11 @@ cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
wake_up_bit(&tlink->tl_flags, TCON_LINK_PENDING);
if (IS_ERR(tlink->tl_tcon)) {
err = PTR_ERR(tlink->tl_tcon);
if (err == -ENOKEY)
err = -EACCES;
cifs_put_tlink(tlink);
return ERR_PTR(-EACCES);
return ERR_PTR(err);
}
return tlink;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment