[ovs-dev] [PATCH ovn] binding: Fix potential NULL dereference of lbinding.
Dumitru Ceara
dceara at redhat.com
Fri Mar 5 20:29:24 UTC 2021
There is a valid code path that can lead to 'lbinding' being NULL in
handle_deleted_vif_lport(). Make sure we check for it.
Found by code inspection.
Fixes: 68cf9fdceba8 ("binding: Fix container port removal from local bindings.")
Signed-off-by: Dumitru Ceara <dceara at redhat.com>
---
controller/binding.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/controller/binding.c b/controller/binding.c
index 2b19fd0..4e6c756 100644
--- a/controller/binding.c
+++ b/controller/binding.c
@@ -2153,10 +2153,12 @@ handle_deleted_vif_lport(const struct sbrec_port_binding *pb,
/* If the container port is removed we should also remove it from
* its parent's children set.
*/
- if (lbinding->parent) {
- local_binding_delete_child(lbinding->parent, lbinding);
+ if (lbinding) {
+ if (lbinding->parent) {
+ local_binding_delete_child(lbinding->parent, lbinding);
+ }
+ local_binding_destroy(lbinding);
}
- local_binding_destroy(lbinding);
}
handle_deleted_lport(pb, b_ctx_in, b_ctx_out);
--
1.8.3.1
More information about the dev
mailing list