From: Doug Ledford <dledford@redhat.com>
To: Colin King <colin.king@canonical.com>
Cc: Selvin Xavier <selvin.xavier@emulex.com>,
Devesh Sharma <devesh.sharma@emulex.com>,
Mitesh Ahuja <mitesh.ahuja@emulex.com>,
Sean Hefty <sean.hefty@intel.com>,
Hal Rosenstock <hal.rosenstock@gmail.com>,
linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] RDMA/ocrdma: fix double free on pd
Date: Thu, 11 Jun 2015 01:15:30 -0400 [thread overview]
Message-ID: <1433999730.71666.149.camel@redhat.com> (raw)
In-Reply-To: <1433515647-28059-1-git-send-email-colin.king@canonical.com>
[-- 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 --]
prev parent reply other threads:[~2015-06-11 5:15 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
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 message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1433999730.71666.149.camel@redhat.com \
--to=dledford@redhat.com \
--cc=colin.king@canonical.com \
--cc=devesh.sharma@emulex.com \
--cc=hal.rosenstock@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=mitesh.ahuja@emulex.com \
--cc=sean.hefty@intel.com \
--cc=selvin.xavier@emulex.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox