lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <868194.36957.qm@web94906.mail.in2.yahoo.com>
Date:	Tue, 4 May 2010 21:22:20 +0530 (IST)
From:	Pavan Savoy <pavan_savoy@...oo.co.in>
To:	Greg KH <greg@...ah.com>
Cc:	Tomas Winkler <tomas.winkler@...el.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] firmware_class: fix memory leak - free allocated pages



--- On Tue, 4/5/10, Greg KH <greg@...ah.com> wrote:

> From: Greg KH <greg@...ah.com>
> Subject: Re: [PATCH v3] firmware_class: fix memory leak - free allocated pages
> To: "Pavan Savoy" <pavan_savoy@...oo.co.in>
> Cc: "Tomas Winkler" <tomas.winkler@...el.com>, linux-kernel@...r.kernel.org
> Date: Tuesday, 4 May, 2010, 9:17 PM
> On Tue, May 04, 2010 at 08:07:33PM
> +0530, Pavan Savoy wrote:
> > 
> > --- On Tue, 4/5/10, Greg KH <greg@...ah.com>
> wrote:
> > 
> > > From: Greg KH <greg@...ah.com>
> > > Subject: Re: [PATCH v3] firmware_class: fix
> memory leak - free allocated pages
> > > To: "Pavan Savoy" <pavan_savoy@...oo.co.in>
> > > Cc: "Tomas Winkler" <tomas.winkler@...el.com>,
> linux-kernel@...r.kernel.org
> > > Date: Tuesday, 4 May, 2010, 7:33 PM
> > > On Tue, May 04, 2010 at 12:16:44AM
> > > +0530, Pavan Savoy wrote:
> > > > 
> > > > 
> > > > --- On Mon, 3/5/10, Greg KH <greg@...ah.com>
> > > wrote:
> > > > 
> > > > > From: Greg KH <greg@...ah.com>
> > > > > Subject: Re: [PATCH v3] firmware_class:
> fix
> > > memory leak - free allocated pages
> > > > > To: "Tomas Winkler" <tomas.winkler@...el.com>
> > > > > Cc: "Greg Kroah-Hartman" <gregkh@...e.de>,
> > > linux-kernel@...r.kernel.org,
> > > "David Woodhouse" <dwmw2@...radead.org>,
> > > "Kay Sievers" <kay.sievers@...y.org>,
> > > "David Woodhouse" <David.Woodhouse@...el.com>,
> > > "Johannes Berg" <johannes@...solutions.net>,
> > > "Ming Lei" <tom.leiming@...il.com>,
> > > "Catalin Marinas" <catalin.marinas@....com>
> > > > > Date: Monday, 3 May, 2010, 10:34 PM
> > > > > On Sun, May 02, 2010 at 11:21:21AM
> > > > > +0300, Tomas Winkler wrote:
> > > > > > From: David Woodhouse <David.Woodhouse@...el.com>
> > > > > > 
> > > > > > fix memory leak introduced by the
> patch
> > > 6e03a201bbe:
> > > > > > firmware: speed up
> request_firmware()
> > > > > > 
> > > > > > 1. vfree won't release pages there
> were
> > > allocated
> > > > > explicitly and mapped
> > > > > > using vmap. The memory has to be
> vunmap-ed
> > > and the
> > > > > pages needs
> > > > > > to be freed explicitly
> > > > > > 
> > > > > > 2. page array is moved into the
> 'struct
> > > > > > firmware' so that we can free it
> from
> > > > > release_firmware()
> > > > > > and not only in fw_dev_release()
> > > > > > 
> > > > > > The fix doesn't break the firmware
> load
> > > speed.
> > > > > > 
> > > > > > Cc: Johannes Berg <johannes@...solutions.net>
> > > > > > Cc: Greg Kroah-Hartman <gregkh@...e.de>
> > > > > > Cc: Ming Lei <tom.leiming@...il.com>
> > > > > > Cc: Catalin Marinas <catalin.marinas@....com>
> > > > > > Singed-off-by: Kay Sievers <kay.sievers@...y.org>
> > > > > > Signed-off-by: David Woodhouse
> <David.Woodhouse@...el.com>
> > > > > > Signed-off-by: Tomas Winkler
> <tomas.winkler@...el.com>
> > > > > > ---
> > > > > > V2: fix authorship of the patch
> > > > > > V3: fix const struct firmware
> breakage
> > > > > 
> > > > > Thanks, this looks much better, I've
> applied it
> > > now.
> > > > 
> > > > Sorry to bump-in the middle.
> > > > But as a user of firmware class, what should
> now my
> > > fw_entry structure be?
> > > > const struct firmware *fw_entry or,
> > > > struct firmware *fw_entry - without the
> const ..
> > > 
> > > You should leave it to be whatever it was before
> this
> > > patch, it has not
> > > changed anything now.
> > 
> > Ok, However this patch has changed the
> release_firmware,
> > -release_firmware(const struct firmware *fw)
> > +release_firmware(struct firmware *fw)
> 
> Does your code now complain about a warning?  If so,
> do you have a
> pointer to it?

Yes, code now has warnings, I have something like,
        const struct firmware *fw_entry; declared in my header file,
and use it as,
            request_firmware(&kim_gdata->fw_entry, bts_scr_name,
                             &kim_gdata->kim_pdev->dev);
and then I get warnings at,
        release_firmware(kim_gdata->fw_entry);

You want me to have a pointer to &kw_gdata->fw_entry which is const ?
as in 
const struct firmware **fw_const_ptr;
fw_const_ptr = &kim_gdata->fw_entry; ?


> thanks,
> 
> greg k-h
> --
> To unsubscribe from this list: send the line "unsubscribe
> linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ