* [PATCH 1/1] drivers:net: fix return value check in be_lancer_xmit_workarounds
@ 2023-07-17 14:45 Yuanjun Gong
2023-07-17 19:32 ` Kuniyuki Iwashima
0 siblings, 1 reply; 7+ messages in thread
From: Yuanjun Gong @ 2023-07-17 14:45 UTC (permalink / raw)
To: Yuanjun Gong, Ajit Khaparde, Sriharsha Basavapatna, Somnath Kotur,
netdev
in be_lancer_xmit_workarounds, it should go to label 'err' if
an unexpected value is returned by pskb_trim.
Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
---
drivers/net/ethernet/emulex/benet/be_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
index 18c2fc880d09..eba29a2e0e8b 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 err;
}
/* If vlan tag is already inlined in the packet, skip HW VLAN
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH 1/1] drivers:net: fix return value check in be_lancer_xmit_workarounds
2023-07-17 14:45 [PATCH 1/1] drivers:net: fix return value check in be_lancer_xmit_workarounds Yuanjun Gong
@ 2023-07-17 19:32 ` Kuniyuki Iwashima
2023-07-19 20:16 ` Simon Horman
2023-07-25 3:27 ` [PATCH net v2 1/1] benet: fix return value check in be_lancer_xmit_workarounds() Yuanjun Gong
0 siblings, 2 replies; 7+ messages in thread
From: Kuniyuki Iwashima @ 2023-07-17 19:32 UTC (permalink / raw)
To: ruc_gongyuanjun
Cc: ajit.khaparde, netdev, somnath.kotur, sriharsha.basavapatna,
kuniyu
From: Yuanjun Gong <ruc_gongyuanjun@163.com>
Date: Mon, 17 Jul 2023 22:45:32 +0800
> in be_lancer_xmit_workarounds, it should go to label 'err' if
> an unexpected value is returned by pskb_trim.
>
Fixes tag needed here.
> Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com>
> ---
> drivers/net/ethernet/emulex/benet/be_main.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/ethernet/emulex/benet/be_main.c b/drivers/net/ethernet/emulex/benet/be_main.c
> index 18c2fc880d09..eba29a2e0e8b 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 err;
This should be `goto tx_drop`, or we'll leak skb.
> }
>
> /* If vlan tag is already inlined in the packet, skip HW VLAN
> --
> 2.17.1
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH 1/1] drivers:net: fix return value check in be_lancer_xmit_workarounds
2023-07-17 19:32 ` Kuniyuki Iwashima
@ 2023-07-19 20:16 ` Simon Horman
2023-07-25 3:27 ` [PATCH net v2 1/1] benet: fix return value check in be_lancer_xmit_workarounds() Yuanjun Gong
1 sibling, 0 replies; 7+ messages in thread
From: Simon Horman @ 2023-07-19 20:16 UTC (permalink / raw)
To: Kuniyuki Iwashima
Cc: ruc_gongyuanjun, ajit.khaparde, netdev, somnath.kotur,
sriharsha.basavapatna
On Mon, Jul 17, 2023 at 12:32:59PM -0700, Kuniyuki Iwashima wrote:
> From: Yuanjun Gong <ruc_gongyuanjun@163.com>
> Date: Mon, 17 Jul 2023 22:45:32 +0800
> > in be_lancer_xmit_workarounds, it should go to label 'err' if
> > an unexpected value is returned by pskb_trim.
> >
>
> Fixes tag needed here.
Further to that, assuming this is a fix, then the patch should also be
targeted at the net tree, as opposed to the net-next tree.
Subject: [PATCH net v2] ...
And the prefix should probably be 'be2net:'
Subject: [PATCH net v2] be2net: ...
...
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net v2 1/1] benet: fix return value check in be_lancer_xmit_workarounds()
2023-07-17 19:32 ` Kuniyuki Iwashima
2023-07-19 20:16 ` Simon Horman
@ 2023-07-25 3:27 ` Yuanjun Gong
2023-07-25 18:00 ` Alexander H Duyck
2023-07-27 8:50 ` patchwork-bot+netdevbpf
1 sibling, 2 replies; 7+ messages in thread
From: Yuanjun Gong @ 2023-07-25 3:27 UTC (permalink / raw)
To: kuniyu
Cc: ajit.khaparde, netdev, ruc_gongyuanjun, somnath.kotur,
sriharsha.basavapatna
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>
---
drivers/net/ethernet/emulex/benet/be_main.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
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
--
2.17.1
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH net v2 1/1] benet: fix return value check in be_lancer_xmit_workarounds()
2023-07-25 3:27 ` [PATCH net v2 1/1] benet: fix return value check in be_lancer_xmit_workarounds() Yuanjun Gong
@ 2023-07-25 18:00 ` Alexander H Duyck
2023-07-27 8:31 ` Paolo Abeni
2023-07-27 8:50 ` patchwork-bot+netdevbpf
1 sibling, 1 reply; 7+ messages in thread
From: Alexander H Duyck @ 2023-07-25 18:00 UTC (permalink / raw)
To: Yuanjun Gong, kuniyu
Cc: ajit.khaparde, netdev, somnath.kotur, sriharsha.basavapatna
On Tue, 2023-07-25 at 11:27 +0800, Yuanjun Gong wrote:
> 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>
> ---
> drivers/net/ethernet/emulex/benet/be_main.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> 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
I'm not sure dropping the packet is the right solution here. Based on
the description of the issue that this is a workaround for it might
make more sense to simply put out a WARN based on the failure since it
means that the tot_len field in the IP header will be modified
incorrectly and a bad IPv4 checksum will be inserted.
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH net v2 1/1] benet: fix return value check in be_lancer_xmit_workarounds()
2023-07-25 18:00 ` Alexander H Duyck
@ 2023-07-27 8:31 ` Paolo Abeni
0 siblings, 0 replies; 7+ messages in thread
From: Paolo Abeni @ 2023-07-27 8:31 UTC (permalink / raw)
To: Alexander H Duyck, Yuanjun Gong, kuniyu
Cc: ajit.khaparde, netdev, somnath.kotur, sriharsha.basavapatna
On Tue, 2023-07-25 at 11:00 -0700, Alexander H Duyck wrote:
> On Tue, 2023-07-25 at 11:27 +0800, Yuanjun Gong wrote:
> > 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>
> > ---
> > drivers/net/ethernet/emulex/benet/be_main.c | 3 ++-
> > 1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > 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
>
> I'm not sure dropping the packet is the right solution here. Based on
> the description of the issue that this is a workaround for it might
> make more sense to simply put out a WARN based on the failure since it
> means that the tot_len field in the IP header will be modified
> incorrectly and a bad IPv4 checksum will be inserted.
... which in turn means the packet will be dropped later, right?
Then I guess it's better to drop it now, it requires a similar amount
of code and will reduce resources usage all around.
Cheers,
Paolo
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH net v2 1/1] benet: fix return value check in be_lancer_xmit_workarounds()
2023-07-25 3:27 ` [PATCH net v2 1/1] benet: fix return value check in be_lancer_xmit_workarounds() Yuanjun Gong
2023-07-25 18:00 ` Alexander H Duyck
@ 2023-07-27 8:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 7+ messages in thread
From: patchwork-bot+netdevbpf @ 2023-07-27 8:50 UTC (permalink / raw)
To: Yuanjun Gong
Cc: kuniyu, ajit.khaparde, netdev, somnath.kotur,
sriharsha.basavapatna
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Tue, 25 Jul 2023 11:27:26 +0800 you wrote:
> 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>
> ---
> drivers/net/ethernet/emulex/benet/be_main.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
Here is the summary with links:
- [net,v2,1/1] benet: fix return value check in be_lancer_xmit_workarounds()
https://git.kernel.org/netdev/net/c/5c85f7065718
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-07-27 8:50 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-17 14:45 [PATCH 1/1] drivers:net: fix return value check in be_lancer_xmit_workarounds Yuanjun Gong
2023-07-17 19:32 ` Kuniyuki Iwashima
2023-07-19 20:16 ` Simon Horman
2023-07-25 3:27 ` [PATCH net v2 1/1] benet: fix return value check in be_lancer_xmit_workarounds() Yuanjun Gong
2023-07-25 18:00 ` Alexander H Duyck
2023-07-27 8:31 ` Paolo Abeni
2023-07-27 8:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).