[ovs-dev,v2,branch,2.8] conntrack: Fix use after free for FTP control case.

Message ID 1531325111-58795-1-git-send-email-dlu998@gmail.com
State Accepted
Headers show
Series
  • [ovs-dev,v2,branch,2.8] conntrack: Fix use after free for FTP control case.
Related show

Commit Message

Darrell Ball July 11, 2018, 4:05 p.m.
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>
---
 lib/conntrack.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Comments

0-day Robot July 11, 2018, 4:54 p.m. | #1
Bleep bloop.  Greetings Darrell Ball, I am a robot and I have tried out your patch.
Thanks for your contribution.

I encountered some error that I wasn't expecting.  See the details below.


git-am:
Failed to merge in the changes.
Patch failed at 0001 conntrack: Fix use after free for FTP control case.
The copy of the patch that failed is found in:
   /var/lib/jenkins/jobs/upstream_build_from_pw/workspace/.git/rebase-apply/patch
When you have resolved this problem, run "git am --resolved".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".


Please check this out.  If you feel there has been an error, please email aconole@bytheb.org

Thanks,
0-day Robot
Ben Pfaff July 12, 2018, 11:51 p.m. | #2
On Wed, Jul 11, 2018 at 09:05:11AM -0700, Darrell Ball wrote:
> 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>

Applied to branch-2.8, thanks!

Patch

diff --git a/lib/conntrack.c b/lib/conntrack.c
index 6691877..08bec61 100644
--- a/lib/conntrack.c
+++ b/lib/conntrack.c
@@ -1135,8 +1135,11 @@  process_one(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) {
+                    handle_ftp_ctl(ct, ctx, pkt, conn, now, CT_FTP_CTL_OTHER,
+                                   !!nat_action_info);
+                }
             }
         } else {
             create_new_conn = conn_update_state(ct, pkt, ctx, &conn, now,