Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp20016pxb; Wed, 30 Mar 2022 21:41:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxoTadV1FnC5lHlKrt2lqKzS/p6M+o3yP8LWuEH1aOzRhkMwPncpVWKo3dra75i3JQHOBHC X-Received: by 2002:a17:90a:4bc2:b0:1b8:cdd3:53e2 with SMTP id u2-20020a17090a4bc200b001b8cdd353e2mr3868862pjl.219.1648701709901; Wed, 30 Mar 2022 21:41:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1648701709; cv=none; d=google.com; s=arc-20160816; b=s1xLsZ1ehdgj9McorYePG4ixXve/phRHrNwPpKPz0ioAa2U5h5utJPnkWcH1W7cddd dN4WVKGlkQxGdVBTENNwayoxmVUQComKdMtTSByC9dD858hz2kw0VVZvR8tMXWxppZbT sLt740eV+zhD6M4tIcvX3jsvS49pRBpIkYp8kS2Fqa79C2gf9ciWUSmkN32gmMtQ7tPL W+nt4lLfnfwMkeOgzZlNF0F87fJoxNYm2NjtaZHXR8MMjU5uSqK2z7Yy5FNSDP7hqEAd 2U0BOBvI40hFj4F6xg73dyJwWr2xgi7Kw8WR5zUQfnsd5Lc6HauowLQN+UGioVY7jnUc 1P1w== 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:date :subject:cc:to:from:message-id:dkim-signature; bh=8fJrMhzqjAXlwfUDxJahr95XCF0ybbs2a5Ofgeo9KHM=; b=M2TTb4BNlq/9R8KtkTRGL49ZZo6qy8+EBCGerXAtsy1bQGA0PnJB8SFQwVUiRvPYc3 kLP4lX1etwOQMQdLUYoQBIUsuL8VXwk5+jVWgIrQGa0k2lDhhsS829n1+AUdpGvsGRgG UlJievgW1vQlYDCTmQg3f90dMDO7UpHm2V8rBc4o60r+zueQnqwD08E9o81pwjLIeYe0 u1a0tgDYHfvMWxi+dBv4ZgDDWpKCWBI/e3rIR6HwVkOIYBeuN3PKaM74k5S7U8NGsRsa udonovENIEydpgDOfZhGSMRolR03Y2TSCJyjsbSaY+TqBcHhzq6WekKtBnOTLPUpfTLg +jTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=XxUBsLmS; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id w22-20020a056a0014d600b004fa8042c398si28098762pfu.190.2022.03.30.21.41.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 30 Mar 2022 21:41:49 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@foxmail.com header.s=s201512 header.b=XxUBsLmS; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=foxmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B0CAB24B0AB; Wed, 30 Mar 2022 20:37:01 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343674AbiC3Lec (ORCPT + 99 others); Wed, 30 Mar 2022 07:34:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57580 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343670AbiC3Leb (ORCPT ); Wed, 30 Mar 2022 07:34:31 -0400 Received: from out203-205-221-235.mail.qq.com (out203-205-221-235.mail.qq.com [203.205.221.235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05F3C1C2D96 for ; Wed, 30 Mar 2022 04:32:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foxmail.com; s=s201512; t=1648639963; bh=8fJrMhzqjAXlwfUDxJahr95XCF0ybbs2a5Ofgeo9KHM=; h=From:To:Cc:Subject:Date; b=XxUBsLmS5w86wlD/ebX5/ZdpLrf3OrecZRasUgaVhdIb0n3YRgVhg6XfOIUZb7fTf 3yykeu64PU9JsaoRojz9BJygy7lN7FhflAlUQFWx74yC2m84fD504PMeYOjyiYigZo 2hFVOZTKn+krt2Apocf8fJZXVTwgCO32wl8DxgrY= Received: from localhost.localdomain ([43.227.138.48]) by newxmesmtplogicsvrszc9.qq.com (NewEsmtp) with SMTP id 8288103E; Wed, 30 Mar 2022 19:32:40 +0800 X-QQ-mid: xmsmtpt1648639960tfxmvk268 Message-ID: X-QQ-XMAILINFO: NMGzQWUSIfvTbni/KihziXVzkQT7chenEEvQ0U9T8LGHF9mKokFevWkRDB7mgP phdQziLrbDwEstkLvoJuVEs2Jv7hbp3/79y4EHQfbs2EC3CQFpgAnGDFRqKn+iN6MQNWO1jjVdZO yMgEcHGyFOw+0it2PdatDnbOUjSEGSUTIYI49FIPPmSCtEFnzTthzt3ijvYozzLru9sUU8nuQXL9 YD4o0DXTCRk2xkbCltn0DKdZ7f2HrJEPcK4l2Sk5/jzNkxxLo2Gbf2oSowAg1lXVsOfSWh/Ne1RL bANkOOUa05NVcVUJCAJEGOqsU/HhM6qM48VsDV5r4MeIOsd2cmjxRtZUmkNlftM9thFd+D9jl+Qb eOw/hVvnRwio0w3wY9MUO2DXLD6HPeSvs28KUvNILoYjz4pYddmCmI4Q4mPHwTjWGnpJ/862qG2M mKYGeFp392TmaC0e8UI+ixI6r0TgLHnaz/Yn2pR2x6wHqkltwt7SifGhbV++9ZHEJ07Fwo5z2S15 XRyzk6vvkUR0z+2ujLkf0q7xG//jfflU2MlDqI863PPwwPYFEPdiD/JPaWiNMVyrXhJSTkGoe9V7 k2uyNuuKaXdeINzwxrX7j0wSkb5R4Yeny+mcbZZKk6cv7IkQUTg0Wkvm154Lx2TGXopbkRgh9uZA vZhSOPgxgXem5QPTJM+kmjlvkGsKaWMtGJNn6DjlKECS2iP6VETvPrhBQL33N+yhiJI3Bnlc30dA pU40rd3qLVm53AczA1iHHmW2XsdiH30DuHOxU/OLq/iZbmPoAQokGblkgtge0LLir1hY+b/IACoq gZIlItK5HWRssW96A7i2lLbHXmvKGgpr6ljMMpmN8ZmCMDzgwfHjj5zk+NflId54Prb4XnM/+FdF MgXfAskR+5sAPqT04wHwbSZhDMy8nSDfgxi3zveJql4TIcEGtQfzGiEgtz3XFCZPEeHaqgZg0n3Q sOy+eaFqptN9x9K6/0clsyDI9z2pkdvl3hdXAVvUwbxtOh8if3/g== From: xkernel.wang@foxmail.com To: Larry.Finger@lwfinger.net, phil@philpotter.co.uk, gregkh@linuxfoundation.org Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Xiaoke Wang Subject: [PATCH] staging: r8188eu: fix a potential memory leak in _rtw_init_cmd_priv() Date: Wed, 30 Mar 2022 19:32:21 +0800 X-OQ-MSGID: <20220330113221.5520-1-xkernel.wang@foxmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, 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: Xiaoke Wang In _rtw_init_cmd_priv(), if `pcmdpriv->rsp_allocated_buf` is allocated in failure, `pcmdpriv->cmd_allocated_buf` is not properly released. This patch is to free it. Signed-off-by: Xiaoke Wang --- drivers/staging/r8188eu/core/rtw_cmd.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c index 56910c3..e76015e 100644 --- a/drivers/staging/r8188eu/core/rtw_cmd.c +++ b/drivers/staging/r8188eu/core/rtw_cmd.c @@ -42,6 +42,8 @@ static int _rtw_init_cmd_priv(struct cmd_priv *pcmdpriv) pcmdpriv->rsp_allocated_buf = kzalloc(MAX_RSPSZ + 4, GFP_KERNEL); if (!pcmdpriv->rsp_allocated_buf) { + kfree(pcmdpriv->cmd_allocated_buf); + pcmdpriv->cmd_allocated_buf = NULL; res = _FAIL; goto exit; } --