mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-09-18 22:14:16 +00:00
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> |
||
|---|---|---|
| .. | ||
| aacraid | ||
| aic7xxx | ||
| aic94xx | ||
| arcmsr | ||
| arm | ||
| be2iscsi | ||
| bfa | ||
| bnx2fc | ||
| bnx2i | ||
| csiostor | ||
| cxgbi | ||
| device_handler | ||
| dpt | ||
| esas2r | ||
| fcoe | ||
| fnic | ||
| ibmvscsi | ||
| isci | ||
| libfc | ||
| libsas | ||
| lpfc | ||
| megaraid | ||
| mpt2sas | ||
| mpt3sas | ||
| mvsas | ||
| osd | ||
| pcmcia | ||
| pm8001 | ||
| qla2xxx | ||
| qla4xxx | ||
| sym53c8xx_2 | ||
| ufs | ||
| .gitignore | ||
| 3w-9xxx.c | ||
| 3w-9xxx.h | ||
| 3w-sas.c | ||
| 3w-sas.h | ||
| 3w-xxxx.c | ||
| 3w-xxxx.h | ||
| 53c700.c | ||
| 53c700.h | ||
| 53c700.scr | ||
| 53c700_d.h_shipped | ||
| a100u2w.c | ||
| a100u2w.h | ||
| a2091.c | ||
| a2091.h | ||
| a3000.c | ||
| a3000.h | ||
| a4000t.c | ||
| advansys.c | ||
| aha152x.c | ||
| aha152x.h | ||
| aha1542.c | ||
| aha1542.h | ||
| aha1740.c | ||
| aha1740.h | ||
| atari_NCR5380.c | ||
| atari_scsi.c | ||
| atari_scsi.h | ||
| atp870u.c | ||
| atp870u.h | ||
| BusLogic.c | ||
| BusLogic.h | ||
| bvme6000_scsi.c | ||
| ch.c | ||
| constants.c | ||
| dc395x.c | ||
| dc395x.h | ||
| dmx3191d.c | ||
| dpt_i2o.c | ||
| dpti.h | ||
| dtc.c | ||
| dtc.h | ||
| eata.c | ||
| eata_generic.h | ||
| eata_pio.c | ||
| eata_pio.h | ||
| esp_scsi.c | ||
| esp_scsi.h | ||
| fdomain.c | ||
| fdomain.h | ||
| FlashPoint.c | ||
| g_NCR5380.c | ||
| g_NCR5380.h | ||
| g_NCR5380_mmio.c | ||
| gdth.c | ||
| gdth.h | ||
| gdth_ioctl.h | ||
| gdth_proc.c | ||
| gdth_proc.h | ||
| gvp11.c | ||
| gvp11.h | ||
| hosts.c | ||
| hpsa.c | ||
| hpsa.h | ||
| hpsa_cmd.h | ||
| hptiop.c | ||
| hptiop.h | ||
| imm.c | ||
| imm.h | ||
| in2000.c | ||
| in2000.h | ||
| initio.c | ||
| initio.h | ||
| ipr.c | ||
| ipr.h | ||
| ips.c | ||
| ips.h | ||
| iscsi_boot_sysfs.c | ||
| iscsi_tcp.c | ||
| iscsi_tcp.h | ||
| jazz_esp.c | ||
| Kconfig | ||
| lasi700.c | ||
| libiscsi.c | ||
| libiscsi_tcp.c | ||
| libsrp.c | ||
| mac53c94.c | ||
| mac53c94.h | ||
| mac_esp.c | ||
| mac_scsi.c | ||
| mac_scsi.h | ||
| Makefile | ||
| megaraid.c | ||
| megaraid.h | ||
| mesh.c | ||
| mesh.h | ||
| mvme16x_scsi.c | ||
| mvme147.c | ||
| mvme147.h | ||
| mvumi.c | ||
| mvumi.h | ||
| ncr53c8xx.c | ||
| ncr53c8xx.h | ||
| NCR53c406a.c | ||
| NCR5380.c | ||
| NCR5380.h | ||
| NCR_D700.c | ||
| NCR_D700.h | ||
| NCR_Q720.c | ||
| NCR_Q720.h | ||
| nsp32.c | ||
| nsp32.h | ||
| nsp32_debug.c | ||
| nsp32_io.h | ||
| osst.c | ||
| osst.h | ||
| osst_detect.h | ||
| osst_options.h | ||
| pas16.c | ||
| pas16.h | ||
| pmcraid.c | ||
| pmcraid.h | ||
| ppa.c | ||
| ppa.h | ||
| ps3rom.c | ||
| qla1280.c | ||
| qla1280.h | ||
| qlogicfas.c | ||
| qlogicfas408.c | ||
| qlogicfas408.h | ||
| qlogicpti.c | ||
| qlogicpti.h | ||
| raid_class.c | ||
| script_asm.pl | ||
| scsi.c | ||
| scsi.h | ||
| scsi_debug.c | ||
| scsi_devinfo.c | ||
| scsi_error.c | ||
| scsi_ioctl.c | ||
| scsi_lib.c | ||
| scsi_lib_dma.c | ||
| scsi_logging.h | ||
| scsi_module.c | ||
| scsi_netlink.c | ||
| scsi_pm.c | ||
| scsi_priv.h | ||
| scsi_proc.c | ||
| scsi_sas_internal.h | ||
| scsi_scan.c | ||
| scsi_sysctl.c | ||
| scsi_sysfs.c | ||
| scsi_tgt_if.c | ||
| scsi_tgt_lib.c | ||
| scsi_tgt_priv.h | ||
| scsi_trace.c | ||
| scsi_transport_api.h | ||
| scsi_transport_fc.c | ||
| scsi_transport_fc_internal.h | ||
| scsi_transport_iscsi.c | ||
| scsi_transport_sas.c | ||
| scsi_transport_spi.c | ||
| scsi_transport_srp.c | ||
| scsi_transport_srp_internal.h | ||
| scsi_typedefs.h | ||
| scsicam.c | ||
| sd.c | ||
| sd.h | ||
| sd_dif.c | ||
| ses.c | ||
| sg.c | ||
| sgiwd93.c | ||
| sim710.c | ||
| sni_53c710.c | ||
| sr.c | ||
| sr.h | ||
| sr_ioctl.c | ||
| sr_vendor.c | ||
| st.c | ||
| st.h | ||
| st_options.h | ||
| stex.c | ||
| storvsc_drv.c | ||
| sun3_NCR5380.c | ||
| sun3_scsi.c | ||
| sun3_scsi.h | ||
| sun3_scsi_vme.c | ||
| sun3x_esp.c | ||
| sun_esp.c | ||
| sym53c416.c | ||
| sym53c416.h | ||
| t128.c | ||
| t128.h | ||
| tmscsim.c | ||
| tmscsim.h | ||
| u14-34f.c | ||
| ultrastor.c | ||
| ultrastor.h | ||
| virtio_scsi.c | ||
| vmw_pvscsi.c | ||
| vmw_pvscsi.h | ||
| wd33c93.c | ||
| wd33c93.h | ||
| wd7000.c | ||
| zalon.c | ||
| zorro7xx.c | ||