diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/8021q/vlanproc.c | 2 | ||||
-rw-r--r-- | net/9p/trans_fd.c | 2 | ||||
-rw-r--r-- | net/bluetooth/rfcomm/tty.c | 10 | ||||
-rw-r--r-- | net/core/dev.c | 22 | ||||
-rw-r--r-- | net/core/dst.c | 4 | ||||
-rw-r--r-- | net/core/link_watch.c | 21 | ||||
-rw-r--r-- | net/core/neighbour.c | 2 | ||||
-rw-r--r-- | net/core/netprio_cgroup.c | 23 | ||||
-rw-r--r-- | net/core/sock.c | 15 | ||||
-rw-r--r-- | net/dns_resolver/dns_key.c | 3 | ||||
-rw-r--r-- | net/dsa/dsa.c | 2 | ||||
-rw-r--r-- | net/ipv4/inetpeer.c | 2 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_param.c | 5 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_tty.c | 320 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_tty_attach.c | 40 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_tty_ioctl.c | 33 | ||||
-rw-r--r-- | net/netfilter/nfnetlink_log.c | 8 | ||||
-rw-r--r-- | net/netfilter/xt_LOG.c | 4 | ||||
-rw-r--r-- | net/netlabel/netlabel_unlabeled.c | 2 | ||||
-rw-r--r-- | net/netlabel/netlabel_user.c | 2 | ||||
-rw-r--r-- | net/rfkill/input.c | 3 | ||||
-rw-r--r-- | net/rxrpc/ar-key.c | 6 | ||||
-rw-r--r-- | net/sched/cls_cgroup.c | 22 | ||||
-rw-r--r-- | net/sunrpc/cache.c | 2 | ||||
-rw-r--r-- | net/xfrm/xfrm_policy.c | 8 | ||||
-rw-r--r-- | net/xfrm/xfrm_state.c | 6 | ||||
-rw-r--r-- | net/xfrm/xfrm_user.c | 12 |
27 files changed, 285 insertions, 296 deletions
diff --git a/net/8021q/vlanproc.c b/net/8021q/vlanproc.c index c718fd3664b..4de77ea5fa3 100644 --- a/net/8021q/vlanproc.c +++ b/net/8021q/vlanproc.c | |||
@@ -105,7 +105,7 @@ static const struct file_operations vlandev_fops = { | |||
105 | }; | 105 | }; |
106 | 106 | ||
107 | /* | 107 | /* |
108 | * Proc filesystem derectory entries. | 108 | * Proc filesystem directory entries. |
109 | */ | 109 | */ |
110 | 110 | ||
111 | /* Strings */ | 111 | /* Strings */ |
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index 6449bae1570..505f0ce3f10 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c | |||
@@ -1083,7 +1083,7 @@ int p9_trans_fd_init(void) | |||
1083 | 1083 | ||
1084 | void p9_trans_fd_exit(void) | 1084 | void p9_trans_fd_exit(void) |
1085 | { | 1085 | { |
1086 | flush_work_sync(&p9_poll_work); | 1086 | flush_work(&p9_poll_work); |
1087 | v9fs_unregister_trans(&p9_tcp_trans); | 1087 | v9fs_unregister_trans(&p9_tcp_trans); |
1088 | v9fs_unregister_trans(&p9_unix_trans); | 1088 | v9fs_unregister_trans(&p9_unix_trans); |
1089 | v9fs_unregister_trans(&p9_fd_trans); | 1089 | v9fs_unregister_trans(&p9_fd_trans); |
diff --git a/net/bluetooth/rfcomm/tty.c b/net/bluetooth/rfcomm/tty.c index 56f182393c4..ccc248791d5 100644 --- a/net/bluetooth/rfcomm/tty.c +++ b/net/bluetooth/rfcomm/tty.c | |||
@@ -278,8 +278,8 @@ out: | |||
278 | if (err < 0) | 278 | if (err < 0) |
279 | goto free; | 279 | goto free; |
280 | 280 | ||
281 | dev->tty_dev = tty_register_device(rfcomm_tty_driver, dev->id, NULL); | 281 | dev->tty_dev = tty_port_register_device(&dev->port, rfcomm_tty_driver, |
282 | 282 | dev->id, NULL); | |
283 | if (IS_ERR(dev->tty_dev)) { | 283 | if (IS_ERR(dev->tty_dev)) { |
284 | err = PTR_ERR(dev->tty_dev); | 284 | err = PTR_ERR(dev->tty_dev); |
285 | list_del(&dev->list); | 285 | list_del(&dev->list); |
@@ -705,9 +705,9 @@ static int rfcomm_tty_open(struct tty_struct *tty, struct file *filp) | |||
705 | break; | 705 | break; |
706 | } | 706 | } |
707 | 707 | ||
708 | tty_unlock(); | 708 | tty_unlock(tty); |
709 | schedule(); | 709 | schedule(); |
710 | tty_lock(); | 710 | tty_lock(tty); |
711 | } | 711 | } |
712 | set_current_state(TASK_RUNNING); | 712 | set_current_state(TASK_RUNNING); |
713 | remove_wait_queue(&dev->wait, &wait); | 713 | remove_wait_queue(&dev->wait, &wait); |
@@ -861,7 +861,7 @@ static int rfcomm_tty_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned l | |||
861 | 861 | ||
862 | static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old) | 862 | static void rfcomm_tty_set_termios(struct tty_struct *tty, struct ktermios *old) |
863 | { | 863 | { |
864 | struct ktermios *new = tty->termios; | 864 | struct ktermios *new = &tty->termios; |
865 | int old_baud_rate = tty_termios_baud_rate(old); | 865 | int old_baud_rate = tty_termios_baud_rate(old); |
866 | int new_baud_rate = tty_termios_baud_rate(new); | 866 | int new_baud_rate = tty_termios_baud_rate(new); |
867 | 867 | ||
diff --git a/net/core/dev.c b/net/core/dev.c index ba4bb118a75..1e0a1847c3b 100644 --- a/net/core/dev.c +++ b/net/core/dev.c | |||
@@ -4569,7 +4569,7 @@ static int __dev_set_promiscuity(struct net_device *dev, int inc) | |||
4569 | "dev=%s prom=%d old_prom=%d auid=%u uid=%u gid=%u ses=%u", | 4569 | "dev=%s prom=%d old_prom=%d auid=%u uid=%u gid=%u ses=%u", |
4570 | dev->name, (dev->flags & IFF_PROMISC), | 4570 | dev->name, (dev->flags & IFF_PROMISC), |
4571 | (old_flags & IFF_PROMISC), | 4571 | (old_flags & IFF_PROMISC), |
4572 | audit_get_loginuid(current), | 4572 | from_kuid(&init_user_ns, audit_get_loginuid(current)), |
4573 | from_kuid(&init_user_ns, uid), | 4573 | from_kuid(&init_user_ns, uid), |
4574 | from_kgid(&init_user_ns, gid), | 4574 | from_kgid(&init_user_ns, gid), |
4575 | audit_get_sessionid(current)); | 4575 | audit_get_sessionid(current)); |
@@ -6464,22 +6464,26 @@ const char *netdev_drivername(const struct net_device *dev) | |||
6464 | return empty; | 6464 | return empty; |
6465 | } | 6465 | } |
6466 | 6466 | ||
6467 | int __netdev_printk(const char *level, const struct net_device *dev, | 6467 | static int __netdev_printk(const char *level, const struct net_device *dev, |
6468 | struct va_format *vaf) | 6468 | struct va_format *vaf) |
6469 | { | 6469 | { |
6470 | int r; | 6470 | int r; |
6471 | 6471 | ||
6472 | if (dev && dev->dev.parent) | 6472 | if (dev && dev->dev.parent) { |
6473 | r = dev_printk(level, dev->dev.parent, "%s: %pV", | 6473 | r = dev_printk_emit(level[1] - '0', |
6474 | netdev_name(dev), vaf); | 6474 | dev->dev.parent, |
6475 | else if (dev) | 6475 | "%s %s %s: %pV", |
6476 | dev_driver_string(dev->dev.parent), | ||
6477 | dev_name(dev->dev.parent), | ||
6478 | netdev_name(dev), vaf); | ||
6479 | } else if (dev) { | ||
6476 | r = printk("%s%s: %pV", level, netdev_name(dev), vaf); | 6480 | r = printk("%s%s: %pV", level, netdev_name(dev), vaf); |
6477 | else | 6481 | } else { |
6478 | r = printk("%s(NULL net_device): %pV", level, vaf); | 6482 | r = printk("%s(NULL net_device): %pV", level, vaf); |
6483 | } | ||
6479 | 6484 | ||
6480 | return r; | 6485 | return r; |
6481 | } | 6486 | } |
6482 | EXPORT_SYMBOL(__netdev_printk); | ||
6483 | 6487 | ||
6484 | int netdev_printk(const char *level, const struct net_device *dev, | 6488 | int netdev_printk(const char *level, const struct net_device *dev, |
6485 | const char *format, ...) | 6489 | const char *format, ...) |
@@ -6494,6 +6498,7 @@ int netdev_printk(const char *level, const struct net_device *dev, | |||
6494 | vaf.va = &args; | 6498 | vaf.va = &args; |
6495 | 6499 | ||
6496 | r = __netdev_printk(level, dev, &vaf); | 6500 | r = __netdev_printk(level, dev, &vaf); |
6501 | |||
6497 | va_end(args); | 6502 | va_end(args); |
6498 | 6503 | ||
6499 | return r; | 6504 | return r; |
@@ -6513,6 +6518,7 @@ int func(const struct net_device *dev, const char *fmt, ...) \ | |||
6513 | vaf.va = &args; \ | 6518 | vaf.va = &args; \ |
6514 | \ | 6519 | \ |
6515 | r = __netdev_printk(level, dev, &vaf); \ | 6520 | r = __netdev_printk(level, dev, &vaf); \ |
6521 | \ | ||
6516 | va_end(args); \ | 6522 | va_end(args); \ |
6517 | \ | 6523 | \ |
6518 | return r; \ | 6524 | return r; \ |
diff --git a/net/core/dst.c b/net/core/dst.c index f6593d238e9..ee6153e2cf4 100644 --- a/net/core/dst.c +++ b/net/core/dst.c | |||
@@ -222,8 +222,8 @@ void __dst_free(struct dst_entry *dst) | |||
222 | if (dst_garbage.timer_inc > DST_GC_INC) { | 222 | if (dst_garbage.timer_inc > DST_GC_INC) { |
223 | dst_garbage.timer_inc = DST_GC_INC; | 223 | dst_garbage.timer_inc = DST_GC_INC; |
224 | dst_garbage.timer_expires = DST_GC_MIN; | 224 | dst_garbage.timer_expires = DST_GC_MIN; |
225 | cancel_delayed_work(&dst_gc_work); | 225 | mod_delayed_work(system_wq, &dst_gc_work, |
226 | schedule_delayed_work(&dst_gc_work, dst_garbage.timer_expires); | 226 | dst_garbage.timer_expires); |
227 | } | 227 | } |
228 | spin_unlock_bh(&dst_garbage.lock); | 228 | spin_unlock_bh(&dst_garbage.lock); |
229 | } | 229 | } |
diff --git a/net/core/link_watch.c b/net/core/link_watch.c index a01922219a2..8f82a5cc385 100644 --- a/net/core/link_watch.c +++ b/net/core/link_watch.c | |||
@@ -128,22 +128,13 @@ static void linkwatch_schedule_work(int urgent) | |||
128 | delay = 0; | 128 | delay = 0; |
129 | 129 | ||
130 | /* | 130 | /* |
131 | * This is true if we've scheduled it immeditately or if we don't | 131 | * If urgent, schedule immediate execution; otherwise, don't |
132 | * need an immediate execution and it's already pending. | 132 | * override the existing timer. |
133 | */ | 133 | */ |
134 | if (schedule_delayed_work(&linkwatch_work, delay) == !delay) | 134 | if (test_bit(LW_URGENT, &linkwatch_flags)) |
135 | return; | 135 | mod_delayed_work(system_wq, &linkwatch_work, 0); |
136 | 136 | else | |
137 | /* Don't bother if there is nothing urgent. */ | 137 | schedule_delayed_work(&linkwatch_work, delay); |
138 | if (!test_bit(LW_URGENT, &linkwatch_flags)) | ||
139 | return; | ||
140 | |||
141 | /* It's already running which is good enough. */ | ||
142 | if (!__cancel_delayed_work(&linkwatch_work)) | ||
143 | return; | ||
144 | |||
145 | /* Otherwise we reschedule it again for immediate execution. */ | ||
146 | schedule_delayed_work(&linkwatch_work, 0); | ||
147 | } | 138 | } |
148 | 139 | ||
149 | 140 | ||
diff --git a/net/core/neighbour.c b/net/core/neighbour.c index c160adb38e5..baca771caae 100644 --- a/net/core/neighbour.c +++ b/net/core/neighbour.c | |||
@@ -1545,7 +1545,7 @@ static void neigh_table_init_no_netlink(struct neigh_table *tbl) | |||
1545 | panic("cannot allocate neighbour cache hashes"); | 1545 | panic("cannot allocate neighbour cache hashes"); |
1546 | 1546 | ||
1547 | rwlock_init(&tbl->lock); | 1547 | rwlock_init(&tbl->lock); |
1548 | INIT_DELAYED_WORK_DEFERRABLE(&tbl->gc_work, neigh_periodic_work); | 1548 | INIT_DEFERRABLE_WORK(&tbl->gc_work, neigh_periodic_work); |
1549 | schedule_delayed_work(&tbl->gc_work, tbl->parms.reachable_time); | 1549 | schedule_delayed_work(&tbl->gc_work, tbl->parms.reachable_time); |
1550 | setup_timer(&tbl->proxy_timer, neigh_proxy_process, (unsigned long)tbl); | 1550 | setup_timer(&tbl->proxy_timer, neigh_proxy_process, (unsigned long)tbl); |
1551 | skb_queue_head_init_class(&tbl->proxy_queue, | 1551 | skb_queue_head_init_class(&tbl->proxy_queue, |
diff --git a/net/core/netprio_cgroup.c b/net/core/netprio_cgroup.c index 45c503e45fc..4a83fb3c8e8 100644 --- a/net/core/netprio_cgroup.c +++ b/net/core/netprio_cgroup.c | |||
@@ -293,11 +293,19 @@ struct cgroup_subsys net_prio_subsys = { | |||
293 | .create = cgrp_create, | 293 | .create = cgrp_create, |
294 | .destroy = cgrp_destroy, | 294 | .destroy = cgrp_destroy, |
295 | .attach = net_prio_attach, | 295 | .attach = net_prio_attach, |
296 | #ifdef CONFIG_NETPRIO_CGROUP | ||
297 | .subsys_id = net_prio_subsys_id, | 296 | .subsys_id = net_prio_subsys_id, |
298 | #endif | ||
299 | .base_cftypes = ss_files, | 297 | .base_cftypes = ss_files, |
300 | .module = THIS_MODULE | 298 | .module = THIS_MODULE, |
299 | |||
300 | /* | ||
301 | * net_prio has artificial limit on the number of cgroups and | ||
302 | * disallows nesting making it impossible to co-mount it with other | ||
303 | * hierarchical subsystems. Remove the artificially low PRIOIDX_SZ | ||
304 | * limit and properly nest configuration such that children follow | ||
305 | * their parents' configurations by default and are allowed to | ||
306 | * override and remove the following. | ||
307 | */ | ||
308 | .broken_hierarchy = true, | ||
301 | }; | 309 | }; |
302 | 310 | ||
303 | static int netprio_device_event(struct notifier_block *unused, | 311 | static int netprio_device_event(struct notifier_block *unused, |
@@ -333,10 +341,6 @@ static int __init init_cgroup_netprio(void) | |||
333 | ret = cgroup_load_subsys(&net_prio_subsys); | 341 | ret = cgroup_load_subsys(&net_prio_subsys); |
334 | if (ret) | 342 | if (ret) |
335 | goto out; | 343 | goto out; |
336 | #ifndef CONFIG_NETPRIO_CGROUP | ||
337 | smp_wmb(); | ||
338 | net_prio_subsys_id = net_prio_subsys.subsys_id; | ||
339 | #endif | ||
340 | 344 | ||
341 | register_netdevice_notifier(&netprio_device_notifier); | 345 | register_netdevice_notifier(&netprio_device_notifier); |
342 | 346 | ||
@@ -353,11 +357,6 @@ static void __exit exit_cgroup_netprio(void) | |||
353 | 357 | ||
354 | cgroup_unload_subsys(&net_prio_subsys); | 358 | cgroup_unload_subsys(&net_prio_subsys); |
355 | 359 | ||
356 | #ifndef CONFIG_NETPRIO_CGROUP | ||
357 | net_prio_subsys_id = -1; | ||
358 | synchronize_rcu(); | ||
359 | #endif | ||
360 | |||
361 | rtnl_lock(); | 360 | rtnl_lock(); |
362 | for_each_netdev(&init_net, dev) { | 361 | for_each_netdev(&init_net, dev) { |
363 | old = rtnl_dereference(dev->priomap); | 362 | old = rtnl_dereference(dev->priomap); |
diff --git a/net/core/sock.c b/net/core/sock.c index 7eac86463eb..8a146cfcc36 100644 --- a/net/core/sock.c +++ b/net/core/sock.c | |||
@@ -326,17 +326,6 @@ int __sk_backlog_rcv(struct sock *sk, struct sk_buff *skb) | |||
326 | } | 326 | } |
327 | EXPORT_SYMBOL(__sk_backlog_rcv); | 327 | EXPORT_SYMBOL(__sk_backlog_rcv); |
328 | 328 | ||
329 | #if defined(CONFIG_CGROUPS) | ||
330 | #if !defined(CONFIG_NET_CLS_CGROUP) | ||
331 | int net_cls_subsys_id = -1; | ||
332 | EXPORT_SYMBOL_GPL(net_cls_subsys_id); | ||
333 | #endif | ||
334 | #if !defined(CONFIG_NETPRIO_CGROUP) | ||
335 | int net_prio_subsys_id = -1; | ||
336 | EXPORT_SYMBOL_GPL(net_prio_subsys_id); | ||
337 | #endif | ||
338 | #endif | ||
339 | |||
340 | static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen) | 329 | static int sock_set_timeout(long *timeo_p, char __user *optval, int optlen) |
341 | { | 330 | { |
342 | struct timeval tv; | 331 | struct timeval tv; |
@@ -1224,6 +1213,7 @@ static void sk_prot_free(struct proto *prot, struct sock *sk) | |||
1224 | } | 1213 | } |
1225 | 1214 | ||
1226 | #ifdef CONFIG_CGROUPS | 1215 | #ifdef CONFIG_CGROUPS |
1216 | #if IS_ENABLED(CONFIG_NET_CLS_CGROUP) | ||
1227 | void sock_update_classid(struct sock *sk) | 1217 | void sock_update_classid(struct sock *sk) |
1228 | { | 1218 | { |
1229 | u32 classid; | 1219 | u32 classid; |
@@ -1235,7 +1225,9 @@ void sock_update_classid(struct sock *sk) | |||
1235 | sk->sk_classid = classid; | 1225 | sk->sk_classid = classid; |
1236 | } | 1226 | } |
1237 | EXPORT_SYMBOL(sock_update_classid); | 1227 | EXPORT_SYMBOL(sock_update_classid); |
1228 | #endif | ||
1238 | 1229 | ||
1230 | #if IS_ENABLED(CONFIG_NETPRIO_CGROUP) | ||
1239 | void sock_update_netprioidx(struct sock *sk, struct task_struct *task) | 1231 | void sock_update_netprioidx(struct sock *sk, struct task_struct *task) |
1240 | { | 1232 | { |
1241 | if (in_interrupt()) | 1233 | if (in_interrupt()) |
@@ -1245,6 +1237,7 @@ void sock_update_netprioidx(struct sock *sk, struct task_struct *task) | |||
1245 | } | 1237 | } |
1246 | EXPORT_SYMBOL_GPL(sock_update_netprioidx); | 1238 | EXPORT_SYMBOL_GPL(sock_update_netprioidx); |
1247 | #endif | 1239 | #endif |
1240 | #endif | ||
1248 | 1241 | ||
1249 | /** | 1242 | /** |
1250 | * sk_alloc - All socket objects are allocated here | 1243 | * sk_alloc - All socket objects are allocated here |
diff --git a/net/dns_resolver/dns_key.c b/net/dns_resolver/dns_key.c index d9507dd0581..9807945a56d 100644 --- a/net/dns_resolver/dns_key.c +++ b/net/dns_resolver/dns_key.c | |||
@@ -259,7 +259,8 @@ static int __init init_dns_resolver(void) | |||
259 | if (!cred) | 259 | if (!cred) |
260 | return -ENOMEM; | 260 | return -ENOMEM; |
261 | 261 | ||
262 | keyring = key_alloc(&key_type_keyring, ".dns_resolver", 0, 0, cred, | 262 | keyring = key_alloc(&key_type_keyring, ".dns_resolver", |
263 | GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, cred, | ||
263 | (KEY_POS_ALL & ~KEY_POS_SETATTR) | | 264 | (KEY_POS_ALL & ~KEY_POS_SETATTR) | |
264 | KEY_USR_VIEW | KEY_USR_READ, | 265 | KEY_USR_VIEW | KEY_USR_READ, |
265 | KEY_ALLOC_NOT_IN_QUOTA); | 266 | KEY_ALLOC_NOT_IN_QUOTA); |
diff --git a/net/dsa/dsa.c b/net/dsa/dsa.c index 88e7c2f3fa0..45295ca0957 100644 --- a/net/dsa/dsa.c +++ b/net/dsa/dsa.c | |||
@@ -370,7 +370,7 @@ static int dsa_remove(struct platform_device *pdev) | |||
370 | if (dst->link_poll_needed) | 370 | if (dst->link_poll_needed) |
371 | del_timer_sync(&dst->link_poll_timer); | 371 | del_timer_sync(&dst->link_poll_timer); |
372 | 372 | ||
373 | flush_work_sync(&dst->link_poll_work); | 373 | flush_work(&dst->link_poll_work); |
374 | 374 | ||
375 | for (i = 0; i < dst->pd->nr_chips; i++) { | 375 | for (i = 0; i < dst->pd->nr_chips; i++) { |
376 | struct dsa_switch *ds = dst->ds[i]; | 376 | struct dsa_switch *ds = dst->ds[i]; |
diff --git a/net/ipv4/inetpeer.c b/net/ipv4/inetpeer.c index c7527f6b9ad..000e3d239d6 100644 --- a/net/ipv4/inetpeer.c +++ b/net/ipv4/inetpeer.c | |||
@@ -194,7 +194,7 @@ void __init inet_initpeers(void) | |||
194 | 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, | 194 | 0, SLAB_HWCACHE_ALIGN | SLAB_PANIC, |
195 | NULL); | 195 | NULL); |
196 | 196 | ||
197 | INIT_DELAYED_WORK_DEFERRABLE(&gc_work, inetpeer_gc_worker); | 197 | INIT_DEFERRABLE_WORK(&gc_work, inetpeer_gc_worker); |
198 | } | 198 | } |
199 | 199 | ||
200 | static int addr_compare(const struct inetpeer_addr *a, | 200 | static int addr_compare(const struct inetpeer_addr *a, |
diff --git a/net/irda/ircomm/ircomm_param.c b/net/irda/ircomm/ircomm_param.c index 8b915f3ac3b..30893912835 100644 --- a/net/irda/ircomm/ircomm_param.c +++ b/net/irda/ircomm/ircomm_param.c | |||
@@ -99,7 +99,6 @@ pi_param_info_t ircomm_param_info = { pi_major_call_table, 3, 0x0f, 4 }; | |||
99 | */ | 99 | */ |
100 | int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush) | 100 | int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush) |
101 | { | 101 | { |
102 | struct tty_struct *tty; | ||
103 | unsigned long flags; | 102 | unsigned long flags; |
104 | struct sk_buff *skb; | 103 | struct sk_buff *skb; |
105 | int count; | 104 | int count; |
@@ -109,10 +108,6 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush) | |||
109 | IRDA_ASSERT(self != NULL, return -1;); | 108 | IRDA_ASSERT(self != NULL, return -1;); |
110 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); | 109 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); |
111 | 110 | ||
112 | tty = self->tty; | ||
113 | if (!tty) | ||
114 | return 0; | ||
115 | |||
116 | /* Make sure we don't send parameters for raw mode */ | 111 | /* Make sure we don't send parameters for raw mode */ |
117 | if (self->service_type == IRCOMM_3_WIRE_RAW) | 112 | if (self->service_type == IRCOMM_3_WIRE_RAW) |
118 | return 0; | 113 | return 0; |
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index 6b9d5a0e42f..95a3a7a336b 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c | |||
@@ -52,6 +52,8 @@ | |||
52 | #include <net/irda/ircomm_tty_attach.h> | 52 | #include <net/irda/ircomm_tty_attach.h> |
53 | #include <net/irda/ircomm_tty.h> | 53 | #include <net/irda/ircomm_tty.h> |
54 | 54 | ||
55 | static int ircomm_tty_install(struct tty_driver *driver, | ||
56 | struct tty_struct *tty); | ||
55 | static int ircomm_tty_open(struct tty_struct *tty, struct file *filp); | 57 | static int ircomm_tty_open(struct tty_struct *tty, struct file *filp); |
56 | static void ircomm_tty_close(struct tty_struct * tty, struct file *filp); | 58 | static void ircomm_tty_close(struct tty_struct * tty, struct file *filp); |
57 | static int ircomm_tty_write(struct tty_struct * tty, | 59 | static int ircomm_tty_write(struct tty_struct * tty, |
@@ -82,6 +84,7 @@ static struct tty_driver *driver; | |||
82 | static hashbin_t *ircomm_tty = NULL; | 84 | static hashbin_t *ircomm_tty = NULL; |
83 | 85 | ||
84 | static const struct tty_operations ops = { | 86 | static const struct tty_operations ops = { |
87 | .install = ircomm_tty_install, | ||
85 | .open = ircomm_tty_open, | 88 | .open = ircomm_tty_open, |
86 | .close = ircomm_tty_close, | 89 | .close = ircomm_tty_close, |
87 | .write = ircomm_tty_write, | 90 | .write = ircomm_tty_write, |
@@ -104,6 +107,35 @@ static const struct tty_operations ops = { | |||
104 | #endif /* CONFIG_PROC_FS */ | 107 | #endif /* CONFIG_PROC_FS */ |
105 | }; | 108 | }; |
106 | 109 | ||
110 | static void ircomm_port_raise_dtr_rts(struct tty_port *port, int raise) | ||
111 | { | ||
112 | struct ircomm_tty_cb *self = container_of(port, struct ircomm_tty_cb, | ||
113 | port); | ||
114 | /* | ||
115 | * Here, we use to lock those two guys, but as ircomm_param_request() | ||
116 | * does it itself, I don't see the point (and I see the deadlock). | ||
117 | * Jean II | ||
118 | */ | ||
119 | if (raise) | ||
120 | self->settings.dte |= IRCOMM_RTS | IRCOMM_DTR; | ||
121 | else | ||
122 | self->settings.dte &= ~(IRCOMM_RTS | IRCOMM_DTR); | ||
123 | |||
124 | ircomm_param_request(self, IRCOMM_DTE, TRUE); | ||
125 | } | ||
126 | |||
127 | static int ircomm_port_carrier_raised(struct tty_port *port) | ||
128 | { | ||
129 | struct ircomm_tty_cb *self = container_of(port, struct ircomm_tty_cb, | ||
130 | port); | ||
131 | return self->settings.dce & IRCOMM_CD; | ||
132 | } | ||
133 | |||
134 | static const struct tty_port_operations ircomm_port_ops = { | ||
135 | .dtr_rts = ircomm_port_raise_dtr_rts, | ||
136 | .carrier_raised = ircomm_port_carrier_raised, | ||
137 | }; | ||
138 | |||
107 | /* | 139 | /* |
108 | * Function ircomm_tty_init() | 140 | * Function ircomm_tty_init() |
109 | * | 141 | * |
@@ -194,7 +226,7 @@ static int ircomm_tty_startup(struct ircomm_tty_cb *self) | |||
194 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); | 226 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); |
195 | 227 | ||
196 | /* Check if already open */ | 228 | /* Check if already open */ |
197 | if (test_and_set_bit(ASYNC_B_INITIALIZED, &self->flags)) { | 229 | if (test_and_set_bit(ASYNCB_INITIALIZED, &self->port.flags)) { |
198 | IRDA_DEBUG(2, "%s(), already open so break out!\n", __func__ ); | 230 | IRDA_DEBUG(2, "%s(), already open so break out!\n", __func__ ); |
199 | return 0; | 231 | return 0; |
200 | } | 232 | } |
@@ -231,7 +263,7 @@ static int ircomm_tty_startup(struct ircomm_tty_cb *self) | |||
231 | 263 | ||
232 | return 0; | 264 | return 0; |
233 | err: | 265 | err: |
234 | clear_bit(ASYNC_B_INITIALIZED, &self->flags); | 266 | clear_bit(ASYNCB_INITIALIZED, &self->port.flags); |
235 | return ret; | 267 | return ret; |
236 | } | 268 | } |
237 | 269 | ||
@@ -242,72 +274,62 @@ err: | |||
242 | * | 274 | * |
243 | */ | 275 | */ |
244 | static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | 276 | static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, |
245 | struct file *filp) | 277 | struct tty_struct *tty, struct file *filp) |
246 | { | 278 | { |
279 | struct tty_port *port = &self->port; | ||
247 | DECLARE_WAITQUEUE(wait, current); | 280 | DECLARE_WAITQUEUE(wait, current); |
248 | int retval; | 281 | int retval; |
249 | int do_clocal = 0, extra_count = 0; | 282 | int do_clocal = 0, extra_count = 0; |
250 | unsigned long flags; | 283 | unsigned long flags; |
251 | struct tty_struct *tty; | ||
252 | 284 | ||
253 | IRDA_DEBUG(2, "%s()\n", __func__ ); | 285 | IRDA_DEBUG(2, "%s()\n", __func__ ); |
254 | 286 | ||
255 | tty = self->tty; | ||
256 | |||
257 | /* | 287 | /* |
258 | * If non-blocking mode is set, or the port is not enabled, | 288 | * If non-blocking mode is set, or the port is not enabled, |
259 | * then make the check up front and then exit. | 289 | * then make the check up front and then exit. |
260 | */ | 290 | */ |
261 | if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ | 291 | if (filp->f_flags & O_NONBLOCK || tty->flags & (1 << TTY_IO_ERROR)){ |
262 | /* nonblock mode is set or port is not enabled */ | 292 | /* nonblock mode is set or port is not enabled */ |
263 | self->flags |= ASYNC_NORMAL_ACTIVE; | 293 | port->flags |= ASYNC_NORMAL_ACTIVE; |
264 | IRDA_DEBUG(1, "%s(), O_NONBLOCK requested!\n", __func__ ); | 294 | IRDA_DEBUG(1, "%s(), O_NONBLOCK requested!\n", __func__ ); |
265 | return 0; | 295 | return 0; |
266 | } | 296 | } |
267 | 297 | ||
268 | if (tty->termios->c_cflag & CLOCAL) { | 298 | if (tty->termios.c_cflag & CLOCAL) { |
269 | IRDA_DEBUG(1, "%s(), doing CLOCAL!\n", __func__ ); | 299 | IRDA_DEBUG(1, "%s(), doing CLOCAL!\n", __func__ ); |
270 | do_clocal = 1; | 300 | do_clocal = 1; |
271 | } | 301 | } |
272 | 302 | ||
273 | /* Wait for carrier detect and the line to become | 303 | /* Wait for carrier detect and the line to become |
274 | * free (i.e., not in use by the callout). While we are in | 304 | * free (i.e., not in use by the callout). While we are in |
275 | * this loop, self->open_count is dropped by one, so that | 305 | * this loop, port->count is dropped by one, so that |
276 | * mgsl_close() knows when to free things. We restore it upon | 306 | * mgsl_close() knows when to free things. We restore it upon |
277 | * exit, either normal or abnormal. | 307 | * exit, either normal or abnormal. |
278 | */ | 308 | */ |
279 | 309 | ||
280 | retval = 0; | 310 | retval = 0; |
281 | add_wait_queue(&self->open_wait, &wait); | 311 | add_wait_queue(&port->open_wait, &wait); |
282 | 312 | ||
283 | IRDA_DEBUG(2, "%s(%d):block_til_ready before block on %s open_count=%d\n", | 313 | IRDA_DEBUG(2, "%s(%d):block_til_ready before block on %s open_count=%d\n", |
284 | __FILE__,__LINE__, tty->driver->name, self->open_count ); | 314 | __FILE__, __LINE__, tty->driver->name, port->count); |
285 | 315 | ||
286 | /* As far as I can see, we protect open_count - Jean II */ | 316 | spin_lock_irqsave(&port->lock, flags); |
287 | spin_lock_irqsave(&self->spinlock, flags); | ||
288 | if (!tty_hung_up_p(filp)) { | 317 | if (!tty_hung_up_p(filp)) { |
289 | extra_count = 1; | 318 | extra_count = 1; |
290 | self->open_count--; | 319 | port->count--; |
291 | } | 320 | } |
292 | spin_unlock_irqrestore(&self->spinlock, flags); | 321 | spin_unlock_irqrestore(&port->lock, flags); |
293 | self->blocked_open++; | 322 | port->blocked_open++; |
294 | 323 | ||
295 | while (1) { | 324 | while (1) { |
296 | if (tty->termios->c_cflag & CBAUD) { | 325 | if (tty->termios.c_cflag & CBAUD) |
297 | /* Here, we use to lock those two guys, but | 326 | tty_port_raise_dtr_rts(port); |
298 | * as ircomm_param_request() does it itself, | ||
299 | * I don't see the point (and I see the deadlock). | ||
300 | * Jean II */ | ||
301 | self->settings.dte |= IRCOMM_RTS + IRCOMM_DTR; | ||
302 | |||
303 | ircomm_param_request(self, IRCOMM_DTE, TRUE); | ||
304 | } | ||
305 | 327 | ||
306 | current->state = TASK_INTERRUPTIBLE; | 328 | current->state = TASK_INTERRUPTIBLE; |
307 | 329 | ||
308 | if (tty_hung_up_p(filp) || | 330 | if (tty_hung_up_p(filp) || |
309 | !test_bit(ASYNC_B_INITIALIZED, &self->flags)) { | 331 | !test_bit(ASYNCB_INITIALIZED, &port->flags)) { |
310 | retval = (self->flags & ASYNC_HUP_NOTIFY) ? | 332 | retval = (port->flags & ASYNC_HUP_NOTIFY) ? |
311 | -EAGAIN : -ERESTARTSYS; | 333 | -EAGAIN : -ERESTARTSYS; |
312 | break; | 334 | break; |
313 | } | 335 | } |
@@ -317,8 +339,8 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | |||
317 | * specified, we cannot return before the IrCOMM link is | 339 | * specified, we cannot return before the IrCOMM link is |
318 | * ready | 340 | * ready |
319 | */ | 341 | */ |
320 | if (!test_bit(ASYNC_B_CLOSING, &self->flags) && | 342 | if (!test_bit(ASYNCB_CLOSING, &port->flags) && |
321 | (do_clocal || (self->settings.dce & IRCOMM_CD)) && | 343 | (do_clocal || tty_port_carrier_raised(port)) && |
322 | self->state == IRCOMM_TTY_READY) | 344 | self->state == IRCOMM_TTY_READY) |
323 | { | 345 | { |
324 | break; | 346 | break; |
@@ -330,46 +352,36 @@ static int ircomm_tty_block_til_ready(struct ircomm_tty_cb *self, | |||
330 | } | 352 | } |
331 | 353 | ||
332 | IRDA_DEBUG(1, "%s(%d):block_til_ready blocking on %s open_count=%d\n", | 354 | IRDA_DEBUG(1, "%s(%d):block_til_ready blocking on %s open_count=%d\n", |
333 | __FILE__,__LINE__, tty->driver->name, self->open_count ); | 355 | __FILE__, __LINE__, tty->driver->name, port->count); |
334 | 356 | ||
335 | schedule(); | 357 | schedule(); |
336 | } | 358 | } |
337 | 359 | ||
338 | __set_current_state(TASK_RUNNING); | 360 | __set_current_state(TASK_RUNNING); |
339 | remove_wait_queue(&self->open_wait, &wait); | 361 | remove_wait_queue(&port->open_wait, &wait); |
340 | 362 | ||
341 | if (extra_count) { | 363 | if (extra_count) { |
342 | /* ++ is not atomic, so this should be protected - Jean II */ | 364 | /* ++ is not atomic, so this should be protected - Jean II */ |
343 | spin_lock_irqsave(&self->spinlock, flags); | 365 | spin_lock_irqsave(&port->lock, flags); |
344 | self->open_count++; | 366 | port->count++; |
345 | spin_unlock_irqrestore(&self->spinlock, flags); | 367 | spin_unlock_irqrestore(&port->lock, flags); |
346 | } | 368 | } |
347 | self->blocked_open--; | 369 | port->blocked_open--; |
348 | 370 | ||
349 | IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n", | 371 | IRDA_DEBUG(1, "%s(%d):block_til_ready after blocking on %s open_count=%d\n", |
350 | __FILE__,__LINE__, tty->driver->name, self->open_count); | 372 | __FILE__, __LINE__, tty->driver->name, port->count); |
351 | 373 | ||
352 | if (!retval) | 374 | if (!retval) |
353 | self->flags |= ASYNC_NORMAL_ACTIVE; | 375 | port->flags |= ASYNC_NORMAL_ACTIVE; |
354 | 376 | ||
355 | return retval; | 377 | return retval; |
356 | } | 378 | } |
357 | 379 | ||
358 | /* | 380 | |
359 | * Function ircomm_tty_open (tty, filp) | 381 | static int ircomm_tty_install(struct tty_driver *driver, struct tty_struct *tty) |
360 | * | ||
361 | * This routine is called when a particular tty device is opened. This | ||
362 | * routine is mandatory; if this routine is not filled in, the attempted | ||
363 | * open will fail with ENODEV. | ||
364 | */ | ||
365 | static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) | ||
366 | { | 382 | { |
367 | struct ircomm_tty_cb *self; | 383 | struct ircomm_tty_cb *self; |
368 | unsigned int line = tty->index; | 384 | unsigned int line = tty->index; |
369 | unsigned long flags; | ||
370 | int ret; | ||
371 | |||
372 | IRDA_DEBUG(2, "%s()\n", __func__ ); | ||
373 | 385 | ||
374 | /* Check if instance already exists */ | 386 | /* Check if instance already exists */ |
375 | self = hashbin_lock_find(ircomm_tty, line, NULL); | 387 | self = hashbin_lock_find(ircomm_tty, line, NULL); |
@@ -381,6 +393,8 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) | |||
381 | return -ENOMEM; | 393 | return -ENOMEM; |
382 | } | 394 | } |
383 | 395 | ||
396 | tty_port_init(&self->port); | ||
397 | self->port.ops = &ircomm_port_ops; | ||
384 | self->magic = IRCOMM_TTY_MAGIC; | 398 | self->magic = IRCOMM_TTY_MAGIC; |
385 | self->flow = FLOW_STOP; | 399 | self->flow = FLOW_STOP; |
386 | 400 | ||
@@ -388,13 +402,9 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) | |||
388 | INIT_WORK(&self->tqueue, ircomm_tty_do_softint); | 402 | INIT_WORK(&self->tqueue, ircomm_tty_do_softint); |
389 | self->max_header_size = IRCOMM_TTY_HDR_UNINITIALISED; | 403 | self->max_header_size = IRCOMM_TTY_HDR_UNINITIALISED; |
390 | self->max_data_size = IRCOMM_TTY_DATA_UNINITIALISED; | 404 | self->max_data_size = IRCOMM_TTY_DATA_UNINITIALISED; |
391 | self->close_delay = 5*HZ/10; | ||
392 | self->closing_wait = 30*HZ; | ||
393 | 405 | ||
394 | /* Init some important stuff */ | 406 | /* Init some important stuff */ |
395 | init_timer(&self->watchdog_timer); | 407 | init_timer(&self->watchdog_timer); |
396 | init_waitqueue_head(&self->open_wait); | ||
397 | init_waitqueue_head(&self->close_wait); | ||
398 | spin_lock_init(&self->spinlock); | 408 | spin_lock_init(&self->spinlock); |
399 | 409 | ||
400 | /* | 410 | /* |
@@ -404,31 +414,48 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) | |||
404 | * | 414 | * |
405 | * Note this is completely usafe and doesn't work properly | 415 | * Note this is completely usafe and doesn't work properly |
406 | */ | 416 | */ |
407 | tty->termios->c_iflag = 0; | 417 | tty->termios.c_iflag = 0; |
408 | tty->termios->c_oflag = 0; | 418 | tty->termios.c_oflag = 0; |
409 | 419 | ||
410 | /* Insert into hash */ | 420 | /* Insert into hash */ |
411 | hashbin_insert(ircomm_tty, (irda_queue_t *) self, line, NULL); | 421 | hashbin_insert(ircomm_tty, (irda_queue_t *) self, line, NULL); |
412 | } | 422 | } |
413 | /* ++ is not atomic, so this should be protected - Jean II */ | ||
414 | spin_lock_irqsave(&self->spinlock, flags); | ||
415 | self->open_count++; | ||
416 | 423 | ||
417 | tty->driver_data = self; | 424 | return tty_port_install(&self->port, driver, tty); |
418 | self->tty = tty; | 425 | } |
419 | spin_unlock_irqrestore(&self->spinlock, flags); | 426 | |
427 | /* | ||
428 | * Function ircomm_tty_open (tty, filp) | ||
429 | * | ||
430 | * This routine is called when a particular tty device is opened. This | ||
431 | * routine is mandatory; if this routine is not filled in, the attempted | ||
432 | * open will fail with ENODEV. | ||
433 | */ | ||
434 | static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) | ||
435 | { | ||
436 | struct ircomm_tty_cb *self = tty->driver_data; | ||
437 | unsigned long flags; | ||
438 | int ret; | ||
439 | |||
440 | IRDA_DEBUG(2, "%s()\n", __func__ ); | ||
441 | |||
442 | /* ++ is not atomic, so this should be protected - Jean II */ | ||
443 | spin_lock_irqsave(&self->port.lock, flags); | ||
444 | self->port.count++; | ||
445 | spin_unlock_irqrestore(&self->port.lock, flags); | ||
446 | tty_port_tty_set(&self->port, tty); | ||
420 | 447 | ||
421 | IRDA_DEBUG(1, "%s(), %s%d, count = %d\n", __func__ , tty->driver->name, | 448 | IRDA_DEBUG(1, "%s(), %s%d, count = %d\n", __func__ , tty->driver->name, |
422 | self->line, self->open_count); | 449 | self->line, self->port.count); |
423 | 450 | ||
424 | /* Not really used by us, but lets do it anyway */ | 451 | /* Not really used by us, but lets do it anyway */ |
425 | self->tty->low_latency = (self->flags & ASYNC_LOW_LATENCY) ? 1 : 0; | 452 | tty->low_latency = (self->port.flags & ASYNC_LOW_LATENCY) ? 1 : 0; |
426 | 453 | ||
427 | /* | 454 | /* |
428 | * If the port is the middle of closing, bail out now | 455 | * If the port is the middle of closing, bail out now |
429 | */ | 456 | */ |
430 | if (tty_hung_up_p(filp) || | 457 | if (tty_hung_up_p(filp) || |
431 | test_bit(ASYNC_B_CLOSING, &self->flags)) { | 458 | test_bit(ASYNCB_CLOSING, &self->port.flags)) { |
432 | 459 | ||
433 | /* Hm, why are we blocking on ASYNC_CLOSING if we | 460 | /* Hm, why are we blocking on ASYNC_CLOSING if we |
434 | * do return -EAGAIN/-ERESTARTSYS below anyway? | 461 | * do return -EAGAIN/-ERESTARTSYS below anyway? |
@@ -438,14 +465,15 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) | |||
438 | * probably better sleep uninterruptible? | 465 | * probably better sleep uninterruptible? |
439 | */ | 466 | */ |
440 | 467 | ||
441 | if (wait_event_interruptible(self->close_wait, !test_bit(ASYNC_B_CLOSING, &self->flags))) { | 468 | if (wait_event_interruptible(self->port.close_wait, |
469 | !test_bit(ASYNCB_CLOSING, &self->port.flags))) { | ||
442 | IRDA_WARNING("%s - got signal while blocking on ASYNC_CLOSING!\n", | 470 | IRDA_WARNING("%s - got signal while blocking on ASYNC_CLOSING!\n", |
443 | __func__); | 471 | __func__); |
444 | return -ERESTARTSYS; | 472 | return -ERESTARTSYS; |
445 | } | 473 | } |
446 | 474 | ||
447 | #ifdef SERIAL_DO_RESTART | 475 | #ifdef SERIAL_DO_RESTART |
448 | return (self->flags & ASYNC_HUP_NOTIFY) ? | 476 | return (self->port.flags & ASYNC_HUP_NOTIFY) ? |
449 | -EAGAIN : -ERESTARTSYS; | 477 | -EAGAIN : -ERESTARTSYS; |
450 | #else | 478 | #else |
451 | return -EAGAIN; | 479 | return -EAGAIN; |
@@ -453,7 +481,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) | |||
453 | } | 481 | } |
454 | 482 | ||
455 | /* Check if this is a "normal" ircomm device, or an irlpt device */ | 483 | /* Check if this is a "normal" ircomm device, or an irlpt device */ |
456 | if (line < 0x10) { | 484 | if (self->line < 0x10) { |
457 | self->service_type = IRCOMM_3_WIRE | IRCOMM_9_WIRE; | 485 | self->service_type = IRCOMM_3_WIRE | IRCOMM_9_WIRE; |
458 | self->settings.service_type = IRCOMM_9_WIRE; /* 9 wire as default */ | 486 | self->settings.service_type = IRCOMM_9_WIRE; /* 9 wire as default */ |
459 | /* Jan Kiszka -> add DSR/RI -> Conform to IrCOMM spec */ | 487 | /* Jan Kiszka -> add DSR/RI -> Conform to IrCOMM spec */ |
@@ -469,7 +497,7 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) | |||
469 | if (ret) | 497 | if (ret) |
470 | return ret; | 498 | return ret; |
471 | 499 | ||
472 | ret = ircomm_tty_block_til_ready(self, filp); | 500 | ret = ircomm_tty_block_til_ready(self, tty, filp); |
473 | if (ret) { | 501 | if (ret) { |
474 | IRDA_DEBUG(2, | 502 | IRDA_DEBUG(2, |
475 | "%s(), returning after block_til_ready with %d\n", __func__ , | 503 | "%s(), returning after block_til_ready with %d\n", __func__ , |
@@ -489,81 +517,22 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) | |||
489 | static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) | 517 | static void ircomm_tty_close(struct tty_struct *tty, struct file *filp) |
490 | { | 518 | { |
491 | struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; | 519 | struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; |
492 | unsigned long flags; | 520 | struct tty_port *port = &self->port; |
493 | 521 | ||
494 | IRDA_DEBUG(0, "%s()\n", __func__ ); | 522 | IRDA_DEBUG(0, "%s()\n", __func__ ); |
495 | 523 | ||
496 | IRDA_ASSERT(self != NULL, return;); | 524 | IRDA_ASSERT(self != NULL, return;); |
497 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); | 525 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); |
498 | 526 | ||
499 | spin_lock_irqsave(&self->spinlock, flags); | 527 | if (tty_port_close_start(port, tty, filp) == 0) |
500 | |||
501 | if (tty_hung_up_p(filp)) { | ||
502 | spin_unlock_irqrestore(&self->spinlock, flags); | ||
503 | |||
504 | IRDA_DEBUG(0, "%s(), returning 1\n", __func__ ); | ||
505 | return; | ||
506 | } | ||
507 | |||
508 | if ((tty->count == 1) && (self->open_count != 1)) { | ||
509 | /* | ||
510 | * Uh, oh. tty->count is 1, which means that the tty | ||
511 | * structure will be freed. state->count should always | ||
512 | * be one in these conditions. If it's greater than | ||
513 | * one, we've got real problems, since it means the | ||
514 | * serial port won't be shutdown. | ||
515 | */ | ||
516 | IRDA_DEBUG(0, "%s(), bad serial port count; " | ||
517 | "tty->count is 1, state->count is %d\n", __func__ , | ||
518 | self->open_count); | ||
519 | self->open_count = 1; | ||
520 | } | ||
521 | |||
522 | if (--self->open_count < 0) { | ||
523 | IRDA_ERROR("%s(), bad serial port count for ttys%d: %d\n", | ||
524 | __func__, self->line, self->open_count); | ||
525 | self->open_count = 0; | ||
526 | } | ||
527 | if (self->open_count) { | ||
528 | spin_unlock_irqrestore(&self->spinlock, flags); | ||
529 | |||
530 | IRDA_DEBUG(0, "%s(), open count > 0\n", __func__ ); | ||
531 | return; | 528 | return; |
532 | } | ||
533 | |||
534 | /* Hum... Should be test_and_set_bit ??? - Jean II */ | ||
535 | set_bit(ASYNC_B_CLOSING, &self->flags); | ||
536 | |||
537 | /* We need to unlock here (we were unlocking at the end of this | ||
538 | * function), because tty_wait_until_sent() may schedule. | ||
539 | * I don't know if the rest should be protected somehow, | ||
540 | * so someone should check. - Jean II */ | ||
541 | spin_unlock_irqrestore(&self->spinlock, flags); | ||
542 | |||
543 | /* | ||
544 | * Now we wait for the transmit buffer to clear; and we notify | ||
545 | * the line discipline to only process XON/XOFF characters. | ||
546 | */ | ||
547 | tty->closing = 1; | ||
548 | if (self->closing_wait != ASYNC_CLOSING_WAIT_NONE) | ||
549 | tty_wait_until_sent_from_close(tty, self->closing_wait); | ||
550 | 529 | ||
551 | ircomm_tty_shutdown(self); | 530 | ircomm_tty_shutdown(self); |
552 | 531 | ||
553 | tty_driver_flush_buffer(tty); | 532 | tty_driver_flush_buffer(tty); |
554 | tty_ldisc_flush(tty); | ||
555 | |||
556 | tty->closing = 0; | ||
557 | self->tty = NULL; | ||
558 | 533 | ||
559 | if (self->blocked_open) { | 534 | tty_port_close_end(port, tty); |
560 | if (self->close_delay) | 535 | tty_port_tty_set(port, NULL); |
561 | schedule_timeout_interruptible(self->close_delay); | ||
562 | wake_up_interruptible(&self->open_wait); | ||
563 | } | ||
564 | |||
565 | self->flags &= ~(ASYNC_NORMAL_ACTIVE|ASYNC_CLOSING); | ||
566 | wake_up_interruptible(&self->close_wait); | ||
567 | } | 536 | } |
568 | 537 | ||
569 | /* | 538 | /* |
@@ -606,7 +575,7 @@ static void ircomm_tty_do_softint(struct work_struct *work) | |||
606 | if (!self || self->magic != IRCOMM_TTY_MAGIC) | 575 | if (!self || self->magic != IRCOMM_TTY_MAGIC) |
607 | return; | 576 | return; |
608 | 577 | ||
609 | tty = self->tty; | 578 | tty = tty_port_tty_get(&self->port); |
610 | if (!tty) | 579 | if (!tty) |
611 | return; | 580 | return; |
612 | 581 | ||
@@ -627,7 +596,7 @@ static void ircomm_tty_do_softint(struct work_struct *work) | |||
627 | } | 596 | } |
628 | 597 | ||
629 | if (tty->hw_stopped) | 598 | if (tty->hw_stopped) |
630 | return; | 599 | goto put; |
631 | 600 | ||
632 | /* Unlink transmit buffer */ | 601 | /* Unlink transmit buffer */ |
633 | spin_lock_irqsave(&self->spinlock, flags); | 602 | spin_lock_irqsave(&self->spinlock, flags); |
@@ -646,6 +615,8 @@ static void ircomm_tty_do_softint(struct work_struct *work) | |||
646 | 615 | ||
647 | /* Check if user (still) wants to be waken up */ | 616 | /* Check if user (still) wants to be waken up */ |
648 | tty_wakeup(tty); | 617 | tty_wakeup(tty); |
618 | put: | ||
619 | tty_kref_put(tty); | ||
649 | } | 620 | } |
650 | 621 | ||
651 | /* | 622 | /* |
@@ -880,7 +851,7 @@ static void ircomm_tty_throttle(struct tty_struct *tty) | |||
880 | ircomm_tty_send_xchar(tty, STOP_CHAR(tty)); | 851 | ircomm_tty_send_xchar(tty, STOP_CHAR(tty)); |
881 | 852 | ||
882 | /* Hardware flow control? */ | 853 | /* Hardware flow control? */ |
883 | if (tty->termios->c_cflag & CRTSCTS) { | 854 | if (tty->termios.c_cflag & CRTSCTS) { |
884 | self->settings.dte &= ~IRCOMM_RTS; | 855 | self->settings.dte &= ~IRCOMM_RTS; |
885 | self->settings.dte |= IRCOMM_DELTA_RTS; | 856 | self->settings.dte |= IRCOMM_DELTA_RTS; |
886 | 857 | ||
@@ -912,7 +883,7 @@ static void ircomm_tty_unthrottle(struct tty_struct *tty) | |||
912 | } | 883 | } |
913 | 884 | ||
914 | /* Using hardware flow control? */ | 885 | /* Using hardware flow control? */ |
915 | if (tty->termios->c_cflag & CRTSCTS) { | 886 | if (tty->termios.c_cflag & CRTSCTS) { |
916 | self->settings.dte |= (IRCOMM_RTS|IRCOMM_DELTA_RTS); | 887 | self->settings.dte |= (IRCOMM_RTS|IRCOMM_DELTA_RTS); |
917 | 888 | ||
918 | ircomm_param_request(self, IRCOMM_DTE, TRUE); | 889 | ircomm_param_request(self, IRCOMM_DTE, TRUE); |
@@ -955,7 +926,7 @@ static void ircomm_tty_shutdown(struct ircomm_tty_cb *self) | |||
955 | 926 | ||
956 | IRDA_DEBUG(0, "%s()\n", __func__ ); | 927 | IRDA_DEBUG(0, "%s()\n", __func__ ); |
957 | 928 | ||
958 | if (!test_and_clear_bit(ASYNC_B_INITIALIZED, &self->flags)) | 929 | if (!test_and_clear_bit(ASYNCB_INITIALIZED, &self->port.flags)) |
959 | return; | 930 | return; |
960 | 931 | ||
961 | ircomm_tty_detach_cable(self); | 932 | ircomm_tty_detach_cable(self); |
@@ -994,6 +965,7 @@ static void ircomm_tty_shutdown(struct ircomm_tty_cb *self) | |||
994 | static void ircomm_tty_hangup(struct tty_struct *tty) | 965 | static void ircomm_tty_hangup(struct tty_struct *tty) |
995 | { | 966 | { |
996 | struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; | 967 | struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; |
968 | struct tty_port *port = &self->port; | ||
997 | unsigned long flags; | 969 | unsigned long flags; |
998 | 970 | ||
999 | IRDA_DEBUG(0, "%s()\n", __func__ ); | 971 | IRDA_DEBUG(0, "%s()\n", __func__ ); |
@@ -1004,14 +976,17 @@ static void ircomm_tty_hangup(struct tty_struct *tty) | |||
1004 | /* ircomm_tty_flush_buffer(tty); */ | 976 | /* ircomm_tty_flush_buffer(tty); */ |
1005 | ircomm_tty_shutdown(self); | 977 | ircomm_tty_shutdown(self); |
1006 | 978 | ||
1007 | /* I guess we need to lock here - Jean II */ | 979 | spin_lock_irqsave(&port->lock, flags); |
1008 | spin_lock_irqsave(&self->spinlock, flags); | 980 | port->flags &= ~ASYNC_NORMAL_ACTIVE; |
1009 | self->flags &= ~ASYNC_NORMAL_ACTIVE; | 981 | if (port->tty) { |
1010 | self->tty = NULL; | 982 | set_bit(TTY_IO_ERROR, &port->tty->flags); |
1011 | self->open_count = 0; | 983 | tty_kref_put(port->tty); |
1012 | spin_unlock_irqrestore(&self->spinlock, flags); | 984 | } |
985 | port->tty = NULL; | ||
986 | port->count = 0; | ||
987 | spin_unlock_irqrestore(&port->lock, flags); | ||
1013 | 988 | ||
1014 | wake_up_interruptible(&self->open_wait); | 989 | wake_up_interruptible(&port->open_wait); |
1015 | } | 990 | } |
1016 | 991 | ||
1017 | /* | 992 | /* |
@@ -1071,20 +1046,20 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self) | |||
1071 | IRDA_ASSERT(self != NULL, return;); | 1046 | IRDA_ASSERT(self != NULL, return;); |
1072 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); | 1047 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); |
1073 | 1048 | ||
1074 | tty = self->tty; | 1049 | tty = tty_port_tty_get(&self->port); |
1075 | 1050 | ||
1076 | status = self->settings.dce; | 1051 | status = self->settings.dce; |
1077 | 1052 | ||
1078 | if (status & IRCOMM_DCE_DELTA_ANY) { | 1053 | if (status & IRCOMM_DCE_DELTA_ANY) { |
1079 | /*wake_up_interruptible(&self->delta_msr_wait);*/ | 1054 | /*wake_up_interruptible(&self->delta_msr_wait);*/ |
1080 | } | 1055 | } |
1081 | if ((self->flags & ASYNC_CHECK_CD) && (status & IRCOMM_DELTA_CD)) { | 1056 | if ((self->port.flags & ASYNC_CHECK_CD) && (status & IRCOMM_DELTA_CD)) { |
1082 | IRDA_DEBUG(2, | 1057 | IRDA_DEBUG(2, |
1083 | "%s(), ircomm%d CD now %s...\n", __func__ , self->line, | 1058 | "%s(), ircomm%d CD now %s...\n", __func__ , self->line, |
1084 | (status & IRCOMM_CD) ? "on" : "off"); | 1059 | (status & IRCOMM_CD) ? "on" : "off"); |
1085 | 1060 | ||
1086 | if (status & IRCOMM_CD) { | 1061 | if (status & IRCOMM_CD) { |
1087 | wake_up_interruptible(&self->open_wait); | 1062 | wake_up_interruptible(&self->port.open_wait); |
1088 | } else { | 1063 | } else { |
1089 | IRDA_DEBUG(2, | 1064 | IRDA_DEBUG(2, |
1090 | "%s(), Doing serial hangup..\n", __func__ ); | 1065 | "%s(), Doing serial hangup..\n", __func__ ); |
@@ -1092,10 +1067,10 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self) | |||
1092 | tty_hangup(tty); | 1067 | tty_hangup(tty); |
1093 | 1068 | ||
1094 | /* Hangup will remote the tty, so better break out */ | 1069 | /* Hangup will remote the tty, so better break out */ |
1095 | return; | 1070 | goto put; |
1096 | } | 1071 | } |
1097 | } | 1072 | } |
1098 | if (self->flags & ASYNC_CTS_FLOW) { | 1073 | if (tty && tty_port_cts_enabled(&self->port)) { |
1099 | if (tty->hw_stopped) { | 1074 | if (tty->hw_stopped) { |
1100 | if (status & IRCOMM_CTS) { | 1075 | if (status & IRCOMM_CTS) { |
1101 | IRDA_DEBUG(2, | 1076 | IRDA_DEBUG(2, |
@@ -1103,10 +1078,10 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self) | |||
1103 | tty->hw_stopped = 0; | 1078 | tty->hw_stopped = 0; |
1104 | 1079 | ||
1105 | /* Wake up processes blocked on open */ | 1080 | /* Wake up processes blocked on open */ |
1106 | wake_up_interruptible(&self->open_wait); | 1081 | wake_up_interruptible(&self->port.open_wait); |
1107 | 1082 | ||
1108 | schedule_work(&self->tqueue); | 1083 | schedule_work(&self->tqueue); |
1109 | return; | 1084 | goto put; |
1110 | } | 1085 | } |
1111 | } else { | 1086 | } else { |
1112 | if (!(status & IRCOMM_CTS)) { | 1087 | if (!(status & IRCOMM_CTS)) { |
@@ -1116,6 +1091,8 @@ void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self) | |||
1116 | } | 1091 | } |
1117 | } | 1092 | } |
1118 | } | 1093 | } |
1094 | put: | ||
1095 | tty_kref_put(tty); | ||
1119 | } | 1096 | } |
1120 | 1097 | ||
1121 | /* | 1098 | /* |
@@ -1128,6 +1105,7 @@ static int ircomm_tty_data_indication(void *instance, void *sap, | |||
1128 | struct sk_buff *skb) | 1105 | struct sk_buff *skb) |
1129 | { | 1106 | { |
1130 | struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; | 1107 | struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; |
1108 | struct tty_struct *tty; | ||
1131 | 1109 | ||
1132 | IRDA_DEBUG(2, "%s()\n", __func__ ); | 1110 | IRDA_DEBUG(2, "%s()\n", __func__ ); |
1133 | 1111 | ||
@@ -1135,7 +1113,8 @@ static int ircomm_tty_data_indication(void *instance, void *sap, | |||
1135 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); | 1113 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return -1;); |
1136 | IRDA_ASSERT(skb != NULL, return -1;); | 1114 | IRDA_ASSERT(skb != NULL, return -1;); |
1137 | 1115 | ||
1138 | if (!self->tty) { | 1116 | tty = tty_port_tty_get(&self->port); |
1117 | if (!tty) { | ||
1139 | IRDA_DEBUG(0, "%s(), no tty!\n", __func__ ); | 1118 | IRDA_DEBUG(0, "%s(), no tty!\n", __func__ ); |
1140 | return 0; | 1119 | return 0; |
1141 | } | 1120 | } |
@@ -1146,7 +1125,7 @@ static int ircomm_tty_data_indication(void *instance, void *sap, | |||
1146 | * Devices like WinCE can do this, and since they don't send any | 1125 | * Devices like WinCE can do this, and since they don't send any |
1147 | * params, we can just as well declare the hardware for running. | 1126 | * params, we can just as well declare the hardware for running. |
1148 | */ | 1127 | */ |
1149 | if (self->tty->hw_stopped && (self->flow == FLOW_START)) { | 1128 | if (tty->hw_stopped && (self->flow == FLOW_START)) { |
1150 | IRDA_DEBUG(0, "%s(), polling for line settings!\n", __func__ ); | 1129 | IRDA_DEBUG(0, "%s(), polling for line settings!\n", __func__ ); |
1151 | ircomm_param_request(self, IRCOMM_POLL, TRUE); | 1130 | ircomm_param_request(self, IRCOMM_POLL, TRUE); |
1152 | 1131 | ||
@@ -1159,8 +1138,9 @@ static int ircomm_tty_data_indication(void *instance, void *sap, | |||
1159 | * Use flip buffer functions since the code may be called from interrupt | 1138 | * Use flip buffer functions since the code may be called from interrupt |
1160 | * context | 1139 | * context |
1161 | */ | 1140 | */ |
1162 | tty_insert_flip_string(self->tty, skb->data, skb->len); | 1141 | tty_insert_flip_string(tty, skb->data, skb->len); |
1163 | tty_flip_buffer_push(self->tty); | 1142 | tty_flip_buffer_push(tty); |
1143 | tty_kref_put(tty); | ||
1164 | 1144 | ||
1165 | /* No need to kfree_skb - see ircomm_ttp_data_indication() */ | 1145 | /* No need to kfree_skb - see ircomm_ttp_data_indication() */ |
1166 | 1146 | ||
@@ -1211,12 +1191,13 @@ static void ircomm_tty_flow_indication(void *instance, void *sap, | |||
1211 | IRDA_ASSERT(self != NULL, return;); | 1191 | IRDA_ASSERT(self != NULL, return;); |
1212 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); | 1192 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); |
1213 | 1193 | ||
1214 | tty = self->tty; | 1194 | tty = tty_port_tty_get(&self->port); |
1215 | 1195 | ||
1216 | switch (cmd) { | 1196 | switch (cmd) { |
1217 | case FLOW_START: | 1197 | case FLOW_START: |
1218 | IRDA_DEBUG(2, "%s(), hw start!\n", __func__ ); | 1198 | IRDA_DEBUG(2, "%s(), hw start!\n", __func__ ); |
1219 | tty->hw_stopped = 0; | 1199 | if (tty) |
1200 | tty->hw_stopped = 0; | ||
1220 | 1201 | ||
1221 | /* ircomm_tty_do_softint will take care of the rest */ | 1202 | /* ircomm_tty_do_softint will take care of the rest */ |
1222 | schedule_work(&self->tqueue); | 1203 | schedule_work(&self->tqueue); |
@@ -1224,15 +1205,19 @@ static void ircomm_tty_flow_indication(void *instance, void *sap, | |||
1224 | default: /* If we get here, something is very wrong, better stop */ | 1205 | default: /* If we get here, something is very wrong, better stop */ |
1225 | case FLOW_STOP: | 1206 | case FLOW_STOP: |
1226 | IRDA_DEBUG(2, "%s(), hw stopped!\n", __func__ ); | 1207 | IRDA_DEBUG(2, "%s(), hw stopped!\n", __func__ ); |
1227 | tty->hw_stopped = 1; | 1208 | if (tty) |
1209 | tty->hw_stopped = 1; | ||
1228 | break; | 1210 | break; |
1229 | } | 1211 | } |
1212 | |||
1213 | tty_kref_put(tty); | ||
1230 | self->flow = cmd; | 1214 | self->flow = cmd; |
1231 | } | 1215 | } |
1232 | 1216 | ||
1233 | #ifdef CONFIG_PROC_FS | 1217 | #ifdef CONFIG_PROC_FS |
1234 | static void ircomm_tty_line_info(struct ircomm_tty_cb *self, struct seq_file *m) | 1218 | static void ircomm_tty_line_info(struct ircomm_tty_cb *self, struct seq_file *m) |
1235 | { | 1219 | { |
1220 | struct tty_struct *tty; | ||
1236 | char sep; | 1221 | char sep; |
1237 | 1222 | ||
1238 | seq_printf(m, "State: %s\n", ircomm_tty_state[self->state]); | 1223 | seq_printf(m, "State: %s\n", ircomm_tty_state[self->state]); |
@@ -1328,40 +1313,43 @@ static void ircomm_tty_line_info(struct ircomm_tty_cb *self, struct seq_file *m) | |||
1328 | 1313 | ||
1329 | seq_puts(m, "Flags:"); | 1314 | seq_puts(m, "Flags:"); |
1330 | sep = ' '; | 1315 | sep = ' '; |
1331 | if (self->flags & ASYNC_CTS_FLOW) { | 1316 | if (tty_port_cts_enabled(&self->port)) { |
1332 | seq_printf(m, "%cASYNC_CTS_FLOW", sep); | 1317 | seq_printf(m, "%cASYNC_CTS_FLOW", sep); |
1333 | sep = '|'; | 1318 | sep = '|'; |
1334 | } | 1319 | } |
1335 | if (self->flags & ASYNC_CHECK_CD) { | 1320 | if (self->port.flags & ASYNC_CHECK_CD) { |
1336 | seq_printf(m, "%cASYNC_CHECK_CD", sep); | 1321 | seq_printf(m, "%cASYNC_CHECK_CD", sep); |
1337 | sep = '|'; | 1322 | sep = '|'; |
1338 | } | 1323 | } |
1339 | if (self->flags & ASYNC_INITIALIZED) { | 1324 | if (self->port.flags & ASYNC_INITIALIZED) { |
1340 | seq_printf(m, "%cASYNC_INITIALIZED", sep); | 1325 | seq_printf(m, "%cASYNC_INITIALIZED", sep); |
1341 | sep = '|'; | 1326 | sep = '|'; |
1342 | } | 1327 | } |
1343 | if (self->flags & ASYNC_LOW_LATENCY) { | 1328 | if (self->port.flags & ASYNC_LOW_LATENCY) { |
1344 | seq_printf(m, "%cASYNC_LOW_LATENCY", sep); | 1329 | seq_printf(m, "%cASYNC_LOW_LATENCY", sep); |
1345 | sep = '|'; | 1330 | sep = '|'; |
1346 | } | 1331 | } |
1347 | if (self->flags & ASYNC_CLOSING) { | 1332 | if (self->port.flags & ASYNC_CLOSING) { |
1348 | seq_printf(m, "%cASYNC_CLOSING", sep); | 1333 | seq_printf(m, "%cASYNC_CLOSING", sep); |
1349 | sep = '|'; | 1334 | sep = '|'; |
1350 | } | 1335 | } |
1351 | if (self->flags & ASYNC_NORMAL_ACTIVE) { | 1336 | if (self->port.flags & ASYNC_NORMAL_ACTIVE) { |
1352 | seq_printf(m, "%cASYNC_NORMAL_ACTIVE", sep); | 1337 | seq_printf(m, "%cASYNC_NORMAL_ACTIVE", sep); |
1353 | sep = '|'; | 1338 | sep = '|'; |
1354 | } | 1339 | } |
1355 | seq_putc(m, '\n'); | 1340 | seq_putc(m, '\n'); |
1356 | 1341 | ||
1357 | seq_printf(m, "Role: %s\n", self->client ? "client" : "server"); | 1342 | seq_printf(m, "Role: %s\n", self->client ? "client" : "server"); |
1358 | seq_printf(m, "Open count: %d\n", self->open_count); | 1343 | seq_printf(m, "Open count: %d\n", self->port.count); |
1359 | seq_printf(m, "Max data size: %d\n", self->max_data_size); | 1344 | seq_printf(m, "Max data size: %d\n", self->max_data_size); |
1360 | seq_printf(m, "Max header size: %d\n", self->max_header_size); | 1345 | seq_printf(m, "Max header size: %d\n", self->max_header_size); |
1361 | 1346 | ||
1362 | if (self->tty) | 1347 | tty = tty_port_tty_get(&self->port); |
1348 | if (tty) { | ||
1363 | seq_printf(m, "Hardware: %s\n", | 1349 | seq_printf(m, "Hardware: %s\n", |
1364 | self->tty->hw_stopped ? "Stopped" : "Running"); | 1350 | tty->hw_stopped ? "Stopped" : "Running"); |
1351 | tty_kref_put(tty); | ||
1352 | } | ||
1365 | } | 1353 | } |
1366 | 1354 | ||
1367 | static int ircomm_tty_proc_show(struct seq_file *m, void *v) | 1355 | static int ircomm_tty_proc_show(struct seq_file *m, void *v) |
diff --git a/net/irda/ircomm/ircomm_tty_attach.c b/net/irda/ircomm/ircomm_tty_attach.c index b65d66e0d81..edab393e0c8 100644 --- a/net/irda/ircomm/ircomm_tty_attach.c +++ b/net/irda/ircomm/ircomm_tty_attach.c | |||
@@ -130,6 +130,8 @@ static int (*state[])(struct ircomm_tty_cb *self, IRCOMM_TTY_EVENT event, | |||
130 | */ | 130 | */ |
131 | int ircomm_tty_attach_cable(struct ircomm_tty_cb *self) | 131 | int ircomm_tty_attach_cable(struct ircomm_tty_cb *self) |
132 | { | 132 | { |
133 | struct tty_struct *tty; | ||
134 | |||
133 | IRDA_DEBUG(0, "%s()\n", __func__ ); | 135 | IRDA_DEBUG(0, "%s()\n", __func__ ); |
134 | 136 | ||
135 | IRDA_ASSERT(self != NULL, return -1;); | 137 | IRDA_ASSERT(self != NULL, return -1;); |
@@ -142,7 +144,11 @@ int ircomm_tty_attach_cable(struct ircomm_tty_cb *self) | |||
142 | } | 144 | } |
143 | 145 | ||
144 | /* Make sure nobody tries to write before the link is up */ | 146 | /* Make sure nobody tries to write before the link is up */ |
145 | self->tty->hw_stopped = 1; | 147 | tty = tty_port_tty_get(&self->port); |
148 | if (tty) { | ||
149 | tty->hw_stopped = 1; | ||
150 | tty_kref_put(tty); | ||
151 | } | ||
146 | 152 | ||
147 | ircomm_tty_ias_register(self); | 153 | ircomm_tty_ias_register(self); |
148 | 154 | ||
@@ -398,23 +404,26 @@ void ircomm_tty_disconnect_indication(void *instance, void *sap, | |||
398 | struct sk_buff *skb) | 404 | struct sk_buff *skb) |
399 | { | 405 | { |
400 | struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; | 406 | struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) instance; |
407 | struct tty_struct *tty; | ||
401 | 408 | ||
402 | IRDA_DEBUG(2, "%s()\n", __func__ ); | 409 | IRDA_DEBUG(2, "%s()\n", __func__ ); |
403 | 410 | ||
404 | IRDA_ASSERT(self != NULL, return;); | 411 | IRDA_ASSERT(self != NULL, return;); |
405 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); | 412 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); |
406 | 413 | ||
407 | if (!self->tty) | 414 | tty = tty_port_tty_get(&self->port); |
415 | if (!tty) | ||
408 | return; | 416 | return; |
409 | 417 | ||
410 | /* This will stop control data transfers */ | 418 | /* This will stop control data transfers */ |
411 | self->flow = FLOW_STOP; | 419 | self->flow = FLOW_STOP; |
412 | 420 | ||
413 | /* Stop data transfers */ | 421 | /* Stop data transfers */ |
414 | self->tty->hw_stopped = 1; | 422 | tty->hw_stopped = 1; |
415 | 423 | ||
416 | ircomm_tty_do_event(self, IRCOMM_TTY_DISCONNECT_INDICATION, NULL, | 424 | ircomm_tty_do_event(self, IRCOMM_TTY_DISCONNECT_INDICATION, NULL, |
417 | NULL); | 425 | NULL); |
426 | tty_kref_put(tty); | ||
418 | } | 427 | } |
419 | 428 | ||
420 | /* | 429 | /* |
@@ -550,12 +559,15 @@ void ircomm_tty_connect_indication(void *instance, void *sap, | |||
550 | */ | 559 | */ |
551 | void ircomm_tty_link_established(struct ircomm_tty_cb *self) | 560 | void ircomm_tty_link_established(struct ircomm_tty_cb *self) |
552 | { | 561 | { |
562 | struct tty_struct *tty; | ||
563 | |||
553 | IRDA_DEBUG(2, "%s()\n", __func__ ); | 564 | IRDA_DEBUG(2, "%s()\n", __func__ ); |
554 | 565 | ||
555 | IRDA_ASSERT(self != NULL, return;); | 566 | IRDA_ASSERT(self != NULL, return;); |
556 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); | 567 | IRDA_ASSERT(self->magic == IRCOMM_TTY_MAGIC, return;); |
557 | 568 | ||
558 | if (!self->tty) | 569 | tty = tty_port_tty_get(&self->port); |
570 | if (!tty) | ||
559 | return; | 571 | return; |
560 | 572 | ||
561 | del_timer(&self->watchdog_timer); | 573 | del_timer(&self->watchdog_timer); |
@@ -566,19 +578,22 @@ void ircomm_tty_link_established(struct ircomm_tty_cb *self) | |||
566 | * will have to wait for the peer device (DCE) to raise the CTS | 578 | * will have to wait for the peer device (DCE) to raise the CTS |
567 | * line. | 579 | * line. |
568 | */ | 580 | */ |
569 | if ((self->flags & ASYNC_CTS_FLOW) && ((self->settings.dce & IRCOMM_CTS) == 0)) { | 581 | if (tty_port_cts_enabled(&self->port) && |
582 | ((self->settings.dce & IRCOMM_CTS) == 0)) { | ||
570 | IRDA_DEBUG(0, "%s(), waiting for CTS ...\n", __func__ ); | 583 | IRDA_DEBUG(0, "%s(), waiting for CTS ...\n", __func__ ); |
571 | return; | 584 | goto put; |
572 | } else { | 585 | } else { |
573 | IRDA_DEBUG(1, "%s(), starting hardware!\n", __func__ ); | 586 | IRDA_DEBUG(1, "%s(), starting hardware!\n", __func__ ); |
574 | 587 | ||
575 | self->tty->hw_stopped = 0; | 588 | tty->hw_stopped = 0; |
576 | 589 | ||
577 | /* Wake up processes blocked on open */ | 590 | /* Wake up processes blocked on open */ |
578 | wake_up_interruptible(&self->open_wait); | 591 | wake_up_interruptible(&self->port.open_wait); |
579 | } | 592 | } |
580 | 593 | ||
581 | schedule_work(&self->tqueue); | 594 | schedule_work(&self->tqueue); |
595 | put: | ||
596 | tty_kref_put(tty); | ||
582 | } | 597 | } |
583 | 598 | ||
584 | /* | 599 | /* |
@@ -977,14 +992,17 @@ static int ircomm_tty_state_ready(struct ircomm_tty_cb *self, | |||
977 | ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH); | 992 | ircomm_tty_next_state(self, IRCOMM_TTY_SEARCH); |
978 | ircomm_tty_start_watchdog_timer(self, 3*HZ); | 993 | ircomm_tty_start_watchdog_timer(self, 3*HZ); |
979 | 994 | ||
980 | if (self->flags & ASYNC_CHECK_CD) { | 995 | if (self->port.flags & ASYNC_CHECK_CD) { |
981 | /* Drop carrier */ | 996 | /* Drop carrier */ |
982 | self->settings.dce = IRCOMM_DELTA_CD; | 997 | self->settings.dce = IRCOMM_DELTA_CD; |
983 | ircomm_tty_check_modem_status(self); | 998 | ircomm_tty_check_modem_status(self); |
984 | } else { | 999 | } else { |
1000 | struct tty_struct *tty = tty_port_tty_get(&self->port); | ||
985 | IRDA_DEBUG(0, "%s(), hanging up!\n", __func__ ); | 1001 | IRDA_DEBUG(0, "%s(), hanging up!\n", __func__ ); |
986 | if (self->tty) | 1002 | if (tty) { |
987 | tty_hangup(self->tty); | 1003 | tty_hangup(tty); |
1004 | tty_kref_put(tty); | ||
1005 | } | ||
988 | } | 1006 | } |
989 | break; | 1007 | break; |
990 | default: | 1008 | default: |
diff --git a/net/irda/ircomm/ircomm_tty_ioctl.c b/net/irda/ircomm/ircomm_tty_ioctl.c index d0667d68351..b343f50dc8d 100644 --- a/net/irda/ircomm/ircomm_tty_ioctl.c +++ b/net/irda/ircomm/ircomm_tty_ioctl.c | |||
@@ -52,17 +52,18 @@ | |||
52 | * Change speed of the driver. If the remote device is a DCE, then this | 52 | * Change speed of the driver. If the remote device is a DCE, then this |
53 | * should make it change the speed of its serial port | 53 | * should make it change the speed of its serial port |
54 | */ | 54 | */ |
55 | static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) | 55 | static void ircomm_tty_change_speed(struct ircomm_tty_cb *self, |
56 | struct tty_struct *tty) | ||
56 | { | 57 | { |
57 | unsigned int cflag, cval; | 58 | unsigned int cflag, cval; |
58 | int baud; | 59 | int baud; |
59 | 60 | ||
60 | IRDA_DEBUG(2, "%s()\n", __func__ ); | 61 | IRDA_DEBUG(2, "%s()\n", __func__ ); |
61 | 62 | ||
62 | if (!self->tty || !self->tty->termios || !self->ircomm) | 63 | if (!self->ircomm) |
63 | return; | 64 | return; |
64 | 65 | ||
65 | cflag = self->tty->termios->c_cflag; | 66 | cflag = tty->termios.c_cflag; |
66 | 67 | ||
67 | /* byte size and parity */ | 68 | /* byte size and parity */ |
68 | switch (cflag & CSIZE) { | 69 | switch (cflag & CSIZE) { |
@@ -81,7 +82,7 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) | |||
81 | cval |= IRCOMM_PARITY_EVEN; | 82 | cval |= IRCOMM_PARITY_EVEN; |
82 | 83 | ||
83 | /* Determine divisor based on baud rate */ | 84 | /* Determine divisor based on baud rate */ |
84 | baud = tty_get_baud_rate(self->tty); | 85 | baud = tty_get_baud_rate(tty); |
85 | if (!baud) | 86 | if (!baud) |
86 | baud = 9600; /* B0 transition handled in rs_set_termios */ | 87 | baud = 9600; /* B0 transition handled in rs_set_termios */ |
87 | 88 | ||
@@ -90,19 +91,19 @@ static void ircomm_tty_change_speed(struct ircomm_tty_cb *self) | |||
90 | 91 | ||
91 | /* CTS flow control flag and modem status interrupts */ | 92 | /* CTS flow control flag and modem status interrupts */ |
92 | if (cflag & CRTSCTS) { | 93 | if (cflag & CRTSCTS) { |
93 | self->flags |= ASYNC_CTS_FLOW; | 94 | self->port.flags |= ASYNC_CTS_FLOW; |
94 | self->settings.flow_control |= IRCOMM_RTS_CTS_IN; | 95 | self->settings.flow_control |= IRCOMM_RTS_CTS_IN; |
95 | /* This got me. Bummer. Jean II */ | 96 | /* This got me. Bummer. Jean II */ |
96 | if (self->service_type == IRCOMM_3_WIRE_RAW) | 97 | if (self->service_type == IRCOMM_3_WIRE_RAW) |
97 | IRDA_WARNING("%s(), enabling RTS/CTS on link that doesn't support it (3-wire-raw)\n", __func__); | 98 | IRDA_WARNING("%s(), enabling RTS/CTS on link that doesn't support it (3-wire-raw)\n", __func__); |
98 | } else { | 99 | } else { |
99 | self->flags &= ~ASYNC_CTS_FLOW; | 100 | self->port.flags &= ~ASYNC_CTS_FLOW; |
100 | self->settings.flow_control &= ~IRCOMM_RTS_CTS_IN; | 101 | self->settings.flow_control &= ~IRCOMM_RTS_CTS_IN; |
101 | } | 102 | } |
102 | if (cflag & CLOCAL) | 103 | if (cflag & CLOCAL) |
103 | self->flags &= ~ASYNC_CHECK_CD; | 104 | self->port.flags &= ~ASYNC_CHECK_CD; |
104 | else | 105 | else |
105 | self->flags |= ASYNC_CHECK_CD; | 106 | self->port.flags |= ASYNC_CHECK_CD; |
106 | #if 0 | 107 | #if 0 |
107 | /* | 108 | /* |
108 | * Set up parity check flag | 109 | * Set up parity check flag |
@@ -148,18 +149,18 @@ void ircomm_tty_set_termios(struct tty_struct *tty, | |||
148 | struct ktermios *old_termios) | 149 | struct ktermios *old_termios) |
149 | { | 150 | { |
150 | struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; | 151 | struct ircomm_tty_cb *self = (struct ircomm_tty_cb *) tty->driver_data; |
151 | unsigned int cflag = tty->termios->c_cflag; | 152 | unsigned int cflag = tty->termios.c_cflag; |
152 | 153 | ||
153 | IRDA_DEBUG(2, "%s()\n", __func__ ); | 154 | IRDA_DEBUG(2, "%s()\n", __func__ ); |
154 | 155 | ||
155 | if ((cflag == old_termios->c_cflag) && | 156 | if ((cflag == old_termios->c_cflag) && |
156 | (RELEVANT_IFLAG(tty->termios->c_iflag) == | 157 | (RELEVANT_IFLAG(tty->termios.c_iflag) == |
157 | RELEVANT_IFLAG(old_termios->c_iflag))) | 158 | RELEVANT_IFLAG(old_termios->c_iflag))) |
158 | { | 159 | { |
159 | return; | 160 | return; |
160 | } | 161 | } |
161 | 162 | ||
162 | ircomm_tty_change_speed(self); | 163 | ircomm_tty_change_speed(self, tty); |
163 | 164 | ||
164 | /* Handle transition to B0 status */ | 165 | /* Handle transition to B0 status */ |
165 | if ((old_termios->c_cflag & CBAUD) && | 166 | if ((old_termios->c_cflag & CBAUD) && |
@@ -172,7 +173,7 @@ void ircomm_tty_set_termios(struct tty_struct *tty, | |||
172 | if (!(old_termios->c_cflag & CBAUD) && | 173 | if (!(old_termios->c_cflag & CBAUD) && |
173 | (cflag & CBAUD)) { | 174 | (cflag & CBAUD)) { |
174 | self->settings.dte |= IRCOMM_DTR; | 175 | self->settings.dte |= IRCOMM_DTR; |
175 | if (!(tty->termios->c_cflag & CRTSCTS) || | 176 | if (!(tty->termios.c_cflag & CRTSCTS) || |
176 | !test_bit(TTY_THROTTLED, &tty->flags)) { | 177 | !test_bit(TTY_THROTTLED, &tty->flags)) { |
177 | self->settings.dte |= IRCOMM_RTS; | 178 | self->settings.dte |= IRCOMM_RTS; |
178 | } | 179 | } |
@@ -181,7 +182,7 @@ void ircomm_tty_set_termios(struct tty_struct *tty, | |||
181 | 182 | ||
182 | /* Handle turning off CRTSCTS */ | 183 | /* Handle turning off CRTSCTS */ |
183 | if ((old_termios->c_cflag & CRTSCTS) && | 184 | if ((old_termios->c_cflag & CRTSCTS) && |
184 | !(tty->termios->c_cflag & CRTSCTS)) | 185 | !(tty->termios.c_cflag & CRTSCTS)) |
185 | { | 186 | { |
186 | tty->hw_stopped = 0; | 187 | tty->hw_stopped = 0; |
187 | ircomm_tty_start(tty); | 188 | ircomm_tty_start(tty); |
@@ -270,10 +271,10 @@ static int ircomm_tty_get_serial_info(struct ircomm_tty_cb *self, | |||
270 | 271 | ||
271 | memset(&info, 0, sizeof(info)); | 272 | memset(&info, 0, sizeof(info)); |
272 | info.line = self->line; | 273 | info.line = self->line; |
273 | info.flags = self->flags; | 274 | info.flags = self->port.flags; |
274 | info.baud_base = self->settings.data_rate; | 275 | info.baud_base = self->settings.data_rate; |
275 | info.close_delay = self->close_delay; | 276 | info.close_delay = self->port.close_delay; |
276 | info.closing_wait = self->closing_wait; | 277 | info.closing_wait = self->port.closing_wait; |
277 | 278 | ||
278 | /* For compatibility */ | 279 | /* For compatibility */ |
279 | info.type = PORT_16550A; | 280 | info.type = PORT_16550A; |
diff --git a/net/netfilter/nfnetlink_log.c b/net/netfilter/nfnetlink_log.c index 10067e3112c..9f199f2e31f 100644 --- a/net/netfilter/nfnetlink_log.c +++ b/net/netfilter/nfnetlink_log.c | |||
@@ -507,10 +507,10 @@ __build_packet_message(struct nfulnl_instance *inst, | |||
507 | read_lock_bh(&sk->sk_callback_lock); | 507 | read_lock_bh(&sk->sk_callback_lock); |
508 | if (sk->sk_socket && sk->sk_socket->file) { | 508 | if (sk->sk_socket && sk->sk_socket->file) { |
509 | struct file *file = sk->sk_socket->file; | 509 | struct file *file = sk->sk_socket->file; |
510 | __be32 uid = htonl(from_kuid_munged(inst->peer_user_ns, | 510 | const struct cred *cred = file->f_cred; |
511 | file->f_cred->fsuid)); | 511 | struct user_namespace *user_ns = inst->peer_user_ns; |
512 | __be32 gid = htonl(from_kgid_munged(inst->peer_user_ns, | 512 | __be32 uid = htonl(from_kuid_munged(user_ns, cred->fsuid)); |
513 | file->f_cred->fsgid)); | 513 | __be32 gid = htonl(from_kgid_munged(user_ns, cred->fsgid)); |
514 | read_unlock_bh(&sk->sk_callback_lock); | 514 | read_unlock_bh(&sk->sk_callback_lock); |
515 | if (nla_put_be32(inst->skb, NFULA_UID, uid) || | 515 | if (nla_put_be32(inst->skb, NFULA_UID, uid) || |
516 | nla_put_be32(inst->skb, NFULA_GID, gid)) | 516 | nla_put_be32(inst->skb, NFULA_GID, gid)) |
diff --git a/net/netfilter/xt_LOG.c b/net/netfilter/xt_LOG.c index aeb19710a6f..fa40096940a 100644 --- a/net/netfilter/xt_LOG.c +++ b/net/netfilter/xt_LOG.c | |||
@@ -154,8 +154,8 @@ static void dump_sk_uid_gid(struct sbuff *m, struct sock *sk) | |||
154 | if (sk->sk_socket && sk->sk_socket->file) { | 154 | if (sk->sk_socket && sk->sk_socket->file) { |
155 | const struct cred *cred = sk->sk_socket->file->f_cred; | 155 | const struct cred *cred = sk->sk_socket->file->f_cred; |
156 | sb_add(m, "UID=%u GID=%u ", | 156 | sb_add(m, "UID=%u GID=%u ", |
157 | from_kuid_munged(&init_user_ns, cred->fsuid), | 157 | from_kuid_munged(&init_user_ns, cred->fsuid), |
158 | from_kgid_munged(&init_user_ns, cred->fsgid)); | 158 | from_kgid_munged(&init_user_ns, cred->fsgid)); |
159 | } | 159 | } |
160 | read_unlock_bh(&sk->sk_callback_lock); | 160 | read_unlock_bh(&sk->sk_callback_lock); |
161 | } | 161 | } |
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c index b7944413b40..847d495cd4d 100644 --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c | |||
@@ -1541,7 +1541,7 @@ int __init netlbl_unlabel_defconf(void) | |||
1541 | * it is called is at bootup before the audit subsystem is reporting | 1541 | * it is called is at bootup before the audit subsystem is reporting |
1542 | * messages so don't worry to much about these values. */ | 1542 | * messages so don't worry to much about these values. */ |
1543 | security_task_getsecid(current, &audit_info.secid); | 1543 | security_task_getsecid(current, &audit_info.secid); |
1544 | audit_info.loginuid = 0; | 1544 | audit_info.loginuid = GLOBAL_ROOT_UID; |
1545 | audit_info.sessionid = 0; | 1545 | audit_info.sessionid = 0; |
1546 | 1546 | ||
1547 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); | 1547 | entry = kzalloc(sizeof(*entry), GFP_KERNEL); |
diff --git a/net/netlabel/netlabel_user.c b/net/netlabel/netlabel_user.c index 9fae63f1029..9650c4ad5f8 100644 --- a/net/netlabel/netlabel_user.c +++ b/net/netlabel/netlabel_user.c | |||
@@ -109,7 +109,7 @@ struct audit_buffer *netlbl_audit_start_common(int type, | |||
109 | return NULL; | 109 | return NULL; |
110 | 110 | ||
111 | audit_log_format(audit_buf, "netlabel: auid=%u ses=%u", | 111 | audit_log_format(audit_buf, "netlabel: auid=%u ses=%u", |
112 | audit_info->loginuid, | 112 | from_kuid(&init_user_ns, audit_info->loginuid), |
113 | audit_info->sessionid); | 113 | audit_info->sessionid); |
114 | 114 | ||
115 | if (audit_info->secid != 0 && | 115 | if (audit_info->secid != 0 && |
diff --git a/net/rfkill/input.c b/net/rfkill/input.c index 24c55c53e6a..c9d931e7ffe 100644 --- a/net/rfkill/input.c +++ b/net/rfkill/input.c | |||
@@ -164,8 +164,7 @@ static void rfkill_schedule_global_op(enum rfkill_sched_op op) | |||
164 | rfkill_op_pending = true; | 164 | rfkill_op_pending = true; |
165 | if (op == RFKILL_GLOBAL_OP_EPO && !rfkill_is_epo_lock_active()) { | 165 | if (op == RFKILL_GLOBAL_OP_EPO && !rfkill_is_epo_lock_active()) { |
166 | /* bypass the limiter for EPO */ | 166 | /* bypass the limiter for EPO */ |
167 | cancel_delayed_work(&rfkill_op_work); | 167 | mod_delayed_work(system_wq, &rfkill_op_work, 0); |
168 | schedule_delayed_work(&rfkill_op_work, 0); | ||
169 | rfkill_last_scheduled = jiffies; | 168 | rfkill_last_scheduled = jiffies; |
170 | } else | 169 | } else |
171 | rfkill_schedule_ratelimited(); | 170 | rfkill_schedule_ratelimited(); |
diff --git a/net/rxrpc/ar-key.c b/net/rxrpc/ar-key.c index 8b1f9f49960..011d2384b11 100644 --- a/net/rxrpc/ar-key.c +++ b/net/rxrpc/ar-key.c | |||
@@ -948,7 +948,8 @@ int rxrpc_get_server_data_key(struct rxrpc_connection *conn, | |||
948 | 948 | ||
949 | _enter(""); | 949 | _enter(""); |
950 | 950 | ||
951 | key = key_alloc(&key_type_rxrpc, "x", 0, 0, cred, 0, | 951 | key = key_alloc(&key_type_rxrpc, "x", |
952 | GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, cred, 0, | ||
952 | KEY_ALLOC_NOT_IN_QUOTA); | 953 | KEY_ALLOC_NOT_IN_QUOTA); |
953 | if (IS_ERR(key)) { | 954 | if (IS_ERR(key)) { |
954 | _leave(" = -ENOMEM [alloc %ld]", PTR_ERR(key)); | 955 | _leave(" = -ENOMEM [alloc %ld]", PTR_ERR(key)); |
@@ -994,7 +995,8 @@ struct key *rxrpc_get_null_key(const char *keyname) | |||
994 | struct key *key; | 995 | struct key *key; |
995 | int ret; | 996 | int ret; |
996 | 997 | ||
997 | key = key_alloc(&key_type_rxrpc, keyname, 0, 0, cred, | 998 | key = key_alloc(&key_type_rxrpc, keyname, |
999 | GLOBAL_ROOT_UID, GLOBAL_ROOT_GID, cred, | ||
998 | KEY_POS_SEARCH, KEY_ALLOC_NOT_IN_QUOTA); | 1000 | KEY_POS_SEARCH, KEY_ALLOC_NOT_IN_QUOTA); |
999 | if (IS_ERR(key)) | 1001 | if (IS_ERR(key)) |
1000 | return key; | 1002 | return key; |
diff --git a/net/sched/cls_cgroup.c b/net/sched/cls_cgroup.c index 91de66695b4..2ecde225ae6 100644 --- a/net/sched/cls_cgroup.c +++ b/net/sched/cls_cgroup.c | |||
@@ -77,11 +77,18 @@ struct cgroup_subsys net_cls_subsys = { | |||
77 | .name = "net_cls", | 77 | .name = "net_cls", |
78 | .create = cgrp_create, | 78 | .create = cgrp_create, |
79 | .destroy = cgrp_destroy, | 79 | .destroy = cgrp_destroy, |
80 | #ifdef CONFIG_NET_CLS_CGROUP | ||
81 | .subsys_id = net_cls_subsys_id, | 80 | .subsys_id = net_cls_subsys_id, |
82 | #endif | ||
83 | .base_cftypes = ss_files, | 81 | .base_cftypes = ss_files, |
84 | .module = THIS_MODULE, | 82 | .module = THIS_MODULE, |
83 | |||
84 | /* | ||
85 | * While net_cls cgroup has the rudimentary hierarchy support of | ||
86 | * inheriting the parent's classid on cgroup creation, it doesn't | ||
87 | * properly propagates config changes in ancestors to their | ||
88 | * descendents. A child should follow the parent's configuration | ||
89 | * but be allowed to override it. Fix it and remove the following. | ||
90 | */ | ||
91 | .broken_hierarchy = true, | ||
85 | }; | 92 | }; |
86 | 93 | ||
87 | struct cls_cgroup_head { | 94 | struct cls_cgroup_head { |
@@ -284,12 +291,6 @@ static int __init init_cgroup_cls(void) | |||
284 | if (ret) | 291 | if (ret) |
285 | goto out; | 292 | goto out; |
286 | 293 | ||
287 | #ifndef CONFIG_NET_CLS_CGROUP | ||
288 | /* We can't use rcu_assign_pointer because this is an int. */ | ||
289 | smp_wmb(); | ||
290 | net_cls_subsys_id = net_cls_subsys.subsys_id; | ||
291 | #endif | ||
292 | |||
293 | ret = register_tcf_proto_ops(&cls_cgroup_ops); | 294 | ret = register_tcf_proto_ops(&cls_cgroup_ops); |
294 | if (ret) | 295 | if (ret) |
295 | cgroup_unload_subsys(&net_cls_subsys); | 296 | cgroup_unload_subsys(&net_cls_subsys); |
@@ -302,11 +303,6 @@ static void __exit exit_cgroup_cls(void) | |||
302 | { | 303 | { |
303 | unregister_tcf_proto_ops(&cls_cgroup_ops); | 304 | unregister_tcf_proto_ops(&cls_cgroup_ops); |
304 | 305 | ||
305 | #ifndef CONFIG_NET_CLS_CGROUP | ||
306 | net_cls_subsys_id = -1; | ||
307 | synchronize_rcu(); | ||
308 | #endif | ||
309 | |||
310 | cgroup_unload_subsys(&net_cls_subsys); | 306 | cgroup_unload_subsys(&net_cls_subsys); |
311 | } | 307 | } |
312 | 308 | ||
diff --git a/net/sunrpc/cache.c b/net/sunrpc/cache.c index 2afd2a84dc3..2a68bb3db77 100644 --- a/net/sunrpc/cache.c +++ b/net/sunrpc/cache.c | |||
@@ -1635,7 +1635,7 @@ static int create_cache_proc_entries(struct cache_detail *cd, struct net *net) | |||
1635 | 1635 | ||
1636 | void __init cache_initialize(void) | 1636 | void __init cache_initialize(void) |
1637 | { | 1637 | { |
1638 | INIT_DELAYED_WORK_DEFERRABLE(&cache_cleaner, do_cache_clean); | 1638 | INIT_DEFERRABLE_WORK(&cache_cleaner, do_cache_clean); |
1639 | } | 1639 | } |
1640 | 1640 | ||
1641 | int cache_register_net(struct cache_detail *cd, struct net *net) | 1641 | int cache_register_net(struct cache_detail *cd, struct net *net) |
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index f4e0a6a148a..41eabc46f11 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -2638,12 +2638,12 @@ static void xfrm_policy_fini(struct net *net) | |||
2638 | 2638 | ||
2639 | flush_work(&net->xfrm.policy_hash_work); | 2639 | flush_work(&net->xfrm.policy_hash_work); |
2640 | #ifdef CONFIG_XFRM_SUB_POLICY | 2640 | #ifdef CONFIG_XFRM_SUB_POLICY |
2641 | audit_info.loginuid = -1; | 2641 | audit_info.loginuid = INVALID_UID; |
2642 | audit_info.sessionid = -1; | 2642 | audit_info.sessionid = -1; |
2643 | audit_info.secid = 0; | 2643 | audit_info.secid = 0; |
2644 | xfrm_policy_flush(net, XFRM_POLICY_TYPE_SUB, &audit_info); | 2644 | xfrm_policy_flush(net, XFRM_POLICY_TYPE_SUB, &audit_info); |
2645 | #endif | 2645 | #endif |
2646 | audit_info.loginuid = -1; | 2646 | audit_info.loginuid = INVALID_UID; |
2647 | audit_info.sessionid = -1; | 2647 | audit_info.sessionid = -1; |
2648 | audit_info.secid = 0; | 2648 | audit_info.secid = 0; |
2649 | xfrm_policy_flush(net, XFRM_POLICY_TYPE_MAIN, &audit_info); | 2649 | xfrm_policy_flush(net, XFRM_POLICY_TYPE_MAIN, &audit_info); |
@@ -2750,7 +2750,7 @@ static void xfrm_audit_common_policyinfo(struct xfrm_policy *xp, | |||
2750 | } | 2750 | } |
2751 | 2751 | ||
2752 | void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, | 2752 | void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, |
2753 | uid_t auid, u32 sessionid, u32 secid) | 2753 | kuid_t auid, u32 sessionid, u32 secid) |
2754 | { | 2754 | { |
2755 | struct audit_buffer *audit_buf; | 2755 | struct audit_buffer *audit_buf; |
2756 | 2756 | ||
@@ -2765,7 +2765,7 @@ void xfrm_audit_policy_add(struct xfrm_policy *xp, int result, | |||
2765 | EXPORT_SYMBOL_GPL(xfrm_audit_policy_add); | 2765 | EXPORT_SYMBOL_GPL(xfrm_audit_policy_add); |
2766 | 2766 | ||
2767 | void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, | 2767 | void xfrm_audit_policy_delete(struct xfrm_policy *xp, int result, |
2768 | uid_t auid, u32 sessionid, u32 secid) | 2768 | kuid_t auid, u32 sessionid, u32 secid) |
2769 | { | 2769 | { |
2770 | struct audit_buffer *audit_buf; | 2770 | struct audit_buffer *audit_buf; |
2771 | 2771 | ||
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 105f2062ed1..3459692092e 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
@@ -2060,7 +2060,7 @@ void xfrm_state_fini(struct net *net) | |||
2060 | unsigned int sz; | 2060 | unsigned int sz; |
2061 | 2061 | ||
2062 | flush_work(&net->xfrm.state_hash_work); | 2062 | flush_work(&net->xfrm.state_hash_work); |
2063 | audit_info.loginuid = -1; | 2063 | audit_info.loginuid = INVALID_UID; |
2064 | audit_info.sessionid = -1; | 2064 | audit_info.sessionid = -1; |
2065 | audit_info.secid = 0; | 2065 | audit_info.secid = 0; |
2066 | xfrm_state_flush(net, IPSEC_PROTO_ANY, &audit_info); | 2066 | xfrm_state_flush(net, IPSEC_PROTO_ANY, &audit_info); |
@@ -2127,7 +2127,7 @@ static void xfrm_audit_helper_pktinfo(struct sk_buff *skb, u16 family, | |||
2127 | } | 2127 | } |
2128 | 2128 | ||
2129 | void xfrm_audit_state_add(struct xfrm_state *x, int result, | 2129 | void xfrm_audit_state_add(struct xfrm_state *x, int result, |
2130 | uid_t auid, u32 sessionid, u32 secid) | 2130 | kuid_t auid, u32 sessionid, u32 secid) |
2131 | { | 2131 | { |
2132 | struct audit_buffer *audit_buf; | 2132 | struct audit_buffer *audit_buf; |
2133 | 2133 | ||
@@ -2142,7 +2142,7 @@ void xfrm_audit_state_add(struct xfrm_state *x, int result, | |||
2142 | EXPORT_SYMBOL_GPL(xfrm_audit_state_add); | 2142 | EXPORT_SYMBOL_GPL(xfrm_audit_state_add); |
2143 | 2143 | ||
2144 | void xfrm_audit_state_delete(struct xfrm_state *x, int result, | 2144 | void xfrm_audit_state_delete(struct xfrm_state *x, int result, |
2145 | uid_t auid, u32 sessionid, u32 secid) | 2145 | kuid_t auid, u32 sessionid, u32 secid) |
2146 | { | 2146 | { |
2147 | struct audit_buffer *audit_buf; | 2147 | struct audit_buffer *audit_buf; |
2148 | 2148 | ||
diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c index 94a2a1f726f..421f9844433 100644 --- a/net/xfrm/xfrm_user.c +++ b/net/xfrm/xfrm_user.c | |||
@@ -595,7 +595,7 @@ static int xfrm_add_sa(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
595 | struct xfrm_state *x; | 595 | struct xfrm_state *x; |
596 | int err; | 596 | int err; |
597 | struct km_event c; | 597 | struct km_event c; |
598 | uid_t loginuid = audit_get_loginuid(current); | 598 | kuid_t loginuid = audit_get_loginuid(current); |
599 | u32 sessionid = audit_get_sessionid(current); | 599 | u32 sessionid = audit_get_sessionid(current); |
600 | u32 sid; | 600 | u32 sid; |
601 | 601 | ||
@@ -674,7 +674,7 @@ static int xfrm_del_sa(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
674 | int err = -ESRCH; | 674 | int err = -ESRCH; |
675 | struct km_event c; | 675 | struct km_event c; |
676 | struct xfrm_usersa_id *p = nlmsg_data(nlh); | 676 | struct xfrm_usersa_id *p = nlmsg_data(nlh); |
677 | uid_t loginuid = audit_get_loginuid(current); | 677 | kuid_t loginuid = audit_get_loginuid(current); |
678 | u32 sessionid = audit_get_sessionid(current); | 678 | u32 sessionid = audit_get_sessionid(current); |
679 | u32 sid; | 679 | u32 sid; |
680 | 680 | ||
@@ -1393,7 +1393,7 @@ static int xfrm_add_policy(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1393 | struct km_event c; | 1393 | struct km_event c; |
1394 | int err; | 1394 | int err; |
1395 | int excl; | 1395 | int excl; |
1396 | uid_t loginuid = audit_get_loginuid(current); | 1396 | kuid_t loginuid = audit_get_loginuid(current); |
1397 | u32 sessionid = audit_get_sessionid(current); | 1397 | u32 sessionid = audit_get_sessionid(current); |
1398 | u32 sid; | 1398 | u32 sid; |
1399 | 1399 | ||
@@ -1651,7 +1651,7 @@ static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1651 | NETLINK_CB(skb).portid); | 1651 | NETLINK_CB(skb).portid); |
1652 | } | 1652 | } |
1653 | } else { | 1653 | } else { |
1654 | uid_t loginuid = audit_get_loginuid(current); | 1654 | kuid_t loginuid = audit_get_loginuid(current); |
1655 | u32 sessionid = audit_get_sessionid(current); | 1655 | u32 sessionid = audit_get_sessionid(current); |
1656 | u32 sid; | 1656 | u32 sid; |
1657 | 1657 | ||
@@ -1945,7 +1945,7 @@ static int xfrm_add_pol_expire(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1945 | 1945 | ||
1946 | err = 0; | 1946 | err = 0; |
1947 | if (up->hard) { | 1947 | if (up->hard) { |
1948 | uid_t loginuid = audit_get_loginuid(current); | 1948 | kuid_t loginuid = audit_get_loginuid(current); |
1949 | u32 sessionid = audit_get_sessionid(current); | 1949 | u32 sessionid = audit_get_sessionid(current); |
1950 | u32 sid; | 1950 | u32 sid; |
1951 | 1951 | ||
@@ -1988,7 +1988,7 @@ static int xfrm_add_sa_expire(struct sk_buff *skb, struct nlmsghdr *nlh, | |||
1988 | km_state_expired(x, ue->hard, nlh->nlmsg_pid); | 1988 | km_state_expired(x, ue->hard, nlh->nlmsg_pid); |
1989 | 1989 | ||
1990 | if (ue->hard) { | 1990 | if (ue->hard) { |
1991 | uid_t loginuid = audit_get_loginuid(current); | 1991 | kuid_t loginuid = audit_get_loginuid(current); |
1992 | u32 sessionid = audit_get_sessionid(current); | 1992 | u32 sessionid = audit_get_sessionid(current); |
1993 | u32 sid; | 1993 | u32 sid; |
1994 | 1994 | ||