net: dsa: avoid potential use-after-free error
If dsa_switch_ops::port_txtstamp() returns false, clone will be freed immediately. Shouldn't store a pointer to freed memory. Signed-off-by: Christian Eggers <ceggers@arri.de> Reviewed-by: Vladimir Oltean <olteanv@gmail.com> Tested-by: Vladimir Oltean <olteanv@gmail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Link: https://lore.kernel.org/r/20201119110906.25558-1-ceggers@arri.de Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
Родитель
2ed03e5a84
Коммит
30abc9cd9c
|
@ -522,10 +522,10 @@ static void dsa_skb_tx_timestamp(struct dsa_slave_priv *p,
|
|||
if (!clone)
|
||||
return;
|
||||
|
||||
if (ds->ops->port_txtstamp(ds, p->dp->index, clone, type)) {
|
||||
DSA_SKB_CB(skb)->clone = clone;
|
||||
|
||||
if (ds->ops->port_txtstamp(ds, p->dp->index, clone, type))
|
||||
return;
|
||||
}
|
||||
|
||||
kfree_skb(clone);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче