linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Cox <gnomes@lxorguk.ukuu.org.uk>
To: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Alan <alan@linux.intel.com>,
	vincent.hervieux@gmail.com, linux-media@vger.kernel.org
Subject: Re: [PATCH 2/3] atomisp: fix vfree of bogus data on unload
Date: Tue, 14 Nov 2017 00:16:01 +0000	[thread overview]
Message-ID: <20171114001601.4d51d230@alans-desktop> (raw)
In-Reply-To: <20171113220548.ji4z4e5neehxg4wn@kekkonen.localdomain>

On Tue, 14 Nov 2017 00:05:48 +0200
Sakari Ailus <sakari.ailus@linux.intel.com> wrote:

> Hi Alan,
> 
> On Mon, Nov 06, 2017 at 11:36:45PM +0000, Alan wrote:
> > We load the firmware once, set pointers to it and then at some point release
> > it. We should not be doing a vfree() on the pointers into the firmware.
> > 
> > Signed-off-by: Alan Cox <alan@linux.intel.com>
> > ---
> >  .../atomisp/pci/atomisp2/css2400/sh_css_firmware.c |    2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c
> > index 8158ea40d069..f181bd8fcee2 100644
> > --- a/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c
> > +++ b/drivers/staging/media/atomisp/pci/atomisp2/css2400/sh_css_firmware.c
> > @@ -288,8 +288,6 @@ void sh_css_unload_firmware(void)
> >  		for (i = 0; i < sh_css_num_binaries; i++) {
> >  			if (fw_minibuffer[i].name)
> >  				kfree((void *)fw_minibuffer[i].name);
> > -			if (fw_minibuffer[i].buffer)
> > -				vfree((void *)fw_minibuffer[i].buffer);  
> 
> You shouldn't end up here if the firmware is just loaded once. If multiple
> times, then yes.

You end up there when unloading the module.

> The memory appears to have been allocated using kmalloc() in some cases.
> How about kvfree(), or changing that kmalloc() to vmalloc()

I'll take a deeper look at what is going on.

Alan

  reply	other threads:[~2017-11-14  0:16 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-06 23:36 [PATCH 1/3] atomisp: Fix up the open v load race Alan
2017-11-06 23:36 ` [PATCH 2/3] atomisp: fix vfree of bogus data on unload Alan
2017-11-13 22:05   ` Sakari Ailus
2017-11-14  0:16     ` Alan Cox [this message]
2017-11-14 14:10       ` Sakari Ailus
2017-11-06 23:37 ` [PATCH 3/3] atomisp: hmm gives a bogus warning " Alan
2017-12-12 11:03 ` [PATCH 1/3] atomisp: Fix up the open v load race Mauro Carvalho Chehab
2017-12-12 15:55   ` Alan Cox

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=20171114001601.4d51d230@alans-desktop \
    --to=gnomes@lxorguk.ukuu.org.uk \
    --cc=alan@linux.intel.com \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    --cc=vincent.hervieux@gmail.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;
as well as URLs for NNTP newsgroup(s).