diff options
author | Rick Macklem <rmacklem@FreeBSD.org> | 2009-06-17 22:50:26 +0000 |
---|---|---|
committer | Rick Macklem <rmacklem@FreeBSD.org> | 2009-06-17 22:50:26 +0000 |
commit | 6b97c9f09a0184f0853280013297e288751ec76a (patch) | |
tree | 16d38ade3aac3d505cfcf872a12639bc87a462cc /sys/nlm/nlm_prot_impl.c | |
parent | 3055b7c6ffb457f95c2826c50df0453039e5f61c (diff) | |
download | src-6b97c9f09a0184f0853280013297e288751ec76a.tar.gz src-6b97c9f09a0184f0853280013297e288751ec76a.zip |
Since svc_[dg|vc|tli|tp]_create() did not hold a reference count on the
SVCXPTR structure returned by them, it was possible for the structure
to be free'd before svc_reg() had been completed using the structure.
This patch acquires a reference count on the newly created structure
that is returned by svc_[dg|vc|tli|tp]_create(). It also
adds the appropriate SVC_RELEASE() calls to the callers, except the
experimental nfs subsystem. The latter will be committed separately.
Submitted by: dfr
Tested by: pho
Approved by: kib (mentor)
Notes
Notes:
svn path=/head/; revision=194407
Diffstat (limited to 'sys/nlm/nlm_prot_impl.c')
-rw-r--r-- | sys/nlm/nlm_prot_impl.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/nlm/nlm_prot_impl.c b/sys/nlm/nlm_prot_impl.c index 6ee6baa282ac..049c7ba97508 100644 --- a/sys/nlm/nlm_prot_impl.c +++ b/sys/nlm/nlm_prot_impl.c @@ -1389,7 +1389,7 @@ nlm_register_services(SVCPOOL *pool, int addr_count, char **addrs) return (EINVAL); } - xprts = malloc(addr_count * sizeof(SVCXPRT *), M_NLM, M_WAITOK); + xprts = malloc(addr_count * sizeof(SVCXPRT *), M_NLM, M_WAITOK|M_ZERO); for (i = 0; i < version_count; i++) { for (j = 0; j < addr_count; j++) { /* @@ -1447,6 +1447,10 @@ nlm_register_services(SVCPOOL *pool, int addr_count, char **addrs) } error = 0; out: + for (j = 0; j < addr_count; j++) { + if (xprts[j]) + SVC_RELEASE(xprts[j]); + } free(xprts, M_NLM); return (error); } |