Skip to content

Commit

Permalink
unix: Fix user after free when clearing a file handle
Browse files Browse the repository at this point in the history
The iod may go away in the cleared handler, so don't use it after
that point.

Signed-off-by: Corey Minyard <[email protected]>
  • Loading branch information
cminyard committed Jan 4, 2025
1 parent 2d9c25a commit 25ec586
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/os_unix.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,9 +566,9 @@ file_runner(struct gensio_runner *r, void *cb_data)
iod->handlers_set = false;
f->unlock(iod->u.file.lock);
iod->cleared_handler(&iod->r, iod->cb_data);
f->lock(iod->u.file.lock);
} else {
f->unlock(iod->u.file.lock);
}
f->unlock(iod->u.file.lock);
}

static void
Expand Down

0 comments on commit 25ec586

Please sign in to comment.