Skip to contentSkip to conversation

staging: fsl-dpaa2/ethsw: fix memory leak of switchdev_work

PATCH New Colin King 1 participant 1 message Jun 8, 2019

Subsystems (2)
lore
Share & tools
lore

Colin King

author
#0 lore raw

PATCH 1/1 staging: fsl-dpaa2/ethsw: fix memory leak of switchdev_work

From: Colin Ian King <[email protected]>

In the default event case switchdev_work is being leaked because nothing is queued for work. Fix this by kfree'ing switchdev_work before returning NOTIFY_DONE.

Addresses-Coverity: ("Resource leak")

Fixes 44baaa43d7cc ("staging: fsl-dpaa2/ethsw: Add Freescale DPAA2 Ethernet Switch driver")
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 1 +
 1 file changed, 1 insertion(+)
drivers/staging/fsl-dpaa2/ethsw/ethsw.c +1 -0
index e3c3e427309a..f73edaf6ce87 100644
@@ -1086,6 +1086,7 @@ static int port_switchdev_event(struct notifier_block *unused,
 		dev_hold(dev);
 		break;
 	default:
+		kfree(switchdev_work);
 		return NOTIFY_DONE;
 	}
 
Signature · 1 line
2.20.1