Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 23B5EC64ED6 for ; Mon, 27 Feb 2023 14:07:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230124AbjB0OH5 (ORCPT ); Mon, 27 Feb 2023 09:07:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51940 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229888AbjB0OHz (ORCPT ); Mon, 27 Feb 2023 09:07:55 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFA821C7E3 for ; Mon, 27 Feb 2023 06:07:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1677506825; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=aFTvFQ3q5aWSqvyw9AelhhhkIt6I0O9TBRHfypnLJlQ=; b=GEcndyobv9GWtT9DftMcqy+RVDZRHvLBaiVaAtQobRey6fEObKRbXNVtWyBX0Fp8xPS74b osEQO+vJJzJ4Oj1pLgA52/KFbxJIniJrjFvRFa6Qexk2VJbAm2SRLvMKi5kU8ZVFlN6rBb 0mCfpP7j8wRb4gzwZgQjaWOWGiWnccw= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-319-RTsNvR7HOH2bsdSAc6baxQ-1; Mon, 27 Feb 2023 09:07:03 -0500 X-MC-Unique: RTsNvR7HOH2bsdSAc6baxQ-1 Received: by mail-wm1-f70.google.com with SMTP id y16-20020a1c4b10000000b003dd1b5d2a36so2229306wma.1 for ; Mon, 27 Feb 2023 06:07:03 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=aFTvFQ3q5aWSqvyw9AelhhhkIt6I0O9TBRHfypnLJlQ=; b=5kcYGzc4YhWd7UPTk06gVzAhCNisUHOowY08HBU9GmUA6FP9EQ4s/WeaeYjQH2OY/O 9FIzdBuhHqtWFw99MD/4Ksp01g1e/RISOI4J9q9tcciqlHTfZgSGT86qLCAhowiJSuEU fB9jGoZKRb1dP1KqBftxRlL3Q/msLizPLEM69o4M/ZMGp+O3tyId+gWJNxB2MzbVyppE ZgS/gxWJFg2AHHve/8ugpJFDQ8uFcGd0wyaCN30G7GMHnA6TYN+TvDGzbLxYZ+IAi6Z3 1HRQ/rnZN06fwEcRZc6JUsKLSvB6fvbNGq4J74bXVhfyTCUPsLyF4/4uRmio2guPnw7l e5XQ== X-Gm-Message-State: AO0yUKWD9DDetmJBcfqjh58ej61tDFJYwVnuz8iXBHjYkNVSM+Yiu/sL xQtEiCC0u9w/QCDuCIIXTBy06t1G07bAKosdI6RwqDlqkj20GXjgr86mpbxcPm0YvQ6rPgFCAYH gVsoQtaZUscqyosGje56apYaB X-Received: by 2002:a5d:4f89:0:b0:2c7:1d70:561 with SMTP id d9-20020a5d4f89000000b002c71d700561mr9516591wru.45.1677506821182; Mon, 27 Feb 2023 06:07:01 -0800 (PST) X-Google-Smtp-Source: AK7set9ec/Yueab8Bvk6eJi8LCRz4+aeuNEBluM/tCSwA288dNuu0Nq41jbKDNy7uFxhcbonKrPSew== X-Received: by 2002:a5d:4f89:0:b0:2c7:1d70:561 with SMTP id d9-20020a5d4f89000000b002c71d700561mr9516553wru.45.1677506820885; Mon, 27 Feb 2023 06:07:00 -0800 (PST) Received: from localhost (net-188-216-77-84.cust.vodafonedsl.it. [188.216.77.84]) by smtp.gmail.com with ESMTPSA id g9-20020a056000118900b002c794495f6fsm6993704wrx.117.2023.02.27.06.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 06:07:00 -0800 (PST) Date: Mon, 27 Feb 2023 15:06:58 +0100 From: Lorenzo Bianconi To: void0red Cc: angelogioacchino.delregno@collabora.com, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, kvalo@kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-wireless@vger.kernel.org, lorenzo@kernel.org, matthias.bgg@gmail.com, nbd@nbd.name, netdev@vger.kernel.org, pabeni@redhat.com, ryder.lee@mediatek.com, sean.wang@mediatek.com, shayne.chen@mediatek.com Subject: Re: [PATCH v2] wifi: mt76: add a check of vzalloc in mt7615_coredump_work Message-ID: References: <20230227135241.947052-1-void0red@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="suqa0cLxZu8I2O6i" Content-Disposition: inline In-Reply-To: <20230227135241.947052-1-void0red@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --suqa0cLxZu8I2O6i Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable > From: Kang Chen >=20 > vzalloc may fails, dump might be null and will cause > illegal address access later. >=20 > Fixes: d2bf7959d9c0 ("mt76: mt7663: introduce coredump support") > Signed-off-by: Kang Chen > --- > v2 -> v1: add Fixes tag >=20 > 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 a95602473..73d84c301 100644 > --- a/drivers/net/wireless/mediatek/mt76/mt7615/mac.c > +++ b/drivers/net/wireless/mediatek/mt76/mt7615/mac.c > @@ -2367,6 +2367,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 >=20 revieweing the code I guess the right approach would be the one used in mt7921_coredump_work(): - free pending skbs - not run dev_coredumpv() What do you think? Regards, Lorenzo --suqa0cLxZu8I2O6i Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iHUEABYKAB0WIQTquNwa3Txd3rGGn7Y6cBh0uS2trAUCY/y5AgAKCRA6cBh0uS2t rNvNAQChxct9I9hvxziffNgrIyEvdXvuQxbOt0yeiX8oblnPWwEA4qXx39acNsg6 Q0MSG7S8eufwOP2IXUXhOgXTb9tFZQw= =ErB1 -----END PGP SIGNATURE----- --suqa0cLxZu8I2O6i--