Skip to content

Commit

Permalink
drop_monitor: Better sanitize notified packets
Browse files Browse the repository at this point in the history
When working in 'packet' mode, drop monitor generates a notification
with a potentially truncated payload of the dropped packet. The payload
is copied from the MAC header, but I forgot to check that the MAC header
was set, so do it now.

Fixes: ca30707 ("drop_monitor: Add packet alert mode")
Fixes: 5e58109 ("drop_monitor: Add support for packet alert mode for hardware drops")
Acked-by: Jiri Pirko <[email protected]>
Signed-off-by: Ido Schimmel <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
idosch authored and davem330 committed Sep 16, 2019
1 parent 58a406d commit bef1746
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/core/drop_monitor.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,9 @@ static void net_dm_packet_trace_kfree_skb_hit(void *ignore,
struct sk_buff *nskb;
unsigned long flags;

if (!skb_mac_header_was_set(skb))
return;

nskb = skb_clone(skb, GFP_ATOMIC);
if (!nskb)
return;
Expand Down Expand Up @@ -900,6 +903,9 @@ net_dm_hw_packet_probe(struct sk_buff *skb,
struct sk_buff *nskb;
unsigned long flags;

if (!skb_mac_header_was_set(skb))
return;

nskb = skb_clone(skb, GFP_ATOMIC);
if (!nskb)
return;
Expand Down

0 comments on commit bef1746

Please sign in to comment.