diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-31 18:41:02 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-01-31 18:41:02 -0500 |
| commit | 0fd08c5545a806c960a6597fae4a2e656eb7ead9 (patch) | |
| tree | 027dfcc65f600afe6a4b19ab72c472fe3f0f24fa | |
| parent | 7921127e297ea203b794c4a1c3ef3eb0ee52acbf (diff) | |
| parent | d1205f87bbb8040c1408bbd9e0a720310b2b0b9b (diff) | |
Merge branch 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6
* 'bugfixes' of git://git.linux-nfs.org/projects/trondmy/nfs-2.6:
NFS: NFSv4 readdir loses entries
NFS: Micro-optimize nfs4_decode_dirent()
NFS: Fix an NFS client lockdep issue
NFS construct consistent co_ownerid for v4.1
NFS: nfs_wcc_update_inode() should set nfsi->attr_gencount
NFS improve pnfs_put_deviceid_cache debug print
NFS fix cb_sequence error processing
NFS do not find client in NFSv4 pg_authenticate
NLM: Fix "kernel BUG at fs/lockd/host.c:417!" or ".../host.c:283!"
NFS: Prevent memory allocation failure in nfsacl_encode()
NFS: nfsacl_{encode,decode} should return signed integer
NFS: Fix "kernel BUG at fs/nfs/nfs3xdr.c:1338!"
NFS: Fix "kernel BUG at fs/aio.c:554!"
NFS4: Avoid potential NULL pointer dereference in decode_and_add_ds().
NFS: fix handling of malloc failure during nfs_flush_multi()
| -rw-r--r-- | fs/lockd/host.c | 9 | ||||
| -rw-r--r-- | fs/nfs/callback.c | 109 | ||||
| -rw-r--r-- | fs/nfs/callback.h | 4 | ||||
| -rw-r--r-- | fs/nfs/callback_proc.c | 12 | ||||
| -rw-r--r-- | fs/nfs/callback_xdr.c | 5 | ||||
| -rw-r--r-- | fs/nfs/client.c | 15 | ||||
| -rw-r--r-- | fs/nfs/delegation.c | 6 | ||||
| -rw-r--r-- | fs/nfs/direct.c | 34 | ||||
| -rw-r--r-- | fs/nfs/inode.c | 26 | ||||
| -rw-r--r-- | fs/nfs/internal.h | 3 | ||||
| -rw-r--r-- | fs/nfs/nfs3acl.c | 4 | ||||
| -rw-r--r-- | fs/nfs/nfs3xdr.c | 5 | ||||
| -rw-r--r-- | fs/nfs/nfs4filelayoutdev.c | 9 | ||||
| -rw-r--r-- | fs/nfs/nfs4proc.c | 30 | ||||
| -rw-r--r-- | fs/nfs/nfs4state.c | 6 | ||||
| -rw-r--r-- | fs/nfs/nfs4xdr.c | 9 | ||||
| -rw-r--r-- | fs/nfs/pnfs.c | 2 | ||||
| -rw-r--r-- | fs/nfs/write.c | 2 | ||||
| -rw-r--r-- | fs/nfs_common/nfsacl.c | 54 | ||||
| -rw-r--r-- | fs/posix_acl.c | 17 | ||||
| -rw-r--r-- | include/linux/nfsacl.h | 4 | ||||
| -rw-r--r-- | include/linux/posix_acl.h | 1 | ||||
| -rw-r--r-- | include/linux/sunrpc/bc_xprt.h | 13 | ||||
| -rw-r--r-- | include/linux/sunrpc/svc_xprt.h | 1 | ||||
| -rw-r--r-- | net/sunrpc/svcsock.c | 4 |
25 files changed, 174 insertions, 210 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c index 5f1bcb2f06f..b7c99bfb3da 100644 --- a/fs/lockd/host.c +++ b/fs/lockd/host.c | |||
| @@ -520,7 +520,7 @@ static struct nlm_host *next_host_state(struct hlist_head *cache, | |||
| 520 | struct nsm_handle *nsm, | 520 | struct nsm_handle *nsm, |
| 521 | const struct nlm_reboot *info) | 521 | const struct nlm_reboot *info) |
| 522 | { | 522 | { |
| 523 | struct nlm_host *host = NULL; | 523 | struct nlm_host *host; |
| 524 | struct hlist_head *chain; | 524 | struct hlist_head *chain; |
| 525 | struct hlist_node *pos; | 525 | struct hlist_node *pos; |
| 526 | 526 | ||
| @@ -532,12 +532,13 @@ static struct nlm_host *next_host_state(struct hlist_head *cache, | |||
| 532 | host->h_state++; | 532 | host->h_state++; |
| 533 | 533 | ||
| 534 | nlm_get_host(host); | 534 | nlm_get_host(host); |
| 535 | goto out; | 535 | mutex_unlock(&nlm_host_mutex); |
| 536 | return host; | ||
| 536 | } | 537 | } |
| 537 | } | 538 | } |
| 538 | out: | 539 | |
| 539 | mutex_unlock(&nlm_host_mutex); | 540 | mutex_unlock(&nlm_host_mutex); |
| 540 | return host; | 541 | return NULL; |
| 541 | } | 542 | } |
| 542 | 543 | ||
| 543 | /** | 544 | /** |
diff --git a/fs/nfs/callback.c b/fs/nfs/callback.c index 199016528fc..e3d29426905 100644 --- a/fs/nfs/callback.c +++ b/fs/nfs/callback.c | |||
| @@ -135,33 +135,6 @@ out_err: | |||
| 135 | 135 | ||
| 136 | #if defined(CONFIG_NFS_V4_1) | 136 | #if defined(CONFIG_NFS_V4_1) |
| 137 | /* | 137 | /* |
| 138 | * * CB_SEQUENCE operations will fail until the callback sessionid is set. | ||
| 139 | * */ | ||
| 140 | int nfs4_set_callback_sessionid(struct nfs_client *clp) | ||
| 141 | { | ||
| 142 | struct svc_serv *serv = clp->cl_rpcclient->cl_xprt->bc_serv; | ||
| 143 | struct nfs4_sessionid *bc_sid; | ||
| 144 | |||
| 145 | if (!serv->sv_bc_xprt) | ||
| 146 | return -EINVAL; | ||
| 147 | |||
| 148 | /* on success freed in xprt_free */ | ||
| 149 | bc_sid = kmalloc(sizeof(struct nfs4_sessionid), GFP_KERNEL); | ||
| 150 | if (!bc_sid) | ||
| 151 | return -ENOMEM; | ||
| 152 | memcpy(bc_sid->data, &clp->cl_session->sess_id.data, | ||
| 153 | NFS4_MAX_SESSIONID_LEN); | ||
| 154 | spin_lock_bh(&serv->sv_cb_lock); | ||
| 155 | serv->sv_bc_xprt->xpt_bc_sid = bc_sid; | ||
| 156 | spin_unlock_bh(&serv->sv_cb_lock); | ||
| 157 | dprintk("%s set xpt_bc_sid=%u:%u:%u:%u for sv_bc_xprt %p\n", __func__, | ||
| 158 | ((u32 *)bc_sid->data)[0], ((u32 *)bc_sid->data)[1], | ||
| 159 | ((u32 *)bc_sid->data)[2], ((u32 *)bc_sid->data)[3], | ||
| 160 | serv->sv_bc_xprt); | ||
| 161 | return 0; | ||
| 162 | } | ||
| 163 | |||
| 164 | /* | ||
| 165 | * The callback service for NFSv4.1 callbacks | 138 | * The callback service for NFSv4.1 callbacks |
| 166 | */ | 139 | */ |
| 167 | static int | 140 | static int |
| @@ -266,10 +239,6 @@ static inline void nfs_callback_bc_serv(u32 minorversion, struct rpc_xprt *xprt, | |||
| 266 | struct nfs_callback_data *cb_info) | 239 | struct nfs_callback_data *cb_info) |
| 267 | { | 240 | { |
| 268 | } | 241 | } |
| 269 | int nfs4_set_callback_sessionid(struct nfs_client *clp) | ||
| 270 | { | ||
| 271 | return 0; | ||
| 272 | } | ||
| 273 | #endif /* CONFIG_NFS_V4_1 */ | 242 | #endif /* CONFIG_NFS_V4_1 */ |
| 274 | 243 | ||
| 275 | /* | 244 | /* |
| @@ -359,78 +328,58 @@ void nfs_callback_down(int minorversion) | |||
| 359 | mutex_unlock(&nfs_callback_mutex); | 328 | mutex_unlock(&nfs_callback_mutex); |
| 360 | } | 329 | } |
| 361 | 330 | ||
| 362 | static int check_gss_callback_principal(struct nfs_client *clp, | 331 | /* Boolean check of RPC_AUTH_GSS principal */ |
| 363 | struct svc_rqst *rqstp) | 332 | int |
| 333 | check_gss_callback_principal(struct nfs_client *clp, struct svc_rqst *rqstp) | ||
| 364 | { | 334 | { |
| 365 | struct rpc_clnt *r = clp->cl_rpcclient; | 335 | struct rpc_clnt *r = clp->cl_rpcclient; |
| 366 | char *p = svc_gss_principal(rqstp); | 336 | char *p = svc_gss_principal(rqstp); |
| 367 | 337 | ||
| 338 | if (rqstp->rq_authop->flavour != RPC_AUTH_GSS) | ||
| 339 | return 1; | ||
| 340 | |||
| 368 | /* No RPC_AUTH_GSS on NFSv4.1 back channel yet */ | 341 | /* No RPC_AUTH_GSS on NFSv4.1 back channel yet */ |
| 369 | if (clp->cl_minorversion != 0) | 342 | if (clp->cl_minorversion != 0) |
| 370 | return SVC_DROP; | 343 | return 0; |
| 371 | /* | 344 | /* |
| 372 | * It might just be a normal user principal, in which case | 345 | * It might just be a normal user principal, in which case |
| 373 | * userspace won't bother to tell us the name at all. | 346 | * userspace won't bother to tell us the name at all. |
| 374 | */ | 347 | */ |
| 375 | if (p == NULL) | 348 | if (p == NULL) |
| 376 | return SVC_DENIED; | 349 | return 0; |
| 377 | 350 | ||
| 378 | /* Expect a GSS_C_NT_HOSTBASED_NAME like "nfs@serverhostname" */ | 351 | /* Expect a GSS_C_NT_HOSTBASED_NAME like "nfs@serverhostname" */ |
| 379 | 352 | ||
| 380 | if (memcmp(p, "nfs@", 4) != 0) | 353 | if (memcmp(p, "nfs@", 4) != 0) |
| 381 | return SVC_DENIED; | 354 | return 0; |
| 382 | p += 4; | 355 | p += 4; |
| 383 | if (strcmp(p, r->cl_server) != 0) | 356 | if (strcmp(p, r->cl_server) != 0) |
| 384 | return SVC_DENIED; | 357 | return 0; |
| 385 | return SVC_OK; | 358 | return 1; |
| 386 | } | 359 | } |
| 387 | 360 | ||
| 388 | /* pg_authenticate method helper */ | 361 | /* |
| 389 | static struct nfs_client *nfs_cb_find_client(struct svc_rqst *rqstp) | 362 | * pg_authenticate method for nfsv4 callback threads. |
| 390 | { | 363 | * |
| 391 | struct nfs4_sessionid *sessionid = bc_xprt_sid(rqstp); | 364 | * The authflavor has been negotiated, so an incorrect flavor is a server |
| 392 | int is_cb_compound = rqstp->rq_proc == CB_COMPOUND ? 1 : 0; | 365 | * bug. Drop packets with incorrect authflavor. |
| 393 | 366 | * | |
| 394 | dprintk("--> %s rq_proc %d\n", __func__, rqstp->rq_proc); | 367 | * All other checking done after NFS decoding where the nfs_client can be |
| 395 | if (svc_is_backchannel(rqstp)) | 368 | * found in nfs4_callback_compound |
| 396 | /* Sessionid (usually) set after CB_NULL ping */ | 369 | */ |
| 397 | return nfs4_find_client_sessionid(svc_addr(rqstp), sessionid, | ||
| 398 | is_cb_compound); | ||
| 399 | else | ||
| 400 | /* No callback identifier in pg_authenticate */ | ||
| 401 | return nfs4_find_client_no_ident(svc_addr(rqstp)); | ||
| 402 | } | ||
| 403 | |||
| 404 | /* pg_authenticate method for nfsv4 callback threads. */ | ||
| 405 | static int nfs_callback_authenticate(struct svc_rqst *rqstp) | 370 | static int nfs_callback_authenticate(struct svc_rqst *rqstp) |
| 406 | { | 371 | { |
| 407 | struct nfs_client *clp; | ||
| 408 | RPC_IFDEBUG(char buf[RPC_MAX_ADDRBUFLEN]); | ||
| 409 | int ret = SVC_OK; | ||
| 410 | |||
| 411 | /* Don't talk to strangers */ | ||
| 412 | clp = nfs_cb_find_client(rqstp); | ||
| 413 | if (clp == NULL) | ||
| 414 | return SVC_DROP; | ||
| 415 | |||
| 416 | dprintk("%s: %s NFSv4 callback!\n", __func__, | ||
| 417 | svc_print_addr(rqstp, buf, sizeof(buf))); | ||
| 418 | |||
| 419 | switch (rqstp->rq_authop->flavour) { | 372 | switch (rqstp->rq_authop->flavour) { |
| 420 | case RPC_AUTH_NULL: | 373 | case RPC_AUTH_NULL: |
| 421 | if (rqstp->rq_proc != CB_NULL) | 374 | if (rqstp->rq_proc != CB_NULL) |
| 422 | ret = SVC_DENIED; | 375 | return SVC_DROP; |
| 423 | break; | 376 | break; |
