From patchwork Thu Apr 12 18:50:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Nault X-Patchwork-Id: 897760 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 40MVNH42CLz9s0x for ; Fri, 13 Apr 2018 04:50:39 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753392AbeDLSug (ORCPT ); Thu, 12 Apr 2018 14:50:36 -0400 Received: from zimbra.alphalink.fr ([217.15.80.77]:40448 "EHLO zimbra.alphalink.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753150AbeDLSuf (ORCPT ); Thu, 12 Apr 2018 14:50:35 -0400 Received: from localhost (localhost [127.0.0.1]) by mail-2-cbv2.admin.alphalink.fr (Postfix) with ESMTP id BE2582B5210C; Thu, 12 Apr 2018 20:50:33 +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 gbLAqG_GhWZl; Thu, 12 Apr 2018 20:50:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail-2-cbv2.admin.alphalink.fr (Postfix) with ESMTP id 703C02B52093; Thu, 12 Apr 2018 20:50:32 +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 aCe6Kp44je87; Thu, 12 Apr 2018 20:50:32 +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 474672B5206F; Thu, 12 Apr 2018 20:50:32 +0200 (CEST) Received: by c-dev-0.admin.alphalink.fr (Postfix, from userid 1000) id 18747601B9; Thu, 12 Apr 2018 20:50:32 +0200 (CEST) Date: Thu, 12 Apr 2018 20:50:32 +0200 From: Guillaume Nault To: netdev@vger.kernel.org Cc: James Chapman Subject: [PATCH net 0/3] l2tp: remove unsafe calls to l2tp_tunnel_find_nth() 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 Using l2tp_tunnel_find_nth() is racy, because the returned tunnel can go away as soon as this function returns. This series introduce l2tp_tunnel_get_nth() as a safe replacement to fixes these races. With this series, all unsafe tunnel/session lookups are finally gone. Guillaume Nault (3): l2tp: hold reference on tunnels in netlink dumps l2tp: hold reference on tunnels printed in pppol2tp proc file l2tp: hold reference on tunnels printed in l2tp/tunnels debugfs file net/l2tp/l2tp_core.c | 40 ++++++++++++++++++++-------------------- net/l2tp/l2tp_core.h | 3 ++- net/l2tp/l2tp_debugfs.c | 15 +++++++++++++-- net/l2tp/l2tp_netlink.c | 11 ++++++++--- net/l2tp/l2tp_ppp.c | 24 +++++++++++++++++------- 5 files changed, 60 insertions(+), 33 deletions(-)