diff options
Diffstat (limited to 'net')
| -rw-r--r-- | net/ipv4/devinet.c | 15 | ||||
| -rw-r--r-- | net/ipv6/raw.c | 6 | ||||
| -rw-r--r-- | net/mac80211/debugfs_key.c | 6 | ||||
| -rw-r--r-- | net/mac80211/ieee80211_i.h | 4 | ||||
| -rw-r--r-- | net/sched/cls_api.c | 2 | ||||
| -rw-r--r-- | net/sched/cls_route.c | 2 | ||||
| -rw-r--r-- | net/sched/sch_api.c | 8 | ||||
| -rw-r--r-- | net/sched/sch_cbq.c | 2 | ||||
| -rw-r--r-- | net/sched/sch_htb.c | 4 | ||||
| -rw-r--r-- | net/sched/sch_netem.c | 2 | ||||
| -rw-r--r-- | net/sched/sch_teql.c | 2 | ||||
| -rw-r--r-- | net/wireless/Kconfig | 3 | ||||
| -rw-r--r-- | net/xfrm/xfrm_policy.c | 6 | ||||
| -rw-r--r-- | net/xfrm/xfrm_state.c | 32 |
14 files changed, 59 insertions, 35 deletions
diff --git a/net/ipv4/devinet.c b/net/ipv4/devinet.c index 91d3d96805d0..b12dae2b0b2d 100644 --- a/net/ipv4/devinet.c +++ b/net/ipv4/devinet.c | |||
| @@ -1029,6 +1029,11 @@ skip: | |||
| 1029 | } | 1029 | } |
| 1030 | } | 1030 | } |
| 1031 | 1031 | ||
| 1032 | static inline bool inetdev_valid_mtu(unsigned mtu) | ||
| 1033 | { | ||
| 1034 | return mtu >= 68; | ||
| 1035 | } | ||
| 1036 | |||
| 1032 | /* Called only under RTNL semaphore */ | 1037 | /* Called only under RTNL semaphore */ |
| 1033 | 1038 | ||
| 1034 | static int inetdev_event(struct notifier_block *this, unsigned long event, | 1039 | static int inetdev_event(struct notifier_block *this, unsigned long event, |
| @@ -1048,6 +1053,10 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, | |||
| 1048 | IN_DEV_CONF_SET(in_dev, NOXFRM, 1); | 1053 | IN_DEV_CONF_SET(in_dev, NOXFRM, 1); |
| 1049 | IN_DEV_CONF_SET(in_dev, NOPOLICY, 1); | 1054 | IN_DEV_CONF_SET(in_dev, NOPOLICY, 1); |
| 1050 | } | 1055 | } |
| 1056 | } else if (event == NETDEV_CHANGEMTU) { | ||
| 1057 | /* Re-enabling IP */ | ||
| 1058 | if (inetdev_valid_mtu(dev->mtu)) | ||
| 1059 | in_dev = inetdev_init(dev); | ||
| 1051 | } | 1060 | } |
| 1052 | goto out; | 1061 | goto out; |
| 1053 | } | 1062 | } |
| @@ -1058,7 +1067,7 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, | |||
| 1058 | dev->ip_ptr = NULL; | 1067 | dev->ip_ptr = NULL; |
| 1059 | break; | 1068 | break; |
| 1060 | case NETDEV_UP: | 1069 | case NETDEV_UP: |
| 1061 | if (dev->mtu < 68) | 1070 | if (!inetdev_valid_mtu(dev->mtu)) |
| 1062 | break; | 1071 | break; |
| 1063 | if (dev->flags & IFF_LOOPBACK) { | 1072 | if (dev->flags & IFF_LOOPBACK) { |
| 1064 | struct in_ifaddr *ifa; | 1073 | struct in_ifaddr *ifa; |
| @@ -1080,9 +1089,9 @@ static int inetdev_event(struct notifier_block *this, unsigned long event, | |||
| 1080 | ip_mc_down(in_dev); | 1089 | ip_mc_down(in_dev); |
| 1081 | break; | 1090 | break; |
| 1082 | case NETDEV_CHANGEMTU: | 1091 | case NETDEV_CHANGEMTU: |
| 1083 | if (dev->mtu >= 68) | 1092 | if (inetdev_valid_mtu(dev->mtu)) |
| 1084 | break; | 1093 | break; |
| 1085 | /* MTU falled under 68, disable IP */ | 1094 | /* disable IP when MTU is not enough */ |
| 1086 | case NETDEV_UNREGISTER: | 1095 | case NETDEV_UNREGISTER: |
| 1087 | inetdev_destroy(in_dev); | 1096 | inetdev_destroy(in_dev); |
| 1088 | break; | 1097 | break; |
diff --git a/net/ipv6/raw.c b/net/ipv6/raw.c index 01d47674f7e5..e53e493606c5 100644 --- a/net/ipv6/raw.c +++ b/net/ipv6/raw.c | |||
| @@ -377,14 +377,14 @@ static inline int rawv6_rcv_skb(struct sock * sk, struct sk_buff * skb) | |||
| 377 | skb_checksum_complete(skb)) { | 377 | skb_checksum_complete(skb)) { |
| 378 | atomic_inc(&sk->sk_drops); | 378 | atomic_inc(&sk->sk_drops); |
| 379 | kfree_skb(skb); | 379 | kfree_skb(skb); |
| 380 | return 0; | 380 | return NET_RX_DROP; |
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | /* Charge it to the socket. */ | 383 | /* Charge it to the socket. */ |
| 384 | if (sock_queue_rcv_skb(sk,skb)<0) { | 384 | if (sock_queue_rcv_skb(sk,skb)<0) { |
| 385 | atomic_inc(&sk->sk_drops); | 385 | atomic_inc(&sk->sk_drops); |
| 386 | kfree_skb(skb); | 386 | kfree_skb(skb); |
| 387 | return 0; | 387 | return NET_RX_DROP; |
| 388 | } | 388 | } |
| 389 | 389 | ||
| 390 | return 0; | 390 | return 0; |
| @@ -429,7 +429,7 @@ int rawv6_rcv(struct sock *sk, struct sk_buff *skb) | |||
| 429 | if (skb_checksum_complete(skb)) { | 429 | if (skb_checksum_complete(skb)) { |
| 430 | atomic_inc(&sk->sk_drops); | 430 | atomic_inc(&sk->sk_drops); |
| 431 | kfree_skb(skb); | 431 | kfree_skb(skb); |
| 432 | return 0; | 432 | return NET_RX_DROP; |
| 433 | } | 433 | } |
| 434 | } | 434 | } |
| 435 | 435 | ||
diff --git a/net/mac80211/debugfs_key.c b/net/mac80211/debugfs_key.c index 7439b63df5d0..cf82acec913a 100644 --- a/net/mac80211/debugfs_key.c +++ b/net/mac80211/debugfs_key.c | |||
| @@ -265,7 +265,7 @@ void ieee80211_debugfs_key_add_default(struct ieee80211_sub_if_data *sdata) | |||
| 265 | key = sdata->default_key; | 265 | key = sdata->default_key; |
| 266 | if (key) { | 266 | if (key) { |
| 267 | sprintf(buf, "../keys/%d", key->debugfs.cnt); | 267 | sprintf(buf, "../keys/%d", key->debugfs.cnt); |
| 268 | sdata->debugfs.default_key = | 268 | sdata->common_debugfs.default_key = |
| 269 | debugfs_create_symlink("default_key", | 269 | debugfs_create_symlink("default_key", |
| 270 | sdata->debugfsdir, buf); | 270 | sdata->debugfsdir, buf); |
| 271 | } else | 271 | } else |
| @@ -277,8 +277,8 @@ void ieee80211_debugfs_key_remove_default(struct ieee80211_sub_if_data *sdata) | |||
| 277 | if (!sdata) | 277 | if (!sdata) |
| 278 | return; | 278 | return; |
| 279 | 279 | ||
| 280 | debugfs_remove(sdata->debugfs.default_key); | 280 | debugfs_remove(sdata->common_debugfs.default_key); |
| 281 | sdata->debugfs.default_key = NULL; | 281 | sdata->common_debugfs.default_key = NULL; |
| 282 | } | 282 | } |
| 283 | 283 | ||
| 284 | void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, | 284 | void ieee80211_debugfs_key_sta_del(struct ieee80211_key *key, |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 586a9b49b0fc..4498d8713652 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
| @@ -496,8 +496,10 @@ struct ieee80211_sub_if_data { | |||
| 496 | struct { | 496 | struct { |
| 497 | struct dentry *mode; | 497 | struct dentry *mode; |
| 498 | } monitor; | 498 | } monitor; |
| 499 | struct dentry *default_key; | ||
| 500 | } debugfs; | 499 | } debugfs; |
| 500 | struct { | ||
| 501 | struct dentry *default_key; | ||
| 502 | } common_debugfs; | ||
| 501 | 503 | ||
| 502 | #ifdef CONFIG_MAC80211_MESH | 504 | #ifdef CONFIG_MAC80211_MESH |
| 503 | struct dentry *mesh_stats_dir; | 505 | struct dentry *mesh_stats_dir; |
diff --git a/net/sched/cls_api.c b/net/sched/cls_api.c index 5cafdd4c8018..8eb79e92e94c 100644 --- a/net/sched/cls_api.c +++ b/net/sched/cls_api.c | |||
| @@ -205,7 +205,7 @@ replay: | |||
| 205 | } | 205 | } |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | root_lock = qdisc_root_lock(q); | 208 | root_lock = qdisc_root_sleeping_lock(q); |
| 209 | 209 | ||
| 210 | if (tp == NULL) { | 210 | if (tp == NULL) { |
| 211 | /* Proto-tcf does not exist, create new one */ | 211 | /* Proto-tcf does not exist, create new one */ |
diff --git a/net/sched/cls_route.c b/net/sched/cls_route.c index 481260a4f10f..e3d8455eebc2 100644 --- a/net/sched/cls_route.c +++ b/net/sched/cls_route.c | |||
| @@ -75,7 +75,7 @@ static __inline__ int route4_fastmap_hash(u32 id, int iif) | |||
| 75 | static inline | 75 | static inline |
| 76 | void route4_reset_fastmap(struct Qdisc *q, struct route4_head *head, u32 id) | 76 | void route4_reset_fastmap(struct Qdisc *q, struct route4_head *head, u32 id) |
| 77 | { | 77 | { |
| 78 | spinlock_t *root_lock = qdisc_root_lock(q); | 78 | spinlock_t *root_lock = qdisc_root_sleeping_lock(q); |
| 79 | 79 | ||
| 80 | spin_lock_bh(root_lock); | 80 | spin_lock_bh(root_lock); |
| 81 | memset(head->fastmap, 0, sizeof(head->fastmap)); | 81 | memset(head->fastmap, 0, sizeof(head->fastmap)); |
diff --git a/net/sched/sch_api.c b/net/sched/sch_api.c index 506b709510b6..1122c952aa99 100644 --- a/net/sched/sch_api.c +++ b/net/sched/sch_api.c | |||
| @@ -1169,8 +1169,8 @@ static int tc_fill_qdisc(struct sk_buff *skb, struct Qdisc *q, u32 clid, | |||
| 1169 | if (q->stab && qdisc_dump_stab(skb, q->stab) < 0) | 1169 | if (q->stab && qdisc_dump_stab(skb, q->stab) < 0) |
| 1170 | goto nla_put_failure; | 1170 | goto nla_put_failure; |
| 1171 | 1171 | ||
| 1172 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, | 1172 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, TCA_XSTATS, |
| 1173 | TCA_XSTATS, qdisc_root_lock(q), &d) < 0) | 1173 | qdisc_root_sleeping_lock(q), &d) < 0) |
| 1174 | goto nla_put_failure; | 1174 | goto nla_put_failure; |
| 1175 | 1175 | ||
| 1176 | if (q->ops->dump_stats && q->ops->dump_stats(q, &d) < 0) | 1176 | if (q->ops->dump_stats && q->ops->dump_stats(q, &d) < 0) |
| @@ -1461,8 +1461,8 @@ static int tc_fill_tclass(struct sk_buff *skb, struct Qdisc *q, | |||
| 1461 | if (cl_ops->dump && cl_ops->dump(q, cl, skb, tcm) < 0) | 1461 | if (cl_ops->dump && cl_ops->dump(q, cl, skb, tcm) < 0) |
| 1462 | goto nla_put_failure; | 1462 | goto nla_put_failure; |
| 1463 | 1463 | ||
| 1464 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, | 1464 | if (gnet_stats_start_copy_compat(skb, TCA_STATS2, TCA_STATS, TCA_XSTATS, |
| 1465 | TCA_XSTATS, qdisc_root_lock(q), &d) < 0) | 1465 | qdisc_root_sleeping_lock(q), &d) < 0) |
| 1466 | goto nla_put_failure; | 1466 | goto nla_put_failure; |
| 1467 | 1467 | ||
| 1468 | if (cl_ops->dump_stats && cl_ops->dump_stats(q, cl, &d) < 0) | 1468 | if (cl_ops->dump_stats && cl_ops->dump_stats(q, cl, &d) < 0) |
diff --git a/net/sched/sch_cbq.c b/net/sched/sch_cbq.c index 9b720adedead..8b06fa900482 100644 --- a/net/sched/sch_cbq.c +++ b/net/sched/sch_cbq.c | |||
| @@ -1754,7 +1754,7 @@ static void cbq_put(struct Qdisc *sch, unsigned long arg) | |||
| 1754 | 1754 | ||
| 1755 | if (--cl->refcnt == 0) { | 1755 | if (--cl->refcnt == 0) { |
| 1756 | #ifdef CONFIG_NET_CLS_ACT | 1756 | #ifdef CONFIG_NET_CLS_ACT |
| 1757 | spinlock_t *root_lock = qdisc_root_lock(sch); | 1757 | spinlock_t *root_lock = qdisc_root_sleeping_lock(sch); |
| 1758 | struct cbq_sched_data *q = qdisc_priv(sch); | 1758 | struct cbq_sched_data *q = qdisc_priv(sch); |
| 1759 | 1759 | ||
| 1760 | spin_lock_bh(root_lock); | 1760 | spin_lock_bh(root_lock); |
diff --git a/net/sched/sch_htb.c b/net/sched/sch_htb.c index 97d4761cc31e..d14f02056ae6 100644 --- a/net/sched/sch_htb.c +++ b/net/sched/sch_htb.c | |||
| @@ -1043,7 +1043,7 @@ static int htb_init(struct Qdisc *sch, struct nlattr *opt) | |||
| 1043 | 1043 | ||
| 1044 | static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) | 1044 | static int htb_dump(struct Qdisc *sch, struct sk_buff *skb) |
| 1045 | { | 1045 | { |
| 1046 | spinlock_t *root_lock = qdisc_root_lock(sch); | 1046 | spinlock_t *root_lock = qdisc_root_sleeping_lock(sch); |
| 1047 | struct htb_sched *q = qdisc_priv(sch); | 1047 | struct htb_sched *q = qdisc_priv(sch); |
| 1048 | struct nlattr *nest; | 1048 | struct nlattr *nest; |
| 1049 | struct tc_htb_glob gopt; | 1049 | struct tc_htb_glob gopt; |
| @@ -1075,7 +1075,7 @@ static int htb_dump_class(struct Qdisc *sch, unsigned long arg, | |||
| 1075 | struct sk_buff *skb, struct tcmsg *tcm) | 1075 | struct sk_buff *skb, struct tcmsg *tcm) |
| 1076 | { | 1076 | { |
| 1077 | struct htb_class *cl = (struct htb_class *)arg; | 1077 | struct htb_class *cl = (struct htb_class *)arg; |
| 1078 | spinlock_t *root_lock = qdisc_root_lock(sch); | 1078 | spinlock_t *root_lock = qdisc_root_sleeping_lock(sch); |
| 1079 | struct nlattr *nest; | 1079 | struct nlattr *nest; |
| 1080 | struct tc_htb_opt opt; | 1080 | struct tc_htb_opt opt; |
| 1081 | 1081 | ||
diff --git a/net/sched/sch_netem.c b/net/sched/sch_netem.c index fb0294d0b55e..3781e55046d0 100644 --- a/net/sched/sch_netem.c +++ b/net/sched/sch_netem.c | |||
| @@ -341,7 +341,7 @@ static int get_dist_table(struct Qdisc *sch, const struct nlattr *attr) | |||
| 341 | for (i = 0; i < n; i++) | 341 | for (i = 0; i < n; i++) |
| 342 | d->table[i] = data[i]; | 342 | d->table[i] = data[i]; |
| 343 | 343 | ||
| 344 | root_lock = qdisc_root_lock(sch); | 344 | root_lock = qdisc_root_sleeping_lock(sch); |
| 345 | 345 | ||
| 346 | spin_lock_bh(root_lock); | 346 | spin_lock_bh(root_lock); |
| 347 | d = xchg(&q->delay_dist, d); | 347 | d = xchg(&q->delay_dist, d); |
diff --git a/net/sched/sch_teql.c b/net/sched/sch_teql.c index 2c35c678563b..d35ef059abb1 100644 --- a/net/sched/sch_teql.c +++ b/net/sched/sch_teql.c | |||
| @@ -161,7 +161,7 @@ teql_destroy(struct Qdisc* sch) | |||
| 161 | txq = netdev_get_tx_queue(master->dev, 0); | 161 | txq = netdev_get_tx_queue(master->dev, 0); |
| 162 | master->slaves = NULL; | 162 | master->slaves = NULL; |
| 163 | 163 | ||
| 164 | root_lock = qdisc_root_lock(txq->qdisc); | 164 | root_lock = qdisc_root_sleeping_lock(txq->qdisc); |
| 165 | spin_lock_bh(root_lock); | 165 | spin_lock_bh(root_lock); |
| 166 | qdisc_reset(txq->qdisc); | 166 | qdisc_reset(txq->qdisc); |
| 167 | spin_unlock_bh(root_lock); | 167 | spin_unlock_bh(root_lock); |
diff --git a/net/wireless/Kconfig b/net/wireless/Kconfig index ab015c62d561..833b024f8f66 100644 --- a/net/wireless/Kconfig +++ b/net/wireless/Kconfig | |||
| @@ -39,4 +39,5 @@ config WIRELESS_EXT_SYSFS | |||
| 39 | files in /sys/class/net/*/wireless/. The same information | 39 | files in /sys/class/net/*/wireless/. The same information |
| 40 | is available via the ioctls as well. | 40 | is available via the ioctls as well. |
| 41 | 41 | ||
| 42 | Say Y if you have programs using it (we don't know of any). | 42 | Say Y if you have programs using it, like old versions of |
| 43 | hal. | ||
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c index 841b32a2e680..46914b79d850 100644 --- a/net/xfrm/xfrm_policy.c +++ b/net/xfrm/xfrm_policy.c | |||
| @@ -1731,8 +1731,7 @@ restart: | |||
| 1731 | * We can't enlist stable bundles either. | 1731 | * We can't enlist stable bundles either. |
| 1732 | */ | 1732 | */ |
| 1733 | write_unlock_bh(&policy->lock); | 1733 | write_unlock_bh(&policy->lock); |
| 1734 | if (dst) | 1734 | dst_free(dst); |
| 1735 | dst_free(dst); | ||
| 1736 | 1735 | ||
| 1737 | if (pol_dead) | 1736 | if (pol_dead) |
| 1738 | XFRM_INC_STATS(LINUX_MIB_XFRMOUTPOLDEAD); | 1737 | XFRM_INC_STATS(LINUX_MIB_XFRMOUTPOLDEAD); |
| @@ -1748,8 +1747,7 @@ restart: | |||
| 1748 | err = xfrm_dst_update_origin(dst, fl); | 1747 | err = xfrm_dst_update_origin(dst, fl); |
| 1749 | if (unlikely(err)) { | 1748 | if (unlikely(err)) { |
| 1750 | write_unlock_bh(&policy->lock); | 1749 | write_unlock_bh(&policy->lock); |
| 1751 | if (dst) | 1750 | dst_free(dst); |
| 1752 | dst_free(dst); | ||
| 1753 | XFRM_INC_STATS(LINUX_MIB_XFRMOUTBUNDLECHECKERROR); | 1751 | XFRM_INC_STATS(LINUX_MIB_XFRMOUTBUNDLECHECKERROR); |
| 1754 | goto error; | 1752 | goto error; |
| 1755 | } | 1753 | } |
diff --git a/net/xfrm/xfrm_state.c b/net/xfrm/xfrm_state.c index 4c6914ef7d92..7bd62f61593f 100644 --- a/net/xfrm/xfrm_state.c +++ b/net/xfrm/xfrm_state.c | |||
| @@ -780,11 +780,13 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
| 780 | { | 780 | { |
| 781 | unsigned int h; | 781 | unsigned int h; |
| 782 | struct hlist_node *entry; | 782 | struct hlist_node *entry; |
| 783 | struct xfrm_state *x, *x0; | 783 | struct xfrm_state *x, *x0, *to_put; |
| 784 | int acquire_in_progress = 0; | 784 | int acquire_in_progress = 0; |
| 785 | int error = 0; | 785 | int error = 0; |
| 786 | struct xfrm_state *best = NULL; | 786 | struct xfrm_state *best = NULL; |
| 787 | 787 | ||
| 788 | to_put = NULL; | ||
| 789 | |||
| 788 | spin_lock_bh(&xfrm_state_lock); | 790 | spin_lock_bh(&xfrm_state_lock); |
| 789 | h = xfrm_dst_hash(daddr, saddr, tmpl->reqid, family); | 791 | h = xfrm_dst_hash(daddr, saddr, tmpl->reqid, family); |
| 790 | hlist_for_each_entry(x, entry, xfrm_state_bydst+h, bydst) { | 792 | hlist_for_each_entry(x, entry, xfrm_state_bydst+h, bydst) { |
| @@ -833,7 +835,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
| 833 | if (tmpl->id.spi && | 835 | if (tmpl->id.spi && |
| 834 | (x0 = __xfrm_state_lookup(daddr, tmpl->id.spi, | 836 | (x0 = __xfrm_state_lookup(daddr, tmpl->id.spi, |
| 835 | tmpl->id.proto, family)) != NULL) { | 837 | tmpl->id.proto, family)) != NULL) { |
| 836 | xfrm_state_put(x0); | 838 | to_put = x0; |
| 837 | error = -EEXIST; | 839 | error = -EEXIST; |
| 838 | goto out; | 840 | goto out; |
| 839 | } | 841 | } |
| @@ -849,7 +851,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
| 849 | error = security_xfrm_state_alloc_acquire(x, pol->security, fl->secid); | 851 | error = security_xfrm_state_alloc_acquire(x, pol->security, fl->secid); |
| 850 | if (error) { | 852 | if (error) { |
| 851 | x->km.state = XFRM_STATE_DEAD; | 853 | x->km.state = XFRM_STATE_DEAD; |
| 852 | xfrm_state_put(x); | 854 | to_put = x; |
| 853 | x = NULL; | 855 | x = NULL; |
| 854 | goto out; | 856 | goto out; |
| 855 | } | 857 | } |
| @@ -870,7 +872,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr, | |||
| 870 | xfrm_hash_grow_check(x->bydst.next != NULL); | 872 | xfrm_hash_grow_check(x->bydst.next != NULL); |
| 871 | } else { | 873 | } else { |
| 872 | x->km.state = XFRM_STATE_DEAD; | 874 | x->km.state = XFRM_STATE_DEAD; |
| 873 | xfrm_state_put(x); | 875 | to_put = x; |
| 874 | x = NULL; | 876 | x = NULL; |
| 875 | error = -ESRCH; | 877 | error = -ESRCH; |
| 876 | } | 878 | } |
| @@ -881,6 +883,8 @@ out: | |||
| 881 | else | 883 | else |
| 882 | *err = acquire_in_progress ? -EAGAIN : error; | 884 | *err = acquire_in_progress ? -EAGAIN : error; |
| 883 | spin_unlock_bh(&xfrm_state_lock); | 885 | spin_unlock_bh(&xfrm_state_lock); |
| 886 | if (to_put) | ||
| 887 | xfrm_state_put(to_put); | ||
| 884 | return x; | 888 | return x; |
| 885 | } | 889 | } |
| 886 | 890 | ||
| @@ -1067,18 +1071,20 @@ static struct xfrm_state *__xfrm_find_acq_byseq(u32 seq); | |||
| 1067 | 1071 | ||
| 1068 | int xfrm_state_add(struct xfrm_state *x) | 1072 | int xfrm_state_add(struct xfrm_state *x) |
| 1069 | { | 1073 | { |
| 1070 | struct xfrm_state *x1; | 1074 | struct xfrm_state *x1, *to_put; |
| 1071 | int family; | 1075 | int family; |
| 1072 | int err; | 1076 | int err; |
| 1073 | int use_spi = xfrm_id_proto_match(x->id.proto, IPSEC_PROTO_ANY); | 1077 | int use_spi = xfrm_id_proto_match(x->id.proto, IPSEC_PROTO_ANY); |
| 1074 | 1078 | ||
| 1075 | family = x->props.family; | 1079 | family = x->props.family; |
| 1076 | 1080 | ||
| 1081 | to_put = NULL; | ||
| 1082 | |||
| 1077 | spin_lock_bh(&xfrm_state_lock); | 1083 | spin_lock_bh(&xfrm_state_lock); |
| 1078 | 1084 | ||
| 1079 | x1 = __xfrm_state_locate(x, use_spi, family); | 1085 | x1 = __xfrm_state_locate(x, use_spi, family); |
| 1080 | if (x1) { | 1086 | if (x1) { |
| 1081 | xfrm_state_put(x1); | 1087 | to_put = x1; |
| 1082 | x1 = NULL; | 1088 | x1 = NULL; |
| 1083 | err = -EEXIST; | 1089 | err = -EEXIST; |
| 1084 | goto out; | 1090 | goto out; |
| @@ -1088,7 +1094,7 @@ int xfrm_state_add(struct xfrm_state *x) | |||
| 1088 | x1 = __xfrm_find_acq_byseq(x->km.seq); | 1094 | x1 = __xfrm_find_acq_byseq(x->km.seq); |
| 1089 | if (x1 && ((x1->id.proto != x->id.proto) || | 1095 | if (x1 && ((x1->id.proto != x->id.proto) || |
| 1090 | xfrm_addr_cmp(&x1->id.daddr, &x->id.daddr, family))) { | 1096 | xfrm_addr_cmp(&x1->id.daddr, &x->id.daddr, family))) { |
| 1091 | xfrm_state_put(x1); | 1097 | to_put = x1; |
| 1092 | x1 = NULL; | 1098 | x1 = NULL; |
| 1093 | } | 1099 | } |
| 1094 | } | 1100 | } |
| @@ -1110,6 +1116,9 @@ out: | |||
| 1110 | xfrm_state_put(x1); | 1116 | xfrm_state_put(x1); |
| 1111 | } | 1117 | } |
| 1112 | 1118 | ||
| 1119 | if (to_put) | ||
| 1120 | xfrm_state_put(to_put); | ||
| 1121 | |||
| 1113 | return err; | 1122 | return err; |
| 1114 | } | 1123 | } |
| 1115 | EXPORT_SYMBOL(xfrm_state_add); | 1124 | EXPORT_SYMBOL(xfrm_state_add); |
| @@ -1269,10 +1278,12 @@ EXPORT_SYMBOL(xfrm_state_migrate); | |||
| 1269 | 1278 | ||
| 1270 | int xfrm_state_update(struct xfrm_state *x) | 1279 | int xfrm_state_update(struct xfrm_state *x) |
| 1271 | { | 1280 | { |
| 1272 | struct xfrm_state *x1; | 1281 | struct xfrm_state *x1, *to_put; |
| 1273 | int err; | 1282 | int err; |
| 1274 | int use_spi = xfrm_id_proto_match(x->id.proto, IPSEC_PROTO_ANY); | 1283 | int use_spi = xfrm_id_proto_match(x->id.proto, IPSEC_PROTO_ANY); |
| 1275 | 1284 | ||
| 1285 | to_put = NULL; | ||
| 1286 | |||
| 1276 | spin_lock_bh(&xfrm_state_lock); | 1287 | spin_lock_bh(&xfrm_state_lock); |
| 1277 | x1 = __xfrm_state_locate(x, use_spi, x->props.family); | 1288 | x1 = __xfrm_state_locate(x, use_spi, x->props.family); |
| 1278 | 1289 | ||
| @@ -1281,7 +1292,7 @@ int xfrm_state_update(struct xfrm_state *x) | |||
| 1281 | goto out; | 1292 | goto out; |
| 1282 | 1293 | ||
| 1283 | if (xfrm_state_kern(x1)) { | 1294 | if (xfrm_state_kern(x1)) { |
| 1284 | xfrm_state_put(x1); | 1295 | to_put = x1; |
| 1285 | err = -EEXIST; | 1296 | err = -EEXIST; |
| 1286 | goto out; | 1297 | goto out; |
| 1287 | } | 1298 | } |
| @@ -1295,6 +1306,9 @@ int xfrm_state_update(struct xfrm_state *x) | |||
| 1295 | out: | 1306 | out: |
| 1296 | spin_unlock_bh(&xfrm_state_lock); | 1307 | spin_unlock_bh(&xfrm_state_lock); |
| 1297 | 1308 | ||
| 1309 | if (to_put) | ||
| 1310 | xfrm_state_put(to_put); | ||
| 1311 | |||
| 1298 | if (err) | 1312 | if (err) |
| 1299 | return err; | 1313 | return err; |
| 1300 | 1314 | ||
