Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xenbus: fix deadlock on writes to /proc/xen/xenbus

/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 <david.vrabel@citrix.com>
Reviewed-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Juergen Gross <jgross@suse.com>

authored by

David Vrabel and committed by
Juergen Gross
581d21a2 3da96be5

+2
+2
drivers/xen/xenbus/xenbus_dev_frontend.c
··· 538 538 539 539 nonseekable_open(inode, filp); 540 540 541 + filp->f_mode &= ~FMODE_ATOMIC_POS; /* cdev-style semantics */ 542 + 541 543 u = kzalloc(sizeof(*u), GFP_KERNEL); 542 544 if (u == NULL) 543 545 return -ENOMEM;