[SCSI] zfcp: Prevent usage w/o holding a reference
The ERP got values assigned for which no reference was taken. This can lead to an unpredictable race condition. Fix this by only assigning the values which are required and for which a reference was pulled or is held implicitly. Signed-off-by: Swen Schillig <swen@vnet.ibm.com> Signed-off-by: Christof Schmitt <christof.schmitt@de.ibm.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
This commit is contained in:
parent
d3e1088d68
commit
14718e3cd8
|
@ -190,6 +190,9 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status,
|
|||
atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE,
|
||||
&zfcp_sdev->status);
|
||||
erp_action = &zfcp_sdev->erp_action;
|
||||
memset(erp_action, 0, sizeof(struct zfcp_erp_action));
|
||||
erp_action->port = port;
|
||||
erp_action->sdev = sdev;
|
||||
if (!(atomic_read(&zfcp_sdev->status) &
|
||||
ZFCP_STATUS_COMMON_RUNNING))
|
||||
act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY;
|
||||
|
@ -202,6 +205,8 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status,
|
|||
zfcp_erp_action_dismiss_port(port);
|
||||
atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &port->status);
|
||||
erp_action = &port->erp_action;
|
||||
memset(erp_action, 0, sizeof(struct zfcp_erp_action));
|
||||
erp_action->port = port;
|
||||
if (!(atomic_read(&port->status) & ZFCP_STATUS_COMMON_RUNNING))
|
||||
act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY;
|
||||
break;
|
||||
|
@ -211,6 +216,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status,
|
|||
zfcp_erp_action_dismiss_adapter(adapter);
|
||||
atomic_set_mask(ZFCP_STATUS_COMMON_ERP_INUSE, &adapter->status);
|
||||
erp_action = &adapter->erp_action;
|
||||
memset(erp_action, 0, sizeof(struct zfcp_erp_action));
|
||||
if (!(atomic_read(&adapter->status) &
|
||||
ZFCP_STATUS_COMMON_RUNNING))
|
||||
act_status |= ZFCP_STATUS_ERP_CLOSE_ONLY;
|
||||
|
@ -220,10 +226,7 @@ static struct zfcp_erp_action *zfcp_erp_setup_act(int need, u32 act_status,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
memset(erp_action, 0, sizeof(struct zfcp_erp_action));
|
||||
erp_action->adapter = adapter;
|
||||
erp_action->port = port;
|
||||
erp_action->sdev = sdev;
|
||||
erp_action->action = need;
|
||||
erp_action->status = act_status;
|
||||
|
||||
|
|
Loading…
Reference in a new issue