diff options
author | Thomas Gleixner <tglx@linutronix.de> | 2010-12-09 12:17:25 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2010-12-09 12:17:25 -0500 |
commit | d834a9dcecae834cd6b2bc5e50e1907738d9cf6a (patch) | |
tree | 0589d753465d3fe359ba451ba6cb7798df03aaa2 /net/irda | |
parent | a38c5380ef9f088be9f49b6e4c5d80af8b1b5cd4 (diff) | |
parent | f658bcfb2607bf0808966a69cf74135ce98e5c2d (diff) |
Merge branch 'x86/amd-nb' into x86/apic-cleanups
Reason: apic cleanup series depends on x86/apic, x86/amd-nb x86/platform
Conflicts:
arch/x86/include/asm/io_apic.h
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'net/irda')
-rw-r--r-- | net/irda/af_irda.c | 380 | ||||
-rw-r--r-- | net/irda/discovery.c | 2 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_tty.c | 4 | ||||
-rw-r--r-- | net/irda/iriap.c | 3 | ||||
-rw-r--r-- | net/irda/irlan/irlan_eth.c | 32 | ||||
-rw-r--r-- | net/irda/irlan/irlan_event.c | 2 | ||||
-rw-r--r-- | net/irda/irlmp.c | 2 | ||||
-rw-r--r-- | net/irda/irlmp_frame.c | 2 | ||||
-rw-r--r-- | net/irda/irnet/irnet.h | 2 | ||||
-rw-r--r-- | net/irda/irnet/irnet_irda.c | 22 | ||||
-rw-r--r-- | net/irda/irnet/irnet_ppp.c | 71 | ||||
-rw-r--r-- | net/irda/irnet/irnet_ppp.h | 3 | ||||
-rw-r--r-- | net/irda/parameters.c | 4 |
13 files changed, 283 insertions, 246 deletions
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index fd55b5135de5..7f097989cde2 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -573,9 +573,9 @@ static int irda_find_lsap_sel(struct irda_sock *self, char *name) | |||
573 | /* Requested object/attribute doesn't exist */ | 573 | /* Requested object/attribute doesn't exist */ |
574 | if((self->errno == IAS_CLASS_UNKNOWN) || | 574 | if((self->errno == IAS_CLASS_UNKNOWN) || |
575 | (self->errno == IAS_ATTRIB_UNKNOWN)) | 575 | (self->errno == IAS_ATTRIB_UNKNOWN)) |
576 | return (-EADDRNOTAVAIL); | 576 | return -EADDRNOTAVAIL; |
577 | else | 577 | else |
578 | return (-EHOSTUNREACH); | 578 | return -EHOSTUNREACH; |
579 | } | 579 | } |
580 | 580 | ||
581 | /* Get the remote TSAP selector */ | 581 | /* Get the remote TSAP selector */ |
@@ -663,7 +663,7 @@ static int irda_discover_daddr_and_lsap_sel(struct irda_sock *self, char *name) | |||
663 | __func__, name); | 663 | __func__, name); |
664 | self->daddr = DEV_ADDR_ANY; | 664 | self->daddr = DEV_ADDR_ANY; |
665 | kfree(discoveries); | 665 | kfree(discoveries); |
666 | return(-ENOTUNIQ); | 666 | return -ENOTUNIQ; |
667 | } | 667 | } |
668 | /* First time we found that one, save it ! */ | 668 | /* First time we found that one, save it ! */ |
669 | daddr = self->daddr; | 669 | daddr = self->daddr; |
@@ -677,7 +677,7 @@ static int irda_discover_daddr_and_lsap_sel(struct irda_sock *self, char *name) | |||
677 | IRDA_DEBUG(0, "%s(), unexpected IAS query failure\n", __func__); | 677 | IRDA_DEBUG(0, "%s(), unexpected IAS query failure\n", __func__); |
678 | self->daddr = DEV_ADDR_ANY; | 678 | self->daddr = DEV_ADDR_ANY; |
679 | kfree(discoveries); | 679 | kfree(discoveries); |
680 | return(-EHOSTUNREACH); | 680 | return -EHOSTUNREACH; |
681 | break; | 681 | break; |
682 | } | 682 | } |
683 | } | 683 | } |
@@ -689,7 +689,7 @@ static int irda_discover_daddr_and_lsap_sel(struct irda_sock *self, char *name) | |||
689 | IRDA_DEBUG(1, "%s(), cannot discover service ''%s'' in any device !!!\n", | 689 | IRDA_DEBUG(1, "%s(), cannot discover service ''%s'' in any device !!!\n", |
690 | __func__, name); | 690 | __func__, name); |
691 | self->daddr = DEV_ADDR_ANY; | 691 | self->daddr = DEV_ADDR_ANY; |
692 | return(-EADDRNOTAVAIL); | 692 | return -EADDRNOTAVAIL; |
693 | } | 693 | } |
694 | 694 | ||
695 | /* Revert back to discovered device & service */ | 695 | /* Revert back to discovered device & service */ |
@@ -715,14 +715,11 @@ static int irda_getname(struct socket *sock, struct sockaddr *uaddr, | |||
715 | struct sockaddr_irda saddr; | 715 | struct sockaddr_irda saddr; |
716 | struct sock *sk = sock->sk; | 716 | struct sock *sk = sock->sk; |
717 | struct irda_sock *self = irda_sk(sk); | 717 | struct irda_sock *self = irda_sk(sk); |
718 | int err; | ||
719 | 718 | ||
720 | lock_kernel(); | ||
721 | memset(&saddr, 0, sizeof(saddr)); | 719 | memset(&saddr, 0, sizeof(saddr)); |
722 | if (peer) { | 720 | if (peer) { |
723 | err = -ENOTCONN; | ||
724 | if (sk->sk_state != TCP_ESTABLISHED) | 721 | if (sk->sk_state != TCP_ESTABLISHED) |
725 | goto out; | 722 | return -ENOTCONN; |
726 | 723 | ||
727 | saddr.sir_family = AF_IRDA; | 724 | saddr.sir_family = AF_IRDA; |
728 | saddr.sir_lsap_sel = self->dtsap_sel; | 725 | saddr.sir_lsap_sel = self->dtsap_sel; |
@@ -739,10 +736,8 @@ static int irda_getname(struct socket *sock, struct sockaddr *uaddr, | |||
739 | /* uaddr_len come to us uninitialised */ | 736 | /* uaddr_len come to us uninitialised */ |
740 | *uaddr_len = sizeof (struct sockaddr_irda); | 737 | *uaddr_len = sizeof (struct sockaddr_irda); |
741 | memcpy(uaddr, &saddr, *uaddr_len); | 738 | memcpy(uaddr, &saddr, *uaddr_len); |
742 | err = 0; | 739 | |
743 | out: | 740 | return 0; |
744 | unlock_kernel(); | ||
745 | return err; | ||
746 | } | 741 | } |
747 | 742 | ||
748 | /* | 743 | /* |
@@ -758,7 +753,8 @@ static int irda_listen(struct socket *sock, int backlog) | |||
758 | 753 | ||
759 | IRDA_DEBUG(2, "%s()\n", __func__); | 754 | IRDA_DEBUG(2, "%s()\n", __func__); |
760 | 755 | ||
761 | lock_kernel(); | 756 | lock_sock(sk); |
757 | |||
762 | if ((sk->sk_type != SOCK_STREAM) && (sk->sk_type != SOCK_SEQPACKET) && | 758 | if ((sk->sk_type != SOCK_STREAM) && (sk->sk_type != SOCK_SEQPACKET) && |
763 | (sk->sk_type != SOCK_DGRAM)) | 759 | (sk->sk_type != SOCK_DGRAM)) |
764 | goto out; | 760 | goto out; |
@@ -770,7 +766,7 @@ static int irda_listen(struct socket *sock, int backlog) | |||
770 | err = 0; | 766 | err = 0; |
771 | } | 767 | } |
772 | out: | 768 | out: |
773 | unlock_kernel(); | 769 | release_sock(sk); |
774 | 770 | ||
775 | return err; | 771 | return err; |
776 | } | 772 | } |
@@ -793,7 +789,7 @@ static int irda_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
793 | if (addr_len != sizeof(struct sockaddr_irda)) | 789 | if (addr_len != sizeof(struct sockaddr_irda)) |
794 | return -EINVAL; | 790 | return -EINVAL; |
795 | 791 | ||
796 | lock_kernel(); | 792 | lock_sock(sk); |
797 | #ifdef CONFIG_IRDA_ULTRA | 793 | #ifdef CONFIG_IRDA_ULTRA |
798 | /* Special care for Ultra sockets */ | 794 | /* Special care for Ultra sockets */ |
799 | if ((sk->sk_type == SOCK_DGRAM) && | 795 | if ((sk->sk_type == SOCK_DGRAM) && |
@@ -836,7 +832,7 @@ static int irda_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
836 | 832 | ||
837 | err = 0; | 833 | err = 0; |
838 | out: | 834 | out: |
839 | unlock_kernel(); | 835 | release_sock(sk); |
840 | return err; | 836 | return err; |
841 | } | 837 | } |
842 | 838 | ||
@@ -856,12 +852,13 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) | |||
856 | 852 | ||
857 | IRDA_DEBUG(2, "%s()\n", __func__); | 853 | IRDA_DEBUG(2, "%s()\n", __func__); |
858 | 854 | ||
859 | lock_kernel(); | ||
860 | err = irda_create(sock_net(sk), newsock, sk->sk_protocol, 0); | 855 | err = irda_create(sock_net(sk), newsock, sk->sk_protocol, 0); |
861 | if (err) | 856 | if (err) |
862 | goto out; | 857 | return err; |
863 | 858 | ||
864 | err = -EINVAL; | 859 | err = -EINVAL; |
860 | |||
861 | lock_sock(sk); | ||
865 | if (sock->state != SS_UNCONNECTED) | 862 | if (sock->state != SS_UNCONNECTED) |
866 | goto out; | 863 | goto out; |
867 | 864 | ||
@@ -947,7 +944,7 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) | |||
947 | irda_connect_response(new); | 944 | irda_connect_response(new); |
948 | err = 0; | 945 | err = 0; |
949 | out: | 946 | out: |
950 | unlock_kernel(); | 947 | release_sock(sk); |
951 | return err; | 948 | return err; |
952 | } | 949 | } |
953 | 950 | ||
@@ -981,7 +978,7 @@ static int irda_connect(struct socket *sock, struct sockaddr *uaddr, | |||
981 | 978 | ||
982 | IRDA_DEBUG(2, "%s(%p)\n", __func__, self); | 979 | IRDA_DEBUG(2, "%s(%p)\n", __func__, self); |
983 | 980 | ||
984 | lock_kernel(); | 981 | lock_sock(sk); |
985 | /* Don't allow connect for Ultra sockets */ | 982 | /* Don't allow connect for Ultra sockets */ |
986 | err = -ESOCKTNOSUPPORT; | 983 | err = -ESOCKTNOSUPPORT; |
987 | if ((sk->sk_type == SOCK_DGRAM) && (sk->sk_protocol == IRDAPROTO_ULTRA)) | 984 | if ((sk->sk_type == SOCK_DGRAM) && (sk->sk_protocol == IRDAPROTO_ULTRA)) |
@@ -1072,6 +1069,8 @@ static int irda_connect(struct socket *sock, struct sockaddr *uaddr, | |||
1072 | 1069 | ||
1073 | if (sk->sk_state != TCP_ESTABLISHED) { | 1070 | if (sk->sk_state != TCP_ESTABLISHED) { |
1074 | sock->state = SS_UNCONNECTED; | 1071 | sock->state = SS_UNCONNECTED; |
1072 | if (sk->sk_prot->disconnect(sk, flags)) | ||
1073 | sock->state = SS_DISCONNECTING; | ||
1075 | err = sock_error(sk); | 1074 | err = sock_error(sk); |
1076 | if (!err) | 1075 | if (!err) |
1077 | err = -ECONNRESET; | 1076 | err = -ECONNRESET; |
@@ -1084,7 +1083,7 @@ static int irda_connect(struct socket *sock, struct sockaddr *uaddr, | |||
1084 | self->saddr = irttp_get_saddr(self->tsap); | 1083 | self->saddr = irttp_get_saddr(self->tsap); |
1085 | err = 0; | 1084 | err = 0; |
1086 | out: | 1085 | out: |
1087 | unlock_kernel(); | 1086 | release_sock(sk); |
1088 | return err; | 1087 | return err; |
1089 | } | 1088 | } |
1090 | 1089 | ||
@@ -1231,7 +1230,6 @@ static int irda_release(struct socket *sock) | |||
1231 | if (sk == NULL) | 1230 | if (sk == NULL) |
1232 | return 0; | 1231 | return 0; |
1233 | 1232 | ||
1234 | lock_kernel(); | ||
1235 | lock_sock(sk); | 1233 | lock_sock(sk); |
1236 | sk->sk_state = TCP_CLOSE; | 1234 | sk->sk_state = TCP_CLOSE; |
1237 | sk->sk_shutdown |= SEND_SHUTDOWN; | 1235 | sk->sk_shutdown |= SEND_SHUTDOWN; |
@@ -1250,7 +1248,6 @@ static int irda_release(struct socket *sock) | |||
1250 | /* Destroy networking socket if we are the last reference on it, | 1248 | /* Destroy networking socket if we are the last reference on it, |
1251 | * i.e. if(sk->sk_refcnt == 0) -> sk_free(sk) */ | 1249 | * i.e. if(sk->sk_refcnt == 0) -> sk_free(sk) */ |
1252 | sock_put(sk); | 1250 | sock_put(sk); |
1253 | unlock_kernel(); | ||
1254 | 1251 | ||
1255 | /* Notes on socket locking and deallocation... - Jean II | 1252 | /* Notes on socket locking and deallocation... - Jean II |
1256 | * In theory we should put pairs of sock_hold() / sock_put() to | 1253 | * In theory we should put pairs of sock_hold() / sock_put() to |
@@ -1298,7 +1295,6 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1298 | 1295 | ||
1299 | IRDA_DEBUG(4, "%s(), len=%zd\n", __func__, len); | 1296 | IRDA_DEBUG(4, "%s(), len=%zd\n", __func__, len); |
1300 | 1297 | ||
1301 | lock_kernel(); | ||
1302 | /* Note : socket.c set MSG_EOR on SEQPACKET sockets */ | 1298 | /* Note : socket.c set MSG_EOR on SEQPACKET sockets */ |
1303 | if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_EOR | MSG_CMSG_COMPAT | | 1299 | if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_EOR | MSG_CMSG_COMPAT | |
1304 | MSG_NOSIGNAL)) { | 1300 | MSG_NOSIGNAL)) { |
@@ -1306,6 +1302,8 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1306 | goto out; | 1302 | goto out; |
1307 | } | 1303 | } |
1308 | 1304 | ||
1305 | lock_sock(sk); | ||
1306 | |||
1309 | if (sk->sk_shutdown & SEND_SHUTDOWN) | 1307 | if (sk->sk_shutdown & SEND_SHUTDOWN) |
1310 | goto out_err; | 1308 | goto out_err; |
1311 | 1309 | ||
@@ -1361,14 +1359,14 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1361 | goto out_err; | 1359 | goto out_err; |
1362 | } | 1360 | } |
1363 | 1361 | ||
1364 | unlock_kernel(); | 1362 | release_sock(sk); |
1365 | /* Tell client how much data we actually sent */ | 1363 | /* Tell client how much data we actually sent */ |
1366 | return len; | 1364 | return len; |
1367 | 1365 | ||
1368 | out_err: | 1366 | out_err: |
1369 | err = sk_stream_error(sk, msg->msg_flags, err); | 1367 | err = sk_stream_error(sk, msg->msg_flags, err); |
1370 | out: | 1368 | out: |
1371 | unlock_kernel(); | 1369 | release_sock(sk); |
1372 | return err; | 1370 | return err; |
1373 | 1371 | ||
1374 | } | 1372 | } |
@@ -1390,14 +1388,10 @@ static int irda_recvmsg_dgram(struct kiocb *iocb, struct socket *sock, | |||
1390 | 1388 | ||
1391 | IRDA_DEBUG(4, "%s()\n", __func__); | 1389 | IRDA_DEBUG(4, "%s()\n", __func__); |
1392 | 1390 | ||
1393 | lock_kernel(); | ||
1394 | if ((err = sock_error(sk)) < 0) | ||
1395 | goto out; | ||
1396 | |||
1397 | skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, | 1391 | skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, |
1398 | flags & MSG_DONTWAIT, &err); | 1392 | flags & MSG_DONTWAIT, &err); |
1399 | if (!skb) | 1393 | if (!skb) |
1400 | goto out; | 1394 | return err; |
1401 | 1395 | ||
1402 | skb_reset_transport_header(skb); | 1396 | skb_reset_transport_header(skb); |
1403 | copied = skb->len; | 1397 | copied = skb->len; |
@@ -1425,12 +1419,8 @@ static int irda_recvmsg_dgram(struct kiocb *iocb, struct socket *sock, | |||
1425 | irttp_flow_request(self->tsap, FLOW_START); | 1419 | irttp_flow_request(self->tsap, FLOW_START); |
1426 | } | 1420 | } |
1427 | } | 1421 | } |
1428 | unlock_kernel(); | ||
1429 | return copied; | ||
1430 | 1422 | ||
1431 | out: | 1423 | return copied; |
1432 | unlock_kernel(); | ||
1433 | return err; | ||
1434 | } | 1424 | } |
1435 | 1425 | ||
1436 | /* | 1426 | /* |
@@ -1448,17 +1438,15 @@ static int irda_recvmsg_stream(struct kiocb *iocb, struct socket *sock, | |||
1448 | 1438 | ||
1449 | IRDA_DEBUG(3, "%s()\n", __func__); | 1439 | IRDA_DEBUG(3, "%s()\n", __func__); |
1450 | 1440 | ||
1451 | lock_kernel(); | ||
1452 | if ((err = sock_error(sk)) < 0) | 1441 | if ((err = sock_error(sk)) < 0) |
1453 | goto out; | 1442 | return err; |
1454 | 1443 | ||
1455 | err = -EINVAL; | ||
1456 | if (sock->flags & __SO_ACCEPTCON) | 1444 | if (sock->flags & __SO_ACCEPTCON) |
1457 | goto out; | 1445 | return -EINVAL; |
1458 | 1446 | ||
1459 | err =-EOPNOTSUPP; | 1447 | err =-EOPNOTSUPP; |
1460 | if (flags & MSG_OOB) | 1448 | if (flags & MSG_OOB) |
1461 | goto out; | 1449 | return -EOPNOTSUPP; |
1462 | 1450 | ||
1463 | err = 0; | 1451 | err = 0; |
1464 | target = sock_rcvlowat(sk, flags & MSG_WAITALL, size); | 1452 | target = sock_rcvlowat(sk, flags & MSG_WAITALL, size); |
@@ -1500,7 +1488,7 @@ static int irda_recvmsg_stream(struct kiocb *iocb, struct socket *sock, | |||
1500 | finish_wait(sk_sleep(sk), &wait); | 1488 | finish_wait(sk_sleep(sk), &wait); |
1501 | 1489 | ||
1502 | if (err) | 1490 | if (err) |
1503 | goto out; | 1491 | return err; |
1504 | if (sk->sk_shutdown & RCV_SHUTDOWN) | 1492 | if (sk->sk_shutdown & RCV_SHUTDOWN) |
1505 | break; | 1493 | break; |
1506 | 1494 | ||
@@ -1553,9 +1541,7 @@ static int irda_recvmsg_stream(struct kiocb *iocb, struct socket *sock, | |||
1553 | } | 1541 | } |
1554 | } | 1542 | } |
1555 | 1543 | ||
1556 | out: | 1544 | return copied; |
1557 | unlock_kernel(); | ||
1558 | return err ? : copied; | ||
1559 | } | 1545 | } |
1560 | 1546 | ||
1561 | /* | 1547 | /* |
@@ -1573,13 +1559,12 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock, | |||
1573 | struct sk_buff *skb; | 1559 | struct sk_buff *skb; |
1574 | int err; | 1560 | int err; |
1575 | 1561 | ||
1576 | lock_kernel(); | ||
1577 | |||
1578 | IRDA_DEBUG(4, "%s(), len=%zd\n", __func__, len); | 1562 | IRDA_DEBUG(4, "%s(), len=%zd\n", __func__, len); |
1579 | 1563 | ||
1580 | err = -EINVAL; | ||
1581 | if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) | 1564 | if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) |
1582 | goto out; | 1565 | return -EINVAL; |
1566 | |||
1567 | lock_sock(sk); | ||
1583 | 1568 | ||
1584 | if (sk->sk_shutdown & SEND_SHUTDOWN) { | 1569 | if (sk->sk_shutdown & SEND_SHUTDOWN) { |
1585 | send_sig(SIGPIPE, current, 0); | 1570 | send_sig(SIGPIPE, current, 0); |
@@ -1630,10 +1615,12 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock, | |||
1630 | IRDA_DEBUG(0, "%s(), err=%d\n", __func__, err); | 1615 | IRDA_DEBUG(0, "%s(), err=%d\n", __func__, err); |
1631 | goto out; | 1616 | goto out; |
1632 | } | 1617 | } |
1633 | unlock_kernel(); | 1618 | |
1619 | release_sock(sk); | ||
1634 | return len; | 1620 | return len; |
1621 | |||
1635 | out: | 1622 | out: |
1636 | unlock_kernel(); | 1623 | release_sock(sk); |
1637 | return err; | 1624 | return err; |
1638 | } | 1625 | } |
1639 | 1626 | ||
@@ -1656,10 +1643,11 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock, | |||
1656 | 1643 | ||
1657 | IRDA_DEBUG(4, "%s(), len=%zd\n", __func__, len); | 1644 | IRDA_DEBUG(4, "%s(), len=%zd\n", __func__, len); |
1658 | 1645 | ||
1659 | lock_kernel(); | ||
1660 | err = -EINVAL; | 1646 | err = -EINVAL; |
1661 | if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) | 1647 | if (msg->msg_flags & ~(MSG_DONTWAIT|MSG_CMSG_COMPAT)) |
1662 | goto out; | 1648 | return -EINVAL; |
1649 | |||
1650 | lock_sock(sk); | ||
1663 | 1651 | ||
1664 | err = -EPIPE; | 1652 | err = -EPIPE; |
1665 | if (sk->sk_shutdown & SEND_SHUTDOWN) { | 1653 | if (sk->sk_shutdown & SEND_SHUTDOWN) { |
@@ -1732,7 +1720,7 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock, | |||
1732 | if (err) | 1720 | if (err) |
1733 | IRDA_DEBUG(0, "%s(), err=%d\n", __func__, err); | 1721 | IRDA_DEBUG(0, "%s(), err=%d\n", __func__, err); |
1734 | out: | 1722 | out: |
1735 | unlock_kernel(); | 1723 | release_sock(sk); |
1736 | return err ? : len; | 1724 | return err ? : len; |
1737 | } | 1725 | } |
1738 | #endif /* CONFIG_IRDA_ULTRA */ | 1726 | #endif /* CONFIG_IRDA_ULTRA */ |
@@ -1747,7 +1735,7 @@ static int irda_shutdown(struct socket *sock, int how) | |||
1747 | 1735 | ||
1748 | IRDA_DEBUG(1, "%s(%p)\n", __func__, self); | 1736 | IRDA_DEBUG(1, "%s(%p)\n", __func__, self); |
1749 | 1737 | ||
1750 | lock_kernel(); | 1738 | lock_sock(sk); |
1751 | 1739 | ||
1752 | sk->sk_state = TCP_CLOSE; | 1740 | sk->sk_state = TCP_CLOSE; |
1753 | sk->sk_shutdown |= SEND_SHUTDOWN; | 1741 | sk->sk_shutdown |= SEND_SHUTDOWN; |
@@ -1769,7 +1757,7 @@ static int irda_shutdown(struct socket *sock, int how) | |||
1769 | self->daddr = DEV_ADDR_ANY; /* Until we get re-connected */ | 1757 | self->daddr = DEV_ADDR_ANY; /* Until we get re-connected */ |
1770 | self->saddr = 0x0; /* so IrLMP assign us any link */ | 1758 | self->saddr = 0x0; /* so IrLMP assign us any link */ |
1771 | 1759 | ||
1772 | unlock_kernel(); | 1760 | release_sock(sk); |
1773 | 1761 | ||
1774 | return 0; | 1762 | return 0; |
1775 | } | 1763 | } |
@@ -1786,7 +1774,6 @@ static unsigned int irda_poll(struct file * file, struct socket *sock, | |||
1786 | 1774 | ||
1787 | IRDA_DEBUG(4, "%s()\n", __func__); | 1775 | IRDA_DEBUG(4, "%s()\n", __func__); |
1788 | 1776 | ||
1789 | lock_kernel(); | ||
1790 | poll_wait(file, sk_sleep(sk), wait); | 1777 | poll_wait(file, sk_sleep(sk), wait); |
1791 | mask = 0; | 1778 | mask = 0; |
1792 | 1779 | ||
@@ -1834,20 +1821,8 @@ static unsigned int irda_poll(struct file * file, struct socket *sock, | |||
1834 | default: | 1821 | default: |
1835 | break; | 1822 | break; |
1836 | } | 1823 | } |
1837 | unlock_kernel(); | ||
1838 | return mask; | ||
1839 | } | ||
1840 | 1824 | ||
1841 | static unsigned int irda_datagram_poll(struct file *file, struct socket *sock, | 1825 | return mask; |
1842 | poll_table *wait) | ||
1843 | { | ||
1844 | int err; | ||
1845 | |||
1846 | lock_kernel(); | ||
1847 | err = datagram_poll(file, sock, wait); | ||
1848 | unlock_kernel(); | ||
1849 | |||
1850 | return err; | ||
1851 | } | 1826 | } |
1852 | 1827 | ||
1853 | /* | 1828 | /* |
@@ -1860,7 +1835,6 @@ static int irda_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1860 | 1835 | ||
1861 | IRDA_DEBUG(4, "%s(), cmd=%#x\n", __func__, cmd); | 1836 | IRDA_DEBUG(4, "%s(), cmd=%#x\n", __func__, cmd); |
1862 | 1837 | ||
1863 | lock_kernel(); | ||
1864 | err = -EINVAL; | 1838 | err = -EINVAL; |
1865 | switch (cmd) { | 1839 | switch (cmd) { |
1866 | case TIOCOUTQ: { | 1840 | case TIOCOUTQ: { |
@@ -1903,7 +1877,6 @@ static int irda_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) | |||
1903 | IRDA_DEBUG(1, "%s(), doing device ioctl!\n", __func__); | 1877 | IRDA_DEBUG(1, "%s(), doing device ioctl!\n", __func__); |
1904 | err = -ENOIOCTLCMD; | 1878 | err = -ENOIOCTLCMD; |
1905 | } | 1879 | } |
1906 | unlock_kernel(); | ||
1907 | 1880 | ||
1908 | return err; | 1881 | return err; |
1909 | } | 1882 | } |
@@ -1927,7 +1900,7 @@ static int irda_compat_ioctl(struct socket *sock, unsigned int cmd, unsigned lon | |||
1927 | * Set some options for the socket | 1900 | * Set some options for the socket |
1928 | * | 1901 | * |
1929 | */ | 1902 | */ |
1930 | static int __irda_setsockopt(struct socket *sock, int level, int optname, | 1903 | static int irda_setsockopt(struct socket *sock, int level, int optname, |
1931 | char __user *optval, unsigned int optlen) | 1904 | char __user *optval, unsigned int optlen) |
1932 | { | 1905 | { |
1933 | struct sock *sk = sock->sk; | 1906 | struct sock *sk = sock->sk; |
@@ -1935,13 +1908,15 @@ static int __irda_setsockopt(struct socket *sock, int level, int optname, | |||
1935 | struct irda_ias_set *ias_opt; | 1908 | struct irda_ias_set *ias_opt; |
1936 | struct ias_object *ias_obj; | 1909 | struct ias_object *ias_obj; |
1937 | struct ias_attrib * ias_attr; /* Attribute in IAS object */ | 1910 | struct ias_attrib * ias_attr; /* Attribute in IAS object */ |
1938 | int opt, free_ias = 0; | 1911 | int opt, free_ias = 0, err = 0; |
1939 | 1912 | ||
1940 | IRDA_DEBUG(2, "%s(%p)\n", __func__, self); | 1913 | IRDA_DEBUG(2, "%s(%p)\n", __func__, self); |
1941 | 1914 | ||
1942 | if (level != SOL_IRLMP) | 1915 | if (level != SOL_IRLMP) |
1943 | return -ENOPROTOOPT; | 1916 | return -ENOPROTOOPT; |
1944 | 1917 | ||
1918 | lock_sock(sk); | ||
1919 | |||
1945 | switch (optname) { | 1920 | switch (optname) { |
1946 | case IRLMP_IAS_SET: | 1921 | case IRLMP_IAS_SET: |
1947 | /* The user want to add an attribute to an existing IAS object | 1922 | /* The user want to add an attribute to an existing IAS object |
@@ -1951,17 +1926,22 @@ static int __irda_setsockopt(struct socket *sock, int level, int optname, | |||
1951 | * create the right attribute... | 1926 | * create the right attribute... |
1952 | */ | 1927 | */ |
1953 | 1928 | ||
1954 | if (optlen != sizeof(struct irda_ias_set)) | 1929 | if (optlen != sizeof(struct irda_ias_set)) { |
1955 | return -EINVAL; | 1930 | err = -EINVAL; |
1931 | goto out; | ||
1932 | } | ||
1956 | 1933 | ||
1957 | ias_opt = kmalloc(sizeof(struct irda_ias_set), GFP_ATOMIC); | 1934 | ias_opt = kmalloc(sizeof(struct irda_ias_set), GFP_ATOMIC); |
1958 | if (ias_opt == NULL) | 1935 | if (ias_opt == NULL) { |
1959 | return -ENOMEM; | 1936 | err = -ENOMEM; |
1937 | goto out; | ||
1938 | } | ||
1960 | 1939 | ||
1961 | /* Copy query to the driver. */ | 1940 | /* Copy query to the driver. */ |
1962 | if (copy_from_user(ias_opt, optval, optlen)) { | 1941 | if (copy_from_user(ias_opt, optval, optlen)) { |
1963 | kfree(ias_opt); | 1942 | kfree(ias_opt); |
1964 | return -EFAULT; | 1943 | err = -EFAULT; |
1944 | goto out; | ||
1965 | } | 1945 | } |
1966 | 1946 | ||
1967 | /* Find the object we target. | 1947 | /* Find the object we target. |
@@ -1971,7 +1951,8 @@ static int __irda_setsockopt(struct socket *sock, int level, int optname, | |||
1971 | if(ias_opt->irda_class_name[0] == '\0') { | 1951 | if(ias_opt->irda_class_name[0] == '\0') { |
1972 | if(self->ias_obj == NULL) { | 1952 | if(self->ias_obj == NULL) { |
1973 | kfree(ias_opt); | 1953 | kfree(ias_opt); |
1974 | return -EINVAL; | 1954 | err = -EINVAL; |
1955 | goto out; | ||
1975 | } | 1956 | } |
1976 | ias_obj = self->ias_obj; | 1957 | ias_obj = self->ias_obj; |
1977 | } else | 1958 | } else |
@@ -1983,7 +1964,8 @@ static int __irda_setsockopt(struct socket *sock, int level, int optname, | |||
1983 | if((!capable(CAP_NET_ADMIN)) && | 1964 | if((!capable(CAP_NET_ADMIN)) && |
1984 | ((ias_obj == NULL) || (ias_obj != self->ias_obj))) { | 1965 | ((ias_obj == NULL) || (ias_obj != self->ias_obj))) { |
1985 | kfree(ias_opt); | 1966 | kfree(ias_opt); |
1986 | return -EPERM; | 1967 | err = -EPERM; |
1968 | goto out; | ||
1987 | } | 1969 | } |
1988 | 1970 | ||
1989 | /* If the object doesn't exist, create it */ | 1971 | /* If the object doesn't exist, create it */ |
@@ -1993,7 +1975,8 @@ static int __irda_setsockopt(struct socket *sock, int level, int optname, | |||
1993 | jiffies); | 1975 | jiffies); |
1994 | if (ias_obj == NULL) { | 1976 | if (ias_obj == NULL) { |
1995 | kfree(ias_opt); | 1977 | kfree(ias_opt); |
1996 | return -ENOMEM; | 1978 | err = -ENOMEM; |
1979 | goto out; | ||
1997 | } | 1980 | } |
1998 | free_ias = 1; | 1981 | free_ias = 1; |
1999 | } | 1982 | } |
@@ -2005,7 +1988,8 @@ static int __irda_setsockopt(struct socket *sock, int level, int optname, | |||
2005 | kfree(ias_obj->name); | 1988 | kfree(ias_obj->name); |
2006 | kfree(ias_obj); | 1989 | kfree(ias_obj); |
2007 | } | 1990 | } |
2008 | return -EINVAL; | 1991 | err = -EINVAL; |
1992 | goto out; | ||
2009 | } | 1993 | } |
2010 | 1994 | ||
2011 | /* Look at the type */ | 1995 | /* Look at the type */ |
@@ -2028,7 +2012,8 @@ static int __irda_setsockopt(struct socket *sock, int level, int optname, | |||
2028 | kfree(ias_obj); | 2012 | kfree(ias_obj); |
2029 | } | 2013 | } |
2030 | 2014 | ||
2031 | return -EINVAL; | 2015 | err = -EINVAL; |
2016 | goto out; | ||
2032 | } | 2017 | } |
2033 | /* Add an octet sequence attribute */ | 2018 | /* Add an octet sequence attribute */ |
2034 | irias_add_octseq_attrib( | 2019 | irias_add_octseq_attrib( |
@@ -2060,7 +2045,8 @@ static int __irda_setsockopt(struct socket *sock, int level, int optname, | |||
2060 | kfree(ias_obj->name); | 2045 | kfree(ias_obj->name); |
2061 | kfree(ias_obj); | 2046 | kfree(ias_obj); |
2062 | } | 2047 | } |
2063 | return -EINVAL; | 2048 | err = -EINVAL; |
2049 | goto out; | ||
2064 | } | 2050 | } |
2065 | irias_insert_object(ias_obj); | 2051 | irias_insert_object(ias_obj); |
2066 | kfree(ias_opt); | 2052 | kfree(ias_opt); |
@@ -2071,17 +2057,22 @@ static int __irda_setsockopt(struct socket *sock, int level, int optname, | |||
2071 | * object is not owned by the kernel and delete it. | 2057 | * object is not owned by the kernel and delete it. |
2072 | */ | 2058 | */ |
2073 | 2059 | ||
2074 | if (optlen != sizeof(struct irda_ias_set)) | 2060 | if (optlen != sizeof(struct irda_ias_set)) { |
2075 | return -EINVAL; | 2061 | err = -EINVAL; |
2062 | goto out; | ||
2063 | } | ||
2076 | 2064 | ||
2077 | ias_opt = kmalloc(sizeof(struct irda_ias_set), GFP_ATOMIC); | 2065 | ias_opt = kmalloc(sizeof(struct irda_ias_set), GFP_ATOMIC); |
2078 | if (ias_opt == NULL) | 2066 | if (ias_opt == NULL) { |
2079 | return -ENOMEM; | 2067 | err = -ENOMEM; |
2068 | goto out; | ||
2069 | } | ||
2080 | 2070 | ||
2081 | /* Copy query to the driver. */ | 2071 | /* Copy query to the driver. */ |
2082 | if (copy_from_user(ias_opt, optval, optlen)) { | 2072 | if (copy_from_user(ias_opt, optval, optlen)) { |
2083 | kfree(ias_opt); | 2073 | kfree(ias_opt); |
2084 | return -EFAULT; | 2074 | err = -EFAULT; |
2075 | goto out; | ||
2085 | } | 2076 | } |
2086 | 2077 | ||
2087 | /* Find the object we target. | 2078 | /* Find the object we target. |
@@ -2094,7 +2085,8 @@ static int __irda_setsockopt(struct socket *sock, int level, int optname, | |||
2094 | ias_obj = irias_find_object(ias_opt->irda_class_name); | 2085 | ias_obj = irias_find_object(ias_opt->irda_class_name); |
2095 | if(ias_obj == (struct ias_object *) NULL) { | 2086 | if(ias_obj == (struct ias_object *) NULL) { |
2096 | kfree(ias_opt); | 2087 | kfree(ias_opt); |
2097 | return -EINVAL; | 2088 | err = -EINVAL; |
2089 | goto out; | ||
2098 | } | 2090 | } |
2099 | 2091 | ||
2100 | /* Only ROOT can mess with the global IAS database. | 2092 | /* Only ROOT can mess with the global IAS database. |
@@ -2103,7 +2095,8 @@ static int __irda_setsockopt(struct socket *sock, int level, int optname, | |||
2103 | if((!capable(CAP_NET_ADMIN)) && | 2095 | if((!capable(CAP_NET_ADMIN)) && |
2104 | ((ias_obj == NULL) || (ias_obj != self->ias_obj))) { | 2096 | ((ias_obj == NULL) || (ias_obj != self->ias_obj))) { |
2105 | kfree(ias_opt); | 2097 | kfree(ias_opt); |
2106 | return -EPERM; | 2098 | err = -EPERM; |
2099 | goto out; | ||
2107 | } | 2100 | } |
2108 | 2101 | ||
2109 | /* Find the attribute (in the object) we target */ | 2102 | /* Find the attribute (in the object) we target */ |
@@ -2111,14 +2104,16 @@ static int __irda_setsockopt(struct socket *sock, int level, int optname, | |||
2111 | ias_opt->irda_attrib_name); | 2104 | ias_opt->irda_attrib_name); |
2112 | if(ias_attr == (struct ias_attrib *) NULL) { | 2105 | if(ias_attr == (struct ias_attrib *) NULL) { |
2113 | kfree(ias_opt); | 2106 | kfree(ias_opt); |
2114 | return -EINVAL; | 2107 | err = -EINVAL; |
2108 | goto out; | ||
2115 | } | 2109 | } |
2116 | 2110 | ||
2117 | /* Check is the user space own the object */ | 2111 | /* Check is the user space own the object */ |
2118 | if(ias_attr->value->owner != IAS_USER_ATTR) { | 2112 | if(ias_attr->value->owner != IAS_USER_ATTR) { |
2119 | IRDA_DEBUG(1, "%s(), attempting to delete a kernel attribute\n", __func__); | 2113 | IRDA_DEBUG(1, "%s(), attempting to delete a kernel attribute\n", __func__); |
2120 | kfree(ias_opt); | 2114 | kfree(ias_opt); |
2121 | return -EPERM; | 2115 | err = -EPERM; |
2116 | goto out; | ||
2122 | } | 2117 | } |
2123 | 2118 | ||
2124 | /* Remove the attribute (and maybe the object) */ | 2119 | /* Remove the attribute (and maybe the object) */ |
@@ -2126,11 +2121,15 @@ static int __irda_setsockopt(struct socket *sock, int level, int optname, | |||
2126 | kfree(ias_opt); | 2121 | kfree(ias_opt); |
2127 | break; | 2122 | break; |
2128 | case IRLMP_MAX_SDU_SIZE: | 2123 | case IRLMP_MAX_SDU_SIZE: |
2129 | if (optlen < sizeof(int)) | 2124 | if (optlen < sizeof(int)) { |
2130 | return -EINVAL; | 2125 | err = -EINVAL; |
2126 | goto out; | ||
2127 | } | ||
2131 | 2128 | ||
2132 | if (get_user(opt, (int __user *)optval)) | 2129 | if (get_user(opt, (int __user *)optval)) { |
2133 | return -EFAULT; | 2130 | err = -EFAULT; |
2131 | goto out; | ||
2132 | } | ||
2134 | 2133 | ||
2135 | /* Only possible for a seqpacket service (TTP with SAR) */ | 2134 | /* Only possible for a seqpacket service (TTP with SAR) */ |
2136 | if (sk->sk_type != SOCK_SEQPACKET) { | 2135 | if (sk->sk_type != SOCK_SEQPACKET) { |
@@ -2140,16 +2139,21 @@ static int __irda_setsockopt(struct socket *sock, int level, int optname, | |||
2140 | } else { | 2139 | } else { |
2141 | IRDA_WARNING("%s: not allowed to set MAXSDUSIZE for this socket type!\n", | 2140 | IRDA_WARNING("%s: not allowed to set MAXSDUSIZE for this socket type!\n", |
2142 | __func__); | 2141 | __func__); |
2143 | return -ENOPROTOOPT; | 2142 | err = -ENOPROTOOPT; |
2143 | goto out; | ||
2144 | } | 2144 | } |
2145 | break; | 2145 | break; |
2146 | case IRLMP_HINTS_SET: | 2146 | case IRLMP_HINTS_SET: |
2147 | if (optlen < sizeof(int)) | 2147 | if (optlen < sizeof(int)) { |
2148 | return -EINVAL; | 2148 | err = -EINVAL; |
2149 | goto out; | ||
2150 | } | ||
2149 | 2151 | ||
2150 | /* The input is really a (__u8 hints[2]), easier as an int */ | 2152 | /* The input is really a (__u8 hints[2]), easier as an int */ |
2151 | if (get_user(opt, (int __user *)optval)) | 2153 | if (get_user(opt, (int __user *)optval)) { |
2152 | return -EFAULT; | 2154 | err = -EFAULT; |
2155 | goto out; | ||
2156 | } | ||
2153 | 2157 | ||
2154 | /* Unregister any old registration */ | 2158 | /* Unregister any old registration */ |
2155 | if (self->skey) | 2159 | if (self->skey) |
@@ -2163,12 +2167,16 @@ static int __irda_setsockopt(struct socket *sock, int level, int optname, | |||
2163 | * making a discovery (nodes which don't match any hint | 2167 | * making a discovery (nodes which don't match any hint |
2164 | * bit in the mask are not reported). | 2168 | * bit in the mask are not reported). |
2165 | */ | 2169 | */ |
2166 | if (optlen < sizeof(int)) | 2170 | if (optlen < sizeof(int)) { |
2167 | return -EINVAL; | 2171 | err = -EINVAL; |
2172 | goto out; | ||
2173 | } | ||
2168 | 2174 | ||
2169 | /* The input is really a (__u8 hints[2]), easier as an int */ | 2175 | /* The input is really a (__u8 hints[2]), easier as an int */ |
2170 | if (get_user(opt, (int __user *)optval)) | 2176 | if (get_user(opt, (int __user *)optval)) { |
2171 | return -EFAULT; | 2177 | err = -EFAULT; |
2178 | goto out; | ||
2179 | } | ||
2172 | 2180 | ||
2173 | /* Set the new hint mask */ | 2181 | /* Set the new hint mask */ |
2174 | self->mask.word = (__u16) opt; | 2182 | self->mask.word = (__u16) opt; |
@@ -2180,19 +2188,12 @@ static int __irda_setsockopt(struct socket *sock, int level, int optname, | |||
2180 | 2188 | ||
2181 | break; | 2189 | break; |
2182 | default: | 2190 | default: |
2183 | return -ENOPROTOOPT; | 2191 | err = -ENOPROTOOPT; |
2192 | break; | ||
2184 | } | 2193 | } |
2185 | return 0; | ||
2186 | } | ||
2187 | 2194 | ||
2188 | static int irda_setsockopt(struct socket *sock, int level, int optname, | 2195 | out: |
2189 | char __user *optval, unsigned int optlen) | 2196 | release_sock(sk); |
2190 | { | ||
2191 | int err; | ||
2192 | |||
2193 | lock_kernel(); | ||
2194 | err = __irda_setsockopt(sock, level, optname, optval, optlen); | ||
2195 | unlock_kernel(); | ||
2196 | 2197 | ||
2197 | return err; | 2198 | return err; |
2198 | } | 2199 | } |
@@ -2249,7 +2250,7 @@ static int irda_extract_ias_value(struct irda_ias_set *ias_opt, | |||
2249 | /* | 2250 | /* |
2250 | * Function irda_getsockopt (sock, level, optname, optval, optlen) | 2251 | * Function irda_getsockopt (sock, level, optname, optval, optlen) |
2251 | */ | 2252 | */ |
2252 | static int __irda_getsockopt(struct socket *sock, int level, int optname, | 2253 | static int irda_getsockopt(struct socket *sock, int level, int optname, |
2253 | char __user *optval, int __user *optlen) | 2254 | char __user *optval, int __user *optlen) |
2254 | { | 2255 | { |
2255 | struct sock *sk = sock->sk; | 2256 | struct sock *sk = sock->sk; |
@@ -2262,7 +2263,7 @@ static int __irda_getsockopt(struct socket *sock, int level, int optname, | |||
2262 | int daddr = DEV_ADDR_ANY; /* Dest address for IAS queries */ | 2263 | int daddr = DEV_ADDR_ANY; /* Dest address for IAS queries */ |
2263 | int val = 0; | 2264 | int val = 0; |
2264 | int len = 0; | 2265 | int len = 0; |
2265 | int err; | 2266 | int err = 0; |
2266 | int offset, total; | 2267 | int offset, total; |
2267 | 2268 | ||
2268 | IRDA_DEBUG(2, "%s(%p)\n", __func__, self); | 2269 | IRDA_DEBUG(2, "%s(%p)\n", __func__, self); |
@@ -2276,15 +2277,18 @@ static int __irda_getsockopt(struct socket *sock, int level, int optname, | |||
2276 | if(len < 0) | 2277 | if(len < 0) |
2277 | return -EINVAL; | 2278 | return -EINVAL; |
2278 | 2279 | ||
2280 | lock_sock(sk); | ||
2281 | |||
2279 | switch (optname) { | 2282 | switch (optname) { |
2280 | case IRLMP_ENUMDEVICES: | 2283 | case IRLMP_ENUMDEVICES: |
2281 | /* Ask lmp for the current discovery log */ | 2284 | /* Ask lmp for the current discovery log */ |
2282 | discoveries = irlmp_get_discoveries(&list.len, self->mask.word, | 2285 | discoveries = irlmp_get_discoveries(&list.len, self->mask.word, |
2283 | self->nslots); | 2286 | self->nslots); |
2284 | /* Check if the we got some results */ | 2287 | /* Check if the we got some results */ |
2285 | if (discoveries == NULL) | 2288 | if (discoveries == NULL) { |
2286 | return -EAGAIN; /* Didn't find any devices */ | 2289 | err = -EAGAIN; |
2287 | err = 0; | 2290 | goto out; /* Didn't find any devices */ |
2291 | } | ||
2288 | 2292 | ||
2289 | /* Write total list length back to client */ | 2293 | /* Write total list length back to client */ |
2290 | if (copy_to_user(optval, &list, | 2294 | if (copy_to_user(optval, &list, |
@@ -2297,8 +2301,7 @@ static int __irda_getsockopt(struct socket *sock, int level, int optname, | |||
2297 | sizeof(struct irda_device_info); | 2301 | sizeof(struct irda_device_info); |
2298 | 2302 | ||
2299 | /* Copy the list itself - watch for overflow */ | 2303 | /* Copy the list itself - watch for overflow */ |
2300 | if(list.len > 2048) | 2304 | if (list.len > 2048) { |
2301 | { | ||
2302 | err = -EINVAL; | 2305 | err = -EINVAL; |
2303 | goto bed; | 2306 | goto bed; |
2304 | } | 2307 | } |
@@ -2314,17 +2317,20 @@ static int __irda_getsockopt(struct socket *sock, int level, int optname, | |||
2314 | bed: | 2317 | bed: |
2315 | /* Free up our buffer */ | 2318 | /* Free up our buffer */ |
2316 | kfree(discoveries); | 2319 | kfree(discoveries); |
2317 | if (err) | ||
2318 | return err; | ||
2319 | break; | 2320 | break; |
2320 | case IRLMP_MAX_SDU_SIZE: | 2321 | case IRLMP_MAX_SDU_SIZE: |
2321 | val = self->max_data_size; | 2322 | val = self->max_data_size; |
2322 | len = sizeof(int); | 2323 | len = sizeof(int); |
2323 | if (put_user(len, optlen)) | 2324 | if (put_user(len, optlen)) { |
2324 | return -EFAULT; | 2325 | err = -EFAULT; |
2326 | goto out; | ||
2327 | } | ||
2328 | |||
2329 | if (copy_to_user(optval, &val, len)) { | ||
2330 | err = -EFAULT; | ||
2331 | goto out; | ||
2332 | } | ||
2325 | 2333 | ||
2326 | if (copy_to_user(optval, &val, len)) | ||
2327 | return -EFAULT; | ||
2328 | break; | 2334 | break; |
2329 | case IRLMP_IAS_GET: | 2335 | case IRLMP_IAS_GET: |
2330 | /* The user want an object from our local IAS database. | 2336 | /* The user want an object from our local IAS database. |
@@ -2332,17 +2338,22 @@ bed: | |||
2332 | * that we found */ | 2338 | * that we found */ |
2333 | 2339 | ||
2334 | /* Check that the user has allocated the right space for us */ | 2340 | /* Check that the user has allocated the right space for us */ |
2335 | if (len != sizeof(struct irda_ias_set)) | 2341 | if (len != sizeof(struct irda_ias_set)) { |
2336 | return -EINVAL; | 2342 | err = -EINVAL; |
2343 | goto out; | ||
2344 | } | ||
2337 | 2345 | ||
2338 | ias_opt = kmalloc(sizeof(struct irda_ias_set), GFP_ATOMIC); | 2346 | ias_opt = kmalloc(sizeof(struct irda_ias_set), GFP_ATOMIC); |
2339 | if (ias_opt == NULL) | 2347 | if (ias_opt == NULL) { |
2340 | return -ENOMEM; | 2348 | err = -ENOMEM; |
2349 | goto out; | ||
2350 | } | ||
2341 | 2351 | ||
2342 | /* Copy query to the driver. */ | 2352 | /* Copy query to the driver. */ |
2343 | if (copy_from_user(ias_opt, optval, len)) { | 2353 | if (copy_from_user(ias_opt, optval, len)) { |
2344 | kfree(ias_opt); | 2354 | kfree(ias_opt); |
2345 | return -EFAULT; | 2355 | err = -EFAULT; |
2356 | goto out; | ||
2346 | } | 2357 | } |
2347 | 2358 | ||
2348 | /* Find the object we target. | 2359 | /* Find the object we target. |
@@ -2355,7 +2366,8 @@ bed: | |||
2355 | ias_obj = irias_find_object(ias_opt->irda_class_name); | 2366 | ias_obj = irias_find_object(ias_opt->irda_class_name); |
2356 | if(ias_obj == (struct ias_object *) NULL) { | 2367 | if(ias_obj == (struct ias_object *) NULL) { |
2357 | kfree(ias_opt); | 2368 | kfree(ias_opt); |
2358 | return -EINVAL; | 2369 | err = -EINVAL; |
2370 | goto out; | ||
2359 | } | 2371 | } |
2360 | 2372 | ||
2361 | /* Find the attribute (in the object) we target */ | 2373 | /* Find the attribute (in the object) we target */ |
@@ -2363,21 +2375,23 @@ bed: | |||
2363 | ias_opt->irda_attrib_name); | 2375 | ias_opt->irda_attrib_name); |
2364 | if(ias_attr == (struct ias_attrib *) NULL) { | 2376 | if(ias_attr == (struct ias_attrib *) NULL) { |
2365 | kfree(ias_opt); | 2377 | kfree(ias_opt); |
2366 | return -EINVAL; | 2378 | err = -EINVAL; |
2379 | goto out; | ||
2367 | } | 2380 | } |
2368 | 2381 | ||
2369 | /* Translate from internal to user structure */ | 2382 | /* Translate from internal to user structure */ |
2370 | err = irda_extract_ias_value(ias_opt, ias_attr->value); | 2383 | err = irda_extract_ias_value(ias_opt, ias_attr->value); |
2371 | if(err) { | 2384 | if(err) { |
2372 | kfree(ias_opt); | 2385 | kfree(ias_opt); |
2373 | return err; | 2386 | goto out; |
2374 | } | 2387 | } |
2375 | 2388 | ||
2376 | /* Copy reply to the user */ | 2389 | /* Copy reply to the user */ |
2377 | if (copy_to_user(optval, ias_opt, | 2390 | if (copy_to_user(optval, ias_opt, |
2378 | sizeof(struct irda_ias_set))) { | 2391 | sizeof(struct irda_ias_set))) { |
2379 | kfree(ias_opt); | 2392 | kfree(ias_opt); |
2380 | return -EFAULT; | 2393 | err = -EFAULT; |
2394 | goto out; | ||
2381 | } | 2395 | } |
2382 | /* Note : don't need to put optlen, we checked it */ | 2396 | /* Note : don't need to put optlen, we checked it */ |
2383 | kfree(ias_opt); | 2397 | kfree(ias_opt); |
@@ -2388,17 +2402,22 @@ bed: | |||
2388 | * then wait for the answer to come back. */ | 2402 | * then wait for the answer to come back. */ |
2389 | 2403 | ||
2390 | /* Check that the user has allocated the right space for us */ | 2404 | /* Check that the user has allocated the right space for us */ |
2391 | if (len != sizeof(struct irda_ias_set)) | 2405 | if (len != sizeof(struct irda_ias_set)) { |
2392 | return -EINVAL; | 2406 | err = -EINVAL; |
2407 | goto out; | ||
2408 | } | ||
2393 | 2409 | ||
2394 | ias_opt = kmalloc(sizeof(struct irda_ias_set), GFP_ATOMIC); | 2410 | ias_opt = kmalloc(sizeof(struct irda_ias_set), GFP_ATOMIC); |
2395 | if (ias_opt == NULL) | 2411 | if (ias_opt == NULL) { |
2396 | return -ENOMEM; | 2412 | err = -ENOMEM; |
2413 | goto out; | ||
2414 | } | ||
2397 | 2415 | ||
2398 | /* Copy query to the driver. */ | 2416 | /* Copy query to the driver. */ |
2399 | if (copy_from_user(ias_opt, optval, len)) { | 2417 | if (copy_from_user(ias_opt, optval, len)) { |
2400 | kfree(ias_opt); | 2418 | kfree(ias_opt); |
2401 | return -EFAULT; | 2419 | err = -EFAULT; |
2420 | goto out; | ||
2402 | } | 2421 | } |
2403 | 2422 | ||
2404 | /* At this point, there are two cases... | 2423 | /* At this point, there are two cases... |
@@ -2419,7 +2438,8 @@ bed: | |||
2419 | daddr = ias_opt->daddr; | 2438 | daddr = ias_opt->daddr; |
2420 | if((!daddr) || (daddr == DEV_ADDR_ANY)) { | 2439 | if((!daddr) || (daddr == DEV_ADDR_ANY)) { |
2421 | kfree(ias_opt); | 2440 | kfree(ias_opt); |
2422 | return -EINVAL; | 2441 | err = -EINVAL; |
2442 | goto out; | ||
2423 | } | 2443 | } |
2424 | } | 2444 | } |
2425 | 2445 | ||
@@ -2428,7 +2448,8 @@ bed: | |||
2428 | IRDA_WARNING("%s: busy with a previous query\n", | 2448 | IRDA_WARNING("%s: busy with a previous query\n", |
2429 | __func__); | 2449 | __func__); |
2430 | kfree(ias_opt); | 2450 | kfree(ias_opt); |
2431 | return -EBUSY; | 2451 | err = -EBUSY; |
2452 | goto out; | ||
2432 | } | 2453 | } |
2433 | 2454 | ||
2434 | self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, | 2455 | self->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self, |
@@ -2436,7 +2457,8 @@ bed: | |||
2436 | 2457 | ||
2437 | if (self->iriap == NULL) { | 2458 | if (self->iriap == NULL) { |
2438 | kfree(ias_opt); | 2459 | kfree(ias_opt); |
2439 | return -ENOMEM; | 2460 | err = -ENOMEM; |
2461 | goto out; | ||
2440 | } | 2462 | } |
2441 | 2463 | ||
2442 | /* Treat unexpected wakeup as disconnect */ | 2464 | /* Treat unexpected wakeup as disconnect */ |
@@ -2455,7 +2477,8 @@ bed: | |||
2455 | * we can free it regardless! */ | 2477 | * we can free it regardless! */ |
2456 | kfree(ias_opt); | 2478 | kfree(ias_opt); |
2457 | /* Treat signals as disconnect */ | 2479 | /* Treat signals as disconnect */ |
2458 | return -EHOSTUNREACH; | 2480 | err = -EHOSTUNREACH; |
2481 | goto out; | ||
2459 | } | 2482 | } |
2460 | 2483 | ||
2461 | /* Check what happened */ | 2484 | /* Check what happened */ |
@@ -2465,9 +2488,11 @@ bed: | |||
2465 | /* Requested object/attribute doesn't exist */ | 2488 | /* Requested object/attribute doesn't exist */ |
2466 | if((self->errno == IAS_CLASS_UNKNOWN) || | 2489 | if((self->errno == IAS_CLASS_UNKNOWN) || |
2467 | (self->errno == IAS_ATTRIB_UNKNOWN)) | 2490 | (self->errno == IAS_ATTRIB_UNKNOWN)) |
2468 | return (-EADDRNOTAVAIL); | 2491 | err = -EADDRNOTAVAIL; |
2469 | else | 2492 | else |
2470 | return (-EHOSTUNREACH); | 2493 | err = -EHOSTUNREACH; |
2494 | |||
2495 | goto out; | ||
2471 | } | 2496 | } |
2472 | 2497 | ||
2473 | /* Translate from internal to user structure */ | 2498 | /* Translate from internal to user structure */ |
@@ -2476,14 +2501,15 @@ bed: | |||
2476 | irias_delete_value(self->ias_result); | 2501 | irias_delete_value(self->ias_result); |
2477 | if (err) { | 2502 | if (err) { |
2478 | kfree(ias_opt); | 2503 | kfree(ias_opt); |
2479 | return err; | 2504 | goto out; |
2480 | } | 2505 | } |
2481 | 2506 | ||
2482 | /* Copy reply to the user */ | 2507 | /* Copy reply to the user */ |
2483 | if (copy_to_user(optval, ias_opt, | 2508 | if (copy_to_user(optval, ias_opt, |
2484 | sizeof(struct irda_ias_set))) { | 2509 | sizeof(struct irda_ias_set))) { |
2485 | kfree(ias_opt); | 2510 | kfree(ias_opt); |
2486 | return -EFAULT; | 2511 | err = -EFAULT; |
2512 | goto out; | ||
2487 | } | 2513 | } |
2488 | /* Note : don't need to put optlen, we checked it */ | 2514 | /* Note : don't need to put optlen, we checked it */ |
2489 | kfree(ias_opt); | 2515 | kfree(ias_opt); |
@@ -2504,11 +2530,15 @@ bed: | |||
2504 | */ | 2530 | */ |
2505 | 2531 | ||
2506 | /* Check that the user is passing us an int */ | 2532 | /* Check that the user is passing us an int */ |
2507 | if (len != sizeof(int)) | 2533 | if (len != sizeof(int)) { |
2508 | return -EINVAL; | 2534 | err = -EINVAL; |
2535 | goto out; | ||
2536 | } | ||
2509 | /* Get timeout in ms (max time we block the caller) */ | 2537 | /* Get timeout in ms (max time we block the caller) */ |
2510 | if (get_user(val, (int __user *)optval)) | 2538 | if (get_user(val, (int __user *)optval)) { |
2511 | return -EFAULT; | 2539 | err = -EFAULT; |
2540 | goto out; | ||
2541 | } | ||
2512 | 2542 | ||
2513 | /* Tell IrLMP we want to be notified */ | 2543 | /* Tell IrLMP we want to be notified */ |
2514 | irlmp_update_client(self->ckey, self->mask.word, | 2544 | irlmp_update_client(self->ckey, self->mask.word, |
@@ -2520,8 +2550,6 @@ bed: | |||
2520 | 2550 | ||
2521 | /* Wait until a node is discovered */ | 2551 | /* Wait until a node is discovered */ |
2522 | if (!self->cachedaddr) { | 2552 | if (!self->cachedaddr) { |
2523 | int ret = 0; | ||
2524 | |||
2525 | IRDA_DEBUG(1, "%s(), nothing discovered yet, going to sleep...\n", __func__); | 2553 | IRDA_DEBUG(1, "%s(), nothing discovered yet, going to sleep...\n", __func__); |
2526 | 2554 | ||
2527 | /* Set watchdog timer to expire in <val> ms. */ | 2555 | /* Set watchdog timer to expire in <val> ms. */ |
@@ -2534,7 +2562,7 @@ bed: | |||
2534 | /* Wait for IR-LMP to call us back */ | 2562 | /* Wait for IR-LMP to call us back */ |
2535 | __wait_event_interruptible(self->query_wait, | 2563 | __wait_event_interruptible(self->query_wait, |
2536 | (self->cachedaddr != 0 || self->errno == -ETIME), | 2564 | (self->cachedaddr != 0 || self->errno == -ETIME), |
2537 | ret); | 2565 | err); |
2538 | 2566 | ||
2539 | /* If watchdog is still activated, kill it! */ | 2567 | /* If watchdog is still activated, kill it! */ |
2540 | if(timer_pending(&(self->watchdog))) | 2568 | if(timer_pending(&(self->watchdog))) |
@@ -2542,8 +2570,8 @@ bed: | |||
2542 | 2570 | ||
2543 | IRDA_DEBUG(1, "%s(), ...waking up !\n", __func__); | 2571 | IRDA_DEBUG(1, "%s(), ...waking up !\n", __func__); |
2544 | 2572 | ||
2545 | if (ret != 0) | 2573 | if (err != 0) |
2546 | return ret; | 2574 | goto out; |
2547 | } | 2575 | } |
2548 | else | 2576 | else |
2549 | IRDA_DEBUG(1, "%s(), found immediately !\n", | 2577 | IRDA_DEBUG(1, "%s(), found immediately !\n", |
@@ -2566,25 +2594,19 @@ bed: | |||
2566 | * If the user want more details, he should query | 2594 | * If the user want more details, he should query |
2567 | * the whole discovery log and pick one device... | 2595 | * the whole discovery log and pick one device... |
2568 | */ | 2596 | */ |
2569 | if (put_user(daddr, (int __user *)optval)) | 2597 | if (put_user(daddr, (int __user *)optval)) { |
2570 | return -EFAULT; | 2598 | err = -EFAULT; |
2599 | goto out; | ||
2600 | } | ||
2571 | 2601 | ||
2572 | break; | 2602 | break; |
2573 | default: | 2603 | default: |
2574 | return -ENOPROTOOPT; | 2604 | err = -ENOPROTOOPT; |
2575 | } | 2605 | } |
2576 | 2606 | ||
2577 | return 0; | 2607 | out: |
2578 | } | ||
2579 | |||
2580 | static int irda_getsockopt(struct socket *sock, int level, int optname, | ||
2581 | char __user *optval, int __user *optlen) | ||
2582 | { | ||
2583 | int err; | ||
2584 | 2608 | ||
2585 | lock_kernel(); | 2609 | release_sock(sk); |
2586 | err = __irda_getsockopt(sock, level, optname, optval, optlen); | ||
2587 | unlock_kernel(); | ||
2588 | 2610 | ||
2589 | return err; | 2611 | return err; |
2590 | } | 2612 | } |
@@ -2628,7 +2650,7 @@ static const struct proto_ops irda_seqpacket_ops = { | |||
2628 | .socketpair = sock_no_socketpair, | 2650 | .socketpair = sock_no_socketpair, |
2629 | .accept = irda_accept, | 2651 | .accept = irda_accept, |
2630 | .getname = irda_getname, | 2652 | .getname = irda_getname, |
2631 | .poll = irda_datagram_poll, | 2653 | .poll = datagram_poll, |
2632 | .ioctl = irda_ioctl, | 2654 | .ioctl = irda_ioctl, |
2633 | #ifdef CONFIG_COMPAT | 2655 | #ifdef CONFIG_COMPAT |
2634 | .compat_ioctl = irda_compat_ioctl, | 2656 | .compat_ioctl = irda_compat_ioctl, |
@@ -2652,7 +2674,7 @@ static const struct proto_ops irda_dgram_ops = { | |||
2652 | .socketpair = sock_no_socketpair, | 2674 | .socketpair = sock_no_socketpair, |
2653 | .accept = irda_accept, | 2675 | .accept = irda_accept, |
2654 | .getname = irda_getname, | 2676 | .getname = irda_getname, |
2655 | .poll = irda_datagram_poll, | 2677 | .poll = datagram_poll, |
2656 | .ioctl = irda_ioctl, | 2678 | .ioctl = irda_ioctl, |
2657 | #ifdef CONFIG_COMPAT | 2679 | #ifdef CONFIG_COMPAT |
2658 | .compat_ioctl = irda_compat_ioctl, | 2680 | .compat_ioctl = irda_compat_ioctl, |
@@ -2677,7 +2699,7 @@ static const struct proto_ops irda_ultra_ops = { | |||
2677 | .socketpair = sock_no_socketpair, | 2699 | .socketpair = sock_no_socketpair, |
2678 | .accept = sock_no_accept, | 2700 | .accept = sock_no_accept, |
2679 | .getname = irda_getname, | 2701 | .getname = irda_getname, |
2680 | .poll = irda_datagram_poll, | 2702 | .poll = datagram_poll, |
2681 | .ioctl = irda_ioctl, | 2703 | .ioctl = irda_ioctl, |
2682 | #ifdef CONFIG_COMPAT | 2704 | #ifdef CONFIG_COMPAT |
2683 | .compat_ioctl = irda_compat_ioctl, | 2705 | .compat_ioctl = irda_compat_ioctl, |
diff --git a/net/irda/discovery.c b/net/irda/discovery.c index c1c8ae939126..36c3f037f172 100644 --- a/net/irda/discovery.c +++ b/net/irda/discovery.c | |||
@@ -315,7 +315,7 @@ struct irda_device_info *irlmp_copy_discoveries(hashbin_t *log, int *pn, | |||
315 | 315 | ||
316 | /* Get the actual number of device in the buffer and return */ | 316 | /* Get the actual number of device in the buffer and return */ |
317 | *pn = i; | 317 | *pn = i; |
318 | return(buffer); | 318 | return buffer; |
319 | } | 319 | } |
320 | 320 | ||
321 | #ifdef CONFIG_PROC_FS | 321 | #ifdef CONFIG_PROC_FS |
diff --git a/net/irda/ircomm/ircomm_tty.c b/net/irda/ircomm/ircomm_tty.c index faa82ca2dfdc..a39cca8331df 100644 --- a/net/irda/ircomm/ircomm_tty.c +++ b/net/irda/ircomm/ircomm_tty.c | |||
@@ -449,8 +449,8 @@ static int ircomm_tty_open(struct tty_struct *tty, struct file *filp) | |||
449 | } | 449 | } |
450 | 450 | ||
451 | #ifdef SERIAL_DO_RESTART | 451 | #ifdef SERIAL_DO_RESTART |
452 | return ((self->flags & ASYNC_HUP_NOTIFY) ? | 452 | return (self->flags & ASYNC_HUP_NOTIFY) ? |
453 | -EAGAIN : -ERESTARTSYS); | 453 | -EAGAIN : -ERESTARTSYS; |
454 | #else | 454 | #else |
455 | return -EAGAIN; | 455 | return -EAGAIN; |
456 | #endif | 456 | #endif |
diff --git a/net/irda/iriap.c b/net/irda/iriap.c index fce364c6c71a..5b743bdd89ba 100644 --- a/net/irda/iriap.c +++ b/net/irda/iriap.c | |||
@@ -502,7 +502,8 @@ static void iriap_getvaluebyclass_confirm(struct iriap_cb *self, | |||
502 | IRDA_DEBUG(4, "%s(), strlen=%d\n", __func__, value_len); | 502 | IRDA_DEBUG(4, "%s(), strlen=%d\n", __func__, value_len); |
503 | 503 | ||
504 | /* Make sure the string is null-terminated */ | 504 | /* Make sure the string is null-terminated */ |
505 | fp[n+value_len] = 0x00; | 505 | if (n + value_len < skb->len) |
506 | fp[n + value_len] = 0x00; | ||
506 | IRDA_DEBUG(4, "Got string %s\n", fp+n); | 507 | IRDA_DEBUG(4, "Got string %s\n", fp+n); |
507 | 508 | ||
508 | /* Will truncate to IAS_MAX_STRING bytes */ | 509 | /* Will truncate to IAS_MAX_STRING bytes */ |
diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c index 5bb8353105cc..8ee1ff6c742f 100644 --- a/net/irda/irlan/irlan_eth.c +++ b/net/irda/irlan/irlan_eth.c | |||
@@ -45,13 +45,11 @@ static int irlan_eth_close(struct net_device *dev); | |||
45 | static netdev_tx_t irlan_eth_xmit(struct sk_buff *skb, | 45 | static netdev_tx_t irlan_eth_xmit(struct sk_buff *skb, |
46 | struct net_device *dev); | 46 | struct net_device *dev); |
47 | static void irlan_eth_set_multicast_list( struct net_device *dev); | 47 | static void irlan_eth_set_multicast_list( struct net_device *dev); |
48 | static struct net_device_stats *irlan_eth_get_stats(struct net_device *dev); | ||
49 | 48 | ||
50 | static const struct net_device_ops irlan_eth_netdev_ops = { | 49 | static const struct net_device_ops irlan_eth_netdev_ops = { |
51 | .ndo_open = irlan_eth_open, | 50 | .ndo_open = irlan_eth_open, |
52 | .ndo_stop = irlan_eth_close, | 51 | .ndo_stop = irlan_eth_close, |
53 | .ndo_start_xmit = irlan_eth_xmit, | 52 | .ndo_start_xmit = irlan_eth_xmit, |
54 | .ndo_get_stats = irlan_eth_get_stats, | ||
55 | .ndo_set_multicast_list = irlan_eth_set_multicast_list, | 53 | .ndo_set_multicast_list = irlan_eth_set_multicast_list, |
56 | .ndo_change_mtu = eth_change_mtu, | 54 | .ndo_change_mtu = eth_change_mtu, |
57 | .ndo_validate_addr = eth_validate_addr, | 55 | .ndo_validate_addr = eth_validate_addr, |
@@ -208,10 +206,10 @@ static netdev_tx_t irlan_eth_xmit(struct sk_buff *skb, | |||
208 | * tried :-) DB | 206 | * tried :-) DB |
209 | */ | 207 | */ |
210 | /* irttp_data_request already free the packet */ | 208 | /* irttp_data_request already free the packet */ |
211 | self->stats.tx_dropped++; | 209 | dev->stats.tx_dropped++; |
212 | } else { | 210 | } else { |
213 | self->stats.tx_packets++; | 211 | dev->stats.tx_packets++; |
214 | self->stats.tx_bytes += len; | 212 | dev->stats.tx_bytes += len; |
215 | } | 213 | } |
216 | 214 | ||
217 | return NETDEV_TX_OK; | 215 | return NETDEV_TX_OK; |
@@ -226,15 +224,16 @@ static netdev_tx_t irlan_eth_xmit(struct sk_buff *skb, | |||
226 | int irlan_eth_receive(void *instance, void *sap, struct sk_buff *skb) | 224 | int irlan_eth_receive(void *instance, void *sap, struct sk_buff *skb) |
227 | { | 225 | { |
228 | struct irlan_cb *self = instance; | 226 | struct irlan_cb *self = instance; |
227 | struct net_device *dev = self->dev; | ||
229 | 228 | ||
230 | if (skb == NULL) { | 229 | if (skb == NULL) { |
231 | ++self->stats.rx_dropped; | 230 | dev->stats.rx_dropped++; |
232 | return 0; | 231 | return 0; |
233 | } | 232 | } |
234 | if (skb->len < ETH_HLEN) { | 233 | if (skb->len < ETH_HLEN) { |
235 | IRDA_DEBUG(0, "%s() : IrLAN frame too short (%d)\n", | 234 | IRDA_DEBUG(0, "%s() : IrLAN frame too short (%d)\n", |
236 | __func__, skb->len); | 235 | __func__, skb->len); |
237 | ++self->stats.rx_dropped; | 236 | dev->stats.rx_dropped++; |
238 | dev_kfree_skb(skb); | 237 | dev_kfree_skb(skb); |
239 | return 0; | 238 | return 0; |
240 | } | 239 | } |
@@ -244,10 +243,10 @@ int irlan_eth_receive(void *instance, void *sap, struct sk_buff *skb) | |||
244 | * might have been previously set by the low level IrDA network | 243 | * might have been previously set by the low level IrDA network |
245 | * device driver | 244 | * device driver |
246 | */ | 245 | */ |
247 | skb->protocol = eth_type_trans(skb, self->dev); /* Remove eth header */ | 246 | skb->protocol = eth_type_trans(skb, dev); /* Remove eth header */ |
248 | 247 | ||
249 | self->stats.rx_packets++; | 248 | dev->stats.rx_packets++; |
250 | self->stats.rx_bytes += skb->len; | 249 | dev->stats.rx_bytes += skb->len; |
251 | 250 | ||
252 | netif_rx(skb); /* Eat it! */ | 251 | netif_rx(skb); /* Eat it! */ |
253 | 252 | ||
@@ -348,16 +347,3 @@ static void irlan_eth_set_multicast_list(struct net_device *dev) | |||
348 | else | 347 | else |
349 | irlan_set_broadcast_filter(self, FALSE); | 348 | irlan_set_broadcast_filter(self, FALSE); |
350 | } | 349 | } |
351 | |||
352 | /* | ||
353 | * Function irlan_get_stats (dev) | ||
354 | * | ||
355 | * Get the current statistics for this device | ||
356 | * | ||
357 | */ | ||
358 | static struct net_device_stats *irlan_eth_get_stats(struct net_device *dev) | ||
359 | { | ||
360 | struct irlan_cb *self = netdev_priv(dev); | ||
361 | |||
362 | return &self->stats; | ||
363 | } | ||
diff --git a/net/irda/irlan/irlan_event.c b/net/irda/irlan/irlan_event.c index cbcb4eb54037..43f16040a6fe 100644 --- a/net/irda/irlan/irlan_event.c +++ b/net/irda/irlan/irlan_event.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #include <net/irda/irlan_event.h> | 25 | #include <net/irda/irlan_event.h> |
26 | 26 | ||
27 | char *irlan_state[] = { | 27 | const char * const irlan_state[] = { |
28 | "IRLAN_IDLE", | 28 | "IRLAN_IDLE", |
29 | "IRLAN_QUERY", | 29 | "IRLAN_QUERY", |
30 | "IRLAN_CONN", | 30 | "IRLAN_CONN", |
diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c index 0e7d8bde145d..6115a44c0a24 100644 --- a/net/irda/irlmp.c +++ b/net/irda/irlmp.c | |||
@@ -939,7 +939,7 @@ struct irda_device_info *irlmp_get_discoveries(int *pn, __u16 mask, int nslots) | |||
939 | } | 939 | } |
940 | 940 | ||
941 | /* Return current cached discovery log */ | 941 | /* Return current cached discovery log */ |
942 | return(irlmp_copy_discoveries(irlmp->cachelog, pn, mask, TRUE)); | 942 | return irlmp_copy_discoveries(irlmp->cachelog, pn, mask, TRUE); |
943 | } | 943 | } |
944 | EXPORT_SYMBOL(irlmp_get_discoveries); | 944 | EXPORT_SYMBOL(irlmp_get_discoveries); |
945 | 945 | ||
diff --git a/net/irda/irlmp_frame.c b/net/irda/irlmp_frame.c index 3750884094da..062e63b1c5c4 100644 --- a/net/irda/irlmp_frame.c +++ b/net/irda/irlmp_frame.c | |||
@@ -448,7 +448,7 @@ static struct lsap_cb *irlmp_find_lsap(struct lap_cb *self, __u8 dlsap_sel, | |||
448 | (self->cache.slsap_sel == slsap_sel) && | 448 | (self->cache.slsap_sel == slsap_sel) && |
449 | (self->cache.dlsap_sel == dlsap_sel)) | 449 | (self->cache.dlsap_sel == dlsap_sel)) |
450 | { | 450 | { |
451 | return (self->cache.lsap); | 451 | return self->cache.lsap; |
452 | } | 452 | } |
453 | #endif | 453 | #endif |
454 | 454 | ||
diff --git a/net/irda/irnet/irnet.h b/net/irda/irnet/irnet.h index 4300df35d37d..0d82ff5aeff1 100644 --- a/net/irda/irnet/irnet.h +++ b/net/irda/irnet/irnet.h | |||
@@ -458,6 +458,8 @@ typedef struct irnet_socket | |||
458 | int disco_index; /* Last read in the discovery log */ | 458 | int disco_index; /* Last read in the discovery log */ |
459 | int disco_number; /* Size of the discovery log */ | 459 | int disco_number; /* Size of the discovery log */ |
460 | 460 | ||
461 | struct mutex lock; | ||
462 | |||
461 | } irnet_socket; | 463 | } irnet_socket; |
462 | 464 | ||
463 | /* | 465 | /* |
diff --git a/net/irda/irnet/irnet_irda.c b/net/irda/irnet/irnet_irda.c index e98e40d76f4f..7f17a8020e8a 100644 --- a/net/irda/irnet/irnet_irda.c +++ b/net/irda/irnet/irnet_irda.c | |||
@@ -238,7 +238,7 @@ irnet_ias_to_tsap(irnet_socket * self, | |||
238 | DEXIT(IRDA_SR_TRACE, "\n"); | 238 | DEXIT(IRDA_SR_TRACE, "\n"); |
239 | 239 | ||
240 | /* Return the TSAP */ | 240 | /* Return the TSAP */ |
241 | return(dtsap_sel); | 241 | return dtsap_sel; |
242 | } | 242 | } |
243 | 243 | ||
244 | /*------------------------------------------------------------------*/ | 244 | /*------------------------------------------------------------------*/ |
@@ -301,7 +301,7 @@ irnet_connect_tsap(irnet_socket * self) | |||
301 | { | 301 | { |
302 | clear_bit(0, &self->ttp_connect); | 302 | clear_bit(0, &self->ttp_connect); |
303 | DERROR(IRDA_SR_ERROR, "connect aborted!\n"); | 303 | DERROR(IRDA_SR_ERROR, "connect aborted!\n"); |
304 | return(err); | 304 | return err; |
305 | } | 305 | } |
306 | 306 | ||
307 | /* Connect to remote device */ | 307 | /* Connect to remote device */ |
@@ -312,7 +312,7 @@ irnet_connect_tsap(irnet_socket * self) | |||
312 | { | 312 | { |
313 | clear_bit(0, &self->ttp_connect); | 313 | clear_bit(0, &self->ttp_connect); |
314 | DERROR(IRDA_SR_ERROR, "connect aborted!\n"); | 314 | DERROR(IRDA_SR_ERROR, "connect aborted!\n"); |
315 | return(err); | 315 | return err; |
316 | } | 316 | } |
317 | 317 | ||
318 | /* The above call is non-blocking. | 318 | /* The above call is non-blocking. |
@@ -321,7 +321,7 @@ irnet_connect_tsap(irnet_socket * self) | |||
321 | * See you there ;-) */ | 321 | * See you there ;-) */ |
322 | 322 | ||
323 | DEXIT(IRDA_SR_TRACE, "\n"); | 323 | DEXIT(IRDA_SR_TRACE, "\n"); |
324 | return(err); | 324 | return err; |
325 | } | 325 | } |
326 | 326 | ||
327 | /*------------------------------------------------------------------*/ | 327 | /*------------------------------------------------------------------*/ |
@@ -362,10 +362,10 @@ irnet_discover_next_daddr(irnet_socket * self) | |||
362 | /* The above request is non-blocking. | 362 | /* The above request is non-blocking. |
363 | * After a while, IrDA will call us back in irnet_discovervalue_confirm() | 363 | * After a while, IrDA will call us back in irnet_discovervalue_confirm() |
364 | * We will then call irnet_ias_to_tsap() and come back here again... */ | 364 | * We will then call irnet_ias_to_tsap() and come back here again... */ |
365 | return(0); | 365 | return 0; |
366 | } | 366 | } |
367 | else | 367 | else |
368 | return(1); | 368 | return 1; |
369 | } | 369 | } |
370 | 370 | ||
371 | /*------------------------------------------------------------------*/ | 371 | /*------------------------------------------------------------------*/ |
@@ -436,7 +436,7 @@ irnet_discover_daddr_and_lsap_sel(irnet_socket * self) | |||
436 | /* Follow me in irnet_discovervalue_confirm() */ | 436 | /* Follow me in irnet_discovervalue_confirm() */ |
437 | 437 | ||
438 | DEXIT(IRDA_SR_TRACE, "\n"); | 438 | DEXIT(IRDA_SR_TRACE, "\n"); |
439 | return(0); | 439 | return 0; |
440 | } | 440 | } |
441 | 441 | ||
442 | /*------------------------------------------------------------------*/ | 442 | /*------------------------------------------------------------------*/ |
@@ -485,7 +485,7 @@ irnet_dname_to_daddr(irnet_socket * self) | |||
485 | /* No luck ! */ | 485 | /* No luck ! */ |
486 | DEBUG(IRDA_SR_INFO, "cannot discover device ``%s'' !!!\n", self->rname); | 486 | DEBUG(IRDA_SR_INFO, "cannot discover device ``%s'' !!!\n", self->rname); |
487 | kfree(discoveries); | 487 | kfree(discoveries); |
488 | return(-EADDRNOTAVAIL); | 488 | return -EADDRNOTAVAIL; |
489 | } | 489 | } |
490 | 490 | ||
491 | 491 | ||
@@ -527,7 +527,7 @@ irda_irnet_create(irnet_socket * self) | |||
527 | INIT_WORK(&self->disconnect_work, irnet_ppp_disconnect); | 527 | INIT_WORK(&self->disconnect_work, irnet_ppp_disconnect); |
528 | 528 | ||
529 | DEXIT(IRDA_SOCK_TRACE, "\n"); | 529 | DEXIT(IRDA_SOCK_TRACE, "\n"); |
530 | return(0); | 530 | return 0; |
531 | } | 531 | } |
532 | 532 | ||
533 | /*------------------------------------------------------------------*/ | 533 | /*------------------------------------------------------------------*/ |
@@ -601,7 +601,7 @@ irda_irnet_connect(irnet_socket * self) | |||
601 | * We will finish the connection procedure in irnet_connect_tsap(). | 601 | * We will finish the connection procedure in irnet_connect_tsap(). |
602 | */ | 602 | */ |
603 | DEXIT(IRDA_SOCK_TRACE, "\n"); | 603 | DEXIT(IRDA_SOCK_TRACE, "\n"); |
604 | return(0); | 604 | return 0; |
605 | } | 605 | } |
606 | 606 | ||
607 | /*------------------------------------------------------------------*/ | 607 | /*------------------------------------------------------------------*/ |
@@ -733,7 +733,7 @@ irnet_daddr_to_dname(irnet_socket * self) | |||
733 | /* No luck ! */ | 733 | /* No luck ! */ |
734 | DEXIT(IRDA_SERV_INFO, ": cannot discover device 0x%08x !!!\n", self->daddr); | 734 | DEXIT(IRDA_SERV_INFO, ": cannot discover device 0x%08x !!!\n", self->daddr); |
735 | kfree(discoveries); | 735 | kfree(discoveries); |
736 | return(-EADDRNOTAVAIL); | 736 | return -EADDRNOTAVAIL; |
737 | } | 737 | } |
738 | 738 | ||
739 | /*------------------------------------------------------------------*/ | 739 | /*------------------------------------------------------------------*/ |
diff --git a/net/irda/irnet/irnet_ppp.c b/net/irda/irnet/irnet_ppp.c index dfe7b38dd4af..7fa86373de41 100644 --- a/net/irda/irnet/irnet_ppp.c +++ b/net/irda/irnet/irnet_ppp.c | |||
@@ -166,7 +166,7 @@ irnet_ctrl_write(irnet_socket * ap, | |||
166 | } | 166 | } |
167 | 167 | ||
168 | /* Success : we have parsed all commands successfully */ | 168 | /* Success : we have parsed all commands successfully */ |
169 | return(count); | 169 | return count; |
170 | } | 170 | } |
171 | 171 | ||
172 | #ifdef INITIAL_DISCOVERY | 172 | #ifdef INITIAL_DISCOVERY |
@@ -300,7 +300,7 @@ irnet_ctrl_read(irnet_socket * ap, | |||
300 | } | 300 | } |
301 | 301 | ||
302 | DEXIT(CTRL_TRACE, "\n"); | 302 | DEXIT(CTRL_TRACE, "\n"); |
303 | return(strlen(event)); | 303 | return strlen(event); |
304 | } | 304 | } |
305 | #endif /* INITIAL_DISCOVERY */ | 305 | #endif /* INITIAL_DISCOVERY */ |
306 | 306 | ||
@@ -409,7 +409,7 @@ irnet_ctrl_read(irnet_socket * ap, | |||
409 | } | 409 | } |
410 | 410 | ||
411 | DEXIT(CTRL_TRACE, "\n"); | 411 | DEXIT(CTRL_TRACE, "\n"); |
412 | return(strlen(event)); | 412 | return strlen(event); |
413 | } | 413 | } |
414 | 414 | ||
415 | /*------------------------------------------------------------------*/ | 415 | /*------------------------------------------------------------------*/ |
@@ -480,7 +480,6 @@ dev_irnet_open(struct inode * inode, | |||
480 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); | 480 | ap = kzalloc(sizeof(*ap), GFP_KERNEL); |
481 | DABORT(ap == NULL, -ENOMEM, FS_ERROR, "Can't allocate struct irnet...\n"); | 481 | DABORT(ap == NULL, -ENOMEM, FS_ERROR, "Can't allocate struct irnet...\n"); |
482 | 482 | ||
483 | lock_kernel(); | ||
484 | /* initialize the irnet structure */ | 483 | /* initialize the irnet structure */ |
485 | ap->file = file; | 484 | ap->file = file; |
486 | 485 | ||
@@ -502,18 +501,20 @@ dev_irnet_open(struct inode * inode, | |||
502 | { | 501 | { |
503 | DERROR(FS_ERROR, "Can't setup IrDA link...\n"); | 502 | DERROR(FS_ERROR, "Can't setup IrDA link...\n"); |
504 | kfree(ap); | 503 | kfree(ap); |
505 | unlock_kernel(); | 504 | |
506 | return err; | 505 | return err; |
507 | } | 506 | } |
508 | 507 | ||
509 | /* For the control channel */ | 508 | /* For the control channel */ |
510 | ap->event_index = irnet_events.index; /* Cancel all past events */ | 509 | ap->event_index = irnet_events.index; /* Cancel all past events */ |
511 | 510 | ||
511 | mutex_init(&ap->lock); | ||
512 | |||
512 | /* Put our stuff where we will be able to find it later */ | 513 | /* Put our stuff where we will be able to find it later */ |
513 | file->private_data = ap; | 514 | file->private_data = ap; |
514 | 515 | ||
515 | DEXIT(FS_TRACE, " - ap=0x%p\n", ap); | 516 | DEXIT(FS_TRACE, " - ap=0x%p\n", ap); |
516 | unlock_kernel(); | 517 | |
517 | return 0; | 518 | return 0; |
518 | } | 519 | } |
519 | 520 | ||
@@ -623,7 +624,7 @@ dev_irnet_poll(struct file * file, | |||
623 | mask |= irnet_ctrl_poll(ap, file, wait); | 624 | mask |= irnet_ctrl_poll(ap, file, wait); |
624 | 625 | ||
625 | DEXIT(FS_TRACE, " - mask=0x%X\n", mask); | 626 | DEXIT(FS_TRACE, " - mask=0x%X\n", mask); |
626 | return(mask); | 627 | return mask; |
627 | } | 628 | } |
628 | 629 | ||
629 | /*------------------------------------------------------------------*/ | 630 | /*------------------------------------------------------------------*/ |
@@ -663,8 +664,10 @@ dev_irnet_ioctl( | |||
663 | if((val == N_SYNC_PPP) || (val == N_PPP)) | 664 | if((val == N_SYNC_PPP) || (val == N_PPP)) |
664 | { | 665 | { |
665 | DEBUG(FS_INFO, "Entering PPP discipline.\n"); | 666 | DEBUG(FS_INFO, "Entering PPP discipline.\n"); |
666 | /* PPP channel setup (ap->chan in configued in dev_irnet_open())*/ | 667 | /* PPP channel setup (ap->chan in configured in dev_irnet_open())*/ |
667 | lock_kernel(); | 668 | if (mutex_lock_interruptible(&ap->lock)) |
669 | return -EINTR; | ||
670 | |||
668 | err = ppp_register_channel(&ap->chan); | 671 | err = ppp_register_channel(&ap->chan); |
669 | if(err == 0) | 672 | if(err == 0) |
670 | { | 673 | { |
@@ -677,14 +680,17 @@ dev_irnet_ioctl( | |||
677 | } | 680 | } |
678 | else | 681 | else |
679 | DERROR(FS_ERROR, "Can't setup PPP channel...\n"); | 682 | DERROR(FS_ERROR, "Can't setup PPP channel...\n"); |
680 | unlock_kernel(); | 683 | |
684 | mutex_unlock(&ap->lock); | ||
681 | } | 685 | } |
682 | else | 686 | else |
683 | { | 687 | { |
684 | /* In theory, should be N_TTY */ | 688 | /* In theory, should be N_TTY */ |
685 | DEBUG(FS_INFO, "Exiting PPP discipline.\n"); | 689 | DEBUG(FS_INFO, "Exiting PPP discipline.\n"); |
686 | /* Disconnect from the generic PPP layer */ | 690 | /* Disconnect from the generic PPP layer */ |
687 | lock_kernel(); | 691 | if (mutex_lock_interruptible(&ap->lock)) |
692 | return -EINTR; | ||
693 | |||
688 | if(ap->ppp_open) | 694 | if(ap->ppp_open) |
689 | { | 695 | { |
690 | ap->ppp_open = 0; | 696 | ap->ppp_open = 0; |
@@ -693,24 +699,31 @@ dev_irnet_ioctl( | |||
693 | else | 699 | else |
694 | DERROR(FS_ERROR, "Channel not registered !\n"); | 700 | DERROR(FS_ERROR, "Channel not registered !\n"); |
695 | err = 0; | 701 | err = 0; |
696 | unlock_kernel(); | 702 | |
703 | mutex_unlock(&ap->lock); | ||
697 | } | 704 | } |
698 | break; | 705 | break; |
699 | 706 | ||
700 | /* Query PPP channel and unit number */ | 707 | /* Query PPP channel and unit number */ |
701 | case PPPIOCGCHAN: | 708 | case PPPIOCGCHAN: |
702 | lock_kernel(); | 709 | if (mutex_lock_interruptible(&ap->lock)) |
710 | return -EINTR; | ||
711 | |||
703 | if(ap->ppp_open && !put_user(ppp_channel_index(&ap->chan), | 712 | if(ap->ppp_open && !put_user(ppp_channel_index(&ap->chan), |
704 | (int __user *)argp)) | 713 | (int __user *)argp)) |
705 | err = 0; | 714 | err = 0; |
706 | unlock_kernel(); | 715 | |
716 | mutex_unlock(&ap->lock); | ||
707 | break; | 717 | break; |
708 | case PPPIOCGUNIT: | 718 | case PPPIOCGUNIT: |
709 | lock_kernel(); | 719 | if (mutex_lock_interruptible(&ap->lock)) |
720 | return -EINTR; | ||
721 | |||
710 | if(ap->ppp_open && !put_user(ppp_unit_number(&ap->chan), | 722 | if(ap->ppp_open && !put_user(ppp_unit_number(&ap->chan), |
711 | (int __user *)argp)) | 723 | (int __user *)argp)) |
712 | err = 0; | 724 | err = 0; |
713 | unlock_kernel(); | 725 | |
726 | mutex_unlock(&ap->lock); | ||
714 | break; | 727 | break; |
715 | 728 | ||
716 | /* All these ioctls can be passed both directly and from ppp_generic, | 729 | /* All these ioctls can be passed both directly and from ppp_generic, |
@@ -730,9 +743,12 @@ dev_irnet_ioctl( | |||
730 | if(!capable(CAP_NET_ADMIN)) | 743 | if(!capable(CAP_NET_ADMIN)) |
731 | err = -EPERM; | 744 | err = -EPERM; |
732 | else { | 745 | else { |
733 | lock_kernel(); | 746 | if (mutex_lock_interruptible(&ap->lock)) |
747 | return -EINTR; | ||
748 | |||
734 | err = ppp_irnet_ioctl(&ap->chan, cmd, arg); | 749 | err = ppp_irnet_ioctl(&ap->chan, cmd, arg); |
735 | unlock_kernel(); | 750 | |
751 | mutex_unlock(&ap->lock); | ||
736 | } | 752 | } |
737 | break; | 753 | break; |
738 | 754 | ||
@@ -740,7 +756,9 @@ dev_irnet_ioctl( | |||
740 | /* Get termios */ | 756 | /* Get termios */ |
741 | case TCGETS: | 757 | case TCGETS: |
742 | DEBUG(FS_INFO, "Get termios.\n"); | 758 | DEBUG(FS_INFO, "Get termios.\n"); |
743 | lock_kernel(); | 759 | if (mutex_lock_interruptible(&ap->lock)) |
760 | return -EINTR; | ||
761 | |||
744 | #ifndef TCGETS2 | 762 | #ifndef TCGETS2 |
745 | if(!kernel_termios_to_user_termios((struct termios __user *)argp, &ap->termios)) | 763 | if(!kernel_termios_to_user_termios((struct termios __user *)argp, &ap->termios)) |
746 | err = 0; | 764 | err = 0; |
@@ -748,12 +766,15 @@ dev_irnet_ioctl( | |||
748 | if(kernel_termios_to_user_termios_1((struct termios __user *)argp, &ap->termios)) | 766 | if(kernel_termios_to_user_termios_1((struct termios __user *)argp, &ap->termios)) |
749 | err = 0; | 767 | err = 0; |
750 | #endif | 768 | #endif |
751 | unlock_kernel(); | 769 | |
770 | mutex_unlock(&ap->lock); | ||
752 | break; | 771 | break; |
753 | /* Set termios */ | 772 | /* Set termios */ |
754 | case TCSETSF: | 773 | case TCSETSF: |
755 | DEBUG(FS_INFO, "Set termios.\n"); | 774 | DEBUG(FS_INFO, "Set termios.\n"); |
756 | lock_kernel(); | 775 | if (mutex_lock_interruptible(&ap->lock)) |
776 | return -EINTR; | ||
777 | |||
757 | #ifndef TCGETS2 | 778 | #ifndef TCGETS2 |
758 | if(!user_termios_to_kernel_termios(&ap->termios, (struct termios __user *)argp)) | 779 | if(!user_termios_to_kernel_termios(&ap->termios, (struct termios __user *)argp)) |
759 | err = 0; | 780 | err = 0; |
@@ -761,7 +782,8 @@ dev_irnet_ioctl( | |||
761 | if(!user_termios_to_kernel_termios_1(&ap->termios, (struct termios __user *)argp)) | 782 | if(!user_termios_to_kernel_termios_1(&ap->termios, (struct termios __user *)argp)) |
762 | err = 0; | 783 | err = 0; |
763 | #endif | 784 | #endif |
764 | unlock_kernel(); | 785 | |
786 | mutex_unlock(&ap->lock); | ||
765 | break; | 787 | break; |
766 | 788 | ||
767 | /* Set DTR/RTS */ | 789 | /* Set DTR/RTS */ |
@@ -784,9 +806,10 @@ dev_irnet_ioctl( | |||
784 | * We should also worry that we don't accept junk here and that | 806 | * We should also worry that we don't accept junk here and that |
785 | * we get rid of our own buffers */ | 807 | * we get rid of our own buffers */ |
786 | #ifdef FLUSH_TO_PPP | 808 | #ifdef FLUSH_TO_PPP |
787 | lock_kernel(); | 809 | if (mutex_lock_interruptible(&ap->lock)) |
810 | return -EINTR; | ||
788 | ppp_output_wakeup(&ap->chan); | 811 | ppp_output_wakeup(&ap->chan); |
789 | unlock_kernel(); | 812 | mutex_unlock(&ap->lock); |
790 | #endif /* FLUSH_TO_PPP */ | 813 | #endif /* FLUSH_TO_PPP */ |
791 | err = 0; | 814 | err = 0; |
792 | break; | 815 | break; |
diff --git a/net/irda/irnet/irnet_ppp.h b/net/irda/irnet/irnet_ppp.h index b5df2418f90c..940225866da0 100644 --- a/net/irda/irnet/irnet_ppp.h +++ b/net/irda/irnet/irnet_ppp.h | |||
@@ -103,7 +103,8 @@ static const struct file_operations irnet_device_fops = | |||
103 | .poll = dev_irnet_poll, | 103 | .poll = dev_irnet_poll, |
104 | .unlocked_ioctl = dev_irnet_ioctl, | 104 | .unlocked_ioctl = dev_irnet_ioctl, |
105 | .open = dev_irnet_open, | 105 | .open = dev_irnet_open, |
106 | .release = dev_irnet_close | 106 | .release = dev_irnet_close, |
107 | .llseek = noop_llseek, | ||
107 | /* Also : llseek, readdir, mmap, flush, fsync, fasync, lock, readv, writev */ | 108 | /* Also : llseek, readdir, mmap, flush, fsync, fasync, lock, readv, writev */ |
108 | }; | 109 | }; |
109 | 110 | ||
diff --git a/net/irda/parameters.c b/net/irda/parameters.c index fc1a20565e2d..71cd38c1a67f 100644 --- a/net/irda/parameters.c +++ b/net/irda/parameters.c | |||
@@ -298,6 +298,8 @@ static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi, | |||
298 | 298 | ||
299 | p.pi = pi; /* In case handler needs to know */ | 299 | p.pi = pi; /* In case handler needs to know */ |
300 | p.pl = buf[1]; /* Extract length of value */ | 300 | p.pl = buf[1]; /* Extract length of value */ |
301 | if (p.pl > 32) | ||
302 | p.pl = 32; | ||
301 | 303 | ||
302 | IRDA_DEBUG(2, "%s(), pi=%#x, pl=%d\n", __func__, | 304 | IRDA_DEBUG(2, "%s(), pi=%#x, pl=%d\n", __func__, |
303 | p.pi, p.pl); | 305 | p.pi, p.pl); |
@@ -318,7 +320,7 @@ static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi, | |||
318 | (__u8) str[0], (__u8) str[1]); | 320 | (__u8) str[0], (__u8) str[1]); |
319 | 321 | ||
320 | /* Null terminate string */ | 322 | /* Null terminate string */ |
321 | str[p.pl+1] = '\0'; | 323 | str[p.pl] = '\0'; |
322 | 324 | ||
323 | p.pv.c = str; /* Handler will need to take a copy */ | 325 | p.pv.c = str; /* Handler will need to take a copy */ |
324 | 326 | ||