]> git.proxmox.com Git - mirror_ovs.git/commitdiff
conntrack: Fix conn_update_state_alg use after free.
authorDarrell Ball <dlu998@gmail.com>
Tue, 10 Jul 2018 23:41:58 +0000 (16:41 -0700)
committerBen Pfaff <blp@ovn.org>
Wed, 11 Jul 2018 15:34:08 +0000 (08:34 -0700)
When conn_update_state() returns true, conn has been freed, so skip calling
handle_ftp_ctl() with this conn and instead follow code path for new
connections.

Fixes: bd5e81a0e596 ("Userspace Datapath: Add ALG infra and FTP.")
Signed-off-by: Darrell Ball <dlu998@gmail.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
lib/conntrack.c

index 08fce055ab178c937b27cd6a99f782e167f8df6e..974f985bd1307ccf436e272b66989f170f3589ac 100644 (file)
@@ -1156,8 +1156,11 @@ conn_update_state_alg(struct conntrack *ct, struct dp_packet *pkt,
         } else {
             *create_new_conn = conn_update_state(ct, pkt, ctx, &conn, now,
                                                 bucket);
-            handle_ftp_ctl(ct, ctx, pkt, conn, now, CT_FTP_CTL_OTHER,
-                           !!nat_action_info);
+
+            if (*create_new_conn == false) {
+                handle_ftp_ctl(ct, ctx, pkt, conn, now, CT_FTP_CTL_OTHER,
+                               !!nat_action_info);
+            }
         }
         return true;
     }