Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

powerpc/pseries: Avoid using the size greater than RTAS_ERROR_LOG_MAX.

The global mce data buffer that used to copy rtas error log is of 2048
(RTAS_ERROR_LOG_MAX) bytes in size. Before the copy we read
extended_log_length from rtas error log header, then use max of
extended_log_length and RTAS_ERROR_LOG_MAX as a size of data to be copied.
Ideally the platform (phyp) will never send extended error log with
size > 2048. But if that happens, then we have a risk of buffer overrun
and corruption. Fix this by using min_t instead.

Fixes: d368514c3097 ("powerpc: Fix corruption when grabbing FWNMI data")
Reported-by: Michal Suchanek <msuchanek@suse.com>
Signed-off-by: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Mahesh Salgaonkar and committed by
Michael Ellerman
74e96bf4 e27e0a94

+1 -1
+1 -1
arch/powerpc/platforms/pseries/ras.c
··· 371 371 int len, error_log_length; 372 372 373 373 error_log_length = 8 + rtas_error_extended_log_length(h); 374 - len = max_t(int, error_log_length, RTAS_ERROR_LOG_MAX); 374 + len = min_t(int, error_log_length, RTAS_ERROR_LOG_MAX); 375 375 memset(global_mce_data_buf, 0, RTAS_ERROR_LOG_MAX); 376 376 memcpy(global_mce_data_buf, h, len); 377 377 errhdr = (struct rtas_error_log *)global_mce_data_buf;