Skip to content

Commit

Permalink
ofproto: Fix potential leak during flow mods.
Browse files Browse the repository at this point in the history
This code created a cls_rule without destroying it.  Found by
inspection.

Signed-off-by: Ethan Jackson <[email protected]>
Acked-by: Jarno Rajahalme <[email protected]>
  • Loading branch information
ejj committed May 1, 2014
1 parent 25d6a6a commit 0ef165e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions ofproto/ofproto.c
Original file line number Diff line number Diff line change
Expand Up @@ -1975,14 +1975,13 @@ ofproto_flow_mod(struct ofproto *ofproto, struct ofputil_flow_mod *fm)
if (fm->command == OFPFC_MODIFY_STRICT && fm->table_id != OFPTT_ALL
&& !(fm->flags & OFPUTIL_FF_RESET_COUNTS)) {
struct oftable *table = &ofproto->tables[fm->table_id];
struct cls_rule match_rule;
struct rule *rule;
bool done = false;

cls_rule_init(&match_rule, &fm->match, fm->priority);
fat_rwlock_rdlock(&table->cls.rwlock);
rule = rule_from_cls_rule(classifier_find_rule_exactly(&table->cls,
&match_rule));
rule = rule_from_cls_rule(classifier_find_match_exactly(&table->cls,
&fm->match,
fm->priority));
if (rule) {
/* Reading many of the rule fields and writing on 'modified'
* requires the rule->mutex. Also, rule->actions may change
Expand Down

0 comments on commit 0ef165e

Please sign in to comment.