Vasilis Liaskovitis f92898e7f3 xen/blkfront: avoid NULL blkfront_info dereference on device removal
If a block device is hot-added when we are out of grants,
gnttab_grant_foreign_access fails with -ENOSPC (log message "28
granting access to ring page") in this code path:

  talk_to_blkback ->
	setup_blkring ->
		xenbus_grant_ring ->
			gnttab_grant_foreign_access

and the failing path in talk_to_blkback sets the driver_data to NULL:

 destroy_blkring:
        blkif_free(info, 0);

        mutex_lock(&blkfront_mutex);
        free_info(info);
        mutex_unlock(&blkfront_mutex);

        dev_set_drvdata(&dev->dev, NULL);

This results in a NULL pointer BUG when blkfront_remove and blkif_free
try to access the failing device's NULL struct blkfront_info.

Cc: stable@vger.kernel.org # 4.5 and later
Signed-off-by: Vasilis Liaskovitis <vliaskovitis@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
2018-10-25 11:17:39 -06:00
..
2018-10-25 06:50:48 -07:00
2018-10-25 06:50:48 -07:00
2018-10-16 09:50:39 -06:00
2018-10-22 17:30:06 +01:00
2018-10-25 06:50:48 -07:00
2018-10-25 06:50:48 -07:00
2018-09-27 16:58:49 +02:00
2018-08-08 15:44:47 +10:00
2018-10-25 06:50:48 -07:00
2018-10-20 12:26:26 +10:00
2018-10-25 06:19:15 -07:00
2018-10-25 06:50:48 -07:00
2018-10-25 06:19:15 -07:00
2018-09-10 12:54:02 +02:00
2018-10-22 17:46:08 +01:00
2018-10-25 06:19:15 -07:00
2018-10-23 01:09:22 +01:00
2018-10-25 06:50:48 -07:00
2018-10-25 06:31:56 -07:00
2018-10-25 06:50:48 -07:00
2018-10-25 06:50:48 -07:00
2018-10-22 17:30:06 +01:00
2018-10-25 06:50:48 -07:00
2018-08-20 11:36:07 +02:00
2018-08-20 16:30:27 -07:00
2018-10-25 06:50:48 -07:00
2018-10-25 07:40:30 -07:00
2018-10-25 06:19:15 -07:00
2018-10-25 07:40:30 -07:00
2018-08-23 13:52:46 -07:00
2018-10-25 06:19:15 -07:00
2018-08-19 09:30:44 -07:00
2018-08-17 11:32:50 -07:00
2018-10-07 21:31:32 -07:00
2018-10-25 06:21:28 -07:00
2018-08-24 08:45:19 -07:00
2018-08-18 11:04:51 -07:00