Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp316497ybj; Wed, 6 May 2020 18:37:12 -0700 (PDT) X-Google-Smtp-Source: APiQypJtvz1yxFh1jirCf04+ohI4uebabh76IwtJfO/lzufwC6erIU8PP9/gcOM4r3os+M5zmI7g X-Received: by 2002:a17:906:4bc9:: with SMTP id x9mr9773106ejv.27.1588815432599; Wed, 06 May 2020 18:37:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588815432; cv=none; d=google.com; s=arc-20160816; b=jw3VatCG9eE/8sXAyVaqQk+9qzHGi3Q/0lmVfIK760cEwGjuzfYWsxZEzqaG+oKsaX N0kYvDPQfH18lCfht+Elcp8XaNp23qtCynGHp7QdRw+tiDE5xBAKU+CI06+35w/xy+m6 +QOUQaR5q2xUP9emHo9wGypTCCOKy+0tpcheKg+k95HxrQYVGjUiUdQ2VAg/VETseemk IRCpQOyZ7/R6NAwNLQ8HZtEP++UgO+axjQaodcCnqMEyqu2boKzlEqWLuDfxGpPykdkI 0KqdwyraWzyW9ZVgLjX90jreGXxFFreCoABbo3RPkvyMrUwmOyif2ATKMhBOXEpKhHPH BYVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=qEFVXmKO5kMfWeWugqhBonvnrOemaIWnCcTFn0Q/jzU=; b=yt2y5RSpe7bR31tP83SZxCgQFHRL4ldn/A7mridIJ7daUkv9CKvjKAJ+mhMOATN8w2 EO084NbFSX7D1k7/FmwhdEp90dMxIk4KbkLU1uAFU1z4FwMsdilu8iuk3m2XFF3Sc5ph Mc54iHijPj5In64YYNBjI6GNX0n67IpzHibS4alC69iT0q/es6vgNDRwDAXtUPa8nNWb o/cZrGdLNEaBLKI829j/fAb0Ub1oN8ByV6RoPdxFeGd7WeJFRM8e8XuKl2JLyaumSQ0y 9YhggmYT4V0F2UQTYEWPPkhW5uhrSOofQRUyFHGSuiN+Db0chc4Lk0FIU5gHMjuMK0L+ Nyjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="TVS1/yv2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g9si1342241ejx.46.2020.05.06.18.36.50; Wed, 06 May 2020 18:37:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="TVS1/yv2"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729918AbgEFVYS (ORCPT + 99 others); Wed, 6 May 2020 17:24:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58796 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1728878AbgEFVYR (ORCPT ); Wed, 6 May 2020 17:24:17 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 577F2C061A0F; Wed, 6 May 2020 14:24:17 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id ms17so1599417pjb.0; Wed, 06 May 2020 14:24:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=qEFVXmKO5kMfWeWugqhBonvnrOemaIWnCcTFn0Q/jzU=; b=TVS1/yv2Sppwgh2iNN17Ti7v2bNzqatDrYGLVInJ31yQlKh6dwxguQ3peYq9/FlrA9 S9X19MX/ODodXfx494AafbBQOJys6imFXVq4iu1GYDShHuDN6IhuX9PO/YPkxm2n9GOY GZy1SDwzm8mH5cZFnLKAATDHoL0w5ndeWBtoSfyN8zJhatKb0gVxuugpGKTXmPsKjXmE Uh5IVPAszfKuPU6at/vOcuALTm+1uGHu7YIqtq4ihVdLbWIkjQvW6l4XuzVpIx94c4D9 rSr3SgYVlpyiGc650Vb4uGTEu7LDHSeRuE6Xs2DlZHzCSA4T4QAxXjTliCyLOEsq0SDX YwTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=qEFVXmKO5kMfWeWugqhBonvnrOemaIWnCcTFn0Q/jzU=; b=Nr+KizACLcuKpFm9SmtP4o0bP4dD1YBVFpurXnXmnASNEtdQUzPG8CrM/h/7Gm6+WR Pr2MYk886AT+Nb24JO1gfMLu/IQqUzqB5jGv4QsOMll/7+sw9B6lycGRnQxEiG1pe63Y p9xlFh5fyXaBJ4b5mdgYeBvxRYtP9YX9/cQduSsHN/tf4yZ8oKlXfgSRW3ch2gygmIzf Og8nJ95LJTo3t2M75wxfqv81rkpNoWEDRDqSkUMouniB9O3KAUYXvuIdINq+zX3GZ/Z4 qP7FeT+dMOX3Wz2h7pewShb4Eez9kiFEoER1qUQuHSFpKoMbce6eToCurXIg0mPxvU5Q HQZA== X-Gm-Message-State: AGi0PuYi7LC2C5zOWUwDezedsfUECh3AwEFcAQ/HW+ACZg6D4qKz38WG jw00nGW/5OmGFMYjsxfvyQTVg5kf X-Received: by 2002:a17:90a:b10f:: with SMTP id z15mr12137304pjq.188.1588800256275; Wed, 06 May 2020 14:24:16 -0700 (PDT) Received: from [10.230.188.43] ([192.19.223.252]) by smtp.gmail.com with ESMTPSA id x193sm2912545pfd.54.2020.05.06.14.24.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 06 May 2020 14:24:15 -0700 (PDT) Subject: Re: [RFC net] net: dsa: Add missing reference counting To: Vivien Didelot Cc: netdev@vger.kernel.org, olteanv@gmail.com, Andrew Lunn , "David S. Miller" , Jakub Kicinski , open list References: <20200505210253.20311-1-f.fainelli@gmail.com> <20200505172302.GB1170406@t480s.localdomain> From: Florian Fainelli Message-ID: Date: Wed, 6 May 2020 14:24:14 -0700 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Firefox/68.0 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200505172302.GB1170406@t480s.localdomain> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 5/5/2020 2:23 PM, Vivien Didelot wrote: > On Tue, 5 May 2020 14:02:53 -0700, Florian Fainelli wrote: >> If we are probed through platform_data we would be intentionally >> dropping the reference count on master after dev_to_net_device() >> incremented it. If we are probed through Device Tree, >> of_find_net_device() does not do a dev_hold() at all. >> >> Ensure that the DSA master device is properly reference counted by >> holding it as soon as the CPU port is successfully initialized and later >> released during dsa_switch_release_ports(). dsa_get_tag_protocol() does >> a short de-reference, so we hold and release the master at that time, >> too. >> >> Fixes: 83c0afaec7b7 ("net: dsa: Add new binding implementation") >> Signed-off-by: Florian Fainelli > > Reviewed-by: Vivien Didelot > Andrew, Vladimir, any thoughts on that? -- Florian