* [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference
@ 2019-03-09 5:19 Kangjie Lu
2019-03-23 2:37 ` Kangjie Lu
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Kangjie Lu @ 2019-03-09 5:19 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Steve Wise, Doug Ledford, Jason Gunthorpe, linux-rdma,
linux-kernel
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;
+
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
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference
2019-03-09 5:19 [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference Kangjie Lu
@ 2019-03-23 2:37 ` Kangjie Lu
2019-03-23 23:25 ` Bart Van Assche
2019-03-27 13:38 ` Potnuri Bharat Teja
2019-03-27 12:13 ` Mukesh Ojha
2019-03-27 12:15 ` Mukesh Ojha
2 siblings, 2 replies; 9+ messages in thread
From: Kangjie Lu @ 2019-03-23 2:37 UTC (permalink / raw)
To: kjlu
Cc: pakki001, Steve Wise, Doug Ledford, Jason Gunthorpe, linux-rdma,
linux-kernel
> 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
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference
2019-03-23 2:37 ` Kangjie Lu
@ 2019-03-23 23:25 ` Bart Van Assche
2019-03-27 13:38 ` Potnuri Bharat Teja
1 sibling, 0 replies; 9+ messages in thread
From: Bart Van Assche @ 2019-03-23 23:25 UTC (permalink / raw)
To: Kangjie Lu
Cc: pakki001, Steve Wise, Doug Ledford, Jason Gunthorpe, linux-rdma,
linux-kernel
On 3/22/19 7:37 PM, Kangjie Lu wrote:
>> 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.
Hi Kangjie,
Please change the patch description to the imperative mood (see also
https://git.kernel.org/pub/scm/git/git.git/tree/Documentation/SubmittingPatches).
A good way to invite feedback is to add a relevant Cc-list to a patch.
The output of scripts/get_maintainer.pl can be a good start.
Bart.
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference
2019-03-09 5:19 [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference Kangjie Lu
2019-03-23 2:37 ` Kangjie Lu
@ 2019-03-27 12:13 ` Mukesh Ojha
2019-03-27 12:15 ` Mukesh Ojha
2 siblings, 0 replies; 9+ messages in thread
From: Mukesh Ojha @ 2019-03-27 12:13 UTC (permalink / raw)
To: Kangjie Lu
Cc: pakki001, Steve Wise, Doug Ledford, Jason Gunthorpe, linux-rdma,
linux-kernel
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@umn.edu>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.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)));
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference
2019-03-09 5:19 [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference Kangjie Lu
2019-03-23 2:37 ` Kangjie Lu
2019-03-27 12:13 ` Mukesh Ojha
@ 2019-03-27 12:15 ` Mukesh Ojha
2 siblings, 0 replies; 9+ messages in thread
From: Mukesh Ojha @ 2019-03-27 12:15 UTC (permalink / raw)
To: Kangjie Lu
Cc: pakki001, Steve Wise, Doug Ledford, Jason Gunthorpe, linux-rdma,
linux-kernel
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@umn.edu>
Reviewed-by: Mukesh OJha <mojha@codeaurora.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)));
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference
2019-03-23 2:37 ` Kangjie Lu
2019-03-23 23:25 ` Bart Van Assche
@ 2019-03-27 13:38 ` Potnuri Bharat Teja
2019-03-28 12:40 ` Jason Gunthorpe
1 sibling, 1 reply; 9+ messages in thread
From: Potnuri Bharat Teja @ 2019-03-27 13:38 UTC (permalink / raw)
To: Kangjie Lu
Cc: pakki001, Doug Ledford, Jason Gunthorpe, linux-rdma, linux-kernel
On Saturday, March 03/23/19, 2019 at 08:07:46 +0530, Kangjie Lu wrote:
>
>
> > 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.
Sorry for the late response.
I recommend an error print before the return.
---
if (!skb) {
pr_err("%s - failed to alloc skb\n", __func__);
return -ENOMEM;
}
---
Thanks for the patch!
- Bharat.
>
> > 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
> >
>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference
2019-03-27 13:38 ` Potnuri Bharat Teja
@ 2019-03-28 12:40 ` Jason Gunthorpe
2019-03-28 14:20 ` Potnuri Bharat Teja
0 siblings, 1 reply; 9+ messages in thread
From: Jason Gunthorpe @ 2019-03-28 12:40 UTC (permalink / raw)
To: Potnuri Bharat Teja
Cc: Kangjie Lu, pakki001, Doug Ledford, linux-rdma, linux-kernel
On Wed, Mar 27, 2019 at 07:08:54PM +0530, Potnuri Bharat Teja wrote:
> On Saturday, March 03/23/19, 2019 at 08:07:46 +0530, Kangjie Lu wrote:
> >
> >
> > > 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
> > > +++ 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.
>
> Sorry for the late response.
> I recommend an error print before the return.
> if (!skb) {
> pr_err("%s - failed to alloc skb\n", __func__);
> return -ENOMEM;
> }
no error prints on memory allocation failure, the kernel already
prints enough on this
Jason
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference
2019-03-28 12:40 ` Jason Gunthorpe
@ 2019-03-28 14:20 ` Potnuri Bharat Teja
2019-03-28 14:26 ` Jason Gunthorpe
0 siblings, 1 reply; 9+ messages in thread
From: Potnuri Bharat Teja @ 2019-03-28 14:20 UTC (permalink / raw)
To: Jason Gunthorpe
Cc: Kangjie Lu, pakki001, Doug Ledford, linux-rdma, linux-kernel
On Thursday, March 03/28/19, 2019 at 18:10:37 +0530, Jason Gunthorpe wrote:
> On Wed, Mar 27, 2019 at 07:08:54PM +0530, Potnuri Bharat Teja wrote:
> > On Saturday, March 03/23/19, 2019 at 08:07:46 +0530, Kangjie Lu wrote:
> > >
> > >
> > > > 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
> > > > +++ 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.
> >
> > Sorry for the late response.
> > I recommend an error print before the return.
> > if (!skb) {
> > pr_err("%s - failed to alloc skb\n", __func__);
> > return -ENOMEM;
> > }
>
> no error prints on memory allocation failure, the kernel already
> prints enough on this
Ok.
Acked-by: Potnuri Bharat Teja <bharat@chelsio.com>
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference
2019-03-28 14:20 ` Potnuri Bharat Teja
@ 2019-03-28 14:26 ` Jason Gunthorpe
0 siblings, 0 replies; 9+ messages in thread
From: Jason Gunthorpe @ 2019-03-28 14:26 UTC (permalink / raw)
To: Potnuri Bharat Teja
Cc: Kangjie Lu, pakki001, Doug Ledford, linux-rdma, linux-kernel
On Thu, Mar 28, 2019 at 07:50:23PM +0530, Potnuri Bharat Teja wrote:
> On Thursday, March 03/28/19, 2019 at 18:10:37 +0530, Jason Gunthorpe wrote:
> > On Wed, Mar 27, 2019 at 07:08:54PM +0530, Potnuri Bharat Teja wrote:
> > > On Saturday, March 03/23/19, 2019 at 08:07:46 +0530, Kangjie Lu wrote:
> > > >
> > > >
> > > > > 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
> > > > > +++ 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.
> > >
> > > Sorry for the late response.
> > > I recommend an error print before the return.
> > > if (!skb) {
> > > pr_err("%s - failed to alloc skb\n", __func__);
> > > return -ENOMEM;
> > > }
> >
> > no error prints on memory allocation failure, the kernel already
> > prints enough on this
> Ok.
>
> Acked-by: Potnuri Bharat Teja <bharat@chelsio.com>
It needs to be resent with Bart's comment addressed, and all the tags collected.
Jason
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2019-03-28 14:26 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-09 5:19 [PATCH] infiniband: cxgb4: fix a potential NULL pointer dereference Kangjie Lu
2019-03-23 2:37 ` Kangjie Lu
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
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.