mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Colin King <colin.king@canonical.com>,
	Vinod Koul <vkoul@kernel.org>,
	dmaengine@vger.kernel.org
Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] dmaengine: idxd: Fix potential null dereference on pointer status
Date: Thu, 15 Apr 2021 07:09:40 -0700	[thread overview]
Message-ID: <4e545597-8fe5-411d-6bb7-0c5e8eea5b23@intel.com> (raw)
In-Reply-To: <20210415110654.1941580-1-colin.king@canonical.com>


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;
>   	}
>   

  reply	other threads:[~2021-04-15 14:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-15 11:06 Colin King
2021-04-15 14:09 ` Dave Jiang [this message]
2021-04-20 10:16 ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4e545597-8fe5-411d-6bb7-0c5e8eea5b23@intel.com \
    --to=dave.jiang@intel.com \
    --cc=colin.king@canonical.com \
    --cc=dmaengine@vger.kernel.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vkoul@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome