Skip to content

Commit

Permalink
ofproto: Fix potential NULL pointer dereference in ofproto_type_xx().
Browse files Browse the repository at this point in the history
Ensure a valid class is found before calling it's function pointer.
If it's not found, call ovs_assert().

Signed-off-by: Eelco Chaudron <[email protected]>
Signed-off-by: 0-day Robot <[email protected]>
  • Loading branch information
chaudron authored and ovsrobot committed Feb 6, 2025
1 parent 0f8e5c2 commit 15bb0ce
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ofproto/ofproto.c
Original file line number Diff line number Diff line change
Expand Up @@ -1896,6 +1896,7 @@ ofproto_type_run(const char *datapath_type)

datapath_type = ofproto_normalize_type(datapath_type);
class = ofproto_class_find__(datapath_type);
ovs_assert(class);

error = class->type_run ? class->type_run(datapath_type) : 0;
if (error && error != EAGAIN) {
Expand All @@ -1912,6 +1913,7 @@ ofproto_type_wait(const char *datapath_type)

datapath_type = ofproto_normalize_type(datapath_type);
class = ofproto_class_find__(datapath_type);
ovs_assert(class);

if (class->type_wait) {
class->type_wait(datapath_type);
Expand Down

0 comments on commit 15bb0ce

Please sign in to comment.