Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3586797pxb; Mon, 24 Jan 2022 12:54:11 -0800 (PST) X-Google-Smtp-Source: ABdhPJxgp8zi/pVAw85DdeQFGZnOf05zrBuDuPWDbO+YOlGTIqHz/SqelOdV7Q7P6Ht7c5oq7dIe X-Received: by 2002:a17:90b:4a8e:: with SMTP id lp14mr77676pjb.75.1643057651119; Mon, 24 Jan 2022 12:54:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643057651; cv=none; d=google.com; s=arc-20160816; b=DyDLvxMSXptMRazSzWdiV9x/sW/X9gX78lHSl/KJIsbItPj62QMsnusm+RFZC2mjB8 wW9sqg6k8K/byqTmz5Nna8+rCnlo5jb/g6rOACizTPWHMsC3dckZ4gMXqYMgySGETIkH fo48zoUPGpJRArPZt7ATHEzT/3pHutjzV0Zufstm7QwExh2jwShKAgebFPO3TJcTYTJI 1qq5D5Uc0I3GjoiokV/JzAeok9BB0/v7EhCdQt/BoIGrYf5QVmnqu4w8WBThlNzH7gBb Qu8eqMvclT2xxiu5+hIHCB0nuPX3suMRh0dWh3Q7QSdcaFfT3zcIy7u+B0MnSofq0TSV fHPQ== 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=7NF0V5pVBtZYFfLw/hBztlLFp5+X8ikRb8zHOarZ+AI=; b=cNq76RYWgX6GYqc3qIvghhJBRFsIS78AV1GNB10fg0QUbYKNAq/9QAjPyKgyYZXAD/ 4x93fiJuakV2IWfIDJvDKrwN5Awf9xWq6qIpRo+RqHKY+BdQsRYH/MJLxos8u3T86UQk gW/vmlsamPgCjxet2zAs4HM4wsqh+XLetfydbaqa+Vm10Ko8xBFkOE73+nP3qXixW6tf wsiY9HM/SvwAsrgtc2M0TCsT8PoxDlldtTKhM+kK9fqkSVDalEEgoB6FE89c6zjfFjdt r8zauXfR1jy9WyH+jjENJN98xhdBhzeQMpQUb695+nrlb306b1QUsA28SG4chlAEwv7q 5O0g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=Yim4rdW8; 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=pass (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 h11si14543312pgj.300.2022.01.24.12.53.55; Mon, 24 Jan 2022 12:54:11 -0800 (PST) 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=@linuxfoundation.org header.s=korg header.b=Yim4rdW8; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380507AbiAXUQZ (ORCPT + 99 others); Mon, 24 Jan 2022 15:16:25 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59180 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1352696AbiAXT5b (ORCPT ); Mon, 24 Jan 2022 14:57:31 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E420C047CE0; Mon, 24 Jan 2022 11:27:51 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id AA432B811F9; Mon, 24 Jan 2022 19:27:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DA315C340E7; Mon, 24 Jan 2022 19:27:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643052469; bh=TVOUWNBzfDhAxoXUMjAv2R95FzmE2kWLWGzml5e+0xM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Yim4rdW855uNiP8MExWtHJoNutDxW8Wd8R+24/U2jroz4wfFRDIsrO46wzsD62QeZ g8sRJpdJQtia5tn651TZ2dj80+3G3NK1bOvcd+oxBJ2Y4Ba0GUnG4h3FoQ1hrj11Dd 0N0qJ5k1I8iX1qdDVvIb1SKWppdDDgE23aX6dPOU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Pavel Skripkin , Yang Yingliang , Sasha Levin Subject: [PATCH 5.4 070/320] staging: rtl8192e: rtllib_module: fix error handle case in alloc_rtllib() Date: Mon, 24 Jan 2022 19:40:54 +0100 Message-Id: <20220124183956.108196673@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124183953.750177707@linuxfoundation.org> References: <20220124183953.750177707@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: Yang Yingliang [ Upstream commit e730cd57ac2dfe94bca0f14a3be8e1b21de41a9c ] Some variables are leaked in the error handling in alloc_rtllib(), free the variables in the error path. Fixes: 94a799425eee ("From: wlanfae ") Reviewed-by: Dan Carpenter Reviewed-by: Pavel Skripkin Signed-off-by: Yang Yingliang Link: https://lore.kernel.org/r/20211202030704.2425621-3-yangyingliang@huawei.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/rtl8192e/rtllib_module.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtllib_module.c b/drivers/staging/rtl8192e/rtllib_module.c index 64d9feee1f392..f00ac94b2639b 100644 --- a/drivers/staging/rtl8192e/rtllib_module.c +++ b/drivers/staging/rtl8192e/rtllib_module.c @@ -88,7 +88,7 @@ struct net_device *alloc_rtllib(int sizeof_priv) err = rtllib_networks_allocate(ieee); if (err) { pr_err("Unable to allocate beacon storage: %d\n", err); - goto failed; + goto free_netdev; } rtllib_networks_initialize(ieee); @@ -121,11 +121,13 @@ struct net_device *alloc_rtllib(int sizeof_priv) ieee->hwsec_active = 0; memset(ieee->swcamtable, 0, sizeof(struct sw_cam_table) * 32); - rtllib_softmac_init(ieee); + err = rtllib_softmac_init(ieee); + if (err) + goto free_crypt_info; ieee->pHTInfo = kzalloc(sizeof(struct rt_hi_throughput), GFP_KERNEL); if (!ieee->pHTInfo) - return NULL; + goto free_softmac; HTUpdateDefaultSetting(ieee); HTInitializeHTInfo(ieee); @@ -141,8 +143,14 @@ struct net_device *alloc_rtllib(int sizeof_priv) return dev; - failed: +free_softmac: + rtllib_softmac_free(ieee); +free_crypt_info: + lib80211_crypt_info_free(&ieee->crypt_info); + rtllib_networks_free(ieee); +free_netdev: free_netdev(dev); + return NULL; } EXPORT_SYMBOL(alloc_rtllib); -- 2.34.1