Received: by 2002:ab2:710b:0:b0:1ef:a325:1205 with SMTP id z11csp1147744lql; Tue, 12 Mar 2024 08:32:40 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWutsqIB+xxkUr2md0QFxjub/jmb7QwXG+mczUf3HXULjASAq9A3t0u5W7RT/FUF3hpqeaVOOUziSy/KDtINjy3S275wNMMYgjnqizW2Q== X-Google-Smtp-Source: AGHT+IFtzM22VTz3o5y5IN/eiwXijnn4yu+Z3bQF5kUftWb7VMDTGqExh/VkxhM/e0LPuY6tRQ86 X-Received: by 2002:a05:6871:828:b0:220:be2c:6083 with SMTP id q40-20020a056871082800b00220be2c6083mr2604489oap.49.1710257560050; Tue, 12 Mar 2024 08:32:40 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710257560; cv=pass; d=google.com; s=arc-20160816; b=U84Y0DPWKwYTDYBJmVqyV2QCxrQCtq0YynGoPkRu6Ygzf93g/hLkAtyE5XyvxGl6Oi D3/PuXdNwCFj/Lgr1P8ndUQCyOsVoj4sxfzpGJY865hKZdx8YgtmLpMiEsqz0F2DlgUF uWmKcGkscci+PCTlmjNa7ywbt28Urw47qBIF8qzmsGktLAuFmwIQ0eH+XW3uAR0bwWS8 uP8J5XFQYkikgqq327SfxS6UxUVpNLwoCkViQlhszSefyR95/Eib1RyPw1Do47l4Myr7 +TsH7TIaZt8E8pLNsh4YfblykHRQJufZ0zLD8wYPBc3VAsMNt26I82ayhPAG4AzN5qu7 gxyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=date:message-id:user-agent:cc:to:references:in-reply-to:from :subject:content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:dkim-signature; bh=lIAur79am2hrl2+Z66U/lumSR5NhIzDJ1VDNbHu2ZiU=; fh=CTWFbZSpZD/lGwJ7hi8weQ9tJeJVOATf0DWdPrK92Ro=; b=VG4rSBMRPbphJFKeBJDUDfUqvnHVAjmSH5gB75eSRJDIRNUccxr2NwCKS6UpPjKKjF od6n6j1/bIerTxpw+V+gu4wREgQ8D0bhGiDspOF3ZuyXJS7ux30DBD/iMFdVFoH3LUUM chKooDDpwPZ5xDQRPuD7/GXUeowGTQ7ueOt9nTZNlHqVpcaeJVRtkVlfNdzKe0QlGXCx dP/EjKjrkjl3mWn0Try3Xhzyk+mOnnV+YBBPyywjgkSZs3u9qxgg/iZiGHd9rybqzf91 FQSJZrcoIPD5VbH763c9ElCFVZ1T5Gc4jnBvZqz1Bu9Oxc6GZNBdUjkG/QnIevGSdy3t dUWw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b78phves; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-4626-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4626-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id js12-20020a0562142aac00b0068f3ecd0f6csi7439832qvb.104.2024.03.12.08.32.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Mar 2024 08:32:40 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4626-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=b78phves; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-wireless+bounces-4626-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4626-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 3BFC01C21659 for ; Tue, 12 Mar 2024 15:32:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EC5BA7C0B1; Tue, 12 Mar 2024 15:32:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="b78phves" 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 C0D4FF4FA; Tue, 12 Mar 2024 15:32:35 +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=1710257555; cv=none; b=BIHabCJG2KUSKVuxc4oDWahOC/fo6ctllVGkiJSy6ETMd+KMONevYZgW8r6O4EnHdIBVLqf928laW0Od8ZhtGnQoF0IA8ArKwtpQ5m7JIte1nRbWWC13w8Vcu+IYJcwilbF/nPwWPgzoKHyPHglDpLNPF+CHoTpV4WYnvy9qbY8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710257555; c=relaxed/simple; bh=B699QGzqbXGKmn7SCx9L3vDjnq6OqBfZza3oOdqYJNU=; h=Content-Type:MIME-Version:Subject:From:In-Reply-To:References:To: Cc:Message-ID:Date; b=hiYfMQZmY72ZjIdFYF1SozTgz/xSundkC+r+1dWdqrjFqEdnE4gNEyi5so1irXf57jHp5hSXBvTFTToM5Pra5rCUaoxB4QbWp5MyRPM0NUJU632k7Wna/62VX9qgd4TUYGZYIZT8f0SeYJ8XiyXrjRYxPAerlqDFCCJBG8hoQeE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=b78phves; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 86242C433C7; Tue, 12 Mar 2024 15:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1710257555; bh=B699QGzqbXGKmn7SCx9L3vDjnq6OqBfZza3oOdqYJNU=; h=Subject:From:In-Reply-To:References:To:Cc:Date:From; b=b78phvese5WkORrMEAdhLdcw3mIJkLLDnhOEjrrVmXijBl0xr/2M0zq+Q5uxPnZzh HiQI1cF7qYRN4gtHpLyIij87ik+RMD5x6rfW3k5p4nZwCfBcA6LCg1Y4fdkqUmXpwy omlAX26md23Dwed1LOIvKaVbsNPjkEbLc2ODA+FkQen4yfY9gje7Az3cZjix49VbPn 0PGh8sKG7A0DTvDvubdvYBwx4i3BIxEYstWK9GZoBycpEnoZa0HAqxNkBknDIVEdlI 7aH8ovhcoTA5+wY3HMrYopzo6GS+E1rTTpkVrpneiKZ70hvSMdtc0FrEsDUR1NsNcI rVHaGRImE4atA== Content-Type: text/plain; charset="utf-8" Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PATCH v2] wifi: brcmfmac: pcie: handle randbuf allocation failure From: Kalle Valo In-Reply-To: <20240306140437.18177-1-duoming@zju.edu.cn> References: <20240306140437.18177-1-duoming@zju.edu.cn> To: Duoming Zhou Cc: linux-kernel@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com, brcm80211@lists.linux.dev, linux-wireless@vger.kernel.org, minipli@grsecurity.net, hdegoede@redhat.com, arend.vanspriel@broadcom.com, arnd@arndb.de, Duoming Zhou User-Agent: pwcli/0.1.1-git (https://github.com/kvalo/pwcli/) Python/3.11.2 Message-ID: <171025755133.1969294.16879379450612075833.kvalo@kernel.org> Date: Tue, 12 Mar 2024 15:32:33 +0000 (UTC) Duoming Zhou wrote: > The kzalloc() in brcmf_pcie_download_fw_nvram() will return null > if the physical memory has run out. As a result, if we use > get_random_bytes() to generate random bytes in the randbuf, the > null pointer dereference bug will happen. > > In order to prevent allocation failure, this patch adds a separate > function using buffer on kernel stack to generate random bytes in > the randbuf, which could prevent the kernel stack from overflow. > > Fixes: 91918ce88d9f ("wifi: brcmfmac: pcie: Provide a buffer of random bytes to the device") > Suggested-by: Arnd Bergmann > Signed-off-by: Duoming Zhou Patch applied to wireless-next.git, thanks. 316f790ebcf9 wifi: brcmfmac: pcie: handle randbuf allocation failure -- https://patchwork.kernel.org/project/linux-wireless/patch/20240306140437.18177-1-duoming@zju.edu.cn/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches