From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751606AbcFAVZu (ORCPT ); Wed, 1 Jun 2016 17:25:50 -0400 Received: from mail-lf0-f53.google.com ([209.85.215.53]:35317 "EHLO mail-lf0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750824AbcFAVZs (ORCPT ); Wed, 1 Jun 2016 17:25:48 -0400 Date: Thu, 2 Jun 2016 00:25:37 +0300 From: Max Filippov To: Colin King Cc: "David S . Miller" , Andrew Lunn , Florian Fainelli , Tobias Klauser , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH][V2] net/ethoc: fix null dereference on error exit path Message-ID: <20160601212537.GA14527@octofox.metropolis> References: <1464787010-3089-1-git-send-email-colin.king@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1464787010-3089-1-git-send-email-colin.king@canonical.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jun 01, 2016 at 02:16:50PM +0100, Colin King wrote: > From: Colin Ian King > > priv is assigned to NULL however some of the early error exit paths to > label 'free' dereference priv, causing a null pointer dereference. > > Move the label 'free' to just the free_netdev statement, and add a new > exit path 'free2' for the error cases were clk_disable_unprepare needs > calling before the final free. > > Fixes issue found by CoverityScan, CID#113260 > > Signed-off-by: Colin Ian King > --- > drivers/net/ethernet/ethoc.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) Reviewed-by: Max Filippov -- Thanks. -- Max