linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kangjie Lu <kjlu@umn.edu>
To: kjlu@umn.edu
Cc: pakki001@umn.edu, Steve Wise <swise@chelsio.com>,
	Doug Ledford <dledford@redhat.com>,
	Jason Gunthorpe <jgg@ziepe.ca>,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference
Date: Fri, 22 Mar 2019 21:37:46 -0500	[thread overview]
Message-ID: <CC1E06D8-7817-4314-AAD4-434FEB8C4157@umn.edu> (raw)
In-Reply-To: <20190309051921.15212-1-kjlu@umn.edu>



> On Mar 8, 2019, at 11:19 PM, Kangjie Lu <kjlu@umn.edu> wrote:
> 
> get_skb may fail and return NULL. The fix returns "ENOMEM"
> when it fails to avoid NULL dereference.
> 
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
> drivers/infiniband/hw/cxgb4/cm.c | 3 +++
> 1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
> index 8221813219e5..502a54d57e2c 100644
> --- a/drivers/infiniband/hw/cxgb4/cm.c
> +++ b/drivers/infiniband/hw/cxgb4/cm.c
> @@ -1919,6 +1919,9 @@ static int send_fw_act_open_req(struct c4iw_ep *ep, unsigned int atid)
> 	int win;
> 
> 	skb = get_skb(NULL, sizeof(*req), GFP_KERNEL);
> +	if (!skb)
> +		return -ENOMEM;
> +

Can someone review this patch? Thanks.

> 	req = __skb_put_zero(skb, sizeof(*req));
> 	req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR));
> 	req->len16_pkd = htonl(FW_WR_LEN16_V(DIV_ROUND_UP(sizeof(*req), 16)));
> -- 
> 2.17.1
> 


  reply	other threads:[~2019-03-23  2:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-09  5:19 [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference Kangjie Lu
2019-03-23  2:37 ` Kangjie Lu [this message]
2019-03-23 23:25   ` Bart Van Assche
2019-03-27 13:38   ` Potnuri Bharat Teja
2019-03-28 12:40     ` Jason Gunthorpe
2019-03-28 14:20       ` Potnuri Bharat Teja
2019-03-28 14:26         ` Jason Gunthorpe
2019-03-27 12:13 ` Mukesh Ojha
2019-03-27 12:15 ` Mukesh Ojha

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=CC1E06D8-7817-4314-AAD4-434FEB8C4157@umn.edu \
    --to=kjlu@umn.edu \
    --cc=dledford@redhat.com \
    --cc=jgg@ziepe.ca \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.org \
    --cc=pakki001@umn.edu \
    --cc=swise@chelsio.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;
as well as URLs for NNTP newsgroup(s).