From efb657a55bb573b5b00b48f408b815b4b413612e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Victor?= Date: Mon, 22 Feb 2021 07:34:37 +0100 Subject: [PATCH] Don't read another until this one is read Instead of accepting new input pkts after checking that the input pkt is shaped OK, do it after actually reading the pkt to ITS. Otherwise read pkts can be overwritten while only partially read to ITS, leading to corruption of data. --- src/dvch11.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/dvch11.c b/src/dvch11.c index 3b683e2..bcbfb3d 100644 --- a/src/dvch11.c +++ b/src/dvch11.c @@ -838,6 +838,8 @@ ch11_read(struct device *d, register uint18 addr) fprintf(DVDBF(ch), "[CH11 reading last word, clearing RDN]\r\n"); ch->ch_rcnt = -1; /* read last word */ REG(ch) &= ~CH_RDN; /* Done receiving? */ + ch->ch_inactf = TRUE; /* OK to read another */ + dp_xrdone(dp_dpxfr(&ch->ch_dp)); /* Done, can now ACK */ } break; } @@ -1548,8 +1550,6 @@ chaos_inxfer(register struct ch11 *ch) } REG(ch) |= CH_RDN; /* Note it's done! */ } - ch->ch_inactf = TRUE; /* OK to read another */ - dp_xrdone(dpx); /* Done, can now ACK */ } #endif /* KLH10_DEV_CH11 */