]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC: r345818, r345828
authorrmacklem <rmacklem@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 16 Apr 2019 02:48:04 +0000 (02:48 +0000)
committerrmacklem <rmacklem@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Tue, 16 Apr 2019 02:48:04 +0000 (02:48 +0000)
commit06ec69c59f7b6a4d64d7950c5a440aabb81d5c70
tree1dcee17e3b31f83da3a9d96752df2b480ee437d8
parent1b93004763531114a6f96aa3c715b359ee88cfae
MFC: r345818, r345828
Fix a race in the RPCSEC_GSS server code that caused crashes.

When a new client structure was allocated, it was added to the list
so that it was visible to other threads before the expiry time was
initialized, with only a single reference count.
The caller would increment the reference count, but it was possible
for another thread to decrement the reference count to zero and free
the structure before the caller incremented the reference count.
This could occur because the expiry time was still set to zero when
the new client structure was inserted in the list and the list was
unlocked.

This patch fixes the race by initializing the reference count to two
and initializing all fields, including the expiry time, before inserting
it in the list.

git-svn-id: svn://svn.freebsd.org/base/stable/10@346262 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
sys/rpc/rpcsec_gss/svc_rpcsec_gss.c