All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] cxgb4: Fix error codes in c4iw_create_cq()
@ 2017-07-13  7:47 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2017-07-13  7:47 UTC (permalink / raw)
  To: Steve Wise
  Cc: Doug Ledford, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

If one of these kmalloc() calls fails then we return ERR_PTR(0) which is
NULL.  It results in a NULL dereference in the callers.

Fixes: cfdda9d76436 ("RDMA/cxgb4: Add driver for Chelsio T4 RNIC")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
index e16fcaf6b5a3..be07da1997e6 100644
--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -963,6 +963,7 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev,
 		goto err3;
 
 	if (ucontext) {
+		ret = -ENOMEM;
 		mm = kmalloc(sizeof *mm, GFP_KERNEL);
 		if (!mm)
 			goto err4;

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] cxgb4: Fix error codes in c4iw_create_cq()
@ 2017-07-13  7:47 ` Dan Carpenter
  0 siblings, 0 replies; 6+ messages in thread
From: Dan Carpenter @ 2017-07-13  7:47 UTC (permalink / raw)
  To: Steve Wise
  Cc: Doug Ledford, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	kernel-janitors-u79uwXL29TY76Z2rM5mHXA

If one of these kmalloc() calls fails then we return ERR_PTR(0) which is
NULL.  It results in a NULL dereference in the callers.

Fixes: cfdda9d76436 ("RDMA/cxgb4: Add driver for Chelsio T4 RNIC")
Signed-off-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org>

diff --git a/drivers/infiniband/hw/cxgb4/cq.c b/drivers/infiniband/hw/cxgb4/cq.c
index e16fcaf6b5a3..be07da1997e6 100644
--- a/drivers/infiniband/hw/cxgb4/cq.c
+++ b/drivers/infiniband/hw/cxgb4/cq.c
@@ -963,6 +963,7 @@ struct ib_cq *c4iw_create_cq(struct ib_device *ibdev,
 		goto err3;
 
 	if (ucontext) {
+		ret = -ENOMEM;
 		mm = kmalloc(sizeof *mm, GFP_KERNEL);
 		if (!mm)
 			goto err4;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* RE: [PATCH] cxgb4: Fix error codes in c4iw_create_cq()
  2017-07-13  7:47 ` Dan Carpenter
@ 2017-07-13 14:34   ` Steve Wise
  -1 siblings, 0 replies; 6+ messages in thread
From: Steve Wise @ 2017-07-13 14:34 UTC (permalink / raw)
  To: 'Dan Carpenter'
  Cc: 'Doug Ledford', 'Sean Hefty',
	'Hal Rosenstock', linux-rdma, kernel-janitors

> 
> If one of these kmalloc() calls fails then we return ERR_PTR(0) which is
> NULL.  It results in a NULL dereference in the callers.
> 
> Fixes: cfdda9d76436 ("RDMA/cxgb4: Add driver for Chelsio T4 RNIC")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Steve Wise <swise@opengridcomputing.com>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] cxgb4: Fix error codes in c4iw_create_cq()
@ 2017-07-13 14:34   ` Steve Wise
  0 siblings, 0 replies; 6+ messages in thread
From: Steve Wise @ 2017-07-13 14:34 UTC (permalink / raw)
  To: 'Dan Carpenter'
  Cc: 'Doug Ledford', 'Sean Hefty',
	'Hal Rosenstock', linux-rdma, kernel-janitors

> 
> If one of these kmalloc() calls fails then we return ERR_PTR(0) which is
> NULL.  It results in a NULL dereference in the callers.
> 
> Fixes: cfdda9d76436 ("RDMA/cxgb4: Add driver for Chelsio T4 RNIC")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Acked-by: Steve Wise <swise@opengridcomputing.com>



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] cxgb4: Fix error codes in c4iw_create_cq()
  2017-07-13  7:47 ` Dan Carpenter
@ 2017-07-22 17:28   ` Doug Ledford
  -1 siblings, 0 replies; 6+ messages in thread
From: Doug Ledford @ 2017-07-22 17:28 UTC (permalink / raw)
  To: Dan Carpenter, Steve Wise
  Cc: Sean Hefty, Hal Rosenstock, linux-rdma, kernel-janitors


[-- Attachment #1.1: Type: text/plain, Size: 508 bytes --]

On 7/13/2017 3:47 AM, Dan Carpenter wrote:
> If one of these kmalloc() calls fails then we return ERR_PTR(0) which is
> NULL.  It results in a NULL dereference in the callers.
> 
> Fixes: cfdda9d76436 ("RDMA/cxgb4: Add driver for Chelsio T4 RNIC")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

This was accepted into 4.13-rc, thanks.

-- 
Doug Ledford <dledford@redhat.com>
    GPG Key ID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] cxgb4: Fix error codes in c4iw_create_cq()
@ 2017-07-22 17:28   ` Doug Ledford
  0 siblings, 0 replies; 6+ messages in thread
From: Doug Ledford @ 2017-07-22 17:28 UTC (permalink / raw)
  To: Dan Carpenter, Steve Wise
  Cc: Sean Hefty, Hal Rosenstock, linux-rdma, kernel-janitors


[-- Attachment #1.1: Type: text/plain, Size: 508 bytes --]

On 7/13/2017 3:47 AM, Dan Carpenter wrote:
> If one of these kmalloc() calls fails then we return ERR_PTR(0) which is
> NULL.  It results in a NULL dereference in the callers.
> 
> Fixes: cfdda9d76436 ("RDMA/cxgb4: Add driver for Chelsio T4 RNIC")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

This was accepted into 4.13-rc, thanks.

-- 
Doug Ledford <dledford@redhat.com>
    GPG Key ID: B826A3330E572FDD
    Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 884 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-07-22 17:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-13  7:47 [PATCH] cxgb4: Fix error codes in c4iw_create_cq() Dan Carpenter
2017-07-13  7:47 ` Dan Carpenter
2017-07-13 14:34 ` Steve Wise
2017-07-13 14:34   ` Steve Wise
2017-07-22 17:28 ` Doug Ledford
2017-07-22 17:28   ` Doug Ledford

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.