[PATCH] leon, grspw_pkt: protect TX descriptor from bad input (hdrlen)

Daniel Hellstrom daniel at gaisler.com
Wed Sep 19 14:13:31 UTC 2018


---
 bsps/sparc/shared/spw/grspw_pkt.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/bsps/sparc/shared/spw/grspw_pkt.c b/bsps/sparc/shared/spw/grspw_pkt.c
index ff481f2..39f5087 100644
--- a/bsps/sparc/shared/spw/grspw_pkt.c
+++ b/bsps/sparc/shared/spw/grspw_pkt.c
@@ -1470,7 +1470,8 @@ STATIC int grspw_tx_schedule_send(struct grspw_dma_priv *dma)
 					curr_pkt->flags &= ~PKT_FLAG_TR_HDR;
 			}
 			BD_WRITE(&curr_bd->bd->haddr, hwaddr);
-			ctrl = GRSPW_TXBD_EN | curr_pkt->hlen;
+			ctrl = GRSPW_TXBD_EN |
+			       (curr_pkt->hlen & GRSPW_TXBD_HLEN);
 		} else {
 			ctrl = GRSPW_TXBD_EN;
 		}
-- 
2.7.4




More information about the devel mailing list