Commit e03dd6bd authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix drivers/net/ewrk.c memory leak

From: Hollis Blanchard <hollis@austin.ibm.com>

Hi, this was caught by the Stanford memory leak checker a while ago
(2.5.48). If the tmp_stats allocation fails, tmp is not being freed.
parent fb8ce055
......@@ -1968,7 +1968,10 @@ static int ewrk3_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
case EWRK3_GET_STATS: { /* Get the driver statistics */
struct ewrk3_stats *tmp_stats =
kmalloc(sizeof(lp->pktStats), GFP_KERNEL);
if (!tmp_stats) return -ENOMEM;
if (!tmp_stats) {
status = -ENOMEM;
break;
}
spin_lock_irqsave(&lp->hw_lock, flags);
memcpy(tmp_stats, &lp->pktStats, sizeof(lp->pktStats));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment