Re: [PATCH] parport_cs: Fix memory leak in parport_config

From: Greg KH
Date: Wed Mar 27 2019 - 14:28:30 EST


On Fri, Mar 22, 2019 at 05:39:17PM +0530, Mukesh Ojha wrote:
>
> On 3/21/2019 1:56 PM, Yue Haibing wrote:
> > From: YueHaibing <yuehaibing@xxxxxxxxxx>
> >
> > parport_probe() alloc parport device 'info',
> > but while parport_config failed it does not free it.
> >
> > Signed-off-by: YueHaibing <yuehaibing@xxxxxxxxxx>
> > ---
> > drivers/parport/parport_cs.c | 5 +++--
> > 1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/parport/parport_cs.c b/drivers/parport/parport_cs.c
> > index e9b52e4..e77044c2 100644
> > --- a/drivers/parport/parport_cs.c
> > +++ b/drivers/parport/parport_cs.c
> > @@ -158,8 +158,9 @@ static int parport_config(struct pcmcia_device *link)
> > return 0;
> > failed:
> > - parport_cs_release(link);
> > - return -ENODEV;
> > + parport_cs_release(link);
> > + kfree(link->priv);
> > + return -ENODEV;
> > } /* parport_config */
> > static void parport_cs_release(struct pcmcia_device *link)
>
>
> Reviewed-by: Mukesh Ojha <mojha@xxxxxxxxxxxxxx
> <mailto:mojha@xxxxxxxxxxxxxx>>

Please do not send html email for kernel patches :(