Skip to content

Commit

Permalink
smb: client: propagate error from cifs_construct_tcon()
Browse files Browse the repository at this point in the history
Propagate error from cifs_construct_tcon() in cifs_sb_tlink() instead of
always returning -EACCES.

Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
  • Loading branch information
pcacjr authored and Steve French committed Sep 19, 2024
1 parent a2aa92f commit 51aad05
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions fs/smb/client/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -4213,9 +4213,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));
Expand Down Expand Up @@ -4250,9 +4250,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);
}
Expand All @@ -4263,8 +4263,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))
Expand All @@ -4276,8 +4277,9 @@ 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);
cifs_put_tlink(tlink);
return ERR_PTR(-EACCES);
return ERR_PTR(err);
}

return tlink;
Expand Down

0 comments on commit 51aad05

Please sign in to comment.