cobalt/vfile: Plug race while opening
PATCH 1/1 cobalt/vfile: Plug race while opening
From: Jan Kiszka <[email protected]>
The procfs does not ensure atomicity of the open handlers. Therefore, it is possible that two instances enter successfully because we check for concurrency early but only mark a vfile as used at the end of the handler. When we run into that, the refcnt may underflow on cleanup:
kernel BUG at ../kernel/xenomai/vfile.c:555!
Protect that path via a regular Linux mutex.
Signed-off-by Jan Kiszka <[email protected]>
--- include/cobalt/kernel/vfile.h | 1 + kernel/cobalt/vfile.c | 61 ++++++++++++++++++++++++----------- 2 files changed, 43 insertions(+), 19 deletions(-)
include/cobalt/kernel/vfile.h +1 -0
@@ -39,6 +39,7 @@ struct xnvfile {struct proc_dir_entry *pde;struct file *file;struct xnvfile_lock_ops *lockops; +struct mutex mutex;int refcnt;void *private; };
kernel/cobalt/vfile.c +42 -19
130 lines not on this page · raw message
Signature · 1 line
2.43.0