From 6114ad11bbd22c709fc7588d1f2b82f73b5a6923 Mon Sep 17 00:00:00 2001 From: Justin Pettit Date: Fri, 12 Sep 2008 18:47:29 -0700 Subject: [PATCH] Fix crash when no actions are specified. Actions are allocated as a pointer to an array of actions in flows. When flows are freed, the code was always freeing the action pointer. Under some circumstances the pointer may not be set. --- datapath/flow.c | 3 ++- switch/switch-flow.c | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/datapath/flow.c b/datapath/flow.c index a2c96abd6..71dd8235d 100644 --- a/datapath/flow.c +++ b/datapath/flow.c @@ -187,7 +187,8 @@ void flow_free(struct sw_flow *flow) { if (unlikely(!flow)) return; - kfree(flow->actions); + if (flow->actions) + kfree(flow->actions); kmem_cache_free(flow_cache, flow); } EXPORT_SYMBOL(flow_free); diff --git a/switch/switch-flow.c b/switch/switch-flow.c index 9c9538d0e..16a7177e1 100644 --- a/switch/switch-flow.c +++ b/switch/switch-flow.c @@ -191,7 +191,9 @@ flow_free(struct sw_flow *flow) if (!flow) { return; } - free(flow->actions); + if (flow->actions) { + free(flow->actions); + } free(flow); } -- 2.45.2