Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp637026pxb; Tue, 5 Apr 2022 16:50:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx12wLm+COSnPn+jzYPnDYrKKG66iWwQ68LbA989qduwJQiLXSlOiuK3/Uf6istqdesPQNs X-Received: by 2002:a17:902:ce0a:b0:156:72e2:f191 with SMTP id k10-20020a170902ce0a00b0015672e2f191mr5777333plg.76.1649202601607; Tue, 05 Apr 2022 16:50:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649202601; cv=none; d=google.com; s=arc-20160816; b=otk9ZYhhQ37l8kC2mhXBjjmC7eUmmeQ75NcpFlC8ZTFjSm0Gi1hqSQJh6K6cUQXk3E Kx+CK1sXvVm9OCbXshjjuN1K9pTfLB9AOcNavkUHwTGd23oBSkYZZwaDVBiKh095SNJe vnt2Bil2ZkQKyk912GJC6QtNagUm0MtayF4CnYEYxRnXemao2xJqO6Vs58FsS7xXwc/4 alk5YiZIPCbIG8f6pPCa6P7y7zMyT9oTmQv3HSIvsVXPn8qx1nbXLzpJJwRH4np8HDRs MqY5RBY/Th9WhnPn3M5kKXtiSjsTSls1Dj2VJ86MZkzo/r+uyEqr6MiXQXleJ7jwLW+R BmQQ== 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=AOjxvhFT8BhYmJ4lnxe6VMho9W5TO0LYx0f/rL0EEis=; b=Do0qTMmUVFTiiRn58rtDQ6C1ly/frQQnTNqT2zhVdeGlpqdswv8RUrSYZRjvQmpFvX JOo0dTQL5rB/fDZlwm7pO8N2HhLegcAU/Ibp/X9WGOO/Xd29y8hvW79sv1vAOvt0WYAI LN6fe/3GjeYn5494ZB+oRhPPjXrEYRRP3rdxGkRghInqcySlMpkRXRkWGUmtbCCRwcrb cK4TWMiOHxl5HeG2WPJzJwl90Le5vJoCCMlwXrtVBRP/IWC7X+8exEfWdE+R6rjbBnCe wJCAa/SqkiRqdwEvDA8K8GuFLUixhZk/EBdXnoFOOVm4m/N8X89feoVql42/+Sd5eJSf ovcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XHyy46fc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id o3-20020a635d43000000b003816043f14dsi1350927pgm.834.2022.04.05.16.50.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Apr 2022 16:50:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=XHyy46fc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id F37DA113D19; Tue, 5 Apr 2022 16:34:14 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242886AbiDEMzu (ORCPT + 99 others); Tue, 5 Apr 2022 08:55:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244537AbiDEJOP (ORCPT ); Tue, 5 Apr 2022 05:14:15 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B9FC6381A9; Tue, 5 Apr 2022 02:00:35 -0700 (PDT) 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 61BC5B80DA1; Tue, 5 Apr 2022 09:00:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C5909C385A1; Tue, 5 Apr 2022 09:00:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649149233; bh=RgygLs90P80dA/tn0louJwqPh2WnY93FIS08MYA5D50=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XHyy46fcIzbpju43RY6Dit4p+7SXef0BMuO+rFBjiYPS/JO1AR0xR6n02yx0+Xfx0 zWKvfYuGIa1fC+vhNI0a9+dGYKtCKUPZEn4ZWl6liuDZpjO7Ocoi4rI+Ec7+TZaBNd CRW731skZUaamDSTl5VOBb+8ayIEjLnMiL7sCzPM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Straube , Sasha Levin Subject: [PATCH 5.16 0643/1017] staging: r8188eu: release_firmware is not called if allocation fails Date: Tue, 5 Apr 2022 09:25:56 +0200 Message-Id: <20220405070413.369654764@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070354.155796697@linuxfoundation.org> References: <20220405070354.155796697@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Straube [ Upstream commit 39850edf2befe27bcb3d6c37b6ee76d2ee4df903 ] In function load_firmware() release_firmware() is not called if the allocation of pFirmware->szFwBuffer fails or if fw->size is greater than FW_8188E_SIZE. Move the call to release_firmware() to the exit label at the end of the function to fix this. Fixes: 8cd574e6af54 ("staging: r8188eu: introduce new hal dir for RTL8188eu driver") Signed-off-by: Michael Straube Link: https://lore.kernel.org/r/20220107103620.15648-4-straube.linux@gmail.com Signed-off-by: Greg Kroah-Hartman Signed-off-by: Sasha Levin --- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c index 92c3c39e098f..8656d4061059 100644 --- a/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +++ b/drivers/staging/r8188eu/hal/rtl8188e_hal_init.c @@ -540,10 +540,10 @@ static int load_firmware(struct rt_firmware *pFirmware, struct device *device) } memcpy(pFirmware->szFwBuffer, fw->data, fw->size); pFirmware->ulFwLength = fw->size; - release_firmware(fw); dev_dbg(device, "!bUsedWoWLANFw, FmrmwareLen:%d+\n", pFirmware->ulFwLength); Exit: + release_firmware(fw); return rtStatus; } -- 2.34.1