* [PATCH] dmaengine: idxd: Fix potential null dereference on pointer status
@ 2021-04-15 11:06 Colin King
2021-04-15 14:09 ` Dave Jiang
2021-04-20 10:16 ` Vinod Koul
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2021-04-15 11:06 UTC (permalink / raw)
To: Dave Jiang, Vinod Koul, dmaengine; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
There are calls to idxd_cmd_exec that pass a null status pointer however
a recent commit has added an assignment to *status that can end up
with a null pointer dereference. The function expects a null status
pointer sometimes as there is a later assignment to *status where
status is first null checked. Fix the issue by null checking status
before making the assignment.
Addresses-Coverity: ("Explicit null dereferenced")
Fixes: 89e3becd8f82 ("dmaengine: idxd: check device state before issue command")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/dma/idxd/device.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
index 31c819544a22..78d2dc5e9bd8 100644
--- a/drivers/dma/idxd/device.c
+++ b/drivers/dma/idxd/device.c
@@ -451,7 +451,8 @@ static void idxd_cmd_exec(struct idxd_device *idxd, int cmd_code, u32 operand,
if (idxd_device_is_halted(idxd)) {
dev_warn(&idxd->pdev->dev, "Device is HALTED!\n");
- *status = IDXD_CMDSTS_HW_ERR;
+ if (status)
+ *status = IDXD_CMDSTS_HW_ERR;
return;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] dmaengine: idxd: Fix potential null dereference on pointer status
2021-04-15 11:06 [PATCH] dmaengine: idxd: Fix potential null dereference on pointer status Colin King
@ 2021-04-15 14:09 ` Dave Jiang
2021-04-20 10:16 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Dave Jiang @ 2021-04-15 14:09 UTC (permalink / raw)
To: Colin King, Vinod Koul, dmaengine; +Cc: kernel-janitors, linux-kernel
On 4/15/2021 4:06 AM, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> There are calls to idxd_cmd_exec that pass a null status pointer however
> a recent commit has added an assignment to *status that can end up
> with a null pointer dereference. The function expects a null status
> pointer sometimes as there is a later assignment to *status where
> status is first null checked. Fix the issue by null checking status
> before making the assignment.
>
> Addresses-Coverity: ("Explicit null dereferenced")
> Fixes: 89e3becd8f82 ("dmaengine: idxd: check device state before issue command")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Dave Jiang <dave.jiang@intel.com>
Thanks!
> ---
> drivers/dma/idxd/device.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
> index 31c819544a22..78d2dc5e9bd8 100644
> --- a/drivers/dma/idxd/device.c
> +++ b/drivers/dma/idxd/device.c
> @@ -451,7 +451,8 @@ static void idxd_cmd_exec(struct idxd_device *idxd, int cmd_code, u32 operand,
>
> if (idxd_device_is_halted(idxd)) {
> dev_warn(&idxd->pdev->dev, "Device is HALTED!\n");
> - *status = IDXD_CMDSTS_HW_ERR;
> + if (status)
> + *status = IDXD_CMDSTS_HW_ERR;
> return;
> }
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] dmaengine: idxd: Fix potential null dereference on pointer status
2021-04-15 11:06 [PATCH] dmaengine: idxd: Fix potential null dereference on pointer status Colin King
2021-04-15 14:09 ` Dave Jiang
@ 2021-04-20 10:16 ` Vinod Koul
1 sibling, 0 replies; 3+ messages in thread
From: Vinod Koul @ 2021-04-20 10:16 UTC (permalink / raw)
To: Colin King; +Cc: Dave Jiang, dmaengine, kernel-janitors, linux-kernel
On 15-04-21, 12:06, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> There are calls to idxd_cmd_exec that pass a null status pointer however
> a recent commit has added an assignment to *status that can end up
> with a null pointer dereference. The function expects a null status
> pointer sometimes as there is a later assignment to *status where
> status is first null checked. Fix the issue by null checking status
> before making the assignment.
Applied, thanks
--
~Vinod
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-04-20 10:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-15 11:06 [PATCH] dmaengine: idxd: Fix potential null dereference on pointer status Colin King
2021-04-15 14:09 ` Dave Jiang
2021-04-20 10:16 ` Vinod Koul
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).