Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp3208141rdb; Tue, 6 Feb 2024 10:07:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IHHmduRpfBWRZlbw1C31LpFj9w0586zKcTJWJUP/FbMveu17l/Rs4grZrItsWsz3cDC/DjD X-Received: by 2002:a05:6a00:2d03:b0:6e0:35b1:e172 with SMTP id fa3-20020a056a002d0300b006e035b1e172mr462349pfb.3.1707242823877; Tue, 06 Feb 2024 10:07:03 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707242823; cv=pass; d=google.com; s=arc-20160816; b=Ln8/QeJgJc0q4fu4LwrBcX515ywbpnapluFuxRF6lnUfx0pE/HLmqWok8FYcyJyPzZ ha1os0M1I5ffN6WscdzTi9cJGPdOwsvsmsoEEnuUsTNTuWzaJ2QxpumpEbU5zHzUMoIh py2QZ8gJCUoKTd14uD/AH4Tcj75qbyqCgfl5NzyfV3HFIkVciX9TddeMMMuAYf/wt2Aw XrU25TIbUsDSSvLk53tDN/XbZfM8Zc6X6PyuIdRu2YhWQFUV8Rc7S4jwI/u8uPRNifaF DvRNQrB1EH2CdZpWUgQ8hZLipUA1z9fbp04IMLoFSq0hEHvcqqKsO3xw7vtd85wYxn+8 hM9Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:message-id:user-agent:cc:to:references:in-reply-to:from :subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=8DoIqEBS5RaRV494s5SplmS/edDerRMnrgYdQPfQwTY=; fh=LPwm7aeXkSlfGhZesineyXUfecjYVsuJ7U56cYZUDoY=; b=AjdYnQmRyq9biSqMBZD06ua1sjl3Xc+5wtniQF1m6c2G1jHYEnN3U5GrAHsaGGe+pW YBZgR9yzH/CdIgOd2Mhky4RXe+vGov9O/ySaH/b+XxZr0lKWsqagSfd8/ME/Ma99F+7W +gpg1TEM4c1i7xxWLq2+zzT3GMrYLdQ2nmO4VRD3wFgzruDuiTikpcfyU5EJ3NfMBiF9 D+wmTNxWrBijtvmSPLqjk553zDjL7NnKaMwOnMFZZfo/AqjZaXDo7GPS19fPcvK8VosT SvyjRSo4I0U7JXEJnN2v/JWMOYeBe8ZxVmQUq3xNwXTP/BeHHGJxUGbOAztzsGlT3LJA GWgg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r7tui5s3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-3248-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3248-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; AJvYcCX10VfQ6jsIIO4lEcERMxiRxCpxNf8wIVzLWtnTtkpqKxx48us/tXTI1cnDYLDDK8la/g1ItfFxL1/xI/nHR3Pj1m75zmfqmwVEZa/R9w== Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id p29-20020a056a0026dd00b006e04a017037si1961771pfw.209.2024.02.06.10.07.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Feb 2024 10:07:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-3248-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=r7tui5s3; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-3248-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-3248-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 8C405289EC8 for ; Tue, 6 Feb 2024 18:07:03 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7D392134A8; Tue, 6 Feb 2024 18:07:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="r7tui5s3" 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 562FC134A5; Tue, 6 Feb 2024 18:07:00 +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=1707242820; cv=none; b=scG+KNJ9TPl3cvG8/XR0wl918ZHfxJXrkA08YaGrc8KQTpf236MXhgXPkPGBNUKGIeMq3+BrFowwgZDzX7AHmVo5MSCcxkp69PorbtHP9ruhhASak4eOSbUJ3NABWJ1T86Aa+uqEnhvWxH+JXoABNCep8MGCxxqa23Tw0siEV2E= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707242820; c=relaxed/simple; bh=HvEv2Kfd6eukGI9whK4yWFO/flKDzwX8BfuUE6HpwbE=; h=Content-Type:MIME-Version:Subject:From:In-Reply-To:References:To: Cc:Message-ID:Date; b=WPWPI2y8A8tiEaPWJgU3Ygaul0xNElpei8zVfbtdZiLTagf7P+b83cs0xniPU2Q4PmZol2onJadr+ysGXdM9wKkEJ8vA8k0yGGipCKLX9VK324PlhpASMyJXnSVZSGps+1MyvPxYz1LsBoq3rEF9+obuX1CQ80/LthwuOxgne2Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r7tui5s3; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8885DC433F1; Tue, 6 Feb 2024 18:06:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1707242819; bh=HvEv2Kfd6eukGI9whK4yWFO/flKDzwX8BfuUE6HpwbE=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=r7tui5s3ZqCJds0HWpLtSd+v77o7tJ1ss/1E0cmi0CeCo/8VTZi5bnc6ekDXZvktQ +vDF9ds0Q7Uh2J3QKeHWRKtNhfzcyvzUnl5S56hv4OMVYpjN9JBOMnCiUcM66wgvRR b5CQH73p8n+4Sv3d/HCAd80099qglu+QeZT82carplk8f/daglOXS2ERCNkC89E9iA yZhnKjj61ukvhHI2xGYCZAn8qBQCL+UbRtSuVM5DEgklsblV3ABl7vfS5Rzxlid33j NMpia9BqIAYwpYv/8ygVZR8Bs8dofdG0D3np5qOza3KCQk/fbVPEom/qwWNUEibNKF r6dMZNbKrf8ag== Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: Re: [PATCH] wifi: wfx: fix memory leak when starting AP From: Kalle Valo In-Reply-To: <20240202164213.1606145-1-jerome.pouiller@silabs.com> References: <20240202164213.1606145-1-jerome.pouiller@silabs.com> To: =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org, linux-devel@silabs.com, =?utf-8?b?SsOpcsO0bWUgUG91aWxsZXI=?= , Ulrich Mohr User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.11.2 Message-ID: <170724281653.1979906.14756847148616354771.kvalo@kernel.org> Date: Tue, 6 Feb 2024 18:06:58 +0000 (UTC) Jérôme Pouiller wrote: > Kmemleak reported this error: > > unreferenced object 0xd73d1180 (size 184): > comm "wpa_supplicant", pid 1559, jiffies 13006305 (age 964.245s) > hex dump (first 32 bytes): > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > 00 00 00 00 00 00 00 00 1e 00 01 00 00 00 00 00 ................ > backtrace: > [<5ca11420>] kmem_cache_alloc+0x20c/0x5ac > [<127bdd74>] __alloc_skb+0x144/0x170 > [] __netdev_alloc_skb+0x50/0x180 > [<0f9fa1d5>] __ieee80211_beacon_get+0x290/0x4d4 [mac80211] > [<7accd02d>] ieee80211_beacon_get_tim+0x54/0x18c [mac80211] > [<41e25cc3>] wfx_start_ap+0xc8/0x234 [wfx] > [<93a70356>] ieee80211_start_ap+0x404/0x6b4 [mac80211] > [] nl80211_start_ap+0x76c/0x9e0 [cfg80211] > [<47bd8b68>] genl_rcv_msg+0x198/0x378 > [<453ef796>] netlink_rcv_skb+0xd0/0x130 > [<6b7c977a>] genl_rcv+0x34/0x44 > [<66b2d04d>] netlink_unicast+0x1b4/0x258 > [] netlink_sendmsg+0x1e8/0x428 > [] ____sys_sendmsg+0x1e0/0x274 > [] ___sys_sendmsg+0x80/0xb4 > [<69954f45>] __sys_sendmsg+0x64/0xa8 > unreferenced object 0xce087000 (size 1024): > comm "wpa_supplicant", pid 1559, jiffies 13006305 (age 964.246s) > hex dump (first 32 bytes): > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ > 10 00 07 40 00 00 00 00 00 00 00 00 00 00 00 00 ...@............ > backtrace: > [<9a993714>] __kmalloc_track_caller+0x230/0x600 > [] kmalloc_reserve.constprop.0+0x30/0x74 > [] __alloc_skb+0xa0/0x170 > [] __netdev_alloc_skb+0x50/0x180 > [<0f9fa1d5>] __ieee80211_beacon_get+0x290/0x4d4 [mac80211] > [<7accd02d>] ieee80211_beacon_get_tim+0x54/0x18c [mac80211] > [<41e25cc3>] wfx_start_ap+0xc8/0x234 [wfx] > [<93a70356>] ieee80211_start_ap+0x404/0x6b4 [mac80211] > [] nl80211_start_ap+0x76c/0x9e0 [cfg80211] > [<47bd8b68>] genl_rcv_msg+0x198/0x378 > [<453ef796>] netlink_rcv_skb+0xd0/0x130 > [<6b7c977a>] genl_rcv+0x34/0x44 > [<66b2d04d>] netlink_unicast+0x1b4/0x258 > [] netlink_sendmsg+0x1e8/0x428 > [] ____sys_sendmsg+0x1e0/0x274 > [] ___sys_sendmsg+0x80/0xb4 > > However, since the kernel is build optimized, it seems the stack is not > accurate. It appears the issue is related to wfx_set_mfp_ap(). The issue > is obvious in this function: memory allocated by ieee80211_beacon_get() > is never released. Fixing this leak makes kmemleak happy. > > Reported-by: Ulrich Mohr > Co-developed-by: Ulrich Mohr > Signed-off-by: Ulrich Mohr > Fixes: 268bceec1684 ("staging: wfx: fix BA when device is AP and MFP is enabled") > Signed-off-by: Jérôme Pouiller Patch applied to wireless-next.git, thanks. b8cfb7c819dd wifi: wfx: fix memory leak when starting AP -- https://patchwork.kernel.org/project/linux-wireless/patch/20240202164213.1606145-1-jerome.pouiller@silabs.com/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches