macsec: fix use-after-free of skb during RX

Fix use-after-free of skb when rx_handler returns RX_HANDLER_PASS.

Signed-off-by: Andreas Steinmetz <ast@domdv.de>
Acked-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Andreas Steinmetz 2019-06-30 22:46:42 +02:00 committed by David S. Miller
parent e835ada070
commit 095c02da80

View File

@ -1099,10 +1099,9 @@ static rx_handler_result_t macsec_handle_frame(struct sk_buff **pskb)
}
skb = skb_unshare(skb, GFP_ATOMIC);
if (!skb) {
*pskb = NULL;
*pskb = skb;
if (!skb)
return RX_HANDLER_CONSUMED;
}
pulled_sci = pskb_may_pull(skb, macsec_extra_len(true));
if (!pulled_sci) {