From patchwork Sat May 27 22:28:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 13257716 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4956EC77B7C for ; Sat, 27 May 2023 22:28:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229460AbjE0W2v (ORCPT ); Sat, 27 May 2023 18:28:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229454AbjE0W2r (ORCPT ); Sat, 27 May 2023 18:28:47 -0400 Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2A8EAD; Sat, 27 May 2023 15:28:45 -0700 (PDT) Received: from tr.lan (ip-86-49-120-218.bb.vodafone.cz [86.49.120.218]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 245E884673; Sun, 28 May 2023 00:28:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=denx.de; s=phobos-20191101; t=1685226523; bh=bcKQnIzsbSZhdBuEWfnx3ch1Jsf9OWtNztHG9Wber3U=; h=From:To:Cc:Subject:Date:From; b=WAXvxCBnd28nPI9gsfwFiLmBIzyGKxJQO+N/CSTp561Go7XwO+UArZnIvg1JGNT5Y 0R3JfeNNFjs5hhluOQ66f9jHYeWm5fQb6/M8y3QzPD2uEMyGhGq+z3VFJqqb76grrU ZKk3Msp8zzrbl28wIZqkndb7k20eiebyGmvsa2L84hWXIUr4l/vOkjlPJyn/etlSzr /dMWwCV7TJAyj5/lYracKBN22Zg4i96LoKWH/tLQqBD5k4VsfJtXAI/fBULeM4smCB Xj+oDBMQ9uvsq/tkqy4MlnFEpw3gXjIlsL1Vcsz0iVJYYhPShE3jqgG/dI2ICtfsYI 3lLFJ4m+cd37Q== From: Marek Vasut To: linux-wireless@vger.kernel.org Cc: Marek Vasut , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Jilin Yuan , Kalle Valo , Paolo Abeni , netdev@vger.kernel.org Subject: [PATCH] wifi: rsi: Do not configure WoWlan in shutdown hook if not enabled Date: Sun, 28 May 2023 00:28:33 +0200 Message-Id: <20230527222833.273741-1-marex@denx.de> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org In case WoWlan was never configured during the operation of the system, the hw->wiphy->wowlan_config will be NULL. rsi_config_wowlan() checks whether wowlan_config is non-NULL and if it is not, then WARNs about it. The warning is valid, as during normal operation the rsi_config_wowlan() should only ever be called with non-NULL wowlan_config. In shutdown this rsi_config_wowlan() should only ever be called if WoWlan was configured before by the user. Add checks for non-NULL wowlan_config into the shutdown hook. While at it, check whether the wiphy is also non-NULL before accessing wowlan_config . Drop the single-use wowlan_config variable, just inline it into function call. Fixes: 16bbc3eb8372 ("rsi: fix null pointer dereference during rsi_shutdown()") Signed-off-by: Marek Vasut Reviewed-by: Simon Horman --- Cc: "David S. Miller" Cc: Eric Dumazet Cc: Jakub Kicinski Cc: Jilin Yuan Cc: Kalle Valo Cc: Marek Vasut Cc: Paolo Abeni Cc: linux-wireless@vger.kernel.org Cc: netdev@vger.kernel.org --- drivers/net/wireless/rsi/rsi_91x_sdio.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/net/wireless/rsi/rsi_91x_sdio.c b/drivers/net/wireless/rsi/rsi_91x_sdio.c index d09998796ac08..6e33a2563fdbd 100644 --- a/drivers/net/wireless/rsi/rsi_91x_sdio.c +++ b/drivers/net/wireless/rsi/rsi_91x_sdio.c @@ -1463,10 +1463,8 @@ static void rsi_shutdown(struct device *dev) rsi_dbg(ERR_ZONE, "SDIO Bus shutdown =====>\n"); - if (hw) { - struct cfg80211_wowlan *wowlan = hw->wiphy->wowlan_config; - - if (rsi_config_wowlan(adapter, wowlan)) + if (hw && hw->wiphy && hw->wiphy->wowlan_config) { + if (rsi_config_wowlan(adapter, hw->wiphy->wowlan_config)) rsi_dbg(ERR_ZONE, "Failed to configure WoWLAN\n"); }