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 Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5720CC433EF for ; Thu, 20 Jan 2022 00:27:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345552AbiATA1m (ORCPT ); Wed, 19 Jan 2022 19:27:42 -0500 Received: from vps0.lunn.ch ([185.16.172.187]:45478 "EHLO vps0.lunn.ch" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345540AbiATA1m (ORCPT ); Wed, 19 Jan 2022 19:27:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Transfer-Encoding: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=cg29zCKERMjuyPKxQcXZu/pWt7Yhte9nUmrkJZ6zC8E=; b=hS 8hHfGEuS+dkkj2QlYphisM5pnGO2BNa+ovE8lF8Vjq4V5D6oD6ramE5YJb/gHAHe1Yw/3Zi2nYjkD RCktQtKVXp0pbwkdSwY0H+Ujb/3hQ5Q9TZJYPgCX25MC66JkJABc12EFpztIpOuMcurPAHGm4agXE 1CvT6D/6xxsOO2U=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1nALIh-001we4-FM; Thu, 20 Jan 2022 01:27:39 +0100 Date: Thu, 20 Jan 2022 01:27:39 +0100 From: Andrew Lunn To: Marek =?iso-8859-1?Q?Beh=FAn?= Cc: "netdev@vger.kernel.org" , Russell King , Sergei Shtylyov , "David S . Miller" Subject: Re: [PATCH net] phylib: fix potential use-after-free Message-ID: References: <20220119162748.32418-1-kabel@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220119162748.32418-1-kabel@kernel.org> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Wed, Jan 19, 2022 at 05:27:48PM +0100, Marek Behún wrote: > Commit bafbdd527d56 ("phylib: Add device reset GPIO support") added call > to phy_device_reset(phydev) after the put_device() call in phy_detach(). > > The comment before the put_device() call says that the phydev might go > away with put_device(). > > Fix potential use-after-free by calling phy_device_reset() before > put_device(). > > Fixes: bafbdd527d56 ("phylib: Add device reset GPIO support") > Signed-off-by: Marek Behún Reviewed-by: Andrew Lunn Andrew