diff mbox series

pata_hpt3x2n: fix writing to wrong register in hpt3x2n_bmdma_stop()

Message ID 2ce292b5-d49f-740e-1445-be7375963a58@omp.ru
State New
Headers show
Series pata_hpt3x2n: fix writing to wrong register in hpt3x2n_bmdma_stop() | expand

Commit Message

Sergey Shtylyov Feb. 7, 2022, 8:32 p.m. UTC
The driver's bmdma_stop() method writes to the wrong PCI config register
(0x52 intead of 0x54) when trying to clear the state machine on secondary
channel -- "luckily", the write falls on a read-only part of the primary
channel MISC. control 1 register, so no collateral damage is done...

Alan Cox fixed the HPT37x driver in commit 6929da4427b4 ("[PATCH] hpt37x:
Two important bug fixes") but forgot to check the HPT3x2N driver which has
the same bug. :-/

Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

---
This patch is against the 'master' branch of Damien Le Moal's 'libata.git'
repo.

 drivers/ata/pata_hpt3x2n.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Sergey Shtylyov Feb. 7, 2022, 8:56 p.m. UTC | #1
On 2/7/22 11:32 PM, Sergey Shtylyov wrote:

> The driver's bmdma_stop() method writes to the wrong PCI config register
> (0x52 intead of 0x54) when trying to clear the state machine on secondary
> channel -- "luckily", the write falls on a read-only part of the primary
> channel MISC. control 1 register, so no collateral damage is done...

   Sorry, s/1/3/. Could you fix while applying please?

> 
> Alan Cox fixed the HPT37x driver in commit 6929da4427b4 ("[PATCH] hpt37x:
> Two important bug fixes") but forgot to check the HPT3x2N driver which has
> the same bug. :-/
> 
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

[...]

MBR, Sergey
Damien Le Moal Feb. 10, 2022, 3:07 a.m. UTC | #2
On 2/8/22 05:32, Sergey Shtylyov wrote:
> The driver's bmdma_stop() method writes to the wrong PCI config register
> (0x52 intead of 0x54) when trying to clear the state machine on secondary
> channel -- "luckily", the write falls on a read-only part of the primary
> channel MISC. control 1 register, so no collateral damage is done...
> 
> Alan Cox fixed the HPT37x driver in commit 6929da4427b4 ("[PATCH] hpt37x:
> Two important bug fixes") but forgot to check the HPT3x2N driver which has
> the same bug. :-/
> 
> Signed-off-by: Sergey Shtylyov <s.shtylyov@omp.ru>

Applied to for-5.18 with commit message fixed. Please check. Thanks !
diff mbox series

Patch

Index: libata/drivers/ata/pata_hpt3x2n.c
===================================================================
--- libata.orig/drivers/ata/pata_hpt3x2n.c
+++ libata/drivers/ata/pata_hpt3x2n.c
@@ -24,7 +24,7 @@ 
 #include <linux/libata.h>
 
 #define DRV_NAME	"pata_hpt3x2n"
-#define DRV_VERSION	"0.3.16"
+#define DRV_VERSION	"0.3.17"
 
 enum {
 	HPT_PCI_FAST	=	(1 << 31),
@@ -251,7 +251,7 @@  static void hpt3x2n_bmdma_stop(struct at
 {
 	struct ata_port *ap = qc->ap;
 	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
-	int mscreg = 0x50 + 2 * ap->port_no;
+	int mscreg = 0x50 + 4 * ap->port_no;
 	u8 bwsr_stat, msc_stat;
 
 	pci_read_config_byte(pdev, 0x6A, &bwsr_stat);