From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 7DF7734751B; Tue, 16 Jun 2026 19:04:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781636690; cv=none; b=ipcjXwFOJgyUvMInYRDdU2oWyUIlV6COUO0Xc9ZaBtKkOmITzDCOS6VjkLOD9qX0qPpi66GBRjcpUmMHmgB/vCZV3JA67KE/JUWi9H1Wjlr0IXgINI2R7ShGoUJoYy8J1MGByaBb1y5jow7mzan64PmbMPVmZ8DM0OlbRMBuw5k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781636690; c=relaxed/simple; bh=luNtPU+bUss7yadiU93brEBquHyLEznoGZRUiAWTdiA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bMwy3bKz0iaJnVQ6Cy3F/w9Csom+lBkSPiFoPnD96isVX8yGBk1m+DSeEUUbDfYEtqMhsdMwYsML3Eg1kBNuZU7+oBv9bGNK7NRtVastjTr/8I6gUb+6n9vxtnfwuhCgAz43FRxAZDGoHVYsaSt/R3oB5cAI1pVgRLrs9tcZCSU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=DsN+rThR; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="DsN+rThR" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 59A151F000E9; Tue, 16 Jun 2026 19:04:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1781636689; bh=RV+SWhR3w223iQG6Ny+2HbDJfNIPuvBGhb6WwrjhXNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=DsN+rThRalE3sDp6jsmqRRCT5COMZvmubbRfDaFCmyifHFa9zU9OlKjvyb2d6p4vF yCitc4Lh/RYDTBRK5YtFc/P0xiYrDQy0AHI8LESQ9vsrw/TMBEnJe71b6THBx3tauK UrZXzRNZbO4k5QglXcF27KJJHRprxt+IIiN2SPqg= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Marek Szyprowski , Arend van Spriel , Johannes Berg , Sasha Levin Subject: [PATCH 5.10 254/342] wifi: brcmfmac: Fix potential use-after-free issue when stopping watchdog task Date: Tue, 16 Jun 2026 20:29:10 +0530 Message-ID: <20260616145100.079932981@linuxfoundation.org> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260616145048.348037099@linuxfoundation.org> References: <20260616145048.348037099@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 5.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Marek Szyprowski [ Upstream commit c623b63580880cc742255eaed3d79804c1b91143 ] Watchdog task might end between send_sig() and kthread_stop() calls, what results in the use-after-free issue. Fix this by increasing watchdog task reference count before calling send_sig() and dropping it by switching to kthread_stop_put(). Cc: stable@vger.kernel.org Fixes: 373c83a801f1 ("brcmfmac: stop watchdog before detach and free everything") Fixes: a9ffda88be74 ("brcm80211: fmac: abstract bus_stop interface function pointer") Signed-off-by: Marek Szyprowski Acked-by: Arend van Spriel Link: https://patch.msgid.link/20260416093339.2066829-1-m.szyprowski@samsung.com Signed-off-by: Johannes Berg [ replaced kthread_stop_put() with open-coded kthread_stop() + put_task_struct() ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c @@ -2464,8 +2464,10 @@ static void brcmf_sdio_bus_stop(struct d brcmf_dbg(TRACE, "Enter\n"); if (bus->watchdog_tsk) { + get_task_struct(bus->watchdog_tsk); send_sig(SIGTERM, bus->watchdog_tsk, 1); kthread_stop(bus->watchdog_tsk); + put_task_struct(bus->watchdog_tsk); bus->watchdog_tsk = NULL; } @@ -4536,8 +4538,10 @@ void brcmf_sdio_remove(struct brcmf_sdio if (bus) { /* Stop watchdog task */ if (bus->watchdog_tsk) { + get_task_struct(bus->watchdog_tsk); send_sig(SIGTERM, bus->watchdog_tsk, 1); kthread_stop(bus->watchdog_tsk); + put_task_struct(bus->watchdog_tsk); bus->watchdog_tsk = NULL; }