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>
Showing
- block/bsg-lib.c 2 additions, 4 deletionsblock/bsg-lib.c
- block/bsg.c 5 additions, 34 deletionsblock/bsg.c
- drivers/scsi/scsi_transport_fc.c 3 additions, 4 deletionsdrivers/scsi/scsi_transport_fc.c
- drivers/scsi/scsi_transport_iscsi.c 1 addition, 1 deletiondrivers/scsi/scsi_transport_iscsi.c
- drivers/scsi/scsi_transport_sas.c 6 additions, 13 deletionsdrivers/scsi/scsi_transport_sas.c
- include/linux/bsg-lib.h 1 addition, 2 deletionsinclude/linux/bsg-lib.h
- include/linux/bsg.h 1 addition, 5 deletionsinclude/linux/bsg.h
Loading
Please register or sign in to comment