提交 9eed785b 编写于 作者: H Hannes Reinecke 提交者: Martin K. Petersen

scsi: fcoe: move fcoe_interface_remove() out of fcoe_interface_cleanup()

This closes a possible race condition in _fcoe_create() where we drop
the rtnl_lock() before calling fcoe_interface_remove().
Signed-off-by: NHannes Reinecke <hare@suse.com>
Reviewed-by: NLee Duncan <lduncan@suse.com>
Acked-by: NJohannes Thumshirn <jth@kernel.org>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
上级 2a8ee616
......@@ -501,11 +501,6 @@ static void fcoe_interface_cleanup(struct fcoe_interface *fcoe)
struct net_device *netdev = fcoe->netdev;
struct fcoe_ctlr *fip = fcoe_to_ctlr(fcoe);
rtnl_lock();
if (!fcoe->removed)
fcoe_interface_remove(fcoe);
rtnl_unlock();
/* Release the self-reference taken during fcoe_interface_create() */
/* tear-down the FCoE controller */
fcoe_ctlr_destroy(fip);
......@@ -2140,6 +2135,11 @@ static void fcoe_destroy_work(struct work_struct *work)
cdev = fcoe_ctlr_to_ctlr_dev(ctlr);
fcoe_if_destroy(port->lport);
rtnl_lock();
if (!fcoe->removed)
fcoe_interface_remove(fcoe);
rtnl_unlock();
fcoe_interface_cleanup(fcoe);
mutex_unlock(&fcoe_config_mutex);
......@@ -2254,6 +2254,8 @@ static int _fcoe_create(struct net_device *netdev, enum fip_mode fip_mode,
printk(KERN_ERR "fcoe: Failed to create interface (%s)\n",
netdev->name);
rc = -EIO;
if (!fcoe->removed)
fcoe_interface_remove(fcoe);
rtnl_unlock();
fcoe_interface_cleanup(fcoe);
mutex_unlock(&fcoe_config_mutex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册