From patchwork Tue Oct 27 13:49:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 289695 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 07C50C55178 for ; Tue, 27 Oct 2020 15:33:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id A837822202 for ; Tue, 27 Oct 2020 15:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603812836; bh=X0JhAcdX0GJjijwZDUlnwnbHgDOOhxJpSUNZtm3TzUc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=xAc05VowEUU5bkeIhP24dURNKI6mIIgyUJvCXUNplKonCTupGxmETOmeVK3pT1p9c KQ/JtajaFTcd3qQcLisnX57pQbnn1OCY26x7cN7pcRmZWeuN5rWr9wjfC9r9x7Mhgs 9IF23BnPDbgo0hqEBQP6BPTkkXUGd0Qle4zp/S4c= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1799880AbgJ0Pdy (ORCPT ); Tue, 27 Oct 2020 11:33:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:51498 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1799876AbgJ0Pdx (ORCPT ); Tue, 27 Oct 2020 11:33:53 -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 9A96D22263; Tue, 27 Oct 2020 15:33:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603812832; bh=X0JhAcdX0GJjijwZDUlnwnbHgDOOhxJpSUNZtm3TzUc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dBVVFYyYYdR/ka3MJLl3gK9smTxxW4sTKuThiNFl5mvFhe0ESWe7kh5dOkIvCuvFr j/ZDCxQcFpVeXtz5jnfuvnIuBQVd0YaQerZRluaKw4Tz0ovw0iMksII4BD7TXPrnLj w0mHPyQDux4alJNLUzxcStNtY2roYG6mAKU0Vcno= 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.9 314/757] rtw88: Fix potential probe error handling race with wow firmware loading Date: Tue, 27 Oct 2020 14:49:24 +0100 Message-Id: <20201027135505.265834977@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135450.497324313@linuxfoundation.org> References: <20201027135450.497324313@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 58c760dfd6b80..d69e4c6fc680a 100644 --- a/drivers/net/wireless/realtek/rtw88/main.c +++ b/drivers/net/wireless/realtek/rtw88/main.c @@ -1473,6 +1473,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; } }