diff options
author | Yuanjun Gong <ruc_gongyuanjun@163.com> | 2023-07-25 11:27:26 +0800 |
---|---|---|
committer | Paolo Abeni <pabeni@redhat.com> | 2023-07-27 10:31:38 +0200 |
commit | 5c85f7065718a949902b238a6abd8fc907c5d3e0 (patch) | |
tree | 8d6ed8045231d1e56ba52b2e6b9d5868d6b8e1c2 | |
parent | ff0df20827f6ac32822f9855998c4db3e99af47c (diff) | |
download | linux-stable-5c85f7065718a949902b238a6abd8fc907c5d3e0.tar.gz linux-stable-5c85f7065718a949902b238a6abd8fc907c5d3e0.tar.bz2 linux-stable-5c85f7065718a949902b238a6abd8fc907c5d3e0.zip |
benet: fix return value check in be_lancer_xmit_workarounds()
in be_lancer_xmit_workarounds(), it should go to label 'tx_drop'
if an unexpected value is returned by pskb_trim().
Fixes: 93040ae5cc8d ("be2net: Fix to trim skb for padded vlan packets to workaround an ASIC Bug")
Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
Link: https://lore.kernel.org/r/20230725032726.15002-1-ruc_gongyuanjun@163.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
-rw-r--r-- | drivers/net/ethernet/emulex/benet/be_main.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c index 18c2fc880d09..0616b5fe241c 100644 --- a/drivers/net/ethernet/emulex/benet/be_main.c +++ b/drivers/net/ethernet/emulex/benet/be_main.c @@ -1138,7 +1138,8 @@ static struct sk_buff *be_lancer_xmit_workarounds(struct be_adapter *adapter, (lancer_chip(adapter) || BE3_chip(adapter) || skb_vlan_tag_present(skb)) && is_ipv4_pkt(skb)) { ip = (struct iphdr *)ip_hdr(skb); - pskb_trim(skb, eth_hdr_len + ntohs(ip->tot_len)); + if (unlikely(pskb_trim(skb, eth_hdr_len + ntohs(ip->tot_len)))) + goto tx_drop; } /* If vlan tag is already inlined in the packet, skip HW VLAN |