Patch "macvlan: Fix leaking skb in source mode with nodst option" has been added to the 5.17-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

    macvlan: Fix leaking skb in source mode with nodst option

to the 5.17-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:
     macvlan-fix-leaking-skb-in-source-mode-with-nodst-op.patch
and it can be found in the queue-5.17 subdirectory.

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



commit f9fe95fc506c4288c1b573d06443b110b100385c
Author: Martin Willi <martin@xxxxxxxxxxxxxx>
Date:   Tue Apr 12 11:34:57 2022 +0200

    macvlan: Fix leaking skb in source mode with nodst option
    
    [ Upstream commit e16b859872b87650bb55b12cca5a5fcdc49c1442 ]
    
    The MACVLAN receive handler clones skbs to all matching source MACVLAN
    interfaces, before it passes the packet along to match on destination
    based MACVLANs.
    
    When using the MACVLAN nodst mode, passing the packet to destination based
    MACVLANs is omitted and the handler returns with RX_HANDLER_CONSUMED.
    However, the passed skb is not freed, leaking for any packet processed
    with the nodst option.
    
    Properly free the skb when consuming packets to fix that leak.
    
    Fixes: 427f0c8c194b ("macvlan: Add nodst option to macvlan type source")
    Signed-off-by: Martin Willi <martin@xxxxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/macvlan.c b/drivers/net/macvlan.c
index 6ef5f77be4d0..c83664b28d89 100644
--- a/drivers/net/macvlan.c
+++ b/drivers/net/macvlan.c
@@ -460,8 +460,10 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
 			return RX_HANDLER_CONSUMED;
 		*pskb = skb;
 		eth = eth_hdr(skb);
-		if (macvlan_forward_source(skb, port, eth->h_source))
+		if (macvlan_forward_source(skb, port, eth->h_source)) {
+			kfree_skb(skb);
 			return RX_HANDLER_CONSUMED;
+		}
 		src = macvlan_hash_lookup(port, eth->h_source);
 		if (src && src->mode != MACVLAN_MODE_VEPA &&
 		    src->mode != MACVLAN_MODE_BRIDGE) {
@@ -480,8 +482,10 @@ static rx_handler_result_t macvlan_handle_frame(struct sk_buff **pskb)
 		return RX_HANDLER_PASS;
 	}
 
-	if (macvlan_forward_source(skb, port, eth->h_source))
+	if (macvlan_forward_source(skb, port, eth->h_source)) {
+		kfree_skb(skb);
 		return RX_HANDLER_CONSUMED;
+	}
 	if (macvlan_passthru(port))
 		vlan = list_first_or_null_rcu(&port->vlans,
 					      struct macvlan_dev, list);



[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