diff --git a/SOURCES/openvswitch-2.17.0.patch b/SOURCES/openvswitch-2.17.0.patch
index e01ff54..0bafd4a 100644
--- a/SOURCES/openvswitch-2.17.0.patch
+++ b/SOURCES/openvswitch-2.17.0.patch
@@ -59535,7 +59535,7 @@ index d15f2f1d6d..963e937957 100644
      }
  }
 diff --git a/ovsdb/transaction.c b/ovsdb/transaction.c
-index db86d847c3..3a6ddfa1df 100644
+index db86d847c3..9adbabf808 100644
 --- a/ovsdb/transaction.c
 +++ b/ovsdb/transaction.c
 @@ -159,15 +159,15 @@ ovsdb_txn_row_abort(struct ovsdb_txn *txn OVS_UNUSED,
@@ -59580,16 +59580,119 @@ index db86d847c3..3a6ddfa1df 100644
          dst_row = CONST_CAST(struct ovsdb_row *,
                      ovsdb_table_get_row(weak->dst_table, &weak->dst));
  
-@@ -597,7 +597,7 @@ find_and_add_weak_ref(struct ovsdb_txn_row *txn_row,
+@@ -544,7 +544,7 @@ ovsdb_txn_update_weak_refs(struct ovsdb_txn *txn OVS_UNUSED,
+ }
+ 
+ static void
+-add_weak_ref(struct ovsdb_txn_row *txn_row, const struct ovsdb_row *dst_,
++add_weak_ref(const struct ovsdb_row *src, const struct ovsdb_row *dst_,
+              struct ovs_list *ref_list,
+              const union ovsdb_atom *key, const union ovsdb_atom *value,
+              bool by_key, const struct ovsdb_column *column)
+@@ -552,13 +552,13 @@ add_weak_ref(struct ovsdb_txn_row *txn_row, const struct ovsdb_row *dst_,
+     struct ovsdb_row *dst = CONST_CAST(struct ovsdb_row *, dst_);
+     struct ovsdb_weak_ref *weak;
+ 
+-    if (txn_row->new == dst) {
++    if (src == dst) {
+         return;
+     }
+ 
+     weak = xzalloc(sizeof *weak);
+-    weak->src_table = txn_row->new->table;
+-    weak->src = *ovsdb_row_get_uuid(txn_row->new);
++    weak->src_table = src->table;
++    weak->src = *ovsdb_row_get_uuid(src);
+     weak->dst_table = dst->table;
+     weak->dst = *ovsdb_row_get_uuid(dst);
+     ovsdb_type_clone(&weak->type, &column->type);
+@@ -573,7 +573,7 @@ add_weak_ref(struct ovsdb_txn_row *txn_row, const struct ovsdb_row *dst_,
+ }
+ 
+ static void
+-find_and_add_weak_ref(struct ovsdb_txn_row *txn_row,
++find_and_add_weak_ref(const struct ovsdb_row *src,
+                       const union ovsdb_atom *key,
+                       const union ovsdb_atom *value,
+                       const struct ovsdb_column *column,
+@@ -585,7 +585,7 @@ find_and_add_weak_ref(struct ovsdb_txn_row *txn_row,
+         : ovsdb_table_get_row(column->type.value.uuid.refTable, &value->uuid);
+ 
+     if (row) {
+-        add_weak_ref(txn_row, row, ref_list, key, value, by_key, column);
++        add_weak_ref(src, row, ref_list, key, value, by_key, column);
+     } else if (not_found) {
+         if (uuid_is_zero(by_key ? &key->uuid : &value->uuid)) {
+             *zero = true;
+@@ -594,11 +594,36 @@ find_and_add_weak_ref(struct ovsdb_txn_row *txn_row,
+     }
+ }
+ 
++static void
++find_and_add_weak_refs(const struct ovsdb_row *src,
++                       const struct ovsdb_datum *datum,
++                       const struct ovsdb_column *column,
++                       struct ovs_list *ref_list,
++                       struct ovsdb_datum *not_found, bool *zero)
++{
++    unsigned int i;
++
++    if (ovsdb_base_type_is_weak_ref(&column->type.key)) {
++        for (i = 0; i < datum->n; i++) {
++            find_and_add_weak_ref(src, &datum->keys[i],
++                                  datum->values ? &datum->values[i] : NULL,
++                                  column, true, ref_list, not_found, zero);
++        }
++    }
++
++    if (ovsdb_base_type_is_weak_ref(&column->type.value)) {
++        for (i = 0; i < datum->n; i++) {
++            find_and_add_weak_ref(src, &datum->keys[i], &datum->values[i],
++                                  column, false, ref_list, not_found, zero);
++        }
++    }
++}
++
  static struct ovsdb_error * OVS_WARN_UNUSED_RESULT
  assess_weak_refs(struct ovsdb_txn *txn, struct ovsdb_txn_row *txn_row)
  {
 -    struct ovsdb_weak_ref *weak, *next;
+-    struct ovsdb_table *table;
 +    struct ovsdb_weak_ref *weak;
-     struct ovsdb_table *table;
++    struct ovsdb_table *table = txn_row->table;
      struct shash_node *node;
  
-@@ -642,7 +642,7 @@ assess_weak_refs(struct ovsdb_txn *txn, struct ovsdb_txn_row *txn_row)
+     if (txn_row->old && !txn_row->new) {
+@@ -620,6 +645,15 @@ assess_weak_refs(struct ovsdb_txn *txn, struct ovsdb_txn_row *txn_row)
+             ovs_assert(ovs_list_is_empty(&weak->src_node));
+             ovs_list_insert(&src_txn_row->deleted_refs, &weak->src_node);
+         }
++
++        /* Creating refs that needs to be removed on commit. */
++        SHASH_FOR_EACH (node, &table->schema->columns) {
++            const struct ovsdb_column *column = node->data;
++            struct ovsdb_datum *datum = &txn_row->old->fields[column->index];
++
++            find_and_add_weak_refs(txn_row->old, datum, column,
++                                   &txn_row->deleted_refs, NULL, NULL);
++        }
+     }
+ 
+     if (!txn_row->new) {
+@@ -630,19 +664,18 @@ assess_weak_refs(struct ovsdb_txn *txn, struct ovsdb_txn_row *txn_row)
+         return NULL;
+     }
+ 
+-    table = txn_row->table;
+     SHASH_FOR_EACH (node, &table->schema->columns) {
+         const struct ovsdb_column *column = node->data;
+         struct ovsdb_datum *datum = &txn_row->new->fields[column->index];
+         struct ovsdb_datum added, removed, deleted_refs;
+-        unsigned int orig_n, i;
++        unsigned int orig_n;
+         bool zero = false;
+ 
+         orig_n = datum->n;
  
          /* Collecting all key-value pairs that references deleted rows. */
          ovsdb_datum_init_empty(&deleted_refs);
@@ -59598,7 +59701,60 @@ index db86d847c3..3a6ddfa1df 100644
              if (column->index == weak->column_idx) {
                  ovsdb_datum_add_unsafe(&deleted_refs, &weak->key, &weak->value,
                                         &column->type, NULL);
-@@ -1094,10 +1094,10 @@ static void
+@@ -670,23 +703,8 @@ assess_weak_refs(struct ovsdb_txn *txn, struct ovsdb_txn_row *txn_row)
+ 
+         /* Checking added data and creating new references. */
+         ovsdb_datum_init_empty(&deleted_refs);
+-        if (ovsdb_base_type_is_weak_ref(&column->type.key)) {
+-            for (i = 0; i < added.n; i++) {
+-                find_and_add_weak_ref(txn_row, &added.keys[i],
+-                                      added.values ? &added.values[i] : NULL,
+-                                      column, true, &txn_row->added_refs,
+-                                      &deleted_refs, &zero);
+-            }
+-        }
+-
+-        if (ovsdb_base_type_is_weak_ref(&column->type.value)) {
+-            for (i = 0; i < added.n; i++) {
+-                find_and_add_weak_ref(txn_row, &added.keys[i],
+-                                      &added.values[i],
+-                                      column, false, &txn_row->added_refs,
+-                                      &deleted_refs, &zero);
+-            }
+-        }
++        find_and_add_weak_refs(txn_row->new, &added, column,
++                               &txn_row->added_refs, &deleted_refs, &zero);
+         if (deleted_refs.n) {
+             /* Removing all the references that doesn't point to valid rows. */
+             ovsdb_datum_sort_unique(&deleted_refs, column->type.key.type,
+@@ -700,24 +718,8 @@ assess_weak_refs(struct ovsdb_txn *txn, struct ovsdb_txn_row *txn_row)
+         /* Creating refs that needs to be removed on commit.  This includes
+          * both: the references that got directly removed from the datum and
+          * references removed due to deletion of a referenced row. */
+-        if (ovsdb_base_type_is_weak_ref(&column->type.key)) {
+-            for (i = 0; i < removed.n; i++) {
+-                find_and_add_weak_ref(txn_row, &removed.keys[i],
+-                                      removed.values
+-                                      ? &removed.values[i] : NULL,
+-                                      column, true, &txn_row->deleted_refs,
+-                                      NULL, NULL);
+-            }
+-        }
+-
+-        if (ovsdb_base_type_is_weak_ref(&column->type.value)) {
+-            for (i = 0; i < removed.n; i++) {
+-                find_and_add_weak_ref(txn_row, &removed.keys[i],
+-                                      &removed.values[i],
+-                                      column, false, &txn_row->deleted_refs,
+-                                      NULL, NULL);
+-            }
+-        }
++        find_and_add_weak_refs(txn_row->new, &removed, column,
++                               &txn_row->deleted_refs, NULL, NULL);
+         ovsdb_datum_destroy(&removed, &column->type);
+ 
+         if (datum->n != orig_n) {
+@@ -1094,10 +1096,10 @@ static void
  ovsdb_txn_destroy_cloned(struct ovsdb_txn *txn)
  {
      ovs_assert(!txn->db);
@@ -59613,7 +59769,7 @@ index db86d847c3..3a6ddfa1df 100644
              if (r->old) {
                  ovsdb_row_destroy(r->old);
              }
-@@ -1549,19 +1549,19 @@ for_each_txn_row(struct ovsdb_txn *txn,
+@@ -1549,19 +1551,19 @@ for_each_txn_row(struct ovsdb_txn *txn,
      serial++;
  
      do {
@@ -59637,7 +59793,7 @@ index db86d847c3..3a6ddfa1df 100644
                      if (r->serial != serial) {
                          struct ovsdb_error *error;
  
-@@ -1629,8 +1629,8 @@ ovsdb_txn_history_destroy(struct ovsdb *db)
+@@ -1629,8 +1631,8 @@ ovsdb_txn_history_destroy(struct ovsdb *db)
          return;
      }
  
diff --git a/SPECS/openvswitch2.17.spec b/SPECS/openvswitch2.17.spec
index 030aa4f..9577d9d 100644
--- a/SPECS/openvswitch2.17.spec
+++ b/SPECS/openvswitch2.17.spec
@@ -57,7 +57,7 @@ Summary: Open vSwitch
 Group: System Environment/Daemons daemon/database/utilities
 URL: http://www.openvswitch.org/
 Version: 2.17.0
-Release: 53%{?dist}
+Release: 54%{?dist}
 
 # Nearly all of openvswitch is ASL 2.0.  The bugtool is LGPLv2+, and the
 # lib/sflow*.[ch] files are SISSL
@@ -748,6 +748,13 @@ exit 0
 %endif
 
 %changelog
+* Fri Nov 04 2022 Open vSwitch CI <ovs-ci@redhat.com> - 2.17.0-54
+- Merging upstream branch-2.17 [RH git: 28e77c1573]
+    Commit list:
+    0d1e425c7c ovsdb: transaction: Fix weak reference leak.
+    ceab1ca1ec ovsdb: transaction: Refactor assess_weak_refs.
+
+
 * Wed Nov 02 2022 Open vSwitch CI <ovs-ci@redhat.com> - 2.17.0-53
 - Merging upstream branch-2.17 [RH git: 5c721e65a7]
     Commit list: