lkml.org 
[lkml]   [2022]   [Aug]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
SubjectRe: [PATCH 2/2] afs: Fix access after dec in put functions
Date
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);
}
\
 
 \ /
  Last update: 2022-08-02 19:15    [W:0.052 / U:2.352 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site