mirror of
https://github.com/qosmio/nss-packages.git
synced 2025-12-17 00:33:40 +00:00
nss-drv: fix NSS FW coredump
DMA functions used for NSS FW coredump are called with NULL being passed instead of device pointer. This will obviously cause a NULL pointer exception and crash the kernel. So, fix it by passing proper device structure pointer. Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
73460a73af
commit
4667f4acb4
@ -0,0 +1,49 @@
|
|||||||
|
From 62e457f262aaa0db7113ad3ccbcb7ae49d4d7ea8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Robert Marko <robimarko@gmail.com>
|
||||||
|
Date: Tue, 8 Jun 2021 23:24:43 +0200
|
||||||
|
Subject: [PATCH] DMA: Fix NULL pointer exceptions
|
||||||
|
|
||||||
|
There are multiple instances that pass NULL instead
|
||||||
|
of device to DMA functions.
|
||||||
|
That is incorrect and will cause kernel NULL pointer
|
||||||
|
exceptions.
|
||||||
|
|
||||||
|
So, simply pass the device structure pointers.
|
||||||
|
|
||||||
|
Signed-off-by: Robert Marko <robimarko@gmail.com>
|
||||||
|
---
|
||||||
|
nss_core.c | 2 +-
|
||||||
|
nss_coredump.c | 4 ++--
|
||||||
|
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
--- a/nss_core.c
|
||||||
|
+++ b/nss_core.c
|
||||||
|
@@ -1617,7 +1617,7 @@ static int32_t nss_core_handle_cause_que
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
if (unlikely((buffer_type == N2H_BUFFER_CRYPTO_RESP))) {
|
||||||
|
- dma_unmap_single(NULL, (desc->buffer + desc->payload_offs), desc->payload_len, DMA_FROM_DEVICE);
|
||||||
|
+ dma_unmap_single(nss_ctx->dev, (desc->buffer + desc->payload_offs), desc->payload_len, DMA_FROM_DEVICE);
|
||||||
|
goto consume;
|
||||||
|
}
|
||||||
|
|
||||||
|
--- a/nss_coredump.c
|
||||||
|
+++ b/nss_coredump.c
|
||||||
|
@@ -154,7 +154,7 @@ void nss_fw_coredump_notify(struct nss_c
|
||||||
|
dma_addr = nss_own->meminfo_ctx.logbuffer_dma;
|
||||||
|
}
|
||||||
|
|
||||||
|
- dma_sync_single_for_cpu(NULL, dma_addr, sizeof(struct nss_log_descriptor), DMA_FROM_DEVICE);
|
||||||
|
+ dma_sync_single_for_cpu(nss_own->dev, dma_addr, sizeof(struct nss_log_descriptor), DMA_FROM_DEVICE);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If the current entry is smaller than or equal to the number of NSS_LOG_COREDUMP_LINE_NUM,
|
||||||
|
@@ -181,7 +181,7 @@ void nss_fw_coredump_notify(struct nss_c
|
||||||
|
|
||||||
|
offset = (index * sizeof(struct nss_log_entry))
|
||||||
|
+ offsetof(struct nss_log_descriptor, log_ring_buffer);
|
||||||
|
- dma_sync_single_for_cpu(NULL, dma_addr + offset,
|
||||||
|
+ dma_sync_single_for_cpu(nss_own->dev, dma_addr + offset,
|
||||||
|
sizeof(struct nss_log_entry), DMA_FROM_DEVICE);
|
||||||
|
nss_info_always("%px: %s\n", nss_own, nle_print->message);
|
||||||
|
nle_print++;
|
||||||
Loading…
Reference in New Issue
Block a user