Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp12394180rwb; Sat, 26 Nov 2022 08:21:32 -0800 (PST) X-Google-Smtp-Source: AA0mqf7dVarZzOLGirdFIduycvzdX8trqGHv0LxxszJzSFY4LeWBCw+m8MER7h63ShohlN+uX1OK X-Received: by 2002:aa7:d3cb:0:b0:461:8d98:3d6d with SMTP id o11-20020aa7d3cb000000b004618d983d6dmr26880319edr.116.1669479692231; Sat, 26 Nov 2022 08:21:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669479692; cv=none; d=google.com; s=arc-20160816; b=UvngRUTIUwxJ1e3WH3l0BWmHnW7oOcY9hn54LEJ4BQof/6HrAp75Omsx5fWZtTlI9N o5xpyRajrtkAgO818F/2rP9gzD7N57m3cmhnDf/vEFF83e7V39uWAfXbuXOwR2VJoI+W TUwvq8cVHu2I/jn1dqazwwKnGLiBZ7oS53qsgV4UmhpFPVRtF4/iMjCYcBLXXcTzAl2g c2GbNG9ZH7E15QAequObiydS1jMjiKT0idOVhw6J1GNEu5vh35lKmGOkCP0V+1/kPTq+ 6cY/j1u4pdxp8vvv/6X/luz6fZ1/AJ+8SEBi4mww7kf1KLLovocpu80GeoW53jKCseTz T0yw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=1/sDCNpJgApNKSt8RsPP0ovLtlq46ONCw3xg00fmIh0=; b=InbZVz+X5JNRMGWCw8TgKAKHuEjqX6ioiGbplqAD21rNdLmZGboozYYYwSo67QV4HF 2AJDL/eWEHOif4jt0KSVVM95jtei86ouyV+TsqEjOACCEg5aDYrf65kX14yVpLpWbKUQ FFapbYDmFn8xLbM3uDfCkh9LRxu030YK9q2rgGzFbrrNdyvGSVVfFWrxZFOryDUbmsgX X9c+uyshKZSbev4aEWxDU+mlwlDkWcSbx5AD4Fu8l9czTK2VZ/LDs8GikLNr51cr44ID ZEeMCQZPQmjxZ2o84pZKgOigxIjzGGiwdMHvaV7XNUn5eSTw2D8uIV/EFSbibmTwhFPv 1plw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dp17-20020a170906c15100b007b29ccd79c0si6833993ejc.590.2022.11.26.08.21.11; Sat, 26 Nov 2022 08:21:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229737AbiKZQCL (ORCPT + 85 others); Sat, 26 Nov 2022 11:02:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52298 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229648AbiKZQBr (ORCPT ); Sat, 26 Nov 2022 11:01:47 -0500 Received: from viti.kaiser.cx (viti.kaiser.cx [IPv6:2a01:238:43fe:e600:cd0c:bd4a:7a3:8e9f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2157A193ED for ; Sat, 26 Nov 2022 08:01:46 -0800 (PST) Received: from dslb-188-096-151-149.188.096.pools.vodafone-ip.de ([188.96.151.149] helo=martin-debian-2.paytec.ch) by viti.kaiser.cx with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.89) (envelope-from ) id 1oyxca-0000Ub-21; Sat, 26 Nov 2022 17:01:40 +0100 From: Martin Kaiser To: Greg Kroah-Hartman Cc: Larry Finger , Phillip Potter , Michael Straube , Pavel Skripkin , linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Martin Kaiser Subject: [PATCH 08/10] staging: r8188eu: stop beacon processing if kmalloc fails Date: Sat, 26 Nov 2022 17:01:27 +0100 Message-Id: <20221126160129.178697-9-martin@kaiser.cx> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221126160129.178697-1-martin@kaiser.cx> References: <20221126160129.178697-1-martin@kaiser.cx> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org If we cannot allocate a struct wlan_bssid_ex in the OnBeacon function, we should stop processing the incoming beacon message and return. For kmalloc failures, the current code just skips the update of network and beacon info and tries to continue with the authentication. The update would set the encryption algorithm that should be used for the authentication. Signed-off-by: Martin Kaiser --- drivers/staging/r8188eu/core/rtw_mlme_ext.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme_ext.c b/drivers/staging/r8188eu/core/rtw_mlme_ext.c index a15998d912a7..76424bcba416 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/r8188eu/core/rtw_mlme_ext.c @@ -575,13 +575,14 @@ static void OnBeacon(struct adapter *padapter, struct recv_frame *precv_frame) if (pmlmeinfo->state & WIFI_FW_AUTH_NULL) { /* we should update current network before auth, or some IE is wrong */ pbss = kmalloc(sizeof(struct wlan_bssid_ex), GFP_ATOMIC); - if (pbss) { - if (collect_bss_info(padapter, precv_frame, pbss) == _SUCCESS) { - update_network(&pmlmepriv->cur_network.network, pbss, padapter, true); - rtw_get_bcn_info(&pmlmepriv->cur_network); - } - kfree(pbss); + if (!pbss) + return; + + if (collect_bss_info(padapter, precv_frame, pbss) == _SUCCESS) { + update_network(&pmlmepriv->cur_network.network, pbss, padapter, true); + rtw_get_bcn_info(&pmlmepriv->cur_network); } + kfree(pbss); /* check the vendor of the assoc AP */ pmlmeinfo->assoc_AP_vendor = check_assoc_AP(pframe + sizeof(struct ieee80211_hdr_3addr), len - sizeof(struct ieee80211_hdr_3addr)); -- 2.30.2