OSDN Git Service

nvme_fcloop: disassocate local port structs
authorJames Smart <jsmart2021@gmail.com>
Thu, 30 Nov 2017 00:47:31 +0000 (16:47 -0800)
committerChristoph Hellwig <hch@lst.de>
Mon, 8 Jan 2018 10:01:54 +0000 (11:01 +0100)
commit6fda20283e55b9d288cd56822ce39fc8e64f2208
tree6ffe500e957f43325e741eab2c5bc7146728a389
parent278e096063f1914fccfc77a617be9fc8dbb31b0e
nvme_fcloop: disassocate local port structs

The current fcloop driver gets its lport structure from the private
area co-allocated with the fc_localport. All is fine except the
teardown path, which wants to wait on the completion, which is marked
complete by the delete_localport callback performed after
unregister_localport.  The issue is, the nvme_fc transport frees the
localport structure immediately after delete_localport is called,
meaning the original routine is trying to wait on a complete that
was just freed.

Change such that a lport struct is allocated coincident with the
addition and registration of a localport. The private area of the
localport now contains just a backpointer to the real lport struct.
Now, the completion can be waited for, and after completing, the
new structure can be kfree'd.

Signed-off-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/fcloop.c