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 7433E415B82; Wed, 23 Sep 2026 14:31:52 +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=1790173913; cv=none; b=eQSf78V8bTMAoJqLlGcI2VPkXST0454ZY/ok5ADeZ9JgS1ZXH313NQlxcZtDoUYhKKar0ton3cW2rVGi7mvBhKGbOjfcYGqk2eJ32sOU+SV8BxuqSsx9uwISnpIt9HZtI2Q33W2yT+AVyBeHzTy4MgWFGQVZUibyEGzXQOVEbRo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790173913; c=relaxed/simple; bh=i8Ujl8bMmL48EpPYsvcKmeJW/8KiR2T9z5BKQ4sX1y8=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tKqAAc6UEVnAquk622NtiU96x+Tz+0VkchWOYKRbGDZaBb9ZGg0SIWpepV183msONzbOW1Ssqogh6TGIkBQrlbQUZR7i103j3hFMIjYq0EkFhV6Pu34VEmkkbd43o8xTR5NilfvghevI/NqrKblu+WUzpfmXuqX7LzeQwReeriM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=W2DAp157; 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="W2DAp157" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A2D131F000FF; Wed, 23 Sep 2026 14:31:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1790173912; bh=V84hCrzlYuSnkTQs4Br5w0S7ItZJomxyYgIK10CGsVs=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=W2DAp157ZIgIMdZcwaFOAtQGDiQICvhCwNUa1lJFd0uLEd9EgudedIzPkMtOuE62k lqx3XveHuaA00/VT9e1xS0J3kGU1iHOX6a9PKiuoFNe2S75kGH81nNSkOA6UvJmMNq EAr25He7JBYpEmoE/rDIjvxleN59RJ1wMNZgISeQ= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Jiangshan Yi , Johannes Berg Subject: [PATCH 7.2 384/438] wifi: libertas_tf: fix UAF in lbtf_free_adapter() Date: Wed, 23 Sep 2026 16:06:45 +0200 Message-ID: <20260923140654.825612120@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 bbb9a0ab96d44a64529aafc7a16de460a1712f6a upstream. lbtf_free_adapter() calls lbtf_free_cmd_buffer() to free the command buffers before calling timer_delete_sync() to wait for the command timer callback. If the timer callback (command_timer_fn) is already running when lbtf_free_cmd_buffer() frees the command array, the callback dereferences priv->cur_cmd->cmdbuf which points to freed memory. Swap the order so that timer_delete_sync() runs first, ensuring any in-flight callback has completed before the command buffers are freed. Fixes: 06b16ae53192 ("libertas_tf: main.c, data paths and mac80211 handlers") Cc: stable@vger.kernel.org Signed-off-by: Jiangshan Yi Link: https://patch.msgid.link/20260815115724.920628-1-yijiangshan@kylinos.cn Signed-off-by: Johannes Berg Signed-off-by: Greg Kroah-Hartman --- drivers/net/wireless/marvell/libertas_tf/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/wireless/marvell/libertas_tf/main.c +++ b/drivers/net/wireless/marvell/libertas_tf/main.c @@ -173,8 +173,8 @@ static int lbtf_init_adapter(struct lbtf static void lbtf_free_adapter(struct lbtf_private *priv) { lbtf_deb_enter(LBTF_DEB_MAIN); - lbtf_free_cmd_buffer(priv); timer_delete_sync(&priv->command_timer); + lbtf_free_cmd_buffer(priv); lbtf_deb_leave(LBTF_DEB_MAIN); }