Skip to content

Commit

Permalink
xenbus: fix deadlock on writes to /proc/xen/xenbus
Browse files Browse the repository at this point in the history
/proc/xen/xenbus does not work correctly.  A read blocked waiting for
a xenstore message holds the mutex needed for atomic file position
updates.  This blocks any writes on the same file handle, which can
deadlock if the write is needed to unblock the read.

Clear FMODE_ATOMIC_POS when opening this device to always get
character device like sematics.

Signed-off-by: David Vrabel <[email protected]>
Reviewed-by: Juergen Gross <[email protected]>
Signed-off-by: Juergen Gross <[email protected]>
  • Loading branch information
David Vrabel authored and jgross1 committed Dec 12, 2016
1 parent 3da96be commit 581d21a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/xen/xenbus/xenbus_dev_frontend.c
Original file line number Diff line number Diff line change
@@ -538,6 +538,8 @@ static int xenbus_file_open(struct inode *inode, struct file *filp)

nonseekable_open(inode, filp);

filp->f_mode &= ~FMODE_ATOMIC_POS; /* cdev-style semantics */

u = kzalloc(sizeof(*u), GFP_KERNEL);
if (u == NULL)
return -ENOMEM;

0 comments on commit 581d21a

Please sign in to comment.