From: Leon Romanovsky <leon@kernel.org>
To: "Gustavo A. R. Silva" <garsilva@embeddedor.com>,
Ram Amrani <ram.amrani@cavium.com>
Cc: Doug Ledford <dledford@redhat.com>,
Sean Hefty <sean.hefty@intel.com>,
Hal Rosenstock <hal.rosenstock@gmail.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] infiniband: hw: qedr: add null check before pointer dereference
Date: Tue, 23 May 2017 10:13:49 +0300 [thread overview]
Message-ID: <20170523071349.GF17751@mtr-leonro.local> (raw)
In-Reply-To: <20170522183015.GA22310@embeddedgus>
[-- Attachment #1: Type: text/plain, Size: 1377 bytes --]
On Mon, May 22, 2017 at 01:30:15PM -0500, Gustavo A. R. Silva wrote:
> Add null check before dereferencing pointer sgid_attr.ndev
> inside function rdma_vlan_dev_vlan_id().
>
> Addresses-Coverity-ID: 1373979
> Signed-off-by: Gustavo A. R. Silva <garsilva@embeddedor.com>
> ---
> drivers/infiniband/hw/qedr/qedr_cm.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
+ Ram,
Ram, IB part of qedr driver doesn't exist in MAINTAINERS file.
>
> diff --git a/drivers/infiniband/hw/qedr/qedr_cm.c b/drivers/infiniband/hw/qedr/qedr_cm.c
> index 3d7705c..d86dbe8 100644
> --- a/drivers/infiniband/hw/qedr/qedr_cm.c
> +++ b/drivers/infiniband/hw/qedr/qedr_cm.c
> @@ -270,11 +270,13 @@ static inline int qedr_gsi_build_header(struct qedr_dev *dev,
> return rc;
> }
>
> - vlan_id = rdma_vlan_dev_vlan_id(sgid_attr.ndev);
> - if (vlan_id < VLAN_CFI_MASK)
> - has_vlan = true;
> - if (sgid_attr.ndev)
> + if (sgid_attr.ndev) {
> + vlan_id = rdma_vlan_dev_vlan_id(sgid_attr.ndev);
> + if (vlan_id < VLAN_CFI_MASK)
> + has_vlan = true;
> +
> dev_put(sgid_attr.ndev);
> + }
I do agree that it is better than kernel panic trying to access NULL
pointer, but I'm not sure that retaining default vlan_id = 0 is correct
solution here.
>
> if (!memcmp(&sgid, &zgid, sizeof(sgid))) {
> DP_ERR(dev, "gsi post send: GID not found GID index %d\n",
> --
> 2.5.0
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2017-05-23 7:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-22 18:30 [PATCH] infiniband: hw: qedr: add null check before pointer dereference Gustavo A. R. Silva
2017-05-23 7:13 ` Leon Romanovsky [this message]
2017-05-23 15:03 ` Amrani, Ram
2017-05-23 15:09 ` Amrani, Ram
2017-06-01 22:32 ` Doug Ledford
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=20170523071349.GF17751@mtr-leonro.local \
--to=leon@kernel.org \
--cc=dledford@redhat.com \
--cc=garsilva@embeddedor.com \
--cc=hal.rosenstock@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=ram.amrani@cavium.com \
--cc=sean.hefty@intel.com \
/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