Skip to content

Commit 4e3ba58

Browse files
Paulo Alcantarasmfrench
authored andcommitted
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: Paulo Alcantara (Red Hat) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 0826b13 commit 4e3ba58

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

fs/smb/client/connect.c

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4211,9 +4211,9 @@ tlink_rb_insert(struct rb_root *root, struct tcon_link *new_tlink)
42114211
struct tcon_link *
42124212
cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
42134213
{
4214-
int ret;
4215-
kuid_t fsuid = current_fsuid();
42164214
struct tcon_link *tlink, *newtlink;
4215+
kuid_t fsuid = current_fsuid();
4216+
int err;
42174217

42184218
if (!(cifs_sb->mnt_cifs_flags & CIFS_MOUNT_MULTIUSER))
42194219
return cifs_get_tlink(cifs_sb_master_tlink(cifs_sb));
@@ -4248,9 +4248,9 @@ cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
42484248
spin_unlock(&cifs_sb->tlink_tree_lock);
42494249
} else {
42504250
wait_for_construction:
4251-
ret = wait_on_bit(&tlink->tl_flags, TCON_LINK_PENDING,
4251+
err = wait_on_bit(&tlink->tl_flags, TCON_LINK_PENDING,
42524252
TASK_INTERRUPTIBLE);
4253-
if (ret) {
4253+
if (err) {
42544254
cifs_put_tlink(tlink);
42554255
return ERR_PTR(-ERESTARTSYS);
42564256
}
@@ -4261,8 +4261,9 @@ cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
42614261

42624262
/* return error if we tried this already recently */
42634263
if (time_before(jiffies, tlink->tl_time + TLINK_ERROR_EXPIRE)) {
4264+
err = PTR_ERR(tlink->tl_tcon);
42644265
cifs_put_tlink(tlink);
4265-
return ERR_PTR(-EACCES);
4266+
return ERR_PTR(err);
42664267
}
42674268

42684269
if (test_and_set_bit(TCON_LINK_PENDING, &tlink->tl_flags))
@@ -4274,8 +4275,11 @@ cifs_sb_tlink(struct cifs_sb_info *cifs_sb)
42744275
wake_up_bit(&tlink->tl_flags, TCON_LINK_PENDING);
42754276

42764277
if (IS_ERR(tlink->tl_tcon)) {
4278+
err = PTR_ERR(tlink->tl_tcon);
4279+
if (err == -ENOKEY)
4280+
err = -EACCES;
42774281
cifs_put_tlink(tlink);
4278-
return ERR_PTR(-EACCES);
4282+
return ERR_PTR(err);
42794283
}
42804284

42814285
return tlink;

0 commit comments

Comments
 (0)