Skip to content

Commit

Permalink
xen-blkfront: fix kernel panic with negotiate_mq error path
Browse files Browse the repository at this point in the history
commit 6cc4a08 upstream.

info->nr_rings isn't adjusted in case of ENOMEM error from
negotiate_mq(). This leads to kernel panic in error path.

Typical call stack involving panic -
 Freescale#8 page_fault at ffffffff8175936f
    [exception RIP: blkif_free_ring+33]
    RIP: ffffffffa0149491  RSP: ffff8804f7673c08  RFLAGS: 00010292
 ...
 Freescale#9 blkif_free at ffffffffa0149aaa [xen_blkfront]
 Freescale#10 talk_to_blkback at ffffffffa014c8cd [xen_blkfront]
 Freescale#11 blkback_changed at ffffffffa014ea8b [xen_blkfront]
 Freescale#12 xenbus_otherend_changed at ffffffff81424670
 Freescale#13 backend_changed at ffffffff81426dc3
 Freescale#14 xenwatch_thread at ffffffff81422f29
 Freescale#15 kthread at ffffffff810abe6a
 Freescale#16 ret_from_fork at ffffffff81754078

Cc: stable@vger.kernel.org
Fixes: 7ed8ce1 ("xen-blkfront: move negotiate_mq to cover all cases of new VBDs")
Signed-off-by: Manjunath Patil <manjunath.b.patil@oracle.com>
Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
mbpatil369 authored and gregkh committed Nov 13, 2018
1 parent 034680f commit 4e6d30d
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions drivers/block/xen-blkfront.c
Original file line number Diff line number Diff line change
Expand Up @@ -1910,6 +1910,7 @@ static int negotiate_mq(struct blkfront_info *info)
info->rinfo = kzalloc(sizeof(struct blkfront_ring_info) * info->nr_rings, GFP_KERNEL);
if (!info->rinfo) {
xenbus_dev_fatal(info->xbdev, -ENOMEM, "allocating ring_info structure");
info->nr_rings = 0;
return -ENOMEM;
}

Expand Down

0 comments on commit 4e6d30d

Please sign in to comment.