From: Elizabeth Figura <zfigura@codeweavers.com>
To: Arnd Bergmann <arnd@arndb.de>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org, wine-devel@winehq.org,
Elizabeth Figura <zfigura@codeweavers.com>
Subject: [PATCH] ntsync: Fix reference leaks in the remaining create ioctls.
Date: Thu, 16 Jan 2025 13:07:17 -0600 [thread overview]
Message-ID: <20250116190717.8923-1-zfigura@codeweavers.com> (raw)
When ntsync_obj_get_fd() fails, we free the ntsync object but forget to drop the
"file" member.
This was fixed for semaphores in 0e7d523b5f7a23b1dc6ceceb04e31a60e9e3321d, 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: 5bc2479a3585b "ntsync: Introduce NTSYNC_IOC_CREATE_MUTEX."
Fixes: 4c7404b9c2b57 "ntsync: Introduce NTSYNC_IOC_CREATE_EVENT."
Signed-off-by: Elizabeth Figura <zfigura@codeweavers.com>
---
drivers/misc/ntsync.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/misc/ntsync.c b/drivers/misc/ntsync.c
index b6441e978974..055395cde42b 100644
--- a/drivers/misc/ntsync.c
+++ b/drivers/misc/ntsync.c
@@ -781,7 +781,7 @@ static int ntsync_create_mutex(struct ntsync_device *dev, void __user *argp)
mutex->u.mutex.owner = args.owner;
fd = ntsync_obj_get_fd(mutex);
if (fd < 0)
- kfree(mutex);
+ ntsync_free_obj(mutex);
return fd;
}
@@ -802,7 +802,7 @@ static int ntsync_create_event(struct ntsync_device *dev, void __user *argp)
event->u.event.signaled = args.signaled;
fd = ntsync_obj_get_fd(event);
if (fd < 0)
- kfree(event);
+ ntsync_free_obj(event);
return fd;
}
base-commit: 0e7d523b5f7a23b1dc6ceceb04e31a60e9e3321d
--
2.45.2
reply other threads:[~2025-01-16 19:07 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250116190717.8923-1-zfigura@codeweavers.com \
--to=zfigura@codeweavers.com \
--cc=arnd@arndb.de \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=wine-devel@winehq.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®