Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp2796811pxb; Mon, 25 Apr 2022 02:41:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyZFpjrbE9cXvcoh1ruuNdpH47LHDxzG2hKHrQCEbyO/Y8xckZmAAm4IxRMnKW414DclyJX X-Received: by 2002:a05:6402:2318:b0:413:7645:fa51 with SMTP id l24-20020a056402231800b004137645fa51mr18187757eda.201.1650879665139; Mon, 25 Apr 2022 02:41:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650879665; cv=none; d=google.com; s=arc-20160816; b=BVdz1wGp4f8xWUMOnfKMAnD4O0N6wcn+LYNEOAxCRqmeF3Ph68g2T4MR2927QXAu+0 CneiAJ6YVxSeXE2/6G5kh/IVx1mnEFU5RHMX0lFKpaMRE9M/hHMNhYgwJBLouu++vLuZ CwqUNataWIE8R1MSp/T3tEp2opq/7LI3jy6QMfhElCdO/R7HJfec6C63yVVhsilfllUU Lk2PVDpSJxBru60pvxJOVjKdNbUP4XSPafTf6jeyyd7VfjdPhKWR5gi64FdhHij6I++W uWQXPbdzA5n8jk3/AMl1f8ISujTXavH7iecy6n9h913xU1iLoquQQTbilNgaTvZRUVhG opKw== 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 :dkim-signature; bh=P/noh+5Uc1qGrvG4//CeRZx4MibEjRfxJ6hoprNgkUE=; b=tbRpphnR+BMxX16AtaDQ3alN8pwFHIAU0Ml3T6kcW55fY1gvX4/qWnV82QxPthYQQF WiiBtJ7bZS82vHxSFDA8++NOHM3U02shgGcthf9sQC6scMtk8NzyqI22oVxZ7ZR5Gb8g mytXamF42iLcqwiFngJODEOqRRw/1b+N8jRY2bEYOnT/bZ5G1NnL3NME04ZPAukQKzMP J3B/4U3H+a2LpR9cYGYNTkHzLk+MjVrl66qtSmfnF2084dOlI4D/1ASWUeRNpRzyDCpn oAvjKp2w/p5O9ki8qllgA8k6QZs38sIYed/Zn8yQIQLxrTTI4zlUWucsVKCiuceU91yN Ducw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VNeRnw63; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r18-20020aa7c152000000b00423e4aa6eb4si2653246edp.348.2022.04.25.02.40.40; Mon, 25 Apr 2022 02:41:05 -0700 (PDT) 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; dkim=pass header.i=@gmail.com header.s=20210112 header.b=VNeRnw63; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235325AbiDXQfF (ORCPT + 99 others); Sun, 24 Apr 2022 12:35:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50522 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235440AbiDXQe4 (ORCPT ); Sun, 24 Apr 2022 12:34:56 -0400 Received: from mail-pl1-x62a.google.com (mail-pl1-x62a.google.com [IPv6:2607:f8b0:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD5CB7644 for ; Sun, 24 Apr 2022 09:31:53 -0700 (PDT) Received: by mail-pl1-x62a.google.com with SMTP id d15so7446328plh.2 for ; Sun, 24 Apr 2022 09:31:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=P/noh+5Uc1qGrvG4//CeRZx4MibEjRfxJ6hoprNgkUE=; b=VNeRnw63/ItAEpzBOVWitrcmRTeccS46J4GatZadFJK7b0ByX4ql7Hm2dQfS4A9ORj 9bcem5WCbul3TgJrbmgK+vC9mJbWKdLyDGLhcc9OAcKJ+RrCOp4/1/YPQXi6FyIXs1Ev FnGhVSeP7Q4T7PxIj64DqQjLzaxKOoTZvXaVrXBxNpDgvRWjFkuW95e36pfVpCwVp7tU LFVVGsQwZXJw3hbmiiyjEo4iFL83q5HbEIZBjseCQM0K34+6KYWMFH55ZVANLCJtPw1x pRNjbIKdfkmSkLlUrfR/J7zQt2TIg7qhXF5cuIEIdBFImWQ+o5iuHt327eix2vDo10Cq T8QQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=P/noh+5Uc1qGrvG4//CeRZx4MibEjRfxJ6hoprNgkUE=; b=R4vxd6JFoD7czNJYHM+StkEOaUNgF8JWVLMaKbSsf5xqI+EheZqj872qCzfAue91os tyefHirnv03/6FlCAzeFWlxIlTZpWZEqcsPpCmmDykdBJDaUmpCmomY3VbahHWaXMjn+ sXpVs3OVjYbXqgqhd6gQlkWlP7o6OnVh5u8DZwPSQ/7a6rHuLaE3tJwmZ8oPw0yoB4NP E8zBy0WIQtG/twj0SVC150YKGl92DaE8HrDQNJmSJ9iOTRcS0tTakVXYY1sY72qf64UA Ctq/jcw9Ey0+tFzPySogRFq3qbvny9k4nrgScFaGJ4gCRHfrIHjp7UC+aWcbY7DxJ4bb IMhg== X-Gm-Message-State: AOAM532Iv6ulO5ZzOTMqXcmh+iawIBZ1ANQgK7PhNJ2jxSGpUlvW5Lhl s2UkfbS3hJbKmwaQP0BZfvFwZfMBZVeEiQ== X-Received: by 2002:a17:90a:5983:b0:1c9:ee11:76df with SMTP id l3-20020a17090a598300b001c9ee1176dfmr27107739pji.95.1650817913328; Sun, 24 Apr 2022 09:31:53 -0700 (PDT) Received: from makvihas.localhost.com ([2405:201:202b:15:b82e:45af:4bb0:4014]) by smtp.gmail.com with ESMTPSA id i5-20020a635845000000b003aaba2d78c2sm7113472pgm.71.2022.04.24.09.31.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Apr 2022 09:31:53 -0700 (PDT) From: Vihas Makwana To: Larry Finger , Phillip Potter , Greg Kroah-Hartman , Michael Straube Cc: linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org, Dan Carpenter , Pavel Skripkin , Vihas Makwana Subject: [PATCH 3/3] staging: r8188eu: fix null check in _rtw_free_mlme_priv Date: Sun, 24 Apr 2022 22:01:32 +0530 Message-Id: <20220424163132.37007-4-makvihas@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220424163132.37007-1-makvihas@gmail.com> References: <20220424163132.37007-1-makvihas@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, NO_RDNS_DOTCOM_HELO,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=no 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 There's a NULL check on pmlmepriv in rtw_mlme.c:112 which makes no sense as rtw_free_mlme_priv_ie_data() dereferences it unconditionally and it would have already crashed at this point. Fix this by moving rtw_free_mlme_priv_ie_data() inside the check. Signed-off-by: Vihas Makwana --- drivers/staging/r8188eu/core/rtw_mlme.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/r8188eu/core/rtw_mlme.c b/drivers/staging/r8188eu/core/rtw_mlme.c index 081c02417..87c754462 100644 --- a/drivers/staging/r8188eu/core/rtw_mlme.c +++ b/drivers/staging/r8188eu/core/rtw_mlme.c @@ -109,12 +109,10 @@ void rtw_free_mlme_priv_ie_data(struct mlme_priv *pmlmepriv) void _rtw_free_mlme_priv(struct mlme_priv *pmlmepriv) { - - rtw_free_mlme_priv_ie_data(pmlmepriv); - - if (pmlmepriv) + if (pmlmepriv) { + rtw_free_mlme_priv_ie_data(pmlmepriv); vfree(pmlmepriv->free_bss_buf); - + } } struct wlan_network *_rtw_alloc_network(struct mlme_priv *pmlmepriv)/* _queue *free_queue) */ -- 2.30.2