linux/drivers/ata
Tejun Heo 5f6f12ccf3 libata: fix oops when LPM is used with PMP
ae01b2493c (libata: Implement ATA_FLAG_NO_DIPM and apply it to mcp65)
added ATA_FLAG_NO_DIPM and made ata_eh_set_lpm() check the flag.
However, @ap is NULL if @link points to a PMP link and thus the
unconditional @ap->flags dereference leads to the following oops.

  BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
  IP: [<ffffffff813f98e1>] ata_eh_recover+0x9a1/0x1510
  ...
  Pid: 295, comm: scsi_eh_4 Tainted: P            2.6.38.5-core2 #1 System76, Inc. Serval Professional/Serval Professional
  RIP: 0010:[<ffffffff813f98e1>]  [<ffffffff813f98e1>] ata_eh_recover+0x9a1/0x1510
  RSP: 0018:ffff880132defbf0  EFLAGS: 00010246
  RAX: 0000000000000000 RBX: ffff880132f40000 RCX: 0000000000000000
  RDX: ffff88013377c000 RSI: ffff880132f40000 RDI: 0000000000000000
  RBP: ffff880132defce0 R08: ffff88013377dc58 R09: ffff880132defd98
  R10: 0000000000000000 R11: 00000000ffffffff R12: 0000000000000000
  R13: 0000000000000000 R14: ffff88013377c000 R15: 0000000000000000
  FS:  0000000000000000(0000) GS:ffff8800bf700000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
  CR2: 0000000000000018 CR3: 0000000001a03000 CR4: 00000000000406e0
  DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
  DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
  Process scsi_eh_4 (pid: 295, threadinfo ffff880132dee000, task ffff880133b416c0)
  Stack:
   0000000000000000 ffff880132defcc0 0000000000000000 ffff880132f42738
   ffffffff813ee8f0 ffffffff813eefe0 ffff880132defd98 ffff88013377f190
   ffffffffa00b3e30 ffffffff813ef030 0000000032defc60 ffff880100000000
  Call Trace:
   [<ffffffff81400867>] sata_pmp_error_handler+0x607/0xc30
   [<ffffffffa00b273f>] ahci_error_handler+0x1f/0x70 [libahci]
   [<ffffffff813faade>] ata_scsi_error+0x5be/0x900
   [<ffffffff813cf724>] scsi_error_handler+0x124/0x650
   [<ffffffff810834b6>] kthread+0x96/0xa0
   [<ffffffff8100cd64>] kernel_thread_helper+0x4/0x10
  Code: 8b 95 70 ff ff ff b8 00 00 00 00 48 3b 9a 10 2e 00 00 48 0f 44 c2 48 89 85 70 ff ff ff 48 8b 8d 70 ff ff ff f6 83 69 02 00 00 01 <48> 8b 41 18 0f 85 48 01 00 00 48 85 c9 74 12 48 8b 51 08 48 83
  RIP  [<ffffffff813f98e1>] ata_eh_recover+0x9a1/0x1510
   RSP <ffff880132defbf0>
  CR2: 0000000000000018

Fix it by testing @link->ap->flags instead.

stable: ATA_FLAG_NO_DIPM was added during 2.6.39 cycle but was
        backported to 2.6.37 and 38.  This is a fix for that and thus
        also applicable to 2.6.37 and 38.

Signed-off-by: Tejun Heo <tj@kernel.org>
Reported-by: "Nathan A. Mourey II" <nmoureyii@ne.rr.com>
LKML-Reference: <1304555277.2059.2.camel@localhost.localdomain>
Cc: Connor H <cmdkhh@gmail.com>
Cc: stable@kernel.org
Signed-off-by: Jeff Garzik <jgarzik@pobox.com>
2011-05-14 14:51:40 -04:00
..
acard-ahci.c [libata] new driver acard_ahci, for ATP8620 host controller 2011-01-05 19:43:22 -05:00
ahci_platform.c libata: reimplement link power management 2010-10-21 20:21:04 -04:00
ahci.c ahci: AHCI-mode SATA patch for Intel Panther Point DeviceIDs 2011-04-24 11:34:05 -04:00
ahci.h ahci: EM supported message type sysfs attribute 2011-04-24 11:31:31 -04:00
ata_generic.c [libata] trivial: trim trailing whitespace for drivers/ata/*.[ch] 2011-03-02 02:36:45 -05:00
ata_piix.c ata_piix: IDE-mode SATA patch for Intel Panther Point DeviceIDs 2011-04-24 11:34:05 -04:00
Kconfig pata_arasan_cf: Adding support for arasan compact flash host controller 2011-03-14 02:52:46 -04:00
libahci.c libata: ahci_start_engine compliant to AHCI spec 2011-04-24 11:35:40 -04:00
libata-acpi.c libata: remove ATA_FLAG_MMIO 2011-03-02 02:36:46 -05:00
libata-core.c libata: Pioneer DVR-216D can't do SETXFER 2011-04-24 11:34:05 -04:00
libata-eh.c libata: fix oops when LPM is used with PMP 2011-05-14 14:51:40 -04:00
libata-pmp.c libata: implement LPM support for port multipliers 2010-10-21 20:21:04 -04:00
libata-scsi.c Fix common misspellings 2011-03-31 11:26:23 -03:00
libata-sff.c Fix common misspellings 2011-03-31 11:26:23 -03:00
libata-transport.c drivers/ata/libata-transport.c: include linux/slab.h 2010-10-21 20:21:04 -04:00
libata-transport.h [libata] Add ATA transport class 2010-10-21 20:21:03 -04:00
libata.h libata: plumb sas port scan into standard libata paths 2011-03-02 02:36:45 -05:00
Makefile pata_arasan_cf: Adding support for arasan compact flash host controller 2011-03-14 02:52:46 -04:00
pata_acpi.c libata: remove ATA_FLAG_{SRST|SATA_RESET} 2011-03-02 02:36:46 -05:00
pata_ali.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_amd.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_arasan_cf.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_artop.c pata_artop: Fix device ID parity check 2010-09-09 14:19:18 -04:00
pata_at32.c libata: remove ATA_FLAG_MMIO 2011-03-02 02:36:46 -05:00
pata_at91.c ata: pata_at91.c bugfix for initial_timing initialisation 2011-04-24 11:34:06 -04:00
pata_atiixp.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_atp867x.c libata-sff: separate out BMDMA irq handler 2010-05-25 19:40:24 -04:00
pata_bf54x.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_cmd64x.c pata_cmd64x: revert commit d62f5576 2010-08-25 19:24:15 -04:00
pata_cmd640.c pata_cmd640: implement sff_irq_check() method 2010-10-21 20:21:05 -04:00
pata_cs5520.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_cs5530.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_cs5535.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_cs5536.c pata_cs5536: avoid implicit MSR API inclusion on x86-64 2010-12-26 19:42:15 -05:00
pata_cypress.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_efar.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_hpt3x2n.c ata: pata: Convert pr_*(DRV_NAME ...) to pr_fmt/pr_<level> 2011-03-14 02:56:31 -04:00
pata_hpt3x3.c [libata] trivial: trim trailing whitespace for drivers/ata/*.[ch] 2011-03-02 02:36:45 -05:00
pata_hpt37x.c ata: pata: Convert pr_*(DRV_NAME ...) to pr_fmt/pr_<level> 2011-03-14 02:56:31 -04:00
pata_hpt366.c ata: pata: Convert pr_*(DRV_NAME ...) to pr_fmt/pr_<level> 2011-03-14 02:56:31 -04:00
pata_icside.c libata-sff: separate out BMDMA irq handler 2010-05-25 19:40:24 -04:00
pata_isapnp.c [libata] Improve timeout handling 2009-03-24 22:52:39 -04:00
pata_it821x.c [libata] trivial: trim trailing whitespace for drivers/ata/*.[ch] 2011-03-02 02:36:45 -05:00
pata_it8213.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_ixp4xx_cf.c drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
pata_jmicron.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_legacy.c pata_legacy: fix CONFIG_PATA_WINBOND_VLB_MODULE test 2010-11-12 17:10:53 -05:00
pata_macio.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
pata_marvell.c [libata] trivial: trim trailing whitespace for drivers/ata/*.[ch] 2011-03-02 02:36:45 -05:00
pata_mpc52xx.c dt: Eliminate of_platform_{,un}register_driver 2011-02-28 13:22:46 -07:00
pata_mpiix.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_netcell.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_ninja32.c [libata] trivial: trim trailing whitespace for drivers/ata/*.[ch] 2011-03-02 02:36:45 -05:00
pata_ns87410.c libata: Pass host flags into the pci helper 2010-03-01 14:58:46 -05:00
pata_ns87415.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_octeon_cf.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
pata_of_platform.c dt: Eliminate of_platform_{,un}register_driver 2011-02-28 13:22:46 -07:00
pata_oldpiix.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_opti.c libata: Pass host flags into the pci helper 2010-03-01 14:58:46 -05:00
pata_optidma.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_palmld.c Merge branch 'devel' of git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa-linux-2.6 into devel-stable 2011-03-26 10:03:03 +00:00
pata_pcmcia.c [libata] trivial: trim trailing whitespace for drivers/ata/*.[ch] 2011-03-02 02:36:45 -05:00
pata_pdc202xx_old.c pata_pdc202xx_old: implement sff_irq_check() method 2010-10-21 20:21:06 -04:00
pata_pdc2027x.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
pata_piccolo.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_platform.c libata-sff: clean up BMDMA initialization 2010-05-19 13:32:19 -04:00
pata_pxa.c libata: remove ATA_FLAG_MMIO 2011-03-02 02:36:46 -05:00
pata_qdi.c [libata] convert drivers to use ata.h mode mask defines 2009-03-24 22:13:27 -04:00
pata_radisys.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_rb532_cf.c drivers: Final irq namespace conversion 2011-03-29 14:48:19 +02:00
pata_rdc.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_rz1000.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_samsung_cf.c libata: remove ATA_FLAG_MMIO 2011-03-02 02:36:46 -05:00
pata_sc1200.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_scc.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
pata_sch.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_serverworks.c libata-sff: separate out BMDMA init 2010-05-25 19:40:30 -04:00
pata_sil680.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_sis.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_sl82c105.c pata_sl82c105: implement sff_irq_check() method 2010-10-21 20:21:06 -04:00
pata_triflex.c Fix common misspellings 2011-03-31 11:26:23 -03:00
pata_via.c libata,pata_via: revert ata_wait_idle() removal from ata_sff/via_tf_load() 2010-09-09 22:27:44 -04:00
pdc_adma.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sata_dwc_460ex.c Merge branch 'devicetree/next' of git://git.secretlab.ca/git/linux-2.6 2011-03-16 17:28:10 -07:00
sata_fsl.c Fix common misspellings 2011-03-31 11:26:23 -03:00
sata_inic162x.c libata: add @ap to ata_wait_register() and introduce ata_msleep() 2010-10-21 20:21:05 -04:00
sata_mv.c Fix common misspellings 2011-03-31 11:26:23 -03:00
sata_nv.c Fix common misspellings 2011-03-31 11:26:23 -03:00
sata_promise.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sata_promise.h libata annotations and fixes 2008-01-23 05:24:15 -05:00
sata_qstor.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sata_sil24.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sata_sil.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sata_sis.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sata_svw.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sata_sx4.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sata_uli.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sata_via.c Fix common misspellings 2011-03-31 11:26:23 -03:00
sata_vsc.c libata: remove ATA_FLAG_NO_LEGACY 2011-03-02 02:36:46 -05:00
sis.h libata: PATA-mode fixes for sis_sata 2007-07-02 10:17:42 -04:00