Message ID | 20230717144621.22870-1-ruc_gongyuanjun@163.com (mailing list archive) |
---|---|
State | Accepted |
Commit | 78a93c31003cc53aca5d67b1bbe2d5b9fc37cc4d |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | [1/1] drivers: net: fix return value check in emac_tso_csum() | expand |
From: Yuanjun Gong <ruc_gongyuanjun@163.com> Date: Mon, 17 Jul 2023 22:46:21 +0800 > in emac_tso_csum(), return an error code if an unexpected value > is returned by pskb_trim(). > > Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com> Fixes: b9b17debc69d ("net: emac: emac gigabit ethernet controller driver") Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com> > --- > drivers/net/ethernet/qualcomm/emac/emac-mac.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c > index 0d80447d4d3b..d5c688a8d7be 100644 > --- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c > +++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c > @@ -1260,8 +1260,11 @@ static int emac_tso_csum(struct emac_adapter *adpt, > if (skb->protocol == htons(ETH_P_IP)) { > u32 pkt_len = ((unsigned char *)ip_hdr(skb) - skb->data) > + ntohs(ip_hdr(skb)->tot_len); > - if (skb->len > pkt_len) > - pskb_trim(skb, pkt_len); > + if (skb->len > pkt_len) { > + ret = pskb_trim(skb, pkt_len); > + if (unlikely(ret)) > + return ret; > + } > } > > hdr_len = skb_tcp_all_headers(skb); > -- > 2.17.1
Hello: This patch was applied to netdev/net.git (main) by David S. Miller <davem@davemloft.net>: On Mon, 17 Jul 2023 22:46:21 +0800 you wrote: > in emac_tso_csum(), return an error code if an unexpected value > is returned by pskb_trim(). > > Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com> > --- > drivers/net/ethernet/qualcomm/emac/emac-mac.c | 7 +++++-- > 1 file changed, 5 insertions(+), 2 deletions(-) Here is the summary with links: - [1/1] drivers: net: fix return value check in emac_tso_csum() https://git.kernel.org/netdev/net/c/78a93c31003c You are awesome, thank you!
On Mon, Jul 17, 2023 at 10:02 AM Yuanjun Gong <ruc_gongyuanjun@163.com> wrote: > > in emac_tso_csum(), return an error code if an unexpected value > is returned by pskb_trim(). > > Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com> Acked-by: Timur Tabi <timur@kernel.org>
diff --git a/drivers/net/ethernet/qualcomm/emac/emac-mac.c b/drivers/net/ethernet/qualcomm/emac/emac-mac.c index 0d80447d4d3b..d5c688a8d7be 100644 --- a/drivers/net/ethernet/qualcomm/emac/emac-mac.c +++ b/drivers/net/ethernet/qualcomm/emac/emac-mac.c @@ -1260,8 +1260,11 @@ static int emac_tso_csum(struct emac_adapter *adpt, if (skb->protocol == htons(ETH_P_IP)) { u32 pkt_len = ((unsigned char *)ip_hdr(skb) - skb->data) + ntohs(ip_hdr(skb)->tot_len); - if (skb->len > pkt_len) - pskb_trim(skb, pkt_len); + if (skb->len > pkt_len) { + ret = pskb_trim(skb, pkt_len); + if (unlikely(ret)) + return ret; + } } hdr_len = skb_tcp_all_headers(skb);
in emac_tso_csum(), return an error code if an unexpected value is returned by pskb_trim(). Signed-off-by: Yuanjun Gong <ruc_gongyuanjun@163.com> --- drivers/net/ethernet/qualcomm/emac/emac-mac.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)