[bug report] [SMB3] send channel sequence number in SMB3 requests after reconnects

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

 



Hello Steve French,

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

The patch 09ee7a3bf866: "[SMB3] send channel sequence number in SMB3 
requests after reconnects" from Aug 24, 2023, leads to the following 
Smatch complaint:

    fs/smb/client/smb2pdu.c:105 smb2_hdr_assemble()
    warn: variable dereferenced before check 'server' (see line 95)

fs/smb/client/smb2pdu.c
    94		shdr->Command = smb2_cmd;
    95		if (server->dialect >= SMB30_PROT_ID) {
                    ^^^^^^^^
Unchecked dereference

    96			/* After reconnect SMB3 must set ChannelSequence on subsequent reqs */
    97			smb3_hdr = (struct smb3_hdr_req *)shdr;
    98			/* if primary channel is not set yet, use default channel for chan sequence num */
    99			if (SERVER_IS_CHAN(server))
   100				smb3_hdr->ChannelSequence =
   101					cpu_to_le16(server->primary_server->channel_sequence_num);
   102			else
   103				smb3_hdr->ChannelSequence = cpu_to_le16(server->channel_sequence_num);
   104		}
   105		if (server) {
                    ^^^^^^
The existing code assumed that server could be NULL

   106			spin_lock(&server->req_lock);
   107			/* Request up to 10 credits but don't go over the limit. */

regards,
dan carpenter



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

  Powered by Linux