1 From 1f6d308a085add0d178a5a45a06614dfcd0bc3e8 Mon Sep 17 00:00:00 2001
2 From: Varun Prakash <varun@chelsio.com>
3 Date: Sat, 12 Jan 2019 22:14:30 +0530
4 Subject: scsi: csiostor: fix NULL pointer dereference in
7 [ Upstream commit fe35a40e675473eb65f2f5462b82770f324b5689 ]
9 Assign fc_vport to ln->fc_vport before calling csio_fcoe_alloc_vnp() to
10 avoid a NULL pointer dereference in csio_vport_set_state().
12 ln->fc_vport is dereferenced in csio_vport_set_state().
14 Signed-off-by: Varun Prakash <varun@chelsio.com>
15 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
16 Signed-off-by: Sasha Levin <sashal@kernel.org>
18 drivers/scsi/csiostor/csio_attr.c | 2 +-
19 1 file changed, 1 insertion(+), 1 deletion(-)
21 diff --git a/drivers/scsi/csiostor/csio_attr.c b/drivers/scsi/csiostor/csio_attr.c
22 index 8a004036e3d72..9bd2bd8dc2be2 100644
23 --- a/drivers/scsi/csiostor/csio_attr.c
24 +++ b/drivers/scsi/csiostor/csio_attr.c
25 @@ -594,12 +594,12 @@ csio_vport_create(struct fc_vport *fc_vport, bool disable)
28 fc_vport_set_state(fc_vport, FC_VPORT_INITIALIZING);
29 + ln->fc_vport = fc_vport;
31 if (csio_fcoe_alloc_vnp(hw, ln))
34 *(struct csio_lnode **)fc_vport->dd_data = ln;
35 - ln->fc_vport = fc_vport;
36 if (!fc_vport->node_name)
37 fc_vport->node_name = wwn_to_u64(csio_ln_wwnn(ln));
38 if (!fc_vport->port_name)