All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] qede: validate non LSO skb length
@ 2021-11-24  9:24 Manish Chopra
  2021-11-24 23:38 ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: Manish Chopra @ 2021-11-24  9:24 UTC (permalink / raw)
  To: kuba; +Cc: netdev, aelior, palok, pkushwaha

Although it is unlikely that stack could transmit a non LSO
skb with length > MTU, however in some cases or environment such
occurrences actually resulted into firmware asserts due to packet
length being greater than the max supported by the device (~9700B).

This patch adds the safeguard for such odd cases to avoid firmware
asserts.

Signed-off-by: Manish Chopra <manishc@marvell.com>
Signed-off-by: Alok Prasad <palok@marvell.com>
Signed-off-by: Prabhakar Kushwaha <pkushwaha@marvell.com>
Signed-off-by: Ariel Elior <aelior@marvell.com>
---
 drivers/net/ethernet/qlogic/qede/qede_fp.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/net/ethernet/qlogic/qede/qede_fp.c b/drivers/net/ethernet/qlogic/qede/qede_fp.c
index e113fbd56e86..5ea9cb4311a1 100644
--- a/drivers/net/ethernet/qlogic/qede/qede_fp.c
+++ b/drivers/net/ethernet/qlogic/qede/qede_fp.c
@@ -1644,6 +1644,13 @@ netdev_tx_t qede_start_xmit(struct sk_buff *skb, struct net_device *ndev)
 			data_split = true;
 		}
 	} else {
+		if (unlikely(skb->len > ETH_TX_MAX_NON_LSO_PKT_LEN)) {
+			DP_ERR(edev, "Unexpected non LSO skb length = 0x%x\n", skb->len);
+			qede_free_failed_tx_pkt(txq, first_bd, 0, false);
+			qede_update_tx_producer(txq);
+			return NETDEV_TX_OK;
+		}
+
 		val |= ((skb->len & ETH_TX_DATA_1ST_BD_PKT_LEN_MASK) <<
 			 ETH_TX_DATA_1ST_BD_PKT_LEN_SHIFT);
 	}
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net] qede: validate non LSO skb length
  2021-11-24  9:24 [PATCH net] qede: validate non LSO skb length Manish Chopra
@ 2021-11-24 23:38 ` Jakub Kicinski
  2021-12-02 21:19   ` [EXT] " Manish Chopra
  0 siblings, 1 reply; 4+ messages in thread
From: Jakub Kicinski @ 2021-11-24 23:38 UTC (permalink / raw)
  To: Manish Chopra; +Cc: netdev, aelior, palok, pkushwaha

On Wed, 24 Nov 2021 01:24:05 -0800 Manish Chopra wrote:
> Although it is unlikely that stack could transmit a non LSO
> skb with length > MTU, however in some cases or environment such
> occurrences actually resulted into firmware asserts due to packet
> length being greater than the max supported by the device (~9700B).
> 
> This patch adds the safeguard for such odd cases to avoid firmware
> asserts.
> 
> Signed-off-by: Manish Chopra <manishc@marvell.com>
> Signed-off-by: Alok Prasad <palok@marvell.com>
> Signed-off-by: Prabhakar Kushwaha <pkushwaha@marvell.com>
> Signed-off-by: Ariel Elior <aelior@marvell.com>

Please add an appropriate Fixes tag and repost.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* RE: [EXT] Re: [PATCH net] qede: validate non LSO skb length
  2021-11-24 23:38 ` Jakub Kicinski
@ 2021-12-02 21:19   ` Manish Chopra
  2021-12-03  1:19     ` Jakub Kicinski
  0 siblings, 1 reply; 4+ messages in thread
From: Manish Chopra @ 2021-12-02 21:19 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: netdev, Ariel Elior, Alok Prasad, Prabhakar Kushwaha

> -----Original Message-----
> From: Jakub Kicinski <kuba@kernel.org>
> Sent: Thursday, November 25, 2021 5:08 AM
> To: Manish Chopra <manishc@marvell.com>
> Cc: netdev@vger.kernel.org; Ariel Elior <aelior@marvell.com>; Alok Prasad
> <palok@marvell.com>; Prabhakar Kushwaha <pkushwaha@marvell.com>
> Subject: [EXT] Re: [PATCH net] qede: validate non LSO skb length
> 
> External Email
> 
> ----------------------------------------------------------------------
> On Wed, 24 Nov 2021 01:24:05 -0800 Manish Chopra wrote:
> > Although it is unlikely that stack could transmit a non LSO skb with
> > length > MTU, however in some cases or environment such occurrences
> > actually resulted into firmware asserts due to packet length being
> > greater than the max supported by the device (~9700B).
> >
> > This patch adds the safeguard for such odd cases to avoid firmware
> > asserts.
> >
> > Signed-off-by: Manish Chopra <manishc@marvell.com>
> > Signed-off-by: Alok Prasad <palok@marvell.com>
> > Signed-off-by: Prabhakar Kushwaha <pkushwaha@marvell.com>
> > Signed-off-by: Ariel Elior <aelior@marvell.com>
> 
> Please add an appropriate Fixes tag and repost.

Hello Jakub,

I don't really know which commit has introduced this exactly. It was probably day1 (when this driver was submitted) behavior,
just that this issue was discovered recently by some customer environment.
Let me know if you want me to put one of those initial driver commit tag here and repost ? 

Thanks,
Manish  


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [EXT] Re: [PATCH net] qede: validate non LSO skb length
  2021-12-02 21:19   ` [EXT] " Manish Chopra
@ 2021-12-03  1:19     ` Jakub Kicinski
  0 siblings, 0 replies; 4+ messages in thread
From: Jakub Kicinski @ 2021-12-03  1:19 UTC (permalink / raw)
  To: Manish Chopra; +Cc: netdev, Ariel Elior, Alok Prasad, Prabhakar Kushwaha

On Thu, 2 Dec 2021 21:19:26 +0000 Manish Chopra wrote:
> > On Wed, 24 Nov 2021 01:24:05 -0800 Manish Chopra wrote:  
> > > Although it is unlikely that stack could transmit a non LSO skb with
> > > length > MTU, however in some cases or environment such occurrences
> > > actually resulted into firmware asserts due to packet length being
> > > greater than the max supported by the device (~9700B).
> > >
> > > This patch adds the safeguard for such odd cases to avoid firmware
> > > asserts.
> > >
> > > Signed-off-by: Manish Chopra <manishc@marvell.com>
> > > Signed-off-by: Alok Prasad <palok@marvell.com>
> > > Signed-off-by: Prabhakar Kushwaha <pkushwaha@marvell.com>
> > > Signed-off-by: Ariel Elior <aelior@marvell.com>  
> > 
> > Please add an appropriate Fixes tag and repost.  
> 
> Hello Jakub,
> 
> I don't really know which commit has introduced this exactly. It was
> probably day1 (when this driver was submitted) behavior, just that
> this issue was discovered recently by some customer environment. Let
> me know if you want me to put one of those initial driver commit tag
> here and repost ? 

Yes, that'd be best. This way any sort of automation for tracking which
fixes need to be backported will have clear signal that this fix
applies to all the kernels.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-12-03  1:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-24  9:24 [PATCH net] qede: validate non LSO skb length Manish Chopra
2021-11-24 23:38 ` Jakub Kicinski
2021-12-02 21:19   ` [EXT] " Manish Chopra
2021-12-03  1:19     ` Jakub Kicinski

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.