Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2CE1DC3DA78 for ; Sun, 15 Jan 2023 16:31:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231444AbjAOQbN (ORCPT ); Sun, 15 Jan 2023 11:31:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231197AbjAOQbK (ORCPT ); Sun, 15 Jan 2023 11:31:10 -0500 Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7D6BB4ED9 for ; Sun, 15 Jan 2023 08:31:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=fKoQ6dLHyJrJAKZsNPDqV/dOgy5iAJcNL74j+nDYi8w=; b=TzISPbbuDofx/LpvMOTlk2SlZw NxoK831+WBToAxb/YsPgg3C8WJbfxZsiQTpgWk5+C1qaVt//fPd4PYW71z3M/wSv55BaFyOMDBmDL mJibF+0n8wUXs3y0p/KZ6U4yiJzd90tfsIJvy3k/ezHvLDMM5ORtZM3y9rQ5K5yK2X0o=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1pH5uE-0028mN-V2; Sun, 15 Jan 2023 17:30:50 +0100 Date: Sun, 15 Jan 2023 17:30:50 +0100 From: Andrew Lunn To: Heiner Kallweit Cc: Russell King - ARM Linux , David Miller , Jakub Kicinski , Eric Dumazet , Paolo Abeni , "netdev@vger.kernel.org" Subject: Re: [PATCH net] net: mdio: validate parameter addr in mdiobus_get_phy() Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Sun, Jan 15, 2023 at 11:54:06AM +0100, Heiner Kallweit wrote: > The caller may pass any value as addr, what may result in an out-of-bounds > access to array mdio_map. One existing case is stmmac_init_phy() that > may pass -1 as addr. Therefore validate addr before using it. > > Fixes: 7f854420fbfe ("phy: Add API for {un}registering an mdio device to a bus.") > Signed-off-by: Heiner Kallweit Hi Heiner This makes sense, but we should also fix stmmac to not actually do this, since it is clearly wrong, and probably indicates a configuration problem for that driver. Reviewed-by: Andrew Lunn Andrew