fix for ipt_TCPMSS
Hi!
While looking at the source code of the TCPMSS target I noticed a simple error: the target makes an expanded copy of the skb if needed. However, this copy is no longer owned by the original "struct sock". The attached patch fixes this.
If the skb is copied without this fix the kernel will oops short time after, when some code tries to access the attached "struct sock", which is NULL.
The code of TCPMSS isn't perfect anyway since the skb is copied twice under certain circumstances. This is not needed.
Nobody ever triggered this error, as it seems. Nonetheless, it is an error.
(At least I think so. I am new to kernel hacking, so it might be I missed something. However, I tried my very best.)
The patch is against the netfilter sources of 2.4.19.
lp
Signature · 3 lines
name { Lennart Poettering } mail { [email protected] }
icq { 11060553 } www { http://www.poettering.de/lennart/ }
loc { hamburg, germany } pgp { 0x1A015CC4 } hack { .phi. }ipt_TCPMSS.c renamed from ipt_TCPMSS.c.dist +3 -0
@@ -143,6 +143,9 @@return NF_DROP ; } +if ((*pskb)->sk) +skb_set_owner (newskb, (*pskb)->sk); +kfree_skb (*pskb); *pskb = newskb; iph = (*pskb)->nh.iph;
Quoted 11 lines · Lennart Poettering
Hi!
While looking at the source code of the TCPMSS target I noticed a simple error: the target makes an expanded copy of the skb if needed. However, this copy is no longer owned by the original "struct sock". The attached patch fixes this.
If the skb is copied without this fix the kernel will oops short time after, when some code tries to access the attached "struct sock", which is NULL.
Quoted 5 lines
The code of TCPMSS isn't perfect anyway since the skb is copied twice under certain circumstances. This is not needed.
Nobody ever triggered this error, as it seems. Nonetheless, it is an error.
your patch seems fine to me. I have asked Marc Boucher (as the original author) to confirm this bug.
Quoted 1 line
lp
Signature · 5 lines
Live long and prosper - Harald Welte / [email protected] http://www.gnumonks.org/ ============================================================================ "If this were a dictatorship, it'd be a heck of a lot easier, just so long as I'm the dictator." -- George W. Bush Dec 18, 2000