Skip to contentSkip to conversation

atm: br2684: restore VCC push/pop handlers on close

PATCH In review Zhenghang Xiao 2 participants 2 messages May 26 – Jun 1

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

PATCH 1/1 atm: br2684: restore VCC push/pop handlers on close

br2684_close_vcc() frees the br2684_vcc and NULLs atmvcc->user_back but leaves atmvcc->push and atmvcc->pop pointing to br2684_push/br2684_pop. If the ATM driver completes a TX after the close (delayed pop callback), br2684_pop() dereferences the NULL user_back at offset 0x18, causing a kernel panic.

Restore push and pop on the atmvcc before clearing user_back, matching the pattern in pppoatm_unassign_vcc().

Fixes 137742cf9738 ("atm/br2684: netif_stop_queue() when atm device busy and netif_wake_queue() when we can send packets again.")
---
 net/atm/br2684.c | 2 ++
 1 file changed, 2 insertions(+)
net/atm/br2684.c +2 -0
index 6580d67c3456..dbdc31ce5c53 100644
@@ -412,6 +412,8 @@ static void br2684_close_vcc(struct br2684_vcc *brvcc)
 	write_lock_irq(&devs_lock);
 	list_del(&brvcc->brvccs);
 	write_unlock_irq(&devs_lock);
+	brvcc->atmvcc->push = brvcc->old_push;
+	brvcc->atmvcc->pop = brvcc->old_pop;
 	brvcc->atmvcc->user_back = NULL;	/* what about vcc->recvq ??? */
 	brvcc->atmvcc->release_cb = brvcc->old_release_cb;
 	brvcc->old_push(brvcc->atmvcc, NULL);	/* pass on the bad news */
Signature · 1 line
2.50.1 (Apple Git-155)
maintainer
#1 lore raw
Quoted 5 lines · Zhenghang Xiao

br2684_close_vcc() frees the br2684_vcc and NULLs atmvcc->user_back but leaves atmvcc->push and atmvcc->pop pointing to br2684_push/br2684_pop. If the ATM driver completes a TX after the close (delayed pop callback), br2684_pop() dereferences the NULL user_back at offset 0x18, causing a kernel panic.

Lacking synchronization between the close and the tx patch, this does not fix the issue, just makes the race shorter.

/P