diff options
| author | Mark Johnston <markj@FreeBSD.org> | 2026-09-23 16:53:53 +0000 |
|---|---|---|
| committer | Mark Johnston <markj@FreeBSD.org> | 2026-09-23 16:53:53 +0000 |
| commit | ba974faaf30b74472acc4f0dc5853a22d43951f2 (patch) | |
| tree | 2ff6e225b698ee4aafb15039f4e022d4666bb590 | |
| parent | 7c5e457d3afdc7742ee24f0b5ee6e5e7aa00a6bd (diff) | |
posixshm: Fix a double unlock in shm_partial_page_invalidate()
For some reason, shm_partial_page_invalidate() unlocks the object upon
an error, but its callers don't expect this. Don't do any special error
handling. Keep the subroutine anyway since the name is a bit clearer
than vm_page_grab_zero_partial().
While here, normalize the object pointer used for locking in
shm_deallocate().
Reviewed by: kib
Fixes: 454bc887f250 ("uipc_shm: Implements fspacectl(2) support")
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D59877
| -rw-r--r-- | sys/kern/uipc_shm.c | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c index b77731f8188b..7df9d59716c7 100644 --- a/sys/kern/uipc_shm.c +++ b/sys/kern/uipc_shm.c @@ -723,12 +723,7 @@ static int shm_partial_page_invalidate(vm_object_t object, vm_pindex_t idx, int base, int end) { - int error; - - error = vm_page_grab_zero_partial(object, idx, base, end); - if (error == EIO) - VM_OBJECT_WUNLOCK(object); - return (error); + return (vm_page_grab_zero_partial(object, idx, base, end)); } static int @@ -2093,7 +2088,7 @@ shm_deallocate(struct shmfd *shmfd, off_t *offset, off_t *length, int flags) } out: - VM_OBJECT_WUNLOCK(shmfd->shm_object); + VM_OBJECT_WUNLOCK(object); *offset = off; *length = len; return (error); |
