diff mbox

[ovs-dev] ovn-controller: Fix possible null pointer dereference.

Message ID 1474333275-21202-1-git-send-email-jpettit@ovn.org
State Accepted
Headers show

Commit Message

Justin Pettit Sept. 20, 2016, 1:01 a.m. UTC
The code dereferences "chassis", which could be null if chassis_run()
returns null.  "chassis" will always be null if "chassis_id" is null, so
checking "chassis" is sufficient to check both.

Found by inspection.

Signed-off-by: Justin Pettit <jpettit@ovn.org>
---
 ovn/controller/ovn-controller.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ben Pfaff Sept. 20, 2016, 5 p.m. UTC | #1
On Mon, Sep 19, 2016 at 06:01:15PM -0700, Justin Pettit wrote:
> The code dereferences "chassis", which could be null if chassis_run()
> returns null.  "chassis" will always be null if "chassis_id" is null, so
> checking "chassis" is sufficient to check both.
> 
> Found by inspection.
> 
> Signed-off-by: Justin Pettit <jpettit@ovn.org>

Thanks.

Acked-by: Ben Pfaff <blp@ovn.org>
Justin Pettit Sept. 20, 2016, 5:13 p.m. UTC | #2
> On Sep 20, 2016, at 10:00 AM, Ben Pfaff <blp@ovn.org> wrote:
> 
> On Mon, Sep 19, 2016 at 06:01:15PM -0700, Justin Pettit wrote:
>> The code dereferences "chassis", which could be null if chassis_run()
>> returns null.  "chassis" will always be null if "chassis_id" is null, so
>> checking "chassis" is sufficient to check both.
>> 
>> Found by inspection.
>> 
>> Signed-off-by: Justin Pettit <jpettit@ovn.org>
> 
> Thanks.
> 
> Acked-by: Ben Pfaff <blp@ovn.org>

Thanks.  I pushed it to master and branch-2.6.

--Justin
diff mbox

Patch

diff --git a/ovn/controller/ovn-controller.c b/ovn/controller/ovn-controller.c
index 5f2f90a..49821f7 100644
--- a/ovn/controller/ovn-controller.c
+++ b/ovn/controller/ovn-controller.c
@@ -427,7 +427,7 @@  main(int argc, char *argv[])
                         &all_lports);
         }
 
-        if (br_int && chassis_id) {
+        if (br_int && chassis) {
             patch_run(&ctx, br_int, chassis_id, &local_datapaths,
                       &patched_datapaths);