Skip to content

Commit

Permalink
net: lantiq_xrx200: restore buffer if memory allocation failed
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
abajk authored and kuba-moo committed Aug 25, 2022
1 parent c4b6e93 commit c9c3b17
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/net/ethernet/lantiq_xrx200.c
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ static int xrx200_alloc_buf(struct xrx200_chan *ch, void *(*alloc)(unsigned int

ch->rx_buff[ch->dma.desc] = alloc(priv->rx_skb_size);
if (!ch->rx_buff[ch->dma.desc]) {
ch->rx_buff[ch->dma.desc] = buf;
ret = -ENOMEM;
goto skip;
}
Expand Down

0 comments on commit c9c3b17

Please sign in to comment.