From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Lunn Subject: Re: [PATCH net] net: phy: guard against accessing a NULL features bitmap Date: Fri, 11 Jan 2019 15:19:32 +0100 Message-ID: <20190111141932.GC20924@lunn.ch> References: <1547207806-30572-1-git-send-email-camelia.groza@nxp.com> <20190111133730.GA1895@lunn.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "f.fainelli@gmail.com" , "hkallweit1@gmail.com" , "davem@davemloft.net" , "oss@buserror.net" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" To: Camelia Alexandra Groza Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-Id: netdev.vger.kernel.org > > Hi Camelia > > > > A NULL features is a driver bug. So i would prefer to solve this > > differently. > > > > Please make phy_driver_register() do a WARN_ON(!new_driver->features) > > and return -EINVAL. > > I wasn't aware that features are mandatory. I'll make the change. It was not origionally, but really it should be now. > Yes, there are five drivers that don't have features configured: BCM8706, BCM8727, CS4340, TN2020 and KSZ8873MLL. > I'm planning to send patches on net-next for the Cortina and > Teranetics ones at least, but fixing the generic crash was my > priority. O.K, will take the others. Thanks Andrew From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EC0ECC43387 for ; Fri, 11 Jan 2019 14:22:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B9D502177B for ; Fri, 11 Jan 2019 14:22:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="CSe3SXHC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732781AbfAKOWI (ORCPT ); Fri, 11 Jan 2019 09:22:08 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:40351 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729624AbfAKOTi (ORCPT ); Fri, 11 Jan 2019 09:19:38 -0500 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=0RigYZLJue07QZWT7y7EUdLva04itwCInh7YyWYd71c=; b=CSe3SXHCrsRC5qnMMAFqJJA2e8kfJ524ZZIrQ8FiwIwQMpAE10KIn574spw9yj6FDG1d8K+LTnmN6oNHdUq6aXhwkyDVb/7XO3MgKweKGEMXEwpSnjKh7AY5thd5oSBHMOuBTiuZjImQWwO1kGok+4uDnjZlXfs5UlahUhYQKgM=; Received: from andrew by vps0.lunn.ch with local (Exim 4.84_2) (envelope-from ) id 1ghxem-0001Lw-Mc; Fri, 11 Jan 2019 15:19:32 +0100 Date: Fri, 11 Jan 2019 15:19:32 +0100 From: Andrew Lunn To: Camelia Alexandra Groza Cc: "f.fainelli@gmail.com" , "hkallweit1@gmail.com" , "davem@davemloft.net" , "oss@buserror.net" , "netdev@vger.kernel.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH net] net: phy: guard against accessing a NULL features bitmap Message-ID: <20190111141932.GC20924@lunn.ch> References: <1547207806-30572-1-git-send-email-camelia.groza@nxp.com> <20190111133730.GA1895@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: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Message-ID: <20190111141932.3N1thFf2pHCZxxuWdr5SlnPgLZVo9xX2zywJnEaXl0U@z> > > Hi Camelia > > > > A NULL features is a driver bug. So i would prefer to solve this > > differently. > > > > Please make phy_driver_register() do a WARN_ON(!new_driver->features) > > and return -EINVAL. > > I wasn't aware that features are mandatory. I'll make the change. It was not origionally, but really it should be now. > Yes, there are five drivers that don't have features configured: BCM8706, BCM8727, CS4340, TN2020 and KSZ8873MLL. > I'm planning to send patches on net-next for the Cortina and > Teranetics ones at least, but fixing the generic crash was my > priority. O.K, will take the others. Thanks Andrew