]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commit
block: remove parent device reference from struct bsg_class_device
authorChristoph Hellwig <hch@lst.de>
Tue, 29 May 2018 06:40:23 +0000 (08:40 +0200)
committerJens Axboe <axboe@kernel.dk>
Tue, 29 May 2018 19:00:25 +0000 (13:00 -0600)
commit5de815a7eedfacf593817ef34634eaa9b75a1482
tree13cca552662936096f7b306dc5dbb7b64dfdd93e
parentb7405176b58aa475354f3c0d2ca1c560e9354288
block: remove parent device reference from struct bsg_class_device

Bsg holding a reference to the parent device may result in a crash if a
bsg file handle is closed after the parent device driver has unloaded.

Holding a reference is not really needed: the parent device must exist
between bsg_register_queue and bsg_unregister_queue.  Before the device
goes away the caller does blk_cleanup_queue so that all in-flight
requests to the device are gone and all new requests cannot pass beyond
the queue.  The queue itself is a refcounted object and it will stay
alive with a bsg file.

Based on analysis, previous patch and changelog from Anatoliy Glagolev.

Reported-by: Anatoliy Glagolev <glagolig@gmail.com>
Reviewed-by: James E.J. Bottomley <jejb@linux.vnet.ibm.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bsg-lib.c
block/bsg.c
drivers/scsi/scsi_transport_fc.c
drivers/scsi/scsi_transport_iscsi.c
drivers/scsi/scsi_transport_sas.c
include/linux/bsg-lib.h
include/linux/bsg.h