mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Marc Dionne <marc.dionne@auristor.com>
Cc: dhowells@redhat.com, linux-afs@lists.infradead.org,
	linux-fsdevel@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/2] afs: Fix access after dec in put functions
Date: Tue, 02 Aug 2022 18:14:16 +0100	[thread overview]
Message-ID: <3733972.1659460456@warthog.procyon.org.uk> (raw)
In-Reply-To: <CAB9dFdsSHwVo6j=+z=4yiTRSJiOeKpFB4QHf6fqrLRuuAa3+JQ@mail.gmail.com>

Marc Dionne <marc.dionne@auristor.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);
 }


  parent reply	other threads:[~2022-08-02 17:14 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29 16:39 [PATCH 0/2] afs: Fix ref-put functions David Howells
2022-07-29 16:39 ` [PATCH 1/2] afs: Use refcount_t rather than atomic_t David Howells
2022-08-02 14:27   ` Marc Dionne
2022-07-29 16:39 ` [PATCH 2/2] afs: Fix access after dec in put functions David Howells
2022-08-02 14:54   ` Marc Dionne
2022-08-02 15:49   ` David Howells
2022-08-02 17:14   ` David Howells [this message]
2022-08-02 17:27     ` Marc Dionne

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=3733972.1659460456@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=linux-afs@lists.infradead.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.dionne@auristor.com \
    /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®