Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp262977pxx; Wed, 28 Oct 2020 04:26:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzp23BAgL60JtfQM8HiftZxJSJ9hl3NP0ChO0sZ7byDlreZZ4qbDDKd1PpYgeK/9ziqxYE X-Received: by 2002:aa7:d6da:: with SMTP id x26mr6982008edr.238.1603884377378; Wed, 28 Oct 2020 04:26:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603884377; cv=none; d=google.com; s=arc-20160816; b=L0F66d3lkGAa3TB1Gg91SP30DG9lgXZ/vxpr9pzLcAQtxpkxNLH3tuVnUFSgLTnLCX rNSaJD/yWnYgsLA2cKSu3eHWZJOEB6Oja8vnBATY6yLiAq0uojvN9MSgyoyAwQUYSaH3 gEGYnk/gRrj8Klrm2E88jA8FgPIggE6qN4IZtUg2YTjMK/TE0cnFqW+RodliRd+72dVj Pzf7p3351uhSdD9HaKIwso5J1zWtN2t0YFfXcqGfro+3ivM9BrU5vjmvbT9pOC8fcBQq FKsD7IR1+2YBhVIxmysR3SeCDbsHUwKP7kro2TRSEGEuDiOslJcz9DFl4Fm8scMTH125 BVSQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=7LMmsuyfG+iIUeAqc+jDOLUxRD/9Yf13ubUi51F1ZaY=; b=x/LuT9ocZXkPh1QNLNgNAIuxoTC6TQ79O9gP+WRQEy+G1J7pFw52d7nijp6sRtx35n EggAnueLUvPtW1x1pQJ2/V6qLX0XKcOC/rFOL8DkwRI0Zc1C4XRcPgltoGBwqvf7aLQK TxSDhmLUrVByOP5aGJcpscd4dSH2uLibnazYO78UrzRccDltVBRcrj9d8kM5HoiJNr7k T6ufflaVDpZh55+twRfTGk9V2BjNNA0O90lRgGkGHo8LXi1GVuvM3u1/r4+To8sYJXLB l7X7u+n5h2zhrvSdKmRdVFhri3fTNw7cG9HjMujbVIsE7FNfMLPiwa08nAMFRzXqXdtK 5NEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tZ0HzhZo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p19si2741759edu.169.2020.10.28.04.25.55; Wed, 28 Oct 2020 04:26:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=tZ0HzhZo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2504809AbgJ0PDh (ORCPT + 99 others); Tue, 27 Oct 2020 11:03:37 -0400 Received: from mail.kernel.org ([198.145.29.99]:33324 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1787079AbgJ0O76 (ORCPT ); Tue, 27 Oct 2020 10:59:58 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A817820715; Tue, 27 Oct 2020 14:59:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810798; bh=bBAZKnnaphTaOGpknk2rJ10sEiOSsZlFfbur2kyL2E4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tZ0HzhZoGBvlGsGWC2mHsdOPnaGAcWn3EJaSpwBiudoxmW5ucOFe2gXpfAyHQ008o G9LMbzzMJHD9j8Jr7tJCYmEsQ8E//cougWv6n8bQ85X6QgIsOHKJ5nQ9B+ufGETiG8 ylYz29JcCWtxQ9gPSnOZ/LP698uod5P9tXBIFyvM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chin-Yen Lee , Yan-Hsuan Chuang , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Kalle Valo , Sasha Levin Subject: [PATCH 5.8 267/633] rtw88: Fix potential probe error handling race with wow firmware loading Date: Tue, 27 Oct 2020 14:50:10 +0100 Message-Id: <20201027135535.193950731@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andreas Färber [ Upstream commit ac4bac99161e8f7a7a9faef70d8ca8f69d5493a9 ] 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 Signed-off-by: Kalle Valo Link: https://lore.kernel.org/r/20200920132621.26468-3-afaerber@suse.de Signed-off-by: Sasha Levin --- drivers/net/wireless/realtek/rtw88/main.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/net/wireless/realtek/rtw88/main.c b/drivers/net/wireless/realtek/rtw88/main.c index 80b880b671eaa..6a881d0be9bf0 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -1465,6 +1465,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; } } -- 2.25.1