Skip to content

Commit eb5aaed

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networkign fixes from David Miller: "Networking bug fixes, Cacio e Pepe edition: 1) BNX2X accidently accesses chip rev specific registers without an appropriate guard, fix from Ariel Elior. 2) When we removed the routing cache, we set ip_rt_max_size to ~0 just to keep reporting a value to userspace via sysfs. But the ipv4 IPSEC layer was using this to tune itself which is completely bogus to now do. Fix from Steffen Klassert. 3) Missing initialization in netfilter ipset code from Jozsef Kadlecsik. 4) Check CTA_TIMEOUT_NAME length properly in netfilter cttimeout code, fix from Florian Westphal. 5) After removing the routing cache, we inadvertantly are caching multicast routes that end up looping back locally, we cannot do that legitimately any more. Fix from Julian Anastasov. 6) Revert a race fix for 8139cp qemu/kvm that doesn't actually work properly on real hardware. From Francois Romieu. 7) Fixup errors in example command lines in VXLAN device docs." * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: bnx2x: remove redundant warning log vxlan: fix command usage in its doc 8139cp: revert "set ring address before enabling receiver" ipv4: do not cache looped multicasts netfilter: cttimeout: fix buffer overflow netfilter: ipset: Fix range bug in hash:ip,port,net xfrm: Fix the gc threshold value for ipv4
2 parents f3a443a + 4a25417 commit eb5aaed

File tree

11 files changed

+43
-46
lines changed

11 files changed

+43
-46
lines changed

Documentation/networking/vxlan.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ no entry is in the forwarding table.
3232
# ip link delete vxlan0
3333

3434
3. Show vxlan info
35-
# ip -d show vxlan0
35+
# ip -d link show vxlan0
3636

3737
It is possible to create, destroy and display the vxlan
3838
forwarding table using the new bridge command.
@@ -41,7 +41,7 @@ forwarding table using the new bridge command.
4141
# bridge fdb add to 00:17:42:8a:b4:05 dst 192.19.0.2 dev vxlan0
4242

4343
2. Delete forwarding table entry
44-
# bridge fdb delete 00:17:42:8a:b4:05
44+
# bridge fdb delete 00:17:42:8a:b4:05 dev vxlan0
4545

4646
3. Show forwarding table
4747
# bridge fdb show dev vxlan0

drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9545,10 +9545,13 @@ static int __devinit bnx2x_prev_unload_common(struct bnx2x *bp)
95459545
*/
95469546
static void __devinit bnx2x_prev_interrupted_dmae(struct bnx2x *bp)
95479547
{
9548-
u32 val = REG_RD(bp, PGLUE_B_REG_PGLUE_B_INT_STS);
9549-
if (val & PGLUE_B_PGLUE_B_INT_STS_REG_WAS_ERROR_ATTN) {
9550-
BNX2X_ERR("was error bit was found to be set in pglueb upon startup. Clearing");
9551-
REG_WR(bp, PGLUE_B_REG_WAS_ERROR_PF_7_0_CLR, 1 << BP_FUNC(bp));
9548+
if (!CHIP_IS_E1x(bp)) {
9549+
u32 val = REG_RD(bp, PGLUE_B_REG_PGLUE_B_INT_STS);
9550+
if (val & PGLUE_B_PGLUE_B_INT_STS_REG_WAS_ERROR_ATTN) {
9551+
BNX2X_ERR("was error bit was found to be set in pglueb upon startup. Clearing");
9552+
REG_WR(bp, PGLUE_B_REG_WAS_ERROR_PF_7_0_CLR,
9553+
1 << BP_FUNC(bp));
9554+
}
95529555
}
95539556
}
95549557

drivers/net/ethernet/realtek/8139cp.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -979,17 +979,6 @@ static void cp_init_hw (struct cp_private *cp)
979979
cpw32_f (MAC0 + 0, le32_to_cpu (*(__le32 *) (dev->dev_addr + 0)));
980980
cpw32_f (MAC0 + 4, le32_to_cpu (*(__le32 *) (dev->dev_addr + 4)));
981981

982-
cpw32_f(HiTxRingAddr, 0);
983-
cpw32_f(HiTxRingAddr + 4, 0);
984-
985-
ring_dma = cp->ring_dma;
986-
cpw32_f(RxRingAddr, ring_dma & 0xffffffff);
987-
cpw32_f(RxRingAddr + 4, (ring_dma >> 16) >> 16);
988-
989-
ring_dma += sizeof(struct cp_desc) * CP_RX_RING_SIZE;
990-
cpw32_f(TxRingAddr, ring_dma & 0xffffffff);
991-
cpw32_f(TxRingAddr + 4, (ring_dma >> 16) >> 16);
992-
993982
cp_start_hw(cp);
994983
cpw8(TxThresh, 0x06); /* XXX convert magic num to a constant */
995984

@@ -1003,6 +992,17 @@ static void cp_init_hw (struct cp_private *cp)
1003992

1004993
cpw8(Config5, cpr8(Config5) & PMEStatus);
1005994

995+
cpw32_f(HiTxRingAddr, 0);
996+
cpw32_f(HiTxRingAddr + 4, 0);
997+
998+
ring_dma = cp->ring_dma;
999+
cpw32_f(RxRingAddr, ring_dma & 0xffffffff);
1000+
cpw32_f(RxRingAddr + 4, (ring_dma >> 16) >> 16);
1001+
1002+
ring_dma += sizeof(struct cp_desc) * CP_RX_RING_SIZE;
1003+
cpw32_f(TxRingAddr, ring_dma & 0xffffffff);
1004+
cpw32_f(TxRingAddr + 4, (ring_dma >> 16) >> 16);
1005+
10061006
cpw16(MultiIntr, 0);
10071007

10081008
cpw8_f(Cfg9346, Cfg9346_Lock);

include/net/xfrm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1351,7 +1351,7 @@ struct xfrm6_tunnel {
13511351
};
13521352

13531353
extern void xfrm_init(void);
1354-
extern void xfrm4_init(int rt_hash_size);
1354+
extern void xfrm4_init(void);
13551355
extern int xfrm_state_init(struct net *net);
13561356
extern void xfrm_state_fini(struct net *net);
13571357
extern void xfrm4_state_init(void);

net/ipv4/route.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1785,6 +1785,7 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
17851785
if (dev_out->flags & IFF_LOOPBACK)
17861786
flags |= RTCF_LOCAL;
17871787

1788+
do_cache = true;
17881789
if (type == RTN_BROADCAST) {
17891790
flags |= RTCF_BROADCAST | RTCF_LOCAL;
17901791
fi = NULL;
@@ -1793,6 +1794,8 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
17931794
if (!ip_check_mc_rcu(in_dev, fl4->daddr, fl4->saddr,
17941795
fl4->flowi4_proto))
17951796
flags &= ~RTCF_LOCAL;
1797+
else
1798+
do_cache = false;
17961799
/* If multicast route do not exist use
17971800
* default one, but do not gateway in this case.
17981801
* Yes, it is hack.
@@ -1802,8 +1805,8 @@ static struct rtable *__mkroute_output(const struct fib_result *res,
18021805
}
18031806

18041807
fnhe = NULL;
1805-
do_cache = fi != NULL;
1806-
if (fi) {
1808+
do_cache &= fi != NULL;
1809+
if (do_cache) {
18071810
struct rtable __rcu **prth;
18081811
struct fib_nh *nh = &FIB_RES_NH(*res);
18091812

@@ -2597,7 +2600,7 @@ int __init ip_rt_init(void)
25972600
pr_err("Unable to create route proc files\n");
25982601
#ifdef CONFIG_XFRM
25992602
xfrm_init();
2600-
xfrm4_init(ip_rt_max_size);
2603+
xfrm4_init();
26012604
#endif
26022605
rtnl_register(PF_INET, RTM_GETROUTE, inet_rtm_getroute, NULL, NULL);
26032606

net/ipv4/xfrm4_policy.c

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -279,19 +279,8 @@ static void __exit xfrm4_policy_fini(void)
279279
xfrm_policy_unregister_afinfo(&xfrm4_policy_afinfo);
280280
}
281281

282-
void __init xfrm4_init(int rt_max_size)
282+
void __init xfrm4_init(void)
283283
{
284-
/*
285-
* Select a default value for the gc_thresh based on the main route
286-
* table hash size. It seems to me the worst case scenario is when
287-
* we have ipsec operating in transport mode, in which we create a
288-
* dst_entry per socket. The xfrm gc algorithm starts trying to remove
289-
* entries at gc_thresh, and prevents new allocations as 2*gc_thresh
290-
* so lets set an initial xfrm gc_thresh value at the rt_max_size/2.
291-
* That will let us store an ipsec connection per route table entry,
292-
* and start cleaning when were 1/2 full
293-
*/
294-
xfrm4_dst_ops.gc_thresh = rt_max_size/2;
295284
dst_entries_init(&xfrm4_dst_ops);
296285

297286
xfrm4_state_init();

net/netfilter/ipset/ip_set_hash_ip.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[],
173173
return adtfn(set, &nip, timeout, flags);
174174
}
175175

176+
ip_to = ip;
176177
if (tb[IPSET_ATTR_IP_TO]) {
177178
ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to);
178179
if (ret)
@@ -185,8 +186,7 @@ hash_ip4_uadt(struct ip_set *set, struct nlattr *tb[],
185186
if (!cidr || cidr > 32)
186187
return -IPSET_ERR_INVALID_CIDR;
187188
ip_set_mask_from_to(ip, ip_to, cidr);
188-
} else
189-
ip_to = ip;
189+
}
190190

191191
hosts = h->netmask == 32 ? 1 : 2 << (32 - h->netmask - 1);
192192

net/netfilter/ipset/ip_set_hash_ipport.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[],
162162
const struct ip_set_hash *h = set->data;
163163
ipset_adtfn adtfn = set->variant->adt[adt];
164164
struct hash_ipport4_elem data = { };
165-
u32 ip, ip_to = 0, p = 0, port, port_to;
165+
u32 ip, ip_to, p = 0, port, port_to;
166166
u32 timeout = h->timeout;
167167
bool with_ports = false;
168168
int ret;
@@ -210,7 +210,7 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[],
210210
return ip_set_eexist(ret, flags) ? 0 : ret;
211211
}
212212

213-
ip = ntohl(data.ip);
213+
ip_to = ip = ntohl(data.ip);
214214
if (tb[IPSET_ATTR_IP_TO]) {
215215
ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to);
216216
if (ret)
@@ -223,8 +223,7 @@ hash_ipport4_uadt(struct ip_set *set, struct nlattr *tb[],
223223
if (!cidr || cidr > 32)
224224
return -IPSET_ERR_INVALID_CIDR;
225225
ip_set_mask_from_to(ip, ip_to, cidr);
226-
} else
227-
ip_to = ip;
226+
}
228227

229228
port_to = port = ntohs(data.port);
230229
if (with_ports && tb[IPSET_ATTR_PORT_TO]) {

net/netfilter/ipset/ip_set_hash_ipportip.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[],
166166
const struct ip_set_hash *h = set->data;
167167
ipset_adtfn adtfn = set->variant->adt[adt];
168168
struct hash_ipportip4_elem data = { };
169-
u32 ip, ip_to = 0, p = 0, port, port_to;
169+
u32 ip, ip_to, p = 0, port, port_to;
170170
u32 timeout = h->timeout;
171171
bool with_ports = false;
172172
int ret;
@@ -218,7 +218,7 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[],
218218
return ip_set_eexist(ret, flags) ? 0 : ret;
219219
}
220220

221-
ip = ntohl(data.ip);
221+
ip_to = ip = ntohl(data.ip);
222222
if (tb[IPSET_ATTR_IP_TO]) {
223223
ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to);
224224
if (ret)
@@ -231,8 +231,7 @@ hash_ipportip4_uadt(struct ip_set *set, struct nlattr *tb[],
231231
if (!cidr || cidr > 32)
232232
return -IPSET_ERR_INVALID_CIDR;
233233
ip_set_mask_from_to(ip, ip_to, cidr);
234-
} else
235-
ip_to = ip;
234+
}
236235

237236
port_to = port = ntohs(data.port);
238237
if (with_ports && tb[IPSET_ATTR_PORT_TO]) {

net/netfilter/ipset/ip_set_hash_ipportnet.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,8 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
215215
const struct ip_set_hash *h = set->data;
216216
ipset_adtfn adtfn = set->variant->adt[adt];
217217
struct hash_ipportnet4_elem data = { .cidr = HOST_MASK - 1 };
218-
u32 ip, ip_to = 0, p = 0, port, port_to;
219-
u32 ip2_from = 0, ip2_to, ip2_last, ip2;
218+
u32 ip, ip_to, p = 0, port, port_to;
219+
u32 ip2_from, ip2_to, ip2_last, ip2;
220220
u32 timeout = h->timeout;
221221
bool with_ports = false;
222222
u8 cidr;
@@ -286,6 +286,7 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
286286
return ip_set_eexist(ret, flags) ? 0 : ret;
287287
}
288288

289+
ip_to = ip;
289290
if (tb[IPSET_ATTR_IP_TO]) {
290291
ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP_TO], &ip_to);
291292
if (ret)
@@ -306,6 +307,8 @@ hash_ipportnet4_uadt(struct ip_set *set, struct nlattr *tb[],
306307
if (port > port_to)
307308
swap(port, port_to);
308309
}
310+
311+
ip2_to = ip2_from;
309312
if (tb[IPSET_ATTR_IP2_TO]) {
310313
ret = ip_set_get_hostipaddr4(tb[IPSET_ATTR_IP2_TO], &ip2_to);
311314
if (ret)

net/netfilter/nfnetlink_cttimeout.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ MODULE_DESCRIPTION("cttimeout: Extended Netfilter Connection Tracking timeout tu
4141
static LIST_HEAD(cttimeout_list);
4242

4343
static const struct nla_policy cttimeout_nla_policy[CTA_TIMEOUT_MAX+1] = {
44-
[CTA_TIMEOUT_NAME] = { .type = NLA_NUL_STRING },
44+
[CTA_TIMEOUT_NAME] = { .type = NLA_NUL_STRING,
45+
.len = CTNL_TIMEOUT_NAME_MAX - 1},
4546
[CTA_TIMEOUT_L3PROTO] = { .type = NLA_U16 },
4647
[CTA_TIMEOUT_L4PROTO] = { .type = NLA_U8 },
4748
[CTA_TIMEOUT_DATA] = { .type = NLA_NESTED },

0 commit comments

Comments
 (0)