diff mbox series

[next] ath10k: fix null dereference on pointer crash_data

Message ID 20191004160227.31577-1-colin.king@canonical.com (mailing list archive)
State Accepted
Commit a69d3bdd4d40c8f780c94b5e1983adb1cd389b59
Delegated to: Kalle Valo
Headers show
Series [next] ath10k: fix null dereference on pointer crash_data | expand

Commit Message

Colin King Oct. 4, 2019, 4:02 p.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Currently when pointer crash_data is null the present null check
will also check that crash_data->ramdump_buf is null and will cause
a null pointer dereference on crash_data. Fix this by using the ||
operator instead of &&.

Fixes: 3f14b73c3843 ("ath10k: Enable MSA region dump support for WCN3990")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 drivers/net/wireless/ath/ath10k/snoc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kalle Valo Oct. 11, 2019, 8:46 a.m. UTC | #1
Colin King <colin.king@canonical.com> wrote:

> Currently when pointer crash_data is null the present null check
> will also check that crash_data->ramdump_buf is null and will cause
> a null pointer dereference on crash_data. Fix this by using the ||
> operator instead of &&.
> 
> Fixes: 3f14b73c3843 ("ath10k: Enable MSA region dump support for WCN3990")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

Patch applied to ath-next branch of ath.git, thanks.

a69d3bdd4d40 ath10k: fix null dereference on pointer crash_data
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath10k/snoc.c b/drivers/net/wireless/ath/ath10k/snoc.c
index cd22c8654aa9..16177497bba7 100644
--- a/drivers/net/wireless/ath/ath10k/snoc.c
+++ b/drivers/net/wireless/ath/ath10k/snoc.c
@@ -1400,7 +1400,7 @@  static void ath10k_msa_dump_memory(struct ath10k *ar,
 	size_t buf_len;
 	u8 *buf;
 
-	if (!crash_data && !crash_data->ramdump_buf)
+	if (!crash_data || !crash_data->ramdump_buf)
 		return;
 
 	mem_layout = ath10k_coredump_get_mem_layout(ar);