lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3ad1c3b3-f54d-4b0e-2441-ab348d099f3f@acm.org>
Date:   Sat, 4 Feb 2023 15:17:04 -0800
From:   Bart Van Assche <bvanassche@....org>
To:     Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        linux-trace-kernel@...r.kernel.org
Cc:     Jens Axboe <axboe@...nel.dk>, Steven Rostedt <rostedt@...dmis.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] trace/blktrace: fix memory leak with using
 debugfs_lookup()

On 2/2/23 06:19, Greg Kroah-Hartman wrote:
> When calling debugfs_lookup() the result must have dput() called on it,
> otherwise the memory will leak over time.  To make things simpler, just
> call debugfs_lookup_and_remove() instead which handles all of the logic
> at once.
> 
> Cc: Jens Axboe <axboe@...nel.dk>
> Cc: Steven Rostedt <rostedt@...dmis.org>
> Cc: Masami Hiramatsu <mhiramat@...nel.org>
> Cc: linux-block@...r.kernel.org
> Cc: linux-kernel@...r.kernel.org
> Cc: linux-trace-kernel@...r.kernel.org
> Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> ---
>   kernel/trace/blktrace.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
> index 918a7d12df8f..5743be559415 100644
> --- a/kernel/trace/blktrace.c
> +++ b/kernel/trace/blktrace.c
> @@ -320,8 +320,8 @@ static void blk_trace_free(struct request_queue *q, struct blk_trace *bt)
>   	 * under 'q->debugfs_dir', thus lookup and remove them.
>   	 */
>   	if (!bt->dir) {
> -		debugfs_remove(debugfs_lookup("dropped", q->debugfs_dir));
> -		debugfs_remove(debugfs_lookup("msg", q->debugfs_dir));
> +		debugfs_lookup_and_remove("dropped", q->debugfs_dir);
> +		debugfs_lookup_and_remove("msg", q->debugfs_dir);
>   	} else {
>   		debugfs_remove(bt->dir);
>   	}

Reviewed-by: Bart Van Assche <bvanassche@....org>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ