* [PATCH] RDMA/ocrdma: fix double free on pd
@ 2015-06-05 14:47 Colin King
2015-06-08 5:52 ` Devesh Sharma
2015-06-11 5:15 ` Doug Ledford
0 siblings, 2 replies; 3+ messages in thread
From: Colin King @ 2015-06-05 14:47 UTC (permalink / raw)
To: Selvin Xavier, Devesh Sharma, Mitesh Ahuja, Doug Ledford,
Sean Hefty, Hal Rosenstock, linux-rdma
Cc: linux-kernel
From: Colin Ian King <colin.king@canonical.com>
A reorganisation of the PD allocation and deallocation in commit
9ba1377daa ("RDMA/ocrdma: Move PD resource management to driver.")
introduced a double free on pd, as detected by static analysis by
smatch:
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c:682 ocrdma_alloc_pd()
error: double free of 'pd'^
The original call to ocrdma_mbx_dealloc_pd() (which does not kfree
pd) was replaced with a call to _ocrdma_dealloc_pd() (which does
kfree pd). The kfree following this call causes the double free,
so just remove it to fix the problem.
Fixes: 9ba1377daa ("RDMA/ocrdma: Move PD resource management to driver.")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index 9dcb660..219f212 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -679,7 +679,6 @@ err:
ocrdma_release_ucontext_pd(uctx);
} else {
status = _ocrdma_dealloc_pd(dev, pd);
- kfree(pd);
}
exit:
return ERR_PTR(status);
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] RDMA/ocrdma: fix double free on pd
2015-06-05 14:47 [PATCH] RDMA/ocrdma: fix double free on pd Colin King
@ 2015-06-08 5:52 ` Devesh Sharma
2015-06-11 5:15 ` Doug Ledford
1 sibling, 0 replies; 3+ messages in thread
From: Devesh Sharma @ 2015-06-08 5:52 UTC (permalink / raw)
To: Colin King
Cc: Selvin Xavier, Devesh Sharma, Mitesh Ahuja, Doug Ledford,
Sean Hefty, Hal Rosenstock, linux-rdma, linux-kernel
Acked-By: Devesh Sharma <devesh.sharma@avagotech.com>
On Fri, Jun 5, 2015 at 8:17 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> A reorganisation of the PD allocation and deallocation in commit
> 9ba1377daa ("RDMA/ocrdma: Move PD resource management to driver.")
> introduced a double free on pd, as detected by static analysis by
> smatch:
>
> drivers/infiniband/hw/ocrdma/ocrdma_verbs.c:682 ocrdma_alloc_pd()
> error: double free of 'pd'^
>
> The original call to ocrdma_mbx_dealloc_pd() (which does not kfree
> pd) was replaced with a call to _ocrdma_dealloc_pd() (which does
> kfree pd). The kfree following this call causes the double free,
> so just remove it to fix the problem.
>
> Fixes: 9ba1377daa ("RDMA/ocrdma: Move PD resource management to driver.")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
> index 9dcb660..219f212 100644
> --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
> +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
> @@ -679,7 +679,6 @@ err:
> ocrdma_release_ucontext_pd(uctx);
> } else {
> status = _ocrdma_dealloc_pd(dev, pd);
> - kfree(pd);
> }
> exit:
> return ERR_PTR(status);
> --
> 2.1.4
>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] RDMA/ocrdma: fix double free on pd
2015-06-05 14:47 [PATCH] RDMA/ocrdma: fix double free on pd Colin King
2015-06-08 5:52 ` Devesh Sharma
@ 2015-06-11 5:15 ` Doug Ledford
1 sibling, 0 replies; 3+ messages in thread
From: Doug Ledford @ 2015-06-11 5:15 UTC (permalink / raw)
To: Colin King
Cc: Selvin Xavier, Devesh Sharma, Mitesh Ahuja, Sean Hefty,
Hal Rosenstock, linux-rdma, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1459 bytes --]
On Fri, 2015-06-05 at 15:47 +0100, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> A reorganisation of the PD allocation and deallocation in commit
> 9ba1377daa ("RDMA/ocrdma: Move PD resource management to driver.")
> introduced a double free on pd, as detected by static analysis by
> smatch:
>
> drivers/infiniband/hw/ocrdma/ocrdma_verbs.c:682 ocrdma_alloc_pd()
> error: double free of 'pd'^
>
> The original call to ocrdma_mbx_dealloc_pd() (which does not kfree
> pd) was replaced with a call to _ocrdma_dealloc_pd() (which does
> kfree pd). The kfree following this call causes the double free,
> so just remove it to fix the problem.
>
> Fixes: 9ba1377daa ("RDMA/ocrdma: Move PD resource management to driver.")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/infiniband/hw/ocrdma/ocrdma_verbs.c | 1 -
> 1 file changed, 1 deletion(-)
>
> diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
> index 9dcb660..219f212 100644
> --- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
> +++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
> @@ -679,7 +679,6 @@ err:
> ocrdma_release_ucontext_pd(uctx);
> } else {
> status = _ocrdma_dealloc_pd(dev, pd);
> - kfree(pd);
> }
> exit:
> return ERR_PTR(status);
Thanks, applied.
--
Doug Ledford <dledford@redhat.com>
GPG KeyID: 0E572FDD
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-06-11 5:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-05 14:47 [PATCH] RDMA/ocrdma: fix double free on pd Colin King
2015-06-08 5:52 ` Devesh Sharma
2015-06-11 5:15 ` Doug Ledford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox