Skip to content

Commit

Permalink
ofproto-dpif: Do not allow recirc_id freed by non-owning ofproto.
Browse files Browse the repository at this point in the history
This commit changes the VLOG_ERR (for warning unmatched ofproto)
in ofproto_dpif_free_recirc_id() to an assert statement, so that
recirc_id is never allowed to be freed by non-owning ofproto.

Suggested-by: Ben Pfaff <[email protected]>
Signed-off-by: Alex Wang <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
yew011 committed Jan 6, 2015
1 parent 3fbbcba commit b2623fd
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions ofproto/ofproto-dpif.c
Original file line number Diff line number Diff line change
Expand Up @@ -5459,11 +5459,8 @@ ofproto_dpif_free_recirc_id(struct ofproto_dpif *ofproto, uint32_t recirc_id)
ovs_mutex_unlock(&backer->recirc_mutex);
recirc_id_free(backer->rid_pool, node->recirc_id);

if (node->ofproto != ofproto) {
VLOG_ERR("recirc_id %"PRIu32", freed by incorrect ofproto (%s),"
" expect ofproto (%s)", node->recirc_id, ofproto->up.name,
node->ofproto->up.name);
}
/* 'recirc_id' should never be freed by non-owning 'ofproto'. */
ovs_assert(node->ofproto == ofproto);

/* RCU postpone the free, since other threads may be referring
* to 'node' at same time. */
Expand Down

0 comments on commit b2623fd

Please sign in to comment.