Skip to content

Commit

Permalink
smb3: add missing null server pointer check
Browse files Browse the repository at this point in the history
commit 45be088 upstream.

Address static checker warning in cifs_ses_get_chan_index():
    warn: variable dereferenced before check 'server'
To be consistent, and reduce risk, we should add another check
for null server pointer.

Fixes: 88675b2 ("cifs: do not search for channel if server is terminating")
Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
Reviewed-by: Shyam Prasad N <sprasad@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Steve French authored and gregkh committed Mar 1, 2024
1 parent a7f34a0 commit 824c15a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/smb/client/sess.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ cifs_ses_get_chan_index(struct cifs_ses *ses,
unsigned int i;

/* if the channel is waiting for termination */
if (server->terminate)
if (server && server->terminate)
return CIFS_INVAL_CHAN_INDEX;

for (i = 0; i < ses->chan_count; i++) {
Expand Down

0 comments on commit 824c15a

Please sign in to comment.