Skip to content

Commit 970b975

Browse files
Elizabeth Figuragregkh
authored andcommitted
ntsync: Fix reference leaks in the remaining create ioctls.
When ntsync_obj_get_fd() fails, we free the ntsync object but forget to drop the "file" member. This was fixed for semaphores in 0e7d523, but that commit did not fix the similar leak for events and mutexes, since they were part of patches not yet in the mainline kernel. Fix those cases. Fixes: 5bc2479 "ntsync: Introduce NTSYNC_IOC_CREATE_MUTEX." Fixes: 4c7404b "ntsync: Introduce NTSYNC_IOC_CREATE_EVENT." Signed-off-by: Elizabeth Figura <zfigura@codeweavers.com> Link: https://lore.kernel.org/r/20250116190717.8923-1-zfigura@codeweavers.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c65b229 commit 970b975

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/misc/ntsync.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -781,7 +781,7 @@ static int ntsync_create_mutex(struct ntsync_device *dev, void __user *argp)
781781
mutex->u.mutex.owner = args.owner;
782782
fd = ntsync_obj_get_fd(mutex);
783783
if (fd < 0)
784-
kfree(mutex);
784+
ntsync_free_obj(mutex);
785785

786786
return fd;
787787
}
@@ -802,7 +802,7 @@ static int ntsync_create_event(struct ntsync_device *dev, void __user *argp)
802802
event->u.event.signaled = args.signaled;
803803
fd = ntsync_obj_get_fd(event);
804804
if (fd < 0)
805-
kfree(event);
805+
ntsync_free_obj(event);
806806

807807
return fd;
808808
}

0 commit comments

Comments
 (0)