Re: [PATCH 3/4] fs, afs: convert afs_server.usage from atomic_t to refcount_t

From: David Howells
Date: Wed Feb 22 2017 - 11:32:27 EST

Elena Reshetova <elena.reshetova@xxxxxxxxx> wrote:

> refcount_t type and corresponding API should be
> used instead of atomic_t when the variable is used as
> a reference counter. This allows to avoid accidental
> refcounter overflows that might lead to use-after-free
> situations.

Although I don't see an assertion for this (the window is too small), it is
possible for a dead server record to get resurrected. Take a look at
afs_put_server() and note there's a check around the move to the graveyard.

So, please hold this patch also.