From patchwork Tue Apr 10 19:01:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 896901 Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=alphalink.fr Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 40LGjP6SKZz9s0v for ; Wed, 11 Apr 2018 05:01:13 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752417AbeDJTBL (ORCPT ); Tue, 10 Apr 2018 15:01:11 -0400 Received: from zimbra.alphalink.fr ([217.15.80.77]:40379 "EHLO zimbra.alphalink.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752062AbeDJTBK (ORCPT ); Tue, 10 Apr 2018 15:01:10 -0400 Received: from localhost (localhost [127.0.0.1]) by mail-2-cbv2.admin.alphalink.fr (Postfix) with ESMTP id 5766C2B52097; Tue, 10 Apr 2018 21:01:09 +0200 (CEST) Received: from zimbra.alphalink.fr ([127.0.0.1]) by localhost (mail-2-cbv2.admin.alphalink.fr [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 04vGIBwMuhUo; Tue, 10 Apr 2018 21:01:08 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail-2-cbv2.admin.alphalink.fr (Postfix) with ESMTP id 400352B52099; Tue, 10 Apr 2018 21:01:08 +0200 (CEST) X-Virus-Scanned: amavisd-new at mail-2-cbv2.admin.alphalink.fr Received: from zimbra.alphalink.fr ([127.0.0.1]) by localhost (mail-2-cbv2.admin.alphalink.fr [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id X4ibGHo2DuK4; Tue, 10 Apr 2018 21:01:08 +0200 (CEST) Received: from c-dev-0.admin.alphalink.fr (94-84-15-217.reverse.alphalink.fr [217.15.84.94]) by mail-2-cbv2.admin.alphalink.fr (Postfix) with ESMTP id 14AD22B52097; Tue, 10 Apr 2018 21:01:08 +0200 (CEST) Received: by c-dev-0.admin.alphalink.fr (Postfix, from userid 1000) id E6B9A601E2; Tue, 10 Apr 2018 21:01:07 +0200 (CEST) Date: Tue, 10 Apr 2018 21:01:07 +0200 From: Guillaume Nault To: netdev@vger.kernel.org Cc: James Chapman , Tom Parkin Subject: [PATCH net 0/2] l2tp: tunnel creation fixes Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Mutt-Fcc: =Sent User-Agent: Mutt/1.9.4 (2018-02-28) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org L2TP tunnel creation is racy. We need to make sure that the tunnel returned by l2tp_tunnel_create() isn't going to be freed while the caller is using it. This is done in patch #1, by separating tunnel creation from tunnel registration. With the tunnel registration code in place, we can now check for duplicate tunnels in a race-free way. This is done in patch #2, which incidentally removes the last use of l2tp_tunnel_find(). Guillaume Nault (2): l2tp: fix races in tunnel creation l2tp: fix race in duplicate tunnel detection net/l2tp/l2tp_core.c | 225 +++++++++++++++++----------------------- net/l2tp/l2tp_core.h | 4 +- net/l2tp/l2tp_netlink.c | 22 ++-- net/l2tp/l2tp_ppp.c | 9 ++ 4 files changed, 123 insertions(+), 137 deletions(-)