Skip to content

Commit

Permalink
cifs: fix missing unload_nls() in smb2_reconnect()
Browse files Browse the repository at this point in the history
Make sure to unload_nls() @nls_codepage if we no longer need it.

Fixes: bc96215 ("cifs: avoid race conditions with parallel reconnects")
Signed-off-by: Paulo Alcantara (SUSE) <pc@manguebit.com>
Cc: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
  • Loading branch information
Paulo Alcantara authored and Steve French committed Mar 24, 2023
1 parent bc96215 commit c24bb1a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/cifs/smb2pdu.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
struct TCP_Server_Info *server)
{
int rc = 0;
struct nls_table *nls_codepage;
struct nls_table *nls_codepage = NULL;
struct cifs_ses *ses;

/*
Expand Down Expand Up @@ -220,8 +220,6 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
tcon->ses->chans_need_reconnect,
tcon->need_reconnect);

nls_codepage = load_nls_default();

mutex_lock(&ses->session_mutex);
/*
* Recheck after acquire mutex. If another thread is negotiating
Expand All @@ -241,6 +239,8 @@ smb2_reconnect(__le16 smb2_command, struct cifs_tcon *tcon,
}
spin_unlock(&server->srv_lock);

nls_codepage = load_nls_default();

/*
* need to prevent multiple threads trying to simultaneously
* reconnect the same SMB session
Expand Down

0 comments on commit c24bb1a

Please sign in to comment.