mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Aditya Pakki <pakki001@umn.edu>
Cc: kjlu@umn.edu, linux-ide@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ata: dwc_460ex: Avoid potential NULL pointer dereference
Date: Sun, 24 Mar 2019 10:28:23 -0600	[thread overview]
Message-ID: <66403341-fa27-4b80-ab6b-2413b6b6fb98@kernel.dk> (raw)
In-Reply-To: <20190304230858.13387-1-pakki001@umn.edu>

On 3/4/19 4:08 PM, Aditya Pakki wrote:
> dma_async_tx_descriptor can contain a NULL variable and using
> it in dmaengine_submit without checking can crash the process.
> This patch avoids such a scenario.
> 
> Signed-off-by: Aditya Pakki <pakki001@umn.edu>
> ---
>  drivers/ata/sata_dwc_460ex.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/ata/sata_dwc_460ex.c b/drivers/ata/sata_dwc_460ex.c
> index 6f142aa54f5f..44a0d7a1ef54 100644
> --- a/drivers/ata/sata_dwc_460ex.c
> +++ b/drivers/ata/sata_dwc_460ex.c
> @@ -1052,8 +1052,10 @@ static void sata_dwc_bmdma_start_by_tag(struct ata_queued_cmd *qc, u8 tag)
>  					SATA_DWC_DMACR_RXCHEN);
>  
>  		/* Enable AHB DMA transfer on the specified channel */
> -		dmaengine_submit(desc);
> -		dma_async_issue_pending(hsdevp->chan);
> +		if (desc) {
> +			dmaengine_submit(desc);
> +			dma_async_issue_pending(hsdevp->chan);
> +		}
>  	}
>  }

Hmm, if desc == NULL, is that an error condition?

-- 
Jens Axboe


  reply	other threads:[~2019-03-24 16:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-04 23:08 Aditya Pakki
2019-03-24 16:28 ` Jens Axboe [this message]
2019-03-24 16:47   ` Aditya Pakki
2019-03-24 17:10     ` Jens Axboe

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=66403341-fa27-4b80-ab6b-2413b6b6fb98@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=kjlu@umn.edu \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pakki001@umn.edu \
    /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

all inboxes | Powered by JetHome®