[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7e949cd4-8ef7-a29b-83a0-9c15b68499e5@codeaurora.org>
Date: Wed, 27 Mar 2019 17:43:29 +0530
From: Mukesh Ojha <mojha@...eaurora.org>
To: Kangjie Lu <kjlu@....edu>
Cc: pakki001@....edu, Steve Wise <swise@...lsio.com>,
Doug Ledford <dledford@...hat.com>,
Jason Gunthorpe <jgg@...pe.ca>, linux-rdma@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] infiniband: cxgb4: fix a potential NULL pointer
dereference
On 3/9/2019 10:49 AM, Kangjie Lu 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@....edu>
Reviewed-by: Mukesh Ojha <mojha@...eaurora.org>
> ---
> 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;
> +
> 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)));
Powered by blists - more mailing lists