Message ID | 20210525151608.7754.39691.stgit@dceara.remote.csb |
---|---|
State | Accepted |
Headers | show |
Series | ofproto: Fix potential NULL dereference with invalid datapath types. | expand |
Dumitru Ceara <dceara@redhat.com> writes: > 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 <dceara@redhat.com> > --- LGTM, Acked-by: Paolo Valerio <pvalerio@redhat.com>
diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c index b91517cd25..bf6a262be2 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); } }
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 <dceara@redhat.com> --- ofproto/ofproto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)