Skip to content

Commit

Permalink
fixup! [LibOS] Missing lock around dentry->inode derefences
Browse files Browse the repository at this point in the history
Signed-off-by: g2flyer <michael.steiner@intel.com>
  • Loading branch information
g2flyer committed Aug 27, 2024
1 parent 08e6fc3 commit 0118b3f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion libos/include/libos_process.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ struct libos_process {
LISTP_TYPE(libos_child_process) zombies;

struct libos_lock children_lock;
struct libos_lock fs_lock; /* Note: has lower priority than g_dcache_lock. */

/* If g_dcache_lock is also required, acquire g_dcache_lock first and then fs_lock */
struct libos_lock fs_lock;

/* Complete command line for the process, as reported by /proc/[pid]/cmdline; currently filled
* once during initialization and not able to be modified.
Expand Down
3 changes: 2 additions & 1 deletion libos/src/sys/libos_getcwd.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ long libos_syscall_fchdir(int fd) {
if (!hdl)
return -EBADF;

int ret = 0;
int ret;
lock(&g_dcache_lock);

struct libos_dentry* dent = hdl->dentry;
Expand All @@ -106,6 +106,7 @@ long libos_syscall_fchdir(int fd) {
put_dentry(g_process.cwd);
g_process.cwd = dent;
unlock(&g_process.fs_lock);
ret = 0;
out:
put_handle(hdl);
unlock(&g_dcache_lock);
Expand Down

0 comments on commit 0118b3f

Please sign in to comment.