Re: [PATCH v3] firmware_class: fix memory leak - free allocated pages

From: Pavan Savoy
Date: Mon May 03 2010 - 14:46:52 EST




--- On Mon, 3/5/10, Greg KH <greg@xxxxxxxxx> wrote:

> From: Greg KH <greg@xxxxxxxxx>
> Subject: Re: [PATCH v3] firmware_class: fix memory leak - free allocated pages
> To: "Tomas Winkler" <tomas.winkler@xxxxxxxxx>
> Cc: "Greg Kroah-Hartman" <gregkh@xxxxxxx>, linux-kernel@xxxxxxxxxxxxxxx, "David Woodhouse" <dwmw2@xxxxxxxxxxxxx>, "Kay Sievers" <kay.sievers@xxxxxxxx>, "David Woodhouse" <David.Woodhouse@xxxxxxxxx>, "Johannes Berg" <johannes@xxxxxxxxxxxxxxxx>, "Ming Lei" <tom.leiming@xxxxxxxxx>, "Catalin Marinas" <catalin.marinas@xxxxxxx>
> 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@xxxxxxxxx>
> >
> > 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@xxxxxxxxxxxxxxxx>
> > Cc: Greg Kroah-Hartman <gregkh@xxxxxxx>
> > Cc: Ming Lei <tom.leiming@xxxxxxxxx>
> > Cc: Catalin Marinas <catalin.marinas@xxxxxxx>
> > Singed-off-by: Kay Sievers <kay.sievers@xxxxxxxx>
> > Signed-off-by: David Woodhouse <David.Woodhouse@xxxxxxxxx>
> > Signed-off-by: Tomas Winkler <tomas.winkler@xxxxxxxxx>
> > ---
> > 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 ..


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