Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp490547pxx; Wed, 28 Oct 2020 09:30:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwsoBtEFgPbfaT/OsVy53mdkpvW6bTTV+J8dMU6sHobHfY58+9EDdiuLK7iEYw4+F6onsnA X-Received: by 2002:a17:906:3413:: with SMTP id c19mr3142408ejb.421.1603902623120; Wed, 28 Oct 2020 09:30:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603902623; cv=none; d=google.com; s=arc-20160816; b=gaoc9lgJTyo2CqGb/8IV8hJsDL3hrY1RfIdcvWqsX7kdiCMPen5j1UeejQidsRB0/k shlhheWIFsZqucMkU5FoUm9o61G/YLdkCRPHe3sKZlu4jFKf+f9AcNbYiMvqBoaP33sJ RDvOaed6XExSRz2r4p/NADntDPlpW3Bj7q19pr1nvag0qH329k1pabFErdqYivIYq3eW uB9heQIivVkMjSXN3VQw03lJwUuY6TmnryZ0fRZuS2bik4MRENxZTAdPDw6ZEZ410KQN WRJozXXbG2hJOjgsqQ0fiK0g83KEHx+YTdTISdXtmqSagSHdFX0lhuj1JtiXG6/3eWDs D1+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=H3s+KpGp7YVjd+GOqBM8VPrMxyrORcbO5VJNVDX4bZ0=; b=xL0whDWeyWQeuibTNxbO9hod4hjcO9k4bk6+OL/GXo9Gycyx3RBi/icjplANFXdG1O dLZunXD+NOCu3q8iW/7FvffJ1M4V/mx9QWEqtKjpYAvDfGu/OgASSPs86TkFldzE9xP0 DYIAb8hb13H+xF5CCBWb+afuYMS0VuL3hhsey2w/Dm9HC/IrDZ5WqWmWSSqgJEbo9er+ yYGzX4Boxy9VZ3Jm4YQ0GcKA0UeLpvzaIAwn5HVIRJ5xsaerIHpPnEoOQQlSVHgrHSrl iby8/YX4hGj5e771WDwFi+M30KepyFdGQZM0qunWlMyqv9ZGTbHpPC1JSPmcotRiovF/ rM4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=eG3ngfh+; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u21si3820982ejb.621.2020.10.28.09.30.00; Wed, 28 Oct 2020 09:30:23 -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=@kernel.org header.s=default header.b=eG3ngfh+; 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=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1817059AbgJ0RMf (ORCPT + 99 others); Tue, 27 Oct 2020 13:12:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:33144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1785104AbgJ0O7o (ORCPT ); Tue, 27 Oct 2020 10:59:44 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3D7E920714; Tue, 27 Oct 2020 14:59:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810783; bh=NtXoIMJCeTROgKuaHm67EDwfKRS+kP49fIqYA68hxQs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eG3ngfh+gIEBj7ZTKWz3RpdDz6bBgU+i+XgVY8IKvPdeWiHr7JKvIh+/8Cdzipyr3 +urcbxDWISKnlzBWWnaCxCLuWKKCRnPw3M3kFkfcvCAFBfPzCblRx0Hw8IKrhSygKd V6JACTEZjUQY//agykszmjMH8NI2tngy+IGcy8dQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hulk Robot , Huang Guobin , Kalle Valo , Sasha Levin Subject: [PATCH 5.8 245/633] net: wilc1000: clean up resource in error path of init mon interface Date: Tue, 27 Oct 2020 14:49:48 +0100 Message-Id: <20201027135534.168133078@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Huang Guobin [ Upstream commit 55bd149978679742374c800e56e8f6bc74378bbe ] The wilc_wfi_init_mon_int() forgets to clean up resource when register_netdevice() failed. Add the missed call to fix it. And the return value of netdev_priv can't be NULL, so remove the unnecessary error handling. Fixes: 588713006ea4 ("staging: wilc1000: avoid the use of 'wilc_wfi_mon' static variable") Reported-by: Hulk Robot Signed-off-by: Huang Guobin Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200917123019.206382-1-huangguobin4@huawei.com Signed-off-by: Sasha Levin --- drivers/staging/wilc1000/mon.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/wilc1000/mon.c b/drivers/staging/wilc1000/mon.c index 60331417bd983..66f1c870f4f69 100644 --- a/drivers/staging/wilc1000/mon.c +++ b/drivers/staging/wilc1000/mon.c @@ -236,11 +236,10 @@ struct net_device *wilc_wfi_init_mon_interface(struct wilc *wl, if (register_netdevice(wl->monitor_dev)) { netdev_err(real_dev, "register_netdevice failed\n"); + free_netdev(wl->monitor_dev); return NULL; } priv = netdev_priv(wl->monitor_dev); - if (!priv) - return NULL; priv->real_ndev = real_dev; -- 2.25.1