need more sanity checks in blkback when using grant tables
I'm upgrading FreeBSD to work against TOT in -unstable. I haven't added grant table support to the blkfront yet. DOM0 can't cope with this:
[XEN] Netfront recovered tx=0 rxfree=0
[XEN] Initialising virtual block device driver
(XEN) (file=grant_table.c, line=347) Bad ref (8367) or flags (2).
Unable to handle kernel paging request at virtual address dfc00008 printing eip: c029a01c *pde = ma 2007d067 pa 0007d067 *pte = ma 00000000 pa 55555000 [<c02991d6>] dispatch_probe+0x106/0x120 [<c02990ab>] do_block_io_op+0xeb/0x110 [<c011c09f>] daemonize+0xef/0x100 [<c0298d57>] blkio_schedule+0x127/0x180 [<c0116b50>] default_wake_function+0x0/0x20 [<c01099e2>] ret_from_fork+0x6/0x1c [<c0116b50>] default_wake_function+0x0/0x20 [<c0298c30>] blkio_schedule+0x0/0x180 [<c0107ad5>] kernel_thread_helper+0x5/0x10 Oops: 0002 [#1] PREEMPT Modules linked in: CPU: 0 EIP: 0061:[<c029a01c>] Not tainted VLI EFLAGS: 00010202 (2.6.11-xen0)
EIP is at vbd_probe_single+0xc/0x50
eax: 00000700 ebx: dfc00000 ecx: 00000155 edx: ddce2fc0
esi: 00000001 edi: daef0728 ebp: 00000155 esp: c175bef4
ds: 007b es: 007b ss: 0069
Process xenblkd (pid: 749, threadinfo=c175a000 task=c16900e0)
Stack: ddce2fcc c029a0b7 daef0728 dfc00000 ddce2fc0 c05f9a00 00000000 e080e008
daef0728 c02991d6 daef0728 dfc00000 00000155 c16900e0 00000000 00000000
ffffffff dfc00000 00000002 20af0004 fffd0002 c05f9a00 00002b0b bb9b6117
Call Trace:
[<c029a0b7>] vbd_probe+0x57/0xb0
[<c02991d6>] dispatch_probe+0x106/0x120
[<c02990ab>] do_block_io_op+0xeb/0x110
[<c011c09f>] daemonize+0xef/0x100
[<c0298d57>] blkio_schedule+0x127/0x180
[<c0116b50>] default_wake_function+0x0/0x20
[<c01099e2>] ret_from_fork+0x6/0x1c
[<c0116b50>] default_wake_function+0x0/0x20
[<c0298c30>] blkio_schedule+0x0/0x180
[<c0107ad5>] kernel_thread_helper+0x5/0x10
Code: 08 5b 5e 5f 5d e9 75 e2 13 00 e8 70 e2 13 00 eb b7 8d b4 26 0000 00 00 8d bc 27 00 00 00 00 53 8b 54 24 10 8b 5c 24 0c 0f b7 02 <66> 89 43 08 0f b6 42 03 89 c1 83 c9 40 80 7a 02 00 0f 45 c1 66
<6>note: xenblkd[749] exited with preempt_count 1
Thanks for the catch, Kip. Fix inline below.
===== linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c 1.38 vs edited ===== --- 1.38/linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c
2005-04-05 05:28:05 -07:00
+++ edited/linux-2.6.11-xen-sparse/drivers/xen/blkback/blkback.c
2005-04-18 18:48:12 -07:00
@@ -397,7 +397,7 @@
GNTTABOP_map_grant_ref, &op, 1)))
BUG();- if ( op.u.map_grant_ref.dev_bus_addr == 0 )
+ if ( op.u.map_grant_ref.handle < 0 )
goto out;
pending_handle(pending_idx, 0) = op.u.map_grant_ref.handle;@@ -500,7 +500,7 @@
for ( i = 0; i < nseg; i++ )
{
- if ( unlikely(aop[i].u.map_grant_ref.dev_bus_addr == 0) )
+ if ( unlikely(aop[i].u.map_grant_ref.handle < 0) )
{
DPRINTK("invalid buffer -- could not remap it\n");
fast_flush_area(pending_idx, nseg);