提交 30abc9cd 编写于 作者: C Christian Eggers 提交者: Jakub Kicinski

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: NChristian Eggers <ceggers@arri.de>
Reviewed-by: NVladimir Oltean <olteanv@gmail.com>
Tested-by: NVladimir Oltean <olteanv@gmail.com>
Reviewed-by: NFlorian Fainelli <f.fainelli@gmail.com>
Link: https://lore.kernel.org/r/20201119110906.25558-1-ceggers@arri.deSigned-off-by: NJakub Kicinski <kuba@kernel.org>
上级 2ed03e5a
......@@ -522,10 +522,10 @@ static void dsa_skb_tx_timestamp(struct dsa_slave_priv *p,
if (!clone)
return;
DSA_SKB_CB(skb)->clone = clone;
if (ds->ops->port_txtstamp(ds, p->dp->index, clone, type))
if (ds->ops->port_txtstamp(ds, p->dp->index, clone, type)) {
DSA_SKB_CB(skb)->clone = clone;
return;
}
kfree_skb(clone);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册