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] [day] [month] [year] [list]
Message-ID: <CAB9dFdu2WpTf47V1HvvcU7Yhtfy4+-niQrEx1GQ2ptD5T+dmWg@mail.gmail.com>
Date:   Tue, 2 Aug 2022 14:27:20 -0300
From:   Marc Dionne <marc.dionne@...istor.com>
To:     David Howells <dhowells@...hat.com>
Cc:     linux-afs@...ts.infradead.org, linux-fsdevel@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] afs: Fix access after dec in put functions

On Tue, Aug 2, 2022 at 2:15 PM David Howells <dhowells@...hat.com> wrote:
>
> Marc Dionne <marc.dionne@...istor.com> wrote:
>
> > > -       trace_afs_server(server, r - 1, atomic_read(&server->active), reason);
> > > +       trace_afs_server(server->debug_id, r - 1, a, reason);
> >
> > Don't you also want to copy server->debug_id into a local variable here?
>
> Okay, how about the attached change?
>
> David
> ---
> diff --git a/fs/afs/server.c b/fs/afs/server.c
> index bca4b4c55c14..4981baf97835 100644
> --- a/fs/afs/server.c
> +++ b/fs/afs/server.c
> @@ -399,7 +399,7 @@ struct afs_server *afs_use_server(struct afs_server *server, enum afs_server_tra
>  void afs_put_server(struct afs_net *net, struct afs_server *server,
>                     enum afs_server_trace reason)
>  {
> -       unsigned int a;
> +       unsigned int a, debug_id = server->debug_id;
>         bool zero;
>         int r;
>
> @@ -408,7 +408,7 @@ void afs_put_server(struct afs_net *net, struct afs_server *server,
>
>         a = atomic_inc_return(&server->active);
>         zero = __refcount_dec_and_test(&server->ref, &r);
> -       trace_afs_server(server->debug_id, r - 1, a, reason);
> +       trace_afs_server(debug_id, r - 1, a, reason);
>         if (unlikely(zero))
>                 __afs_put_server(net, server);
>  }

Looks fine with that change.

Marc

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ