Skip to contentSkip to conversation

pata_hpt3x2n: check channel enable bits

PATCH Applied Sergey Shtylyov 2 participants 5 messages Feb 7, 2022 – Feb 10, 2022 libata

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 pata_hpt3x2n: check channel enable bits

The driver's prereset() method still doesn't check the channel enable bits. The bug was there for the entire time the driver has existed. :-/

Alan Cox fixed the HPT37x driver in commit b5bf24b94c65 ("[PATCH] hpt37x:
Check the enablebits") but forgot to check the HPT3x2N driver which has the same bug. :-/

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

Changes in version 3:
- added a passage to the patch description about Alan Cox missing to fix the driver back in 2006.

Changes in version 2:
- updated #define DRV_VERSION;
- fixed typo in the patch description.

 drivers/ata/pata_hpt3x2n.c |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/ata/pata_hpt3x2n.c +8 -1
Index: libata/drivers/ata/pata_hpt3x2n.c
===================================================================
@@ -24,7 +24,7 @@
 #include <linux/libata.h>
 
 #define DRV_NAME	"pata_hpt3x2n"
-#define DRV_VERSION	"0.3.15"
+#define DRV_VERSION	"0.3.16"
 
 enum {
 	HPT_PCI_FAST	=	(1 << 31),
@@ -168,6 +168,13 @@ static int hpt3x2n_pre_reset(struct ata_
 {
 	struct ata_port *ap = link->ap;
 	struct pci_dev *pdev = to_pci_dev(ap->host->dev);
+	static const struct pci_bits hpt3x2n_enable_bits[] = {
+		{ 0x50, 1, 0x04, 0x04 },
+		{ 0x54, 1, 0x04, 0x04 }
+	};
+
+	if (!pci_test_config_bits(pdev, &hpt3x2n_enable_bits[ap->port_no]))
+		return -ENOENT;
 
 	/* Reset the state machine */
 	pci_write_config_byte(pdev, 0x50 + 4 * ap->port_no, 0x37);
#1 lore raw
Quoted 8 lines · Sergey Shtylyov

The driver's prereset() method still doesn't check the channel enable bits. The bug was there for the entire time the driver has existed. :-/

Alan Cox fixed the HPT37x driver in commit b5bf24b94c65 ("[PATCH] hpt37x:
Check the enablebits") but forgot to check the HPT3x2N driver which has the same bug. :-/

Applied to for-5.18. Thanks !

Signature · 2 lines
Damien Le Moal
Western Digital Research
#2 lore raw
Quoted 10 lines · Damien Le Moal
Quoted 8 lines

The driver's prereset() method still doesn't check the channel enable bits. The bug was there for the entire time the driver has existed. :-/

Alan Cox fixed the HPT37x driver in commit b5bf24b94c65 ("[PATCH] hpt37x:
Check the enablebits") but forgot to check the HPT3x2N driver which has the same bug. :-/

Applied to for-5.18. Thanks !

What about the (analogous) pata_hpoet366 paych?

MBR, Sergey

#3 lore raw
Quoted 9 lines · Sergey Shtylyov
Quoted 7 lines · Damien Le Moal
Quoted 7 lines

The driver's prereset() method still doesn't check the channel enable bits. The bug was there for the entire time the driver has existed. :-/

Alan Cox fixed the HPT37x driver in commit b5bf24b94c65 ("[PATCH] hpt37x:
Check the enablebits") but forgot to check the HPT3x2N driver which has the same bug. :-/

Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Applied to for-5.18. Thanks !

What about the (analogous) pata_hpoet366 paych?

I think it fell through the cracks: I can't find it... Can you resend ?

Quoted 2 lines

MBR, Sergey

Signature · 2 lines
Damien Le Moal
Western Digital Research
#4 lore raw
Quoted 7 lines · Damien Le Moal
Quoted 7 lines
Quoted 7 lines
Quoted 7 lines

The driver's prereset() method still doesn't check the channel enable bits. The bug was there for the entire time the driver has existed. :-/

Alan Cox fixed the HPT37x driver in commit b5bf24b94c65 ("[PATCH] hpt37x:
Check the enablebits") but forgot to check the HPT3x2N driver which has the same bug. :-/

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Quoted 1 line

Applied to for-5.18. Thanks !

What about the (analogous) pata_hpoet366 paych?

I think it fell through the cracks: I can't find it... Can you resend ?

Done.

MBR, Sergey