Patch "net: lantiq_xrx200: confirm skb is allocated before using" has been added to the 5.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net: lantiq_xrx200: confirm skb is allocated before using

to the 5.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-lantiq_xrx200-confirm-skb-is-allocated-before-us.patch
and it can be found in the queue-5.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit a2f44019fd08b7d03d3f9f544d460d9d48f97816
Author: Aleksander Jan Bajkowski <olek2@xxxxx>
Date:   Wed Aug 24 23:54:06 2022 +0200

    net: lantiq_xrx200: confirm skb is allocated before using
    
    [ Upstream commit c8b043702dc0894c07721c5b019096cebc8c798f ]
    
    xrx200_hw_receive() assumes build_skb() always works and goes straight
    to skb_reserve(). However, build_skb() can fail under memory pressure.
    
    Add a check in case build_skb() failed to allocate and return NULL.
    
    Fixes: e015593573b3 ("net: lantiq_xrx200: convert to build_skb")
    Reported-by: Eric Dumazet <edumazet@xxxxxxxxxx>
    Signed-off-by: Aleksander Jan Bajkowski <olek2@xxxxx>
    Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/lantiq_xrx200.c b/drivers/net/ethernet/lantiq_xrx200.c
index 5edb68a8aab1e..89314b645c822 100644
--- a/drivers/net/ethernet/lantiq_xrx200.c
+++ b/drivers/net/ethernet/lantiq_xrx200.c
@@ -239,6 +239,12 @@ static int xrx200_hw_receive(struct xrx200_chan *ch)
 	}
 
 	skb = build_skb(buf, priv->rx_skb_size);
+	if (!skb) {
+		skb_free_frag(buf);
+		net_dev->stats.rx_dropped++;
+		return -ENOMEM;
+	}
+
 	skb_reserve(skb, NET_SKB_PAD);
 	skb_put(skb, len);
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux