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: <CADD9qeiVv3zKTFkGL4Y_rKG5u6LDV_E6YULNMhzVF8C45jM7iw@mail.gmail.com>
Date: Tue, 25 Nov 2025 19:47:11 +0530
From: Malaya Kumar Rout <mrout@...hat.com>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: John Stultz <jstultz@...gle.com>, Thomas Gleixner <tglx@...utronix.de>, 
	Stephen Boyd <sboyd@...nel.org>, linux-kernel@...r.kernel.org, 
	kernel-janitors@...r.kernel.org
Subject: Re: [PATCH] timekeeping: Fix error code in tk_aux_sysfs_init()

On Tue, Nov 25, 2025 at 7:25 PM Dan Carpenter <dan.carpenter@...aro.org> wrote:
>
> If kobject_create_and_add() fails on the first iteration, then the
> error code is set to -ENOMEM and that's good.  But if it fails on the
> later iterations then "ret" is zero, which means success, but it should
> be -ENOMEM.  Set the error code to -ENOMEM correctly.
>
> Fixes: 7b5ab04f035f ("timekeeping: Fix resource leak in tk_aux_sysfs_init() error paths")
> Signed-off-by: Dan Carpenter <dan.carpenter@...aro.org>
> ---
>  kernel/time/timekeeping.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> index 0c8b77ee4a3a..3ec3daa4acab 100644
> --- a/kernel/time/timekeeping.c
> +++ b/kernel/time/timekeeping.c
> @@ -3087,8 +3087,10 @@ static int __init tk_aux_sysfs_init(void)
>                 char id[2] = { [0] = '0' + i, };
>                 struct kobject *clk = kobject_create_and_add(id, auxo);
>
> -               if (!clk)
> +               if (!clk) {
> +                       ret = -ENOMEM;
>                         goto err_clean;
> +               }
>
>                 ret = sysfs_create_group(clk, &aux_clock_enable_attr_group);
>                 if (ret)
> --
> 2.51.0
>
The fix looks good to me.

Reviewed-by: Malaya Kumar Rout <mrout@...hat.com>


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ