All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] ib/rxe: double free on error
@ 2016-06-18  8:40 ` Dan Carpenter
  0 siblings, 0 replies; 22+ messages in thread
From: Dan Carpenter @ 2016-06-18  8:40 UTC (permalink / raw)
  To: Moni Shoua
  Cc: Doug Ledford, Sean Hefty, Hal Rosenstock, linux-rdma,
	kernel-janitors

"goto err1" could probably be remained "goto free_pkey_tbl" since
that's what it does.  This is a double free.

Fixes: 0784481b2f32 ('Add initialization for Soft RoCE driver, pools constants etc.')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/infiniband/hw/rxe/rxe.c b/drivers/infiniband/hw/rxe/rxe.c
index 48c41e00..50e25b0 100644
--- a/drivers/infiniband/hw/rxe/rxe.c
+++ b/drivers/infiniband/hw/rxe/rxe.c
@@ -187,7 +187,6 @@ static int rxe_init_ports(struct rxe_dev *rxe)
 	port->pkey_tbl[0] = 0xffff;
 
 	if (!port->attr.gid_tbl_len) {
-		kfree(port->pkey_tbl);
 		err = -EINVAL;
 		goto err1;
 	}

^ permalink raw reply related	[flat|nested] 22+ messages in thread
* Re: [PATCH] IB/rxe: Simplify rxe_init_ports logic
  2016-06-18 10:34   ` Leon Romanovsky
@ 2016-06-18 13:36 ` kbuild test robot
  -1 siblings, 0 replies; 22+ messages in thread
From: kbuild test robot @ 2016-06-18 13:36 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 1422 bytes --]

Hi,

[auto build test ERROR on next-20160617]
[cannot apply to rdma/master v4.7-rc3 v4.7-rc2 v4.7-rc1 v4.7-rc3]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Leon-Romanovsky/IB-rxe-Simplify-rxe_init_ports-logic/20160618-183558
config: x86_64-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

All errors (new ones prefixed by >>):

   include/linux/compiler.h:232:8: sparse: attribute 'no_sanitize_address': unknown attribute
   drivers/infiniband/hw/rxe/rxe.c: In function 'rxe_init_ports':
>> drivers/infiniband/hw/rxe/rxe.c:168:27: error: incompatible types when initializing type 'struct rxe_port *' using type 'struct rxe_port'
     struct rxe_port *port =  rxe->port;
                              ^~~

vim +168 drivers/infiniband/hw/rxe/rxe.c

   162	
   163	/* initialize port state, note IB convention that HCA ports are always
   164	 * numbered from 1
   165	 */
   166	static int rxe_init_ports(struct rxe_dev *rxe)
   167	{
 > 168		struct rxe_port *port =  rxe->port;
   169	
   170		rxe_init_port_param(port);
   171	

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation

[-- Attachment #2: .config.gz --]
[-- Type: application/octet-stream, Size: 55009 bytes --]

^ permalink raw reply	[flat|nested] 22+ messages in thread
* [PATCH] IB/rxe: double free on error
@ 2017-03-08  5:21 ` Dan Carpenter
  0 siblings, 0 replies; 22+ messages in thread
From: Dan Carpenter @ 2017-03-08  5:21 UTC (permalink / raw)
  To: Moni Shoua
  Cc: Doug Ledford, Sean Hefty, Hal Rosenstock, linux-rdma,
	kernel-janitors

"goto err;" has it's own kfree_skb() call so it's a double free.  We
only need to free on the "goto exit;" path.

Fixes: 8700e3e7c485 ("Soft RoCE driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
Static analysis.  Not tested.  Please review carefully.

diff --git a/drivers/infiniband/sw/rxe/rxe_req.c b/drivers/infiniband/sw/rxe/rxe_req.c
index dbfde0dc6ff7..9f95f50b2909 100644
--- a/drivers/infiniband/sw/rxe/rxe_req.c
+++ b/drivers/infiniband/sw/rxe/rxe_req.c
@@ -729,11 +729,11 @@ int rxe_requester(void *arg)
 	ret = rxe_xmit_packet(to_rdev(qp->ibqp.device), qp, &pkt, skb);
 	if (ret) {
 		qp->need_req_skb = 1;
-		kfree_skb(skb);
 
 		rollback_state(wqe, qp, &rollback_wqe, rollback_psn);
 
 		if (ret = -EAGAIN) {
+			kfree_skb(skb);
 			rxe_run_task(&qp->req.task, 1);
 			goto exit;
 		}

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

end of thread, other threads:[~2017-03-25  1:48 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-18  8:40 [patch] ib/rxe: double free on error Dan Carpenter
2016-06-18  8:40 ` Dan Carpenter
2016-06-18 10:34 ` Leon Romanovsky
2016-06-18 10:34   ` Leon Romanovsky
     [not found]   ` <20160618103430.GC5408-2ukJVAZIZ/Y@public.gmane.org>
2016-06-18 11:00     ` Dan Carpenter
2016-06-18 11:00       ` Dan Carpenter
2016-06-18 11:03       ` Leon Romanovsky
2016-06-18 11:03         ` Leon Romanovsky
2016-06-18 11:22         ` Leon Romanovsky
2016-06-18 11:22           ` Leon Romanovsky
  -- strict thread matches above, loose matches on Subject: below --
2016-06-18 13:36 [PATCH] IB/rxe: Simplify rxe_init_ports logic kbuild test robot
2016-06-18 13:36 ` kbuild test robot
2017-03-08  5:21 [PATCH] IB/rxe: double free on error Dan Carpenter
2017-03-08  5:21 ` Dan Carpenter
2017-03-08  6:58 ` Leon Romanovsky
2017-03-08  6:58   ` Leon Romanovsky
     [not found]   ` <20170308065829.GV14379-U/DQcQFIOTAAJjI8aNfphQ@public.gmane.org>
2017-03-08 16:42     ` Moni Shoua
2017-03-08 16:42       ` Moni Shoua
2017-03-08 16:44 ` Moni Shoua
2017-03-08 16:44   ` Moni Shoua
2017-03-25  1:48 ` Doug Ledford
2017-03-25  1:48   ` 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.