linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] xen-blkfront: fix kernel panic with blkfront_remove()
@ 2018-11-09  1:10 Manjunath Patil
  2018-11-09  6:16 ` Juergen Gross
  0 siblings, 1 reply; 3+ messages in thread
From: Manjunath Patil @ 2018-11-09  1:10 UTC (permalink / raw)
  To: boris.ostrovsky, jgross, konrad.wilk, roger.pau
  Cc: axboe, xen-devel, linux-block, linux-kernel, stable

When we try to detach the device, blkfront_remove() tries to access
blkfront_info leading to kernel panic.

Typical call stack involving panic -
 #10 page_fault at ffffffff816f25df
     [exception RIP: blkif_free+46]
 #11 blkfront_remove at ffffffffa004de47 [xen_blkfront]
 #12 xenbus_dev_remove at ffffffff813faa4c
 #13 __device_release_driver at ffffffff814769aa
 #14 device_release_driver at ffffffff81476a63
 #15 bus_remove_device at ffffffff814762eb
 #16 device_del at ffffffff81472684
 #17 device_unregister at ffffffff814727e2
 #18 xenbus_dev_changed at ffffffff813fa89f
 #19 frontend_changed at ffffffff813fca19
 #20 xenwatch_thread at ffffffff813f88f9
 #21 kthread at ffffffff810a486b
 #22 ret_from_fork at ffffffff816ed2a8

Cc: stable@vger.kernel.org
Signed-off-by: Manjunath Patil <manjunath.b.patil@oracle.com>
---
v2: style change. added the missing space b/w if and (
---
 drivers/block/xen-blkfront.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/block/xen-blkfront.c b/drivers/block/xen-blkfront.c
index dc8fe25..2d8b10d 100644
--- a/drivers/block/xen-blkfront.c
+++ b/drivers/block/xen-blkfront.c
@@ -2496,6 +2496,9 @@ static int blkfront_remove(struct xenbus_device *xbdev)
 
 	dev_dbg(&xbdev->dev, "%s removed", xbdev->nodename);
 
+	if (!info)
+		return 0;
+
 	blkif_free(info, 0);
 
 	mutex_lock(&info->mutex);
-- 
1.7.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH v2] xen-blkfront: fix kernel panic with blkfront_remove()
  2018-11-09  1:10 [PATCH v2] xen-blkfront: fix kernel panic with blkfront_remove() Manjunath Patil
@ 2018-11-09  6:16 ` Juergen Gross
  2018-11-09 19:08   ` [Xen-devel] " Manjunath Patil
  0 siblings, 1 reply; 3+ messages in thread
From: Juergen Gross @ 2018-11-09  6:16 UTC (permalink / raw)
  To: Manjunath Patil, boris.ostrovsky, konrad.wilk, roger.pau
  Cc: axboe, xen-devel, linux-block, linux-kernel, stable

On 09/11/2018 02:10, Manjunath Patil wrote:
> When we try to detach the device, blkfront_remove() tries to access
> blkfront_info leading to kernel panic.
> 
> Typical call stack involving panic -
>  #10 page_fault at ffffffff816f25df
>      [exception RIP: blkif_free+46]
>  #11 blkfront_remove at ffffffffa004de47 [xen_blkfront]
>  #12 xenbus_dev_remove at ffffffff813faa4c
>  #13 __device_release_driver at ffffffff814769aa
>  #14 device_release_driver at ffffffff81476a63
>  #15 bus_remove_device at ffffffff814762eb
>  #16 device_del at ffffffff81472684
>  #17 device_unregister at ffffffff814727e2
>  #18 xenbus_dev_changed at ffffffff813fa89f
>  #19 frontend_changed at ffffffff813fca19
>  #20 xenwatch_thread at ffffffff813f88f9
>  #21 kthread at ffffffff810a486b
>  #22 ret_from_fork at ffffffff816ed2a8
> 
> Cc: stable@vger.kernel.org
> Signed-off-by: Manjunath Patil <manjunath.b.patil@oracle.com>

Commit f92898e7f32e3 already added that.


Juergen

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Xen-devel] [PATCH v2] xen-blkfront: fix kernel panic with blkfront_remove()
  2018-11-09  6:16 ` Juergen Gross
@ 2018-11-09 19:08   ` Manjunath Patil
  0 siblings, 0 replies; 3+ messages in thread
From: Manjunath Patil @ 2018-11-09 19:08 UTC (permalink / raw)
  To: Juergen Gross, boris.ostrovsky, konrad.wilk, roger.pau
  Cc: axboe, xen-devel, linux-block, linux-kernel, stable

oops! sorry for not noticing this.

-Manjunath

On 11/8/2018 10:16 PM, Juergen Gross wrote:
> On 09/11/2018 02:10, Manjunath Patil wrote:
>> When we try to detach the device, blkfront_remove() tries to access
>> blkfront_info leading to kernel panic.
>>
>> Typical call stack involving panic -
>>   #10 page_fault at ffffffff816f25df
>>       [exception RIP: blkif_free+46]
>>   #11 blkfront_remove at ffffffffa004de47 [xen_blkfront]
>>   #12 xenbus_dev_remove at ffffffff813faa4c
>>   #13 __device_release_driver at ffffffff814769aa
>>   #14 device_release_driver at ffffffff81476a63
>>   #15 bus_remove_device at ffffffff814762eb
>>   #16 device_del at ffffffff81472684
>>   #17 device_unregister at ffffffff814727e2
>>   #18 xenbus_dev_changed at ffffffff813fa89f
>>   #19 frontend_changed at ffffffff813fca19
>>   #20 xenwatch_thread at ffffffff813f88f9
>>   #21 kthread at ffffffff810a486b
>>   #22 ret_from_fork at ffffffff816ed2a8
>>
>> Cc: stable@vger.kernel.org
>> Signed-off-by: Manjunath Patil <manjunath.b.patil@oracle.com>
> Commit f92898e7f32e3 already added that.
>
>
> Juergen


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-11-09 19:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-09  1:10 [PATCH v2] xen-blkfront: fix kernel panic with blkfront_remove() Manjunath Patil
2018-11-09  6:16 ` Juergen Gross
2018-11-09 19:08   ` [Xen-devel] " Manjunath Patil

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).