[PATCH] parport: mfc3: use port A DDR for status lines
From: raoxu
Date: Wed Jun 24 2026 - 01:53:13 EST
From: Xu Rao <raoxu@xxxxxxxxxxxxx>
mfc3_save_state() and mfc3_restore_state() clear PIA_DDR in CRA to
expose the port A data-direction register, but then access the port B
register address through PDDRB.
At that point CRB selects the port B data register, so the save path
stores the port B data latch in statusdir and the restore path writes
statusdir back to the port B data latch. The port A direction register
is therefore never saved or restored, and restoring an initialized
state can replace the restored data byte with 0xe0.
Access PDDRA while CRA exposes the port A DDR.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Xu Rao <raoxu@xxxxxxxxxxxxx>
---
drivers/parport/parport_mfc3.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/parport/parport_mfc3.c b/drivers/parport/parport_mfc3.c
index bb18172..ccb5bb3 100644
--- a/drivers/parport/parport_mfc3.c
+++ b/drivers/parport/parport_mfc3.c
@@ -226,7 +226,7 @@ static void mfc3_save_state(struct parport *p, struct parport_state *s)
pia(p)->crb |= PIA_DDR;
s->u.amiga.status = pia(p)->ppra;
pia(p)->cra &= ~PIA_DDR;
- s->u.amiga.statusdir = pia(p)->pddrb;
+ s->u.amiga.statusdir = pia(p)->pddra;
pia(p)->cra |= PIA_DDR;
}
@@ -238,7 +238,7 @@ static void mfc3_restore_state(struct parport *p, struct parport_state *s)
pia(p)->crb |= PIA_DDR;
pia(p)->ppra = s->u.amiga.status;
pia(p)->cra &= ~PIA_DDR;
- pia(p)->pddrb = s->u.amiga.statusdir;
+ pia(p)->pddra = s->u.amiga.statusdir;
pia(p)->cra |= PIA_DDR;
}
--
2.47.3