]> git.lizzy.rs Git - plan9front.git/commitdiff
sshfs: reset SReq->reqid field to fix double-free of request ids
authoraiju <devnull@localhost>
Fri, 28 Apr 2017 18:45:32 +0000 (18:45 +0000)
committeraiju <devnull@localhost>
Fri, 28 Apr 2017 18:45:32 +0000 (18:45 +0000)
sys/src/cmd/sshfs.c

index b3cbbfe1d7b96ecd9f433fa2468cba5c6d92cd53..e659121336a2c504fe08fec7e483e0e4827d9065 100644 (file)
@@ -938,18 +938,19 @@ recvproc(void *)
                }
                id = GET4(rxpkt + 1);
                if(id >= MAXREQID){
-                       fprint(2, "sshfs: received response with id out of range, %d > %d\n", id, MAXREQID);
+                       fprint(2, "sshfs: received %Σ response with id out of range, %d > %d\n", t, id, MAXREQID);
                        continue;
                }
                qlock(&sreqidlock);
                r = sreqrd[id];
                if(r != nil){
                        sreqrd[id] = nil;
+                       r->reqid = -1;
                        rwakeup(&sreqidrend);
                }
                qunlock(&sreqidlock);
                if(r == nil){
-                       fprint(2, "sshfs: received response to non-existent request (req id = %d)\n", id);
+                       fprint(2, "sshfs: received %Σ response to non-existent request (req id = %d)\n", t, id);
                        continue;
                }
                if(r->closefid != nil){