scsi: mpt3sas: Validate data_out size before SMP link-reset check
_ctl_do_mpt_command() handles MPI2_FUNCTION_SMP_PASSTHROUGH by reading
data[1] and data[10] of the data_out buffer to detect SMP link-reset
requests. The non-IMMEDIATE path sets data = data_out after checking only
for a NULL pointer, so a payload shorter than 11 bytes can read past the
end of the buffer, and out-of-bounds bytes can unexpectedly set
ioc_link_reset_in_progress and ignore_loginfos.
However, a short SMP request is not invalid: SMP_REPORT_GENERAL, for
example, can use an 8-byte payload. Rejecting every data_out smaller than
11 bytes would break valid requests.
Instead, require enough data only when checking for a link reset, and keep
sending the request normally otherwise. The IMMEDIATE path reads from the
request frame rather than data_out, so data_out_sz does not apply to it.
Fixes: f92363d12359 ("[SCSI] mpt3sas: add new driver supporting 12GB SAS")
Cc: stable@vger.kernel.org # 3.8+
Reviewed-by: Guanglei Zhu <zhugl3@xiaopeng.com>
Signed-off-by: Weibin Liu <liuwb@xiaopeng.com>
Link: https://patch.msgid.link/20261029073316.4188569-1-liuwb@xiaopeng.com
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
1 file changed