summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Steinmetz <ast@domdv.de>2019-06-30 22:46:42 +0200
committerDavid S. Miller <davem@davemloft.net>2019-07-02 14:12:29 -0700
commit095c02da80a41cf6d311c504d8955d6d1c2add10 (patch)
tree1b6afb475f0c060e5c0390025d8cd1e19ef1f0ff
parente835ada07091f40dcfb1bc735082bd0a7c005e59 (diff)
downloadlinux-095c02da80a41cf6d311c504d8955d6d1c2add10.tar.bz2
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>
-rw-r--r--drivers/net/macsec.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c
index 75aebf65cd09..8ec73d677123 100644
--- a/drivers/net/macsec.c
+++ b/drivers/net/macsec.c
@@ -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) {