diff options
author | 2025-01-15 02:50:02 +0000 | |
---|---|---|
committer | 2025-01-16 14:03:10 +0100 | |
commit | 0e7d523b5f7a23b1dc6ceceb04e31a60e9e3321d (patch) | |
tree | f5d48ba2fef5a29afbcfca11c1b951a49d4c1fd9 /scripts/lib/kdoc/kdoc_files.py | |
parent | scripts/tags.sh: Don't tag usages of DECLARE_BITMAP (diff) | |
download | linux-rng-0e7d523b5f7a23b1dc6ceceb04e31a60e9e3321d.tar.xz linux-rng-0e7d523b5f7a23b1dc6ceceb04e31a60e9e3321d.zip |
ntsync: fix a file reference leak in drivers/misc/ntsync.c
struct ntsync_obj contains a reference to struct file
and that reference contributes to refcount - ntsync_alloc_obj()
grabs it. Normally the object is destroyed (and reference
to obj->file dropped) in ntsync_obj_release(). However, in
case of ntsync_obj_get_fd() failure the object is destroyed
directly by its creator.
That case should also drop obj->file; plain kfree(obj)
is not enough there - it ends up leaking struct file * reference.
Take that logics into a helper (ntsync_free_obj()) and
use it in both codepaths that destroy ntsync_obj instances.
Fixes: b46271ec40a05 "ntsync: Introduce NTSYNC_IOC_CREATE_SEM"
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Reviewed-by: Elizabeth Figura <zfigura@codeweavers.com>
Link: https://lore.kernel.org/r/20250115025002.GA1977892@ZenIV
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts/lib/kdoc/kdoc_files.py')
0 files changed, 0 insertions, 0 deletions