Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
d2b83141
Commit
d2b83141
authored
Apr 14, 2008
by
Trond Myklebust
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SUNRPC: Protect creds against early garbage collection
Signed-off-by:
Trond Myklebust
<
Trond.Myklebust@netapp.com
>
parent
a2b2bb88
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
0 deletions
+8
-0
net/sunrpc/auth.c
net/sunrpc/auth.c
+8
-0
No files found.
net/sunrpc/auth.c
View file @
d2b83141
...
...
@@ -220,6 +220,9 @@ rpcauth_destroy_credcache(struct rpc_auth *auth)
}
EXPORT_SYMBOL_GPL
(
rpcauth_destroy_credcache
);
#define RPC_AUTH_EXPIRY_MORATORIUM (60 * HZ)
/*
* Remove stale credentials. Avoid sleeping inside the loop.
*/
...
...
@@ -228,6 +231,7 @@ rpcauth_prune_expired(struct list_head *free, int nr_to_scan)
{
spinlock_t
*
cache_lock
;
struct
rpc_cred
*
cred
;
unsigned
long
expired
=
jiffies
-
RPC_AUTH_EXPIRY_MORATORIUM
;
while
(
!
list_empty
(
&
cred_unused
))
{
cred
=
list_entry
(
cred_unused
.
next
,
struct
rpc_cred
,
cr_lru
);
...
...
@@ -235,6 +239,10 @@ rpcauth_prune_expired(struct list_head *free, int nr_to_scan)
number_cred_unused
--
;
if
(
atomic_read
(
&
cred
->
cr_count
)
!=
0
)
continue
;
/* Enforce a 5 second garbage collection moratorium */
if
(
time_in_range
(
cred
->
cr_expire
,
expired
,
jiffies
)
&&
test_bit
(
RPCAUTH_CRED_UPTODATE
,
&
cred
->
cr_flags
)
!=
0
)
continue
;
cache_lock
=
&
cred
->
cr_auth
->
au_credcache
->
lock
;
spin_lock
(
cache_lock
);
if
(
atomic_read
(
&
cred
->
cr_count
)
==
0
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment