[bug report] cifs: do not search for channel if server is terminating

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Shyam Prasad N,

This is a semi-automatic email about new static checker warnings.

    fs/smb/client/sess.c:88 cifs_ses_get_chan_index()
    warn: variable dereferenced before check 'server' (see line 79)

fs/smb/client/sess.c
    78		/* if the channel is waiting for termination */
    79		if (server->terminate)
                    ^^^^^^^^^^^^^^^^^
The patch adds an unchecked dereference

    80			return CIFS_INVAL_CHAN_INDEX;
    81	
    82		for (i = 0; i < ses->chan_count; i++) {
    83			if (ses->chans[i].server == server)
    84				return i;
    85		}
    86	
    87		/* If we didn't find the channel, it is likely a bug */
    88		if (server)
                    ^^^^^^
But the existing code assumed that server could be NULL

    89			cifs_dbg(VFS, "unable to get chan index for server: 0x%llx",
    90				 server->conn_id);

regards,
dan carpenter




[Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux