View | Details | Raw Unified | Return to bug 200585
Collapse All | Expand All

(-)b/sys/nlm/nlm_advlock.c (-5 / +9 lines)
Lines 210-216 nlm_advlock_internal(struct vnode *vp, void *id, int op, struct flock *fl, Link Here
210
	struct rpc_callextra ext;
210
	struct rpc_callextra ext;
211
	struct nlm_feedback_arg nf;
211
	struct nlm_feedback_arg nf;
212
	AUTH *auth;
212
	AUTH *auth;
213
	struct ucred *cred;
213
	struct ucred *cred, *cred1;
214
	struct nlm_file_svid *ns;
214
	struct nlm_file_svid *ns;
215
	int svid;
215
	int svid;
216
	int error;
216
	int error;
Lines 240-254 nlm_advlock_internal(struct vnode *vp, void *id, int op, struct flock *fl, Link Here
240
	else
240
	else
241
		retries = INT_MAX;
241
		retries = INT_MAX;
242
242
243
	if (unlock_vp)
244
		VOP_UNLOCK(vp, 0);
245
246
	/*
243
	/*
247
	 * We need to switch to mount-point creds so that we can send
244
	 * We need to switch to mount-point creds so that we can send
248
	 * packets from a privileged port.
245
	 * packets from a privileged port.  Reference mnt_cred and
246
	 * switch to them before unlocking the vnode, since mount
247
	 * point could be unmounted right after unlock.
249
	 */
248
	 */
250
	cred = td->td_ucred;
249
	cred = td->td_ucred;
251
	td->td_ucred = vp->v_mount->mnt_cred;
250
	td->td_ucred = vp->v_mount->mnt_cred;
251
	crhold(td->td_ucred);
252
	if (unlock_vp)
253
		VOP_UNLOCK(vp, 0);
252
254
253
	host = nlm_find_host_by_name(servername, sa, vers);
255
	host = nlm_find_host_by_name(servername, sa, vers);
254
	auth = authunix_create(cred);
256
	auth = authunix_create(cred);
Lines 373-379 nlm_advlock_internal(struct vnode *vp, void *id, int op, struct flock *fl, Link Here
373
	if (ns)
375
	if (ns)
374
		nlm_free_svid(ns);
376
		nlm_free_svid(ns);
375
377
378
	cred1 = td->td_ucred;
376
	td->td_ucred = cred;
379
	td->td_ucred = cred;
380
	crfree(cred1);
377
	AUTH_DESTROY(auth);
381
	AUTH_DESTROY(auth);
378
382
379
	nlm_host_release(host);
383
	nlm_host_release(host);

Return to bug 200585