From eccd9d6d23f15a37ad118897d167dd18973242a1 Mon Sep 17 00:00:00 2001 From: dzwdz Date: Fri, 29 Sep 2023 22:00:07 +0200 Subject: kernel: fix linked list iteration in postqueue --- src/kernel/arch/amd64/driver/util.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/kernel/arch/amd64/driver/util.c b/src/kernel/arch/amd64/driver/util.c index 1462258..0f0ee34 100644 --- a/src/kernel/arch/amd64/driver/util.c +++ b/src/kernel/arch/amd64/driver/util.c @@ -42,7 +42,10 @@ void postqueue_ringreadall(VfsReq **queue, ring_t *r) { mlen = min(mlen, sizeof tmp); mlen = ring_get(r, tmp, mlen); - for (req = *queue; req; req = req->postqueue_next) { + while (*queue) { + req = *queue; + *queue = req->postqueue_next; + size_t ret = min(mlen, req->output.len); assert(req->type == VFSOP_READ); if (req->caller) { @@ -50,7 +53,6 @@ void postqueue_ringreadall(VfsReq **queue, ring_t *r) { } vfsreq_finish_short(req, ret); } - *queue = NULL; } size_t ring_to_virt(ring_t *r, Proc *proc, void __user *ubuf, size_t max) { -- cgit v1.2.3