Skip to contentSkip to conversation

parport_cs: Fix memory leak in parport_config

PATCH In review Yue Haibing 2 participants 2 messages Mar 21, 2019 – Mar 27, 2019 1 message not in the archive Parallel port

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 parport_cs: Fix memory leak in parport_config

From: YueHaibing <[email protected]>

parport_probe() alloc parport device 'info', but while parport_config failed it does not free it.

---
 drivers/parport/parport_cs.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/parport/parport_cs.c +3 -2
index e9b52e4..e77044c2 100644
@@ -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)
Signature · 1 line
2.7.0

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 29 lines · Mukesh Ojha
Quoted 15 lines · Yue Haibing

From: YueHaibing <[email protected]>

parport_probe() alloc parport device 'info', but while parport_config failed it does not free it.

---
  drivers/parport/parport_cs.c | 5 +++--
  1 file changed, 3 insertions(+), 2 deletions(-)
drivers/parport/parport_cs.c +0 -0
index e9b52e4..e77044c2 100644

drivers/parport/parport_cs.c static int parport_config(struct pcmcia_device *link) · line 164

Quoted 9 lines
drivers/parport/parport_cs.c +3 -2
@@ -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)
Quoted 1 line

<mailto:[email protected]>>

Please do not send html email for kernel patches :(