Commit 7793a88e authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

Merge tag 'batadv-net-pullrequest-20230816' of git://git.open-mesh.org/linux-merge

Simon Wunderlich says:

====================
Here are some batman-adv bugfixes:

 - Fix issues with adjusted MTUs (2 patches), by Sven Eckelmann

 - Fix header access for memory reallocation case, by Remi Pommarel

 - Fix two memory leaks (2 patches), by Remi Pommarel

* tag 'batadv-net-pullrequest-20230816' of git://git.open-mesh.org/linux-merge:
  batman-adv: Fix batadv_v_ogm_aggr_send memory leak
  batman-adv: Fix TT global entry leak when client roamed back
  batman-adv: Do not get eth header before batadv_check_management_packet
  batman-adv: Don't increase MTU when set by user
  batman-adv: Trigger events for auto adjusted MTU
====================

Link: https://lore.kernel.org/r/20230816163318.189996-1-sw@simonwunderlich.de


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 0e8860d2 421d467d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -505,7 +505,7 @@ int batadv_v_elp_packet_recv(struct sk_buff *skb,
	struct batadv_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
	struct batadv_elp_packet *elp_packet;
	struct batadv_hard_iface *primary_if;
	struct ethhdr *ethhdr = (struct ethhdr *)skb_mac_header(skb);
	struct ethhdr *ethhdr;
	bool res;
	int ret = NET_RX_DROP;

@@ -513,6 +513,7 @@ int batadv_v_elp_packet_recv(struct sk_buff *skb,
	if (!res)
		goto free_skb;

	ethhdr = eth_hdr(skb);
	if (batadv_is_my_mac(bat_priv, ethhdr->h_source))
		goto free_skb;

+5 −2
Original line number Diff line number Diff line
@@ -123,8 +123,10 @@ static void batadv_v_ogm_send_to_if(struct sk_buff *skb,
{
	struct batadv_priv *bat_priv = netdev_priv(hard_iface->soft_iface);

	if (hard_iface->if_status != BATADV_IF_ACTIVE)
	if (hard_iface->if_status != BATADV_IF_ACTIVE) {
		kfree_skb(skb);
		return;
	}

	batadv_inc_counter(bat_priv, BATADV_CNT_MGMT_TX);
	batadv_add_counter(bat_priv, BATADV_CNT_MGMT_TX_BYTES,
@@ -985,7 +987,7 @@ int batadv_v_ogm_packet_recv(struct sk_buff *skb,
{
	struct batadv_priv *bat_priv = netdev_priv(if_incoming->soft_iface);
	struct batadv_ogm2_packet *ogm_packet;
	struct ethhdr *ethhdr = eth_hdr(skb);
	struct ethhdr *ethhdr;
	int ogm_offset;
	u8 *packet_pos;
	int ret = NET_RX_DROP;
@@ -999,6 +1001,7 @@ int batadv_v_ogm_packet_recv(struct sk_buff *skb,
	if (!batadv_check_management_packet(skb, if_incoming, BATADV_OGM2_HLEN))
		goto free_skb;

	ethhdr = eth_hdr(skb);
	if (batadv_is_my_mac(bat_priv, ethhdr->h_source))
		goto free_skb;

+13 −1
Original line number Diff line number Diff line
@@ -630,7 +630,19 @@ int batadv_hardif_min_mtu(struct net_device *soft_iface)
 */
void batadv_update_min_mtu(struct net_device *soft_iface)
{
	soft_iface->mtu = batadv_hardif_min_mtu(soft_iface);
	struct batadv_priv *bat_priv = netdev_priv(soft_iface);
	int limit_mtu;
	int mtu;

	mtu = batadv_hardif_min_mtu(soft_iface);

	if (bat_priv->mtu_set_by_user)
		limit_mtu = bat_priv->mtu_set_by_user;
	else
		limit_mtu = ETH_DATA_LEN;

	mtu = min(mtu, limit_mtu);
	dev_set_mtu(soft_iface, mtu);

	/* Check if the local translate table should be cleaned up to match a
	 * new (and smaller) MTU.
+3 −0
Original line number Diff line number Diff line
@@ -153,11 +153,14 @@ static int batadv_interface_set_mac_addr(struct net_device *dev, void *p)

static int batadv_interface_change_mtu(struct net_device *dev, int new_mtu)
{
	struct batadv_priv *bat_priv = netdev_priv(dev);

	/* check ranges */
	if (new_mtu < 68 || new_mtu > batadv_hardif_min_mtu(dev))
		return -EINVAL;

	dev->mtu = new_mtu;
	bat_priv->mtu_set_by_user = new_mtu;

	return 0;
}
+0 −1
Original line number Diff line number Diff line
@@ -774,7 +774,6 @@ bool batadv_tt_local_add(struct net_device *soft_iface, const u8 *addr,
		if (roamed_back) {
			batadv_tt_global_free(bat_priv, tt_global,
					      "Roaming canceled");
			tt_global = NULL;
		} else {
			/* The global entry has to be marked as ROAMING and
			 * has to be kept for consistency purpose
Loading