mirror of
git://git.yoctoproject.org/linux-yocto.git
synced 2025-07-05 13:25:20 +02:00
macsec: avoid use-after-free in macsec_handle_frame()
De-referencing skb after call to gro_cells_receive() is not allowed.
We need to fetch skb->len earlier.
Fixes: 5491e7c6b1
("macsec: enable GRO and RPS on macsec devices")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Paolo Abeni <pabeni@redhat.com>
Acked-by: Paolo Abeni <pabeni@redhat.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
47dda78671
commit
c7cc9200e9
|
@ -1077,6 +1077,7 @@ static rx_handler_result_t macsec_handle_frame(struct sk_buff **pskb)
|
||||||
struct macsec_rx_sa *rx_sa;
|
struct macsec_rx_sa *rx_sa;
|
||||||
struct macsec_rxh_data *rxd;
|
struct macsec_rxh_data *rxd;
|
||||||
struct macsec_dev *macsec;
|
struct macsec_dev *macsec;
|
||||||
|
unsigned int len;
|
||||||
sci_t sci;
|
sci_t sci;
|
||||||
u32 hdr_pn;
|
u32 hdr_pn;
|
||||||
bool cbit;
|
bool cbit;
|
||||||
|
@ -1232,9 +1233,10 @@ deliver:
|
||||||
macsec_rxsc_put(rx_sc);
|
macsec_rxsc_put(rx_sc);
|
||||||
|
|
||||||
skb_orphan(skb);
|
skb_orphan(skb);
|
||||||
|
len = skb->len;
|
||||||
ret = gro_cells_receive(&macsec->gro_cells, skb);
|
ret = gro_cells_receive(&macsec->gro_cells, skb);
|
||||||
if (ret == NET_RX_SUCCESS)
|
if (ret == NET_RX_SUCCESS)
|
||||||
count_rx(dev, skb->len);
|
count_rx(dev, len);
|
||||||
else
|
else
|
||||||
macsec->secy.netdev->stats.rx_dropped++;
|
macsec->secy.netdev->stats.rx_dropped++;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user