[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1612428002-12333-2-git-send-email-loic.poulain@linaro.org>
Date: Thu, 4 Feb 2021 09:40:01 +0100
From: Loic Poulain <loic.poulain@...aro.org>
To: kuba@...nel.org, davem@...emloft.net
Cc: willemdebruijn.kernel@...il.com, netdev@...r.kernel.org,
stranche@...eaurora.org, subashab@...eaurora.org,
Loic Poulain <loic.poulain@...aro.org>
Subject: [PATCH net-next v5 2/2] net: qualcomm: rmnet: Fix rx_handler for non-linear skbs
There is no guarantee that rmnet rx_handler is only fed with linear
skbs, but current rmnet implementation does not check that, leading
to crash in case of non linear skbs processed as linear ones.
Fix that by ensuring skb linearization before processing.
Signed-off-by: Loic Poulain <loic.poulain@...aro.org>
Acked-by: Willem de Bruijn <willemb@...gle.com>
Reviewed-by: Subash Abhinov Kasiviswanathan <subashab@...eaurora.org>
---
v2: Add this patch to the series to prevent crash
v3: no change
v4: Fix skb leak in case of skb_linearize failure
v5: no change
drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
index 3d7d3ab..3d00b32 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
@@ -183,6 +183,11 @@ rx_handler_result_t rmnet_rx_handler(struct sk_buff **pskb)
if (!skb)
goto done;
+ if (skb_linearize(skb)) {
+ kfree_skb(skb);
+ goto done;
+ }
+
if (skb->pkt_type == PACKET_LOOPBACK)
return RX_HANDLER_PASS;
--
2.7.4
Powered by blists - more mailing lists