]> www.infradead.org Git - users/jedix/linux-maple.git/commit
scsi: libfc: Do not take rdata->rp_mutex when processing a -FC_EX_CLOSED ELS response.
authorChad Dupuis <chad.dupuis@cavium.com>
Fri, 30 Sep 2016 09:01:16 +0000 (11:01 +0200)
committerBrian Maly <brian.maly@oracle.com>
Sun, 12 May 2019 01:51:55 +0000 (21:51 -0400)
commit25f7c9186cd14ff41e56e5fdbb7d9dc1715c7e75
treeb1a1975b986c27e210d4482f2f4770bc57c339a4
parent6f58c151fbd8fd3152fb3072eef45367963140ef
scsi: libfc: Do not take rdata->rp_mutex when processing a -FC_EX_CLOSED ELS response.

When an ELS response handler receives a -FC_EX_CLOSED, the rdata->rp_mutex is
already held which can lead to a deadlock condition like the following stack trace:

[<ffffffffa04d8f18>] fc_rport_plogi_resp+0x28/0x200 [libfc]
[<ffffffffa04cfa1a>] fc_invoke_resp+0x6a/0xe0 [libfc]
[<ffffffffa04d0c08>] fc_exch_mgr_reset+0x1b8/0x280 [libfc]
[<ffffffffa04d87b3>] fc_rport_logoff+0x43/0xd0 [libfc]
[<ffffffffa04ce73d>] fc_disc_stop+0x6d/0xf0 [libfc]
[<ffffffffa04ce7ce>] fc_disc_stop_final+0xe/0x20 [libfc]
[<ffffffffa04d55f7>] fc_fabric_logoff+0x17/0x70 [libfc]

The other ELS handlers need to follow the FLOGI response handler and simply do
a kref_put against the fc_rport_priv struct and exit when receving a
-FC_EX_CLOSED response.

Orabug: 25933179

Reviewed-by: John Sobecki <john.sobecki@oracle.com>
Signed-off-by: Chad Dupuis <chad.dupuis@cavium.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Acked-by: Johannes Thumshirn <jth@kernel.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Rajan Shanmugavelu <rajan.shanmugavelu@oracle.com>
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/scsi/libfc/fc_rport.c