Skip to content

Commit c18bb39

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Pull networking fixes from David Miller: 1) The sockmap code has to free socket memory on close if there is corked data, from John Fastabend. 2) Tunnel names coming from userspace need to be length validated. From Eric Dumazet. 3) arp_filter() has to take VRFs properly into account, from Miguel Fadon Perlines. 4) Fix oops in error path of tcf_bpf_init(), from Davide Caratti. 5) Missing idr_remove() in u32_delete_key(), from Cong Wang. 6) More syzbot stuff. Several use of uninitialized value fixes all over, from Eric Dumazet. 7) Do not leak kernel memory to userspace in sctp, also from Eric Dumazet. 8) Discard frames from unused ports in DSA, from Andrew Lunn. 9) Fix DMA mapping and reset/failover problems in ibmvnic, from Thomas Falcon. 10) Do not access dp83640 PHY registers prematurely after reset, from Esben Haabendal. * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (46 commits) vhost-net: set packet weight of tx polling to 2 * vq size net: thunderx: rework mac addresses list to u64 array inetpeer: fix uninit-value in inet_getpeer dp83640: Ensure against premature access to PHY registers after reset devlink: convert occ_get op to separate registration ARM: dts: ls1021a: Specify TBIPA register address net/fsl_pq_mdio: Allow explicit speficition of TBIPA address ibmvnic: Do not reset CRQ for Mobility driver resets ibmvnic: Fix failover case for non-redundant configuration ibmvnic: Fix reset scheduler error handling ibmvnic: Zero used TX descriptor counter on reset ibmvnic: Fix DMA mapping mistakes tipc: use the right skb in tipc_sk_fill_sock_diag() sctp: sctp_sockaddr_af must check minimal addr length for AF_INET6 net: dsa: Discard frames from unused ports sctp: do not leak kernel memory to user space soreuseport: initialise timewait reuseport field ipv4: fix uninit-value in ip_route_output_key_hash_rcu() dccp: initialize ireq->ir_mark net: fix uninit-value in __hw_addr_add_ex() ...
2 parents fd3b36d + a2ac999 commit c18bb39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+553
-298
lines changed

Documentation/devicetree/bindings/net/fsl-tsec-phy.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ the definition of the PHY node in booting-without-of.txt for an example
66
of how to define a PHY.
77

88
Required properties:
9-
- reg : Offset and length of the register set for the device
9+
- reg : Offset and length of the register set for the device, and optionally
10+
the offset and length of the TBIPA register (TBI PHY address
11+
register). If TBIPA register is not specified, the driver will
12+
attempt to infer it from the register set specified (your mileage may
13+
vary).
1014
- compatible : Should define the compatible device type for the
1115
mdio. Currently supported strings/devices are:
1216
- "fsl,gianfar-tbi"

arch/arm/boot/dts/ls1021a.dtsi

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,8 @@
587587
device_type = "mdio";
588588
#address-cells = <1>;
589589
#size-cells = <0>;
590-
reg = <0x0 0x2d24000 0x0 0x4000>;
590+
reg = <0x0 0x2d24000 0x0 0x4000>,
591+
<0x0 0x2d10030 0x0 0x4>;
591592
};
592593

593594
ptp_clock@2d10e00 {

crypto/af_alg.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,16 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
158158
void *private;
159159
int err;
160160

161-
/* If caller uses non-allowed flag, return error. */
162-
if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed))
163-
return -EINVAL;
164-
165161
if (sock->state == SS_CONNECTED)
166162
return -EINVAL;
167163

168164
if (addr_len < sizeof(*sa))
169165
return -EINVAL;
170166

167+
/* If caller uses non-allowed flag, return error. */
168+
if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed))
169+
return -EINVAL;
170+
171171
sa->salg_type[sizeof(sa->salg_type) - 1] = 0;
172172
sa->salg_name[sizeof(sa->salg_name) + addr_len - sizeof(*sa) - 1] = 0;
173173

drivers/net/ethernet/cavium/thunder/nic.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -265,14 +265,9 @@ struct nicvf_drv_stats {
265265

266266
struct cavium_ptp;
267267

268-
struct xcast_addr {
269-
struct list_head list;
270-
u64 addr;
271-
};
272-
273268
struct xcast_addr_list {
274-
struct list_head list;
275269
int count;
270+
u64 mc[];
276271
};
277272

278273
struct nicvf_work {

drivers/net/ethernet/cavium/thunder/nicvf_main.c

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,7 +1929,7 @@ static void nicvf_set_rx_mode_task(struct work_struct *work_arg)
19291929
work.work);
19301930
struct nicvf *nic = container_of(vf_work, struct nicvf, rx_mode_work);
19311931
union nic_mbx mbx = {};
1932-
struct xcast_addr *xaddr, *next;
1932+
int idx;
19331933

19341934
if (!vf_work)
19351935
return;
@@ -1956,16 +1956,10 @@ static void nicvf_set_rx_mode_task(struct work_struct *work_arg)
19561956
/* check if we have any specific MACs to be added to PF DMAC filter */
19571957
if (vf_work->mc) {
19581958
/* now go through kernel list of MACs and add them one by one */
1959-
list_for_each_entry_safe(xaddr, next,
1960-
&vf_work->mc->list, list) {
1959+
for (idx = 0; idx < vf_work->mc->count; idx++) {
19611960
mbx.xcast.msg = NIC_MBOX_MSG_ADD_MCAST;
1962-
mbx.xcast.data.mac = xaddr->addr;
1961+
mbx.xcast.data.mac = vf_work->mc->mc[idx];
19631962
nicvf_send_msg_to_pf(nic, &mbx);
1964-
1965-
/* after receiving ACK from PF release memory */
1966-
list_del(&xaddr->list);
1967-
kfree(xaddr);
1968-
vf_work->mc->count--;
19691963
}
19701964
kfree(vf_work->mc);
19711965
}
@@ -1996,17 +1990,15 @@ static void nicvf_set_rx_mode(struct net_device *netdev)
19961990
mode |= BGX_XCAST_MCAST_FILTER;
19971991
/* here we need to copy mc addrs */
19981992
if (netdev_mc_count(netdev)) {
1999-
struct xcast_addr *xaddr;
2000-
2001-
mc_list = kmalloc(sizeof(*mc_list), GFP_ATOMIC);
2002-
INIT_LIST_HEAD(&mc_list->list);
1993+
mc_list = kmalloc(offsetof(typeof(*mc_list),
1994+
mc[netdev_mc_count(netdev)]),
1995+
GFP_ATOMIC);
1996+
if (unlikely(!mc_list))
1997+
return;
1998+
mc_list->count = 0;
20031999
netdev_hw_addr_list_for_each(ha, &netdev->mc) {
2004-
xaddr = kmalloc(sizeof(*xaddr),
2005-
GFP_ATOMIC);
2006-
xaddr->addr =
2000+
mc_list->mc[mc_list->count] =
20072001
ether_addr_to_u64(ha->addr);
2008-
list_add_tail(&xaddr->list,
2009-
&mc_list->list);
20102002
mc_list->count++;
20112003
}
20122004
}

drivers/net/ethernet/freescale/fsl_pq_mdio.c

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,38 @@ static const struct of_device_id fsl_pq_mdio_match[] = {
377377
};
378378
MODULE_DEVICE_TABLE(of, fsl_pq_mdio_match);
379379

380+
static void set_tbipa(const u32 tbipa_val, struct platform_device *pdev,
381+
uint32_t __iomem * (*get_tbipa)(void __iomem *),
382+
void __iomem *reg_map, struct resource *reg_res)
383+
{
384+
struct device_node *np = pdev->dev.of_node;
385+
uint32_t __iomem *tbipa;
386+
bool tbipa_mapped;
387+
388+
tbipa = of_iomap(np, 1);
389+
if (tbipa) {
390+
tbipa_mapped = true;
391+
} else {
392+
tbipa_mapped = false;
393+
tbipa = (*get_tbipa)(reg_map);
394+
395+
/*
396+
* Add consistency check to make sure TBI is contained within
397+
* the mapped range (not because we would get a segfault,
398+
* rather to catch bugs in computing TBI address). Print error
399+
* message but continue anyway.
400+
*/
401+
if ((void *)tbipa > reg_map + resource_size(reg_res) - 4)
402+
dev_err(&pdev->dev, "invalid register map (should be at least 0x%04zx to contain TBI address)\n",
403+
((void *)tbipa - reg_map) + 4);
404+
}
405+
406+
iowrite32be(be32_to_cpu(tbipa_val), tbipa);
407+
408+
if (tbipa_mapped)
409+
iounmap(tbipa);
410+
}
411+
380412
static int fsl_pq_mdio_probe(struct platform_device *pdev)
381413
{
382414
const struct of_device_id *id =
@@ -450,29 +482,15 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev)
450482

451483
if (tbi) {
452484
const u32 *prop = of_get_property(tbi, "reg", NULL);
453-
uint32_t __iomem *tbipa;
454-
455485
if (!prop) {
456486
dev_err(&pdev->dev,
457487
"missing 'reg' property in node %pOF\n",
458488
tbi);
459489
err = -EBUSY;
460490
goto error;
461491
}
462-
463-
tbipa = data->get_tbipa(priv->map);
464-
465-
/*
466-
* Add consistency check to make sure TBI is contained
467-
* within the mapped range (not because we would get a
468-
* segfault, rather to catch bugs in computing TBI
469-
* address). Print error message but continue anyway.
470-
*/
471-
if ((void *)tbipa > priv->map + resource_size(&res) - 4)
472-
dev_err(&pdev->dev, "invalid register map (should be at least 0x%04zx to contain TBI address)\n",
473-
((void *)tbipa - priv->map) + 4);
474-
475-
iowrite32be(be32_to_cpup(prop), tbipa);
492+
set_tbipa(*prop, pdev,
493+
data->get_tbipa, priv->map, &res);
476494
}
477495
}
478496

0 commit comments

Comments
 (0)