From: Cezary Rojewski Date: Thu, 13 Jun 2019 19:04:34 +0000 (+0200) Subject: ASoC: Intel: Common: Fix NULL dereference in tx_wait_done X-Git-Tag: v5.4-rc1~52^2~39^2~112 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9f4f42d710d417745cff05845f93370126f77ff7;p=platform%2Fkernel%2Flinux-rpi.git ASoC: Intel: Common: Fix NULL dereference in tx_wait_done rx_data and rx_bytes present for tx_wait_done are optional parameters. If not provided, function should not attempt to copy received data. This change fixes memcpy NULL pointer dereference issue occurring when optional rx_data is NULL while received message size is non-zero. Signed-off-by: Cezary Rojewski Reviewed-by: Pierre-Louis Bossart Signed-off-by: Mark Brown --- diff --git a/sound/soc/intel/common/sst-ipc.c b/sound/soc/intel/common/sst-ipc.c index dcff138..fc3340f 100644 --- a/sound/soc/intel/common/sst-ipc.c +++ b/sound/soc/intel/common/sst-ipc.c @@ -71,7 +71,7 @@ static int tx_wait_done(struct sst_generic_ipc *ipc, } else { /* copy the data returned from DSP */ - if (msg->rx_size) + if (rx_data) memcpy(rx_data, msg->rx_data, msg->rx_size); ret = msg->errno; }