diff mbox

IB/cma: Fix net_dev reference leak with failed requests

Message ID 1440680115-9164-1-git-send-email-haggaie@mellanox.com (mailing list archive)
State Accepted
Headers show

Commit Message

Haggai Eran Aug. 27, 2015, 12:55 p.m. UTC
When no matching listening ID is found for a given request, the net_dev
that was used to find the request isn't released.

Fixes: 20c36836ecad ("IB/cma: Use found net_dev for passive connections")
Signed-off-by: Haggai Eran <haggaie@mellanox.com>
---
 drivers/infiniband/core/cma.c | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Or Gerlitz Aug. 30, 2015, 6:12 a.m. UTC | #1
On Thu, Aug 27, 2015 at 5:55 AM, Haggai Eran <haggaie@mellanox.com> wrote:
> When no matching listening ID is found for a given request, the net_dev
> that was used to find the request isn't released.
>
> Fixes: 20c36836ecad ("IB/cma: Use found net_dev for passive connections")

same here, Doug, if this ID isn't the one that is actually going to
show off in Linus tree, please either squash this there prior to
getting the bits upstream or hold off till we have  a proper ID

> Signed-off-by: Haggai Eran <haggaie@mellanox.com>
> ---
>  drivers/infiniband/core/cma.c | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
> index 9b306d7b5c27..b1ab13f3e182 100644
> --- a/drivers/infiniband/core/cma.c
> +++ b/drivers/infiniband/core/cma.c
> @@ -1302,6 +1302,10 @@ static struct rdma_id_private *cma_id_from_event(struct ib_cm_id *cm_id,
>         bind_list = cma_ps_find(rdma_ps_from_service_id(req.service_id),
>                                 cma_port_from_service_id(req.service_id));
>         id_priv = cma_find_listener(bind_list, cm_id, ib_event, &req, *net_dev);
> +       if (IS_ERR(id_priv)) {
> +               dev_put(*net_dev);
> +               *net_dev = NULL;
> +       }
>
>         return id_priv;
>  }
> --
> 1.7.11.2
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Doug Ledford Aug. 30, 2015, 10:25 p.m. UTC | #2
On 08/30/2015 02:12 AM, Or Gerlitz wrote:
> On Thu, Aug 27, 2015 at 5:55 AM, Haggai Eran <haggaie@mellanox.com> wrote:
>> When no matching listening ID is found for a given request, the net_dev
>> that was used to find the request isn't released.
>>
>> Fixes: 20c36836ecad ("IB/cma: Use found net_dev for passive connections")
> 
> same here, Doug,

Same as the last email, I have the commit ID now, and I fixed up the
commit message.
Ira Weiny Aug. 31, 2015, 3:20 p.m. UTC | #3
> 

> On 08/30/2015 02:12 AM, Or Gerlitz wrote:

> > On Thu, Aug 27, 2015 at 5:55 AM, Haggai Eran <haggaie@mellanox.com>

> wrote:

> >> When no matching listening ID is found for a given request, the

> >> net_dev that was used to find the request isn't released.

> >>

> >> Fixes: 20c36836ecad ("IB/cma: Use found net_dev for passive

> >> connections")

> >

> > same here, Doug,

> 

> Same as the last email, I have the commit ID now, and I fixed up the commit

> message.

> 


Doug I'm working on the clean up Hal suggested to the ib_mad.h file which was updated in your to-be-rebased-4.3 branch via this patch.

Fixes: abde0260e47b ("IB/core: Add header definitions")

It looks like this is the patch destined for 4.3 on this branch k.o/for-4.3?

Fixes: d4ab347005fb ("IB/core: Add core header changes needed for OPA")

I personally did not mind the rebasing except for this issue.

Let me know which branch I should base these changes off of.

Thanks,
Ira
Doug Ledford Sept. 1, 2015, 12:23 a.m. UTC | #4
On 08/31/2015 11:20 AM, Weiny, Ira wrote:
>>
>> On 08/30/2015 02:12 AM, Or Gerlitz wrote:
>>> On Thu, Aug 27, 2015 at 5:55 AM, Haggai Eran <haggaie@mellanox.com>
>> wrote:
>>>> When no matching listening ID is found for a given request, the
>>>> net_dev that was used to find the request isn't released.
>>>>
>>>> Fixes: 20c36836ecad ("IB/cma: Use found net_dev for passive
>>>> connections")
>>>
>>> same here, Doug,
>>
>> Same as the last email, I have the commit ID now, and I fixed up the commit
>> message.
>>
> 
> Doug I'm working on the clean up Hal suggested to the ib_mad.h file which was updated in your to-be-rebased-4.3 branch via this patch.
> 
> Fixes: abde0260e47b ("IB/core: Add header definitions")
> 
> It looks like this is the patch destined for 4.3 on this branch k.o/for-4.3?
> 
> Fixes: d4ab347005fb ("IB/core: Add core header changes needed for OPA")

Correct.  I squashed the first two patches (which both touched core
files) down to just one.

> I personally did not mind the rebasing except for this issue.
> 
> Let me know which branch I should base these changes off of.

Base if off of the k.o/for-4.3.  That's where it will go.  I'll just end
up applying this to the top of the stack.
Doug Ledford Sept. 3, 2015, 5:56 p.m. UTC | #5
On 08/27/2015 08:55 AM, Haggai Eran wrote:
> When no matching listening ID is found for a given request, the net_dev
> that was used to find the request isn't released.
> 
> Fixes: 20c36836ecad ("IB/cma: Use found net_dev for passive connections")
> Signed-off-by: Haggai Eran <haggaie@mellanox.com>

Applied, thanks!

> ---
>  drivers/infiniband/core/cma.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
> index 9b306d7b5c27..b1ab13f3e182 100644
> --- a/drivers/infiniband/core/cma.c
> +++ b/drivers/infiniband/core/cma.c
> @@ -1302,6 +1302,10 @@ static struct rdma_id_private *cma_id_from_event(struct ib_cm_id *cm_id,
>  	bind_list = cma_ps_find(rdma_ps_from_service_id(req.service_id),
>  				cma_port_from_service_id(req.service_id));
>  	id_priv = cma_find_listener(bind_list, cm_id, ib_event, &req, *net_dev);
> +	if (IS_ERR(id_priv)) {
> +		dev_put(*net_dev);
> +		*net_dev = NULL;
> +	}
>  
>  	return id_priv;
>  }
>
diff mbox

Patch

diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 9b306d7b5c27..b1ab13f3e182 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1302,6 +1302,10 @@  static struct rdma_id_private *cma_id_from_event(struct ib_cm_id *cm_id,
 	bind_list = cma_ps_find(rdma_ps_from_service_id(req.service_id),
 				cma_port_from_service_id(req.service_id));
 	id_priv = cma_find_listener(bind_list, cm_id, ib_event, &req, *net_dev);
+	if (IS_ERR(id_priv)) {
+		dev_put(*net_dev);
+		*net_dev = NULL;
+	}
 
 	return id_priv;
 }