endpoint: protect the idr tree on release
authorDjalal Harouni <tixxdz@opendz.org>
Mon, 31 Mar 2014 00:41:24 +0000 (01:41 +0100)
committerKay Sievers <kay@vrfy.org>
Mon, 31 Mar 2014 12:26:13 +0000 (14:26 +0200)
Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
endpoint.c

index 66b4de56df6f86c750b6d54379482ac03418b191..f37b80a834275170f06423dbd1be8f0ef54a3c52 100644 (file)
@@ -104,7 +104,9 @@ void kdbus_ep_disconnect(struct kdbus_ep *ep)
                ep->dev = NULL;
        }
        if (ep->minor > 0) {
+               mutex_lock(&ep->bus->domain->lock);
                idr_remove(&ep->bus->domain->idr, ep->minor);
+               mutex_unlock(&ep->bus->domain->lock);
                ep->minor = 0;
        }
 }