diff options
author | Zheyu Ma <zheyuma97@gmail.com> | 2022-04-21 09:39:20 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-04-27 13:53:54 +0200 |
commit | cf23a960c5c62ddd8283a855a742977ee983a62a (patch) | |
tree | ab6f7dad60bf08d7b980e132a57443c433bb9904 | |
parent | 9ca66d79143980260be615b964b8dc1504a5d0c6 (diff) | |
download | linux-stable-cf23a960c5c62ddd8283a855a742977ee983a62a.tar.gz linux-stable-cf23a960c5c62ddd8283a855a742977ee983a62a.tar.bz2 linux-stable-cf23a960c5c62ddd8283a855a742977ee983a62a.zip |
ata: pata_marvell: Check the 'bmdma_addr' beforing reading
commit aafa9f958342db36c17ac2a7f1b841032c96feb4 upstream.
Before detecting the cable type on the dma bar, the driver should check
whether the 'bmdma_addr' is zero, which means the adapter does not
support DMA, otherwise we will get the following error:
[ 5.146634] Bad IO access at port 0x1 (return inb(port))
[ 5.147206] WARNING: CPU: 2 PID: 303 at lib/iomap.c:44 ioread8+0x4a/0x60
[ 5.150856] RIP: 0010:ioread8+0x4a/0x60
[ 5.160238] Call Trace:
[ 5.160470] <TASK>
[ 5.160674] marvell_cable_detect+0x6e/0xc0 [pata_marvell]
[ 5.161728] ata_eh_recover+0x3520/0x6cc0
[ 5.168075] ata_do_eh+0x49/0x3c0
Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/ata/pata_marvell.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/ata/pata_marvell.c b/drivers/ata/pata_marvell.c index b066809ba9a1..c56f4043b0cc 100644 --- a/drivers/ata/pata_marvell.c +++ b/drivers/ata/pata_marvell.c @@ -83,6 +83,8 @@ static int marvell_cable_detect(struct ata_port *ap) switch(ap->port_no) { case 0: + if (!ap->ioaddr.bmdma_addr) + return ATA_CBL_PATA_UNK; if (ioread8(ap->ioaddr.bmdma_addr + 1) & 1) return ATA_CBL_PATA40; return ATA_CBL_PATA80; |