diff options
-rw-r--r-- | include/net/af_unix.h | 3 | ||||
-rw-r--r-- | net/unix/af_unix.c | 8 |
2 files changed, 6 insertions, 5 deletions
diff --git a/include/net/af_unix.h b/include/net/af_unix.h index fd60eccb59a6..3a385e4767f0 100644 --- a/include/net/af_unix.h +++ b/include/net/af_unix.h | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/socket.h> | 4 | #include <linux/socket.h> |
5 | #include <linux/un.h> | 5 | #include <linux/un.h> |
6 | #include <linux/mutex.h> | 6 | #include <linux/mutex.h> |
7 | #include <linux/refcount.h> | ||
7 | #include <net/sock.h> | 8 | #include <net/sock.h> |
8 | 9 | ||
9 | void unix_inflight(struct user_struct *user, struct file *fp); | 10 | void unix_inflight(struct user_struct *user, struct file *fp); |
@@ -21,7 +22,7 @@ extern spinlock_t unix_table_lock; | |||
21 | extern struct hlist_head unix_socket_table[2 * UNIX_HASH_SIZE]; | 22 | extern struct hlist_head unix_socket_table[2 * UNIX_HASH_SIZE]; |
22 | 23 | ||
23 | struct unix_address { | 24 | struct unix_address { |
24 | atomic_t refcnt; | 25 | refcount_t refcnt; |
25 | int len; | 26 | int len; |
26 | unsigned int hash; | 27 | unsigned int hash; |
27 | struct sockaddr_un name[0]; | 28 | struct sockaddr_un name[0]; |
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index c88525403d2e..b9ee766054f6 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -212,7 +212,7 @@ EXPORT_SYMBOL_GPL(unix_peer_get); | |||
212 | 212 | ||
213 | static inline void unix_release_addr(struct unix_address *addr) | 213 | static inline void unix_release_addr(struct unix_address *addr) |
214 | { | 214 | { |
215 | if (atomic_dec_and_test(&addr->refcnt)) | 215 | if (refcount_dec_and_test(&addr->refcnt)) |
216 | kfree(addr); | 216 | kfree(addr); |
217 | } | 217 | } |
218 | 218 | ||
@@ -864,7 +864,7 @@ static int unix_autobind(struct socket *sock) | |||
864 | goto out; | 864 | goto out; |
865 | 865 | ||
866 | addr->name->sun_family = AF_UNIX; | 866 | addr->name->sun_family = AF_UNIX; |
867 | atomic_set(&addr->refcnt, 1); | 867 | refcount_set(&addr->refcnt, 1); |
868 | 868 | ||
869 | retry: | 869 | retry: |
870 | addr->len = sprintf(addr->name->sun_path+1, "%05x", ordernum) + 1 + sizeof(short); | 870 | addr->len = sprintf(addr->name->sun_path+1, "%05x", ordernum) + 1 + sizeof(short); |
@@ -1040,7 +1040,7 @@ static int unix_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
1040 | memcpy(addr->name, sunaddr, addr_len); | 1040 | memcpy(addr->name, sunaddr, addr_len); |
1041 | addr->len = addr_len; | 1041 | addr->len = addr_len; |
1042 | addr->hash = hash ^ sk->sk_type; | 1042 | addr->hash = hash ^ sk->sk_type; |
1043 | atomic_set(&addr->refcnt, 1); | 1043 | refcount_set(&addr->refcnt, 1); |
1044 | 1044 | ||
1045 | if (sun_path[0]) { | 1045 | if (sun_path[0]) { |
1046 | addr->hash = UNIX_HASH_SIZE; | 1046 | addr->hash = UNIX_HASH_SIZE; |
@@ -1335,7 +1335,7 @@ restart: | |||
1335 | 1335 | ||
1336 | /* copy address information from listening to new sock*/ | 1336 | /* copy address information from listening to new sock*/ |
1337 | if (otheru->addr) { | 1337 | if (otheru->addr) { |
1338 | atomic_inc(&otheru->addr->refcnt); | 1338 | refcount_inc(&otheru->addr->refcnt); |
1339 | newu->addr = otheru->addr; | 1339 | newu->addr = otheru->addr; |
1340 | } | 1340 | } |
1341 | if (otheru->path.dentry) { | 1341 | if (otheru->path.dentry) { |