net: ipv6: mld: Fix improper reference drop

In case of successful submission, the reference shouldn't be put down,
this only should done on error cases.

As reference is put down on success, during the buffer unref, no action
is taken due to an uint8 overflow (ref is now 255), so, the buf->frags
isn't cleared properly and the next time the frags is used and when L2
inserts a second frag, the first head frag and next frag are same (due
to buffer re-use) causing an infinite loop in either net_buf_frag_last
or net_pkt_get_len.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
This commit is contained in:
Chaitanya Tata 2024-04-30 01:41:21 +05:30 committed by Carles Cufí
parent e40c8757f3
commit 09048e0a16

View file

@ -299,9 +299,11 @@ static int send_mld_report(struct net_if *iface)
ret = mld_send(pkt);
if (ret < 0) {
return ret;
goto drop;
}
return 0;
drop:
net_pkt_unref(pkt);