Fam Zheng
0c8482ac92
[SCSI] virtio-scsi: Skip setting affinity on uninitialized vq
...
virtscsi_init calls virtscsi_remove_vqs on err, even before initializing
the vqs. The latter calls virtscsi_set_affinity, so let's check the
pointer there before setting affinity on it.
This fixes a panic when setting device's num_queues=2 on RHEL 6.5:
qemu-system-x86_64 ... \
-device virtio-scsi-pci,id=scsi0,addr=0x13,...,num_queues=2 \
-drive file=/stor/vm/dummy.raw,id=drive-scsi-disk,... \
-device scsi-hd,drive=drive-scsi-disk,...
[ 0.354734] scsi0 : Virtio SCSI HBA
[ 0.379504] BUG: unable to handle kernel NULL pointer dereference at 0000000000000020
[ 0.380141] IP: [<ffffffff814741ef>] __virtscsi_set_affinity+0x4f/0x120
[ 0.380141] PGD 0
[ 0.380141] Oops: 0000 [#1 ] SMP
[ 0.380141] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 3.14.0+ #5
[ 0.380141] Hardware name: Red Hat KVM, BIOS 0.5.1 01/01/2007
[ 0.380141] task: ffff88003c9f0000 ti: ffff88003c9f8000 task.ti: ffff88003c9f8000
[ 0.380141] RIP: 0010:[<ffffffff814741ef>] [<ffffffff814741ef>] __virtscsi_set_affinity+0x4f/0x120
[ 0.380141] RSP: 0000:ffff88003c9f9c08 EFLAGS: 00010256
[ 0.380141] RAX: 0000000000000000 RBX: ffff88003c3a9d40 RCX: 0000000000001070
[ 0.380141] RDX: 0000000000000002 RSI: 0000000000000000 RDI: 0000000000000000
[ 0.380141] RBP: ffff88003c9f9c28 R08: 00000000000136c0 R09: ffff88003c801c00
[ 0.380141] R10: ffffffff81475229 R11: 0000000000000008 R12: 0000000000000000
[ 0.380141] R13: ffffffff81cc7ca8 R14: ffff88003cac3d40 R15: ffff88003cac37a0
[ 0.380141] FS: 0000000000000000(0000) GS:ffff88003e400000(0000) knlGS:0000000000000000
[ 0.380141] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[ 0.380141] CR2: 0000000000000020 CR3: 0000000001c0e000 CR4: 00000000000006f0
[ 0.380141] Stack:
[ 0.380141] ffff88003c3a9d40 0000000000000000 ffff88003cac3d80 ffff88003cac3d40
[ 0.380141] ffff88003c9f9c48 ffffffff814742e8 ffff88003c26d000 ffff88003c26d000
[ 0.380141] ffff88003c9f9c68 ffffffff81474321 ffff88003c26d000 ffff88003c3a9d40
[ 0.380141] Call Trace:
[ 0.380141] [<ffffffff814742e8>] virtscsi_set_affinity+0x28/0x40
[ 0.380141] [<ffffffff81474321>] virtscsi_remove_vqs+0x21/0x50
[ 0.380141] [<ffffffff81475231>] virtscsi_init+0x91/0x240
[ 0.380141] [<ffffffff81365290>] ? vp_get+0x50/0x70
[ 0.380141] [<ffffffff81475544>] virtscsi_probe+0xf4/0x280
[ 0.380141] [<ffffffff81363ea5>] virtio_dev_probe+0xe5/0x140
[ 0.380141] [<ffffffff8144c669>] driver_probe_device+0x89/0x230
[ 0.380141] [<ffffffff8144c8ab>] __driver_attach+0x9b/0xa0
[ 0.380141] [<ffffffff8144c810>] ? driver_probe_device+0x230/0x230
[ 0.380141] [<ffffffff8144c810>] ? driver_probe_device+0x230/0x230
[ 0.380141] [<ffffffff8144ac1c>] bus_for_each_dev+0x8c/0xb0
[ 0.380141] [<ffffffff8144c499>] driver_attach+0x19/0x20
[ 0.380141] [<ffffffff8144bf28>] bus_add_driver+0x198/0x220
[ 0.380141] [<ffffffff8144ce9f>] driver_register+0x5f/0xf0
[ 0.380141] [<ffffffff81d27c91>] ? spi_transport_init+0x79/0x79
[ 0.380141] [<ffffffff8136403b>] register_virtio_driver+0x1b/0x30
[ 0.380141] [<ffffffff81d27d19>] init+0x88/0xd6
[ 0.380141] [<ffffffff81d27c18>] ? scsi_init_procfs+0x5b/0x5b
[ 0.380141] [<ffffffff81ce88a7>] do_one_initcall+0x7f/0x10a
[ 0.380141] [<ffffffff81ce8aa7>] kernel_init_freeable+0x14a/0x1de
[ 0.380141] [<ffffffff81ce8b3b>] ? kernel_init_freeable+0x1de/0x1de
[ 0.380141] [<ffffffff817dec20>] ? rest_init+0x80/0x80
[ 0.380141] [<ffffffff817dec29>] kernel_init+0x9/0xf0
[ 0.380141] [<ffffffff817e68fc>] ret_from_fork+0x7c/0xb0
[ 0.380141] [<ffffffff817dec20>] ? rest_init+0x80/0x80
[ 0.380141] RIP [<ffffffff814741ef>] __virtscsi_set_affinity+0x4f/0x120
[ 0.380141] RSP <ffff88003c9f9c08>
[ 0.380141] CR2: 0000000000000020
[ 0.380141] ---[ end trace 8074b70c3d5e1d73 ]---
[ 0.475018] Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
[ 0.475018]
[ 0.475068] Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffff9fffffff)
[ 0.475068] ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000009
[jejb: checkpatch fixes]
Signed-off-by: Fam Zheng <famz@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
2014-04-28 16:16:08 -07:00
..
2014-03-19 15:04:44 -07:00
2014-03-19 15:04:44 -07:00
2013-06-04 11:15:59 -07:00
2014-03-15 10:19:19 -07:00
2014-03-19 15:04:44 -07:00
2014-04-01 19:19:15 -07:00
2014-03-19 15:04:47 -07:00
2014-04-07 14:55:46 -07:00
2014-04-07 14:55:46 -07:00
2013-11-15 16:47:22 -08:00
2014-03-15 10:19:18 -07:00
2013-10-25 11:19:33 +01:00
2011-07-26 16:49:47 -07:00
2014-03-19 15:04:44 -07:00
2014-03-20 13:43:45 +01:00
2013-11-15 16:47:22 -08:00
2014-03-19 15:04:44 -07:00
2014-03-15 10:19:17 -07:00
2013-09-04 13:52:35 -07:00
2014-04-01 18:49:04 -07:00
2014-03-15 10:18:58 -07:00
2014-03-15 10:19:21 -07:00
2014-04-28 07:49:25 -07:00
2014-01-30 11:19:05 -08:00
2013-10-14 15:26:04 +02:00
2013-11-23 22:33:47 -08:00
2013-04-09 14:13:21 -04:00
2014-03-19 15:04:44 -07:00
2014-04-12 16:51:08 -07:00
2014-03-15 10:19:18 -07:00
2014-04-12 18:02:16 -07:00
2013-11-15 16:47:22 -08:00
2013-11-29 08:48:39 +04:00
2013-11-29 08:48:39 +04:00
2013-11-29 08:48:39 +04:00
2012-03-28 18:30:03 +01:00
2013-01-03 15:57:01 -08:00
2013-11-26 11:09:07 +01:00
2013-11-26 11:09:07 +01:00
2013-11-26 11:09:07 +01:00
2013-10-25 11:44:54 +01:00
2014-03-19 15:04:44 -07:00
2012-06-28 11:44:36 +02:00
2013-04-09 14:13:23 -04:00
2013-04-09 14:13:29 -04:00
2014-03-10 21:15:09 +01:00
2013-04-09 14:13:29 -04:00
2013-10-14 15:26:04 +02:00
2013-10-25 09:57:57 +01:00
2013-06-26 18:32:47 -07:00
2013-01-03 15:57:01 -08:00
2013-02-27 19:10:18 -08:00
2013-07-09 22:52:29 +01:00
2013-11-15 16:47:22 -08:00
2013-01-03 15:57:01 -08:00
2013-10-25 11:40:42 +01:00
2013-10-25 11:36:26 +01:00
2014-03-19 15:04:44 -07:00
2013-04-09 14:13:17 -04:00
2014-03-19 15:04:44 -07:00
2014-03-19 15:04:44 -07:00
2013-08-01 18:08:34 -07:00
2013-08-01 18:08:34 -07:00
2013-01-03 15:57:01 -08:00
2013-06-26 18:32:47 -07:00
2014-03-19 15:04:44 -07:00
2013-04-09 14:13:16 -04:00
2013-04-09 14:13:16 -04:00
2014-03-19 15:04:44 -07:00
2013-04-09 14:13:16 -04:00
2013-11-26 11:09:07 +01:00
2014-03-15 10:18:59 -07:00
2014-03-15 10:19:23 -07:00
2014-04-21 07:56:53 -07:00
2014-03-15 10:19:23 -07:00
2013-01-03 15:57:01 -08:00
2012-11-27 08:59:43 +04:00
2013-04-09 14:13:16 -04:00
2014-03-19 15:04:44 -07:00
2014-03-19 15:04:44 -07:00
2014-04-01 19:19:15 -07:00
2014-03-19 15:04:42 -07:00
2013-11-29 08:48:39 +04:00
2013-04-09 14:13:27 -04:00
2014-03-15 10:19:19 -07:00
2014-04-11 16:15:36 -04:00
2014-04-11 16:15:36 -04:00
2013-01-03 15:57:01 -08:00
2014-04-10 15:30:35 -07:00
2013-01-03 15:57:01 -08:00
2014-03-15 10:19:18 -07:00
2014-04-03 16:57:19 -07:00
2011-10-31 19:31:24 -04:00
2012-03-28 18:30:03 +01:00
2013-01-03 15:57:01 -08:00
2013-12-19 20:56:28 -08:00
2013-04-09 14:13:17 -04:00
2013-12-19 07:39:02 -08:00
2014-03-27 08:26:31 -07:00
2014-03-27 08:26:31 -07:00
2012-03-28 18:30:03 +01:00
2013-01-03 15:57:01 -08:00
2013-04-09 14:13:15 -04:00
2013-10-14 15:26:04 +02:00
2013-04-15 14:30:44 -06:00
2013-10-14 15:31:06 +02:00
2014-03-19 15:04:44 -07:00
2013-04-09 14:13:17 -04:00
2013-01-03 15:57:01 -08:00
2013-01-03 15:57:01 -08:00
2013-06-19 17:53:35 +02:00
2012-03-28 18:30:03 +01:00
2014-03-19 15:04:44 -07:00
2013-04-09 14:13:17 -04:00
2013-12-06 08:30:18 -08:00
2012-02-21 11:40:37 +01:00
2013-04-09 14:13:17 -04:00
2013-01-03 15:57:01 -08:00
2014-02-27 08:07:39 -08:00
2013-01-03 15:57:01 -08:00
2013-01-03 15:57:01 -08:00
2014-03-19 15:04:37 -07:00
2013-06-24 13:00:10 -07:00
2014-04-21 14:28:40 -07:00
2011-10-31 19:31:23 -04:00
2014-04-21 14:27:26 -07:00
2013-03-28 14:27:24 -04:00
2014-04-10 15:30:35 -07:00
2014-04-10 15:30:35 -07:00
2013-05-31 15:16:51 -04:00
2014-04-11 17:23:52 -07:00
2014-04-01 18:49:04 -07:00
2011-10-31 19:31:23 -04:00
2014-03-15 10:19:24 -07:00
2011-05-24 12:38:36 -04:00
2014-03-15 10:17:50 -07:00
2014-02-20 14:54:28 +01:00
2012-12-01 10:08:41 +00:00
2012-05-10 09:06:12 +01:00
2014-03-24 10:05:30 -07:00
2014-04-11 17:23:52 -07:00
2012-01-03 22:54:07 -05:00
2013-11-23 22:33:50 -08:00
2014-04-11 17:23:52 -07:00
2014-03-27 08:26:33 -07:00
2014-03-27 08:26:31 -07:00
2013-10-25 10:59:54 +01:00
2013-01-03 15:57:01 -08:00
2013-01-03 15:57:01 -08:00
2013-01-03 15:57:01 -08:00
2011-10-31 19:31:24 -04:00
2013-12-16 10:57:51 -08:00
2011-07-21 14:15:58 -07:00
2014-03-15 10:19:22 -07:00
2012-09-14 17:59:29 +01:00
2013-10-14 15:26:04 +02:00
2014-03-12 13:16:54 +04:00
2013-05-04 14:50:16 -04:00
2012-03-28 18:30:03 +01:00
2013-05-04 14:50:16 -04:00
2013-05-04 14:50:16 -04:00
2013-01-03 15:57:01 -08:00
2013-01-03 15:57:01 -08:00
2013-01-03 15:57:01 -08:00
2014-03-19 15:04:44 -07:00
2013-04-09 14:13:17 -04:00
2013-11-15 16:47:22 -08:00
2013-10-25 11:51:37 +01:00
2014-03-19 15:04:44 -07:00
2012-03-28 18:30:03 +01:00
2014-04-28 16:16:08 -07:00
2014-03-19 15:04:46 -07:00
2014-03-19 15:04:46 -07:00
2013-04-09 14:13:15 -04:00
2013-04-09 14:13:15 -04:00
2014-03-19 15:04:44 -07:00
2013-01-03 15:57:01 -08:00
2013-11-26 11:09:07 +01:00