From patchwork Mon May 13 14:34:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: sicong X-Patchwork-Id: 13663503 X-Patchwork-Delegate: nbd@nbd.name Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.5]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1383DEC0 for ; Mon, 13 May 2024 14:35:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715610924; cv=none; b=gZQkcXVnS45cAz2iTwM+tl9VvyySAd4UpG9ju9hGBJQj7giZ7dX86Qf5C/C0+LwPk9TZfGqBLAc7oysGq+QGcjHKMMIUTmXqben2BfddIXWABnFqRiZHUia+gi8MhhJWApzzEP6qxY18btgvI1xTyHiSOupVUY6wKtLUh3sz+8w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715610924; c=relaxed/simple; bh=PFnpTfOL55B98whOBYqeX5GtqS8lO3C48yZIUQx7zyc=; h=Date:From:To:Cc:Subject:Content-Type:MIME-Version:Message-ID; b=iYjqQ28u570TBWPK87vTXjdErndYYAfQUOXt4XbJG3DaEMQCf7mRQfXyqiPmaNau7yEfPzFkaiRtnGRjQqyUJccgwEJtSphkALUi5UZ7AqOK+L7h94x8nx8xka2qgZwbc5DwSto/7rPQf90N9Q2+Ny4qRF7b8FFx5KBu3yAq+Zg= 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=fail (1024-bit key) header.d=163.com header.i=@163.com header.b=Sq//C1p7 reason="signature verification failed"; arc=none smtp.client-ip=117.135.210.5 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 Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=163.com header.i=@163.com header.b="Sq//C1p7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Date:From:Subject:Content-Type:MIME-Version: Message-ID; bh=9nzg/fErxEjKWjyhShJtIW1S2P310lBM8cdNG0yqw2E=; b=S q//C1p7vO9sEZTIzIOaq5C79zEs67w1lOgXscsJi2RfqBaGaAGTChO1TTrjDwk0i bWm1rtp0gHw2qnFB9fQo4WdclAZpvefL0GX30KgT3oVok01B8IDg+Hc4S0J98bqZ 0ZVOpEWhGclYEweVc9mJIgCJy40l3qa3zUAw7ry9UY= Received: from congei42$163.com ( [159.226.94.118] ) by ajax-webmail-wmsvr-40-139 (Coremail) ; Mon, 13 May 2024 22:34:45 +0800 (CST) Date: Mon, 13 May 2024 22:34:45 +0800 (CST) From: sicong To: nbd@nbd.name, lorenzo@kernel.org, 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 Subject: [PATCH v1] wifi: mt76: mt7615: fix null pointer dereference bug X-Priority: 3 X-Mailer: Coremail Webmail Server Version XT5.0.14 build 20230109(dcb5de15) Copyright (c) 2002-2024 www.mailtech.cn 163com X-NTES-SC: AL_Qu2aB/qav0Aj4yOdYOkfm0YUj+44Wsa4uvgk2YJeOpt4jBHo2yEbXHxAJUH3z96DCxCKmxuUSSZ39+txcKNgZYAKsjYvNC++oOzKkizu8n3qqQ== Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <6206228d.bdee.18f72609cf4.Coremail.congei42@163.com> X-Coremail-Locale: zh_CN X-CM-TRANSID: _____wD3f8MFJUJmWPQkAA--.696W X-CM-SenderInfo: 5frqwvrlusqiywtou0bp/1tbizQfd8mV4HLKD6AAKs3 X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== 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 kernel crash. Fixes: de791098459d ("wifi: mt76: mt7615: fix null pointer dereference bug") 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) {