diff options
author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-17 15:00:22 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2013-06-17 15:00:22 -0400 |
commit | bf32d52c455d933cc9a459bb94af9ea8b5850af9 (patch) | |
tree | 0d6af119b141e46e120ad06c867fe82ac3c00f1c /net | |
parent | 0c375501be6e6dc23c11ebfa394434517444e62d (diff) | |
parent | 7d132055814ef17a6c7b69f342244c410a5e000f (diff) |
Merge 3.10-rc6 into tty-next
We want the changes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/9p/client.c | 55 | ||||
-rw-r--r-- | net/batman-adv/bat_iv_ogm.c | 86 | ||||
-rw-r--r-- | net/batman-adv/bridge_loop_avoidance.c | 4 | ||||
-rw-r--r-- | net/batman-adv/sysfs.c | 5 | ||||
-rw-r--r-- | net/bluetooth/hci_core.c | 6 | ||||
-rw-r--r-- | net/bluetooth/l2cap_core.c | 70 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 23 | ||||
-rw-r--r-- | net/bluetooth/smp.c | 4 | ||||
-rw-r--r-- | net/ceph/osd_client.c | 2 | ||||
-rw-r--r-- | net/core/filter.c | 2 | ||||
-rw-r--r-- | net/core/sock_diag.c | 9 | ||||
-rw-r--r-- | net/ipv4/ip_tunnel.c | 4 | ||||
-rw-r--r-- | net/ipv4/ip_vti.c | 3 | ||||
-rw-r--r-- | net/l2tp/l2tp_ppp.c | 6 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_ctl.c | 1 | ||||
-rw-r--r-- | net/netfilter/nfnetlink_acct.c | 7 | ||||
-rw-r--r-- | net/netfilter/nfnetlink_cttimeout.c | 7 | ||||
-rw-r--r-- | net/netfilter/nfnetlink_queue_core.c | 6 | ||||
-rw-r--r-- | net/netfilter/xt_TCPMSS.c | 6 | ||||
-rw-r--r-- | net/netlink/af_netlink.c | 2 | ||||
-rw-r--r-- | net/packet/af_packet.c | 5 | ||||
-rw-r--r-- | net/sched/sch_api.c | 11 | ||||
-rw-r--r-- | net/sctp/outqueue.c | 6 | ||||
-rw-r--r-- | net/sctp/socket.c | 6 |
24 files changed, 211 insertions, 125 deletions
diff --git a/net/9p/client.c b/net/9p/client.c index 8eb75425e6e6..addc116cecf0 100644 --- a/net/9p/client.c +++ b/net/9p/client.c | |||
@@ -562,36 +562,19 @@ static int p9_check_zc_errors(struct p9_client *c, struct p9_req_t *req, | |||
562 | 562 | ||
563 | if (!p9_is_proto_dotl(c)) { | 563 | if (!p9_is_proto_dotl(c)) { |
564 | /* Error is reported in string format */ | 564 | /* Error is reported in string format */ |
565 | uint16_t len; | 565 | int len; |
566 | /* 7 = header size for RERROR, 2 is the size of string len; */ | 566 | /* 7 = header size for RERROR; */ |
567 | int inline_len = in_hdrlen - (7 + 2); | 567 | int inline_len = in_hdrlen - 7; |
568 | 568 | ||
569 | /* Read the size of error string */ | 569 | len = req->rc->size - req->rc->offset; |
570 | err = p9pdu_readf(req->rc, c->proto_version, "w", &len); | 570 | if (len > (P9_ZC_HDR_SZ - 7)) { |
571 | if (err) | 571 | err = -EFAULT; |
572 | goto out_err; | ||
573 | |||
574 | ename = kmalloc(len + 1, GFP_NOFS); | ||
575 | if (!ename) { | ||
576 | err = -ENOMEM; | ||
577 | goto out_err; | 572 | goto out_err; |
578 | } | 573 | } |
579 | if (len <= inline_len) { | ||
580 | /* We have error in protocol buffer itself */ | ||
581 | if (pdu_read(req->rc, ename, len)) { | ||
582 | err = -EFAULT; | ||
583 | goto out_free; | ||
584 | 574 | ||
585 | } | 575 | ename = &req->rc->sdata[req->rc->offset]; |
586 | } else { | 576 | if (len > inline_len) { |
587 | /* | 577 | /* We have error in external buffer */ |
588 | * Part of the data is in user space buffer. | ||
589 | */ | ||
590 | if (pdu_read(req->rc, ename, inline_len)) { | ||
591 | err = -EFAULT; | ||
592 | goto out_free; | ||
593 | |||
594 | } | ||
595 | if (kern_buf) { | 578 | if (kern_buf) { |
596 | memcpy(ename + inline_len, uidata, | 579 | memcpy(ename + inline_len, uidata, |
597 | len - inline_len); | 580 | len - inline_len); |
@@ -600,19 +583,19 @@ static int p9_check_zc_errors(struct p9_client *c, struct p9_req_t *req, | |||
600 | uidata, len - inline_len); | 583 | uidata, len - inline_len); |
601 | if (err) { | 584 | if (err) { |
602 | err = -EFAULT; | 585 | err = -EFAULT; |
603 | goto out_free; | 586 | goto out_err; |
604 | } | 587 | } |
605 | } | 588 | } |
606 | } | 589 | } |
607 | ename[len] = 0; | 590 | ename = NULL; |
608 | if (p9_is_proto_dotu(c)) { | 591 | err = p9pdu_readf(req->rc, c->proto_version, "s?d", |
609 | /* For dotu we also have error code */ | 592 | &ename, &ecode); |
610 | err = p9pdu_readf(req->rc, | 593 | if (err) |
611 | c->proto_version, "d", &ecode); | 594 | goto out_err; |
612 | if (err) | 595 | |
613 | goto out_free; | 596 | if (p9_is_proto_dotu(c)) |
614 | err = -ecode; | 597 | err = -ecode; |
615 | } | 598 | |
616 | if (!err || !IS_ERR_VALUE(err)) { | 599 | if (!err || !IS_ERR_VALUE(err)) { |
617 | err = p9_errstr2errno(ename, strlen(ename)); | 600 | err = p9_errstr2errno(ename, strlen(ename)); |
618 | 601 | ||
@@ -628,8 +611,6 @@ static int p9_check_zc_errors(struct p9_client *c, struct p9_req_t *req, | |||
628 | } | 611 | } |
629 | return err; | 612 | return err; |
630 | 613 | ||
631 | out_free: | ||
632 | kfree(ename); | ||
633 | out_err: | 614 | out_err: |
634 | p9_debug(P9_DEBUG_ERROR, "couldn't parse error%d\n", err); | 615 | p9_debug(P9_DEBUG_ERROR, "couldn't parse error%d\n", err); |
635 | return err; | 616 | return err; |
diff --git a/net/batman-adv/bat_iv_ogm.c b/net/batman-adv/bat_iv_ogm.c index 071f288b77a8..f680ee101878 100644 --- a/net/batman-adv/bat_iv_ogm.c +++ b/net/batman-adv/bat_iv_ogm.c | |||
@@ -29,6 +29,21 @@ | |||
29 | #include "bat_algo.h" | 29 | #include "bat_algo.h" |
30 | #include "network-coding.h" | 30 | #include "network-coding.h" |
31 | 31 | ||
32 | /** | ||
33 | * batadv_dup_status - duplicate status | ||
34 | * @BATADV_NO_DUP: the packet is a duplicate | ||
35 | * @BATADV_ORIG_DUP: OGM is a duplicate in the originator (but not for the | ||
36 | * neighbor) | ||
37 | * @BATADV_NEIGH_DUP: OGM is a duplicate for the neighbor | ||
38 | * @BATADV_PROTECTED: originator is currently protected (after reboot) | ||
39 | */ | ||
40 | enum batadv_dup_status { | ||
41 | BATADV_NO_DUP = 0, | ||
42 | BATADV_ORIG_DUP, | ||
43 | BATADV_NEIGH_DUP, | ||
44 | BATADV_PROTECTED, | ||
45 | }; | ||
46 | |||
32 | static struct batadv_neigh_node * | 47 | static struct batadv_neigh_node * |
33 | batadv_iv_ogm_neigh_new(struct batadv_hard_iface *hard_iface, | 48 | batadv_iv_ogm_neigh_new(struct batadv_hard_iface *hard_iface, |
34 | const uint8_t *neigh_addr, | 49 | const uint8_t *neigh_addr, |
@@ -650,7 +665,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, | |||
650 | const struct batadv_ogm_packet *batadv_ogm_packet, | 665 | const struct batadv_ogm_packet *batadv_ogm_packet, |
651 | struct batadv_hard_iface *if_incoming, | 666 | struct batadv_hard_iface *if_incoming, |
652 | const unsigned char *tt_buff, | 667 | const unsigned char *tt_buff, |
653 | int is_duplicate) | 668 | enum batadv_dup_status dup_status) |
654 | { | 669 | { |
655 | struct batadv_neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL; | 670 | struct batadv_neigh_node *neigh_node = NULL, *tmp_neigh_node = NULL; |
656 | struct batadv_neigh_node *router = NULL; | 671 | struct batadv_neigh_node *router = NULL; |
@@ -676,7 +691,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, | |||
676 | continue; | 691 | continue; |
677 | } | 692 | } |
678 | 693 | ||
679 | if (is_duplicate) | 694 | if (dup_status != BATADV_NO_DUP) |
680 | continue; | 695 | continue; |
681 | 696 | ||
682 | spin_lock_bh(&tmp_neigh_node->lq_update_lock); | 697 | spin_lock_bh(&tmp_neigh_node->lq_update_lock); |
@@ -718,7 +733,7 @@ batadv_iv_ogm_orig_update(struct batadv_priv *bat_priv, | |||
718 | neigh_node->tq_avg = batadv_ring_buffer_avg(neigh_node->tq_recv); | 733 | neigh_node->tq_avg = batadv_ring_buffer_avg(neigh_node->tq_recv); |
719 | spin_unlock_bh(&neigh_node->lq_update_lock); | 734 | spin_unlock_bh(&neigh_node->lq_update_lock); |
720 | 735 | ||
721 | if (!is_duplicate) { | 736 | if (dup_status == BATADV_NO_DUP) { |
722 | orig_node->last_ttl = batadv_ogm_packet->header.ttl; | 737 | orig_node->last_ttl = batadv_ogm_packet->header.ttl; |
723 | neigh_node->last_ttl = batadv_ogm_packet->header.ttl; | 738 | neigh_node->last_ttl = batadv_ogm_packet->header.ttl; |
724 | } | 739 | } |
@@ -902,15 +917,16 @@ out: | |||
902 | return ret; | 917 | return ret; |
903 | } | 918 | } |
904 | 919 | ||
905 | /* processes a batman packet for all interfaces, adjusts the sequence number and | 920 | /** |
906 | * finds out whether it is a duplicate. | 921 | * batadv_iv_ogm_update_seqnos - process a batman packet for all interfaces, |
907 | * returns: | 922 | * adjust the sequence number and find out whether it is a duplicate |
908 | * 1 the packet is a duplicate | 923 | * @ethhdr: ethernet header of the packet |
909 | * 0 the packet has not yet been received | 924 | * @batadv_ogm_packet: OGM packet to be considered |
910 | * -1 the packet is old and has been received while the seqno window | 925 | * @if_incoming: interface on which the OGM packet was received |
911 | * was protected. Caller should drop it. | 926 | * |
927 | * Returns duplicate status as enum batadv_dup_status | ||
912 | */ | 928 | */ |
913 | static int | 929 | static enum batadv_dup_status |
914 | batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, | 930 | batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, |
915 | const struct batadv_ogm_packet *batadv_ogm_packet, | 931 | const struct batadv_ogm_packet *batadv_ogm_packet, |
916 | const struct batadv_hard_iface *if_incoming) | 932 | const struct batadv_hard_iface *if_incoming) |
@@ -918,17 +934,18 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, | |||
918 | struct batadv_priv *bat_priv = netdev_priv(if_incoming->soft_iface); | 934 | struct batadv_priv *bat_priv = netdev_priv(if_incoming->soft_iface); |
919 | struct batadv_orig_node *orig_node; | 935 | struct batadv_orig_node *orig_node; |
920 | struct batadv_neigh_node *tmp_neigh_node; | 936 | struct batadv_neigh_node *tmp_neigh_node; |
921 | int is_duplicate = 0; | 937 | int is_dup; |
922 | int32_t seq_diff; | 938 | int32_t seq_diff; |
923 | int need_update = 0; | 939 | int need_update = 0; |
924 | int set_mark, ret = -1; | 940 | int set_mark; |
941 | enum batadv_dup_status ret = BATADV_NO_DUP; | ||
925 | uint32_t seqno = ntohl(batadv_ogm_packet->seqno); | 942 | uint32_t seqno = ntohl(batadv_ogm_packet->seqno); |
926 | uint8_t *neigh_addr; | 943 | uint8_t *neigh_addr; |
927 | uint8_t packet_count; | 944 | uint8_t packet_count; |
928 | 945 | ||
929 | orig_node = batadv_get_orig_node(bat_priv, batadv_ogm_packet->orig); | 946 | orig_node = batadv_get_orig_node(bat_priv, batadv_ogm_packet->orig); |
930 | if (!orig_node) | 947 | if (!orig_node) |
931 | return 0; | 948 | return BATADV_NO_DUP; |
932 | 949 | ||
933 | spin_lock_bh(&orig_node->ogm_cnt_lock); | 950 | spin_lock_bh(&orig_node->ogm_cnt_lock); |
934 | seq_diff = seqno - orig_node->last_real_seqno; | 951 | seq_diff = seqno - orig_node->last_real_seqno; |
@@ -936,22 +953,29 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, | |||
936 | /* signalize caller that the packet is to be dropped. */ | 953 | /* signalize caller that the packet is to be dropped. */ |
937 | if (!hlist_empty(&orig_node->neigh_list) && | 954 | if (!hlist_empty(&orig_node->neigh_list) && |
938 | batadv_window_protected(bat_priv, seq_diff, | 955 | batadv_window_protected(bat_priv, seq_diff, |
939 | &orig_node->batman_seqno_reset)) | 956 | &orig_node->batman_seqno_reset)) { |
957 | ret = BATADV_PROTECTED; | ||
940 | goto out; | 958 | goto out; |
959 | } | ||
941 | 960 | ||
942 | rcu_read_lock(); | 961 | rcu_read_lock(); |
943 | hlist_for_each_entry_rcu(tmp_neigh_node, | 962 | hlist_for_each_entry_rcu(tmp_neigh_node, |
944 | &orig_node->neigh_list, list) { | 963 | &orig_node->neigh_list, list) { |
945 | is_duplicate |= batadv_test_bit(tmp_neigh_node->real_bits, | ||
946 | orig_node->last_real_seqno, | ||
947 | seqno); | ||
948 | |||
949 | neigh_addr = tmp_neigh_node->addr; | 964 | neigh_addr = tmp_neigh_node->addr; |
965 | is_dup = batadv_test_bit(tmp_neigh_node->real_bits, | ||
966 | orig_node->last_real_seqno, | ||
967 | seqno); | ||
968 | |||
950 | if (batadv_compare_eth(neigh_addr, ethhdr->h_source) && | 969 | if (batadv_compare_eth(neigh_addr, ethhdr->h_source) && |
951 | tmp_neigh_node->if_incoming == if_incoming) | 970 | tmp_neigh_node->if_incoming == if_incoming) { |
952 | set_mark = 1; | 971 | set_mark = 1; |
953 | else | 972 | if (is_dup) |
973 | ret = BATADV_NEIGH_DUP; | ||
974 | } else { | ||
954 | set_mark = 0; | 975 | set_mark = 0; |
976 | if (is_dup && (ret != BATADV_NEIGH_DUP)) | ||
977 | ret = BATADV_ORIG_DUP; | ||
978 | } | ||
955 | 979 | ||
956 | /* if the window moved, set the update flag. */ | 980 | /* if the window moved, set the update flag. */ |
957 | need_update |= batadv_bit_get_packet(bat_priv, | 981 | need_update |= batadv_bit_get_packet(bat_priv, |
@@ -971,8 +995,6 @@ batadv_iv_ogm_update_seqnos(const struct ethhdr *ethhdr, | |||
971 | orig_node->last_real_seqno = seqno; | 995 | orig_node->last_real_seqno = seqno; |
972 | } | 996 | } |
973 | 997 | ||
974 | ret = is_duplicate; | ||
975 | |||
976 | out: | 998 | out: |
977 | spin_unlock_bh(&orig_node->ogm_cnt_lock); | 999 | spin_unlock_bh(&orig_node->ogm_cnt_lock); |
978 | batadv_orig_node_free_ref(orig_node); | 1000 | batadv_orig_node_free_ref(orig_node); |
@@ -994,7 +1016,8 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr, | |||
994 | int is_broadcast = 0, is_bidirect; | 1016 | int is_broadcast = 0, is_bidirect; |
995 | bool is_single_hop_neigh = false; | 1017 | bool is_single_hop_neigh = false; |
996 | bool is_from_best_next_hop = false; | 1018 | bool is_from_best_next_hop = false; |
997 | int is_duplicate, sameseq, simlar_ttl; | 1019 | int sameseq, similar_ttl; |
1020 | enum batadv_dup_status dup_status; | ||
998 | uint32_t if_incoming_seqno; | 1021 | uint32_t if_incoming_seqno; |
999 | uint8_t *prev_sender; | 1022 | uint8_t *prev_sender; |
1000 | 1023 | ||
@@ -1138,10 +1161,10 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr, | |||
1138 | if (!orig_node) | 1161 | if (!orig_node) |
1139 | return; | 1162 | return; |
1140 | 1163 | ||
1141 | is_duplicate = batadv_iv_ogm_update_seqnos(ethhdr, batadv_ogm_packet, | 1164 | dup_status = batadv_iv_ogm_update_seqnos(ethhdr, batadv_ogm_packet, |
1142 | if_incoming); | 1165 | if_incoming); |
1143 | 1166 | ||
1144 | if (is_duplicate == -1) { | 1167 | if (dup_status == BATADV_PROTECTED) { |
1145 | batadv_dbg(BATADV_DBG_BATMAN, bat_priv, | 1168 | batadv_dbg(BATADV_DBG_BATMAN, bat_priv, |
1146 | "Drop packet: packet within seqno protection time (sender: %pM)\n", | 1169 | "Drop packet: packet within seqno protection time (sender: %pM)\n", |
1147 | ethhdr->h_source); | 1170 | ethhdr->h_source); |
@@ -1211,11 +1234,12 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr, | |||
1211 | * seqno and similar ttl as the non-duplicate | 1234 | * seqno and similar ttl as the non-duplicate |
1212 | */ | 1235 | */ |
1213 | sameseq = orig_node->last_real_seqno == ntohl(batadv_ogm_packet->seqno); | 1236 | sameseq = orig_node->last_real_seqno == ntohl(batadv_ogm_packet->seqno); |
1214 | simlar_ttl = orig_node->last_ttl - 3 <= batadv_ogm_packet->header.ttl; | 1237 | similar_ttl = orig_node->last_ttl - 3 <= batadv_ogm_packet->header.ttl; |
1215 | if (is_bidirect && (!is_duplicate || (sameseq && simlar_ttl))) | 1238 | if (is_bidirect && ((dup_status == BATADV_NO_DUP) || |
1239 | (sameseq && similar_ttl))) | ||
1216 | batadv_iv_ogm_orig_update(bat_priv, orig_node, ethhdr, | 1240 | batadv_iv_ogm_orig_update(bat_priv, orig_node, ethhdr, |
1217 | batadv_ogm_packet, if_incoming, | 1241 | batadv_ogm_packet, if_incoming, |
1218 | tt_buff, is_duplicate); | 1242 | tt_buff, dup_status); |
1219 | 1243 | ||
1220 | /* is single hop (direct) neighbor */ | 1244 | /* is single hop (direct) neighbor */ |
1221 | if (is_single_hop_neigh) { | 1245 | if (is_single_hop_neigh) { |
@@ -1236,7 +1260,7 @@ static void batadv_iv_ogm_process(const struct ethhdr *ethhdr, | |||
1236 | goto out_neigh; | 1260 | goto out_neigh; |
1237 | } | 1261 | } |
1238 | 1262 | ||
1239 | if (is_duplicate) { | 1263 | if (dup_status == BATADV_NEIGH_DUP) { |
1240 | batadv_dbg(BATADV_DBG_BATMAN, bat_priv, | 1264 | batadv_dbg(BATADV_DBG_BATMAN, bat_priv, |
1241 | "Drop packet: duplicate packet received\n"); | 1265 | "Drop packet: duplicate packet received\n"); |
1242 | goto out_neigh; | 1266 | goto out_neigh; |
diff --git a/net/batman-adv/bridge_loop_avoidance.c b/net/batman-adv/bridge_loop_avoidance.c index 379061c72549..de27b3175cfd 100644 --- a/net/batman-adv/bridge_loop_avoidance.c +++ b/net/batman-adv/bridge_loop_avoidance.c | |||
@@ -1067,6 +1067,10 @@ void batadv_bla_update_orig_address(struct batadv_priv *bat_priv, | |||
1067 | group = htons(crc16(0, primary_if->net_dev->dev_addr, ETH_ALEN)); | 1067 | group = htons(crc16(0, primary_if->net_dev->dev_addr, ETH_ALEN)); |
1068 | bat_priv->bla.claim_dest.group = group; | 1068 | bat_priv->bla.claim_dest.group = group; |
1069 | 1069 | ||
1070 | /* purge everything when bridge loop avoidance is turned off */ | ||
1071 | if (!atomic_read(&bat_priv->bridge_loop_avoidance)) | ||
1072 | oldif = NULL; | ||
1073 | |||
1070 | if (!oldif) { | 1074 | if (!oldif) { |
1071 | batadv_bla_purge_claims(bat_priv, NULL, 1); | 1075 | batadv_bla_purge_claims(bat_priv, NULL, 1); |
1072 | batadv_bla_purge_backbone_gw(bat_priv, 1); | 1076 | batadv_bla_purge_backbone_gw(bat_priv, 1); |
diff --git a/net/batman-adv/sysfs.c b/net/batman-adv/sysfs.c index 15a22efa9a67..929e304dacb2 100644 --- a/net/batman-adv/sysfs.c +++ b/net/batman-adv/sysfs.c | |||
@@ -582,10 +582,7 @@ static ssize_t batadv_store_mesh_iface(struct kobject *kobj, | |||
582 | (strncmp(hard_iface->soft_iface->name, buff, IFNAMSIZ) == 0)) | 582 | (strncmp(hard_iface->soft_iface->name, buff, IFNAMSIZ) == 0)) |
583 | goto out; | 583 | goto out; |
584 | 584 | ||
585 | if (!rtnl_trylock()) { | 585 | rtnl_lock(); |
586 | ret = -ERESTARTSYS; | ||
587 | goto out; | ||
588 | } | ||
589 | 586 | ||
590 | if (status_tmp == BATADV_IF_NOT_IN_USE) { | 587 | if (status_tmp == BATADV_IF_NOT_IN_USE) { |
591 | batadv_hardif_disable_interface(hard_iface, | 588 | batadv_hardif_disable_interface(hard_iface, |
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 33843c5c4939..d817c932d634 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c | |||
@@ -1555,11 +1555,15 @@ static const struct rfkill_ops hci_rfkill_ops = { | |||
1555 | static void hci_power_on(struct work_struct *work) | 1555 | static void hci_power_on(struct work_struct *work) |
1556 | { | 1556 | { |
1557 | struct hci_dev *hdev = container_of(work, struct hci_dev, power_on); | 1557 | struct hci_dev *hdev = container_of(work, struct hci_dev, power_on); |
1558 | int err; | ||
1558 | 1559 | ||
1559 | BT_DBG("%s", hdev->name); | 1560 | BT_DBG("%s", hdev->name); |
1560 | 1561 | ||
1561 | if (hci_dev_open(hdev->id) < 0) | 1562 | err = hci_dev_open(hdev->id); |
1563 | if (err < 0) { | ||
1564 | mgmt_set_powered_failed(hdev, err); | ||
1562 | return; | 1565 | return; |
1566 | } | ||
1563 | 1567 | ||
1564 | if (test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) | 1568 | if (test_bit(HCI_AUTO_OFF, &hdev->dev_flags)) |
1565 | queue_delayed_work(hdev->req_workqueue, &hdev->power_off, | 1569 | queue_delayed_work(hdev->req_workqueue, &hdev->power_off, |
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c index a76d1ac0321b..24bee07ee4ce 100644 --- a/net/bluetooth/l2cap_core.c +++ b/net/bluetooth/l2cap_core.c | |||
@@ -3677,10 +3677,14 @@ static void l2cap_conf_rfc_get(struct l2cap_chan *chan, void *rsp, int len) | |||
3677 | } | 3677 | } |
3678 | 3678 | ||
3679 | static inline int l2cap_command_rej(struct l2cap_conn *conn, | 3679 | static inline int l2cap_command_rej(struct l2cap_conn *conn, |
3680 | struct l2cap_cmd_hdr *cmd, u8 *data) | 3680 | struct l2cap_cmd_hdr *cmd, u16 cmd_len, |
3681 | u8 *data) | ||
3681 | { | 3682 | { |
3682 | struct l2cap_cmd_rej_unk *rej = (struct l2cap_cmd_rej_unk *) data; | 3683 | struct l2cap_cmd_rej_unk *rej = (struct l2cap_cmd_rej_unk *) data; |
3683 | 3684 | ||
3685 | if (cmd_len < sizeof(*rej)) | ||
3686 | return -EPROTO; | ||
3687 | |||
3684 | if (rej->reason != L2CAP_REJ_NOT_UNDERSTOOD) | 3688 | if (rej->reason != L2CAP_REJ_NOT_UNDERSTOOD) |
3685 | return 0; | 3689 | return 0; |
3686 | 3690 | ||
@@ -3829,11 +3833,14 @@ sendresp: | |||
3829 | } | 3833 | } |
3830 | 3834 | ||
3831 | static int l2cap_connect_req(struct l2cap_conn *conn, | 3835 | static int l2cap_connect_req(struct l2cap_conn *conn, |
3832 | struct l2cap_cmd_hdr *cmd, u8 *data) | 3836 | struct l2cap_cmd_hdr *cmd, u16 cmd_len, u8 *data) |
3833 | { | 3837 | { |
3834 | struct hci_dev *hdev = conn->hcon->hdev; | 3838 | struct hci_dev *hdev = conn->hcon->hdev; |
3835 | struct hci_conn *hcon = conn->hcon; | 3839 | struct hci_conn *hcon = conn->hcon; |
3836 | 3840 | ||
3841 | if (cmd_len < sizeof(struct l2cap_conn_req)) | ||
3842 | return -EPROTO; | ||
3843 | |||
3837 | hci_dev_lock(hdev); | 3844 | hci_dev_lock(hdev); |
3838 | if (test_bit(HCI_MGMT, &hdev->dev_flags) && | 3845 | if (test_bit(HCI_MGMT, &hdev->dev_flags) && |
3839 | !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &hcon->flags)) | 3846 | !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &hcon->flags)) |
@@ -3847,7 +3854,8 @@ static int l2cap_connect_req(struct l2cap_conn *conn, | |||
3847 | } | 3854 | } |
3848 | 3855 | ||
3849 | static int l2cap_connect_create_rsp(struct l2cap_conn *conn, | 3856 | static int l2cap_connect_create_rsp(struct l2cap_conn *conn, |
3850 | struct l2cap_cmd_hdr *cmd, u8 *data) | 3857 | struct l2cap_cmd_hdr *cmd, u16 cmd_len, |
3858 | u8 *data) | ||
3851 | { | 3859 | { |
3852 | struct l2cap_conn_rsp *rsp = (struct l2cap_conn_rsp *) data; | 3860 | struct l2cap_conn_rsp *rsp = (struct l2cap_conn_rsp *) data; |
3853 | u16 scid, dcid, result, status; | 3861 | u16 scid, dcid, result, status; |
@@ -3855,6 +3863,9 @@ static int l2cap_connect_create_rsp(struct l2cap_conn *conn, | |||
3855 | u8 req[128]; | 3863 | u8 req[128]; |
3856 | int err; | 3864 | int err; |
3857 | 3865 | ||
3866 | if (cmd_len < sizeof(*rsp)) | ||
3867 | return -EPROTO; | ||
3868 | |||
3858 | scid = __le16_to_cpu(rsp->scid); | 3869 | scid = __le16_to_cpu(rsp->scid); |
3859 | dcid = __le16_to_cpu(rsp->dcid); | 3870 | dcid = __le16_to_cpu(rsp->dcid); |
3860 | result = __le16_to_cpu(rsp->result); | 3871 | result = __le16_to_cpu(rsp->result); |
@@ -3952,6 +3963,9 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, | |||
3952 | struct l2cap_chan *chan; | 3963 | struct l2cap_chan *chan; |
3953 | int len, err = 0; | 3964 | int len, err = 0; |
3954 | 3965 | ||
3966 | if (cmd_len < sizeof(*req)) | ||
3967 | return -EPROTO; | ||
3968 | |||
3955 | dcid = __le16_to_cpu(req->dcid); | 3969 | dcid = __le16_to_cpu(req->dcid); |
3956 | flags = __le16_to_cpu(req->flags); | 3970 | flags = __le16_to_cpu(req->flags); |
3957 | 3971 | ||
@@ -3975,7 +3989,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, | |||
3975 | 3989 | ||
3976 | /* Reject if config buffer is too small. */ | 3990 | /* Reject if config buffer is too small. */ |
3977 | len = cmd_len - sizeof(*req); | 3991 | len = cmd_len - sizeof(*req); |
3978 | if (len < 0 || chan->conf_len + len > sizeof(chan->conf_req)) { | 3992 | if (chan->conf_len + len > sizeof(chan->conf_req)) { |
3979 | l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, | 3993 | l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP, |
3980 | l2cap_build_conf_rsp(chan, rsp, | 3994 | l2cap_build_conf_rsp(chan, rsp, |
3981 | L2CAP_CONF_REJECT, flags), rsp); | 3995 | L2CAP_CONF_REJECT, flags), rsp); |
@@ -4053,14 +4067,18 @@ unlock: | |||
4053 | } | 4067 | } |
4054 | 4068 | ||
4055 | static inline int l2cap_config_rsp(struct l2cap_conn *conn, | 4069 | static inline int l2cap_config_rsp(struct l2cap_conn *conn, |
4056 | struct l2cap_cmd_hdr *cmd, u8 *data) | 4070 | struct l2cap_cmd_hdr *cmd, u16 cmd_len, |
4071 | u8 *data) | ||
4057 | { | 4072 | { |
4058 | struct l2cap_conf_rsp *rsp = (struct l2cap_conf_rsp *)data; | 4073 | struct l2cap_conf_rsp *rsp = (struct l2cap_conf_rsp *)data; |
4059 | u16 scid, flags, result; | 4074 | u16 scid, flags, result; |
4060 | struct l2cap_chan *chan; | 4075 | struct l2cap_chan *chan; |
4061 | int len = le16_to_cpu(cmd->len) - sizeof(*rsp); | 4076 | int len = cmd_len - sizeof(*rsp); |
4062 | int err = 0; | 4077 | int err = 0; |
4063 | 4078 | ||
4079 | if (cmd_len < sizeof(*rsp)) | ||
4080 | return -EPROTO; | ||
4081 | |||
4064 | scid = __le16_to_cpu(rsp->scid); | 4082 | scid = __le16_to_cpu(rsp->scid); |
4065 | flags = __le16_to_cpu(rsp->flags); | 4083 | flags = __le16_to_cpu(rsp->flags); |
4066 | result = __le16_to_cpu(rsp->result); | 4084 | result = __le16_to_cpu(rsp->result); |
@@ -4161,7 +4179,8 @@ done: | |||
4161 | } | 4179 | } |
4162 | 4180 | ||
4163 | static inline int l2cap_disconnect_req(struct l2cap_conn *conn, | 4181 | static inline int l2cap_disconnect_req(struct l2cap_conn *conn, |
4164 | struct l2cap_cmd_hdr *cmd, u8 *data) | 4182 | struct l2cap_cmd_hdr *cmd, u16 cmd_len, |
4183 | u8 *data) | ||
4165 | { | 4184 | { |
4166 | struct l2cap_disconn_req *req = (struct l2cap_disconn_req *) data; | 4185 | struct l2cap_disconn_req *req = (struct l2cap_disconn_req *) data; |
4167 | struct l2cap_disconn_rsp rsp; | 4186 | struct l2cap_disconn_rsp rsp; |
@@ -4169,6 +4188,9 @@ static inline int l2cap_disconnect_req(struct l2cap_conn *conn, | |||
4169 | struct l2cap_chan *chan; | 4188 | struct l2cap_chan *chan; |
4170 | struct sock *sk; | 4189 | struct sock *sk; |
4171 | 4190 | ||
4191 | if (cmd_len != sizeof(*req)) | ||
4192 | return -EPROTO; | ||
4193 | |||
4172 | scid = __le16_to_cpu(req->scid); | 4194 | scid = __le16_to_cpu(req->scid); |
4173 | dcid = __le16_to_cpu(req->dcid); | 4195 | dcid = __le16_to_cpu(req->dcid); |
4174 | 4196 | ||
@@ -4208,12 +4230,16 @@ static inline int l2cap_disconnect_req(struct l2cap_conn *conn, | |||
4208 | } | 4230 | } |
4209 | 4231 | ||
4210 | static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn, | 4232 | static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn, |
4211 | struct l2cap_cmd_hdr *cmd, u8 *data) | 4233 | struct l2cap_cmd_hdr *cmd, u16 cmd_len, |
4234 | u8 *data) | ||
4212 | { | 4235 | { |
4213 | struct l2cap_disconn_rsp *rsp = (struct l2cap_disconn_rsp *) data; | 4236 | struct l2cap_disconn_rsp *rsp = (struct l2cap_disconn_rsp *) data; |
4214 | u16 dcid, scid; | 4237 | u16 dcid, scid; |
4215 | struct l2cap_chan *chan; | 4238 | struct l2cap_chan *chan; |
4216 | 4239 | ||
4240 | if (cmd_len != sizeof(*rsp)) | ||
4241 | return -EPROTO; | ||
4242 | |||
4217 | scid = __le16_to_cpu(rsp->scid); | 4243 | scid = __le16_to_cpu(rsp->scid); |
4218 | dcid = __le16_to_cpu(rsp->dcid); | 4244 | dcid = __le16_to_cpu(rsp->dcid); |
4219 | 4245 | ||
@@ -4243,11 +4269,15 @@ static inline int l2cap_disconnect_rsp(struct l2cap_conn *conn, | |||
4243 | } | 4269 | } |
4244 | 4270 | ||
4245 | static inline int l2cap_information_req(struct l2cap_conn *conn, | 4271 | static inline int l2cap_information_req(struct l2cap_conn *conn, |
4246 | struct l2cap_cmd_hdr *cmd, u8 *data) | 4272 | struct l2cap_cmd_hdr *cmd, u16 cmd_len, |
4273 | u8 *data) | ||
4247 | { | 4274 | { |
4248 | struct l2cap_info_req *req = (struct l2cap_info_req *) data; | 4275 | struct l2cap_info_req *req = (struct l2cap_info_req *) data; |
4249 | u16 type; | 4276 | u16 type; |
4250 | 4277 | ||
4278 | if (cmd_len != sizeof(*req)) | ||
4279 | return -EPROTO; | ||
4280 | |||
4251 | type = __le16_to_cpu(req->type); | 4281 | type = __le16_to_cpu(req->type); |
4252 | 4282 | ||
4253 | BT_DBG("type 0x%4.4x", type); | 4283 | BT_DBG("type 0x%4.4x", type); |
@@ -4294,11 +4324,15 @@ static inline int l2cap_information_req(struct l2cap_conn *conn, | |||
4294 | } | 4324 | } |
4295 | 4325 | ||
4296 | static inline int l2cap_information_rsp(struct l2cap_conn *conn, | 4326 | static inline int l2cap_information_rsp(struct l2cap_conn *conn, |
4297 | struct l2cap_cmd_hdr *cmd, u8 *data) | 4327 | struct l2cap_cmd_hdr *cmd, u16 cmd_len, |
4328 | u8 *data) | ||
4298 | { | 4329 | { |
4299 | struct l2cap_info_rsp *rsp = (struct l2cap_info_rsp *) data; | 4330 | struct l2cap_info_rsp *rsp = (struct l2cap_info_rsp *) data; |
4300 | u16 type, result; | 4331 | u16 type, result; |
4301 | 4332 | ||
4333 | if (cmd_len != sizeof(*rsp)) | ||
4334 | return -EPROTO; | ||
4335 | |||
4302 | type = __le16_to_cpu(rsp->type); | 4336 | type = __le16_to_cpu(rsp->type); |
4303 | result = __le16_to_cpu(rsp->result); | 4337 | result = __le16_to_cpu(rsp->result); |
4304 | 4338 | ||
@@ -5164,16 +5198,16 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn, | |||
5164 | 5198 | ||
5165 | switch (cmd->code) { | 5199 | switch (cmd->code) { |
5166 | case L2CAP_COMMAND_REJ: | 5200 | case L2CAP_COMMAND_REJ: |
5167 | l2cap_command_rej(conn, cmd, data); | 5201 | l2cap_command_rej(conn, cmd, cmd_len, data); |
5168 | break; | 5202 | break; |
5169 | 5203 | ||
5170 | case L2CAP_CONN_REQ: | 5204 | case L2CAP_CONN_REQ: |
5171 | err = l2cap_connect_req(conn, cmd, data); | 5205 | err = l2cap_connect_req(conn, cmd, cmd_len, data); |
5172 | break; | 5206 | break; |
5173 | 5207 | ||
5174 | case L2CAP_CONN_RSP: | 5208 | case L2CAP_CONN_RSP: |
5175 | case L2CAP_CREATE_CHAN_RSP: | 5209 | case L2CAP_CREATE_CHAN_RSP: |
5176 | err = l2cap_connect_create_rsp(conn, cmd, data); | 5210 | err = l2cap_connect_create_rsp(conn, cmd, cmd_len, data); |
5177 | break; | 5211 | break; |
5178 | 5212 | ||
5179 | case L2CAP_CONF_REQ: | 5213 | case L2CAP_CONF_REQ: |
@@ -5181,15 +5215,15 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn, | |||
5181 | break; | 5215 | break; |
5182 | 5216 | ||
5183 | case L2CAP_CONF_RSP: | 5217 | case L2CAP_CONF_RSP: |
5184 | err = l2cap_config_rsp(conn, cmd, data); | 5218 | err = l2cap_config_rsp(conn, cmd, cmd_len, data); |
5185 | break; | 5219 | break; |
5186 | 5220 | ||
5187 | case L2CAP_DISCONN_REQ: | 5221 | case L2CAP_DISCONN_REQ: |
5188 | err = l2cap_disconnect_req(conn, cmd, data); | 5222 | err = l2cap_disconnect_req(conn, cmd, cmd_len, data); |
5189 | break; | 5223 | break; |
5190 | 5224 | ||
5191 | case L2CAP_DISCONN_RSP: | 5225 | case L2CAP_DISCONN_RSP: |
5192 | err = l2cap_disconnect_rsp(conn, cmd, data); | 5226 | err = l2cap_disconnect_rsp(conn, cmd, cmd_len, data); |
5193 | break; | 5227 | break; |
5194 | 5228 | ||
5195 | case L2CAP_ECHO_REQ: | 5229 | case L2CAP_ECHO_REQ: |
@@ -5200,11 +5234,11 @@ static inline int l2cap_bredr_sig_cmd(struct l2cap_conn *conn, | |||
5200 | break; | 5234 | break; |
5201 | 5235 | ||
5202 | case L2CAP_INFO_REQ: | 5236 | case L2CAP_INFO_REQ: |
5203 | err = l2cap_information_req(conn, cmd, data); | 5237 | err = l2cap_information_req(conn, cmd, cmd_len, data); |
5204 | break; | 5238 | break; |
5205 | 5239 | ||
5206 | case L2CAP_INFO_RSP: | 5240 | case L2CAP_INFO_RSP: |
5207 | err = l2cap_information_rsp(conn, cmd, data); | 5241 | err = l2cap_information_rsp(conn, cmd, cmd_len, data); |
5208 | break; | 5242 | break; |
5209 | 5243 | ||
5210 | case L2CAP_CREATE_CHAN_REQ: | 5244 | case L2CAP_CREATE_CHAN_REQ: |
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 35fef22703e9..f8ecbc70293d 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -2700,7 +2700,7 @@ static int start_discovery(struct sock *sk, struct hci_dev *hdev, | |||
2700 | break; | 2700 | break; |
2701 | 2701 | ||
2702 | case DISCOV_TYPE_LE: | 2702 | case DISCOV_TYPE_LE: |
2703 | if (!lmp_host_le_capable(hdev)) { | 2703 | if (!test_bit(HCI_LE_ENABLED, &hdev->dev_flags)) { |
2704 | err = cmd_status(sk, hdev->id, MGMT_OP_START_DISCOVERY, | 2704 | err = cmd_status(sk, hdev->id, MGMT_OP_START_DISCOVERY, |
2705 | MGMT_STATUS_NOT_SUPPORTED); | 2705 | MGMT_STATUS_NOT_SUPPORTED); |
2706 | mgmt_pending_remove(cmd); | 2706 | mgmt_pending_remove(cmd); |
@@ -3418,6 +3418,27 @@ new_settings: | |||
3418 | return err; | 3418 | return err; |
3419 | } | 3419 | } |
3420 | 3420 | ||
3421 | int mgmt_set_powered_failed(struct hci_dev *hdev, int err) | ||
3422 | { | ||
3423 | struct pending_cmd *cmd; | ||
3424 | u8 status; | ||
3425 | |||
3426 | cmd = mgmt_pending_find(MGMT_OP_SET_POWERED, hdev); | ||
3427 | if (!cmd) | ||
3428 | return -ENOENT; | ||
3429 | |||
3430 | if (err == -ERFKILL) | ||
3431 | status = MGMT_STATUS_RFKILLED; | ||
3432 | else | ||
3433 | status = MGMT_STATUS_FAILED; | ||
3434 | |||
3435 | err = cmd_status(cmd->sk, hdev->id, MGMT_OP_SET_POWERED, status); | ||
3436 | |||
3437 | mgmt_pending_remove(cmd); | ||
3438 | |||
3439 | return err; | ||
3440 | } | ||
3441 | |||
3421 | int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable) | 3442 | int mgmt_discoverable(struct hci_dev *hdev, u8 discoverable) |
3422 | { | 3443 | { |
3423 | struct cmd_lookup match = { NULL, hdev }; | 3444 | struct cmd_lookup match = { NULL, hdev }; |
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index b2296d3857a0..b5562abdd6e0 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -770,7 +770,7 @@ int smp_conn_security(struct hci_conn *hcon, __u8 sec_level) | |||
770 | 770 | ||
771 | BT_DBG("conn %p hcon %p level 0x%2.2x", conn, hcon, sec_level); | 771 | BT_DBG("conn %p hcon %p level 0x%2.2x", conn, hcon, sec_level); |
772 | 772 | ||
773 | if (!lmp_host_le_capable(hcon->hdev)) | 773 | if (!test_bit(HCI_LE_ENABLED, &hcon->hdev->dev_flags)) |
774 | return 1; | 774 | return 1; |
775 | 775 | ||
776 | if (sec_level == BT_SECURITY_LOW) | 776 | if (sec_level == BT_SECURITY_LOW) |
@@ -851,7 +851,7 @@ int smp_sig_channel(struct l2cap_conn *conn, struct sk_buff *skb) | |||
851 | __u8 reason; | 851 | __u8 reason; |
852 | int err = 0; | 852 | int err = 0; |
853 | 853 | ||
854 | if (!lmp_host_le_capable(conn->hcon->hdev)) { | 854 | if (!test_bit(HCI_LE_ENABLED, &conn->hcon->hdev->dev_flags)) { |
855 | err = -ENOTSUPP; | 855 | err = -ENOTSUPP; |
856 | reason = SMP_PAIRING_NOTSUPP; | 856 | reason = SMP_PAIRING_NOTSUPP; |
857 | goto done; | 857 | goto done; |
diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c index d5953b87918c..3a246a6cab47 100644 --- a/net/ceph/osd_client.c +++ b/net/ceph/osd_client.c | |||
@@ -1675,13 +1675,13 @@ static void kick_requests(struct ceph_osd_client *osdc, int force_resend) | |||
1675 | __register_request(osdc, req); | 1675 | __register_request(osdc, req); |
1676 | __unregister_linger_request(osdc, req); | 1676 | __unregister_linger_request(osdc, req); |
1677 | } | 1677 | } |
1678 | reset_changed_osds(osdc); | ||
1678 | mutex_unlock(&osdc->request_mutex); | 1679 | mutex_unlock(&osdc->request_mutex); |
1679 | 1680 | ||
1680 | if (needmap) { | 1681 | if (needmap) { |
1681 | dout("%d requests for down osds, need new map\n", needmap); | 1682 | dout("%d requests for down osds, need new map\n", needmap); |
1682 | ceph_monc_request_next_osdmap(&osdc->client->monc); | 1683 | ceph_monc_request_next_osdmap(&osdc->client->monc); |
1683 | } | 1684 | } |
1684 | reset_changed_osds(osdc); | ||
1685 | } | 1685 | } |
1686 | 1686 | ||
1687 | 1687 | ||
diff --git a/net/core/filter.c b/net/core/filter.c index dad2a178f9f8..6438f29ff266 100644 --- a/net/core/filter.c +++ b/net/core/filter.c | |||
@@ -778,7 +778,7 @@ int sk_detach_filter(struct sock *sk) | |||
778 | } | 778 | } |
779 | EXPORT_SYMBOL_GPL(sk_detach_filter); | 779 | EXPORT_SYMBOL_GPL(sk_detach_filter); |
780 | 780 | ||
781 | static void sk_decode_filter(struct sock_filter *filt, struct sock_filter *to) | 781 | void sk_decode_filter(struct sock_filter *filt, struct sock_filter *to) |
782 | { | 782 | { |
783 | static const u16 decodes[] = { | 783 | static const u16 decodes[] = { |
784 | [BPF_S_ALU_ADD_K] = BPF_ALU|BPF_ADD|BPF_K, | 784 | [BPF_S_ALU_ADD_K] = BPF_ALU|BPF_ADD|BPF_K, |
diff --git a/net/core/sock_diag.c b/net/core/sock_diag.c index d5bef0b0f639..a0e9cf6379de 100644 --- a/net/core/sock_diag.c +++ b/net/core/sock_diag.c | |||
@@ -73,8 +73,13 @@ int sock_diag_put_filterinfo(struct user_namespace *user_ns, struct sock *sk, | |||
73 | goto out; | 73 | goto out; |
74 | } | 74 | } |
75 | 75 | ||
76 | if (filter) | 76 | if (filter) { |
77 | memcpy(nla_data(attr), filter->insns, len); | 77 | struct sock_filter *fb = (struct sock_filter *)nla_data(attr); |
78 | int i; | ||
79 | |||
80 | for (i = 0; i < filter->len; i++, fb++) | ||
81 | sk_decode_filter(&filter->insns[i], fb); | ||
82 | } | ||
78 | 83 | ||
79 | out: | 84 | out: |
80 | rcu_read_unlock(); | 85 | rcu_read_unlock(); |
diff --git a/net/ipv4/ip_tunnel.c b/net/ipv4/ip_tunnel.c index be2f8da0ae8e..7fa8f08fa7ae 100644 --- a/net/ipv4/ip_tunnel.c +++ b/net/ipv4/ip_tunnel.c | |||
@@ -853,7 +853,7 @@ void ip_tunnel_dellink(struct net_device *dev, struct list_head *head) | |||
853 | } | 853 | } |
854 | EXPORT_SYMBOL_GPL(ip_tunnel_dellink); | 854 | EXPORT_SYMBOL_GPL(ip_tunnel_dellink); |
855 | 855 | ||
856 | int __net_init ip_tunnel_init_net(struct net *net, int ip_tnl_net_id, | 856 | int ip_tunnel_init_net(struct net *net, int ip_tnl_net_id, |
857 | struct rtnl_link_ops *ops, char *devname) | 857 | struct rtnl_link_ops *ops, char *devname) |
858 | { | 858 | { |
859 | struct ip_tunnel_net *itn = net_generic(net, ip_tnl_net_id); | 859 | struct ip_tunnel_net *itn = net_generic(net, ip_tnl_net_id); |
@@ -899,7 +899,7 @@ static void ip_tunnel_destroy(struct ip_tunnel_net *itn, struct list_head *head) | |||
899 | unregister_netdevice_queue(itn->fb_tunnel_dev, head); | 899 | unregister_netdevice_queue(itn->fb_tunnel_dev, head); |
900 | } | 900 | } |
901 | 901 | ||
902 | void __net_exit ip_tunnel_delete_net(struct ip_tunnel_net *itn) | 902 | void ip_tunnel_delete_net(struct ip_tunnel_net *itn) |
903 | { | 903 | { |
904 | LIST_HEAD(list); | 904 | LIST_HEAD(list); |
905 | 905 | ||
diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c index 9d2bdb2c1d3f..c118f6b576bb 100644 --- a/net/ipv4/ip_vti.c +++ b/net/ipv4/ip_vti.c | |||
@@ -361,8 +361,7 @@ static netdev_tx_t vti_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) | |||
361 | tunnel->err_count = 0; | 361 | tunnel->err_count = 0; |
362 | } | 362 | } |
363 | 363 | ||
364 | IPCB(skb)->flags &= ~(IPSKB_XFRM_TUNNEL_SIZE | IPSKB_XFRM_TRANSFORMED | | 364 | memset(IPCB(skb), 0, sizeof(*IPCB(skb))); |
365 | IPSKB_REROUTED); | ||
366 | skb_dst_drop(skb); | 365 | skb_dst_drop(skb); |
367 | skb_dst_set(skb, &rt->dst); | 366 | skb_dst_set(skb, &rt->dst); |
368 | nf_reset(skb); | 367 | nf_reset(skb); |
diff --git a/net/l2tp/l2tp_ppp.c b/net/l2tp/l2tp_ppp.c index 637a341c1e2d..8dec6876dc50 100644 --- a/net/l2tp/l2tp_ppp.c +++ b/net/l2tp/l2tp_ppp.c | |||
@@ -346,19 +346,19 @@ static int pppol2tp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msgh | |||
346 | skb_put(skb, 2); | 346 | skb_put(skb, 2); |
347 | 347 | ||
348 | /* Copy user data into skb */ | 348 | /* Copy user data into skb */ |
349 | error = memcpy_fromiovec(skb->data, m->msg_iov, total_len); | 349 | error = memcpy_fromiovec(skb_put(skb, total_len), m->msg_iov, |
350 | total_len); | ||
350 | if (error < 0) { | 351 | if (error < 0) { |
351 | kfree_skb(skb); | 352 | kfree_skb(skb); |
352 | goto error_put_sess_tun; | 353 | goto error_put_sess_tun; |
353 | } | 354 | } |
354 | skb_put(skb, total_len); | ||
355 | 355 | ||
356 | l2tp_xmit_skb(session, skb, session->hdr_len); | 356 | l2tp_xmit_skb(session, skb, session->hdr_len); |
357 | 357 | ||
358 | sock_put(ps->tunnel_sock); | 358 | sock_put(ps->tunnel_sock); |
359 | sock_put(sk); | 359 | sock_put(sk); |
360 | 360 | ||
361 | return error; | 361 | return total_len; |
362 | 362 | ||
363 | error_put_sess_tun: | 363 | error_put_sess_tun: |
364 | sock_put(ps->tunnel_sock); | 364 | sock_put(ps->tunnel_sock); |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index 5b142fb16480..9e6c2a075a4c 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -2542,6 +2542,7 @@ __ip_vs_get_dest_entries(struct net *net, const struct ip_vs_get_dests *get, | |||
2542 | struct ip_vs_dest *dest; | 2542 | struct ip_vs_dest *dest; |
2543 | struct ip_vs_dest_entry entry; | 2543 | struct ip_vs_dest_entry entry; |
2544 | 2544 | ||
2545 | memset(&entry, 0, sizeof(entry)); | ||
2545 | list_for_each_entry(dest, &svc->destinations, n_list) { | 2546 | list_for_each_entry(dest, &svc->destinations, n_list) { |
2546 | if (count >= get->num_dests) | 2547 | if (count >= get->num_dests) |
2547 | break; | 2548 | break; |
diff --git a/net/netfilter/nfnetlink_acct.c b/net/netfilter/nfnetlink_acct.c index dc3fd5d44464..c7b6d466a662 100644 --- a/net/netfilter/nfnetlink_acct.c +++ b/net/netfilter/nfnetlink_acct.c | |||
@@ -149,9 +149,12 @@ nfnl_acct_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
149 | 149 | ||
150 | rcu_read_lock(); | 150 | rcu_read_lock(); |
151 | list_for_each_entry_rcu(cur, &nfnl_acct_list, head) { | 151 | list_for_each_entry_rcu(cur, &nfnl_acct_list, head) { |
152 | if (last && cur != last) | 152 | if (last) { |
153 | continue; | 153 | if (cur != last) |
154 | continue; | ||
154 | 155 | ||
156 | last = NULL; | ||
157 | } | ||
155 | if (nfnl_acct_fill_info(skb, NETLINK_CB(cb->skb).portid, | 158 | if (nfnl_acct_fill_info(skb, NETLINK_CB(cb->skb).portid, |
156 | cb->nlh->nlmsg_seq, | 159 | cb->nlh->nlmsg_seq, |
157 | NFNL_MSG_TYPE(cb->nlh->nlmsg_type), | 160 | NFNL_MSG_TYPE(cb->nlh->nlmsg_type), |
diff --git a/net/netfilter/nfnetlink_cttimeout.c b/net/netfilter/nfnetlink_cttimeout.c index 701c88a20fea..65074dfb9383 100644 --- a/net/netfilter/nfnetlink_cttimeout.c +++ b/net/netfilter/nfnetlink_cttimeout.c | |||
@@ -220,9 +220,12 @@ ctnl_timeout_dump(struct sk_buff *skb, struct netlink_callback *cb) | |||
220 | 220 | ||
221 | rcu_read_lock(); | 221 | rcu_read_lock(); |
222 | list_for_each_entry_rcu(cur, &cttimeout_list, head) { | 222 | list_for_each_entry_rcu(cur, &cttimeout_list, head) { |
223 | if (last && cur != last) | 223 | if (last) { |
224 | continue; | 224 | if (cur != last) |
225 | continue; | ||
225 | 226 | ||
227 | last = NULL; | ||
228 | } | ||
226 | if (ctnl_timeout_fill_info(skb, NETLINK_CB(cb->skb).portid, | 229 | if (ctnl_timeout_fill_info(skb, NETLINK_CB(cb->skb).portid, |
227 | cb->nlh->nlmsg_seq, | 230 | cb->nlh->nlmsg_seq, |
228 | NFNL_MSG_TYPE(cb->nlh->nlmsg_type), | 231 | NFNL_MSG_TYPE(cb->nlh->nlmsg_type), |
diff --git a/net/netfilter/nfnetlink_queue_core.c b/net/netfilter/nfnetlink_queue_core.c index 4e27fa035814..5352b2d2d5bf 100644 --- a/net/netfilter/nfnetlink_queue_core.c +++ b/net/netfilter/nfnetlink_queue_core.c | |||
@@ -637,9 +637,6 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum) | |||
637 | if (queue->copy_mode == NFQNL_COPY_NONE) | 637 | if (queue->copy_mode == NFQNL_COPY_NONE) |
638 | return -EINVAL; | 638 | return -EINVAL; |
639 | 639 | ||
640 | if ((queue->flags & NFQA_CFG_F_GSO) || !skb_is_gso(entry->skb)) | ||
641 | return __nfqnl_enqueue_packet(net, queue, entry); | ||
642 | |||
643 | skb = entry->skb; | 640 | skb = entry->skb; |
644 | 641 | ||
645 | switch (entry->pf) { | 642 | switch (entry->pf) { |
@@ -651,6 +648,9 @@ nfqnl_enqueue_packet(struct nf_queue_entry *entry, unsigned int queuenum) | |||
651 | break; | 648 | break; |
652 | } | 649 | } |
653 | 650 | ||
651 | if ((queue->flags & NFQA_CFG_F_GSO) || !skb_is_gso(skb)) | ||
652 | return __nfqnl_enqueue_packet(net, queue, entry); | ||
653 | |||
654 | nf_bridge_adjust_skb_data(skb); | 654 | nf_bridge_adjust_skb_data(skb); |
655 | segs = skb_gso_segment(skb, 0); | 655 | segs = skb_gso_segment(skb, 0); |
656 | /* Does not use PTR_ERR to limit the number of error codes that can be | 656 | /* Does not use PTR_ERR to limit the number of error codes that can be |
diff --git a/net/netfilter/xt_TCPMSS.c b/net/netfilter/xt_TCPMSS.c index a75240f0d42b..afaebc766933 100644 --- a/net/netfilter/xt_TCPMSS.c +++ b/net/netfilter/xt_TCPMSS.c | |||
@@ -125,6 +125,12 @@ tcpmss_mangle_packet(struct sk_buff *skb, | |||
125 | 125 | ||
126 | skb_put(skb, TCPOLEN_MSS); | 126 | skb_put(skb, TCPOLEN_MSS); |
127 | 127 | ||
128 | /* RFC 879 states that the default MSS is 536 without specific | ||
129 | * knowledge that the destination host is prepared to accept larger. | ||
130 | * Since no MSS was provided, we MUST NOT set a value > 536. | ||
131 | */ | ||
132 | newmss = min(newmss, (u16)536); | ||
133 | |||
128 | opt = (u_int8_t *)tcph + sizeof(struct tcphdr); | 134 | opt = (u_int8_t *)tcph + sizeof(struct tcphdr); |
129 | memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr)); | 135 | memmove(opt + TCPOLEN_MSS, opt, tcplen - sizeof(struct tcphdr)); |
130 | 136 | ||
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c index d0b3dd60d386..57ee84d21470 100644 --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c | |||
@@ -371,7 +371,7 @@ static int netlink_mmap(struct file *file, struct socket *sock, | |||
371 | err = 0; | 371 | err = 0; |
372 | out: | 372 | out: |
373 | mutex_unlock(&nlk->pg_vec_lock); | 373 | mutex_unlock(&nlk->pg_vec_lock); |
374 | return 0; | 374 | return err; |
375 | } | 375 | } |
376 | 376 | ||
377 | static void netlink_frame_flush_dcache(const struct nl_mmap_hdr *hdr) | 377 | static void netlink_frame_flush_dcache(const struct nl_mmap_hdr *hdr) |
diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c index 8ec1bca7f859..20a1bd0e6549 100644 --- a/net/packet/af_packet.c +++ b/net/packet/af_packet.c | |||
@@ -2851,12 +2851,11 @@ static int packet_getname_spkt(struct socket *sock, struct sockaddr *uaddr, | |||
2851 | return -EOPNOTSUPP; | 2851 | return -EOPNOTSUPP; |
2852 | 2852 | ||
2853 | uaddr->sa_family = AF_PACKET; | 2853 | uaddr->sa_family = AF_PACKET; |
2854 | memset(uaddr->sa_data, 0, sizeof(uaddr->sa_data)); | ||
2854 | rcu_read_lock(); | 2855 | rcu_read_lock(); |
2855 | dev = dev_get_by_index_rcu(sock_net(sk), pkt_sk(sk)->ifindex); | 2856 | dev = dev_get_by_index_rcu(sock_net(sk), pkt_sk(sk)->ifindex); |
2856 | if (dev) | 2857 | if (dev) |
2857 | strncpy(uaddr->sa_data, dev->name, 14); | 2858 | strlcpy(uaddr->sa_data, dev->name, sizeof(uaddr->sa_data)); |
2858 | else | ||
2859 | memset(uaddr->sa_data, 0, 14); | ||
2860 | rcu_read_unlock(); | 2859 | rcu_read_unlock(); |
2861 | *uaddr_len = sizeof(*uaddr); | 2860 | *uaddr_len = sizeof(*uaddr); |
2862 | 2861 | ||
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 2b935e7cfe7b..281c1bded1f6 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
@@ -291,17 +291,18 @@ struct qdisc_rate_table *qdisc_get_rtab(struct tc_ratespec *r, struct nlattr *ta | |||
291 | { | 291 | { |
292 | struct qdisc_rate_table *rtab; | 292 | struct qdisc_rate_table *rtab; |
293 | 293 | ||
294 | if (tab == NULL || r->rate == 0 || r->cell_log == 0 || | ||
295 | nla_len(tab) != TC_RTAB_SIZE) | ||
296 | return NULL; | ||
297 | |||
294 | for (rtab = qdisc_rtab_list; rtab; rtab = rtab->next) { | 298 | for (rtab = qdisc_rtab_list; rtab; rtab = rtab->next) { |
295 | if (memcmp(&rtab->rate, r, sizeof(struct tc_ratespec)) == 0) { | 299 | if (!memcmp(&rtab->rate, r, sizeof(struct tc_ratespec)) && |
300 | !memcmp(&rtab->data, nla_data(tab), 1024)) { | ||
296 | rtab->refcnt++; | 301 | rtab->refcnt++; |
297 | return rtab; | 302 | return rtab; |
298 | } | 303 | } |
299 | } | 304 | } |
300 | 305 | ||
301 | if (tab == NULL || r->rate == 0 || r->cell_log == 0 || | ||
302 | nla_len(tab) != TC_RTAB_SIZE) | ||
303 | return NULL; | ||
304 | |||
305 | rtab = kmalloc(sizeof(*rtab), GFP_KERNEL); | 306 | rtab = kmalloc(sizeof(*rtab), GFP_KERNEL); |
306 | if (rtab) { | 307 | if (rtab) { |
307 | rtab->rate = *r; | 308 | rtab->rate = *r; |
diff --git a/net/sctp/outqueue.c b/net/sctp/outqueue.c index 32a4625fef77..be35e2dbcc9a 100644 --- a/net/sctp/outqueue.c +++ b/net/sctp/outqueue.c | |||
@@ -206,6 +206,8 @@ static inline int sctp_cacc_skip(struct sctp_transport *primary, | |||
206 | */ | 206 | */ |
207 | void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q) | 207 | void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q) |
208 | { | 208 | { |
209 | memset(q, 0, sizeof(struct sctp_outq)); | ||
210 | |||
209 | q->asoc = asoc; | 211 | q->asoc = asoc; |
210 | INIT_LIST_HEAD(&q->out_chunk_list); | 212 | INIT_LIST_HEAD(&q->out_chunk_list); |
211 | INIT_LIST_HEAD(&q->control_chunk_list); | 213 | INIT_LIST_HEAD(&q->control_chunk_list); |
@@ -213,11 +215,7 @@ void sctp_outq_init(struct sctp_association *asoc, struct sctp_outq *q) | |||
213 | INIT_LIST_HEAD(&q->sacked); | 215 | INIT_LIST_HEAD(&q->sacked); |
214 | INIT_LIST_HEAD(&q->abandoned); | 216 | INIT_LIST_HEAD(&q->abandoned); |
215 | 217 | ||
216 | q->fast_rtx = 0; | ||
217 | q->outstanding_bytes = 0; | ||
218 | q->empty = 1; | 218 | q->empty = 1; |
219 | q->cork = 0; | ||
220 | q->out_qlen = 0; | ||
221 | } | 219 | } |
222 | 220 | ||
223 | /* Free the outqueue structure and any related pending chunks. | 221 | /* Free the outqueue structure and any related pending chunks. |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index f631c5ff4dbf..6abb1caf9836 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -4003,6 +4003,12 @@ SCTP_STATIC void sctp_destroy_sock(struct sock *sk) | |||
4003 | 4003 | ||
4004 | /* Release our hold on the endpoint. */ | 4004 | /* Release our hold on the endpoint. */ |
4005 | sp = sctp_sk(sk); | 4005 | sp = sctp_sk(sk); |
4006 | /* This could happen during socket init, thus we bail out | ||
4007 | * early, since the rest of the below is not setup either. | ||
4008 | */ | ||
4009 | if (sp->ep == NULL) | ||
4010 | return; | ||
4011 | |||
4006 | if (sp->do_auto_asconf) { | 4012 | if (sp->do_auto_asconf) { |
4007 | sp->do_auto_asconf = 0; | 4013 | sp->do_auto_asconf = 0; |
4008 | list_del(&sp->auto_asconf_list); | 4014 | list_del(&sp->auto_asconf_list); |