diff options
-rw-r--r-- | include/linux/phonet.h | 2 | ||||
-rw-r--r-- | net/phonet/datagram.c | 13 | ||||
-rw-r--r-- | net/phonet/socket.c | 1 |
3 files changed, 16 insertions, 0 deletions
diff --git a/include/linux/phonet.h b/include/linux/phonet.h index 76edadf046d3..85e14a83283b 100644 --- a/include/linux/phonet.h +++ b/include/linux/phonet.h | |||
@@ -47,6 +47,8 @@ | |||
47 | 47 | ||
48 | /* ioctls */ | 48 | /* ioctls */ |
49 | #define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0) | 49 | #define SIOCPNGETOBJECT (SIOCPROTOPRIVATE + 0) |
50 | #define SIOCPNADDRESOURCE (SIOCPROTOPRIVATE + 14) | ||
51 | #define SIOCPNDELRESOURCE (SIOCPROTOPRIVATE + 15) | ||
50 | 52 | ||
51 | /* Phonet protocol header */ | 53 | /* Phonet protocol header */ |
52 | struct phonethdr { | 54 | struct phonethdr { |
diff --git a/net/phonet/datagram.c b/net/phonet/datagram.c index 1bd38db4fe1e..2f032381bd45 100644 --- a/net/phonet/datagram.c +++ b/net/phonet/datagram.c | |||
@@ -52,6 +52,19 @@ static int pn_ioctl(struct sock *sk, int cmd, unsigned long arg) | |||
52 | answ = skb ? skb->len : 0; | 52 | answ = skb ? skb->len : 0; |
53 | release_sock(sk); | 53 | release_sock(sk); |
54 | return put_user(answ, (int __user *)arg); | 54 | return put_user(answ, (int __user *)arg); |
55 | |||
56 | case SIOCPNADDRESOURCE: | ||
57 | case SIOCPNDELRESOURCE: { | ||
58 | u32 res; | ||
59 | if (get_user(res, (u32 __user *)arg)) | ||
60 | return -EFAULT; | ||
61 | if (res >= 256) | ||
62 | return -EINVAL; | ||
63 | if (cmd == SIOCPNADDRESOURCE) | ||
64 | return pn_sock_bind_res(sk, res); | ||
65 | else | ||
66 | return pn_sock_unbind_res(sk, res); | ||
67 | } | ||
55 | } | 68 | } |
56 | 69 | ||
57 | return -ENOIOCTLCMD; | 70 | return -ENOIOCTLCMD; |
diff --git a/net/phonet/socket.c b/net/phonet/socket.c index 4c29a23e9007..d4f41afc0583 100644 --- a/net/phonet/socket.c +++ b/net/phonet/socket.c | |||
@@ -158,6 +158,7 @@ void pn_sock_unhash(struct sock *sk) | |||
158 | spin_lock_bh(&pnsocks.lock); | 158 | spin_lock_bh(&pnsocks.lock); |
159 | sk_del_node_init(sk); | 159 | sk_del_node_init(sk); |
160 | spin_unlock_bh(&pnsocks.lock); | 160 | spin_unlock_bh(&pnsocks.lock); |
161 | pn_sock_unbind_all_res(sk); | ||
161 | } | 162 | } |
162 | EXPORT_SYMBOL(pn_sock_unhash); | 163 | EXPORT_SYMBOL(pn_sock_unhash); |
163 | 164 | ||