Skip to content

Commit 45be088

Browse files
author
Steve French
committed
smb3: add missing null server pointer check
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>
1 parent 54be6c6 commit 45be088

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/smb/client/sess.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ cifs_ses_get_chan_index(struct cifs_ses *ses,
7676
unsigned int i;
7777

7878
/* if the channel is waiting for termination */
79-
if (server->terminate)
79+
if (server && server->terminate)
8080
return CIFS_INVAL_CHAN_INDEX;
8181

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

0 commit comments

Comments
 (0)