[bug report] ksmbd: add validation in smb2 negotiate

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

 



Hello Namjae Jeon,

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

The patch 442ff9ebeb01: "ksmbd: add validation in smb2 negotiate" 
from Sep 29, 2021, leads to the following Smatch complaint:

    fs/ksmbd/smb2pdu.c:8330 smb3_preauth_hash_rsp()
    error: we previously assumed 'conn->preauth_info' could be null (see line 8310)

fs/ksmbd/smb2pdu.c
  8309		if (le16_to_cpu(req->Command) == SMB2_NEGOTIATE_HE &&
  8310		    conn->preauth_info)
                    ^^^^^^^^^^^^^^^^^^
The patch adds a new check for "conn->preauth_info"

  8311			ksmbd_gen_preauth_integrity_hash(conn, (char *)rsp,
  8312							 conn->preauth_info->Preauth_HashValue);
  8313	
  8314		if (le16_to_cpu(rsp->Command) == SMB2_SESSION_SETUP_HE && sess) {
  8315			__u8 *hash_value;
  8316	
  8317			if (conn->binding) {
  8318				struct preauth_session *preauth_sess;
  8319	
  8320				preauth_sess = ksmbd_preauth_session_lookup(conn, sess->id);
  8321				if (!preauth_sess)
  8322					return;
  8323				hash_value = preauth_sess->Preauth_HashValue;
  8324			} else {
  8325				hash_value = sess->Preauth_HashValue;
  8326				if (!hash_value)
  8327					return;
  8328			}
  8329			ksmbd_gen_preauth_integrity_hash(conn, (char *)rsp,

But it's not checked inside the ksmbd_gen_preauth_integrity_hash()
function.

  8330							 hash_value);
  8331		}
  8332	}

regards,
dan carpenter



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

  Powered by Linux