* [PATCH 1/1] RDMA/iw_cxgb4: Avoid touch after free error in ARP failure handlers
@ 2017-05-11 11:43 Raju Rangoju
[not found] ` <20170511114354.25046-1-rajur-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Raju Rangoju @ 2017-05-11 11:43 UTC (permalink / raw)
To: dledford-H+wXaHxf7aLQT0dZR+AlfA,
linux-rdma-u79uwXL29TY76Z2rM5mHXA
Cc: swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW,
rajur-ut6Up61K2wZBDgjK7y7TUQ
The patch 761e19a504af: "RDMA/iw_cxgb4: Handle return value of
c4iw_ofld_send() in abort_arp_failure()" from May 6, 2016, leads to the
following static checker warning:
drivers/infiniband/hw/cxgb4/cm.c:575 abort_arp_failure()
warn: passing freed memory 'skb'
Also fixes skb leak when l2t resolution fails
Fixes: 761e19a504afa55 (RDMA/iw_cxgb4: Handle return value of
c4iw_ofld_send() in abort_arp_failure())
Signed-off-by: Raju Rangoju <rajur-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
---
drivers/infiniband/hw/cxgb4/cm.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index b6fe45924c6e..06b110213e92 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -488,6 +488,7 @@ static int _put_ep_safe(struct c4iw_dev *dev, struct sk_buff *skb)
ep = *((struct c4iw_ep **)(skb->cb + 2 * sizeof(void *)));
release_ep_resources(ep);
+ kfree_skb(skb);
return 0;
}
@@ -498,6 +499,7 @@ static int _put_pass_ep_safe(struct c4iw_dev *dev, struct sk_buff *skb)
ep = *((struct c4iw_ep **)(skb->cb + 2 * sizeof(void *)));
c4iw_put_ep(&ep->parent_ep->com);
release_ep_resources(ep);
+ kfree_skb(skb);
return 0;
}
@@ -569,11 +571,13 @@ static void abort_arp_failure(void *handle, struct sk_buff *skb)
pr_debug("%s rdev %p\n", __func__, rdev);
req->cmd = CPL_ABORT_NO_RST;
+ skb_get(skb);
ret = c4iw_ofld_send(rdev, skb);
if (ret) {
__state_set(&ep->com, DEAD);
queue_arp_failure_cpl(ep, skb, FAKE_CPL_PUT_EP_SAFE);
- }
+ } else
+ kfree_skb(skb);
}
static int send_flowc(struct c4iw_ep *ep)
--
2.12.0
--
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] 4+ messages in thread[parent not found: <20170511114354.25046-1-rajur-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>]
* Re: [PATCH 1/1] RDMA/iw_cxgb4: Avoid touch after free error in ARP failure handlers [not found] ` <20170511114354.25046-1-rajur-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org> @ 2017-05-13 11:36 ` Leon Romanovsky 2017-05-15 6:40 ` Raju Rangoju 2017-06-01 22:21 ` Doug Ledford 2 siblings, 0 replies; 4+ messages in thread From: Leon Romanovsky @ 2017-05-13 11:36 UTC (permalink / raw) To: Raju Rangoju Cc: dledford-H+wXaHxf7aLQT0dZR+AlfA, linux-rdma-u79uwXL29TY76Z2rM5mHXA, swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW [-- Attachment #1: Type: text/plain, Size: 848 bytes --] On Thu, May 11, 2017 at 05:13:54PM +0530, Raju Rangoju wrote: > The patch 761e19a504af: "RDMA/iw_cxgb4: Handle return value of > c4iw_ofld_send() in abort_arp_failure()" from May 6, 2016, leads to the > following static checker warning: > drivers/infiniband/hw/cxgb4/cm.c:575 abort_arp_failure() > warn: passing freed memory 'skb' > > Also fixes skb leak when l2t resolution fails > > Fixes: 761e19a504afa55 (RDMA/iw_cxgb4: Handle return value of > c4iw_ofld_send() in abort_arp_failure()) > > Signed-off-by: Raju Rangoju <rajur-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org> > Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org> > --- > drivers/infiniband/hw/cxgb4/cm.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > Thanks, Reviewed-by: Leon Romanovsky <leonro-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org> [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 833 bytes --] ^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH 1/1] RDMA/iw_cxgb4: Avoid touch after free error in ARP failure handlers [not found] ` <20170511114354.25046-1-rajur-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org> 2017-05-13 11:36 ` Leon Romanovsky @ 2017-05-15 6:40 ` Raju Rangoju 2017-06-01 22:21 ` Doug Ledford 2 siblings, 0 replies; 4+ messages in thread From: Raju Rangoju @ 2017-05-15 6:40 UTC (permalink / raw) To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org, linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: SWise OGC, Raju Rangoju -----Original Message----- From: Raju Rangoju [mailto:rajur-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org] Sent: 11 May 2017 17:14 To: dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org; linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org Cc: SWise OGC <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>; Raju Rangoju <rajur-ut6Up61K2waIwRZHo2/mJg@public.gmane.orgm> Subject: [PATCH 1/1] RDMA/iw_cxgb4: Avoid touch after free error in ARP failure handlers The patch 761e19a504af: "RDMA/iw_cxgb4: Handle return value of c4iw_ofld_send() in abort_arp_failure()" from May 6, 2016, leads to the following static checker warning: drivers/infiniband/hw/cxgb4/cm.c:575 abort_arp_failure() warn: passing freed memory 'skb' Also fixes skb leak when l2t resolution fails Fixes: 761e19a504afa55 (RDMA/iw_cxgb4: Handle return value of c4iw_ofld_send() in abort_arp_failure()) Reported-by: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> Cc: Dan Carpenter <dan.carpenter-QHcLZuEGTsvQT0dZR+AlfA@public.gmane.org> Signed-off-by: Raju Rangoju <rajur-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org> Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org> --- drivers/infiniband/hw/cxgb4/cm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index b6fe45924c6e..06b110213e92 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c @@ -488,6 +488,7 @@ static int _put_ep_safe(struct c4iw_dev *dev, struct sk_buff *skb) ep = *((struct c4iw_ep **)(skb->cb + 2 * sizeof(void *))); release_ep_resources(ep); + kfree_skb(skb); return 0; } @@ -498,6 +499,7 @@ static int _put_pass_ep_safe(struct c4iw_dev *dev, struct sk_buff *skb) ep = *((struct c4iw_ep **)(skb->cb + 2 * sizeof(void *))); c4iw_put_ep(&ep->parent_ep->com); release_ep_resources(ep); + kfree_skb(skb); return 0; } @@ -569,11 +571,13 @@ static void abort_arp_failure(void *handle, struct sk_buff *skb) pr_debug("%s rdev %p\n", __func__, rdev); req->cmd = CPL_ABORT_NO_RST; + skb_get(skb); ret = c4iw_ofld_send(rdev, skb); if (ret) { __state_set(&ep->com, DEAD); queue_arp_failure_cpl(ep, skb, FAKE_CPL_PUT_EP_SAFE); - } + } else + kfree_skb(skb); } static int send_flowc(struct c4iw_ep *ep) -- 2.12.0 -- 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] 4+ messages in thread
* Re: [PATCH 1/1] RDMA/iw_cxgb4: Avoid touch after free error in ARP failure handlers [not found] ` <20170511114354.25046-1-rajur-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org> 2017-05-13 11:36 ` Leon Romanovsky 2017-05-15 6:40 ` Raju Rangoju @ 2017-06-01 22:21 ` Doug Ledford 2 siblings, 0 replies; 4+ messages in thread From: Doug Ledford @ 2017-06-01 22:21 UTC (permalink / raw) To: Raju Rangoju, linux-rdma-u79uwXL29TY76Z2rM5mHXA Cc: swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW On Thu, 2017-05-11 at 17:13 +0530, Raju Rangoju wrote: > The patch 761e19a504af: "RDMA/iw_cxgb4: Handle return value of > c4iw_ofld_send() in abort_arp_failure()" from May 6, 2016, leads to > the > following static checker warning: > drivers/infiniband/hw/cxgb4/cm.c:575 abort_arp_failure() > warn: passing freed memory 'skb' > > Also fixes skb leak when l2t resolution fails > > Fixes: 761e19a504afa55 (RDMA/iw_cxgb4: Handle return value of > c4iw_ofld_send() in abort_arp_failure()) > > Signed-off-by: Raju Rangoju <rajur-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org> > Reviewed-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org> Thanks, applied. -- Doug Ledford <dledford-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> GPG KeyID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD -- 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 [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-06-01 22:21 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-11 11:43 [PATCH 1/1] RDMA/iw_cxgb4: Avoid touch after free error in ARP failure handlers Raju Rangoju
[not found] ` <20170511114354.25046-1-rajur-ut6Up61K2wZBDgjK7y7TUQ@public.gmane.org>
2017-05-13 11:36 ` Leon Romanovsky
2017-05-15 6:40 ` Raju Rangoju
2017-06-01 22:21 ` Doug Ledford
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).