1
0
Fork 0
remarkable-linux/drivers/ide
Borislav Petkov fbc3edf7d7 drivers/ide-cd: Handle missing driver data during status check gracefully
The 0day bot reports the below failure which happens occasionally, with
their randconfig testing (once every ~100 boots).  The Code points at
the private pointer ->driver_data being NULL, which hints at a race of
sorts where the private driver_data descriptor has disappeared by the
time we get to run the workqueue.

So let's check that pointer before we continue with issuing the command
to the drive.

This fix is of the brown paper bag nature but considering that IDE is
long deprecated, let's do that so that random testing which happens to
enable CONFIG_IDE during randconfig builds, doesn't fail because of
this.

Besides, failing the TEST_UNIT_READY command because the drive private
data is gone is something which we could simply do anyway, to denote
that there was a problem communicating with the device.

  BUG: unable to handle kernel NULL pointer dereference at 000001c0
  IP: cdrom_check_status
  *pde = 00000000
  Oops: 0000 [#1] SMP
  CPU: 1 PID: 155 Comm: kworker/1:2 Not tainted 4.14.0-rc8 #127
  Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1 04/01/2014
  Workqueue: events_freezable_power_ disk_events_workfn
  task: 4fe90980 task.stack: 507ac000
  EIP: cdrom_check_status+0x2c/0x90
  EFLAGS: 00210246 CPU: 1
  EAX: 00000000 EBX: 4fefec00 ECX: 00000000 EDX: 00000000
  ESI: 00000003 EDI: ffffffff EBP: 467a9340 ESP: 507aded0
   DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
  CR0: 80050033 CR2: 000001c0 CR3: 06e0f000 CR4: 00000690
  Call Trace:
   ? ide_cdrom_check_events_real
   ? cdrom_check_events
   ? disk_check_events
   ? process_one_work
   ? process_one_work
   ? worker_thread
   ? kthread
   ? process_one_work
   ? __kthread_create_on_node
   ? ret_from_fork
  Code: 53 83 ec 14 89 c3 89 d1 be 03 00 00 00 65 a1 14 00 00 00 89 44 24 10 31 c0 8b 43 18 c7 44 24 04 00 00 00 00 c7 04 24 00 00 00 00 <8a> 80 c0 01 00 00 c7 44 24 08 00 00 00 00 83 e0 03 c7 44 24 0c
  EIP: cdrom_check_status+0x2c/0x90 SS:ESP: 0068:507aded0
  CR2: 00000000000001c0
  ---[ end trace 2410e586dd8f88b2 ]---

Reported-and-tested-by: Fengguang Wu <fengguang.wu@intel.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Cc: "David S. Miller" <davem@davemloft.net>
Cc: Jens Axboe <axboe@kernel.dk>
Cc: Bart Van Assche <bart.vanassche@sandisk.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-11-07 09:12:04 -08:00
..
Kconfig block: make scsi_request and scsi ioctl support optional 2017-01-31 10:53:05 -07:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
aec62xx.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
ali14xx.c sections: fix section conflicts in drivers/ide 2012-10-06 03:04:41 +09:00
alim15x3.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
amd74xx.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
atiixp.c Drivers: ide: Remove typedef atiixp_ide_timing 2014-10-15 14:27:38 -04:00
au1xxx-ide.c ide: drop owner assignment from platform_drivers 2014-10-20 16:20:38 +02:00
buddha.c zorro: ZTWO_VADDR() should return "void __iomem *" 2013-11-26 11:09:07 +01:00
cmd64x.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
cmd640.c cmd640: add __init attribute 2016-07-26 15:25:30 -07:00
cs5520.c ide: remove deprecated use of pci api 2015-04-17 15:32:07 -04:00
cs5530.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
cs5535.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
cs5536.c ide: cs5536: use module_pci_driver() 2013-11-14 18:21:25 -05:00
cy82c693.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
delkin_cb.c drivers/ide/delkin_cb: Convert to module_pci_driver 2013-07-10 12:09:10 -07:00
dtc2278.c sections: fix section conflicts in drivers/ide 2012-10-06 03:04:41 +09:00
falconide.c
gayle.c ide: drop owner assignment from platform_drivers 2014-10-20 16:20:38 +02:00
hpt366.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
ht6560b.c sections: fix section conflicts in drivers/ide 2012-10-06 03:04:41 +09:00
icside.c ide: icside: remove incorrect initconst annotation 2016-03-20 16:59:27 -04:00
ide-4drives.c module_param: make bool parameters really bool (drivers & misc) 2012-01-13 09:32:20 +10:30
ide-acpi.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-atapi.c block: Change argument type of scsi_req_init() 2017-06-20 19:27:14 -06:00
ide-cd.c drivers/ide-cd: Handle missing driver data during status check gracefully 2017-11-07 09:12:04 -08:00
ide-cd.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-cd_ioctl.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-cd_verbose.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-cs.c drivers/ide/ide-cs.c: adjust suspicious bit operation 2012-06-12 15:51:41 -07:00
ide-devsets.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-disk.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-disk.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-disk_ioctl.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-disk_proc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-dma-sff.c ide/ata: Add export.h for EXPORT_SYMBOL/THIS_MODULE where needed 2011-10-31 19:31:37 -04:00
ide-dma.c block: introduce new block status code type 2017-06-09 09:27:32 -06:00
ide-eh.c block: introduce new block status code type 2017-06-09 09:27:32 -06:00
ide-floppy.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-floppy.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-floppy_ioctl.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-floppy_proc.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-gd.c block: convert to device_add_disk() 2016-06-27 12:26:08 -07:00
ide-gd.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-generic.c Revert "ide: Fix interface autodetection in legacy IDE driver (trial #2)" 2017-01-09 15:27:59 -05:00
ide-io-std.c ide/ata: Add export.h for EXPORT_SYMBOL/THIS_MODULE where needed 2011-10-31 19:31:37 -04:00
ide-io.c block: introduce new block status code type 2017-06-09 09:27:32 -06:00
ide-ioctls.c block: Make most scsi_req_init() calls implicit 2017-06-20 19:27:14 -06:00
ide-iops.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
ide-legacy.c ide/ata: Add export.h for EXPORT_SYMBOL/THIS_MODULE where needed 2011-10-31 19:31:37 -04:00
ide-lib.c ide,ata: Rename ATA_IDX to ATA_SENSE 2015-03-27 11:59:22 -04:00
ide-park.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-pci-generic.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
ide-pio-blacklist.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-pm.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-pnp.c PNP: ide/ide-pnp: Use module_pnp_driver to register driver 2015-03-18 22:39:17 +01:00
ide-probe.c ide: free hwif->portdev on hwif_init() failure 2017-10-03 13:36:17 -05:00
ide-proc.c Replace <asm/uaccess.h> with <linux/uaccess.h> globally 2016-12-24 11:46:01 -08:00
ide-scan-pci.c ide: fix IRQ assignment for PCI bus order probing 2017-10-03 14:03:31 -05:00
ide-sysfs.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
ide-tape.c block: Make most scsi_req_init() calls implicit 2017-06-20 19:27:14 -06:00
ide-taskfile.c block: Make most scsi_req_init() calls implicit 2017-06-20 19:27:14 -06:00
ide-timings.c ide: avoid warning for timings calculation 2017-07-21 04:37:22 +01:00
ide-xfer-mode.c ide/ata: Add export.h for EXPORT_SYMBOL/THIS_MODULE where needed 2011-10-31 19:31:37 -04:00
ide.c ide: silence some underflow warnings 2016-01-18 14:12:33 -05:00
ide_platform.c ide: drop owner assignment from platform_drivers 2014-10-20 16:20:38 +02:00
it821x.c ide: constify ide_dma_ops structures 2016-01-18 14:12:33 -05:00
it8172.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
it8213.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
jmicron.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
macide.c ide/ata: Add module.h to the implicit modular users 2011-10-31 19:31:37 -04:00
ns87415.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
opti621.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
palm_bk3710.c ide: palm_bk3710: add __initdata to palm_bk3710_port_info 2017-02-27 20:43:26 -05:00
pdc202xx_new.c PCI: Remove includes of asm/pci-bridge.h 2016-02-05 16:29:28 -06:00
pdc202xx_old.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
piix.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
pmac.c ide: pmac: Convert to using %pOF instead of full_name 2017-09-01 16:42:51 +10:00
q40ide.c ide/ata: Add module.h to the implicit modular users 2011-10-31 19:31:37 -04:00
qd65xx.c sections: fix section conflicts in drivers/ide 2012-10-06 03:04:41 +09:00
qd65xx.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
rapide.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
rz1000.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
sc1200.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
serverworks.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
setup-pci.c ide: pci: free PCI BARs on initialization failure 2017-10-03 14:02:57 -05:00
sgiioc4.c ide: remove deprecated use of pci api 2015-04-17 15:32:07 -04:00
siimage.c block: introduce new block status code type 2017-06-09 09:27:32 -06:00
sis5513.c block: split scsi_request out of struct request 2017-01-27 15:08:35 -07:00
sl82c105.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
slc90e66.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
tc86c001.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
triflex.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00
trm290.c ide: constify ide_dma_ops structures 2016-01-18 14:12:33 -05:00
tx4938ide.c ide: drop owner assignment from platform_drivers 2014-10-20 16:20:38 +02:00
tx4939ide.c ide: drop owner assignment from platform_drivers 2014-10-20 16:20:38 +02:00
umc8672.c sections: fix section conflicts in drivers/ide 2012-10-06 03:04:41 +09:00
via82cxxx.c Drivers: ide: remove __dev* attributes. 2013-01-03 15:57:03 -08:00