diff options
author | Christoph Hellwig <hch@lst.de> | 2018-05-29 09:40:23 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2018-05-29 22:00:25 +0300 |
commit | 5de815a7eedfacf593817ef34634eaa9b75a1482 (patch) | |
tree | 13cca552662936096f7b306dc5dbb7b64dfdd93e /include/linux/bsg-lib.h | |
parent | b7405176b58aa475354f3c0d2ca1c560e9354288 (diff) | |
download | linux-5de815a7eedfacf593817ef34634eaa9b75a1482.tar.xz |
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>
Diffstat (limited to 'include/linux/bsg-lib.h')
-rw-r--r-- | include/linux/bsg-lib.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/include/linux/bsg-lib.h b/include/linux/bsg-lib.h index 28a7ccc55c89..6aeaf6472665 100644 --- a/include/linux/bsg-lib.h +++ b/include/linux/bsg-lib.h @@ -72,8 +72,7 @@ struct bsg_job { void bsg_job_done(struct bsg_job *job, int result, unsigned int reply_payload_rcv_len); struct request_queue *bsg_setup_queue(struct device *dev, const char *name, - bsg_job_fn *job_fn, int dd_job_size, - void (*release)(struct device *)); + bsg_job_fn *job_fn, int dd_job_size); void bsg_job_put(struct bsg_job *job); int __must_check bsg_job_get(struct bsg_job *job); |