]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
batman-adv: Avoid free/alloc race when handling OGM buffer
authorSven Eckelmann <sven@narfation.org>
Thu, 3 Oct 2019 15:02:01 +0000 (17:02 +0200)
committerSimon Wunderlich <sw@simonwunderlich.de>
Sun, 13 Oct 2019 19:00:07 +0000 (21:00 +0200)
commit40e220b4218bb3d278e5e8cc04ccdfd1c7ff8307
treeba826ec7b04c7b73e9ac8c2858cb4da9ce018605
parenta8d23cbbf6c9f515ed678204ad2962be7c336344
batman-adv: Avoid free/alloc race when handling OGM buffer

Each slave interface of an B.A.T.M.A.N. IV virtual interface has an OGM
packet buffer which is initialized using data from netdevice notifier and
other rtnetlink related hooks. It is sent regularly via various slave
interfaces of the batadv virtual interface and in this process also
modified (realloced) to integrate additional state information via TVLV
containers.

It must be avoided that the worker item is executed without a common lock
with the netdevice notifier/rtnetlink helpers. Otherwise it can either
happen that half modified/freed data is sent out or functions modifying the
OGM buffer try to access already freed memory regions.

Reported-by: syzbot+0cc629f19ccb8534935b@syzkaller.appspotmail.com
Fixes: c6c8fea29769 ("net: Add batman-adv meshing protocol")
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de>
net/batman-adv/bat_iv_ogm.c
net/batman-adv/hard-interface.c
net/batman-adv/types.h