Merge branch 'netem-fix-further-issues-with-packet-corruption'
Jakub Kicinski says: ==================== net: netem: fix further issues with packet corruption This set is fixing two more issues with the netem packet corruption. First patch (which was previously posted) avoids NULL pointer dereference if the first frame gets freed due to allocation or checksum failure. v2 improves the clarity of the code a little as requested by Cong. Second patch ensures we don't return SUCCESS if the frame was in fact dropped. Thanks to this commit message for patch 1 no longer needs the "this will still break with a single-frame failure" disclaimer. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
commit
708738376c
|
@ -509,6 +509,7 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
|||
if (skb->ip_summed == CHECKSUM_PARTIAL &&
|
||||
skb_checksum_help(skb)) {
|
||||
qdisc_drop(skb, sch, to_free);
|
||||
skb = NULL;
|
||||
goto finish_segs;
|
||||
}
|
||||
|
||||
|
@ -593,9 +594,10 @@ static int netem_enqueue(struct sk_buff *skb, struct Qdisc *sch,
|
|||
finish_segs:
|
||||
if (segs) {
|
||||
unsigned int len, last_len;
|
||||
int nb = 0;
|
||||
int nb;
|
||||
|
||||
len = skb->len;
|
||||
len = skb ? skb->len : 0;
|
||||
nb = skb ? 1 : 0;
|
||||
|
||||
while (segs) {
|
||||
skb2 = segs->next;
|
||||
|
@ -612,7 +614,10 @@ finish_segs:
|
|||
}
|
||||
segs = skb2;
|
||||
}
|
||||
qdisc_tree_reduce_backlog(sch, -nb, prev_len - len);
|
||||
/* Parent qdiscs accounted for 1 skb of size @prev_len */
|
||||
qdisc_tree_reduce_backlog(sch, -(nb - 1), -(len - prev_len));
|
||||
} else if (!skb) {
|
||||
return NET_XMIT_DROP;
|
||||
}
|
||||
return NET_XMIT_SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue