/[packages]/backports/8/kernel/current/SOURCES/net-lantiq_xrx200-confirm-skb-is-allocated-before-us.patch
ViewVC logotype

Contents of /backports/8/kernel/current/SOURCES/net-lantiq_xrx200-confirm-skb-is-allocated-before-us.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1881590 - (show annotations) (download)
Mon Aug 29 03:49:40 2022 UTC (19 months, 3 weeks ago) by tmb
File size: 1386 byte(s)
- add current -stable queue
- io_uring: fix issue with io_write() not always undoing sb_start_write()
- HID: input: fix uclogic tablets


1 From a2f44019fd08b7d03d3f9f544d460d9d48f97816 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Wed, 24 Aug 2022 23:54:06 +0200
4 Subject: net: lantiq_xrx200: confirm skb is allocated before using
5
6 From: Aleksander Jan Bajkowski <olek2@wp.pl>
7
8 [ Upstream commit c8b043702dc0894c07721c5b019096cebc8c798f ]
9
10 xrx200_hw_receive() assumes build_skb() always works and goes straight
11 to skb_reserve(). However, build_skb() can fail under memory pressure.
12
13 Add a check in case build_skb() failed to allocate and return NULL.
14
15 Fixes: e015593573b3 ("net: lantiq_xrx200: convert to build_skb")
16 Reported-by: Eric Dumazet <edumazet@google.com>
17 Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
18 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
19 Signed-off-by: Sasha Levin <sashal@kernel.org>
20 ---
21 drivers/net/ethernet/lantiq_xrx200.c | 6 ++++++
22 1 file changed, 6 insertions(+)
23
24 diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
25 index 5edb68a8aab1e..89314b645c822 100644
26 --- a/drivers/net/ethernet/lantiq_xrx200.c
27 +++ b/drivers/net/ethernet/lantiq_xrx200.c
28 @@ -239,6 +239,12 @@ static int xrx200_hw_receive(struct xrx200_chan *ch)
29 }
30
31 skb = build_skb(buf, priv->rx_skb_size);
32 + if (!skb) {
33 + skb_free_frag(buf);
34 + net_dev->stats.rx_dropped++;
35 + return -ENOMEM;
36 + }
37 +
38 skb_reserve(skb, NET_SKB_PAD);
39 skb_put(skb, len);
40
41 --
42 2.35.1
43

  ViewVC Help
Powered by ViewVC 1.1.30