From: Luca Coelho <luca@coelho.fi> To: kvalo@codeaurora.org Cc: linux-wireless@vger.kernel.org Subject: [PATCH for v5.11 6/7] iwlwifi: mvm: guard against device removal in reprobe Date: Fri, 22 Jan 2021 14:52:41 +0200 Message-ID: <iwlwifi.20210122144849.871f0892e4b2.I94819e11afd68d875f3e242b98bef724b8236f1e@changeid> (raw) In-Reply-To: <20210122125242.107146-1-luca@coelho.fi> From: Johannes Berg <johannes.berg@intel.com> If we get into a problem severe enough to attempt a reprobe, we schedule a worker to do that. However, if the problem gets more severe and the device is actually destroyed before this worker has a chance to run, we use a free device. Bump up the reference count of the device until the worker runs to avoid this situation. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> --- drivers/net/wireless/intel/iwlwifi/mvm/ops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c index 03b41d911338..61618f607927 100644 --- a/drivers/net/wireless/intel/iwlwifi/mvm/ops.c +++ b/drivers/net/wireless/intel/iwlwifi/mvm/ops.c @@ -1209,6 +1209,7 @@ static void iwl_mvm_reprobe_wk(struct work_struct *wk) reprobe = container_of(wk, struct iwl_mvm_reprobe, work); if (device_reprobe(reprobe->dev)) dev_err(reprobe->dev, "reprobe failed!\n"); + put_device(reprobe->dev); kfree(reprobe); module_put(THIS_MODULE); } @@ -1259,7 +1260,7 @@ void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error) module_put(THIS_MODULE); return; } - reprobe->dev = mvm->trans->dev; + reprobe->dev = get_device(mvm->trans->dev); INIT_WORK(&reprobe->work, iwl_mvm_reprobe_wk); schedule_work(&reprobe->work); } else if (test_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, -- 2.29.2
next prev parent reply index Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-01-22 12:52 [PATCH for v5.11 0/7] iwlwifi: fixes intended for v5.11 2021-01-22 Luca Coelho 2021-01-22 12:52 ` [PATCH for v5.11 1/7] iwlwifi: mvm: fix the return type for DSM functions 1 and 2 Luca Coelho 2021-01-25 14:00 ` Kalle Valo 2021-01-22 12:52 ` [PATCH for v5.11 2/7] iwlwifi: mvm: invalidate IDs of internal stations at mvm start Luca Coelho 2021-01-22 12:52 ` [PATCH for v5.11 3/7] iwlwifi: pcie: add rules to match Qu with Hr2 Luca Coelho 2021-01-22 12:52 ` [PATCH for v5.11 4/7] iwlwifi: mvm: clear IN_D3 after wowlan status cmd Luca Coelho 2021-01-22 12:52 ` [PATCH for v5.11 5/7] iwlwifi: Fix IWL_SUBDEVICE_NO_160 macro to use the correct bit Luca Coelho 2021-01-22 12:52 ` Luca Coelho [this message] 2021-01-22 12:52 ` [PATCH for v5.11 7/7] iwlwifi: queue: bail out on invalid freeing Luca Coelho
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=iwlwifi.20210122144849.871f0892e4b2.I94819e11afd68d875f3e242b98bef724b8236f1e@changeid \ --to=luca@coelho.fi \ --cc=kvalo@codeaurora.org \ --cc=linux-wireless@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Linux-Wireless Archive on lore.kernel.org Archives are clonable: git clone --mirror https://lore.kernel.org/linux-wireless/0 linux-wireless/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 linux-wireless linux-wireless/ https://lore.kernel.org/linux-wireless \ linux-wireless@vger.kernel.org public-inbox-index linux-wireless Example config snippet for mirrors Newsgroup available over NNTP: nntp://nntp.lore.kernel.org/org.kernel.vger.linux-wireless AGPL code for this site: git clone https://public-inbox.org/public-inbox.git