Project

General

Profile

Actions

Bug #4803

closed

libnsl: recursive mutex lock in return_xprt_copy()

Added by Marcel Telka over 8 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
lib - userland libraries
Start date:
2014-04-25
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

The return_xprt_copy() in libnsl locks svc_door_mutex and then calls svc_door_destroy():

520int
521return_xprt_copy(SVCXPRT *xprt)
522{
523    SVCXPRT        *parent;
524    SVCXPRT_LIST    *xhead, *xlist;
525/* LINTED pointer alignment */
526    int        len = su_data(xprt)->len;
527
528    (void) mutex_lock(&svc_door_mutex);

...

552    if (svc_defunct(xprt)) {
553/* LINTED pointer alignment */
554        svc_flags(parent) |= SVC_DEFUNCT;
555        /* LINTED pointer cast */
556        if (SVCEXT(parent)->refcnt == 0)
557            svc_door_destroy(xprt);
558    }
559    (void) mutex_unlock(&svc_door_mutex);
560    return (len);
561}

The svc_door_destroy() tries to lock the same mutex again:

617static void
618svc_door_destroy(SVCXPRT *xprt)
619{
620    (void) mutex_lock(&svc_door_mutex);
621    svc_door_destroy_pvt(xprt);
622    (void) mutex_unlock(&svc_door_mutex);
623}

To fix this, the return_xprt_copy() should call svc_door_destroy_pvt() instead of svc_door_destroy().

Actions #1

Updated by Marcel Telka over 8 years ago

  • Status changed from In Progress to Pending RTI
Actions #2

Updated by Electric Monk over 8 years ago

  • Status changed from Pending RTI to Closed
  • % Done changed from 0 to 100

git commit 0900f4f20e4cdeb8e5af4ba32aca32d28aeba2f9

commit  0900f4f20e4cdeb8e5af4ba32aca32d28aeba2f9
Author: Marcel Telka <marcel.telka@nexenta.com>
Date:   2014-05-01T00:54:30.000Z

    4803 libnsl: recursive mutex lock in return_xprt_copy()
    Reviewed by: Andy Stormont <AStormont@racktopsystems.com>
    Reviewed by: Dan McDonald <danmcd@omniti.com>
    Approved by: Gordon Ross <gwr@nexenta.com>

Actions

Also available in: Atom PDF