From patchwork Sun Sep 20 13:26:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 313308 Delivered-To: patch@linaro.org Received: by 2002:a92:5ad1:0:0:0:0:0 with SMTP id b78csp2847387ilg; Sun, 20 Sep 2020 06:26:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxHkLmOf/2XiCmyfpkKBBAksKlavIMAbHs1ojWQQ3w3SaAxJXyhaj+OKpidaTa5hImx8V+/ X-Received: by 2002:a17:906:2354:: with SMTP id m20mr44211352eja.341.1600608394482; Sun, 20 Sep 2020 06:26:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600608394; cv=none; d=google.com; s=arc-20160816; b=Yy61KkedqK8tAFoAXsHo+Vz+MiANj16O/jVgA196DpB3Xqfgkp89wENyYmPRkQpvI9 olJQ3Z+Y85x6VQlV3erlCM7UQVB3GwTX3rMbZNGvI+62pJ0nvap8UsegN5NM7TxMtJJF AdJgQJA+wz4TraVePeXmU/m32q2k+wOxYsru0Hhf6l/O2AF4PMgBt075rDTKPE4JBnvn tzAiKFh3ZwSkmAtL4Y/Q5Pi9egXapF1h7exukNS+q8rF8fyx9S+Nh/KPNY8f/ZvUxmE9 FbksuQ6vuYzTkg6/8DWut/TCYZfql2cLP5b26vk8HO14HI8k44wEelDahDWIub2Ci+Pp kTMQ== 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=qfI2IMxoOM9twDERtHPnmwmJ1cITW8j2yls5HqlwuPE=; b=bzugh8e0YXNhfjOixopfgs0eISgW16qmVWO1Vqjy9qkUfURBPi6VMWHz2W6t/tJDMS y0o01E+f0I989lp4cP2UBDLkjYTZKcgeUgss5izSNfkoR2Z44GjJQiZlmGKqE/R8R4+o e4WlYGfHyOeXtdqlrg3UQNLaMW9xoKMp1+fPQlXb9q6SHlaFg3faqIbsbzzKikAc1OcH latusPvx5c8re9UQa3uyaO6pN6k1S9qjZdC+/ajg+8Ok3C5Om4mKckfW5Sc5J07waDi6 RSUFEDmNUrp3ZwmWXHl6GrMWl9CPMQLgmfY6dsp5b1QV+C9/rlDiXQH/r/DhDERwUZob lT+A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id mj21si6335701ejb.271.2020.09.20.06.26.34; Sun, 20 Sep 2020 06:26:34 -0700 (PDT) Received-SPF: pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of netdev-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=netdev-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726315AbgITN0a (ORCPT + 8 others); Sun, 20 Sep 2020 09:26:30 -0400 Received: from mx2.suse.de ([195.135.220.15]:35488 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726327AbgITN0Z (ORCPT ); Sun, 20 Sep 2020 09:26:25 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 4E375ADA8; Sun, 20 Sep 2020 13:26:59 +0000 (UTC) From: =?utf-8?q?Andreas_F=C3=A4rber?= To: Yan-Hsuan Chuang , Kalle Valo , linux-wireless@vger.kernel.org Cc: Chin-Yen Lee , "David S . Miller" , Jakub Kicinski , netdev@vger.kernel.org, linux-realtek-soc@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?utf-8?q?Andreas_F=C3=A4rber?= Subject: [PATCH 2/2] rtw88: Fix potential probe error handling race with wow firmware loading Date: Sun, 20 Sep 2020 15:26:21 +0200 Message-Id: <20200920132621.26468-3-afaerber@suse.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200920132621.26468-1-afaerber@suse.de> References: <20200920132621.26468-1-afaerber@suse.de> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org If rtw_core_init() fails to load the wow firmware, rtw_core_deinit() will not get called to clean up the regular firmware. Ensure that an error loading the wow firmware does not produce an oops for the regular firmware by waiting on its completion to be signalled before returning. Also release the loaded firmware. Fixes: c8e5695eae99 ("rtw88: load wowlan firmware if wowlan is supported") Cc: Chin-Yen Lee Cc: Yan-Hsuan Chuang Signed-off-by: Andreas Färber --- drivers/net/wireless/realtek/rtw88/main.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.28.0 diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c index dc48ec4b0a31..cc82c80f0433 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -1472,6 +1472,9 @@ int rtw_core_init(struct rtw_dev *rtwdev) ret = rtw_load_firmware(rtwdev, RTW_WOWLAN_FW); if (ret) { rtw_warn(rtwdev, "no wow firmware loaded\n"); + wait_for_completion(&rtwdev->fw.completion); + if (rtwdev->fw.firmware) + release_firmware(rtwdev->fw.firmware); return ret; } }