summaryrefslogtreecommitdiffstats
path: root/sys/dev/pci/drm/drm_linux.c
diff options
context:
space:
mode:
authoranton <anton@openbsd.org>2019-08-05 08:35:59 +0000
committeranton <anton@openbsd.org>2019-08-05 08:35:59 +0000
commit836f297b392ea9a1d38b1ff0cf70716087e44f8a (patch)
tree83dd65931d92ba9dd808f5209c217e697912c701 /sys/dev/pci/drm/drm_linux.c
parentsis(4) calls mii_phy_reset(); add explicit dependency on mii_phy in config (diff)
downloadwireguard-openbsd-836f297b392ea9a1d38b1ff0cf70716087e44f8a.tar.xz
wireguard-openbsd-836f297b392ea9a1d38b1ff0cf70716087e44f8a.zip
Allow concurrent reads of the f_offset field of struct file by
serializing both read/write operations using the existing file mutex. The vnode lock still grants exclusive write access to the offset; the mutex is only used to make the actual write atomic and prevent any concurrent reader from observing intermediate values. ok mpi@ visa@
Diffstat (limited to 'sys/dev/pci/drm/drm_linux.c')
-rw-r--r--sys/dev/pci/drm/drm_linux.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c
index 641d21efd0d..4e77d829dbc 100644
--- a/sys/dev/pci/drm/drm_linux.c
+++ b/sys/dev/pci/drm/drm_linux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_linux.c,v 1.46 2019/07/15 01:05:01 jsg Exp $ */
+/* $OpenBSD: drm_linux.c,v 1.47 2019/08/05 08:35:59 anton Exp $ */
/*
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
@@ -1378,7 +1378,10 @@ dmabuf_seek(struct file *fp, off_t *offset, int whence, struct proc *p)
default:
return (EINVAL);
}
- fp->f_offset = *offset = newoff;
+ mtx_enter(&fp->f_mtx);
+ fp->f_offset = newoff;
+ mtx_leave(&fp->f_mtx);
+ *offset = newoff;
return (0);
}