Re: [PATCH v2] net: ipv6: fix skb_over_panic in __ip6_append_data

From: Tadeusz Struk
Date: Thu Mar 10 2022 - 17:42:48 EST


On 3/10/22 14:30, Jakub Kicinski wrote:
+
+ /*
+ * Check if there is still room for payload
+ */
TBH I think the check is self-explanatory. Not worth a banner comment,
for sure.

Ok


+ if (fragheaderlen >= mtu) {
+ err = -EMSGSIZE;
+ kfree_skb(skb);
+ goto error;
+ }
Not sure if Willem prefers this placement, but seems like we can lift
this check out of the loop, as soon as fragheaderlen and mtu are known.


He said to check it before the skb_put() and so I did.
The fragheaderlen is known early, but mtu can be updated inside the loop
by ip6_append_data_mtu() so I'm not sure we can do the check before that.

--
Thanks,
Tadeusz