diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-01-24 10:45:35 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-01-24 10:45:35 -0500 |
commit | 6f3776c9cd03998f0e6d11774a03aa1788b4e463 (patch) | |
tree | 4c99a1c314f297ecd363c35f9edff80cd843b31b /net | |
parent | 6e35c24b9f5b2f68732910d2138bc0eb1b477ab1 (diff) | |
parent | 1e5c11fc89ef6663aaa14db1e9e27477f07c24e0 (diff) |
Merge master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6
* master.kernel.org:/pub/scm/linux/kernel/git/davem/net-2.6: (23 commits)
[SCTP]: Fix compiler warning.
[IP] TUNNEL: Fix to be built with user application.
[IPV6]: Fixed the size of the netlink message notified by inet6_rt_notify().
[TCP]: rare bad TCP checksum with 2.6.19
[NET]: Process include/linux/if_{addr,link}.h with unifdef
[NETFILTER]: Fix iptables ABI breakage on (at least) CRIS
[IRDA] vlsi_ir.{h,c}: remove kernel 2.4 code
[TCP]: skb is unexpectedly freed.
[IPSEC]: Policy list disorder
[IrDA]: Removed incorrect IRDA_ASSERT()
[IrDA]: irda-usb TX path optimization (was Re: IrDA spams logfiles - since 2.6.19)
[X.25]: Add missing sock_put in x25_receive_data
[SCTP]: Fix SACK sequence during shutdown
[SCTP]: Correctly handle unexpected INIT-ACK chunk.
[SCTP]: Verify some mandatory parameters.
[SCTP]: Set correct error cause value for missing parameters
[NETFILTER]: fix xt_state compile failure
[NETFILTER]: ctnetlink: fix leak in ctnetlink_create_conntrack error path
[SELINUX]: increment flow cache genid
[IPV6] MCAST: Fix joining all-node multicast group on device initialization.
...
Diffstat (limited to 'net')
-rw-r--r-- | net/bluetooth/l2cap.c | 10 | ||||
-rw-r--r-- | net/core/flow.c | 26 | ||||
-rw-r--r-- | net/ipv4/netfilter/ip_conntrack_netlink.c | 2 | ||||
-rw-r--r-- | net/ipv4/tcp_input.c | 6 | ||||
-rw-r--r-- | net/ipv4/tcp_output.c | 3 | ||||
-rw-r--r-- | net/ipv6/addrconf.c | 6 | ||||
-rw-r--r-- | net/ipv6/mcast.c | 6 | ||||
-rw-r--r-- | net/ipv6/route.c | 1 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_netlink.c | 2 | ||||
-rw-r--r-- | net/sctp/sm_make_chunk.c | 6 | ||||
-rw-r--r-- | net/sctp/sm_sideeffect.c | 2 | ||||
-rw-r--r-- | net/sctp/sm_statefuns.c | 44 | ||||
-rw-r--r-- | net/sctp/sm_statetable.c | 2 | ||||
-rw-r--r-- | net/x25/x25_dev.c | 1 | ||||
-rw-r--r-- | net/xfrm/xfrm_policy.c | 16 |
15 files changed, 67 insertions, 66 deletions
diff --git a/net/bluetooth/l2cap.c b/net/bluetooth/l2cap.c index 29a8fa4d3728..f8c25d500155 100644 --- a/net/bluetooth/l2cap.c +++ b/net/bluetooth/l2cap.c | |||
@@ -585,6 +585,12 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_ | |||
585 | goto done; | 585 | goto done; |
586 | } | 586 | } |
587 | 587 | ||
588 | if (la->l2_psm > 0 && btohs(la->l2_psm) < 0x1001 && | ||
589 | !capable(CAP_NET_BIND_SERVICE)) { | ||
590 | err = -EACCES; | ||
591 | goto done; | ||
592 | } | ||
593 | |||
588 | write_lock_bh(&l2cap_sk_list.lock); | 594 | write_lock_bh(&l2cap_sk_list.lock); |
589 | 595 | ||
590 | if (la->l2_psm && __l2cap_get_sock_by_addr(la->l2_psm, &la->l2_bdaddr)) { | 596 | if (la->l2_psm && __l2cap_get_sock_by_addr(la->l2_psm, &la->l2_bdaddr)) { |
@@ -2150,8 +2156,8 @@ static ssize_t l2cap_sysfs_show(struct class *dev, char *buf) | |||
2150 | 2156 | ||
2151 | str += sprintf(str, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d 0x%x\n", | 2157 | str += sprintf(str, "%s %s %d %d 0x%4.4x 0x%4.4x %d %d 0x%x\n", |
2152 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), | 2158 | batostr(&bt_sk(sk)->src), batostr(&bt_sk(sk)->dst), |
2153 | sk->sk_state, pi->psm, pi->scid, pi->dcid, pi->imtu, | 2159 | sk->sk_state, btohs(pi->psm), pi->scid, pi->dcid, |
2154 | pi->omtu, pi->link_mode); | 2160 | pi->imtu, pi->omtu, pi->link_mode); |
2155 | } | 2161 | } |
2156 | 2162 | ||
2157 | read_unlock_bh(&l2cap_sk_list.lock); | 2163 | read_unlock_bh(&l2cap_sk_list.lock); |
diff --git a/net/core/flow.c b/net/core/flow.c index d137f971f97d..5d25697920b1 100644 --- a/net/core/flow.c +++ b/net/core/flow.c | |||
@@ -231,22 +231,16 @@ nocache: | |||
231 | 231 | ||
232 | err = resolver(key, family, dir, &obj, &obj_ref); | 232 | err = resolver(key, family, dir, &obj, &obj_ref); |
233 | 233 | ||
234 | if (fle) { | 234 | if (fle && !err) { |
235 | if (err) { | 235 | fle->genid = atomic_read(&flow_cache_genid); |
236 | /* Force security policy check on next lookup */ | 236 | |
237 | *head = fle->next; | 237 | if (fle->object) |
238 | flow_entry_kill(cpu, fle); | 238 | atomic_dec(fle->object_ref); |
239 | } else { | 239 | |
240 | fle->genid = atomic_read(&flow_cache_genid); | 240 | fle->object = obj; |
241 | 241 | fle->object_ref = obj_ref; | |
242 | if (fle->object) | 242 | if (obj) |
243 | atomic_dec(fle->object_ref); | 243 | atomic_inc(fle->object_ref); |
244 | |||
245 | fle->object = obj; | ||
246 | fle->object_ref = obj_ref; | ||
247 | if (obj) | ||
248 | atomic_inc(fle->object_ref); | ||
249 | } | ||
250 | } | 244 | } |
251 | local_bh_enable(); | 245 | local_bh_enable(); |
252 | 246 | ||
diff --git a/net/ipv4/netfilter/ip_conntrack_netlink.c b/net/ipv4/netfilter/ip_conntrack_netlink.c index 5fcf91d617cd..6f31fad9be13 100644 --- a/net/ipv4/netfilter/ip_conntrack_netlink.c +++ b/net/ipv4/netfilter/ip_conntrack_netlink.c | |||
@@ -959,7 +959,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[], | |||
959 | if (cda[CTA_PROTOINFO-1]) { | 959 | if (cda[CTA_PROTOINFO-1]) { |
960 | err = ctnetlink_change_protoinfo(ct, cda); | 960 | err = ctnetlink_change_protoinfo(ct, cda); |
961 | if (err < 0) | 961 | if (err < 0) |
962 | return err; | 962 | goto err; |
963 | } | 963 | } |
964 | 964 | ||
965 | #if defined(CONFIG_IP_NF_CONNTRACK_MARK) | 965 | #if defined(CONFIG_IP_NF_CONNTRACK_MARK) |
diff --git a/net/ipv4/tcp_input.c b/net/ipv4/tcp_input.c index c701f6abbfc1..5c16e24a6061 100644 --- a/net/ipv4/tcp_input.c +++ b/net/ipv4/tcp_input.c | |||
@@ -4420,9 +4420,11 @@ int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, | |||
4420 | * But, this leaves one open to an easy denial of | 4420 | * But, this leaves one open to an easy denial of |
4421 | * service attack, and SYN cookies can't defend | 4421 | * service attack, and SYN cookies can't defend |
4422 | * against this problem. So, we drop the data | 4422 | * against this problem. So, we drop the data |
4423 | * in the interest of security over speed. | 4423 | * in the interest of security over speed unless |
4424 | * it's still in use. | ||
4424 | */ | 4425 | */ |
4425 | goto discard; | 4426 | kfree_skb(skb); |
4427 | return 0; | ||
4426 | } | 4428 | } |
4427 | goto discard; | 4429 | goto discard; |
4428 | 4430 | ||
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index 32c1a972fa31..23e32c806916 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c | |||
@@ -1650,7 +1650,8 @@ static void tcp_retrans_try_collapse(struct sock *sk, struct sk_buff *skb, int m | |||
1650 | 1650 | ||
1651 | memcpy(skb_put(skb, next_skb_size), next_skb->data, next_skb_size); | 1651 | memcpy(skb_put(skb, next_skb_size), next_skb->data, next_skb_size); |
1652 | 1652 | ||
1653 | skb->ip_summed = next_skb->ip_summed; | 1653 | if (next_skb->ip_summed == CHECKSUM_PARTIAL) |
1654 | skb->ip_summed = CHECKSUM_PARTIAL; | ||
1654 | 1655 | ||
1655 | if (skb->ip_summed != CHECKSUM_PARTIAL) | 1656 | if (skb->ip_summed != CHECKSUM_PARTIAL) |
1656 | skb->csum = csum_block_add(skb->csum, next_skb->csum, skb_size); | 1657 | skb->csum = csum_block_add(skb->csum, next_skb->csum, skb_size); |
diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c index 171e5b55d7d6..2a7e4618f526 100644 --- a/net/ipv6/addrconf.c +++ b/net/ipv6/addrconf.c | |||
@@ -341,6 +341,7 @@ void in6_dev_finish_destroy(struct inet6_dev *idev) | |||
341 | static struct inet6_dev * ipv6_add_dev(struct net_device *dev) | 341 | static struct inet6_dev * ipv6_add_dev(struct net_device *dev) |
342 | { | 342 | { |
343 | struct inet6_dev *ndev; | 343 | struct inet6_dev *ndev; |
344 | struct in6_addr maddr; | ||
344 | 345 | ||
345 | ASSERT_RTNL(); | 346 | ASSERT_RTNL(); |
346 | 347 | ||
@@ -425,6 +426,11 @@ static struct inet6_dev * ipv6_add_dev(struct net_device *dev) | |||
425 | #endif | 426 | #endif |
426 | /* protected by rtnl_lock */ | 427 | /* protected by rtnl_lock */ |
427 | rcu_assign_pointer(dev->ip6_ptr, ndev); | 428 | rcu_assign_pointer(dev->ip6_ptr, ndev); |
429 | |||
430 | /* Join all-node multicast group */ | ||
431 | ipv6_addr_all_nodes(&maddr); | ||
432 | ipv6_dev_mc_inc(dev, &maddr); | ||
433 | |||
428 | return ndev; | 434 | return ndev; |
429 | } | 435 | } |
430 | 436 | ||
diff --git a/net/ipv6/mcast.c b/net/ipv6/mcast.c index a1c231a04ac2..882cde4b4047 100644 --- a/net/ipv6/mcast.c +++ b/net/ipv6/mcast.c | |||
@@ -2258,8 +2258,6 @@ void ipv6_mc_up(struct inet6_dev *idev) | |||
2258 | 2258 | ||
2259 | void ipv6_mc_init_dev(struct inet6_dev *idev) | 2259 | void ipv6_mc_init_dev(struct inet6_dev *idev) |
2260 | { | 2260 | { |
2261 | struct in6_addr maddr; | ||
2262 | |||
2263 | write_lock_bh(&idev->lock); | 2261 | write_lock_bh(&idev->lock); |
2264 | rwlock_init(&idev->mc_lock); | 2262 | rwlock_init(&idev->mc_lock); |
2265 | idev->mc_gq_running = 0; | 2263 | idev->mc_gq_running = 0; |
@@ -2275,10 +2273,6 @@ void ipv6_mc_init_dev(struct inet6_dev *idev) | |||
2275 | idev->mc_maxdelay = IGMP6_UNSOLICITED_IVAL; | 2273 | idev->mc_maxdelay = IGMP6_UNSOLICITED_IVAL; |
2276 | idev->mc_v1_seen = 0; | 2274 | idev->mc_v1_seen = 0; |
2277 | write_unlock_bh(&idev->lock); | 2275 | write_unlock_bh(&idev->lock); |
2278 | |||
2279 | /* Add all-nodes address. */ | ||
2280 | ipv6_addr_all_nodes(&maddr); | ||
2281 | ipv6_dev_mc_inc(idev->dev, &maddr); | ||
2282 | } | 2276 | } |
2283 | 2277 | ||
2284 | /* | 2278 | /* |
diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 8c3d56871b50..5f0043c30b70 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c | |||
@@ -2017,6 +2017,7 @@ static inline size_t rt6_nlmsg_size(void) | |||
2017 | + nla_total_size(4) /* RTA_IIF */ | 2017 | + nla_total_size(4) /* RTA_IIF */ |
2018 | + nla_total_size(4) /* RTA_OIF */ | 2018 | + nla_total_size(4) /* RTA_OIF */ |
2019 | + nla_total_size(4) /* RTA_PRIORITY */ | 2019 | + nla_total_size(4) /* RTA_PRIORITY */ |
2020 | + RTAX_MAX * nla_total_size(4) /* RTA_METRICS */ | ||
2020 | + nla_total_size(sizeof(struct rta_cacheinfo)); | 2021 | + nla_total_size(sizeof(struct rta_cacheinfo)); |
2021 | } | 2022 | } |
2022 | 2023 | ||
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index bd1d2de75e45..811e3e782f0f 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -981,7 +981,7 @@ ctnetlink_create_conntrack(struct nfattr *cda[], | |||
981 | if (cda[CTA_PROTOINFO-1]) { | 981 | if (cda[CTA_PROTOINFO-1]) { |
982 | err = ctnetlink_change_protoinfo(ct, cda); | 982 | err = ctnetlink_change_protoinfo(ct, cda); |
983 | if (err < 0) | 983 | if (err < 0) |
984 | return err; | 984 | goto err; |
985 | } | 985 | } |
986 | 986 | ||
987 | #if defined(CONFIG_NF_CONNTRACK_MARK) | 987 | #if defined(CONFIG_NF_CONNTRACK_MARK) |
diff --git a/net/sctp/sm_make_chunk.c b/net/sctp/sm_make_chunk.c index 167d888d1df2..0b1ddb1005ac 100644 --- a/net/sctp/sm_make_chunk.c +++ b/net/sctp/sm_make_chunk.c | |||
@@ -1562,7 +1562,7 @@ static int sctp_process_missing_param(const struct sctp_association *asoc, | |||
1562 | if (*errp) { | 1562 | if (*errp) { |
1563 | report.num_missing = htonl(1); | 1563 | report.num_missing = htonl(1); |
1564 | report.type = paramtype; | 1564 | report.type = paramtype; |
1565 | sctp_init_cause(*errp, SCTP_ERROR_INV_PARAM, | 1565 | sctp_init_cause(*errp, SCTP_ERROR_MISS_PARAM, |
1566 | &report, sizeof(report)); | 1566 | &report, sizeof(report)); |
1567 | } | 1567 | } |
1568 | 1568 | ||
@@ -1775,7 +1775,9 @@ int sctp_verify_init(const struct sctp_association *asoc, | |||
1775 | 1775 | ||
1776 | /* Verify stream values are non-zero. */ | 1776 | /* Verify stream values are non-zero. */ |
1777 | if ((0 == peer_init->init_hdr.num_outbound_streams) || | 1777 | if ((0 == peer_init->init_hdr.num_outbound_streams) || |
1778 | (0 == peer_init->init_hdr.num_inbound_streams)) { | 1778 | (0 == peer_init->init_hdr.num_inbound_streams) || |
1779 | (0 == peer_init->init_hdr.init_tag) || | ||
1780 | (SCTP_DEFAULT_MINWINDOW > ntohl(peer_init->init_hdr.a_rwnd))) { | ||
1779 | 1781 | ||
1780 | sctp_process_inv_mandatory(asoc, chunk, errp); | 1782 | sctp_process_inv_mandatory(asoc, chunk, errp); |
1781 | return 0; | 1783 | return 0; |
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index 7bbc6156e455..8bd30976cdee 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c | |||
@@ -217,7 +217,7 @@ static int sctp_gen_sack(struct sctp_association *asoc, int force, | |||
217 | 217 | ||
218 | asoc->peer.sack_needed = 0; | 218 | asoc->peer.sack_needed = 0; |
219 | 219 | ||
220 | error = sctp_outq_tail(&asoc->outqueue, sack); | 220 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(sack)); |
221 | 221 | ||
222 | /* Stop the SACK timer. */ | 222 | /* Stop the SACK timer. */ |
223 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, | 223 | sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP, |
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c index aa51d190bfb2..fbbc9e6a3b78 100644 --- a/net/sctp/sm_statefuns.c +++ b/net/sctp/sm_statefuns.c | |||
@@ -440,7 +440,6 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep, | |||
440 | { | 440 | { |
441 | struct sctp_chunk *chunk = arg; | 441 | struct sctp_chunk *chunk = arg; |
442 | sctp_init_chunk_t *initchunk; | 442 | sctp_init_chunk_t *initchunk; |
443 | __u32 init_tag; | ||
444 | struct sctp_chunk *err_chunk; | 443 | struct sctp_chunk *err_chunk; |
445 | struct sctp_packet *packet; | 444 | struct sctp_packet *packet; |
446 | sctp_error_t error; | 445 | sctp_error_t error; |
@@ -462,24 +461,6 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep, | |||
462 | /* Grab the INIT header. */ | 461 | /* Grab the INIT header. */ |
463 | chunk->subh.init_hdr = (sctp_inithdr_t *) chunk->skb->data; | 462 | chunk->subh.init_hdr = (sctp_inithdr_t *) chunk->skb->data; |
464 | 463 | ||
465 | init_tag = ntohl(chunk->subh.init_hdr->init_tag); | ||
466 | |||
467 | /* Verification Tag: 3.3.3 | ||
468 | * If the value of the Initiate Tag in a received INIT ACK | ||
469 | * chunk is found to be 0, the receiver MUST treat it as an | ||
470 | * error and close the association by transmitting an ABORT. | ||
471 | */ | ||
472 | if (!init_tag) { | ||
473 | struct sctp_chunk *reply = sctp_make_abort(asoc, chunk, 0); | ||
474 | if (!reply) | ||
475 | goto nomem; | ||
476 | |||
477 | sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(reply)); | ||
478 | return sctp_stop_t1_and_abort(commands, SCTP_ERROR_INV_PARAM, | ||
479 | ECONNREFUSED, asoc, | ||
480 | chunk->transport); | ||
481 | } | ||
482 | |||
483 | /* Verify the INIT chunk before processing it. */ | 464 | /* Verify the INIT chunk before processing it. */ |
484 | err_chunk = NULL; | 465 | err_chunk = NULL; |
485 | if (!sctp_verify_init(asoc, chunk->chunk_hdr->type, | 466 | if (!sctp_verify_init(asoc, chunk->chunk_hdr->type, |
@@ -550,9 +531,6 @@ sctp_disposition_t sctp_sf_do_5_1C_ack(const struct sctp_endpoint *ep, | |||
550 | SCTP_CHUNK(err_chunk)); | 531 | SCTP_CHUNK(err_chunk)); |
551 | 532 | ||
552 | return SCTP_DISPOSITION_CONSUME; | 533 | return SCTP_DISPOSITION_CONSUME; |
553 | |||
554 | nomem: | ||
555 | return SCTP_DISPOSITION_NOMEM; | ||
556 | } | 534 | } |
557 | 535 | ||
558 | /* | 536 | /* |
@@ -1553,6 +1531,28 @@ sctp_disposition_t sctp_sf_do_5_2_2_dupinit(const struct sctp_endpoint *ep, | |||
1553 | } | 1531 | } |
1554 | 1532 | ||
1555 | 1533 | ||
1534 | /* | ||
1535 | * Unexpected INIT-ACK handler. | ||
1536 | * | ||
1537 | * Section 5.2.3 | ||
1538 | * If an INIT ACK received by an endpoint in any state other than the | ||
1539 | * COOKIE-WAIT state, the endpoint should discard the INIT ACK chunk. | ||
1540 | * An unexpected INIT ACK usually indicates the processing of an old or | ||
1541 | * duplicated INIT chunk. | ||
1542 | */ | ||
1543 | sctp_disposition_t sctp_sf_do_5_2_3_initack(const struct sctp_endpoint *ep, | ||
1544 | const struct sctp_association *asoc, | ||
1545 | const sctp_subtype_t type, | ||
1546 | void *arg, sctp_cmd_seq_t *commands) | ||
1547 | { | ||
1548 | /* Per the above section, we'll discard the chunk if we have an | ||
1549 | * endpoint. If this is an OOTB INIT-ACK, treat it as such. | ||
1550 | */ | ||
1551 | if (ep == sctp_sk((sctp_get_ctl_sock()))->ep) | ||
1552 | return sctp_sf_ootb(ep, asoc, type, arg, commands); | ||
1553 | else | ||
1554 | return sctp_sf_discard_chunk(ep, asoc, type, arg, commands); | ||
1555 | } | ||
1556 | 1556 | ||
1557 | /* Unexpected COOKIE-ECHO handler for peer restart (Table 2, action 'A') | 1557 | /* Unexpected COOKIE-ECHO handler for peer restart (Table 2, action 'A') |
1558 | * | 1558 | * |
diff --git a/net/sctp/sm_statetable.c b/net/sctp/sm_statetable.c index 733dd87b3a7d..5f6cc7aa661b 100644 --- a/net/sctp/sm_statetable.c +++ b/net/sctp/sm_statetable.c | |||
@@ -152,7 +152,7 @@ const sctp_sm_table_entry_t *sctp_sm_lookup_event(sctp_event_t event_type, | |||
152 | /* SCTP_STATE_EMPTY */ \ | 152 | /* SCTP_STATE_EMPTY */ \ |
153 | TYPE_SCTP_FUNC(sctp_sf_ootb), \ | 153 | TYPE_SCTP_FUNC(sctp_sf_ootb), \ |
154 | /* SCTP_STATE_CLOSED */ \ | 154 | /* SCTP_STATE_CLOSED */ \ |
155 | TYPE_SCTP_FUNC(sctp_sf_discard_chunk), \ | 155 | TYPE_SCTP_FUNC(sctp_sf_do_5_2_3_initack), \ |
156 | /* SCTP_STATE_COOKIE_WAIT */ \ | 156 | /* SCTP_STATE_COOKIE_WAIT */ \ |
157 | TYPE_SCTP_FUNC(sctp_sf_do_5_1C_ack), \ | 157 | TYPE_SCTP_FUNC(sctp_sf_do_5_1C_ack), \ |
158 | /* SCTP_STATE_COOKIE_ECHOED */ \ | 158 | /* SCTP_STATE_COOKIE_ECHOED */ \ |
diff --git a/net/x25/x25_dev.c b/net/x25/x25_dev.c index 47b68a301677..328d80f000ad 100644 --- a/net/x25/x25_dev.c +++ b/net/x25/x25_dev.c | |||
@@ -56,6 +56,7 @@ static int x25_receive_data(struct sk_buff *skb, struct x25_neigh *nb) | |||
56 | sk_add_backlog(sk, skb); | 56 | sk_add_backlog(sk, skb); |
57 | } | 57 | } |
58 | bh_unlock_sock(sk); | 58 | bh_unlock_sock(sk); |
59 | sock_put(sk); | ||
59 | return queued; | 60 | return queued; |
60 | } | 61 | } |
61 | 62 | ||
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index bebd40e5a62e..b7e537fe2d75 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
@@ -650,19 +650,18 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl) | |||
650 | struct xfrm_policy *pol; | 650 | struct xfrm_policy *pol; |
651 | struct xfrm_policy *delpol; | 651 | struct xfrm_policy *delpol; |
652 | struct hlist_head *chain; | 652 | struct hlist_head *chain; |
653 | struct hlist_node *entry, *newpos, *last; | 653 | struct hlist_node *entry, *newpos; |
654 | struct dst_entry *gc_list; | 654 | struct dst_entry *gc_list; |
655 | 655 | ||
656 | write_lock_bh(&xfrm_policy_lock); | 656 | write_lock_bh(&xfrm_policy_lock); |
657 | chain = policy_hash_bysel(&policy->selector, policy->family, dir); | 657 | chain = policy_hash_bysel(&policy->selector, policy->family, dir); |
658 | delpol = NULL; | 658 | delpol = NULL; |
659 | newpos = NULL; | 659 | newpos = NULL; |
660 | last = NULL; | ||
661 | hlist_for_each_entry(pol, entry, chain, bydst) { | 660 | hlist_for_each_entry(pol, entry, chain, bydst) { |
662 | if (!delpol && | 661 | if (pol->type == policy->type && |
663 | pol->type == policy->type && | ||
664 | !selector_cmp(&pol->selector, &policy->selector) && | 662 | !selector_cmp(&pol->selector, &policy->selector) && |
665 | xfrm_sec_ctx_match(pol->security, policy->security)) { | 663 | xfrm_sec_ctx_match(pol->security, policy->security) && |
664 | !WARN_ON(delpol)) { | ||
666 | if (excl) { | 665 | if (excl) { |
667 | write_unlock_bh(&xfrm_policy_lock); | 666 | write_unlock_bh(&xfrm_policy_lock); |
668 | return -EEXIST; | 667 | return -EEXIST; |
@@ -671,17 +670,12 @@ int xfrm_policy_insert(int dir, struct xfrm_policy *policy, int excl) | |||
671 | if (policy->priority > pol->priority) | 670 | if (policy->priority > pol->priority) |
672 | continue; | 671 | continue; |
673 | } else if (policy->priority >= pol->priority) { | 672 | } else if (policy->priority >= pol->priority) { |
674 | last = &pol->bydst; | 673 | newpos = &pol->bydst; |
675 | continue; | 674 | continue; |
676 | } | 675 | } |
677 | if (!newpos) | ||
678 | newpos = &pol->bydst; | ||
679 | if (delpol) | 676 | if (delpol) |
680 | break; | 677 | break; |
681 | last = &pol->bydst; | ||
682 | } | 678 | } |
683 | if (!newpos) | ||
684 | newpos = last; | ||
685 | if (newpos) | 679 | if (newpos) |
686 | hlist_add_after(newpos, &policy->bydst); | 680 | hlist_add_after(newpos, &policy->bydst); |
687 | else | 681 | else |