mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-04 08:08:54 +00:00
SUNRPC: Fix a bug in rpcauth_lookup_credcache()
The hash bucket is for some reason always being set to zero. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
parent
9446389ef6
commit
25337fdc85
2 changed files with 6 additions and 3 deletions
|
@ -59,8 +59,8 @@ struct rpc_cred {
|
||||||
/*
|
/*
|
||||||
* Client authentication handle
|
* Client authentication handle
|
||||||
*/
|
*/
|
||||||
#define RPC_CREDCACHE_NR 8
|
#define RPC_CREDCACHE_HASHBITS 4
|
||||||
#define RPC_CREDCACHE_MASK (RPC_CREDCACHE_NR - 1)
|
#define RPC_CREDCACHE_NR (1 << RPC_CREDCACHE_HASHBITS)
|
||||||
struct rpc_cred_cache {
|
struct rpc_cred_cache {
|
||||||
struct hlist_head hashtable[RPC_CREDCACHE_NR];
|
struct hlist_head hashtable[RPC_CREDCACHE_NR];
|
||||||
spinlock_t lock;
|
spinlock_t lock;
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/slab.h>
|
#include <linux/slab.h>
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
|
#include <linux/hash.h>
|
||||||
#include <linux/sunrpc/clnt.h>
|
#include <linux/sunrpc/clnt.h>
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
|
|
||||||
|
@ -280,7 +281,9 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
|
||||||
struct hlist_node *pos;
|
struct hlist_node *pos;
|
||||||
struct rpc_cred *cred = NULL,
|
struct rpc_cred *cred = NULL,
|
||||||
*entry, *new;
|
*entry, *new;
|
||||||
int nr = 0;
|
unsigned int nr;
|
||||||
|
|
||||||
|
nr = hash_long(acred->uid, RPC_CREDCACHE_HASHBITS);
|
||||||
|
|
||||||
if (!(flags & RPCAUTH_LOOKUP_ROOTCREDS))
|
if (!(flags & RPCAUTH_LOOKUP_ROOTCREDS))
|
||||||
nr = acred->uid & RPC_CREDCACHE_MASK;
|
nr = acred->uid & RPC_CREDCACHE_MASK;
|
||||||
|
|
Loading…
Reference in a new issue