diff options
Diffstat (limited to 'net/irda')
-rw-r--r-- | net/irda/af_irda.c | 136 | ||||
-rw-r--r-- | net/irda/ircomm/ircomm_param.c | 4 | ||||
-rw-r--r-- | net/irda/irda_device.c | 21 | ||||
-rw-r--r-- | net/irda/irlan/irlan_common.c | 2 | ||||
-rw-r--r-- | net/irda/irlan/irlan_eth.c | 3 | ||||
-rw-r--r-- | net/irda/irlap_event.c | 2 | ||||
-rw-r--r-- | net/irda/irlap_frame.c | 18 | ||||
-rw-r--r-- | net/irda/irqueue.c | 9 | ||||
-rw-r--r-- | net/irda/irttp.c | 10 | ||||
-rw-r--r-- | net/irda/parameters.c | 8 | ||||
-rw-r--r-- | net/irda/qos.c | 14 | ||||
-rw-r--r-- | net/irda/wrapper.c | 5 |
12 files changed, 97 insertions, 135 deletions
diff --git a/net/irda/af_irda.c b/net/irda/af_irda.c index 0eb7d596d470..06c97c60d542 100644 --- a/net/irda/af_irda.c +++ b/net/irda/af_irda.c | |||
@@ -89,7 +89,6 @@ static int irda_data_indication(void *instance, void *sap, struct sk_buff *skb) | |||
89 | 89 | ||
90 | self = instance; | 90 | self = instance; |
91 | sk = instance; | 91 | sk = instance; |
92 | IRDA_ASSERT(sk != NULL, return -1;); | ||
93 | 92 | ||
94 | err = sock_queue_rcv_skb(sk, skb); | 93 | err = sock_queue_rcv_skb(sk, skb); |
95 | if (err) { | 94 | if (err) { |
@@ -131,14 +130,12 @@ static void irda_disconnect_indication(void *instance, void *sap, | |||
131 | } | 130 | } |
132 | 131 | ||
133 | /* Prevent race conditions with irda_release() and irda_shutdown() */ | 132 | /* Prevent race conditions with irda_release() and irda_shutdown() */ |
133 | bh_lock_sock(sk); | ||
134 | if (!sock_flag(sk, SOCK_DEAD) && sk->sk_state != TCP_CLOSE) { | 134 | if (!sock_flag(sk, SOCK_DEAD) && sk->sk_state != TCP_CLOSE) { |
135 | lock_sock(sk); | ||
136 | sk->sk_state = TCP_CLOSE; | 135 | sk->sk_state = TCP_CLOSE; |
137 | sk->sk_err = ECONNRESET; | ||
138 | sk->sk_shutdown |= SEND_SHUTDOWN; | 136 | sk->sk_shutdown |= SEND_SHUTDOWN; |
139 | 137 | ||
140 | sk->sk_state_change(sk); | 138 | sk->sk_state_change(sk); |
141 | release_sock(sk); | ||
142 | 139 | ||
143 | /* Close our TSAP. | 140 | /* Close our TSAP. |
144 | * If we leave it open, IrLMP put it back into the list of | 141 | * If we leave it open, IrLMP put it back into the list of |
@@ -158,6 +155,7 @@ static void irda_disconnect_indication(void *instance, void *sap, | |||
158 | self->tsap = NULL; | 155 | self->tsap = NULL; |
159 | } | 156 | } |
160 | } | 157 | } |
158 | bh_unlock_sock(sk); | ||
161 | 159 | ||
162 | /* Note : once we are there, there is not much you want to do | 160 | /* Note : once we are there, there is not much you want to do |
163 | * with the socket anymore, apart from closing it. | 161 | * with the socket anymore, apart from closing it. |
@@ -220,7 +218,7 @@ static void irda_connect_confirm(void *instance, void *sap, | |||
220 | break; | 218 | break; |
221 | default: | 219 | default: |
222 | self->max_data_size = irttp_get_max_seg_size(self->tsap); | 220 | self->max_data_size = irttp_get_max_seg_size(self->tsap); |
223 | }; | 221 | } |
224 | 222 | ||
225 | IRDA_DEBUG(2, "%s(), max_data_size=%d\n", __FUNCTION__, | 223 | IRDA_DEBUG(2, "%s(), max_data_size=%d\n", __FUNCTION__, |
226 | self->max_data_size); | 224 | self->max_data_size); |
@@ -283,7 +281,7 @@ static void irda_connect_indication(void *instance, void *sap, | |||
283 | break; | 281 | break; |
284 | default: | 282 | default: |
285 | self->max_data_size = irttp_get_max_seg_size(self->tsap); | 283 | self->max_data_size = irttp_get_max_seg_size(self->tsap); |
286 | }; | 284 | } |
287 | 285 | ||
288 | IRDA_DEBUG(2, "%s(), max_data_size=%d\n", __FUNCTION__, | 286 | IRDA_DEBUG(2, "%s(), max_data_size=%d\n", __FUNCTION__, |
289 | self->max_data_size); | 287 | self->max_data_size); |
@@ -306,8 +304,6 @@ static void irda_connect_response(struct irda_sock *self) | |||
306 | 304 | ||
307 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__); | 305 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__); |
308 | 306 | ||
309 | IRDA_ASSERT(self != NULL, return;); | ||
310 | |||
311 | skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER, | 307 | skb = alloc_skb(TTP_MAX_HEADER + TTP_SAR_HEADER, |
312 | GFP_ATOMIC); | 308 | GFP_ATOMIC); |
313 | if (skb == NULL) { | 309 | if (skb == NULL) { |
@@ -337,7 +333,7 @@ static void irda_flow_indication(void *instance, void *sap, LOCAL_FLOW flow) | |||
337 | 333 | ||
338 | self = instance; | 334 | self = instance; |
339 | sk = instance; | 335 | sk = instance; |
340 | IRDA_ASSERT(sk != NULL, return;); | 336 | BUG_ON(sk == NULL); |
341 | 337 | ||
342 | switch (flow) { | 338 | switch (flow) { |
343 | case FLOW_STOP: | 339 | case FLOW_STOP: |
@@ -449,7 +445,7 @@ static void irda_discovery_timeout(u_long priv) | |||
449 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__); | 445 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__); |
450 | 446 | ||
451 | self = (struct irda_sock *) priv; | 447 | self = (struct irda_sock *) priv; |
452 | IRDA_ASSERT(self != NULL, return;); | 448 | BUG_ON(self == NULL); |
453 | 449 | ||
454 | /* Nothing for the caller */ | 450 | /* Nothing for the caller */ |
455 | self->cachelog = NULL; | 451 | self->cachelog = NULL; |
@@ -546,8 +542,6 @@ static int irda_find_lsap_sel(struct irda_sock *self, char *name) | |||
546 | { | 542 | { |
547 | IRDA_DEBUG(2, "%s(%p, %s)\n", __FUNCTION__, self, name); | 543 | IRDA_DEBUG(2, "%s(%p, %s)\n", __FUNCTION__, self, name); |
548 | 544 | ||
549 | IRDA_ASSERT(self != NULL, return -1;); | ||
550 | |||
551 | if (self->iriap) { | 545 | if (self->iriap) { |
552 | IRDA_WARNING("%s(): busy with a previous query\n", | 546 | IRDA_WARNING("%s(): busy with a previous query\n", |
553 | __FUNCTION__); | 547 | __FUNCTION__); |
@@ -635,8 +629,6 @@ static int irda_discover_daddr_and_lsap_sel(struct irda_sock *self, char *name) | |||
635 | 629 | ||
636 | IRDA_DEBUG(2, "%s(), name=%s\n", __FUNCTION__, name); | 630 | IRDA_DEBUG(2, "%s(), name=%s\n", __FUNCTION__, name); |
637 | 631 | ||
638 | IRDA_ASSERT(self != NULL, return -1;); | ||
639 | |||
640 | /* Ask lmp for the current discovery log | 632 | /* Ask lmp for the current discovery log |
641 | * Note : we have to use irlmp_get_discoveries(), as opposed | 633 | * Note : we have to use irlmp_get_discoveries(), as opposed |
642 | * to play with the cachelog directly, because while we are | 634 | * to play with the cachelog directly, because while we are |
@@ -784,8 +776,6 @@ static int irda_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len) | |||
784 | struct irda_sock *self = irda_sk(sk); | 776 | struct irda_sock *self = irda_sk(sk); |
785 | int err; | 777 | int err; |
786 | 778 | ||
787 | IRDA_ASSERT(self != NULL, return -1;); | ||
788 | |||
789 | IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); | 779 | IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); |
790 | 780 | ||
791 | if (addr_len != sizeof(struct sockaddr_irda)) | 781 | if (addr_len != sizeof(struct sockaddr_irda)) |
@@ -841,8 +831,6 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) | |||
841 | 831 | ||
842 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__); | 832 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__); |
843 | 833 | ||
844 | IRDA_ASSERT(self != NULL, return -1;); | ||
845 | |||
846 | err = irda_create(newsock, sk->sk_protocol); | 834 | err = irda_create(newsock, sk->sk_protocol); |
847 | if (err) | 835 | if (err) |
848 | return err; | 836 | return err; |
@@ -873,44 +861,28 @@ static int irda_accept(struct socket *sock, struct socket *newsock, int flags) | |||
873 | * calling us, the data is waiting for us ;-) | 861 | * calling us, the data is waiting for us ;-) |
874 | * Jean II | 862 | * Jean II |
875 | */ | 863 | */ |
876 | skb = skb_dequeue(&sk->sk_receive_queue); | 864 | while (1) { |
877 | if (skb == NULL) { | 865 | skb = skb_dequeue(&sk->sk_receive_queue); |
878 | int ret = 0; | 866 | if (skb) |
879 | DECLARE_WAITQUEUE(waitq, current); | 867 | break; |
880 | 868 | ||
881 | /* Non blocking operation */ | 869 | /* Non blocking operation */ |
882 | if (flags & O_NONBLOCK) | 870 | if (flags & O_NONBLOCK) |
883 | return -EWOULDBLOCK; | 871 | return -EWOULDBLOCK; |
884 | 872 | ||
885 | /* The following code is a cut'n'paste of the | 873 | err = wait_event_interruptible(*(sk->sk_sleep), |
886 | * wait_event_interruptible() macro. | 874 | skb_peek(&sk->sk_receive_queue)); |
887 | * We don't us the macro because the condition has | 875 | if (err) |
888 | * side effects : we want to make sure that only one | 876 | return err; |
889 | * skb get dequeued - Jean II */ | ||
890 | add_wait_queue(sk->sk_sleep, &waitq); | ||
891 | for (;;) { | ||
892 | set_current_state(TASK_INTERRUPTIBLE); | ||
893 | skb = skb_dequeue(&sk->sk_receive_queue); | ||
894 | if (skb != NULL) | ||
895 | break; | ||
896 | if (!signal_pending(current)) { | ||
897 | schedule(); | ||
898 | continue; | ||
899 | } | ||
900 | ret = -ERESTARTSYS; | ||
901 | break; | ||
902 | } | ||
903 | current->state = TASK_RUNNING; | ||
904 | remove_wait_queue(sk->sk_sleep, &waitq); | ||
905 | if(ret) | ||
906 | return -ERESTARTSYS; | ||
907 | } | 877 | } |
908 | 878 | ||
909 | newsk = newsock->sk; | 879 | newsk = newsock->sk; |
880 | if (newsk == NULL) | ||
881 | return -EIO; | ||
882 | |||
910 | newsk->sk_state = TCP_ESTABLISHED; | 883 | newsk->sk_state = TCP_ESTABLISHED; |
911 | 884 | ||
912 | new = irda_sk(newsk); | 885 | new = irda_sk(newsk); |
913 | IRDA_ASSERT(new != NULL, return -1;); | ||
914 | 886 | ||
915 | /* Now attach up the new socket */ | 887 | /* Now attach up the new socket */ |
916 | new->tsap = irttp_dup(self->tsap, new); | 888 | new->tsap = irttp_dup(self->tsap, new); |
@@ -1061,7 +1033,8 @@ static int irda_connect(struct socket *sock, struct sockaddr *uaddr, | |||
1061 | 1033 | ||
1062 | if (sk->sk_state != TCP_ESTABLISHED) { | 1034 | if (sk->sk_state != TCP_ESTABLISHED) { |
1063 | sock->state = SS_UNCONNECTED; | 1035 | sock->state = SS_UNCONNECTED; |
1064 | return sock_error(sk); /* Always set at this point */ | 1036 | err = sock_error(sk); |
1037 | return err? err : -ECONNRESET; | ||
1065 | } | 1038 | } |
1066 | 1039 | ||
1067 | sock->state = SS_CONNECTED; | 1040 | sock->state = SS_CONNECTED; |
@@ -1171,8 +1144,6 @@ static void irda_destroy_socket(struct irda_sock *self) | |||
1171 | { | 1144 | { |
1172 | IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); | 1145 | IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); |
1173 | 1146 | ||
1174 | IRDA_ASSERT(self != NULL, return;); | ||
1175 | |||
1176 | /* Unregister with IrLMP */ | 1147 | /* Unregister with IrLMP */ |
1177 | irlmp_unregister_client(self->ckey); | 1148 | irlmp_unregister_client(self->ckey); |
1178 | irlmp_unregister_service(self->skey); | 1149 | irlmp_unregister_service(self->skey); |
@@ -1274,7 +1245,6 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1274 | struct sock *sk = sock->sk; | 1245 | struct sock *sk = sock->sk; |
1275 | struct irda_sock *self; | 1246 | struct irda_sock *self; |
1276 | struct sk_buff *skb; | 1247 | struct sk_buff *skb; |
1277 | unsigned char *asmptr; | ||
1278 | int err; | 1248 | int err; |
1279 | 1249 | ||
1280 | IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len); | 1250 | IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len); |
@@ -1292,7 +1262,6 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1292 | return -ENOTCONN; | 1262 | return -ENOTCONN; |
1293 | 1263 | ||
1294 | self = irda_sk(sk); | 1264 | self = irda_sk(sk); |
1295 | IRDA_ASSERT(self != NULL, return -1;); | ||
1296 | 1265 | ||
1297 | /* Check if IrTTP is wants us to slow down */ | 1266 | /* Check if IrTTP is wants us to slow down */ |
1298 | 1267 | ||
@@ -1317,9 +1286,9 @@ static int irda_sendmsg(struct kiocb *iocb, struct socket *sock, | |||
1317 | return -ENOBUFS; | 1286 | return -ENOBUFS; |
1318 | 1287 | ||
1319 | skb_reserve(skb, self->max_header_size + 16); | 1288 | skb_reserve(skb, self->max_header_size + 16); |
1320 | 1289 | skb_reset_transport_header(skb); | |
1321 | asmptr = skb->h.raw = skb_put(skb, len); | 1290 | skb_put(skb, len); |
1322 | err = memcpy_fromiovec(asmptr, msg->msg_iov, len); | 1291 | err = memcpy_fromiovec(skb_transport_header(skb), msg->msg_iov, len); |
1323 | if (err) { | 1292 | if (err) { |
1324 | kfree_skb(skb); | 1293 | kfree_skb(skb); |
1325 | return err; | 1294 | return err; |
@@ -1355,16 +1324,16 @@ static int irda_recvmsg_dgram(struct kiocb *iocb, struct socket *sock, | |||
1355 | 1324 | ||
1356 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__); | 1325 | IRDA_DEBUG(4, "%s()\n", __FUNCTION__); |
1357 | 1326 | ||
1358 | IRDA_ASSERT(self != NULL, return -1;); | 1327 | if ((err = sock_error(sk)) < 0) |
1359 | IRDA_ASSERT(!sock_error(sk), return -1;); | 1328 | return err; |
1360 | 1329 | ||
1361 | skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, | 1330 | skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, |
1362 | flags & MSG_DONTWAIT, &err); | 1331 | flags & MSG_DONTWAIT, &err); |
1363 | if (!skb) | 1332 | if (!skb) |
1364 | return err; | 1333 | return err; |
1365 | 1334 | ||
1366 | skb->h.raw = skb->data; | 1335 | skb_reset_transport_header(skb); |
1367 | copied = skb->len; | 1336 | copied = skb->len; |
1368 | 1337 | ||
1369 | if (copied > size) { | 1338 | if (copied > size) { |
1370 | IRDA_DEBUG(2, "%s(), Received truncated frame (%zd < %zd)!\n", | 1339 | IRDA_DEBUG(2, "%s(), Received truncated frame (%zd < %zd)!\n", |
@@ -1403,13 +1372,13 @@ static int irda_recvmsg_stream(struct kiocb *iocb, struct socket *sock, | |||
1403 | struct irda_sock *self = irda_sk(sk); | 1372 | struct irda_sock *self = irda_sk(sk); |
1404 | int noblock = flags & MSG_DONTWAIT; | 1373 | int noblock = flags & MSG_DONTWAIT; |
1405 | size_t copied = 0; | 1374 | size_t copied = 0; |
1406 | int target = 1; | 1375 | int target, err; |
1407 | DECLARE_WAITQUEUE(waitq, current); | 1376 | long timeo; |
1408 | 1377 | ||
1409 | IRDA_DEBUG(3, "%s()\n", __FUNCTION__); | 1378 | IRDA_DEBUG(3, "%s()\n", __FUNCTION__); |
1410 | 1379 | ||
1411 | IRDA_ASSERT(self != NULL, return -1;); | 1380 | if ((err = sock_error(sk)) < 0) |
1412 | IRDA_ASSERT(!sock_error(sk), return -1;); | 1381 | return err; |
1413 | 1382 | ||
1414 | if (sock->flags & __SO_ACCEPTCON) | 1383 | if (sock->flags & __SO_ACCEPTCON) |
1415 | return(-EINVAL); | 1384 | return(-EINVAL); |
@@ -1417,8 +1386,8 @@ static int irda_recvmsg_stream(struct kiocb *iocb, struct socket *sock, | |||
1417 | if (flags & MSG_OOB) | 1386 | if (flags & MSG_OOB) |
1418 | return -EOPNOTSUPP; | 1387 | return -EOPNOTSUPP; |
1419 | 1388 | ||
1420 | if (flags & MSG_WAITALL) | 1389 | target = sock_rcvlowat(sk, flags & MSG_WAITALL, size); |
1421 | target = size; | 1390 | timeo = sock_rcvtimeo(sk, noblock); |
1422 | 1391 | ||
1423 | msg->msg_namelen = 0; | 1392 | msg->msg_namelen = 0; |
1424 | 1393 | ||
@@ -1426,19 +1395,14 @@ static int irda_recvmsg_stream(struct kiocb *iocb, struct socket *sock, | |||
1426 | int chunk; | 1395 | int chunk; |
1427 | struct sk_buff *skb = skb_dequeue(&sk->sk_receive_queue); | 1396 | struct sk_buff *skb = skb_dequeue(&sk->sk_receive_queue); |
1428 | 1397 | ||
1429 | if (skb==NULL) { | 1398 | if (skb == NULL) { |
1399 | DEFINE_WAIT(wait); | ||
1430 | int ret = 0; | 1400 | int ret = 0; |
1431 | 1401 | ||
1432 | if (copied >= target) | 1402 | if (copied >= target) |
1433 | break; | 1403 | break; |
1434 | 1404 | ||
1435 | /* The following code is a cut'n'paste of the | 1405 | prepare_to_wait_exclusive(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE); |
1436 | * wait_event_interruptible() macro. | ||
1437 | * We don't us the macro because the test condition | ||
1438 | * is messy. - Jean II */ | ||
1439 | set_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); | ||
1440 | add_wait_queue(sk->sk_sleep, &waitq); | ||
1441 | set_current_state(TASK_INTERRUPTIBLE); | ||
1442 | 1406 | ||
1443 | /* | 1407 | /* |
1444 | * POSIX 1003.1g mandates this order. | 1408 | * POSIX 1003.1g mandates this order. |
@@ -1451,17 +1415,17 @@ static int irda_recvmsg_stream(struct kiocb *iocb, struct socket *sock, | |||
1451 | else if (noblock) | 1415 | else if (noblock) |
1452 | ret = -EAGAIN; | 1416 | ret = -EAGAIN; |
1453 | else if (signal_pending(current)) | 1417 | else if (signal_pending(current)) |
1454 | ret = -ERESTARTSYS; | 1418 | ret = sock_intr_errno(timeo); |
1419 | else if (sk->sk_state != TCP_ESTABLISHED) | ||
1420 | ret = -ENOTCONN; | ||
1455 | else if (skb_peek(&sk->sk_receive_queue) == NULL) | 1421 | else if (skb_peek(&sk->sk_receive_queue) == NULL) |
1456 | /* Wait process until data arrives */ | 1422 | /* Wait process until data arrives */ |
1457 | schedule(); | 1423 | schedule(); |
1458 | 1424 | ||
1459 | current->state = TASK_RUNNING; | 1425 | finish_wait(sk->sk_sleep, &wait); |
1460 | remove_wait_queue(sk->sk_sleep, &waitq); | ||
1461 | clear_bit(SOCK_ASYNC_WAITDATA, &sk->sk_socket->flags); | ||
1462 | 1426 | ||
1463 | if(ret) | 1427 | if (ret) |
1464 | return(ret); | 1428 | return ret; |
1465 | if (sk->sk_shutdown & RCV_SHUTDOWN) | 1429 | if (sk->sk_shutdown & RCV_SHUTDOWN) |
1466 | break; | 1430 | break; |
1467 | 1431 | ||
@@ -1530,7 +1494,6 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock, | |||
1530 | struct sock *sk = sock->sk; | 1494 | struct sock *sk = sock->sk; |
1531 | struct irda_sock *self; | 1495 | struct irda_sock *self; |
1532 | struct sk_buff *skb; | 1496 | struct sk_buff *skb; |
1533 | unsigned char *asmptr; | ||
1534 | int err; | 1497 | int err; |
1535 | 1498 | ||
1536 | IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len); | 1499 | IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len); |
@@ -1547,7 +1510,6 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock, | |||
1547 | return -ENOTCONN; | 1510 | return -ENOTCONN; |
1548 | 1511 | ||
1549 | self = irda_sk(sk); | 1512 | self = irda_sk(sk); |
1550 | IRDA_ASSERT(self != NULL, return -1;); | ||
1551 | 1513 | ||
1552 | /* | 1514 | /* |
1553 | * Check that we don't send out too big frames. This is an unreliable | 1515 | * Check that we don't send out too big frames. This is an unreliable |
@@ -1566,10 +1528,11 @@ static int irda_sendmsg_dgram(struct kiocb *iocb, struct socket *sock, | |||
1566 | return -ENOBUFS; | 1528 | return -ENOBUFS; |
1567 | 1529 | ||
1568 | skb_reserve(skb, self->max_header_size); | 1530 | skb_reserve(skb, self->max_header_size); |
1531 | skb_reset_transport_header(skb); | ||
1569 | 1532 | ||
1570 | IRDA_DEBUG(4, "%s(), appending user data\n", __FUNCTION__); | 1533 | IRDA_DEBUG(4, "%s(), appending user data\n", __FUNCTION__); |
1571 | asmptr = skb->h.raw = skb_put(skb, len); | 1534 | skb_put(skb, len); |
1572 | err = memcpy_fromiovec(asmptr, msg->msg_iov, len); | 1535 | err = memcpy_fromiovec(skb_transport_header(skb), msg->msg_iov, len); |
1573 | if (err) { | 1536 | if (err) { |
1574 | kfree_skb(skb); | 1537 | kfree_skb(skb); |
1575 | return err; | 1538 | return err; |
@@ -1602,7 +1565,6 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock, | |||
1602 | __u8 pid = 0; | 1565 | __u8 pid = 0; |
1603 | int bound = 0; | 1566 | int bound = 0; |
1604 | struct sk_buff *skb; | 1567 | struct sk_buff *skb; |
1605 | unsigned char *asmptr; | ||
1606 | int err; | 1568 | int err; |
1607 | 1569 | ||
1608 | IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len); | 1570 | IRDA_DEBUG(4, "%s(), len=%zd\n", __FUNCTION__, len); |
@@ -1616,7 +1578,6 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock, | |||
1616 | } | 1578 | } |
1617 | 1579 | ||
1618 | self = irda_sk(sk); | 1580 | self = irda_sk(sk); |
1619 | IRDA_ASSERT(self != NULL, return -1;); | ||
1620 | 1581 | ||
1621 | /* Check if an address was specified with sendto. Jean II */ | 1582 | /* Check if an address was specified with sendto. Jean II */ |
1622 | if (msg->msg_name) { | 1583 | if (msg->msg_name) { |
@@ -1662,10 +1623,11 @@ static int irda_sendmsg_ultra(struct kiocb *iocb, struct socket *sock, | |||
1662 | return -ENOBUFS; | 1623 | return -ENOBUFS; |
1663 | 1624 | ||
1664 | skb_reserve(skb, self->max_header_size); | 1625 | skb_reserve(skb, self->max_header_size); |
1626 | skb_reset_transport_header(skb); | ||
1665 | 1627 | ||
1666 | IRDA_DEBUG(4, "%s(), appending user data\n", __FUNCTION__); | 1628 | IRDA_DEBUG(4, "%s(), appending user data\n", __FUNCTION__); |
1667 | asmptr = skb->h.raw = skb_put(skb, len); | 1629 | skb_put(skb, len); |
1668 | err = memcpy_fromiovec(asmptr, msg->msg_iov, len); | 1630 | err = memcpy_fromiovec(skb_transport_header(skb), msg->msg_iov, len); |
1669 | if (err) { | 1631 | if (err) { |
1670 | kfree_skb(skb); | 1632 | kfree_skb(skb); |
1671 | return err; | 1633 | return err; |
@@ -1689,8 +1651,6 @@ static int irda_shutdown(struct socket *sock, int how) | |||
1689 | struct sock *sk = sock->sk; | 1651 | struct sock *sk = sock->sk; |
1690 | struct irda_sock *self = irda_sk(sk); | 1652 | struct irda_sock *self = irda_sk(sk); |
1691 | 1653 | ||
1692 | IRDA_ASSERT(self != NULL, return -1;); | ||
1693 | |||
1694 | IRDA_DEBUG(1, "%s(%p)\n", __FUNCTION__, self); | 1654 | IRDA_DEBUG(1, "%s(%p)\n", __FUNCTION__, self); |
1695 | 1655 | ||
1696 | sk->sk_state = TCP_CLOSE; | 1656 | sk->sk_state = TCP_CLOSE; |
@@ -1863,8 +1823,6 @@ static int irda_setsockopt(struct socket *sock, int level, int optname, | |||
1863 | struct ias_attrib * ias_attr; /* Attribute in IAS object */ | 1823 | struct ias_attrib * ias_attr; /* Attribute in IAS object */ |
1864 | int opt; | 1824 | int opt; |
1865 | 1825 | ||
1866 | IRDA_ASSERT(self != NULL, return -1;); | ||
1867 | |||
1868 | IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); | 1826 | IRDA_DEBUG(2, "%s(%p)\n", __FUNCTION__, self); |
1869 | 1827 | ||
1870 | if (level != SOL_IRLMP) | 1828 | if (level != SOL_IRLMP) |
diff --git a/net/irda/ircomm/ircomm_param.c b/net/irda/ircomm/ircomm_param.c index 01d7c9c7b3b4..e5e4792a0314 100644 --- a/net/irda/ircomm/ircomm_param.c +++ b/net/irda/ircomm/ircomm_param.c | |||
@@ -133,8 +133,8 @@ int ircomm_param_request(struct ircomm_tty_cb *self, __u8 pi, int flush) | |||
133 | * Inserting is a little bit tricky since we don't know how much | 133 | * Inserting is a little bit tricky since we don't know how much |
134 | * room we will need. But this should hopefully work OK | 134 | * room we will need. But this should hopefully work OK |
135 | */ | 135 | */ |
136 | count = irda_param_insert(self, pi, skb->tail, skb_tailroom(skb), | 136 | count = irda_param_insert(self, pi, skb_tail_pointer(skb), |
137 | &ircomm_param_info); | 137 | skb_tailroom(skb), &ircomm_param_info); |
138 | if (count < 0) { | 138 | if (count < 0) { |
139 | IRDA_WARNING("%s(), no room for parameter!\n", __FUNCTION__); | 139 | IRDA_WARNING("%s(), no room for parameter!\n", __FUNCTION__); |
140 | spin_unlock_irqrestore(&self->spinlock, flags); | 140 | spin_unlock_irqrestore(&self->spinlock, flags); |
diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c index e717801b38f9..7b5def1ea633 100644 --- a/net/irda/irda_device.c +++ b/net/irda/irda_device.c | |||
@@ -375,7 +375,7 @@ EXPORT_SYMBOL(alloc_irdadev); | |||
375 | dongle_t *irda_device_dongle_init(struct net_device *dev, int type) | 375 | dongle_t *irda_device_dongle_init(struct net_device *dev, int type) |
376 | { | 376 | { |
377 | struct dongle_reg *reg; | 377 | struct dongle_reg *reg; |
378 | dongle_t *dongle = NULL; | 378 | dongle_t *dongle = kzalloc(sizeof(dongle_t), GFP_KERNEL); |
379 | 379 | ||
380 | might_sleep(); | 380 | might_sleep(); |
381 | 381 | ||
@@ -397,19 +397,14 @@ dongle_t *irda_device_dongle_init(struct net_device *dev, int type) | |||
397 | if (!reg || !try_module_get(reg->owner) ) { | 397 | if (!reg || !try_module_get(reg->owner) ) { |
398 | IRDA_ERROR("IrDA: Unable to find requested dongle type %x\n", | 398 | IRDA_ERROR("IrDA: Unable to find requested dongle type %x\n", |
399 | type); | 399 | type); |
400 | goto out; | 400 | kfree(dongle); |
401 | dongle = NULL; | ||
402 | } | ||
403 | if (dongle) { | ||
404 | /* Bind the registration info to this particular instance */ | ||
405 | dongle->issue = reg; | ||
406 | dongle->dev = dev; | ||
401 | } | 407 | } |
402 | |||
403 | /* Allocate dongle info for this instance */ | ||
404 | dongle = kzalloc(sizeof(dongle_t), GFP_KERNEL); | ||
405 | if (!dongle) | ||
406 | goto out; | ||
407 | |||
408 | /* Bind the registration info to this particular instance */ | ||
409 | dongle->issue = reg; | ||
410 | dongle->dev = dev; | ||
411 | |||
412 | out: | ||
413 | spin_unlock(&dongles->hb_spinlock); | 408 | spin_unlock(&dongles->hb_spinlock); |
414 | return dongle; | 409 | return dongle; |
415 | } | 410 | } |
diff --git a/net/irda/irlan/irlan_common.c b/net/irda/irlan/irlan_common.c index fcf9d6599628..ed69773b0f8e 100644 --- a/net/irda/irlan/irlan_common.c +++ b/net/irda/irlan/irlan_common.c | |||
@@ -1039,7 +1039,7 @@ static int __irlan_insert_param(struct sk_buff *skb, char *param, int type, | |||
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | /* Insert at end of sk-buffer */ | 1041 | /* Insert at end of sk-buffer */ |
1042 | frame = skb->tail; | 1042 | frame = skb_tail_pointer(skb); |
1043 | 1043 | ||
1044 | /* Make space for data */ | 1044 | /* Make space for data */ |
1045 | if (skb_tailroom(skb) < (param_len+value_len+3)) { | 1045 | if (skb_tailroom(skb) < (param_len+value_len+3)) { |
diff --git a/net/irda/irlan/irlan_eth.c b/net/irda/irlan/irlan_eth.c index 672ab3f69033..c421521c0a99 100644 --- a/net/irda/irlan/irlan_eth.c +++ b/net/irda/irlan/irlan_eth.c | |||
@@ -234,8 +234,7 @@ int irlan_eth_receive(void *instance, void *sap, struct sk_buff *skb) | |||
234 | * might have been previously set by the low level IrDA network | 234 | * might have been previously set by the low level IrDA network |
235 | * device driver | 235 | * device driver |
236 | */ | 236 | */ |
237 | skb->dev = self->dev; | 237 | skb->protocol = eth_type_trans(skb, self->dev); /* Remove eth header */ |
238 | skb->protocol=eth_type_trans(skb, skb->dev); /* Remove eth header */ | ||
239 | 238 | ||
240 | self->stats.rx_packets++; | 239 | self->stats.rx_packets++; |
241 | self->stats.rx_bytes += skb->len; | 240 | self->stats.rx_bytes += skb->len; |
diff --git a/net/irda/irlap_event.c b/net/irda/irlap_event.c index 7b6433fe1dc2..0b02073ffdf3 100644 --- a/net/irda/irlap_event.c +++ b/net/irda/irlap_event.c | |||
@@ -590,7 +590,7 @@ static int irlap_state_query(struct irlap_cb *self, IRLAP_EVENT event, | |||
590 | if (!self->discovery_log) { | 590 | if (!self->discovery_log) { |
591 | IRDA_WARNING("%s: discovery log is gone! " | 591 | IRDA_WARNING("%s: discovery log is gone! " |
592 | "maybe the discovery timeout has been set" | 592 | "maybe the discovery timeout has been set" |
593 | " to short?\n", __FUNCTION__); | 593 | " too short?\n", __FUNCTION__); |
594 | break; | 594 | break; |
595 | } | 595 | } |
596 | hashbin_insert(self->discovery_log, | 596 | hashbin_insert(self->discovery_log, |
diff --git a/net/irda/irlap_frame.c b/net/irda/irlap_frame.c index 0b04603e9c47..3c5a68e36414 100644 --- a/net/irda/irlap_frame.c +++ b/net/irda/irlap_frame.c | |||
@@ -93,7 +93,9 @@ void irlap_queue_xmit(struct irlap_cb *self, struct sk_buff *skb) | |||
93 | { | 93 | { |
94 | /* Some common init stuff */ | 94 | /* Some common init stuff */ |
95 | skb->dev = self->netdev; | 95 | skb->dev = self->netdev; |
96 | skb->h.raw = skb->nh.raw = skb->mac.raw = skb->data; | 96 | skb_reset_mac_header(skb); |
97 | skb_reset_network_header(skb); | ||
98 | skb_reset_transport_header(skb); | ||
97 | skb->protocol = htons(ETH_P_IRDA); | 99 | skb->protocol = htons(ETH_P_IRDA); |
98 | skb->priority = TC_PRIO_BESTEFFORT; | 100 | skb->priority = TC_PRIO_BESTEFFORT; |
99 | 101 | ||
@@ -411,7 +413,7 @@ static void irlap_recv_discovery_xid_rsp(struct irlap_cb *self, | |||
411 | IRDA_ASSERT(self->magic == LAP_MAGIC, return;); | 413 | IRDA_ASSERT(self->magic == LAP_MAGIC, return;); |
412 | 414 | ||
413 | if (!pskb_may_pull(skb, sizeof(struct xid_frame))) { | 415 | if (!pskb_may_pull(skb, sizeof(struct xid_frame))) { |
414 | IRDA_ERROR("%s: frame to short!\n", __FUNCTION__); | 416 | IRDA_ERROR("%s: frame too short!\n", __FUNCTION__); |
415 | return; | 417 | return; |
416 | } | 418 | } |
417 | 419 | ||
@@ -482,7 +484,7 @@ static void irlap_recv_discovery_xid_cmd(struct irlap_cb *self, | |||
482 | char *text; | 484 | char *text; |
483 | 485 | ||
484 | if (!pskb_may_pull(skb, sizeof(struct xid_frame))) { | 486 | if (!pskb_may_pull(skb, sizeof(struct xid_frame))) { |
485 | IRDA_ERROR("%s: frame to short!\n", __FUNCTION__); | 487 | IRDA_ERROR("%s: frame too short!\n", __FUNCTION__); |
486 | return; | 488 | return; |
487 | } | 489 | } |
488 | 490 | ||
@@ -526,7 +528,7 @@ static void irlap_recv_discovery_xid_cmd(struct irlap_cb *self, | |||
526 | /* Check if things are sane at this point... */ | 528 | /* Check if things are sane at this point... */ |
527 | if((discovery_info == NULL) || | 529 | if((discovery_info == NULL) || |
528 | !pskb_may_pull(skb, 3)) { | 530 | !pskb_may_pull(skb, 3)) { |
529 | IRDA_ERROR("%s: discovery frame to short!\n", | 531 | IRDA_ERROR("%s: discovery frame too short!\n", |
530 | __FUNCTION__); | 532 | __FUNCTION__); |
531 | return; | 533 | return; |
532 | } | 534 | } |
@@ -1171,7 +1173,7 @@ static void irlap_recv_frmr_frame(struct irlap_cb *self, struct sk_buff *skb, | |||
1171 | IRDA_ASSERT(info != NULL, return;); | 1173 | IRDA_ASSERT(info != NULL, return;); |
1172 | 1174 | ||
1173 | if (!pskb_may_pull(skb, 4)) { | 1175 | if (!pskb_may_pull(skb, 4)) { |
1174 | IRDA_ERROR("%s: frame to short!\n", __FUNCTION__); | 1176 | IRDA_ERROR("%s: frame too short!\n", __FUNCTION__); |
1175 | return; | 1177 | return; |
1176 | } | 1178 | } |
1177 | 1179 | ||
@@ -1260,7 +1262,7 @@ static void irlap_recv_test_frame(struct irlap_cb *self, struct sk_buff *skb, | |||
1260 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__); | 1262 | IRDA_DEBUG(2, "%s()\n", __FUNCTION__); |
1261 | 1263 | ||
1262 | if (!pskb_may_pull(skb, sizeof(*frame))) { | 1264 | if (!pskb_may_pull(skb, sizeof(*frame))) { |
1263 | IRDA_ERROR("%s: frame to short!\n", __FUNCTION__); | 1265 | IRDA_ERROR("%s: frame too short!\n", __FUNCTION__); |
1264 | return; | 1266 | return; |
1265 | } | 1267 | } |
1266 | frame = (struct test_frame *) skb->data; | 1268 | frame = (struct test_frame *) skb->data; |
@@ -1268,7 +1270,7 @@ static void irlap_recv_test_frame(struct irlap_cb *self, struct sk_buff *skb, | |||
1268 | /* Broadcast frames must carry saddr and daddr fields */ | 1270 | /* Broadcast frames must carry saddr and daddr fields */ |
1269 | if (info->caddr == CBROADCAST) { | 1271 | if (info->caddr == CBROADCAST) { |
1270 | if (skb->len < sizeof(struct test_frame)) { | 1272 | if (skb->len < sizeof(struct test_frame)) { |
1271 | IRDA_DEBUG(0, "%s() test frame to short!\n", | 1273 | IRDA_DEBUG(0, "%s() test frame too short!\n", |
1272 | __FUNCTION__); | 1274 | __FUNCTION__); |
1273 | return; | 1275 | return; |
1274 | } | 1276 | } |
@@ -1334,7 +1336,7 @@ int irlap_driver_rcv(struct sk_buff *skb, struct net_device *dev, | |||
1334 | 1336 | ||
1335 | /* Check if frame is large enough for parsing */ | 1337 | /* Check if frame is large enough for parsing */ |
1336 | if (!pskb_may_pull(skb, 2)) { | 1338 | if (!pskb_may_pull(skb, 2)) { |
1337 | IRDA_ERROR("%s: frame to short!\n", __FUNCTION__); | 1339 | IRDA_ERROR("%s: frame too short!\n", __FUNCTION__); |
1338 | dev_kfree_skb(skb); | 1340 | dev_kfree_skb(skb); |
1339 | return -1; | 1341 | return -1; |
1340 | } | 1342 | } |
diff --git a/net/irda/irqueue.c b/net/irda/irqueue.c index 92662330dbcf..d058b467f9e4 100644 --- a/net/irda/irqueue.c +++ b/net/irda/irqueue.c | |||
@@ -384,6 +384,9 @@ EXPORT_SYMBOL(hashbin_new); | |||
384 | * for deallocating this structure if it's complex. If not the user can | 384 | * for deallocating this structure if it's complex. If not the user can |
385 | * just supply kfree, which should take care of the job. | 385 | * just supply kfree, which should take care of the job. |
386 | */ | 386 | */ |
387 | #ifdef CONFIG_LOCKDEP | ||
388 | static int hashbin_lock_depth = 0; | ||
389 | #endif | ||
387 | int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) | 390 | int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) |
388 | { | 391 | { |
389 | irda_queue_t* queue; | 392 | irda_queue_t* queue; |
@@ -395,7 +398,8 @@ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) | |||
395 | 398 | ||
396 | /* Synchronize */ | 399 | /* Synchronize */ |
397 | if ( hashbin->hb_type & HB_LOCK ) { | 400 | if ( hashbin->hb_type & HB_LOCK ) { |
398 | spin_lock_irqsave(&hashbin->hb_spinlock, flags); | 401 | spin_lock_irqsave_nested(&hashbin->hb_spinlock, flags, |
402 | hashbin_lock_depth++); | ||
399 | } | 403 | } |
400 | 404 | ||
401 | /* | 405 | /* |
@@ -419,6 +423,9 @@ int hashbin_delete( hashbin_t* hashbin, FREE_FUNC free_func) | |||
419 | /* Release lock */ | 423 | /* Release lock */ |
420 | if ( hashbin->hb_type & HB_LOCK) { | 424 | if ( hashbin->hb_type & HB_LOCK) { |
421 | spin_unlock_irqrestore(&hashbin->hb_spinlock, flags); | 425 | spin_unlock_irqrestore(&hashbin->hb_spinlock, flags); |
426 | #ifdef CONFIG_LOCKDEP | ||
427 | hashbin_lock_depth--; | ||
428 | #endif | ||
422 | } | 429 | } |
423 | 430 | ||
424 | /* | 431 | /* |
diff --git a/net/irda/irttp.c b/net/irda/irttp.c index da3f2bc1b6f6..7069e4a58257 100644 --- a/net/irda/irttp.c +++ b/net/irda/irttp.c | |||
@@ -256,7 +256,7 @@ static struct sk_buff *irttp_reassemble_skb(struct tsap_cb *self) | |||
256 | * Copy all fragments to a new buffer | 256 | * Copy all fragments to a new buffer |
257 | */ | 257 | */ |
258 | while ((frag = skb_dequeue(&self->rx_fragments)) != NULL) { | 258 | while ((frag = skb_dequeue(&self->rx_fragments)) != NULL) { |
259 | memcpy(skb->data+n, frag->data, frag->len); | 259 | skb_copy_to_linear_data_offset(skb, n, frag->data, frag->len); |
260 | n += frag->len; | 260 | n += frag->len; |
261 | 261 | ||
262 | dev_kfree_skb(frag); | 262 | dev_kfree_skb(frag); |
@@ -314,8 +314,8 @@ static inline void irttp_fragment_skb(struct tsap_cb *self, | |||
314 | skb_reserve(frag, self->max_header_size); | 314 | skb_reserve(frag, self->max_header_size); |
315 | 315 | ||
316 | /* Copy data from the original skb into this fragment. */ | 316 | /* Copy data from the original skb into this fragment. */ |
317 | memcpy(skb_put(frag, self->max_seg_size), skb->data, | 317 | skb_copy_from_linear_data(skb, skb_put(frag, self->max_seg_size), |
318 | self->max_seg_size); | 318 | self->max_seg_size); |
319 | 319 | ||
320 | /* Insert TTP header, with the more bit set */ | 320 | /* Insert TTP header, with the more bit set */ |
321 | frame = skb_push(frag, TTP_HEADER); | 321 | frame = skb_push(frag, TTP_HEADER); |
@@ -551,7 +551,7 @@ int irttp_udata_request(struct tsap_cb *self, struct sk_buff *skb) | |||
551 | } | 551 | } |
552 | 552 | ||
553 | if (skb->len > self->max_seg_size) { | 553 | if (skb->len > self->max_seg_size) { |
554 | IRDA_DEBUG(1, "%s(), UData is to large for IrLAP!\n", | 554 | IRDA_DEBUG(1, "%s(), UData is too large for IrLAP!\n", |
555 | __FUNCTION__); | 555 | __FUNCTION__); |
556 | goto err; | 556 | goto err; |
557 | } | 557 | } |
@@ -598,7 +598,7 @@ int irttp_data_request(struct tsap_cb *self, struct sk_buff *skb) | |||
598 | * inside an IrLAP frame | 598 | * inside an IrLAP frame |
599 | */ | 599 | */ |
600 | if ((self->tx_max_sdu_size == 0) && (skb->len > self->max_seg_size)) { | 600 | if ((self->tx_max_sdu_size == 0) && (skb->len > self->max_seg_size)) { |
601 | IRDA_ERROR("%s: SAR disabled, and data is to large for IrLAP!\n", | 601 | IRDA_ERROR("%s: SAR disabled, and data is too large for IrLAP!\n", |
602 | __FUNCTION__); | 602 | __FUNCTION__); |
603 | ret = -EMSGSIZE; | 603 | ret = -EMSGSIZE; |
604 | goto err; | 604 | goto err; |
diff --git a/net/irda/parameters.c b/net/irda/parameters.c index 75a72d203b01..2627dad7cd87 100644 --- a/net/irda/parameters.c +++ b/net/irda/parameters.c | |||
@@ -160,7 +160,7 @@ static int irda_insert_integer(void *self, __u8 *buf, int len, __u8 pi, | |||
160 | } | 160 | } |
161 | /* Check if buffer is long enough for insertion */ | 161 | /* Check if buffer is long enough for insertion */ |
162 | if (len < (2+p.pl)) { | 162 | if (len < (2+p.pl)) { |
163 | IRDA_WARNING("%s: buffer to short for insertion!\n", | 163 | IRDA_WARNING("%s: buffer too short for insertion!\n", |
164 | __FUNCTION__); | 164 | __FUNCTION__); |
165 | return -1; | 165 | return -1; |
166 | } | 166 | } |
@@ -216,7 +216,7 @@ static int irda_extract_integer(void *self, __u8 *buf, int len, __u8 pi, | |||
216 | 216 | ||
217 | /* Check if buffer is long enough for parsing */ | 217 | /* Check if buffer is long enough for parsing */ |
218 | if (len < (2+p.pl)) { | 218 | if (len < (2+p.pl)) { |
219 | IRDA_WARNING("%s: buffer to short for parsing! " | 219 | IRDA_WARNING("%s: buffer too short for parsing! " |
220 | "Need %d bytes, but len is only %d\n", | 220 | "Need %d bytes, but len is only %d\n", |
221 | __FUNCTION__, p.pl, len); | 221 | __FUNCTION__, p.pl, len); |
222 | return -1; | 222 | return -1; |
@@ -304,7 +304,7 @@ static int irda_extract_string(void *self, __u8 *buf, int len, __u8 pi, | |||
304 | 304 | ||
305 | /* Check if buffer is long enough for parsing */ | 305 | /* Check if buffer is long enough for parsing */ |
306 | if (len < (2+p.pl)) { | 306 | if (len < (2+p.pl)) { |
307 | IRDA_WARNING("%s: buffer to short for parsing! " | 307 | IRDA_WARNING("%s: buffer too short for parsing! " |
308 | "Need %d bytes, but len is only %d\n", | 308 | "Need %d bytes, but len is only %d\n", |
309 | __FUNCTION__, p.pl, len); | 309 | __FUNCTION__, p.pl, len); |
310 | return -1; | 310 | return -1; |
@@ -343,7 +343,7 @@ static int irda_extract_octseq(void *self, __u8 *buf, int len, __u8 pi, | |||
343 | 343 | ||
344 | /* Check if buffer is long enough for parsing */ | 344 | /* Check if buffer is long enough for parsing */ |
345 | if (len < (2+p.pl)) { | 345 | if (len < (2+p.pl)) { |
346 | IRDA_WARNING("%s: buffer to short for parsing! " | 346 | IRDA_WARNING("%s: buffer too short for parsing! " |
347 | "Need %d bytes, but len is only %d\n", | 347 | "Need %d bytes, but len is only %d\n", |
348 | __FUNCTION__, p.pl, len); | 348 | __FUNCTION__, p.pl, len); |
349 | return -1; | 349 | return -1; |
diff --git a/net/irda/qos.c b/net/irda/qos.c index 349012c926b7..aeb18cf1dcae 100644 --- a/net/irda/qos.c +++ b/net/irda/qos.c | |||
@@ -469,49 +469,49 @@ int irlap_insert_qos_negotiation_params(struct irlap_cb *self, | |||
469 | int ret; | 469 | int ret; |
470 | 470 | ||
471 | /* Insert data rate */ | 471 | /* Insert data rate */ |
472 | ret = irda_param_insert(self, PI_BAUD_RATE, skb->tail, | 472 | ret = irda_param_insert(self, PI_BAUD_RATE, skb_tail_pointer(skb), |
473 | skb_tailroom(skb), &irlap_param_info); | 473 | skb_tailroom(skb), &irlap_param_info); |
474 | if (ret < 0) | 474 | if (ret < 0) |
475 | return ret; | 475 | return ret; |
476 | skb_put(skb, ret); | 476 | skb_put(skb, ret); |
477 | 477 | ||
478 | /* Insert max turnaround time */ | 478 | /* Insert max turnaround time */ |
479 | ret = irda_param_insert(self, PI_MAX_TURN_TIME, skb->tail, | 479 | ret = irda_param_insert(self, PI_MAX_TURN_TIME, skb_tail_pointer(skb), |
480 | skb_tailroom(skb), &irlap_param_info); | 480 | skb_tailroom(skb), &irlap_param_info); |
481 | if (ret < 0) | 481 | if (ret < 0) |
482 | return ret; | 482 | return ret; |
483 | skb_put(skb, ret); | 483 | skb_put(skb, ret); |
484 | 484 | ||
485 | /* Insert data size */ | 485 | /* Insert data size */ |
486 | ret = irda_param_insert(self, PI_DATA_SIZE, skb->tail, | 486 | ret = irda_param_insert(self, PI_DATA_SIZE, skb_tail_pointer(skb), |
487 | skb_tailroom(skb), &irlap_param_info); | 487 | skb_tailroom(skb), &irlap_param_info); |
488 | if (ret < 0) | 488 | if (ret < 0) |
489 | return ret; | 489 | return ret; |
490 | skb_put(skb, ret); | 490 | skb_put(skb, ret); |
491 | 491 | ||
492 | /* Insert window size */ | 492 | /* Insert window size */ |
493 | ret = irda_param_insert(self, PI_WINDOW_SIZE, skb->tail, | 493 | ret = irda_param_insert(self, PI_WINDOW_SIZE, skb_tail_pointer(skb), |
494 | skb_tailroom(skb), &irlap_param_info); | 494 | skb_tailroom(skb), &irlap_param_info); |
495 | if (ret < 0) | 495 | if (ret < 0) |
496 | return ret; | 496 | return ret; |
497 | skb_put(skb, ret); | 497 | skb_put(skb, ret); |
498 | 498 | ||
499 | /* Insert additional BOFs */ | 499 | /* Insert additional BOFs */ |
500 | ret = irda_param_insert(self, PI_ADD_BOFS, skb->tail, | 500 | ret = irda_param_insert(self, PI_ADD_BOFS, skb_tail_pointer(skb), |
501 | skb_tailroom(skb), &irlap_param_info); | 501 | skb_tailroom(skb), &irlap_param_info); |
502 | if (ret < 0) | 502 | if (ret < 0) |
503 | return ret; | 503 | return ret; |
504 | skb_put(skb, ret); | 504 | skb_put(skb, ret); |
505 | 505 | ||
506 | /* Insert minimum turnaround time */ | 506 | /* Insert minimum turnaround time */ |
507 | ret = irda_param_insert(self, PI_MIN_TURN_TIME, skb->tail, | 507 | ret = irda_param_insert(self, PI_MIN_TURN_TIME, skb_tail_pointer(skb), |
508 | skb_tailroom(skb), &irlap_param_info); | 508 | skb_tailroom(skb), &irlap_param_info); |
509 | if (ret < 0) | 509 | if (ret < 0) |
510 | return ret; | 510 | return ret; |
511 | skb_put(skb, ret); | 511 | skb_put(skb, ret); |
512 | 512 | ||
513 | /* Insert link disconnect/threshold time */ | 513 | /* Insert link disconnect/threshold time */ |
514 | ret = irda_param_insert(self, PI_LINK_DISC, skb->tail, | 514 | ret = irda_param_insert(self, PI_LINK_DISC, skb_tail_pointer(skb), |
515 | skb_tailroom(skb), &irlap_param_info); | 515 | skb_tailroom(skb), &irlap_param_info); |
516 | if (ret < 0) | 516 | if (ret < 0) |
517 | return ret; | 517 | return ret; |
diff --git a/net/irda/wrapper.c b/net/irda/wrapper.c index 5abfb71aae8d..a7a7f191f1a8 100644 --- a/net/irda/wrapper.c +++ b/net/irda/wrapper.c | |||
@@ -239,7 +239,8 @@ async_bump(struct net_device *dev, | |||
239 | 239 | ||
240 | if(docopy) { | 240 | if(docopy) { |
241 | /* Copy data without CRC (lenght already checked) */ | 241 | /* Copy data without CRC (lenght already checked) */ |
242 | memcpy(newskb->data, rx_buff->data, rx_buff->len - 2); | 242 | skb_copy_to_linear_data(newskb, rx_buff->data, |
243 | rx_buff->len - 2); | ||
243 | /* Deliver this skb */ | 244 | /* Deliver this skb */ |
244 | dataskb = newskb; | 245 | dataskb = newskb; |
245 | } else { | 246 | } else { |
@@ -256,7 +257,7 @@ async_bump(struct net_device *dev, | |||
256 | 257 | ||
257 | /* Feed it to IrLAP layer */ | 258 | /* Feed it to IrLAP layer */ |
258 | dataskb->dev = dev; | 259 | dataskb->dev = dev; |
259 | dataskb->mac.raw = dataskb->data; | 260 | skb_reset_mac_header(dataskb); |
260 | dataskb->protocol = htons(ETH_P_IRDA); | 261 | dataskb->protocol = htons(ETH_P_IRDA); |
261 | 262 | ||
262 | netif_rx(dataskb); | 263 | netif_rx(dataskb); |