Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2004344lqo; Mon, 13 May 2024 05:24:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW3n6vxelRa8ztIvyCFBJfdL+UPWdtvK6cHylMCs0XeExsT5Kli67ptfI6xqI80/ho4/tbPESnxfVq7nVjYnjr528g05ogP7A4ezg4y4w== X-Google-Smtp-Source: AGHT+IER5CcwrIMIzt0G23b5cszTObS1sgpR6Bz2X/KlvyUah5P0G16tbURrUKTcnDYrOaVQh9dJ X-Received: by 2002:a17:906:2bc6:b0:a59:c090:7781 with SMTP id a640c23a62f3a-a5a2d55a8d2mr673773666b.3.1715603068382; Mon, 13 May 2024 05:24:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715603068; cv=pass; d=google.com; s=arc-20160816; b=bGD+VXIaZMvJJrXjtSZ3/dWaAmT6lx4q2+80sWnwAOdGv7ChxhL1KEqootNbQpyi/W LXln1g2/4xFV0PNIMS1ZSIgbDryc7+loIyyJCany5lMbNPJgaC/koGPJBJdMJ8kVRY+3 ZHkKd6Yg+V0Rzll608QwzIYQ17xPh2hdysUhc3eVpGE8xNnGTu+jpHrZnZ9VClfJIDGu SalVmvjtmEbPaGrE3j2RABX8rMBk8XrzbCWbBai3WDx7FZlI64AUlBz/C+JZ11oc6Weu Ru02n0vAh433N35Da5g7izRxkdXhqhWM+GaZVgJg4AdunpgkxClzDm+wAppovm4v6yjR wP5A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=fXvZVy+O0FXOwaoVLJHn7SMWSPa7OrLUhbpPfhZ4/e8=; fh=HGGbfoQfg1XHmn+SMCb5oszJRrSGtZJ6ZQm2cG2jt4U=; b=A12q/W5BWx9Odk9GpnvP1d/4zGLaCsSCOxkwZrpf9NVGfeTl7ymuZO7hZhohcgWwDn I6kpYLEGLxE0goiBRaJ44+c008wMAHthQOPM8Mii42+KA3VeGV5p744o0BtBZh90KmA4 6Tq/OulP2grSPbAH4EI90Sv3udgfMZta8RRPRDAF/ntFucqCuw89KiXyGlpD1TJ9XupZ ILlimDdx33fOlx5lb+AYMsCrD5PdXr7YTpwTLH6YhA87egRsn/WkFlVW3XHuqdYeIH5t LfcS3stvUgpxdW63yklv3s23HAM95NqtQphRgfjOWdowA8ORvvxlpCPW778Jqq2641ne tLSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b="D8Hm/MyC"; arc=pass (i=1 spf=pass spfdomain=163.com dkim=pass dkdomain=163.com dmarc=pass fromdomain=163.com); spf=pass (google.com: domain of linux-wireless+bounces-7590-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7590-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17bd55c7si489543666b.700.2024.05.13.05.24.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 05:24:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7590-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@163.com header.s=s110527 header.b="D8Hm/MyC"; arc=pass (i=1 spf=pass spfdomain=163.com dkim=pass dkdomain=163.com dmarc=pass fromdomain=163.com); spf=pass (google.com: domain of linux-wireless+bounces-7590-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7590-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=163.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 0D7211F22289 for ; Mon, 13 May 2024 12:24:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 311E514F119; Mon, 13 May 2024 12:24:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="D8Hm/MyC" X-Original-To: linux-wireless@vger.kernel.org Received: from m16.mail.163.com (m16.mail.163.com [220.197.31.4]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6D50414EC5E for ; Mon, 13 May 2024 12:24:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=220.197.31.4 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715603065; cv=none; b=uVq3WRPtArcfU4AdSLe0+qn5s8AgK8mIHamDvGdFgEszYCWJUcr/Ndb+AWngw+w9Zow3TuDd2l6bldOaJ1ecOAz6LQQ8MX6VDEfxCUPKi41SkTodWAROFd1MtBPu8xtSELVjZ1pV4td3JjaB1rMWF6eSNcdgSSVbZlKZYyzPMLU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715603065; c=relaxed/simple; bh=nmEbUsWqZoLoKkGCEi5+yD7HIB+4LIhHoKsOYVUVX9Q=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=TNzRMx3grdEPQhaU1R4UaeW0DzIKWLRLb9I8e17LC2xWGPjLHSRU24B/QldRaO0epPd+Sjoj/jI8AyhFJhMexZPrhuC4ddatTxEXXwWmnqlm5urhWdS0CX7u2MxvlU938BbErXGGPgUV6dSIKb192y3MBvPS7B4XgJnfn1UyUiI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=D8Hm/MyC; arc=none smtp.client-ip=220.197.31.4 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=fXvZV y+O0FXOwaoVLJHn7SMWSPa7OrLUhbpPfhZ4/e8=; b=D8Hm/MyCPnHJihPxUCHiI P1HSTNEkpHjBo1Kl3c6zL2djILhqLO8vGi+XVR5Pf7U3CqY7Noey5cRHv1FSt5HU 7Dz6htONyX1b9UlIJ8BfbDgR0HGTV8EIwkl+Q16i38MalqWQeZSvCbCEZj8m6lVn vrj49TR2K73YVUDXYkYoRY= Received: from flipped.. (unknown [159.226.94.118]) by gzga-smtp-mta-g2-1 (Coremail) with SMTP id _____wD3f6dEBkJm50hfEQ--.9117S2; Mon, 13 May 2024 20:23:33 +0800 (CST) From: Sicong Huang To: nbd@nbd.name, ryder.lee@mediatek.com, shayne.chen@mediatek.com, sean.wang@mediatek.com, kvalo@kernel.org, matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com Cc: linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org, Sicong Huang Subject: [PATCH v1] wifi: mt76: mt7615: fix null pointer dereference bug Date: Mon, 13 May 2024 20:23:29 +0800 Message-Id: <20240513122329.170380-1-congei42@163.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:_____wD3f6dEBkJm50hfEQ--.9117S2 X-Coremail-Antispam: 1Uf129KBjvdXoWrZryDKr1rKr17WrykJry3CFg_yoWfCwb_WF WkuF1ftw18Gr1kKr42vr4xArW0k395Za48W3sIqrWSq39rJFZrGryavr9rGrZrCrn2vrW3 Gr1DJFyrX39IvjkaLaAFLSUrUUUUjb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUjvtCDUUUUU== X-CM-SenderInfo: 5frqwvrlusqiywtou0bp/xtbBFQfd8mXAlaaUfQAAsC Function mt7615_coredump_work will call vzalloc to allocate a large amount of memory space, the size of which is 1300KB. There should be a null pointer check after vzalloc. Otherwise, when the memory allocation fails and returns NULL, the function will cause a Kernel crash. Signed-off-by: Sicong Huang --- drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c index 7ba789834e8d..04eb52904520 100644 --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c @@ -2341,6 +2341,9 @@ void mt7615_coredump_work(struct work_struct *work) } dump = vzalloc(MT76_CONNAC_COREDUMP_SZ); + if(!dump) + return; + data = dump; while (true) { -- 2.34.1