netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Loic Poulain <loic.poulain@linaro.org>
To: kuba@kernel.org, davem@davemloft.net
Cc: willemdebruijn.kernel@gmail.com, netdev@vger.kernel.org,
	stranche@codeaurora.org, subashab@codeaurora.org,
	Loic Poulain <loic.poulain@linaro.org>
Subject: [PATCH net-next v2 2/2] net: qualcomm: rmnet: Fix rx_handler for non-linear skbs
Date: Tue,  2 Feb 2021 17:16:08 +0100	[thread overview]
Message-ID: <1612282568-14094-2-git-send-email-loic.poulain@linaro.org> (raw)
In-Reply-To: <1612282568-14094-1-git-send-email-loic.poulain@linaro.org>

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@linaro.org>
---
 v2: Add this patch to the series to prevent crash

 drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
index 3d7d3ab..2776c32 100644
--- a/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
+++ b/drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
@@ -180,7 +180,7 @@ rx_handler_result_t rmnet_rx_handler(struct sk_buff **pskb)
 	struct rmnet_port *port;
 	struct net_device *dev;
 
-	if (!skb)
+	if (!skb || skb_linearize(skb))
 		goto done;
 
 	if (skb->pkt_type == PACKET_LOOPBACK)
-- 
2.7.4


  reply	other threads:[~2021-02-02 16:11 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-02 16:16 [PATCH net-next v2 1/2] net: mhi-net: Add de-aggeration support Loic Poulain
2021-02-02 16:16 ` Loic Poulain [this message]
2021-02-02 22:46   ` [PATCH net-next v2 2/2] net: qualcomm: rmnet: Fix rx_handler for non-linear skbs Willem de Bruijn
2021-02-03  0:57   ` subashab
2021-02-02 22:45 ` [PATCH net-next v2 1/2] net: mhi-net: Add de-aggeration support Willem de Bruijn
2021-02-03  7:27   ` Loic Poulain
2021-02-03 14:05     ` Willem de Bruijn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1612282568-14094-2-git-send-email-loic.poulain@linaro.org \
    --to=loic.poulain@linaro.org \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stranche@codeaurora.org \
    --cc=subashab@codeaurora.org \
    --cc=willemdebruijn.kernel@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).