linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 2/3] iw_cxgb4: drop listen destroy replies if no ep found
       [not found] ` <cover.1505510827.git.swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
@ 2017-09-05 18:52   ` Steve Wise
  2017-09-05 18:52   ` [PATCH v3 3/3] iw_cxgb4: remove the stid on listen create failure Steve Wise
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Steve Wise @ 2017-09-05 18:52 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

If the thread waiting for a CLOSE_LISTSRV_RPL times out and bails,
then we need to handle a subsequent CPL if it arrives and the stid has
been released.  In this case silently drop it.

Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
---
 drivers/infiniband/hw/cxgb4/cm.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 6d85a5d..d76bfe3 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -2333,9 +2333,14 @@ static int close_listsrv_rpl(struct c4iw_dev *dev, struct sk_buff *skb)
 	unsigned int stid = GET_TID(rpl);
 	struct c4iw_listen_ep *ep = get_ep_from_stid(dev, stid);
 
+	if (!ep) {
+		pr_debug("%s stid %d lookup failure!\n", __func__, stid);
+		goto out;
+	}
 	pr_debug("%s ep %p\n", __func__, ep);
 	c4iw_wake_up(&ep->com.wr_wait, status2errno(rpl->status));
 	c4iw_put_ep(&ep->com);
+out:
 	return 0;
 }
 
-- 
1.8.3.1

--
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] 5+ messages in thread

* [PATCH v3 3/3] iw_cxgb4: remove the stid on listen create failure
       [not found] ` <cover.1505510827.git.swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
  2017-09-05 18:52   ` [PATCH v3 2/3] iw_cxgb4: drop listen destroy replies if no ep found Steve Wise
@ 2017-09-05 18:52   ` Steve Wise
  2017-09-13 16:52   ` [PATCH v3 1/3] iw_cxgb4: put ep reference in pass_accept_req() Steve Wise
  2017-09-22 17:01   ` [PATCH v3 0/3] iw_cxgb4 fixes for 4.14-rc Doug Ledford
  3 siblings, 0 replies; 5+ messages in thread
From: Steve Wise @ 2017-09-05 18:52 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

If a listen create fails, then the server tid (stid) is incorrectly left
in the stid idr table, which can cause a touch-after-free if the stid
is looked up and the already freed endpoint is touched.  So make sure
and remove it in the error path.

Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
---
 drivers/infiniband/hw/cxgb4/cm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index d76bfe3..ca846fb 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -3463,7 +3463,7 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog)
 		cm_id->provider_data = ep;
 		goto out;
 	}
-
+	remove_handle(ep->com.dev, &ep->com.dev->stid_idr, ep->stid);
 	cxgb4_free_stid(ep->com.dev->rdev.lldi.tids, ep->stid,
 			ep->com.local_addr.ss_family);
 fail2:
-- 
1.8.3.1

--
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] 5+ messages in thread

* [PATCH v3 1/3] iw_cxgb4: put ep reference in pass_accept_req()
       [not found] ` <cover.1505510827.git.swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
  2017-09-05 18:52   ` [PATCH v3 2/3] iw_cxgb4: drop listen destroy replies if no ep found Steve Wise
  2017-09-05 18:52   ` [PATCH v3 3/3] iw_cxgb4: remove the stid on listen create failure Steve Wise
@ 2017-09-13 16:52   ` Steve Wise
  2017-09-22 17:01   ` [PATCH v3 0/3] iw_cxgb4 fixes for 4.14-rc Doug Ledford
  3 siblings, 0 replies; 5+ messages in thread
From: Steve Wise @ 2017-09-13 16:52 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

The listening endpoint should always be dereferenced at the end of
pass_accept_req().

Fixes: f86fac79afec ("RDMA/iw_cxgb4: atomic find and reference for listening endpoints")

Cc: stable-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Signed-off-by: Steve Wise <swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
---
 drivers/infiniband/hw/cxgb4/cm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index e49b34c..6d85a5d 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -2594,9 +2594,9 @@ static int pass_accept_req(struct c4iw_dev *dev, struct sk_buff *skb)
 	c4iw_put_ep(&child_ep->com);
 reject:
 	reject_cr(dev, hwtid, skb);
+out:
 	if (parent_ep)
 		c4iw_put_ep(&parent_ep->com);
-out:
 	return 0;
 }
 
-- 
1.8.3.1

--
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] 5+ messages in thread

* [PATCH v3 0/3] iw_cxgb4 fixes for 4.14-rc
@ 2017-09-15 21:27 Steve Wise
       [not found] ` <cover.1505510827.git.swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Steve Wise @ 2017-09-15 21:27 UTC (permalink / raw)
  To: dledford-H+wXaHxf7aLQT0dZR+AlfA; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

v2 didn't make it to the email list, so I'm sending v3.  I'm having a 
bad day...

---

Hey Doug, please consider these bug fixes for 4.14-rc.  I'm resending 
a "v2" series which overrides the first submission, and the "RESEND"
submission.

Changes since "RESEND"
- fixed up the commit comment for patch 3

Chances since original submission
- Move the stable tag to the correct location in the commit log

Thanks,

Steve.

---

Steve Wise (3):
  iw_cxgb4: put ep reference in pass_accept_req()
  iw_cxgb4: drop listen destroy replies if no ep found
  iw_cxgb4: remove the stid on listen create failure

 drivers/infiniband/hw/cxgb4/cm.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

-- 
1.8.3.1

--
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] 5+ messages in thread

* Re: [PATCH v3 0/3] iw_cxgb4 fixes for 4.14-rc
       [not found] ` <cover.1505510827.git.swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
                     ` (2 preceding siblings ...)
  2017-09-13 16:52   ` [PATCH v3 1/3] iw_cxgb4: put ep reference in pass_accept_req() Steve Wise
@ 2017-09-22 17:01   ` Doug Ledford
  3 siblings, 0 replies; 5+ messages in thread
From: Doug Ledford @ 2017-09-22 17:01 UTC (permalink / raw)
  To: Steve Wise; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA

On Fri, 2017-09-15 at 14:27 -0700, Steve Wise wrote:
> v2 didn't make it to the email list, so I'm sending v3.  I'm having
> a 
> bad day...

Yeah, I saw at least one version went directly to my Inbox instead of
to the mailing list ;-).

Series applied for rc, thanks.

-- 
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] 5+ messages in thread

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

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-15 21:27 [PATCH v3 0/3] iw_cxgb4 fixes for 4.14-rc Steve Wise
     [not found] ` <cover.1505510827.git.swise-7bPotxP6k4+P2YhJcF5u+vpXobYPEAuW@public.gmane.org>
2017-09-05 18:52   ` [PATCH v3 2/3] iw_cxgb4: drop listen destroy replies if no ep found Steve Wise
2017-09-05 18:52   ` [PATCH v3 3/3] iw_cxgb4: remove the stid on listen create failure Steve Wise
2017-09-13 16:52   ` [PATCH v3 1/3] iw_cxgb4: put ep reference in pass_accept_req() Steve Wise
2017-09-22 17:01   ` [PATCH v3 0/3] iw_cxgb4 fixes for 4.14-rc 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).