mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
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>
This commit is contained in:
parent
b7405176b5
commit
5de815a7ee
7 changed files with 19 additions and 63 deletions
|
@ -17,17 +17,13 @@ struct bsg_ops {
|
|||
|
||||
struct bsg_class_device {
|
||||
struct device *class_dev;
|
||||
struct device *parent;
|
||||
int minor;
|
||||
struct request_queue *queue;
|
||||
struct kref ref;
|
||||
const struct bsg_ops *ops;
|
||||
void (*release)(struct device *);
|
||||
};
|
||||
|
||||
int bsg_register_queue(struct request_queue *q, struct device *parent,
|
||||
const char *name, const struct bsg_ops *ops,
|
||||
void (*release)(struct device *));
|
||||
const char *name, const struct bsg_ops *ops);
|
||||
int bsg_scsi_register_queue(struct request_queue *q, struct device *parent);
|
||||
void bsg_unregister_queue(struct request_queue *q);
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue