182da58ed903c6041f028adc8718f75ed0cc6ef1
[openwrt/staging/xback.git] /
1 From c9c3b1775f80fa21f5bff874027d2ccb10f5d90c Mon Sep 17 00:00:00 2001
2 From: Aleksander Jan Bajkowski <olek2@wp.pl>
3 Date: Wed, 24 Aug 2022 23:54:08 +0200
4 Subject: [PATCH] net: lantiq_xrx200: restore buffer if memory allocation
5 failed
6
7 In a situation where memory allocation fails, an invalid buffer address
8 is stored. When this descriptor is used again, the system panics in the
9 build_skb() function when accessing memory.
10
11 Fixes: 7ea6cd16f159 ("lantiq: net: fix duplicated skb in rx descriptor ring")
12 Signed-off-by: Aleksander Jan Bajkowski <olek2@wp.pl>
13 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
14 ---
15 drivers/net/ethernet/lantiq_xrx200.c | 1 +
16 1 file changed, 1 insertion(+)
17
18 --- a/drivers/net/ethernet/lantiq_xrx200.c
19 +++ b/drivers/net/ethernet/lantiq_xrx200.c
20 @@ -193,6 +193,7 @@ static int xrx200_alloc_buf(struct xrx20
21
22 ch->rx_buff[ch->dma.desc] = alloc(priv->rx_skb_size);
23 if (!ch->rx_buff[ch->dma.desc]) {
24 + ch->rx_buff[ch->dma.desc] = buf;
25 ret = -ENOMEM;
26 goto skip;
27 }