Skip to contentSkip to conversation

Fix the cleanup on alloc_mpc failure in atm_mpoa_mpoad_attach

PATCH New Deepak Sharma 1 participant 1 message Sep 23, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix the cleanup on alloc_mpc failure in atm_mpoa_mpoad_attach

Syzbot reported a warning at add_timer, which is called from the atm_mpoa_mpoad_attach function

The reason for this warning is that in the allocation failure by alloc_mpc, there is lack of proper cleanup. And in the event that ATMMPC_CTRL ioctl is called on to again, it will lead to the attempt of starting an already started timer from the previous ioctl call

Do a timer_delete before returning from the alloc_mpc failure

---
 net/atm/mpc.c | 3 +++
 1 file changed, 3 insertions(+)
net/atm/mpc.c +3 -0
index f6b447bba329..cd3295c3c480 100644
@@ -814,7 +814,10 @@ static int atm_mpoa_mpoad_attach(struct atm_vcc *vcc, int arg)
 		dprintk("allocating new mpc for itf %d\n", arg);
 		mpc = alloc_mpc();
 		if (mpc == NULL)
+		{
+			timer_delete(&mpc_timer);
 			return -ENOMEM;
+		}
 		mpc->dev_num = arg;
 		mpc->dev = find_lec_by_itfnum(arg);
 					/* NULL if there was no lec */
Signature · 1 line
2.51.0