}
 
 static void __nft_unregister_flowtable_net_hooks(struct net *net,
+                                                struct nft_flowtable *flowtable,
                                                 struct list_head *hook_list,
                                                 bool release_netdev)
 {
 
        list_for_each_entry_safe(hook, next, hook_list, list) {
                nf_unregister_net_hook(net, &hook->ops);
+               flowtable->data.type->setup(&flowtable->data, hook->ops.dev,
+                                           FLOW_BLOCK_UNBIND);
                if (release_netdev) {
                        list_del(&hook->list);
                        kfree_rcu(hook, rcu);
 }
 
 static void nft_unregister_flowtable_net_hooks(struct net *net,
+                                              struct nft_flowtable *flowtable,
                                               struct list_head *hook_list)
 {
-       __nft_unregister_flowtable_net_hooks(net, hook_list, false);
+       __nft_unregister_flowtable_net_hooks(net, flowtable, hook_list, false);
 }
 
 static int nft_register_flowtable_net_hooks(struct net *net,
 
        flowtable->data.type->free(&flowtable->data);
        list_for_each_entry_safe(hook, next, &flowtable->hook_list, list) {
-               flowtable->data.type->setup(&flowtable->data, hook->ops.dev,
-                                           FLOW_BLOCK_UNBIND);
                list_del_rcu(&hook->list);
                kfree_rcu(hook, rcu);
        }
                                                           &nft_trans_flowtable_hooks(trans),
                                                           trans->msg_type);
                                nft_unregister_flowtable_net_hooks(net,
+                                                                  nft_trans_flowtable(trans),
                                                                   &nft_trans_flowtable_hooks(trans));
                        } else {
                                list_del_rcu(&nft_trans_flowtable(trans)->list);
                                                           NULL,
                                                           trans->msg_type);
                                nft_unregister_flowtable_net_hooks(net,
+                                               nft_trans_flowtable(trans),
                                                &nft_trans_flowtable(trans)->hook_list);
                        }
                        break;
                case NFT_MSG_NEWFLOWTABLE:
                        if (nft_trans_flowtable_update(trans)) {
                                nft_unregister_flowtable_net_hooks(net,
+                                               nft_trans_flowtable(trans),
                                                &nft_trans_flowtable_hooks(trans));
                        } else {
                                nft_use_dec_restore(&table->use);
                                list_del_rcu(&nft_trans_flowtable(trans)->list);
                                nft_unregister_flowtable_net_hooks(net,
+                                               nft_trans_flowtable(trans),
                                                &nft_trans_flowtable(trans)->hook_list);
                        }
                        break;
        list_for_each_entry(chain, &table->chains, list)
                __nf_tables_unregister_hook(net, table, chain, true);
        list_for_each_entry(flowtable, &table->flowtables, list)
-               __nft_unregister_flowtable_net_hooks(net, &flowtable->hook_list,
+               __nft_unregister_flowtable_net_hooks(net, flowtable,
+                                                    &flowtable->hook_list,
                                                     true);
 }