]> err.no Git - linux-2.6/commitdiff
[NETLINK]: don't reinitialize callback mutex
authorPatrick McHardy <kaber@trash.net>
Wed, 25 Apr 2007 21:01:17 +0000 (14:01 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Thu, 26 Apr 2007 05:29:06 +0000 (22:29 -0700)
Don't reinitialize the callback mutex the netlink_kernel_create caller
handed in, it is supposed to already be initialized and could already
be held by someone.

Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/netlink/af_netlink.c

index ec16c9b7b3bddb83bc54569fd631530166e05d88..64d4b27f25ab648e14bd84c9553dd6ef9127804b 100644 (file)
@@ -388,8 +388,12 @@ static int __netlink_create(struct socket *sock, struct mutex *cb_mutex,
        sock_init_data(sock, sk);
 
        nlk = nlk_sk(sk);
-       nlk->cb_mutex = cb_mutex ? : &nlk->cb_def_mutex;
-       mutex_init(nlk->cb_mutex);
+       if (cb_mutex)
+               nlk->cb_mutex = cb_mutex;
+       else {
+               nlk->cb_mutex = &nlk->cb_def_mutex;
+               mutex_init(nlk->cb_mutex);
+       }
        init_waitqueue_head(&nlk->wait);
 
        sk->sk_destruct = netlink_sock_destruct;