From dd0f59783e397a6ffa03cc5bfc6f2182b0004f49 Mon Sep 17 00:00:00 2001 From: Dumitru Ceara Date: Tue, 25 May 2021 17:16:12 +0200 Subject: [PATCH] ofproto: Fix potential NULL dereference in ofproto_get_datapath_cap(). Reproducer: ovs-vsctl \ -- add-br br \ -- set bridge br datapath-type=foo \ -- --id=@m create Datapath datapath_version=0 'capabilities={}' \ -- set Open_vSwitch . datapaths:"foo"=@m Fixes: 27501802d09f ("ofproto-dpif: Expose datapath capability to ovsdb.") Signed-off-by: Dumitru Ceara Acked-by: Paolo Valerio Signed-off-by: Ilya Maximets --- ofproto/ofproto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index b91517cd250..bf6a262be28 100644 --- a/ofproto/ofproto.c +++ b/ofproto/ofproto.c @@ -968,7 +968,7 @@ ofproto_get_datapath_cap(const char *datapath_type, struct smap *dp_cap) datapath_type = ofproto_normalize_type(datapath_type); const struct ofproto_class *class = ofproto_class_find__(datapath_type); - if (class->get_datapath_cap) { + if (class && class->get_datapath_cap) { class->get_datapath_cap(datapath_type, dp_cap); } }