All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: "Gustavo A. R. Silva" <gustavo@embeddedor.com>
Cc: John Garry <john.garry@huawei.com>,
	"James E.J. Bottomley" <jejb@linux.vnet.ibm.com>,
	"Martin K. Petersen" <martin.petersen@oracle.com>,
	Xiang Chen <chenxiang66@hisilicon.com>,
	linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] scsi: hisi_sas: Fix NULL pointer dereference
Date: Fri, 19 Oct 2018 18:28:38 -0400	[thread overview]
Message-ID: <yq1efclinah.fsf@oracle.com> (raw)
In-Reply-To: <20181018165939.GA26491@embeddedor.com> (Gustavo A. R. Silva's message of "Thu, 18 Oct 2018 18:59:39 +0200")


Gustavo,

> There is a NULL pointer dereference in case *slot* happens to
> be NULL at lines 1053 and 1878:
>
> struct hisi_sas_cq *cq =
> 	&hisi_hba->cq[slot->dlvry_queue];
>
> Notice that *slot* is being NULL checked at lines 1057 and 1881:
> if (slot), which implies it may be NULL.
>
> Fix this by placing the declaration and definition of variable cq,
> which contains the pointer dereference slot->dlvry_queue, after
> slot has been properly NULL checked.

Applied to 4.20/scsi-queue, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

  parent reply	other threads:[~2018-10-19 22:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18 16:59 [PATCH v2] scsi: hisi_sas: Fix NULL pointer dereference Gustavo A. R. Silva
2018-10-19  0:54 ` chenxiang (M)
2018-10-19  0:54   ` chenxiang (M)
2018-10-19 22:28 ` Martin K. Petersen [this message]
2018-10-20  6:34   ` Gustavo A. R. Silva

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=yq1efclinah.fsf@oracle.com \
    --to=martin.petersen@oracle.com \
    --cc=chenxiang66@hisilicon.com \
    --cc=gustavo@embeddedor.com \
    --cc=jejb@linux.vnet.ibm.com \
    --cc=john.garry@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.