Stefano Brivio 0f3086868e cxgb4: Fix stack out-of-bounds read due to wrong size to t4_record_mbox()
Passing commands for logging to t4_record_mbox() with size
MBOX_LEN, when the actual command size is actually smaller,
causes out-of-bounds stack accesses in t4_record_mbox() while
copying command words here:

	for (i = 0; i < size / 8; i++)
		entry->cmd[i] = be64_to_cpu(cmd[i]);

Up to 48 bytes from the stack are then leaked to debugfs.

This happens whenever we send (and log) commands described by
structs fw_sched_cmd (32 bytes leaked), fw_vi_rxmode_cmd (48),
fw_hello_cmd (48), fw_bye_cmd (48), fw_initialize_cmd (48),
fw_reset_cmd (48), fw_pfvf_cmd (32), fw_eq_eth_cmd (16),
fw_eq_ctrl_cmd (32), fw_eq_ofld_cmd (32), fw_acl_mac_cmd(16),
fw_rss_glb_config_cmd(32), fw_rss_vi_config_cmd(32),
fw_devlog_cmd(32), fw_vi_enable_cmd(48), fw_port_cmd(32),
fw_sched_cmd(32), fw_devlog_cmd(32).

The cxgb4vf driver got this right instead.

When we call t4_record_mbox() to log a command reply, a MBOX_LEN
size can be used though, as get_mbox_rpl() will fill cmd_rpl up
completely.

Fixes: 7f080c3f2ff0 ("cxgb4: Add support to enable logging of firmware mailbox commands")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2017-08-28 15:24:23 -07:00
..
2017-08-13 12:33:35 -07:00
2017-08-13 12:44:18 -07:00
2017-07-08 12:36:50 -07:00
2017-07-24 17:38:21 +02:00
2017-07-04 14:28:22 -07:00
2017-07-17 15:00:47 +02:00
2017-07-03 20:55:59 -07:00
2017-08-14 09:34:10 +02:00
2017-07-06 11:32:40 -07:00
2017-07-04 14:47:47 -07:00
2017-07-11 09:55:47 -07:00
2017-07-01 14:30:39 -07:00
2017-08-17 10:23:45 +02:00
2017-08-01 15:22:55 -07:00
2017-07-13 11:49:52 -07:00
2017-07-05 17:09:27 -07:00
2017-07-04 14:47:47 -07:00
2017-07-06 15:38:31 -07:00
2017-08-21 11:08:03 +02:00
2017-08-16 17:21:20 -07:00
2017-08-13 12:30:17 -07:00
2017-08-13 12:41:58 -07:00
2017-08-13 12:27:42 -07:00
2017-07-03 20:27:48 -07:00