]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
batman-adv: fix integer overflow on buff_pos
authorLyes Bourennani <lbourennani@fuzzinglabs.com>
Tue, 21 Apr 2026 22:20:22 +0000 (00:20 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 17 May 2026 15:16:32 +0000 (17:16 +0200)
commit 0799e5943611006b346b8813c7daf7dd5aa26bfd upstream.

Fixing an integer overflow present in batadv_iv_ogm_send_to_if. The size
check is done using the int type in batadv_iv_ogm_aggr_packet whereas the
buff_pos variable uses the s16 type. This could lead to an out-of-bound
read.

Cc: stable@vger.kernel.org
Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
Signed-off-by: Lyes Bourennani <lbourennani@fuzzinglabs.com>
Signed-off-by: Alexis Pinson <apinson@fuzzinglabs.com>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/batman-adv/bat_iv_ogm.c

index f28e9cbf8ad5f267b3e3e3004d3769f3291325ad..618d1889c04e75b95167b7aea39347d719a4f141 100644 (file)
@@ -335,7 +335,7 @@ static void batadv_iv_ogm_send_to_if(struct batadv_forw_packet *forw_packet,
        struct batadv_priv *bat_priv = netdev_priv(hard_iface->mesh_iface);
        const char *fwd_str;
        u8 packet_num;
-       s16 buff_pos;
+       int buff_pos;
        struct batadv_ogm_packet *batadv_ogm_packet;
        struct sk_buff *skb;
        u8 *packet_pos;