Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1548851
| Path | csiph.com!aioe.org!bofh.it!news.nic.it!robomod |
|---|---|
| From | Finn Thain <fthain@telegraphics.com.au> |
| Newsgroups | linux.kernel |
| Subject | [PATCH RESEND 05/10] via-cuda: Fix re-initialization of reply_ptr and reading_reply |
| Date | Sun, 01 Jan 2017 02:00:01 +0100 |
| Message-ID | <sUCFb-1FL-11@gated-at.bofh.it> (permalink) |
| References | <sUCFb-1FL-3@gated-at.bofh.it> |
| Sender | robomod@news.nic.it |
| List-ID | <linux-kernel.vger.kernel.org> |
| X-Mailing-List | linux-kernel@vger.kernel.org |
| Approved | robomod@news.nic.it |
| Lines | 43 |
| Organization | linux.* mail to news gateway |
| X-Original-Cc | linux-m68k@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org |
| X-Original-Date | Sat, 31 Dec 2016 19:56:26 -0500 (EST) |
| X-Original-Message-ID | <8ede5ed39315f7113b58ec5468ba6fe6c2274181.1483055859.git.fthain@telegraphics.com.au> |
| X-Original-References | <cover.1483055859.git.fthain@telegraphics.com.au> |
| X-Original-Sender | linux-kernel-owner@vger.kernel.org |
| Xref | csiph.com linux.kernel:1548851 |
Show key headers only | View raw
When reading_reply is set, reply_ptr points into an adb_request struct.
Conversely, when reply_ptr instead points into the global cuda_rbuf,
reading_reply must be false.
Unfortunately, this rule can be violated because re-initialization
of reply_ptr and reading_reply presently depends on the TREQ input.
Fix this by re-initializing reply_ptr and reading_reply as soon as they
are known to be invalid.
Tested-by: Stan Johnson <userm57@yahoo.com>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
---
drivers/macintosh/via-cuda.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/macintosh/via-cuda.c b/drivers/macintosh/via-cuda.c
index 1cf1467..ae3da6b 100644
--- a/drivers/macintosh/via-cuda.c
+++ b/drivers/macintosh/via-cuda.c
@@ -592,6 +592,7 @@ cuda_interrupt(int irq, void *arg)
}
current_req = req->next;
complete = 1;
+ reading_reply = 0;
} else {
/* This is tricky. We must break the spinlock to call
* cuda_input. However, doing so means we might get
@@ -603,11 +604,10 @@ cuda_interrupt(int irq, void *arg)
ibuf_len = reply_ptr - cuda_rbuf;
memcpy(ibuf, cuda_rbuf, ibuf_len);
}
+ reply_ptr = cuda_rbuf;
if (TREQ_asserted(status)) {
assert_TIP();
cuda_state = reading;
- reply_ptr = cuda_rbuf;
- reading_reply = 0;
} else {
cuda_state = idle;
cuda_start();
--
2.10.2
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH RESEND 00/10] Replace via-maciisi with via-cuda driver Finn Thain <fthain@telegraphics.com.au> - 2017-01-01 02:00 +0100
[PATCH RESEND 04/10] via-cuda: Prevent read buffer overflow Finn Thain <fthain@telegraphics.com.au> - 2017-01-01 02:00 +0100
[PATCH RESEND 10/10] m68k/mac: Replace via-maciisi driver with via-cuda driver Finn Thain <fthain@telegraphics.com.au> - 2017-01-01 02:00 +0100
Re: [PATCH RESEND 10/10] m68k/mac: Replace via-maciisi driver with via-cuda driver Geert Uytterhoeven <geert@linux-m68k.org> - 2017-01-02 11:30 +0100
Re: [PATCH RESEND 10/10] m68k/mac: Replace via-maciisi driver with via-cuda driver Finn Thain <fthain@telegraphics.com.au> - 2017-01-03 01:40 +0100
[PATCH RESEND 05/10] via-cuda: Fix re-initialization of reply_ptr and reading_reply Finn Thain <fthain@telegraphics.com.au> - 2017-01-01 02:00 +0100
[PATCH RESEND 08/10] via-cuda: Initialize data_index early and increment consistently Finn Thain <fthain@telegraphics.com.au> - 2017-01-01 02:00 +0100
[PATCH RESEND 02/10] via-cuda: Remove redundant temporary variable Finn Thain <fthain@telegraphics.com.au> - 2017-01-01 02:00 +0100
[PATCH RESEND 01/10] via-cuda: Cleanup printk calls Finn Thain <fthain@telegraphics.com.au> - 2017-01-01 02:00 +0100
[PATCH RESEND 09/10] via-cuda: Add support for Egret system controller Finn Thain <fthain@telegraphics.com.au> - 2017-01-01 02:00 +0100
[PATCH RESEND 03/10] via-cuda: Add TREQ, TIP and TACK signal helpers Finn Thain <fthain@telegraphics.com.au> - 2017-01-01 02:00 +0100
[PATCH RESEND 07/10] via-cuda: Use spinlock_irq_save/restore instead of enable/disable_irq Finn Thain <fthain@telegraphics.com.au> - 2017-01-01 02:00 +0100
csiph-web