Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp2153243lqo; Mon, 13 May 2024 09:13:18 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVTvMtkuiql1PxXLfm2HfLvJAyP7K4mvyBJiP2R6xhlLI8Jd6pgngSdTg7AXZsylbs4eW6bkUXsL5KIIGkCdIqbiM1Ma8leaP+WfkmGvA== X-Google-Smtp-Source: AGHT+IEnJLNWdddYnN66U+S+Q3t+10WVNV4iNmLzHzCD+RYIlevsxR4SQh41sA4hr8HGkyXOb2cI X-Received: by 2002:a05:6512:3d24:b0:51d:5f0a:8839 with SMTP id 2adb3069b0e04-5220fc7c529mr11532903e87.5.1715616798400; Mon, 13 May 2024 09:13:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715616798; cv=pass; d=google.com; s=arc-20160816; b=YI3ZC0W0WMeHEEIFbGVjtUhVIxruIhTU4KA3Qm9ngb6+eq8VxUWHUWlvLwjjGihXZX CojELHLpkVstQQnlNMMuE0fCLt5ZxKLXyJajL8BrPFyT0QF9X43N78ea+9vYRxqvyvck aHUbQy6ki4mqTQu8pF4DC/RXJPCst4jtEE1PS65MLGW3oAvg5Dtdq6OndgspdupSlexb oAzSTmSG6Jdhdy4U+/7KxjxV5287uWJSPpOExuvY5EJxQ4HiszW2MYm76qAt/KgkxSDN pOwMaDxgaRo5Ap4UlEt6s5tDUUmdtMQlJYzdZUzBqRYKtuWzd73SiRS9ccRYnSkRHsaV nUxw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=LOVFZJ+BqcOUrfYAc+t3JTl1Px9e1RzXz+g9BZGFk4g=; fh=LYGYnlibOhzlGDCalJ6uyyydcKuEumnXWF+ge1bVZGw=; b=ncS0aM5qJ+hJ3MXaZWQKtu6VIQnn64zdCPWlG7t0BBURpeOlkFuO1z3k6hcwfksSAz rYPbewQSUEcfmkYbUB//2+7RPh35hIM8v+kMHROR+ZrEkTPJzDY43P2a0jgos64pH31T jXoa0QVLhPfG8anq4qXTqxRIbj1NbGQaN/OIRTSR4WeHCWcpObh89dgYJAGXYcAEyVJx VsuUd0/Z3JrHbxG1b22eyTJUQjPQTdgjSVLkfPNf+H7RH1YLL+nYsfly18rq0771OCY7 BBjA/heuotumaZoOfWJcVhCcGDZ6q+lKFgEs0P2ZZwY/SJ4nXuEz2Qe0Nq4kqfEKoxWi PcEA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=e4T9yt8z; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-7602-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7602-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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-a5a17be8bd5si529079466b.854.2024.05.13.09.13.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 May 2024 09:13:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-7602-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=@kernel.org header.s=k20201202 header.b=e4T9yt8z; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-7602-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-wireless+bounces-7602-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 21A5C1F22930 for ; Mon, 13 May 2024 16:13:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6BCDA1553A6; Mon, 13 May 2024 16:13:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="e4T9yt8z" X-Original-To: linux-wireless@vger.kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 480CA15534D for ; Mon, 13 May 2024 16:13:12 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715616792; cv=none; b=Rp7Rz8ajLwlZAR5rqag1rLqc3UFKMGMfvBihl/WIEmqU+fEr2ALZ8NOZczN1jXMy8iUjBBb/ubJwCUo7gCDffASh83Wj2+JCWcT/dBTh86n1caGOvnwRDrgEeoNKYALl/rco55Diu8X8xu1tRJl11fLIyfKbJcp5wNSPbCwHgpA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715616792; c=relaxed/simple; bh=9X9buD5qIepHwJgVEc7Tyvi2IGtdfBBEoBZf+F32eEw=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Nds6tO9VH475t6mogYA/fCmafrB3ykFhmgULnQaJ3kdJnKY2NJ7XBXfv0i2wROzV9IqeWqdlDrxRJrQ+Zrv2f1pMJX4xtN/MSC96AHUIrsGZ+pSZK9rdsO+fTFm71cjnoj+vSnUtlSeNckb02V7dGnHVm4MAc16r0rtfjTCJV8w= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=e4T9yt8z; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBBA6C2BD11; Mon, 13 May 2024 16:13:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1715616792; bh=9X9buD5qIepHwJgVEc7Tyvi2IGtdfBBEoBZf+F32eEw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=e4T9yt8zd7VwONxhyB9dqukJEUzFjzdKvhaeSeqHS1SazgSP6+4gca6CZSNOZZwLF 6AV3Gsf1pSE/BUQhM/uxyqztiDVqDanKO/8K3WjtMObBq44p9+svVN76dEdrVwHafy KcSKVZTjUzaiEc9LjNyhijFGEQtsJa9nBC/Pt5Wgv5Ze4CzfWKKmbIRFlLIw40nqMh OY4SL+jq1vruxkYZGruP4RxAWSC/nmL7iwW0E/U+0tETVov3iZL5eKtNK2T7FVo9NP GOIxTsh4cXLnAbfC9aD3dO9ClndE+kV8tdSK8me3ZBBoUFaOCDlfd+fyql1qm3cwX3 A6eovMVw1wJiw== Date: Mon, 13 May 2024 18:13:08 +0200 From: Lorenzo Bianconi To: sicong Cc: 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, linux-wireless@vger.kernel.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH v1] wifi: mt76: mt7615: fix null pointer dereference bug Message-ID: References: <6206228d.bdee.18f72609cf4.Coremail.congei42@163.com> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="Rp72CSPL56MRPJkI" Content-Disposition: inline In-Reply-To: <6206228d.bdee.18f72609cf4.Coremail.congei42@163.com> --Rp72CSPL56MRPJkI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > 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. >=20 > Fixes: de791098459d ("wifi: mt76: mt7615: fix null pointer dereference bu= g") > Signed-off-by: Sicong Huang > --- > drivers/net/wireless/mediatek/mt76/mt7615/mac.c | 3 +++ > 1 file changed, 3 insertions(+) >=20 > diff --git a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c b/drivers/ne= t/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) > } > =20 > dump =3D vzalloc(MT76_CONNAC_COREDUMP_SZ); > + if(!dump) > + return; > + > data =3D dump; > =20 > while (true) { > --=20 > 2.34.1 I guess the kernel will not crash here since we check the dump pointer in t= he while loop, we will just flush the msg_list queue. Regards, Lorenzo --Rp72CSPL56MRPJkI Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCZkI8FAAKCRA6cBh0uS2t rH1PAQC/NKiI0N81cddugxpBRaXspuRUoF19NUeJfif9gvHdsgD/VuFcYRSNEGoW GUwuGu32v2UJhfMKmHJtcJPVj6QV9g0= =8TYy -----END PGP SIGNATURE----- --Rp72CSPL56MRPJkI--