Skip to content

Commit c9c3b17

Browse files
abajkkuba-moo
authored andcommitted
net: lantiq_xrx200: restore buffer if memory allocation failed
In a situation where memory allocation fails, an invalid buffer address is stored. When this descriptor is used again, the system panics in the build_skb() function when accessing memory. Fixes: 7ea6cd1 ("lantiq: net: fix duplicated skb in rx descriptor ring") Signed-off-by: Aleksander Jan Bajkowski <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent c4b6e93 commit c9c3b17

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/net/ethernet/lantiq_xrx200.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ static int xrx200_alloc_buf(struct xrx200_chan *ch, void *(*alloc)(unsigned int
193193

194194
ch->rx_buff[ch->dma.desc] = alloc(priv->rx_skb_size);
195195
if (!ch->rx_buff[ch->dma.desc]) {
196+
ch->rx_buff[ch->dma.desc] = buf;
196197
ret = -ENOMEM;
197198
goto skip;
198199
}

0 commit comments

Comments
 (0)