Commit e595dd94 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull networking fixes from David Miller:

 1) Fix memory leak in vti6, from Torsten Hilbrich.

 2) Fix double free in xfrm_policy_timer, from YueHaibing.

 3) NL80211_ATTR_CHANNEL_WIDTH attribute is put with wrong type, from
    Johannes Berg.

 4) Wrong allocation failure check in qlcnic driver, from Xu Wang.

 5) Get ks8851-ml IO operations right, for real this time, from Marek
    Vasut.

* git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (22 commits)
  r8169: fix PHY driver check on platforms w/o module softdeps
  net: ks8851-ml: Fix IO operations, again
  mlxsw: spectrum_mr: Fix list iteration in error path
  qlcnic: Fix bad kzalloc null test
  mac80211: set IEEE80211_TX_CTRL_PORT_CTRL_PROTO for nl80211 TX
  mac80211: mark station unauthorized before key removal
  mac80211: Check port authorization in the ieee80211_tx_dequeue() case
  cfg80211: Do not warn on same channel at the end of CSA
  mac80211: drop data frames without key on encrypted links
  ieee80211: fix HE SPR size calculation
  nl80211: fix NL80211_ATTR_CHANNEL_WIDTH attribute type
  xfrm: policy: Fix doulbe free in xfrm_policy_timer
  bpf: Explicitly memset some bpf info structures declared on the stack
  bpf: Explicitly memset the bpf_attr structure
  bpf: Sanitize the bpf_struct_ops tcp-cc name
  vti6: Fix memory leak of skb if input policy check fails
  esp: remove the skb from the chain when it's enqueued in cryptd_wq
  ipv6: xfrm6_tunnel.c: Use built-in RCU list checking
  xfrm: add the missing verify_sec_ctx_len check in xfrm_add_acquire
  xfrm: fix uctx len check in verify_sec_ctx_len
  ...
parents 906c4043 a0ba26f3
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -637,11 +637,11 @@ static int mlxsw_sp_mr_vif_resolve(struct mlxsw_sp_mr_table *mr_table,
	return 0;

err_erif_unresolve:
	list_for_each_entry_from_reverse(erve, &mr_vif->route_evif_list,
	list_for_each_entry_continue_reverse(erve, &mr_vif->route_evif_list,
					     vif_node)
		mlxsw_sp_mr_route_evif_unresolve(mr_table, erve);
err_irif_unresolve:
	list_for_each_entry_from_reverse(irve, &mr_vif->route_ivif_list,
	list_for_each_entry_continue_reverse(irve, &mr_vif->route_ivif_list,
					     vif_node)
		mlxsw_sp_mr_route_ivif_unresolve(mr_table, irve);
	mr_vif->rif = NULL;
+52 −4
Original line number Diff line number Diff line
@@ -156,6 +156,50 @@ static int msg_enable;
 * chip is busy transferring packet data (RX/TX FIFO accesses).
 */

/**
 * ks_check_endian - Check whether endianness of the bus is correct
 * @ks	  : The chip information
 *
 * The KS8851-16MLL EESK pin allows selecting the endianness of the 16bit
 * bus. To maintain optimum performance, the bus endianness should be set
 * such that it matches the endianness of the CPU.
 */

static int ks_check_endian(struct ks_net *ks)
{
	u16 cider;

	/*
	 * Read CIDER register first, however read it the "wrong" way around.
	 * If the endian strap on the KS8851-16MLL in incorrect and the chip
	 * is operating in different endianness than the CPU, then the meaning
	 * of BE[3:0] byte-enable bits is also swapped such that:
	 *    BE[3,2,1,0] becomes BE[1,0,3,2]
	 *
	 * Luckily for us, the byte-enable bits are the top four MSbits of
	 * the address register and the CIDER register is at offset 0xc0.
	 * Hence, by reading address 0xc0c0, which is not impacted by endian
	 * swapping, we assert either BE[3:2] or BE[1:0] while reading the
	 * CIDER register.
	 *
	 * If the bus configuration is correct, reading 0xc0c0 asserts
	 * BE[3:2] and this read returns 0x0000, because to read register
	 * with bottom two LSbits of address set to 0, BE[1:0] must be
	 * asserted.
	 *
	 * If the bus configuration is NOT correct, reading 0xc0c0 asserts
	 * BE[1:0] and this read returns non-zero 0x8872 value.
	 */
	iowrite16(BE3 | BE2 | KS_CIDER, ks->hw_addr_cmd);
	cider = ioread16(ks->hw_addr);
	if (!cider)
		return 0;

	netdev_err(ks->netdev, "incorrect EESK endian strap setting\n");

	return -EINVAL;
}

/**
 * ks_rdreg16 - read 16 bit register from device
 * @ks	  : The chip information
@@ -166,7 +210,7 @@ static int msg_enable;

static u16 ks_rdreg16(struct ks_net *ks, int offset)
{
	ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02));
	ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02));
	iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
	return ioread16(ks->hw_addr);
}
@@ -181,7 +225,7 @@ static u16 ks_rdreg16(struct ks_net *ks, int offset)

static void ks_wrreg16(struct ks_net *ks, int offset, u16 value)
{
	ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02));
	ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02));
	iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
	iowrite16(value, ks->hw_addr);
}
@@ -197,7 +241,7 @@ static inline void ks_inblk(struct ks_net *ks, u16 *wptr, u32 len)
{
	len >>= 1;
	while (len--)
		*wptr++ = be16_to_cpu(ioread16(ks->hw_addr));
		*wptr++ = (u16)ioread16(ks->hw_addr);
}

/**
@@ -211,7 +255,7 @@ static inline void ks_outblk(struct ks_net *ks, u16 *wptr, u32 len)
{
	len >>= 1;
	while (len--)
		iowrite16(cpu_to_be16(*wptr++), ks->hw_addr);
		iowrite16(*wptr++, ks->hw_addr);
}

static void ks_disable_int(struct ks_net *ks)
@@ -1218,6 +1262,10 @@ static int ks8851_probe(struct platform_device *pdev)
		goto err_free;
	}

	err = ks_check_endian(ks);
	if (err)
		goto err_free;

	netdev->irq = platform_get_irq(pdev, 0);

	if ((int)netdev->irq < 0) {
+1 −1
Original line number Diff line number Diff line
@@ -1720,7 +1720,7 @@ static int qlcnic_83xx_get_reset_instruction_template(struct qlcnic_adapter *p_d

	ahw->reset.seq_error = 0;
	ahw->reset.buff = kzalloc(QLC_83XX_RESTART_TEMPLATE_SIZE, GFP_KERNEL);
	if (p_dev->ahw->reset.buff == NULL)
	if (ahw->reset.buff == NULL)
		return -ENOMEM;

	p_buff = p_dev->ahw->reset.buff;
+7 −9
Original line number Diff line number Diff line
@@ -5285,6 +5285,13 @@ static int r8169_mdio_register(struct rtl8169_private *tp)
	if (!tp->phydev) {
		mdiobus_unregister(new_bus);
		return -ENODEV;
	} else if (!tp->phydev->drv) {
		/* Most chip versions fail with the genphy driver.
		 * Therefore ensure that the dedicated PHY driver is loaded.
		 */
		dev_err(&pdev->dev, "realtek.ko not loaded, maybe it needs to be added to initramfs?\n");
		mdiobus_unregister(new_bus);
		return -EUNATCH;
	}

	/* PHY will be woken up in rtl_open() */
@@ -5446,15 +5453,6 @@ static int rtl_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
	int chipset, region;
	int jumbo_max, rc;

	/* Some tools for creating an initramfs don't consider softdeps, then
	 * r8169.ko may be in initramfs, but realtek.ko not. Then the generic
	 * PHY driver is used that doesn't work with most chip versions.
	 */
	if (!driver_find("RTL8201CP Ethernet", &mdio_bus_type)) {
		dev_err(&pdev->dev, "realtek.ko not loaded, maybe it needs to be added to initramfs?\n");
		return -ENOENT;
	}

	dev = devm_alloc_etherdev(&pdev->dev, sizeof (*tp));
	if (!dev)
		return -ENOMEM;
+1 −0
Original line number Diff line number Diff line
@@ -160,6 +160,7 @@ static inline void copy_map_value(struct bpf_map *map, void *dst, void *src)
}
void copy_map_value_locked(struct bpf_map *map, void *dst, void *src,
			   bool lock_src);
int bpf_obj_name_cpy(char *dst, const char *src, unsigned int size);

struct bpf_offload_dev;
struct bpf_offloaded_map;
Loading