mirror of
https://github.com/torvalds/linux.git
synced 2026-10-15 04:13:02 +02:00
Here are some batman-adv bugfix, all by Sven Eckelmann:
- fix pointers after potential skb reallocs (5 patches) - dat: ensure accessible eth_hdr proto field -----BEGIN PGP SIGNATURE----- iQJKBAABCgA0FiEE1ilQI7G+y+fdhnrfoSvjmEKSnqEFAmpDx/EWHHN3QHNpbW9u d3VuZGVybGljaC5kZQAKCRChK+OYQpKeoU+PD/92qWug2F0Y9KxXsdU27WUK6Y+M NzVADiZhcOe0DjCd2D+3ihHcH053a8KnUlBO7YM/1AKeyhOJX4DKfGu65b3/r7mv 1GR2mhJM7gUF6OeUmOOeW5uHFGiywgUcnNxCprJtCnmxaVaDp5u2EplLklc4dOWj OX7ULJW55PsVS6VM0cXzOylUhebWa4esqqTG0kmO3nFkUYQrqGTvCxUFznijzBBN CiKxTli2U758VSeFcp6Yl4Jf94I+Zw5EnAEKftkPdtnOe390CCAPlUf1bRR27Wqv YWXxt2oMWKpzYwZrKYBWsZ29XCTNgxxcNWXsb6DEckSPWf0A168LfomcPwdjQrVC uGF1E8j8Rbpys8Xm2USFZF4gcRjl56N6Iig7nK5pYZH/NJ0xqIdXTPz5x5AIRTNB p6OaY58Mq/3f0sCUQzsuBXkOKaIwbiprMadF5VY1v6SrT/NNJmHYJ2Bvd5CTr7G6 hJA5VROZ4W6Tuk+tn+jxHMG7WeajcEKo7zZNFC46eeIuEjeNCuCQ2aQELwVngnHe lBkR4Nq9GeCXb5OKC3lXyYDVBt87ktkRYGgPI+pXJFexHlIJ7kwQfoNCHkYH0umF L+7/R1+2VxsT91c7eKRWsvFyeED2i8KqxQdWLu/RfzmPzp5GlaOhq9U/KpDz+7Hj gLTEZkplVRmgB3pzhA== =H0KB -----END PGP SIGNATURE----- Merge tag 'batadv-net-pullrequest-20260630' of https://git.open-mesh.org/batadv Simon Wunderlich says: ==================== Here are some batman-adv bugfix, all by Sven Eckelmann: - fix pointers after potential skb reallocs (5 patches) - dat: ensure accessible eth_hdr proto field * tag 'batadv-net-pullrequest-20260630' of https://git.open-mesh.org/batadv: batman-adv: dat: ensure accessible eth_hdr proto field batman-adv: bla: reacquire gw address after skb realloc batman-adv: dat: acquire ARP hw source only after skb realloc batman-adv: gw: acquire ethernet header only after skb realloc batman-adv: access unicast_ttvn skb->data only after skb realloc batman-adv: retrieve ethhdr after potential skb realloc on RX ==================== Link: https://patch.msgid.link/20260630134430.85786-1-sw@simonwunderlich.de Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
commit
d8e8b85a85
|
|
@ -1066,6 +1066,9 @@ static u16 batadv_arp_get_type(struct batadv_priv *bat_priv,
|
|||
* @skb: the buffer containing the packet to extract the VID from
|
||||
* @hdr_size: the size of the batman-adv header encapsulating the packet
|
||||
*
|
||||
* The caller must ensure that at least @hdr_size + ETH_HLEN bytes are
|
||||
* accessible after skb->data.
|
||||
*
|
||||
* Return: If the packet embedded in the skb is vlan tagged this function
|
||||
* returns the VID with the BATADV_VLAN_HAS_TAG flag. Otherwise BATADV_NO_FLAGS
|
||||
* is returned.
|
||||
|
|
@ -1148,6 +1151,10 @@ bool batadv_dat_snoop_outgoing_arp_request(struct batadv_priv *bat_priv,
|
|||
if (!READ_ONCE(bat_priv->distributed_arp_table))
|
||||
goto out;
|
||||
|
||||
/* first, find out the vid. */
|
||||
if (!pskb_may_pull(skb, hdr_size + ETH_HLEN))
|
||||
goto out;
|
||||
|
||||
vid = batadv_dat_get_vid(skb, &hdr_size);
|
||||
|
||||
type = batadv_arp_get_type(bat_priv, skb, hdr_size);
|
||||
|
|
@ -1243,6 +1250,10 @@ bool batadv_dat_snoop_incoming_arp_request(struct batadv_priv *bat_priv,
|
|||
if (!READ_ONCE(bat_priv->distributed_arp_table))
|
||||
goto out;
|
||||
|
||||
/* first, find out the vid. */
|
||||
if (!pskb_may_pull(skb, hdr_size + ETH_HLEN))
|
||||
goto out;
|
||||
|
||||
vid = batadv_dat_get_vid(skb, &hdr_size);
|
||||
|
||||
type = batadv_arp_get_type(bat_priv, skb, hdr_size);
|
||||
|
|
@ -1305,6 +1316,10 @@ void batadv_dat_snoop_outgoing_arp_reply(struct batadv_priv *bat_priv,
|
|||
if (!READ_ONCE(bat_priv->distributed_arp_table))
|
||||
return;
|
||||
|
||||
/* first, find out the vid. */
|
||||
if (!pskb_may_pull(skb, hdr_size + ETH_HLEN))
|
||||
return;
|
||||
|
||||
vid = batadv_dat_get_vid(skb, &hdr_size);
|
||||
|
||||
type = batadv_arp_get_type(bat_priv, skb, hdr_size);
|
||||
|
|
@ -1353,6 +1368,10 @@ bool batadv_dat_snoop_incoming_arp_reply(struct batadv_priv *bat_priv,
|
|||
if (!READ_ONCE(bat_priv->distributed_arp_table))
|
||||
goto out;
|
||||
|
||||
/* first, find out the vid. */
|
||||
if (!pskb_may_pull(skb, hdr_size + ETH_HLEN))
|
||||
goto out;
|
||||
|
||||
vid = batadv_dat_get_vid(skb, &hdr_size);
|
||||
|
||||
type = batadv_arp_get_type(bat_priv, skb, hdr_size);
|
||||
|
|
@ -1747,6 +1766,7 @@ void batadv_dat_snoop_incoming_dhcp_ack(struct batadv_priv *bat_priv,
|
|||
struct ethhdr *ethhdr;
|
||||
__be32 ip_src, yiaddr;
|
||||
unsigned short vid;
|
||||
int hdr_size_tmp;
|
||||
__be16 proto;
|
||||
u8 *hw_src;
|
||||
|
||||
|
|
@ -1763,8 +1783,10 @@ void batadv_dat_snoop_incoming_dhcp_ack(struct batadv_priv *bat_priv,
|
|||
if (!batadv_dat_check_dhcp_ack(skb, proto, &ip_src, chaddr, &yiaddr))
|
||||
return;
|
||||
|
||||
hdr_size_tmp = hdr_size;
|
||||
vid = batadv_dat_get_vid(skb, &hdr_size_tmp);
|
||||
ethhdr = (struct ethhdr *)(skb->data + hdr_size);
|
||||
hw_src = ethhdr->h_source;
|
||||
vid = batadv_dat_get_vid(skb, &hdr_size);
|
||||
|
||||
batadv_dat_entry_add(bat_priv, yiaddr, chaddr, vid);
|
||||
batadv_dat_entry_add(bat_priv, ip_src, hw_src, vid);
|
||||
|
|
@ -1804,6 +1826,10 @@ bool batadv_dat_drop_broadcast_packet(struct batadv_priv *bat_priv,
|
|||
if (batadv_forw_packet_is_rebroadcast(forw_packet))
|
||||
goto out;
|
||||
|
||||
/* first, find out the vid. */
|
||||
if (!pskb_may_pull(forw_packet->skb, hdr_size + ETH_HLEN))
|
||||
goto out;
|
||||
|
||||
vid = batadv_dat_get_vid(forw_packet->skb, &hdr_size);
|
||||
|
||||
type = batadv_arp_get_type(bat_priv, forw_packet->skb, hdr_size);
|
||||
|
|
|
|||
|
|
@ -684,12 +684,13 @@ bool batadv_gw_out_of_range(struct batadv_priv *bat_priv,
|
|||
struct batadv_gw_node *gw_node = NULL;
|
||||
struct batadv_gw_node *curr_gw = NULL;
|
||||
struct batadv_neigh_ifinfo *curr_ifinfo, *old_ifinfo;
|
||||
struct ethhdr *ethhdr = (struct ethhdr *)skb->data;
|
||||
struct ethhdr *ethhdr;
|
||||
bool out_of_range = false;
|
||||
u8 curr_tq_avg;
|
||||
unsigned short vid;
|
||||
|
||||
vid = batadv_get_vid(skb, 0);
|
||||
ethhdr = (struct ethhdr *)skb->data;
|
||||
|
||||
if (is_multicast_ether_addr(ethhdr->h_dest))
|
||||
goto out;
|
||||
|
|
|
|||
|
|
@ -580,6 +580,9 @@ void batadv_recv_handler_unregister(u8 packet_type)
|
|||
* @skb: the buffer containing the packet
|
||||
* @header_len: length of the batman header preceding the ethernet header
|
||||
*
|
||||
* The caller must ensure that at least @header_len + ETH_HLEN bytes are
|
||||
* accessible after skb->data.
|
||||
*
|
||||
* Return: VID with the BATADV_VLAN_HAS_TAG flag when the packet embedded in the
|
||||
* skb is vlan tagged. Otherwise BATADV_NO_FLAGS.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -434,6 +434,7 @@ void batadv_interface_rx(struct net_device *mesh_iface,
|
|||
if (!pskb_may_pull(skb, VLAN_ETH_HLEN))
|
||||
goto dropped;
|
||||
|
||||
ethhdr = eth_hdr(skb);
|
||||
vhdr = skb_vlan_eth_hdr(skb);
|
||||
|
||||
/* drop batman-in-batman packets to prevent loops */
|
||||
|
|
|
|||
|
|
@ -855,8 +855,8 @@ static bool batadv_check_unicast_ttvn(struct batadv_priv *bat_priv,
|
|||
if (skb_cow(skb, sizeof(*unicast_packet)) < 0)
|
||||
return false;
|
||||
|
||||
unicast_packet = (struct batadv_unicast_packet *)skb->data;
|
||||
vid = batadv_get_vid(skb, hdr_len);
|
||||
unicast_packet = (struct batadv_unicast_packet *)skb->data;
|
||||
ethhdr = (struct ethhdr *)(skb->data + hdr_len);
|
||||
|
||||
/* do not reroute multicast frames in a unicast header */
|
||||
|
|
@ -1029,6 +1029,7 @@ int batadv_recv_unicast_packet(struct sk_buff *skb,
|
|||
hdr_size);
|
||||
batadv_orig_node_put(orig_node_gw);
|
||||
if (is_gw) {
|
||||
orig_addr_gw = eth_hdr(skb)->h_source;
|
||||
batadv_dbg(BATADV_DBG_BLA, bat_priv,
|
||||
"%s(): Dropped unicast pkt received from another backbone gw %pM.\n",
|
||||
__func__, orig_addr_gw);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user