From patchwork Mon Jan 2 08:11:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miaoqian Lin X-Patchwork-Id: 38020 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp4065073wrt; Mon, 2 Jan 2023 00:21:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXsrPpC4Lz5JzAxIuAQoXWQ/hnL48Qhl6/TBORy9U6oHxrmE1hB7Ux5h0Q9YX2+s7mmHmQZm X-Received: by 2002:a05:6402:d4e:b0:46c:ab70:c009 with SMTP id ec14-20020a0564020d4e00b0046cab70c009mr31925512edb.27.1672647671958; Mon, 02 Jan 2023 00:21:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672647671; cv=none; d=google.com; s=arc-20160816; b=G4LKbftzNtlFx9tF8uVrktGuQiArQzU7Qv6GWdVVfPkYzXk4r5i9tqVCAsxhZtGXcO h+UQFXy/HCshC8bbp/XI2mBMzMcabyu5+ZDNZ98y3sB4xbubvBuDGKrMDEYiTdBdG+o7 TCBrRj4Y0U4D2K4DXRT27gCy+/wQy34K5sz83k/xYEvKhRvu0EQ258CfTtNpo7nbvHA9 bIcWSpzoJWbx0CXf29Ae5U1KqLg4Dc/OKFDcSgN/sKov1xsjslQOu//lWwZmwEAtOFut YIuGpQEVHHcwbMMdoITK1i5ijSPR4tnYrdGvwfnbimU5Yj2T/WgFoHCvh6m6oZ0ydnph MLCQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=xoAMGm4CGvulGlKzCI+T5yNGQVVBplAVmvUDydQXfE4=; b=JzQKZlQp3PefS+N6nQwGUXO/cWbFI7dxhtopk3pvMZzQDLvYZRRW1mSsRbJZnHyp/q RkSrRuBVvOajVbm+DuDjGusQN1CV59eFK6c5Jbjs2KscoPPicAlDaGqltZI98yV4SOsx W9qYlwq+R383IGh+x8knnxcrFjR+vLgkfosXG5oDByR+qx7Digsb4haDA+WZXWz0uQWX tqkqntG/7Fh9fX0l+6/pg16kOiLUNTfarGkq7L+Jknn2j/bm7WQR3XAumLJohZENrhw7 ZpLpTQqVXMLbvYxEzrQHKUEFY0wE/o0T05APK3KEQ1Q56vjQbmySyHj3P7X6nGLoXEP8 WvCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=g0YrG0K+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c20-20020a05640227d400b0046b5106d52esi25740178ede.467.2023.01.02.00.20.46; Mon, 02 Jan 2023 00:21:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=g0YrG0K+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231389AbjABIL4 (ORCPT + 99 others); Mon, 2 Jan 2023 03:11:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230509AbjABILx (ORCPT ); Mon, 2 Jan 2023 03:11:53 -0500 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 10AF7B4; Mon, 2 Jan 2023 00:11:53 -0800 (PST) Received: by mail-pj1-x1033.google.com with SMTP id c8-20020a17090a4d0800b00225c3614161so25134674pjg.5; Mon, 02 Jan 2023 00:11:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=xoAMGm4CGvulGlKzCI+T5yNGQVVBplAVmvUDydQXfE4=; b=g0YrG0K+HIe6E9s0E3k+f0UfLVIOE4dhrwK0h1beLo+prLcCLcbMoBAxYTOjCQcCD0 wFau4LuG1IqnSrVVgPCi7hA/H+LTaJMjl7NFVwJJzc8nfTUfYvL67wxus/3RrlaBcdOD 7PLtsjbqeJGBL3jUSamUIiFLnFdJCMwEOLkJVyKaHRb6vpmuRF4rAHCI4KIsssqIJ7CF z/1gpL1VQetrYPOCN2ByKr/i/SOTZYhGUmEQJ/RC/JhvMiXMyJVDucclgYtIzELuU8Uf vLM0h2nD3/i++P34kGtTkwPPzTQJ98JHsO26C48Ody/tI8dxAvX7kBBICO+EGB169O7d SE0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=xoAMGm4CGvulGlKzCI+T5yNGQVVBplAVmvUDydQXfE4=; b=DtspuNFxhhANhpb/egkv46IbIByIL0Go8OMEr2PNhmtMJrJjVq4VGwd8EYRfcD9w/Y GZS/YJCfeP6QBLtPRj4ELshs2DLXAZJMupoCYScaV24xhELr5ytroYl4X/FKUhkJVg6o 71mHUXgWo4Q8Pi0EDuu0Nl6XCBzditFx0ic0wRzjHz0AYRDVumffHtGtsPY/7A/u0N+6 hkoXQbX6OwqA6lzURpd0bUKiQx9SMleEPHqnHaG5GLjEuTRBe144So85PTSm6J7xkvt6 MdDRNg7truKAZIjNo+ITcagwfk8lzqje8GDbXlhpa1BmuDyAKBhR8TIDD90Wn+f+Z/Lp aOlg== X-Gm-Message-State: AFqh2kpPj7i10Eoi4jQeVN/9bORqWbgj00QGKDmcwiXRO2V7Sl3WLGOb MbMuLhI+FlR9zzT6WdvCkBI= X-Received: by 2002:a17:90a:e513:b0:225:fb71:efc1 with SMTP id t19-20020a17090ae51300b00225fb71efc1mr24410317pjy.0.1672647112573; Mon, 02 Jan 2023 00:11:52 -0800 (PST) Received: from localhost.localdomain ([202.120.234.246]) by smtp.googlemail.com with ESMTPSA id on16-20020a17090b1d1000b0020b21019086sm32585201pjb.3.2023.01.02.00.11.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 Jan 2023 00:11:51 -0800 (PST) From: Miaoqian Lin To: Kalle Valo , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Manikanta Pubbisetty , ath11k@lists.infradead.org, linux-wireless@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Cc: linmq006@gmail.com Subject: [PATCH v2] wifi: ath11k: Fix memory leak in ath11k_peer_rx_frag_setup Date: Mon, 2 Jan 2023 12:11:42 +0400 Message-Id: <20230102081142.3937570-1-linmq006@gmail.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1753898205373750911?= X-GMAIL-MSGID: =?utf-8?q?1753898205373750911?= crypto_alloc_shash() allocates resources, which should be released by crypto_free_shash(). When ath11k_peer_find() fails, there has memory leak. Add missing crypto_free_shash() to fix this. Fixes: 243874c64c81 ("ath11k: handle RX fragments") Signed-off-by: Miaoqian Lin Reviewed-by: Leon Romanovsky --- change in v2: - add crypto_free_shash() in the error path instead of move crypto_alloc_shash(). --- drivers/net/wireless/ath/ath11k/dp_rx.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/wireless/ath/ath11k/dp_rx.c b/drivers/net/wireless/ath/ath11k/dp_rx.c index c5a4c34d7749..0c53d88293eb 100644 --- a/drivers/net/wireless/ath/ath11k/dp_rx.c +++ b/drivers/net/wireless/ath/ath11k/dp_rx.c @@ -3126,6 +3126,7 @@ int ath11k_peer_rx_frag_setup(struct ath11k *ar, const u8 *peer_mac, int vdev_id if (!peer) { ath11k_warn(ab, "failed to find the peer to set up fragment info\n"); spin_unlock_bh(&ab->base_lock); + crypto_free_shash(tfm); return -ENOENT; }