Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3629494pxb; Mon, 24 Jan 2022 13:56:02 -0800 (PST) X-Google-Smtp-Source: ABdhPJxqH9kpj/o1l4PhcyBpyBI2Yr0bVRAScGY/u453r6LzRdDtkbNflAvMqcOvvDrU1N0bZ6J5 X-Received: by 2002:a17:90a:8589:: with SMTP id m9mr313510pjn.171.1643061275618; Mon, 24 Jan 2022 13:54:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643061275; cv=none; d=google.com; s=arc-20160816; b=VVLx5dZEeBtnF6PywEIXje+vYFbwIZvIotyJSIHltfe07SATmOtnG6SGPPCwmS/cCn 3ANdaGK79VC/icn+bPcDSeLT4CLJdC+TM2eSw4PGsxu51Op8TOGJ/DvgLlJGwmm++FXU 61UsuwEujrOW3IfQ2zA0EEvlx3Q0Gg4w3dGWBqhQNdnAG9+baGPKZnE6Z63lFKO2ZFvL SX6UfZuK6R1p4xrXPpRxMQnbb/xtMVq/Ov5tqfA+qLTHrJI/0iUETUyxZxGsLWI7Rcxh 8XREgDEoK4ExYlCZ9LHi58BC9yZiChT34fzQWQGOOzUz6ACQ1IxLVAdPA8UsP3Od2Rmd pyYA== 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=Yl5vqNbiaAlhSvRxxYdCcMgHATayk5ByrouDsvhJ5+5DiFUQDpmg1CDHV1n3RoYKgP 4KmdKiJSKcVvUUUQCLkfBGNpCghQbT0mLI/xb+qRAtI5UXPlaQRZ56kwm8E+iElP6GBd DdDXyqvNu5oJYEVXa7rj+vGOdUT5kop1cd5SGGvSRrjS7aAOwurZmK5H/yB4/LZOkPN7 4jq4bBTwFCzew8OrYdgWf1gLvU6oFUbLR5suQZPSq+dyuBxN6BYhjUyGdFWbMtxZ/uAI Cy1A7KGDANCwK7wCo/Zfpkkx/RssVpew/BpcrpkbBPI9b+u1l2ji+yQBShaEiwI+hQsD IxMQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=rkA0pBWp; 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 w23si14595674pll.352.2022.01.24.13.54.19; Mon, 24 Jan 2022 13:54:35 -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=rkA0pBWp; 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 S1457474AbiAXVll (ORCPT + 99 others); Mon, 24 Jan 2022 16:41:41 -0500 Received: from dfw.source.kernel.org ([139.178.84.217]:54970 "EHLO dfw.source.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1442438AbiAXVEe (ORCPT ); Mon, 24 Jan 2022 16:04:34 -0500 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 dfw.source.kernel.org (Postfix) with ESMTPS id DA294611C8; Mon, 24 Jan 2022 21:04:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B649CC340E5; Mon, 24 Jan 2022 21:04:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1643058269; bh=TVOUWNBzfDhAxoXUMjAv2R95FzmE2kWLWGzml5e+0xM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rkA0pBWpT8cSAQV4qRVyi5Q42etiWy1+2ZDb0hnlzU77ERghJyVklM3reDsphF32o DqXOxkjadu1MH0tXj21MqYleAw5NOigWP+iEzURw8tD5mh35BJ/YL3F5KOZSih2m6P eWNlASbiyi5OxyjgeQ1McqSoyOzqzAmJYfybkHls= 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.16 0227/1039] staging: rtl8192e: rtllib_module: fix error handle case in alloc_rtllib() Date: Mon, 24 Jan 2022 19:33:36 +0100 Message-Id: <20220124184132.960193685@linuxfoundation.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220124184125.121143506@linuxfoundation.org> References: <20220124184125.121143506@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