ovsdb-idl: Fix use-after-free error in ovsdb_idl_txn_delete().
[openvswitch] / lib / ovsdb-idl.c
index 635dcccb48ba1b2b2e28734210a8c231d43f9a85..7ba0fd68366b19969a220f0edde6302b9080e970 100644 (file)
@@ -266,10 +266,12 @@ ovsdb_idl_run(struct ovsdb_idl *idl)
                    && ovsdb_idl_txn_process_reply(idl, msg)) {
             /* ovsdb_idl_txn_process_reply() did everything needful. */
         } else {
-            VLOG_WARN("%s: received unexpected %s message",
-                      jsonrpc_session_get_name(idl->session),
-                      jsonrpc_msg_type_to_string(msg->type));
-            jsonrpc_session_force_reconnect(idl->session);
+            /* This can happen if ovsdb_idl_txn_destroy() is called to destroy
+             * a transaction before we receive the reply, so keep the log level
+             * low. */
+            VLOG_DBG("%s: received unexpected %s message",
+                     jsonrpc_session_get_name(idl->session),
+                     jsonrpc_msg_type_to_string(msg->type));
         }
         if (reply) {
             jsonrpc_session_send(idl->session, reply);
@@ -291,6 +293,12 @@ ovsdb_idl_get_seqno(const struct ovsdb_idl *idl)
     return idl->change_seqno;
 }
 
+bool
+ovsdb_idl_has_ever_connected(const struct ovsdb_idl *idl)
+{
+    return ovsdb_idl_get_seqno(idl) != 0;
+}
+
 void
 ovsdb_idl_force_reconnect(struct ovsdb_idl *idl)
 {
@@ -1221,6 +1229,7 @@ ovsdb_idl_txn_delete(struct ovsdb_idl_row *row)
         assert(!row->prereqs);
         hmap_remove(&row->table->idl->txn->txn_rows, &row->txn_node);
         free(row);
+        return;
     }
     if (hmap_node_is_null(&row->txn_node)) {
         hmap_insert(&row->table->idl->txn->txn_rows, &row->txn_node,