]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
scsi: zfcp: Fix a double put in zfcp_port_enqueue()
authorDinghao Liu <dinghao.liu@zju.edu.cn>
Sat, 23 Sep 2023 10:37:23 +0000 (18:37 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 10 Oct 2023 19:43:40 +0000 (21:43 +0200)
commit44d3ee21d8e076a62e5d88e3e796ef609d2d144d
tree0b927b5e35bd571f5df04d9d8f9f7d1c686c6ed0
parent7532d4fa92d6635a38abb58fb165b6034dce83d3
scsi: zfcp: Fix a double put in zfcp_port_enqueue()

commit b481f644d9174670b385c3a699617052cd2a79d3 upstream.

When device_register() fails, zfcp_port_release() will be called after
put_device(). As a result, zfcp_ccw_adapter_put() will be called twice: one
in zfcp_port_release() and one in the error path after device_register().
So the reference on the adapter object is doubly put, which may lead to a
premature free. Fix this by adjusting the error tag after
device_register().

Fixes: f3450c7b9172 ("[SCSI] zfcp: Replace local reference counting with common kref")
Signed-off-by: Dinghao Liu <dinghao.liu@zju.edu.cn>
Link: https://lore.kernel.org/r/20230923103723.10320-1-dinghao.liu@zju.edu.cn
Acked-by: Benjamin Block <bblock@linux.ibm.com>
Cc: stable@vger.kernel.org # v2.6.33+
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/s390/scsi/zfcp_aux.c