netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net/xen-netback: Break build if netback slots > max_skbs + 1
@ 2023-09-27  8:29 David Kahurani
  2023-09-27  9:42 ` Paul Durrant
  2023-10-04 18:47 ` Jakub Kicinski
  0 siblings, 2 replies; 6+ messages in thread
From: David Kahurani @ 2023-09-27  8:29 UTC (permalink / raw)
  To: xen-devel; +Cc: netdev, wei.liu, paul, David Kahurani

If XEN_NETBK_LEGACY_SLOTS_MAX and MAX_SKB_FRAGS have a difference of
more than 1, with MAX_SKB_FRAGS being the lesser value, it opens up a
path for null-dereference. It was also noted that some distributions
were modifying upstream behaviour in that direction which necessitates
this patch.

Signed-off-by: David Kahurani <k.kahurani@gmail.com>
---
 drivers/net/xen-netback/netback.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/xen-netback/netback.c b/drivers/net/xen-netback/netback.c
index 88f760a7cbc3..df032e33787f 100644
--- a/drivers/net/xen-netback/netback.c
+++ b/drivers/net/xen-netback/netback.c
@@ -1005,6 +1005,7 @@ static void xenvif_tx_build_gops(struct xenvif_queue *queue,
 			break;
 		}
 
+		BUILD_BUG_ON(XEN_NETBK_LEGACY_SLOTS_MAX > MAX_SKB_FRAGS + 1);
 		if (ret >= XEN_NETBK_LEGACY_SLOTS_MAX - 1 && data_len < txreq.size)
 			data_len = txreq.size;
 
-- 
2.25.1


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

end of thread, other threads:[~2023-10-05 16:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-27  8:29 [PATCH] net/xen-netback: Break build if netback slots > max_skbs + 1 David Kahurani
2023-09-27  9:42 ` Paul Durrant
2023-10-04 18:47 ` Jakub Kicinski
2023-10-05 15:39   ` David Kahurani
2023-10-05 16:03     ` Jakub Kicinski
2023-10-05 16:24       ` David Kahurani

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).