Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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@linaro.org>
Acked-by: Willem de Bruijn <willemb@google.com>
Reviewed-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Link: https://lore.kernel.org/r/1612428002-12333-2-git-send-email-loic.poulain@linaro.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Loic Poulain and committed by
Jakub Kicinski
d698e6a0 a64566a2

+5
+5
drivers/net/ethernet/qualcomm/rmnet/rmnet_handlers.c
··· 183 183 if (!skb) 184 184 goto done; 185 185 186 + if (skb_linearize(skb)) { 187 + kfree_skb(skb); 188 + goto done; 189 + } 190 + 186 191 if (skb->pkt_type == PACKET_LOOPBACK) 187 192 return RX_HANDLER_PASS; 188 193