From b146c2d54ff3bd99f2c4674eb88d5af417a194d7 Mon Sep 17 00:00:00 2001 From: Michael Meffie Date: Thu, 12 Jan 2017 12:27:36 -0500 Subject: [PATCH] SOLARIS: fix for AFS_PAG_ONEGROUP_ENV for Solaris 11 Fix a bug introduced in commit aab1e71628e6a4ce68c5e59e2f815867438280d1 in which a pointer was incorrectly checked for a NULL value. Fixes a crash when a PAG is set on Solaris. # mdb unix.1 vmcore.1 > ::status ... panic message: BAD TRAP: type=e (#pf Page fault) rp=fffffffc802ba8f0 addr=0 occurred in module "afs" due to a NULL pointer dereference > ::stack pag_to_gidset+0x145() setpag+0xcc() AddPag+0x3a() afs_setpag+0x58() Afs_syscall+0x115() The crash occurs since gidslot is NULL during the assignment: *gidslot = pagvalue; Change-Id: Ic4d50c6b046d10faa49cd4363692e0302707583d Reviewed-on: https://gerrit.openafs.org/12508 Reviewed-by: Benjamin Kaduk Tested-by: BuildBot --- src/afs/SOLARIS/osi_groups.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/afs/SOLARIS/osi_groups.c b/src/afs/SOLARIS/osi_groups.c index 6358821e3..4cbb62f9e 100644 --- a/src/afs/SOLARIS/osi_groups.c +++ b/src/afs/SOLARIS/osi_groups.c @@ -96,7 +96,7 @@ pag_to_gidset(afs_uint32 pagvalue, gid_t *gidset, int *a_ngroups, } } - if (gidslot != NULL) { + if (gidslot == NULL) { /* If we don't already have a PAG, grow the groups list by one, and put * our PAG in the new empty slot. */ if ((sizeof(gidset[0])) * (ngroups + 1) > gidset_sz) { -- 2.39.5