From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796387705; b=lwYVPOJ49f00O/v77iRt5QoggpqEBgunyEHdFJGe9exAkcHm5UYlsrAeTeEHWrgZBwpj wrn/rURfJoAgwCycB/ioAjg11/uV1Y6BbsM9ixPzo29/DrdIAp/mNE+ioUc4OX0iOFHHP zfsebQUSpQ7vjbUrBPbt0zGPx5UY3l2iHMEhsd5AljHMD2Jl1m17as4YTH3twNFleNchu Pb54UO41cU+rqqoh64Y4VyUI1GLbJ2j5lqjnSTxFcikXi1FgR2H9/8CefN4mEAlUWBoBR UO9DonyDnb1SLw4K9so4GMtRDDg4N9ywBgOCS4SD/mqS06fKBd+E21VljNUcHyZiYcg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796387705; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=mrqBpfglA6MXSn3y6CyzU7tT7AiOLuroxCXrFwdLivM=; b=lXLhDbnX+RzVkI4sIXn92G5pgYCHR1hufYm0yM00WEO6meaD97TUUczZwpiZN7hBqvBL FgOVdq0tjxev7M7b0UpmpoLO8TSGQPnhtH0vpjs0cSDtuc1x2RTMlPq47XPwrRkAE/9LM 0pfQZDYHhILqsNX5Ku+AxwSQHZTU2iMuZRVLNkPATkpGcLYnx0Bb/E5kbWVpPBcE9zoxe 2JcHWx5mYXsR28ZrE1n1thmJx/PRNXIyjIfzNkwRBQON7q0FZjReUWLXtqGkxFbZa+5o2 l79TzydzS6xspxQ7nEy4YB4YOD2lFgpPiRfK8M3BYiWTxLV+1AZaXv3DwlJ50PE596Q== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=TBjvxaYD; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0C848606A322; Fri, 4 Dec 2026 12:35:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=TBjvxaYD Received: by smtp.kernel.org (Postfix) with ESMTPSA id 758521F00897; Fri, 4 Dec 2026 12:35:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796387704; bh=mrqBpfglA6MXSn3y6CyzU7tT7AiOLuroxCXrFwdLivM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=TBjvxaYDJZkkrUxJEnP2P2sl6BEjK75+3zMbYcqJ6xI/oO+7f7axaiQVzK0Csx8cE olhxmxaJQi/8KbxnXHfeWND4pXBWAXT8Jm7WzSnvEaEoYIn4ECNPoIzWW5rXuzk/FV i5b+iK3s/9PdbVQ4MZohc35DLwMbeg77HQTtNhzo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Felix Fietkau , Sasha Levin Subject: [PATCH 6.1 0355/1059] wifi: mt76: mt7915: guard firmware memory dump write on disabled memdump Date: Fri, 4 Dec 2026 18:58:06 +0900 Message-ID: <20261204100653.465108214@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Felix Fietkau [ Upstream commit decf5142c2d4c295684da8644d4cb93dcf956c5d ] mt7915_coredump_build()/mt7996_coredump_build() wrote dump_mem->len unconditionally, but the allocation only reserves room for the memory dump header when coredump_memdump is enabled and memdump_buf_len is non-zero. In the default configuration the allocation ends right after the fixed header, so the write landed one struct past the buffer. Only populate the memory-dump section when it was actually allocated. Fixes: 4dbcb9125cc3 ("wifi: mt76: mt7915: enable coredump support") Fixes: 878161d5d4a4 ("wifi: mt76: mt7996: enable coredump support") Signed-off-by: Felix Fietkau [ sashal: Dropped the mt7996 hunk because that driver doesn't exist in this tree, and the mt7915 hunk applies unchanged apart from a one-line context offset. ] Signed-off-by: Sasha Levin --- drivers/net/wireless/mediatek/mt76/mt7915/coredump.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/net/wireless/mediatek/mt76/mt7915/coredump.c b/drivers/net/wireless/mediatek/mt76/mt7915/coredump.c index d097a56dd33d1..ee2b454ed1860 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7915/coredump.c +++ b/drivers/net/wireless/mediatek/mt76/mt7915/coredump.c @@ -344,11 +344,12 @@ static struct mt7915_coredump *mt7915_coredump_build(struct mt7915_dev *dev) mt7915_coredump_fw_stack(dev, dump, exception); /* gather memory content */ - dump_mem = (struct mt7915_coredump_mem *)(buf + sofar); - dump_mem->len = crash_data->memdump_buf_len; - if (coredump_memdump && crash_data->memdump_buf_len) + if (coredump_memdump && crash_data->memdump_buf_len) { + dump_mem = (struct mt7915_coredump_mem *)(buf + sofar); + dump_mem->len = crash_data->memdump_buf_len; memcpy(dump_mem->data, crash_data->memdump_buf, crash_data->memdump_buf_len); + } mutex_unlock(&dev->dump_mutex); -- 2.53.0