From: PanBian <bianpan2016@163.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Juergen Gross <jgross@suse.com>,
Stefano Stabellini <sstabellini@kernel.org>,
xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org
Subject: Re: [Xen-devel] [PATCH] pvcalls-front: fixes incorrect error handling
Date: Tue, 27 Nov 2018 08:58:23 +0800 [thread overview]
Message-ID: <20181127005823.GB125510@bp> (raw)
In-Reply-To: <1f765e81-ed89-d110-74b1-cc8029a4555f@oracle.com>
On Mon, Nov 26, 2018 at 03:31:39PM -0500, Boris Ostrovsky wrote:
> On 11/21/18 9:07 PM, Pan Bian wrote:
> > kfree() is incorrectly used to release the pages allocated by
> > __get_free_page() and __get_free_pages(). Use the matching deallocators
> > i.e., free_page() and free_pages(), respectively.
> >
> > Signed-off-by: Pan Bian <bianpan2016@163.com>
> > ---
> > drivers/xen/pvcalls-front.c | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/xen/pvcalls-front.c b/drivers/xen/pvcalls-front.c
> > index 2f11ca7..77224d8 100644
> > --- a/drivers/xen/pvcalls-front.c
> > +++ b/drivers/xen/pvcalls-front.c
> > @@ -385,8 +385,8 @@ static int create_active(struct sock_mapping *map, int *evtchn)
> > out_error:
> > if (*evtchn >= 0)
> > xenbus_free_evtchn(pvcalls_front_dev, *evtchn);
> > - kfree(map->active.data.in);
> > - kfree(map->active.ring);
> > + free_pages((unsigned long)map->active.data.in, PVCALLS_RING_ORDER);
>
> Is map->active.data.in guaranteed to be NULL when entering this routine?
I am not sure yet. Sorry for that. I observed the mismatches between
__get_free_page and kfree, and submitted the patch.
But I think your consideration is reasonable. A better solution is to
directly free bytes, a local variable that holds __get_free_pages return
value. If you agree, I will rewrite the patch.
Thanks,
Pan
>
> -boris
>
> > + free_page((unsigned long)map->active.ring);
> > return ret;
> > }
> >
>
next prev parent reply other threads:[~2018-11-27 0:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-22 2:07 [PATCH] pvcalls-front: fixes incorrect error handling Pan Bian
2018-11-26 20:31 ` [Xen-devel] " Boris Ostrovsky
2018-11-27 0:58 ` PanBian [this message]
2018-11-27 20:37 ` Stefano Stabellini
2018-11-27 20:57 ` Boris Ostrovsky
2018-11-27 21:08 ` Stefano Stabellini
2018-11-27 22:47 ` Boris Ostrovsky
2018-11-27 22:51 ` Stefano Stabellini
2018-11-29 16:54 ` Juergen Gross
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=20181127005823.GB125510@bp \
--to=bianpan2016@163.com \
--cc=boris.ostrovsky@oracle.com \
--cc=jgross@suse.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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;
as well as URLs for NNTP newsgroup(s).