]> granicus.if.org Git - zfs/commit
Fix crgetgroups out-of-bound and misc cred fix
authorChunwei Chen <david.chen@osnexus.com>
Tue, 18 Oct 2016 22:52:30 +0000 (15:52 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Thu, 20 Oct 2016 16:33:01 +0000 (09:33 -0700)
commit9ba3c01923d45a19003641ceab311150752ed491
tree945091a7ec3807474bde360a4d878dce4eb8e932
parent0d267566650d89bde8bd5ec4665749810d5bafc7
Fix crgetgroups out-of-bound and misc cred fix

init_groups has 0 nblocks, therefore calling the current crgetgroups with
init_groups would result in out-of-bound access. We fix this by returning NULL
when nblocks is 0.

Cap crgetngroups to NGROUPS_PER_BLOCK, since crgetgroups will only return
blocks[0].

Also, remove all get_group_info. The cred already holds reference on the
group_info, and cred is not mutable. So there's no reason to hold extra
reference, if we hold cred.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Chunwei Chen <david.chen@osnexus.com>
Closes #556
module/spl/spl-cred.c