Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp3214611rdb; Tue, 6 Feb 2024 10:17:25 -0800 (PST) X-Google-Smtp-Source: AGHT+IFZPz9elK4HhH/mpY4g50PBw/AzyhIyRDFRsoXWb3sAWKiksvoaXI1YhUUGi5uWcTnbVR0I X-Received: by 2002:a05:6a20:1456:b0:19c:9df2:216 with SMTP id a22-20020a056a20145600b0019c9df20216mr2983906pzi.17.1707243445642; Tue, 06 Feb 2024 10:17:25 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707243445; cv=pass; d=google.com; s=arc-20160816; b=iZ84A1lMmON9crWVGELDlyodrayDprN8Or9y15VWDhXifUBUdDehOq+O3PQVTCfyvh Ue7Y0Jznd1bqLK0gRinkk1oTFIAf46dRIds2CJJiNhh3En0nMY4XIVRVBHMhlXspjtK/ efPh7ekE3tzNc3cDAnOBfh5ceCfISuJlgF79tRvySm0HRrfG/+K0+zmrOlJMX4NNxXBI n8K162oMdBFxB8DHApzxehTVWjjlUuLVCiJj1TfR7uUNhuNgYQNT3ymFcu1Jgy0ofh8v s0249KBsfdEWVBmqaUc1MCBn+74H5zgk1aqsdirwnfRH2z6M5CKUkATaPKvBN9AiohG9 MQhQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:dkim-signature; bh=y4nL63sgympVlcOgoML4H1MOjPdo89UfExhp0HqzNDw=; fh=Q/etiGNLlnIa9sQ6aMla+15cICDL4nEylFH5twouoyA=; b=YZqH4cSkexijh7HWR8mfCPUhAu9rYeehx9ftS2zhk5CAYzEyCHUc+ilmJfQApFFw4X L86zjm9CLuSNsZSpRskFU0Ut6gKwneJ7R+AT10rmGff0P8/oLIcXS41gPlkA+HIn3mkS foTxSOQcR6ENNWMD1XYTs3Kt61vSFkK950cOCrv4ruMPpH98agCeCMAh+gftESOFmD8B NCDLQtSctYoiYisci2txs24sQkVVWWMosa2eXd2PHFnCmJ8A6hV2Ta1wReLiApt3PmH9 0QIq9n7sXNsluq2bpe9/Eox0x7aCLpRvCqQGi2PC1IHvdctwjB5ABNN3X+0Ztu4Wzd35 alAA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LIoxyOzE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-3252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3252-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCXZ0qLUcjEWGlO13TzSKAE0onINFSYPGwT3h6Ju0RvJrWzEWIHlgXOlqDuUuwmP9B5XWkRMcfh+6N2hsSH4ioc9W4acSjCX1JrRYQcBtg== Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d11-20020a63d70b000000b0057d7cff25besi1998656pgg.829.2024.02.06.10.17.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 10:17:25 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-3252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=LIoxyOzE; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-3252-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3252-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 8E28FB232F9 for ; Tue, 6 Feb 2024 18:17:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 20CF812B8B; Tue, 6 Feb 2024 18:17:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="LIoxyOzE" X-Original-To: linux-wireless@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F185212B71 for ; Tue, 6 Feb 2024 18:17:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707243429; cv=none; b=LpxG6ZCJqgvBNiIjm1eylRfYZPwz5Mc929GiM6j0RguxCaQsCzmIp3mBLvQZBAwQucNe/CRef3v1nFAH6riv4hPRTF6clWNSgWZK0fley2lCUs5kqiMG2gyZy8dUfPaUlgU4Zz6vieqkUK5QOjnW7TDs4m+Yxfu79uTMNGdZOqE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707243429; c=relaxed/simple; bh=xRt41RhooFxuADCIIziuiKc9zziCs/ZmRVcIu4XkzKA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:Message-ID: MIME-Version:Content-Type; b=HUsBzPvGAUczzjt6OsW48Ta3VHEqlfHgzAmya57op5pq7la24/hCr2b5t34roBAk57wMWTx8+yCnZ+ozuyg/mXsHu+XO/3KvpsDDpChRyoE/F7z3jAistf7EUUO+CWO33W9kiq+QtEICOSk+fXfinVx9UWBWqPGACtA2zu9K73k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LIoxyOzE; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id A9960C433C7; Tue, 6 Feb 2024 18:17:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707243428; bh=xRt41RhooFxuADCIIziuiKc9zziCs/ZmRVcIu4XkzKA=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=LIoxyOzEoxdhwfk2gzwON9tBZO4x4rSvzL7IrhVvRL9h+KZFfAY2ZpxZ6WiZHAzML t0eXd39bjcW6S+VjAw0Oe2RobvsT1u6GMVtmZM+ewpZLE8iHaD8HVeKMBdbh27xQcM e1hf72zlSzmrV14a1sxCDr1hRfsvPwIRvx+XBmmXSBkdzkgcSl8A3GFfU6jF30rkqI Fk9UP/UkOMqb1/LDlWD5epmY6Xo1g+lqkiQ5VmP0SAZR5zP89wG1BGKzpSynF87Wwk gQG4vNBupjepvmVFwDggKDVBmA/A8DJUTK2Hcy1DzCAkPYdqK9ZSBqubZ5VB3lWn31 BNAfT6bgQ3mFQ== From: Kalle Valo To: Kang Yang Cc: , Subject: Re: [PATCH v6 05/11] wifi: ath12k: implement handling of P2P NoA event References: <20240130040303.370590-1-quic_kangyang@quicinc.com> <20240130040303.370590-6-quic_kangyang@quicinc.com> <87plx9r2rp.fsf@kernel.org> Date: Tue, 06 Feb 2024 20:17:05 +0200 In-Reply-To: <87plx9r2rp.fsf@kernel.org> (Kalle Valo's message of "Tue, 06 Feb 2024 18:11:38 +0200") Message-ID: <87eddpqwym.fsf@kernel.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain Kalle Valo writes: > Kang Yang writes: > >> The NoA(Notice of Absence) attribute is used by the P2P Group Owner to >> signal its absence due to power save timing, concurrent operation, or >> off-channel scanning. It is also used in the P2P Presence Request-Response >> mechanism. >> >> The NoA attribute shall be present in the P2P IE in the beacon frames >> transmitted by a P2P Group Owner when a NoA schedule is being advertised, >> or when the CTWindow is non-zero. >> >> So add support to update P2P information after P2P GO is up through >> event WMI_P2P_NOA_EVENTID, and always put it in probe resp. >> >> Create p2p.c and p2p.h for P2P related functions and definitions. >> >> Tested-on: WCN7850 hw2.0 PCI WLAN.HMT.1.0.c5-00481-QCAHMTSWPL_V1.0_V2.0_SILICONZ-3 >> Tested-on: QCN9274 hw2.0 PCI WLAN.WBE.1.0.1-00029-QCAHKSWPL_SILICONZ-1 >> >> Signed-off-by: Kang Yang > > [...] > >> +static int ath12k_wmi_p2p_noa_event(struct ath12k_base *ab, >> + struct sk_buff *skb) >> +{ >> + const void **tb; >> + const struct wmi_p2p_noa_event *ev; >> + const struct ath12k_wmi_p2p_noa_info *noa; >> + struct ath12k *ar; >> + int ret, vdev_id; >> + >> + tb = ath12k_wmi_tlv_parse_alloc(ab, skb, GFP_ATOMIC); >> + if (IS_ERR(tb)) { >> + ret = PTR_ERR(tb); >> + ath12k_warn(ab, "failed to parse tlv: %d\n", ret); >> + return ret; >> + } >> + >> + ev = tb[WMI_TAG_P2P_NOA_EVENT]; >> + noa = tb[WMI_TAG_P2P_NOA_INFO]; >> + >> + if (!ev || !noa) { >> + kfree(tb); >> + return -EPROTO; >> + } >> + >> + vdev_id = __le32_to_cpu(ev->vdev_id); >> + >> + ath12k_dbg(ab, ATH12K_DBG_WMI, >> + "wmi tlv p2p noa vdev_id %i descriptors %u\n", >> + vdev_id, le32_get_bits(noa->noa_attr, WMI_P2P_NOA_INFO_DESC_NUM)); >> + ar = ath12k_mac_get_ar_by_vdev_id(ab, vdev_id); >> + if (!ar) { >> + ath12k_warn(ab, "invalid vdev id %d in P2P NoA event\n", >> + vdev_id); >> + return -EINVAL; >> + } > > Aren't we leaking tb here? In this function I revamped the error > handling to use the out label to make sure we are freeing tb in every > error. Please review: > > https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=12e182b47078a48169e873c51d438d7417e7e0c8 I realised that ret was uninitialised when no error, new version: https://git.kernel.org/pub/scm/linux/kernel/git/kvalo/ath.git/commit/?h=pending&id=43f3069f6580b8a67969a6f32377d35aa7dd8d9a -- https://patchwork.kernel.org/project/linux-wireless/list/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches