Message ID | 20170221170958.21845-14-jack@suse.cz (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 02/21/2017 09:55 AM, Jan Kara wrote: > When device open races with device shutdown, we can get the following > oops in scsi_disk_get(): [ ... ] Reviewed-by: Bart Van Assche <bart.vanassche@sandisk.com>
diff --git a/block/genhd.c b/block/genhd.c index 68c613edb93a..2baacfea7b5e 100644 --- a/block/genhd.c +++ b/block/genhd.c @@ -1350,7 +1350,7 @@ struct kobject *get_disk(struct gendisk *disk) owner = disk->fops->owner; if (owner && !try_module_get(owner)) return NULL; - kobj = kobject_get(&disk_to_dev(disk)->kobj); + kobj = kobject_get_unless_zero(&disk_to_dev(disk)->kobj); if (kobj == NULL) { module_put(owner); return NULL;