Skip to content

Commit ceeea1b

Browse files
committed
Merge tag 'nfsd-6.3-5' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux
Pull nfsd fixes from Chuck Lever: - Fix a crash and a resource leak in NFSv4 COMPOUND processing - Fix issues with AUTH_SYS credential handling - Try again to address an NFS/NFSD/SUNRPC build dependency regression * tag 'nfsd-6.3-5' of git://git.kernel.org/pub/scm/linux/kernel/git/cel/linux: NFSD: callback request does not use correct credential for AUTH_SYS NFS: Remove "select RPCSEC_GSS_KRB5 sunrpc: only free unix grouplist after RCU settles nfsd: call op_release, even when op_func returns an error NFSD: Avoid calling OPDESC() with ops->opnum == OP_ILLEGAL
2 parents 148341f + 7de82c2 commit ceeea1b

5 files changed

Lines changed: 24 additions & 14 deletions

File tree

fs/nfs/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ config NFS_V3_ACL
7575
config NFS_V4
7676
tristate "NFS client support for NFS version 4"
7777
depends on NFS_FS
78-
select RPCSEC_GSS_KRB5
7978
select KEYS
8079
help
8180
This option enables support for version 4 of the NFS protocol

fs/nfsd/blocklayout.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ nfsd4_block_get_device_info_scsi(struct super_block *sb,
297297

298298
out_free_dev:
299299
kfree(dev);
300+
gdp->gd_device = NULL;
300301
return ret;
301302
}
302303

fs/nfsd/nfs4callback.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -946,8 +946,8 @@ static const struct cred *get_backchannel_cred(struct nfs4_client *clp, struct r
946946
if (!kcred)
947947
return NULL;
948948

949-
kcred->uid = ses->se_cb_sec.uid;
950-
kcred->gid = ses->se_cb_sec.gid;
949+
kcred->fsuid = ses->se_cb_sec.uid;
950+
kcred->fsgid = ses->se_cb_sec.gid;
951951
return kcred;
952952
}
953953
}

fs/nfsd/nfs4xdr.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2476,10 +2476,12 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
24762476
for (i = 0; i < argp->opcnt; i++) {
24772477
op = &argp->ops[i];
24782478
op->replay = NULL;
2479+
op->opdesc = NULL;
24792480

24802481
if (xdr_stream_decode_u32(argp->xdr, &op->opnum) < 0)
24812482
return false;
24822483
if (nfsd4_opnum_in_range(argp, op)) {
2484+
op->opdesc = OPDESC(op);
24832485
op->status = nfsd4_dec_ops[op->opnum](argp, &op->u);
24842486
if (op->status != nfs_ok)
24852487
trace_nfsd_compound_decode_err(argp->rqstp,
@@ -2490,7 +2492,7 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
24902492
op->opnum = OP_ILLEGAL;
24912493
op->status = nfserr_op_illegal;
24922494
}
2493-
op->opdesc = OPDESC(op);
2495+
24942496
/*
24952497
* We'll try to cache the result in the DRC if any one
24962498
* op in the compound wants to be cached:
@@ -5400,10 +5402,8 @@ nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
54005402
__be32 *p;
54015403

54025404
p = xdr_reserve_space(xdr, 8);
5403-
if (!p) {
5404-
WARN_ON_ONCE(1);
5405-
return;
5406-
}
5405+
if (!p)
5406+
goto release;
54075407
*p++ = cpu_to_be32(op->opnum);
54085408
post_err_offset = xdr->buf->len;
54095409

@@ -5418,8 +5418,6 @@ nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
54185418
op->status = encoder(resp, op->status, &op->u);
54195419
if (op->status)
54205420
trace_nfsd_compound_encode_err(rqstp, op->opnum, op->status);
5421-
if (opdesc && opdesc->op_release)
5422-
opdesc->op_release(&op->u);
54235421
xdr_commit_encode(xdr);
54245422

54255423
/* nfsd4_check_resp_size guarantees enough room for error status */
@@ -5460,6 +5458,9 @@ nfsd4_encode_operation(struct nfsd4_compoundres *resp, struct nfsd4_op *op)
54605458
}
54615459
status:
54625460
*p = op->status;
5461+
release:
5462+
if (opdesc && opdesc->op_release)
5463+
opdesc->op_release(&op->u);
54635464
}
54645465

54655466
/*

net/sunrpc/svcauth_unix.c

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,14 +416,23 @@ static int unix_gid_hash(kuid_t uid)
416416
return hash_long(from_kuid(&init_user_ns, uid), GID_HASHBITS);
417417
}
418418

419-
static void unix_gid_put(struct kref *kref)
419+
static void unix_gid_free(struct rcu_head *rcu)
420420
{
421-
struct cache_head *item = container_of(kref, struct cache_head, ref);
422-
struct unix_gid *ug = container_of(item, struct unix_gid, h);
421+
struct unix_gid *ug = container_of(rcu, struct unix_gid, rcu);
422+
struct cache_head *item = &ug->h;
423+
423424
if (test_bit(CACHE_VALID, &item->flags) &&
424425
!test_bit(CACHE_NEGATIVE, &item->flags))
425426
put_group_info(ug->gi);
426-
kfree_rcu(ug, rcu);
427+
kfree(ug);
428+
}
429+
430+
static void unix_gid_put(struct kref *kref)
431+
{
432+
struct cache_head *item = container_of(kref, struct cache_head, ref);
433+
struct unix_gid *ug = container_of(item, struct unix_gid, h);
434+
435+
call_rcu(&ug->rcu, unix_gid_free);
427436
}
428437

429438
static int unix_gid_match(struct cache_head *corig, struct cache_head *cnew)

0 commit comments

Comments
 (0)