From: miter <mit...@outlook.com>

Ofproto_class_find__() may return NULL, and dereference it to cause
segfault.

Tested-by: Zhang YuHuang <zhangyuhu...@ruijie.com.cn>
Signed-off-by: Lin Huang <linhu...@ruijie.com.cn>
---
 ofproto/ofproto.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ofproto/ofproto.c b/ofproto/ofproto.c
index 122a06f30..21c6a1d82 100644
--- a/ofproto/ofproto.c
+++ b/ofproto/ofproto.c
@@ -800,7 +800,7 @@ ofproto_type_set_config(const char *datapath_type, const 
struct smap *cfg)
     datapath_type = ofproto_normalize_type(datapath_type);
     class = ofproto_class_find__(datapath_type);
 
-    if (class->type_set_config) {
+    if (class && class->type_set_config) {
         class->type_set_config(datapath_type, cfg);
     }
 }
-- 
2.39.3

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to