From patchwork Tue Oct 27 13:50:10 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 289870 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2293BC56202 for ; Tue, 27 Oct 2020 15:01:00 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CA64022283 for ; Tue, 27 Oct 2020 15:00:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603810859; bh=bBAZKnnaphTaOGpknk2rJ10sEiOSsZlFfbur2kyL2E4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=FDaDapIDTEjOuuxICSmYkEO3Y3WoRXvcvFmO8agvvgZ8PmWTprOgn4zDWA/b0VHxS ZvswRWiw2lP+b5hIXLPYBTZvGsJf6jvUdXdb6r+VxINXY5p15XkD8FjFInfou7r5pP lyV3yL3YI47N5/TnHDhPcP9WgdnGY+r0PwTrlFPc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1772020AbgJ0PA6 (ORCPT ); Tue, 27 Oct 2020 11:00:58 -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_F?= =?utf-8?b?w6RyYmVy?= , 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 Precedence: bulk List-ID: X-Mailing-List: stable@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; } }