Received: by 10.192.165.148 with SMTP id m20csp1429499imm; Sat, 5 May 2018 11:52:43 -0700 (PDT) X-Google-Smtp-Source: AB8JxZoxz0N3p1oJzBrKtEt2DAjvPEgptfFg1ITiEZqM0KFTIHcdgLa/U4S11hT+l5c/SID1YwW7 X-Received: by 10.98.137.16 with SMTP id v16mr30830767pfd.13.1525546363763; Sat, 05 May 2018 11:52:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525546363; cv=none; d=google.com; s=arc-20160816; b=XCse1O/fzMzpyv3Kb/tx76kmPUZ7nhy0FtOPBjaKu1bAqKPP+DNkhJLq2AmtTLVWt2 +lJ/1iy/IeJDqca4javiaClhOGPWJnR38UC0dV/eEs6TfHNNO1F3L4hB9fR24X1kD94w gauOJonIVK4LQd2sAh3Utsp+kMwkNs/lPGeftOs+nSMweiD44ZsyAR5QDG9M/6bcDIWC JEYoAdf+b7ypFzHzvKCoZDpbJn7J6h48/uWlp86EsDTBuaO3vvT8k9pNSRJXZKAW7ICr I1Qb9lUSqy19aiqwxPIaOYyqltBCPBBlBNVt4HfwyqH7AWTPh4oOgopmrtQdMwkeiSfZ lRPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=zpYAbkUTJtu7+XeUEET3HUK6lXygW++l9OTPHyCECiE=; b=rUKk7YWki1DhJlFJ8Dze5UwYhdZO0YOxbp4eb294Ra+kPBiMay3T+yeEm5zG7E9fmF Bh2jTrPnBB7IoB9oLhUMuX25qetqf+W8F+GkAnPsIrJGWPoS0koyoYFBx83mv2tNRDFl TCzqN8T+DV7HNw8Jar/JAwPQvAgO7yJKYtfP7sh2V0m6ztRWgxVaCbW11eLzAzeaGxrP idTN9ztte2uJlbwENErvGL6N6L6RUPYvHCRfThx6MAreiU/ktdPOPtmhwge0/ejvyDUG 8OyRIw4aY9i0xRy4QBzWWwNNptKyLiZ0Y/Hoim8o9E6LQ0G5nvZ61RuSZxVsYomzu7gx gQ4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=p39dK68n; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1-v6si18495568plb.253.2018.05.05.11.52.16; Sat, 05 May 2018 11:52:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=p39dK68n; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751829AbeEESwH (ORCPT + 99 others); Sat, 5 May 2018 14:52:07 -0400 Received: from vps0.lunn.ch ([185.16.172.187]:50274 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751252AbeEESwE (ORCPT ); Sat, 5 May 2018 14:52:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Type:MIME-Version:References:Message-ID:Subject:Cc:To:From:Date; bh=zpYAbkUTJtu7+XeUEET3HUK6lXygW++l9OTPHyCECiE=; b=p39dK68nWXSnhWOcn7HqrM4xBZv+d9VP9eroJfDP7mb6PMa4w4vGvURByIAz8aX8y2ijAN5cJiLjz68LpxV2EgSr35vKH1FuXDuXEV/5rQbYpwo93ksqIh8Os791erQ8NRHRjLFrfaROxhHv6+3v1VkDJBJMLQu32MlozaYjn/g=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1fF2HZ-00008O-72; Sat, 05 May 2018 20:51:45 +0200 Date: Sat, 5 May 2018 20:51:45 +0200 From: Andrew Lunn To: Kees Cook Cc: Salvatore Mesoraca , Florian Fainelli , Vivien Didelot , LKML , Kernel Hardening , Network Development , "David S. Miller" Subject: Re: [PATCH] net: dsa: drop some VLAs in switch.c Message-ID: <20180505185145.GB32630@lunn.ch> References: <1520970647-19587-1-git-send-email-s.mesoraca16@gmail.com> <87fu5321du.fsf@weeman.i-did-not-set--mail-host-address--so-tickle-me> <20180505153905.GA30439@lunn.ch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > You could make the bitmap part of the dsa_switch structure. This is > > allocated by dsa_switch_alloc() and is passed the number of ports. > > Doing the allocation there means you don't need to worry about it > > failing in dsa_switch_mdb_add() or dsa_switch_vlan_add(). > > Are dsa_switch_mdb_add() and dsa_switch_vlan_add() guaranteed to be > single-threaded? Yes, that is the interesting question here.... against each other, or themselves? They are called from a notifier chain. It is the same notifier chain for both dsa_switch_mdb_add() and dsa_switch_vlan_add(). notifier_call_chain() itself appears to not provide any guarantees about the same handler being called in parallel. It is dsa_port_notify() which is calling the notifier_call_chain(). This is being called by both dsa_port_vlan_add() and dsa_port_mdb_add() in dsa_slave_port_obj_add(). This is a switchdev op. switchdev_port_obj_add_now() does have ASSERT_RTNL(); So that should serialize everything. Andrew