[lldp-devel] [PATCH 5/8] bugfix in decoding of NLMSG to prevent crash

Jens Osterkamp jens at linux.vnet.ibm.com
Fri Aug 5 15:35:41 UTC 2011


When receiving netlink messages about IF_UP or IF_DOWN events,
it could happen that we try to access struct port for a device for which
struct port does not exist, e.g. macvtap*.

Signed-off-by: Jens Osterkamp <jens at linux.vnet.ibm.com>
---
 event_iface.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/event_iface.c b/event_iface.c
index d923a9e..b5cf0ce 100644
--- a/event_iface.c
+++ b/event_iface.c
@@ -277,6 +277,8 @@ static void event_if_decode_nlmsg(int route_type, void *data, int len)
 				break;
 
 			struct port *port = port_find_by_name(device_name);
+			if (!port)
+				break;
 
 			LIST_FOREACH(agent, &port->agent_head, entry) {
 				LLDPAD_DBG("%s: calling ifdown for agent %p.\n",
-- 
1.7.4.4




More information about the lldp-devel mailing list