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 EC6925326CD; Wed, 23 Sep 2026 14:31:45 +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=1790173907; cv=none; b=CtwcllEN6G7Ks9wiLwWh1XPws8iNLkIp43SLmW1OuwDB+jJDB6MO3XaeBrUgbTAu2qDQ9jXJHHlhbgJqzL1DtHTb8Z8hgxKN30wJMf7qtnzB4F3VUt0v8Y8Jkm1DB+LCOpr5RCrF+oFJ9oVuaZTKBctT9po3myJ+e9QSgHxk3Ho= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790173907; c=relaxed/simple; bh=CND4XWfuvWXYLj2RVz77BdQuJ9UBTmt01CivsAJL8aM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dLdVkunySEZOyi5wtF4eVn20P+KkfPrnod4Iym5t51mu87M6c8lFIEywAKpyt5dE9E3LMn7Jck0+bXgYkM5ee5ivJkZyOGTYJ3FFOSJX7soqiOKp62JcL/T9jfaK/hRHIpgXTnxMegPlTZ2iKDY2fHWLINZom/B7a3eJonyzS/g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=Eto4qx95; 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="Eto4qx95" Received: by smtp.kernel.org (Postfix) with ESMTPSA id D31BD1F000FF; Wed, 23 Sep 2026 14:31:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790173905; bh=75tDlF8nAn5UH6R3s7U4Pyx5U1kqDNzYgg8W44QWnjg=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Eto4qx95pp/fHadsZqdUC6vxXb9EbJ4rvuwarIXq5t69Sj0gMBHiG9gY5roO5atiC cxFV7DNrGUNtpz/QzFC1Oh8naU+kCrF2A863REhmUF5hb3uEB8uiD7rSxygKExfjwI NS/M+I4O4lz+MWl9jTv9CX30pGLuNNm/SEJ+P8jY= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jiangshan Yi , Arend van Spriel , Johannes Berg Subject: [PATCH 7.2 382/438] wifi: brcmsmac: fix UAF in brcms_free_timer() Date: Wed, 23 Sep 2026 16:06:43 +0200 Message-ID: <20260923140654.768725707@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260923140644.756254324@linuxfoundation.org> References: <20260923140644.756254324@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 7.2-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jiangshan Yi commit 1eeca1d5e0920fbdad6449768fd2d4364e714180 upstream. brcms_free_timer() calls brcms_del_timer() which uses the non-synchronous cancel_delayed_work() to cancel the timer's underlying delayed work. If the work callback (_brcms_timer) is already running, cancel_delayed_work() returns false without waiting, and brcms_free_timer() proceeds to kfree(t) while the callback still accesses t through container_of(). Add an explicit cancel_delayed_work_sync() after brcms_del_timer() to guarantee that any in-flight callback has completed before the timer structure is freed. Fixes: 5b435de0d786 ("net: wireless: add brcm80211 drivers") Cc: stable@vger.kernel.org Signed-off-by: Jiangshan Yi Acked-by: Arend van Spriel Link: https://patch.msgid.link/20260815121043.938414-1-yijiangshan@kylinos.cn Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmsmac/mac80211_if.c @@ -1571,6 +1571,10 @@ void brcms_free_timer(struct brcms_timer /* delete the timer in case it is active */ brcms_del_timer(t); + /* Ensure the callback has finished before freeing the timer + * structure, since brcms_del_timer() uses non-synchronous cancel. + */ + cancel_delayed_work_sync(&t->dly_wrk); if (wl->timers == t) { wl->timers = wl->timers->next;