Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
Browse files Browse the repository at this point in the history
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()
  ...
  • Loading branch information
torvalds committed Apr 10, 2018
2 parents fd3b36d + a2ac999 commit c18bb39
Show file tree
Hide file tree
Showing 53 changed files with 553 additions and 298 deletions.
6 changes: 5 additions & 1 deletion Documentation/devicetree/bindings/net/fsl-tsec-phy.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@ the definition of the PHY node in booting-without-of.txt for an example
of how to define a PHY.

Required properties:
- reg : Offset and length of the register set for the device
- reg : Offset and length of the register set for the device, and optionally
the offset and length of the TBIPA register (TBI PHY address
register). If TBIPA register is not specified, the driver will
attempt to infer it from the register set specified (your mileage may
vary).
- compatible : Should define the compatible device type for the
mdio. Currently supported strings/devices are:
- "fsl,gianfar-tbi"
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/boot/dts/ls1021a.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,8 @@
device_type = "mdio";
#address-cells = <1>;
#size-cells = <0>;
reg = <0x0 0x2d24000 0x0 0x4000>;
reg = <0x0 0x2d24000 0x0 0x4000>,
<0x0 0x2d10030 0x0 0x4>;
};

ptp_clock@2d10e00 {
Expand Down
8 changes: 4 additions & 4 deletions crypto/af_alg.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,16 @@ static int alg_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
void *private;
int err;

/* If caller uses non-allowed flag, return error. */
if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed))
return -EINVAL;

if (sock->state == SS_CONNECTED)
return -EINVAL;

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

/* If caller uses non-allowed flag, return error. */
if ((sa->salg_feat & ~allowed) || (sa->salg_mask & ~allowed))
return -EINVAL;

sa->salg_type[sizeof(sa->salg_type) - 1] = 0;
sa->salg_name[sizeof(sa->salg_name) + addr_len - sizeof(*sa) - 1] = 0;

Expand Down
7 changes: 1 addition & 6 deletions drivers/net/ethernet/cavium/thunder/nic.h
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,9 @@ struct nicvf_drv_stats {

struct cavium_ptp;

struct xcast_addr {
struct list_head list;
u64 addr;
};

struct xcast_addr_list {
struct list_head list;
int count;
u64 mc[];
};

struct nicvf_work {
Expand Down
28 changes: 10 additions & 18 deletions drivers/net/ethernet/cavium/thunder/nicvf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1929,7 +1929,7 @@ static void nicvf_set_rx_mode_task(struct work_struct *work_arg)
work.work);
struct nicvf *nic = container_of(vf_work, struct nicvf, rx_mode_work);
union nic_mbx mbx = {};
struct xcast_addr *xaddr, *next;
int idx;

if (!vf_work)
return;
Expand All @@ -1956,16 +1956,10 @@ static void nicvf_set_rx_mode_task(struct work_struct *work_arg)
/* check if we have any specific MACs to be added to PF DMAC filter */
if (vf_work->mc) {
/* now go through kernel list of MACs and add them one by one */
list_for_each_entry_safe(xaddr, next,
&vf_work->mc->list, list) {
for (idx = 0; idx < vf_work->mc->count; idx++) {
mbx.xcast.msg = NIC_MBOX_MSG_ADD_MCAST;
mbx.xcast.data.mac = xaddr->addr;
mbx.xcast.data.mac = vf_work->mc->mc[idx];
nicvf_send_msg_to_pf(nic, &mbx);

/* after receiving ACK from PF release memory */
list_del(&xaddr->list);
kfree(xaddr);
vf_work->mc->count--;
}
kfree(vf_work->mc);
}
Expand Down Expand Up @@ -1996,17 +1990,15 @@ static void nicvf_set_rx_mode(struct net_device *netdev)
mode |= BGX_XCAST_MCAST_FILTER;
/* here we need to copy mc addrs */
if (netdev_mc_count(netdev)) {
struct xcast_addr *xaddr;

mc_list = kmalloc(sizeof(*mc_list), GFP_ATOMIC);
INIT_LIST_HEAD(&mc_list->list);
mc_list = kmalloc(offsetof(typeof(*mc_list),
mc[netdev_mc_count(netdev)]),
GFP_ATOMIC);
if (unlikely(!mc_list))
return;
mc_list->count = 0;
netdev_hw_addr_list_for_each(ha, &netdev->mc) {
xaddr = kmalloc(sizeof(*xaddr),
GFP_ATOMIC);
xaddr->addr =
mc_list->mc[mc_list->count] =
ether_addr_to_u64(ha->addr);
list_add_tail(&xaddr->list,
&mc_list->list);
mc_list->count++;
}
}
Expand Down
50 changes: 34 additions & 16 deletions drivers/net/ethernet/freescale/fsl_pq_mdio.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,38 @@ static const struct of_device_id fsl_pq_mdio_match[] = {
};
MODULE_DEVICE_TABLE(of, fsl_pq_mdio_match);

static void set_tbipa(const u32 tbipa_val, struct platform_device *pdev,
uint32_t __iomem * (*get_tbipa)(void __iomem *),
void __iomem *reg_map, struct resource *reg_res)
{
struct device_node *np = pdev->dev.of_node;
uint32_t __iomem *tbipa;
bool tbipa_mapped;

tbipa = of_iomap(np, 1);
if (tbipa) {
tbipa_mapped = true;
} else {
tbipa_mapped = false;
tbipa = (*get_tbipa)(reg_map);

/*
* Add consistency check to make sure TBI is contained within
* the mapped range (not because we would get a segfault,
* rather to catch bugs in computing TBI address). Print error
* message but continue anyway.
*/
if ((void *)tbipa > reg_map + resource_size(reg_res) - 4)
dev_err(&pdev->dev, "invalid register map (should be at least 0x%04zx to contain TBI address)\n",
((void *)tbipa - reg_map) + 4);
}

iowrite32be(be32_to_cpu(tbipa_val), tbipa);

if (tbipa_mapped)
iounmap(tbipa);
}

static int fsl_pq_mdio_probe(struct platform_device *pdev)
{
const struct of_device_id *id =
Expand Down Expand Up @@ -450,29 +482,15 @@ static int fsl_pq_mdio_probe(struct platform_device *pdev)

if (tbi) {
const u32 *prop = of_get_property(tbi, "reg", NULL);
uint32_t __iomem *tbipa;

if (!prop) {
dev_err(&pdev->dev,
"missing 'reg' property in node %pOF\n",
tbi);
err = -EBUSY;
goto error;
}

tbipa = data->get_tbipa(priv->map);

/*
* Add consistency check to make sure TBI is contained
* within the mapped range (not because we would get a
* segfault, rather to catch bugs in computing TBI
* address). Print error message but continue anyway.
*/
if ((void *)tbipa > priv->map + resource_size(&res) - 4)
dev_err(&pdev->dev, "invalid register map (should be at least 0x%04zx to contain TBI address)\n",
((void *)tbipa - priv->map) + 4);

iowrite32be(be32_to_cpup(prop), tbipa);
set_tbipa(*prop, pdev,
data->get_tbipa, priv->map, &res);
}
}

Expand Down
Loading

0 comments on commit c18bb39

Please sign in to comment.