]> git.baikalelectronics.ru Git - kernel.git/commit
net: bridge: multicast: fix igmp/mld port context null pointer dereferences
authorNikolay Aleksandrov <nikolay@nvidia.com>
Wed, 21 Jul 2021 10:06:24 +0000 (13:06 +0300)
committerDavid S. Miller <davem@davemloft.net>
Wed, 21 Jul 2021 16:04:03 +0000 (09:04 -0700)
commit344c6ab0b92fe6155bdb3eab26d73b5a06b4b2d9
tree2ed34b06307271aceb991f25e54e36a17f189973
parent3c53c23921293809f596553132cc835a2c557a99
net: bridge: multicast: fix igmp/mld port context null pointer dereferences

With the recent change to use bridge/port multicast context pointers
instead of bridge/port I missed to convert two locations which pass the
port pointer as-is, but with the new model we need to verify the port
context is non-NULL first and retrieve the port from it. The first
location is when doing querier selection when a query is received, the
second location is when leaving a group. The port context will be null
if the packets originated from the bridge device (i.e. from the host).
The fix is simple just check if the port context exists and retrieve
the port pointer from it.

Fixes: 633df533284c ("net: bridge: multicast: use multicast contexts instead of bridge or port")
Signed-off-by: Nikolay Aleksandrov <nikolay@nvidia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_multicast.c