diff options
Diffstat (limited to 'net/ipv6/xfrm6_tunnel.c')
-rw-r--r-- | net/ipv6/xfrm6_tunnel.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/net/ipv6/xfrm6_tunnel.c b/net/ipv6/xfrm6_tunnel.c index 8cfc58b96fc2..08f9abbdf1d7 100644 --- a/net/ipv6/xfrm6_tunnel.c +++ b/net/ipv6/xfrm6_tunnel.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <net/protocol.h> | 31 | #include <net/protocol.h> |
32 | #include <linux/ipv6.h> | 32 | #include <linux/ipv6.h> |
33 | #include <linux/icmpv6.h> | 33 | #include <linux/icmpv6.h> |
34 | #include <linux/mutex.h> | ||
34 | 35 | ||
35 | #ifdef CONFIG_IPV6_XFRM6_TUNNEL_DEBUG | 36 | #ifdef CONFIG_IPV6_XFRM6_TUNNEL_DEBUG |
36 | # define X6TDEBUG 3 | 37 | # define X6TDEBUG 3 |
@@ -357,19 +358,19 @@ static int xfrm6_tunnel_input(struct xfrm_state *x, struct xfrm_decap_state *dec | |||
357 | } | 358 | } |
358 | 359 | ||
359 | static struct xfrm6_tunnel *xfrm6_tunnel_handler; | 360 | static struct xfrm6_tunnel *xfrm6_tunnel_handler; |
360 | static DECLARE_MUTEX(xfrm6_tunnel_sem); | 361 | static DEFINE_MUTEX(xfrm6_tunnel_mutex); |
361 | 362 | ||
362 | int xfrm6_tunnel_register(struct xfrm6_tunnel *handler) | 363 | int xfrm6_tunnel_register(struct xfrm6_tunnel *handler) |
363 | { | 364 | { |
364 | int ret; | 365 | int ret; |
365 | 366 | ||
366 | down(&xfrm6_tunnel_sem); | 367 | mutex_lock(&xfrm6_tunnel_mutex); |
367 | ret = 0; | 368 | ret = 0; |
368 | if (xfrm6_tunnel_handler != NULL) | 369 | if (xfrm6_tunnel_handler != NULL) |
369 | ret = -EINVAL; | 370 | ret = -EINVAL; |
370 | if (!ret) | 371 | if (!ret) |
371 | xfrm6_tunnel_handler = handler; | 372 | xfrm6_tunnel_handler = handler; |
372 | up(&xfrm6_tunnel_sem); | 373 | mutex_unlock(&xfrm6_tunnel_mutex); |
373 | 374 | ||
374 | return ret; | 375 | return ret; |
375 | } | 376 | } |
@@ -380,13 +381,13 @@ int xfrm6_tunnel_deregister(struct xfrm6_tunnel *handler) | |||
380 | { | 381 | { |
381 | int ret; | 382 | int ret; |
382 | 383 | ||
383 | down(&xfrm6_tunnel_sem); | 384 | mutex_lock(&xfrm6_tunnel_mutex); |
384 | ret = 0; | 385 | ret = 0; |
385 | if (xfrm6_tunnel_handler != handler) | 386 | if (xfrm6_tunnel_handler != handler) |
386 | ret = -EINVAL; | 387 | ret = -EINVAL; |
387 | if (!ret) | 388 | if (!ret) |
388 | xfrm6_tunnel_handler = NULL; | 389 | xfrm6_tunnel_handler = NULL; |
389 | up(&xfrm6_tunnel_sem); | 390 | mutex_unlock(&xfrm6_tunnel_mutex); |
390 | 391 | ||
391 | synchronize_net(); | 392 | synchronize_net(); |
392 | 393 | ||