Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp2142734rbb; Tue, 27 Feb 2024 11:58:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWJS8D9n6Xx6DudgBRW+yfRuFjEWXz2IraViuGEls8MZNrnldPnYHbnws7GLAPhx2zir3g4cRsQfZTmyQSv9Oftz/WWOdxCVdEoqqbBrA== X-Google-Smtp-Source: AGHT+IFqmgGCDi17I4w+xcilTAKK33+A98poVebFhXBUnHZY48YRifSwRd3aNiQq95/UmdPU3cCg X-Received: by 2002:a17:906:454e:b0:a42:fb21:5066 with SMTP id s14-20020a170906454e00b00a42fb215066mr5517588ejq.31.1709063931060; Tue, 27 Feb 2024 11:58:51 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709063931; cv=pass; d=google.com; s=arc-20160816; b=Lk6P1zvqXz08mzibIy92S667AJ6Vgs/scUx2hnk2A9Dey0aXRAScape4gVgjXBz3P8 RLjoZm9mqTNmG3hza0uMbbKxJc3icL9UBT95LcKBELx2FjMuYDD4/pe2qFiJTAJkCQoD 9AojdQTUat1dMJ2HhPvbys0HxRCBbE1ZqUlor+PE8m0a3a4QkgzzJ9YHRz1pg2u9EN12 YVtxQGT3puqHS+wQh+YGlt7eQmzzmMt6rXm1uaek4gdIcrwtGYVsaJFgza1DdS77awGG CQPtY2xN3yWatBEUHPruwoWYNNoddzNA/9NBbUxoT54gfoWrk4bnoHk4twQAF9Bg0v01 cmyA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :user-agent:content-transfer-encoding:references:in-reply-to:date:cc :to:from:subject:message-id; bh=dvt13SArjbfGsXnRi1RAv9tPHQcTuwLOMtEWrbA3CpY=; fh=TahmSvB2m/2znwHiBs22eBZlp5vJLl1nqP0/xAz53Ak=; b=D63I3LSKP1yD3WwGBtD2o4yiZXXuPYr9q0sRiCarns4UKeYO5kdXXVjatx3xBFWgHw kCMRBfCXV3ExPWktX3iHgQf5VMOBbfFlR3ZuZZV5i/ihLO4I0i3G1mp5psuR1xVlf34N 4YG7YoBDctuTjK0wFE2C49DCQWDqGyUkeK1MZ2ju5Gws4bQ76chKdpWW3rXLMCFCssfJ X0WyD1umP86cGksWvlQ0bs578cQvYll2NBsqpaKhW5oekp3gsS6p9c19s2mzUReF6jGu Yy/PQgEX99svnVEagAJtwT1HcgUJpRTsyYhK1JXsYRGwNboGzPFL+UHVW1jbgwlpeSU/ gM0A==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=perches.com); spf=pass (google.com: domain of linux-wireless+bounces-4114-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4114-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id f9-20020a17090660c900b00a3fb653e6a1si947203ejk.971.2024.02.27.11.58.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 11:58:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-4114-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=perches.com); spf=pass (google.com: domain of linux-wireless+bounces-4114-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-4114-linux.lists.archive=gmail.com@vger.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 A3A101F28065 for ; Tue, 27 Feb 2024 19:58:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4BECF14A081; Tue, 27 Feb 2024 19:58:45 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) (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 C6B47149DEF; Tue, 27 Feb 2024 19:58:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=216.40.44.10 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709063925; cv=none; b=E+zlQX4q7SD65wRRNKRC3VozBIk5U5THQ00dQqPjB+Fp1ZYLwHInPYNWuAU44OWVJDBEy3tbjTgqx35NzMlkxE/9ry34m/CT/rqLESteFQjzdLDPYRws+R7IFCMigRitfKdmDJxSc86ZR2RbZLwTAYLVBbEHcdm/8Q7fsffORq4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709063925; c=relaxed/simple; bh=P4sD4HUPQfVisayH8Xs+cN1CttbdVsl7C2KwjoNCd/c=; h=Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:MIME-Version; b=fMj/XdaBQvOHKavhYsDbB2k0/pIj7BIOcoPTBLrLi+sWwN8Rm/Acos/BvAYMaPb6sarMlhcfR5KxYhE/4gnJqI910tIXae9f4C1OpKzmnNMjAVrNMy6jeC1YfpaKqL72XfQOzGyC6qO+3eZynkpbVUY0ovk9Bg+wpmZLc618Ads= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com; spf=pass smtp.mailfrom=perches.com; arc=none smtp.client-ip=216.40.44.10 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=perches.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=perches.com Received: from omf16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id F25BB1C100D; Tue, 27 Feb 2024 19:58:35 +0000 (UTC) Received: from [HIDDEN] (Authenticated sender: joe@perches.com) by omf16.hostedemail.com (Postfix) with ESMTPA id 7918F2000F; Tue, 27 Feb 2024 19:58:31 +0000 (UTC) Message-ID: <421ad59de37ac6bb52c95dde2e3d4bb28590ecca.camel@perches.com> Subject: Re: [PATCH] wifi: brcm80211: handle pmk_op allocation failure From: Joe Perches To: Arend van Spriel , Duoming Zhou , linux-kernel@vger.kernel.org Cc: brcm80211-dev-list.pdl@broadcom.com, brcm80211@lists.linux.dev, linux-wireless@vger.kernel.org, justinstitt@google.com, john@keeping.me.uk, quic_alokad@quicinc.com, marcan@marcan.st, johannes.berg@intel.com, linus.walleij@linaro.org, kvalo@kernel.org Date: Tue, 27 Feb 2024 11:58:30 -0800 In-Reply-To: References: <20240227080613.34001-1-duoming@zju.edu.cn> <87166784-79ab-4eb4-ad1e-af4bc31757b7@broadcom.com> Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.48.4 (3.48.4-1.fc38) Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Rspamd-Queue-Id: 7918F2000F X-Stat-Signature: 5ecpjek1crfwbbitof44ux9oq795j1oo X-Rspamd-Server: rspamout05 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Session-ID: U2FsdGVkX196uCPc1Mhr+W6xRTIiGgxS4/v22vRLx4Y= X-HE-Tag: 1709063911-815136 X-HE-Meta: U2FsdGVkX1/eFvup7WVqYePDzElmDFKyTelnhnAvhZBAaG9nRU/946LUePwJqVPgeDaVi6NNnZR6oQ5clfR/7HRIIAmaPHKnpYGEEIGRjrY2lCmChwJGR31H8bfb2scA+M4gjeceuQGuY/5aJ9uylZKxYGL5j+aKZLSbbS3TF+s47nvl0d+diQafbBT9HSfzF/ZP+ZrBZvSqjXG6yPll4EYxlGDYjbJVJlPs26XPoitAuHsXlhwUfVh4XJ+M4NVI7xxvYaHi9+8DATgbWWEpgDt1zEpJunjTZ3QO/hYhjc1kVYX0BpvCZ9AuGGdPBCIGtBH6GYui4GbVkYfIjBK3Ud0zK5VmJiXC86GH85y2NT3aFEJ+zmRngH1mrQakLgJ9GFFEjdiIEAf+Dt6Nc+7YQG3vRcu0ZKtxeFUgaBxbkIi1YGl/ueclBzjntDxo38smjnqxAscgBXVOeoswPn0GSQ== On Tue, 2024-02-27 at 20:40 +0100, Arend van Spriel wrote: > On 2/27/2024 12:42 PM, Joe Perches wrote: > > On Tue, 2024-02-27 at 12:21 +0100, Arend van Spriel wrote: > > > On 2/27/2024 9:06 AM, Duoming Zhou wrote: > > > > The kzalloc() in brcmf_pmksa_v3_op() will return null if the > > > > physical memory has run out. As a result, if we dereference > > > > the null value, the null pointer dereference bug will happen. > > > >=20 > > > > Return -ENOMEM from brcmf_pmksa_v3_op() if kzalloc() fails > > > > for pmk_op. > > >=20 > > > NAK (see below) > > >=20 > > > Also this issue was reported earlier by Joe Perches. Not sure if he > > > wants to be mentioned as such. > >=20 > > I think it's unimportant to be mentioned. > >=20 > > I think it's more important that the code be researched > > that the simple return of -ENOMEM the appropriate fix > > and is handled by all possible callers of the function. >=20 > Right. That is what I did after which I replied on Feb 18 to your email. >=20 > https://lore.kernel.org/all/3e1f11b3-a689-4c8e-bfda-b43649db7106@broadcom= .com/ >=20 Right, I did that as well, but I didn't look up the entire calling tree. It likely works. It's also likely better than the write through of the null pointer.