Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp349486ybj; Mon, 4 May 2020 23:09:35 -0700 (PDT) X-Google-Smtp-Source: APiQypI2zt8+U5EdmyhMfJd4eGjuyTPyZAfVugnt6Cbxx67Y1QpC6/6+MeGM6w9uzE74pXmIjLFc X-Received: by 2002:a17:906:8282:: with SMTP id h2mr1307576ejx.250.1588658975297; Mon, 04 May 2020 23:09:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588658975; cv=none; d=google.com; s=arc-20160816; b=gWm9N4yJFrE/DUE82ed/GcLtS9Z6ffbdHNUxQ8dqC9wVgaT+vjm4EnpvARjKrCx41z EZbglcjPbNUUQ62/vbC1QQip2/IfIGVIfD5r/6dNQV+ESfKT/BmhWe2YhiVyTl8nFhRg ot7LGZ/4YGRAhMxkw7lEaVnbByLqUV0jDYaNlO783oiT+ZYi28inhYDRev8+lN8PYw9d hSud44v0Hcl669AY7y+W6TLJdxXZoFyQKw+KjugZJjPRCBKY13QBDhhBDkKW3swTMkfg Id3CYRwPFU6CWYvouEHpU59yz5YtSHm5KXFHC1C8E1Pi0ltxJGnsb5kWTe+eEd4Qu7MD A2SQ== 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=Hd7te6S50m+hUOHmKAL5qGjVQoqJ2ucNIjBwUVXEubA=; b=u50dQmfTpre2bXMPt1A2AuV3oCndK58qPzKVTuKYl+uJJ194M3xaRMCAhflKt+PP+O GCpgpuaO1FvRApoXUqf5CqgnEvYHCnaXZfaUVGD7melZVkgAozNDo5Z3gz3wmYQ89W7j r1vM24USy66dmHMK+vrPHpwE47TD2C/gONSAtnL9LWNmceLrhJhAsziSYFV5Cr3KzgA1 IRjP7Cx5Jx5MMJQYTwzajsWoI2Tiggk0zed5ZmPjfe8DsBBRTqGgNNW9rDJ75qzRGSHn 2V+H7vB1K1fr6fo/C/TWiRPVtqDN4eSeU34kOJAl1qsVZkw+OAwUCphgeInvb8OvWegr D5jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2020-01-29 header.b=Av0Il68p; 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=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y10si705269edt.393.2020.05.04.23.09.12; Mon, 04 May 2020 23:09:35 -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=@oracle.com header.s=corp-2020-01-29 header.b=Av0Il68p; 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=NONE dis=NONE) header.from=oracle.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728146AbgEEGHg (ORCPT + 99 others); Tue, 5 May 2020 02:07:36 -0400 Received: from userp2120.oracle.com ([156.151.31.85]:45300 "EHLO userp2120.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725320AbgEEGHf (ORCPT ); Tue, 5 May 2020 02:07:35 -0400 Received: from pps.filterd (userp2120.oracle.com [127.0.0.1]) by userp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04563f2W106378; Tue, 5 May 2020 06:07:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=subject : to : cc : references : from : message-id : date : mime-version : in-reply-to : content-type : content-transfer-encoding; s=corp-2020-01-29; bh=Hd7te6S50m+hUOHmKAL5qGjVQoqJ2ucNIjBwUVXEubA=; b=Av0Il68pcCYb/s6AmtrY4iUdwi6medwv7gkQA256Fs9RKlSSiHkMYyOhNzcdGolbAfM9 GGmzAbs2FS1p6XPXJxrDIKSg35U1UhbYZ55tZRogPjCzMEKWzDsrHoMlQAhkBFknK9Ng 6wbnUKteuFCMd7q/84UUs6rKVxqQIP0Sk1Z8uJbpbbxg5yeP1FRC2lZRy7wcYEGmPa6B b0DUCIfxs7KbfkY19GNn84Zr0ohr1cWWphxy9sskl8ZhqTCgGRA2W+MYDgpeGF1xZQ4G l0x3I0y61xpbdQl4fX7PSZajErxLbQgzqeqjTLHoASnYxAFmHx5fT4SG5Q0oBsY0oaNI Mg== Received: from userp3020.oracle.com (userp3020.oracle.com [156.151.31.79]) by userp2120.oracle.com with ESMTP id 30s1gn2h50-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 May 2020 06:07:26 +0000 Received: from pps.filterd (userp3020.oracle.com [127.0.0.1]) by userp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 04566dqx079123; Tue, 5 May 2020 06:07:25 GMT Received: from userv0121.oracle.com (userv0121.oracle.com [156.151.31.72]) by userp3020.oracle.com with ESMTP id 30sjjxt8t0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Tue, 05 May 2020 06:07:25 +0000 Received: from abhmp0002.oracle.com (abhmp0002.oracle.com [141.146.116.8]) by userv0121.oracle.com (8.14.4/8.13.8) with ESMTP id 04567OBE030156; Tue, 5 May 2020 06:07:24 GMT Received: from [10.191.203.202] (/10.191.203.202) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 04 May 2020 23:07:24 -0700 Subject: Re: [PATCH net] net: dsa: Do not leave DSA master with NULL netdev_ops To: Florian Fainelli , netdev@vger.kernel.org Cc: Andrew Lunn , Vivien Didelot , "David S. Miller" , Jakub Kicinski , open list References: <20200504201806.27192-1-f.fainelli@gmail.com> From: Allen Message-ID: <905b0b48-5184-3b11-2f78-e99834dbc38a@oracle.com> Date: Tue, 5 May 2020 11:37:12 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <20200504201806.27192-1-f.fainelli@gmail.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9611 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxscore=0 phishscore=0 bulkscore=0 malwarescore=0 spamscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005050050 X-Proofpoint-Virus-Version: vendor=nai engine=6000 definitions=9611 signatures=668687 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 adultscore=0 suspectscore=0 mlxscore=0 spamscore=0 clxscore=1011 priorityscore=1501 bulkscore=0 phishscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2003020000 definitions=main-2005050050 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > When ndo_get_phys_port_name() for the CPU port was added we introduced > an early check for when the DSA master network device in > dsa_master_ndo_setup() already implements ndo_get_phys_port_name(). When > we perform the teardown operation in dsa_master_ndo_teardown() we would > not be checking that cpu_dp->orig_ndo_ops was successfully allocated and > non-NULL initialized. > > With network device drivers such as virtio_net, this leads to a NPD as > soon as the DSA switch hanging off of it gets torn down because we are > now assigning the virtio_net device's netdev_ops a NULL pointer. > > Fixes: da7b9e9b00d4 ("net: dsa: Add ndo_get_phys_port_name() for CPU port") > Reported-by: Allen Pais > Signed-off-by: Florian Fainelli Tested-by: Allen Pais Thank you Florain. > --- > net/dsa/master.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/net/dsa/master.c b/net/dsa/master.c > index b5c535af63a3..a621367c6e8c 100644 > --- a/net/dsa/master.c > +++ b/net/dsa/master.c > @@ -289,7 +289,8 @@ static void dsa_master_ndo_teardown(struct net_device *dev) > { > struct dsa_port *cpu_dp = dev->dsa_ptr; > > - dev->netdev_ops = cpu_dp->orig_ndo_ops; > + if (cpu_dp->orig_ndo_ops) > + dev->netdev_ops = cpu_dp->orig_ndo_ops; > cpu_dp->orig_ndo_ops = NULL; > } > >