Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1585866

[PATCH v2 1/2] iwlwifi: fix drv cleanup on opmode registration failure

From "Luis R. Rodriguez" <mcgrof@kernel.org>
Newsgroups linux.kernel
Subject [PATCH v2 1/2] iwlwifi: fix drv cleanup on opmode registration failure
Date 2017-02-22 03:20 +0100
Message-ID <tduH8-2Pq-3@gated-at.bofh.it> (permalink)
References <tdsOZ-1B2-1@gated-at.bofh.it> <tduH8-2Pq-5@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The firmware async callback handles the device's opmode start
call, but optionally also allows opmode registration to take
care of its opmode start. If the firmware callback handles it
its error path in case of opmode start failure has a few pieces
of code missing from the opmode registration. The opmode
registration hanlder has no cleanup at all. Sync both error
paths.

This should in theory fix a detangled drv from the drv list should
either of the opmode modules loaded and handled registration for the
drv.

The path of having the opmode registration deal with the drv
opmode start is actually the more common path. The other path,
from the async callback is rathe rare (1/8 or so times for me) --
it happens when the the opmode driver's init routine completed
prior to the driver's async callback opmode start call.

Signed-off-by: Luis R. Rodriguez <mcgrof@kernel.org>
---
 drivers/net/wireless/intel/iwlwifi/iwl-drv.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
index be466a074c1d..e198d6f5fcea 100644
--- a/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
+++ b/drivers/net/wireless/intel/iwlwifi/iwl-drv.c
@@ -1611,8 +1611,13 @@ int iwl_opmode_register(const char *name, const struct iwl_op_mode_ops *ops)
 			continue;
 		op->ops = ops;
 		/* TODO: need to handle exceptional case */
-		list_for_each_entry(drv, &op->drv, list)
+		list_for_each_entry(drv, &op->drv, list) {
 			drv->op_mode = _iwl_op_mode_start(drv, op);
+			if (!drv->op_mode) {
+				complete(&drv->request_firmware_complete);
+				device_release_driver(drv->trans->dev);
+			}
+		}
 
 		mutex_unlock(&iwlwifi_opmode_table_mtx);
 		return 0;
-- 
2.11.0

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[RFC 0/5] iwlwifi: enhance final opmode work "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-17 03:20 +0100
  [RFC 2/5] iwlwifi: fix request_module() use "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-17 03:20 +0100
    RE: [RFC 2/5] iwlwifi: fix request_module() use "Grumbach, Emmanuel" <emmanuel.grumbach@intel.com> - 2017-02-19 10:50 +0100
      Re: [RFC 2/5] iwlwifi: fix request_module() use "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-21 03:30 +0100
        RE: [RFC 2/5] iwlwifi: fix request_module() use "Grumbach, Emmanuel" <emmanuel.grumbach@intel.com> - 2017-02-21 08:20 +0100
          Re: [RFC 2/5] iwlwifi: fix request_module() use "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-21 19:20 +0100
            Re: [RFC 2/5] iwlwifi: fix request_module() use "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-21 21:20 +0100
              Re: [RFC 2/5] iwlwifi: fix request_module() use "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-22 01:20 +0100
                [PATCH v2 0/2] iwlwifi: share opmode start code "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-22 03:20 +0100
                [PATCH v2 2/2] iwlwifi: convert final opmode work into a workqueue "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-22 03:20 +0100
                [PATCH v2 1/2] iwlwifi: share opmode start work code "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-22 03:20 +0100
                [PATCH v2 1/2] iwlwifi: fix drv cleanup on opmode registration failure "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-22 03:20 +0100
                [PATCH v2 0/2] iwlwifi: corner case fix and request module changes "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-22 03:20 +0100
                [PATCH v2 2/2] iwlwifi: simplify requesting ops module "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-22 03:20 +0100
  [RFC 1/5] iwlwifi: fix drv cleanup on opmode registration failure "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-17 03:20 +0100
    RE: [RFC 1/5] iwlwifi: fix drv cleanup on opmode registration  failure "Grumbach, Emmanuel" <emmanuel.grumbach@intel.com> - 2017-02-19 10:20 +0100
      Re: [RFC 1/5] iwlwifi: fix drv cleanup on opmode registration failure "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-20 18:40 +0100
  [RFC 3/5] iwlwifi: share opmode start work code "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-17 03:20 +0100
  [RFC 5/5] iwlwifi: convert final opmode work into a workqueue "Luis R. Rodriguez" <mcgrof@kernel.org> - 2017-02-17 03:20 +0100

csiph-web