Merge 4.19.187 into android-4.19-stable

Changes in 4.19.187
	ALSA: aloop: Fix initialization of controls
	ASoC: intel: atom: Stop advertising non working S24LE support
	nfc: fix refcount leak in llcp_sock_bind()
	nfc: fix refcount leak in llcp_sock_connect()
	nfc: fix memory leak in llcp_sock_connect()
	nfc: Avoid endless loops caused by repeated llcp_sock_connect()
	xen/evtchn: Change irq_info lock to raw_spinlock_t
	net: ipv6: check for validity before dereferencing cfg->fc_nlinfo.nlh
	ia64: fix user_stack_pointer() for ptrace()
	nds32: flush_dcache_page: use page_mapping_file to avoid races with swapoff
	ocfs2: fix deadlock between setattr and dio_end_io_write
	fs: direct-io: fix missing sdio->boundary
	parisc: parisc-agp requires SBA IOMMU driver
	parisc: avoid a warning on u8 cast for cmpxchg on u8 pointers
	ARM: dts: turris-omnia: configure LED[2]/INTn pin as interrupt pin
	batman-adv: initialize "struct batadv_tvlv_tt_vlan_data"->reserved field
	ice: Increase control queue timeout
	net: hso: fix null-ptr-deref during tty device unregistration
	net: ensure mac header is set in virtio_net_hdr_to_skb()
	net: sched: sch_teql: fix null-pointer dereference
	net-ipv6: bugfix - raw & sctp - switch to ipv6_can_nonlocal_bind()
	usbip: add sysfs_lock to synchronize sysfs code paths
	usbip: stub-dev synchronize sysfs code paths
	usbip: vudc synchronize sysfs code paths
	usbip: synchronize event handler with sysfs code paths
	i2c: turn recovery error on init to debug
	virtio_net: Add XDP meta data support
	xfrm: interface: fix ipv4 pmtu check to honor ip header df
	regulator: bd9571mwv: Fix AVS and DVFS voltage range
	net: xfrm: Localize sequence counter per network namespace
	ASoC: wm8960: Fix wrong bclk and lrclk with pll enabled for some chips
	i40e: Added Asym_Pause to supported link modes
	i40e: Fix kernel oops when i40e driver removes VF's
	amd-xgbe: Update DMA coherency values
	sch_red: fix off-by-one checks in red_check_params()
	gianfar: Handle error code at MAC address change
	cxgb4: avoid collecting SGE_QBASE regs during traffic
	net:tipc: Fix a double free in tipc_sk_mcast_rcv
	ARM: dts: imx6: pbab01: Set vmmc supply for both SD interfaces
	net/ncsi: Avoid channel_monitor hrtimer deadlock
	ASoC: sunxi: sun4i-codec: fill ASoC card owner
	soc/fsl: qbman: fix conflicting alignment attributes
	clk: fix invalid usage of list cursor in register
	clk: fix invalid usage of list cursor in unregister
	workqueue: Move the position of debug_work_activate() in __queue_work()
	s390/cpcmd: fix inline assembly register clobbering
	net/mlx5: Fix placement of log_max_flow_counter
	net/mlx5: Fix PBMC register mapping
	RDMA/cxgb4: check for ipv6 address properly while destroying listener
	clk: socfpga: fix iomem pointer cast on 64-bit
	net: sched: bump refcount for new action in ACT replace mode
	cfg80211: remove WARN_ON() in cfg80211_sme_connect
	net: tun: set tun->dev->addr_len during TUNSETLINK processing
	drivers: net: fix memory leak in atusb_probe
	drivers: net: fix memory leak in peak_usb_create_dev
	net: mac802154: Fix general protection fault
	net: ieee802154: nl-mac: fix check on panid
	net: ieee802154: fix nl802154 del llsec key
	net: ieee802154: fix nl802154 del llsec dev
	net: ieee802154: fix nl802154 add llsec key
	net: ieee802154: fix nl802154 del llsec devkey
	net: ieee802154: forbid monitor for set llsec params
	net: ieee802154: forbid monitor for del llsec seclevel
	net: ieee802154: stop dump llsec params for monitors
	Revert "cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath."
	Linux 4.19.187

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: If3e6588f5ba37d646e090aeec39e733817e6abda
This commit is contained in:
Greg Kroah-Hartman
2021-04-14 10:14:14 +02:00
64 changed files with 357 additions and 176 deletions

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
VERSION = 4 VERSION = 4
PATCHLEVEL = 19 PATCHLEVEL = 19
SUBLEVEL = 186 SUBLEVEL = 187
EXTRAVERSION = EXTRAVERSION =
NAME = "People's Front" NAME = "People's Front"

View File

@@ -236,6 +236,7 @@
status = "okay"; status = "okay";
compatible = "ethernet-phy-id0141.0DD1", "ethernet-phy-ieee802.3-c22"; compatible = "ethernet-phy-id0141.0DD1", "ethernet-phy-ieee802.3-c22";
reg = <1>; reg = <1>;
marvell,reg-init = <3 18 0 0x4985>;
/* irq is connected to &pcawan pin 7 */ /* irq is connected to &pcawan pin 7 */
}; };

View File

@@ -423,6 +423,7 @@
pinctrl-0 = <&pinctrl_usdhc2>; pinctrl-0 = <&pinctrl_usdhc2>;
cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>; cd-gpios = <&gpio1 4 GPIO_ACTIVE_LOW>;
wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>; wp-gpios = <&gpio1 2 GPIO_ACTIVE_HIGH>;
vmmc-supply = <&vdd_sd1_reg>;
status = "disabled"; status = "disabled";
}; };
@@ -432,5 +433,6 @@
&pinctrl_usdhc3_cdwp>; &pinctrl_usdhc3_cdwp>;
cd-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>; cd-gpios = <&gpio1 27 GPIO_ACTIVE_LOW>;
wp-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>; wp-gpios = <&gpio1 29 GPIO_ACTIVE_HIGH>;
vmmc-supply = <&vdd_sd0_reg>;
status = "disabled"; status = "disabled";
}; };

View File

@@ -54,8 +54,7 @@
static inline unsigned long user_stack_pointer(struct pt_regs *regs) static inline unsigned long user_stack_pointer(struct pt_regs *regs)
{ {
/* FIXME: should this be bspstore + nr_dirty regs? */ return regs->r12;
return regs->ar_bspstore;
} }
static inline int is_syscall_success(struct pt_regs *regs) static inline int is_syscall_success(struct pt_regs *regs)
@@ -79,11 +78,6 @@ static inline long regs_return_value(struct pt_regs *regs)
unsigned long __ip = instruction_pointer(regs); \ unsigned long __ip = instruction_pointer(regs); \
(__ip & ~3UL) + ((__ip & 3UL) << 2); \ (__ip & ~3UL) + ((__ip & 3UL) << 2); \
}) })
/*
* Why not default? Because user_stack_pointer() on ia64 gives register
* stack backing store instead...
*/
#define current_user_stack_pointer() (current_pt_regs()->r12)
/* given a pointer to a task_struct, return the user's pt_regs */ /* given a pointer to a task_struct, return the user's pt_regs */
# define task_pt_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1) # define task_pt_regs(t) (((struct pt_regs *) ((char *) (t) + IA64_STK_OFFSET)) - 1)

View File

@@ -239,7 +239,7 @@ void flush_dcache_page(struct page *page)
{ {
struct address_space *mapping; struct address_space *mapping;
mapping = page_mapping(page); mapping = page_mapping_file(page);
if (mapping && !mapping_mapped(mapping)) if (mapping && !mapping_mapped(mapping))
set_bit(PG_dcache_dirty, &page->flags); set_bit(PG_dcache_dirty, &page->flags);
else { else {

View File

@@ -72,7 +72,7 @@ __cmpxchg(volatile void *ptr, unsigned long old, unsigned long new_, int size)
#endif #endif
case 4: return __cmpxchg_u32((unsigned int *)ptr, case 4: return __cmpxchg_u32((unsigned int *)ptr,
(unsigned int)old, (unsigned int)new_); (unsigned int)old, (unsigned int)new_);
case 1: return __cmpxchg_u8((u8 *)ptr, (u8)old, (u8)new_); case 1: return __cmpxchg_u8((u8 *)ptr, old & 0xff, new_ & 0xff);
} }
__cmpxchg_called_with_bad_pointer(); __cmpxchg_called_with_bad_pointer();
return old; return old;

View File

@@ -37,10 +37,12 @@ static int diag8_noresponse(int cmdlen)
static int diag8_response(int cmdlen, char *response, int *rlen) static int diag8_response(int cmdlen, char *response, int *rlen)
{ {
unsigned long _cmdlen = cmdlen | 0x40000000L;
unsigned long _rlen = *rlen;
register unsigned long reg2 asm ("2") = (addr_t) cpcmd_buf; register unsigned long reg2 asm ("2") = (addr_t) cpcmd_buf;
register unsigned long reg3 asm ("3") = (addr_t) response; register unsigned long reg3 asm ("3") = (addr_t) response;
register unsigned long reg4 asm ("4") = cmdlen | 0x40000000L; register unsigned long reg4 asm ("4") = _cmdlen;
register unsigned long reg5 asm ("5") = *rlen; register unsigned long reg5 asm ("5") = _rlen;
asm volatile( asm volatile(
" diag %2,%0,0x8\n" " diag %2,%0,0x8\n"

View File

@@ -125,7 +125,7 @@ config AGP_HP_ZX1
config AGP_PARISC config AGP_PARISC
tristate "HP Quicksilver AGP support" tristate "HP Quicksilver AGP support"
depends on AGP && PARISC && 64BIT depends on AGP && PARISC && 64BIT && IOMMU_SBA
help help
This option gives you AGP GART support for the HP Quicksilver This option gives you AGP GART support for the HP Quicksilver
AGP bus adapter on HP PA-RISC machines (Ok, just on the C8000 AGP bus adapter on HP PA-RISC machines (Ok, just on the C8000

View File

@@ -4401,20 +4401,19 @@ int clk_notifier_register(struct clk *clk, struct notifier_block *nb)
/* search the list of notifiers for this clk */ /* search the list of notifiers for this clk */
list_for_each_entry(cn, &clk_notifier_list, node) list_for_each_entry(cn, &clk_notifier_list, node)
if (cn->clk == clk) if (cn->clk == clk)
break; goto found;
/* if clk wasn't in the notifier list, allocate new clk_notifier */ /* if clk wasn't in the notifier list, allocate new clk_notifier */
if (cn->clk != clk) { cn = kzalloc(sizeof(*cn), GFP_KERNEL);
cn = kzalloc(sizeof(*cn), GFP_KERNEL); if (!cn)
if (!cn) goto out;
goto out;
cn->clk = clk; cn->clk = clk;
srcu_init_notifier_head(&cn->notifier_head); srcu_init_notifier_head(&cn->notifier_head);
list_add(&cn->node, &clk_notifier_list); list_add(&cn->node, &clk_notifier_list);
}
found:
ret = srcu_notifier_chain_register(&cn->notifier_head, nb); ret = srcu_notifier_chain_register(&cn->notifier_head, nb);
clk->core->notifier_count++; clk->core->notifier_count++;
@@ -4439,32 +4438,28 @@ EXPORT_SYMBOL_GPL(clk_notifier_register);
*/ */
int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb) int clk_notifier_unregister(struct clk *clk, struct notifier_block *nb)
{ {
struct clk_notifier *cn = NULL; struct clk_notifier *cn;
int ret = -EINVAL; int ret = -ENOENT;
if (!clk || !nb) if (!clk || !nb)
return -EINVAL; return -EINVAL;
clk_prepare_lock(); clk_prepare_lock();
list_for_each_entry(cn, &clk_notifier_list, node) list_for_each_entry(cn, &clk_notifier_list, node) {
if (cn->clk == clk) if (cn->clk == clk) {
ret = srcu_notifier_chain_unregister(&cn->notifier_head, nb);
clk->core->notifier_count--;
/* XXX the notifier code should handle this better */
if (!cn->notifier_head.head) {
srcu_cleanup_notifier_head(&cn->notifier_head);
list_del(&cn->node);
kfree(cn);
}
break; break;
if (cn->clk == clk) {
ret = srcu_notifier_chain_unregister(&cn->notifier_head, nb);
clk->core->notifier_count--;
/* XXX the notifier code should handle this better */
if (!cn->notifier_head.head) {
srcu_cleanup_notifier_head(&cn->notifier_head);
list_del(&cn->node);
kfree(cn);
} }
} else {
ret = -ENOENT;
} }
clk_prepare_unlock(); clk_prepare_unlock();

View File

@@ -107,7 +107,7 @@ static unsigned long socfpga_clk_recalc_rate(struct clk_hw *hwclk,
val = readl(socfpgaclk->div_reg) >> socfpgaclk->shift; val = readl(socfpgaclk->div_reg) >> socfpgaclk->shift;
val &= GENMASK(socfpgaclk->width - 1, 0); val &= GENMASK(socfpgaclk->width - 1, 0);
/* Check for GPIO_DB_CLK by its offset */ /* Check for GPIO_DB_CLK by its offset */
if ((int) socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET) if ((uintptr_t) socfpgaclk->div_reg & SOCFPGA_GPIO_DB_CLK_OFFSET)
div = val + 1; div = val + 1;
else else
div = (1 << val); div = (1 << val);

View File

@@ -262,13 +262,14 @@ EXPORT_SYMBOL_GPL(i2c_recover_bus);
static void i2c_init_recovery(struct i2c_adapter *adap) static void i2c_init_recovery(struct i2c_adapter *adap)
{ {
struct i2c_bus_recovery_info *bri = adap->bus_recovery_info; struct i2c_bus_recovery_info *bri = adap->bus_recovery_info;
char *err_str; char *err_str, *err_level = KERN_ERR;
if (!bri) if (!bri)
return; return;
if (!bri->recover_bus) { if (!bri->recover_bus) {
err_str = "no recover_bus() found"; err_str = "no suitable method provided";
err_level = KERN_DEBUG;
goto err; goto err;
} }
@@ -298,7 +299,7 @@ static void i2c_init_recovery(struct i2c_adapter *adap)
return; return;
err: err:
dev_err(&adap->dev, "Not using recovery: %s\n", err_str); dev_printk(err_level, &adap->dev, "Not using recovery: %s\n", err_str);
adap->bus_recovery_info = NULL; adap->bus_recovery_info = NULL;
} }

View File

@@ -3523,7 +3523,8 @@ int c4iw_destroy_listen(struct iw_cm_id *cm_id)
c4iw_init_wr_wait(ep->com.wr_waitp); c4iw_init_wr_wait(ep->com.wr_waitp);
err = cxgb4_remove_server( err = cxgb4_remove_server(
ep->com.dev->rdev.lldi.ports[0], ep->stid, ep->com.dev->rdev.lldi.ports[0], ep->stid,
ep->com.dev->rdev.lldi.rxq_ids[0], true); ep->com.dev->rdev.lldi.rxq_ids[0],
ep->com.local_addr.ss_family == AF_INET6);
if (err) if (err)
goto done; goto done;
err = c4iw_wait_for_reply(&ep->com.dev->rdev, ep->com.wr_waitp, err = c4iw_wait_for_reply(&ep->com.dev->rdev, ep->com.wr_waitp,

View File

@@ -864,7 +864,7 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter,
if (dev->adapter->dev_set_bus) { if (dev->adapter->dev_set_bus) {
err = dev->adapter->dev_set_bus(dev, 0); err = dev->adapter->dev_set_bus(dev, 0);
if (err) if (err)
goto lbl_unregister_candev; goto adap_dev_free;
} }
/* get device number early */ /* get device number early */
@@ -876,6 +876,10 @@ static int peak_usb_create_dev(const struct peak_usb_adapter *peak_usb_adapter,
return 0; return 0;
adap_dev_free:
if (dev->adapter->dev_free)
dev->adapter->dev_free(dev);
lbl_unregister_candev: lbl_unregister_candev:
unregister_candev(netdev); unregister_candev(netdev);

View File

@@ -181,9 +181,9 @@
#define XGBE_DMA_SYS_AWCR 0x30303030 #define XGBE_DMA_SYS_AWCR 0x30303030
/* DMA cache settings - PCI device */ /* DMA cache settings - PCI device */
#define XGBE_DMA_PCI_ARCR 0x00000003 #define XGBE_DMA_PCI_ARCR 0x000f0f0f
#define XGBE_DMA_PCI_AWCR 0x13131313 #define XGBE_DMA_PCI_AWCR 0x0f0f0f0f
#define XGBE_DMA_PCI_AWARCR 0x00000313 #define XGBE_DMA_PCI_AWARCR 0x00000f0f
/* DMA channel interrupt modes */ /* DMA channel interrupt modes */
#define XGBE_IRQ_MODE_EDGE 0 #define XGBE_IRQ_MODE_EDGE 0

View File

@@ -1400,11 +1400,25 @@ int cudbg_collect_sge_indirect(struct cudbg_init *pdbg_init,
struct cudbg_buffer temp_buff = { 0 }; struct cudbg_buffer temp_buff = { 0 };
struct sge_qbase_reg_field *sge_qbase; struct sge_qbase_reg_field *sge_qbase;
struct ireg_buf *ch_sge_dbg; struct ireg_buf *ch_sge_dbg;
u8 padap_running = 0;
int i, rc; int i, rc;
u32 size;
rc = cudbg_get_buff(pdbg_init, dbg_buff, /* Accessing SGE_QBASE_MAP[0-3] and SGE_QBASE_INDEX regs can
sizeof(*ch_sge_dbg) * 2 + sizeof(*sge_qbase), * lead to SGE missing doorbells under heavy traffic. So, only
&temp_buff); * collect them when adapter is idle.
*/
for_each_port(padap, i) {
padap_running = netif_running(padap->port[i]);
if (padap_running)
break;
}
size = sizeof(*ch_sge_dbg) * 2;
if (!padap_running)
size += sizeof(*sge_qbase);
rc = cudbg_get_buff(pdbg_init, dbg_buff, size, &temp_buff);
if (rc) if (rc)
return rc; return rc;
@@ -1426,7 +1440,8 @@ int cudbg_collect_sge_indirect(struct cudbg_init *pdbg_init,
ch_sge_dbg++; ch_sge_dbg++;
} }
if (CHELSIO_CHIP_VERSION(padap->params.chip) > CHELSIO_T5) { if (CHELSIO_CHIP_VERSION(padap->params.chip) > CHELSIO_T5 &&
!padap_running) {
sge_qbase = (struct sge_qbase_reg_field *)ch_sge_dbg; sge_qbase = (struct sge_qbase_reg_field *)ch_sge_dbg;
/* 1 addr reg SGE_QBASE_INDEX and 4 data reg /* 1 addr reg SGE_QBASE_INDEX and 4 data reg
* SGE_QBASE_MAP[0-3] * SGE_QBASE_MAP[0-3]

View File

@@ -2093,7 +2093,8 @@ void t4_get_regs(struct adapter *adap, void *buf, size_t buf_size)
0x1190, 0x1194, 0x1190, 0x1194,
0x11a0, 0x11a4, 0x11a0, 0x11a4,
0x11b0, 0x11b4, 0x11b0, 0x11b4,
0x11fc, 0x1274, 0x11fc, 0x123c,
0x1254, 0x1274,
0x1280, 0x133c, 0x1280, 0x133c,
0x1800, 0x18fc, 0x1800, 0x18fc,
0x3000, 0x302c, 0x3000, 0x302c,

View File

@@ -485,7 +485,11 @@ static struct net_device_stats *gfar_get_stats(struct net_device *dev)
static int gfar_set_mac_addr(struct net_device *dev, void *p) static int gfar_set_mac_addr(struct net_device *dev, void *p)
{ {
eth_mac_addr(dev, p); int ret;
ret = eth_mac_addr(dev, p);
if (ret)
return ret;
gfar_set_mac_for_addr(dev, 0, dev->dev_addr); gfar_set_mac_for_addr(dev, 0, dev->dev_addr);

View File

@@ -149,6 +149,7 @@ enum i40e_state_t {
__I40E_CLIENT_L2_CHANGE, __I40E_CLIENT_L2_CHANGE,
__I40E_CLIENT_RESET, __I40E_CLIENT_RESET,
__I40E_VF_RESETS_DISABLED, /* disable resets during i40e_remove */ __I40E_VF_RESETS_DISABLED, /* disable resets during i40e_remove */
__I40E_VFS_RELEASING,
/* This must be last as it determines the size of the BITMAP */ /* This must be last as it determines the size of the BITMAP */
__I40E_STATE_SIZE__, __I40E_STATE_SIZE__,
}; };

View File

@@ -796,6 +796,7 @@ static int i40e_get_link_ksettings(struct net_device *netdev,
/* Set flow control settings */ /* Set flow control settings */
ethtool_link_ksettings_add_link_mode(ks, supported, Pause); ethtool_link_ksettings_add_link_mode(ks, supported, Pause);
ethtool_link_ksettings_add_link_mode(ks, supported, Asym_Pause);
switch (hw->fc.requested_mode) { switch (hw->fc.requested_mode) {
case I40E_FC_FULL: case I40E_FC_FULL:

View File

@@ -137,6 +137,7 @@ void i40e_vc_notify_vf_reset(struct i40e_vf *vf)
**/ **/
static inline void i40e_vc_disable_vf(struct i40e_vf *vf) static inline void i40e_vc_disable_vf(struct i40e_vf *vf)
{ {
struct i40e_pf *pf = vf->pf;
int i; int i;
i40e_vc_notify_vf_reset(vf); i40e_vc_notify_vf_reset(vf);
@@ -147,6 +148,11 @@ static inline void i40e_vc_disable_vf(struct i40e_vf *vf)
* ensure a reset. * ensure a reset.
*/ */
for (i = 0; i < 20; i++) { for (i = 0; i < 20; i++) {
/* If PF is in VFs releasing state reset VF is impossible,
* so leave it.
*/
if (test_bit(__I40E_VFS_RELEASING, pf->state))
return;
if (i40e_reset_vf(vf, false)) if (i40e_reset_vf(vf, false))
return; return;
usleep_range(10000, 20000); usleep_range(10000, 20000);
@@ -1381,6 +1387,8 @@ void i40e_free_vfs(struct i40e_pf *pf)
if (!pf->vf) if (!pf->vf)
return; return;
set_bit(__I40E_VFS_RELEASING, pf->state);
while (test_and_set_bit(__I40E_VF_DISABLE, pf->state)) while (test_and_set_bit(__I40E_VF_DISABLE, pf->state))
usleep_range(1000, 2000); usleep_range(1000, 2000);
@@ -1438,6 +1446,7 @@ void i40e_free_vfs(struct i40e_pf *pf)
} }
} }
clear_bit(__I40E_VF_DISABLE, pf->state); clear_bit(__I40E_VF_DISABLE, pf->state);
clear_bit(__I40E_VFS_RELEASING, pf->state);
} }
#ifdef CONFIG_PCI_IOV #ifdef CONFIG_PCI_IOV

View File

@@ -30,8 +30,8 @@ enum ice_ctl_q {
ICE_CTL_Q_ADMIN, ICE_CTL_Q_ADMIN,
}; };
/* Control Queue timeout settings - max delay 250ms */ /* Control Queue timeout settings - max delay 1s */
#define ICE_CTL_Q_SQ_CMD_TIMEOUT 2500 /* Count 2500 times */ #define ICE_CTL_Q_SQ_CMD_TIMEOUT 10000 /* Count 10000 times */
#define ICE_CTL_Q_SQ_CMD_USEC 100 /* Check every 100usec */ #define ICE_CTL_Q_SQ_CMD_USEC 100 /* Check every 100usec */
struct ice_ctl_q_ring { struct ice_ctl_q_ring {

View File

@@ -368,6 +368,7 @@ static int atusb_alloc_urbs(struct atusb *atusb, int n)
return -ENOMEM; return -ENOMEM;
} }
usb_anchor_urb(urb, &atusb->idle_urbs); usb_anchor_urb(urb, &atusb->idle_urbs);
usb_free_urb(urb);
n--; n--;
} }
return 0; return 0;

View File

@@ -77,6 +77,14 @@
#include <linux/bpf.h> #include <linux/bpf.h>
#include <linux/bpf_trace.h> #include <linux/bpf_trace.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <linux/ieee802154.h>
#include <linux/if_ltalk.h>
#include <uapi/linux/if_fddi.h>
#include <uapi/linux/if_hippi.h>
#include <uapi/linux/if_fc.h>
#include <net/ax25.h>
#include <net/rose.h>
#include <net/6lowpan.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/proc_fs.h> #include <linux/proc_fs.h>
@@ -2864,6 +2872,45 @@ static int tun_set_ebpf(struct tun_struct *tun, struct tun_prog **prog_p,
return __tun_set_ebpf(tun, prog_p, prog); return __tun_set_ebpf(tun, prog_p, prog);
} }
/* Return correct value for tun->dev->addr_len based on tun->dev->type. */
static unsigned char tun_get_addr_len(unsigned short type)
{
switch (type) {
case ARPHRD_IP6GRE:
case ARPHRD_TUNNEL6:
return sizeof(struct in6_addr);
case ARPHRD_IPGRE:
case ARPHRD_TUNNEL:
case ARPHRD_SIT:
return 4;
case ARPHRD_ETHER:
return ETH_ALEN;
case ARPHRD_IEEE802154:
case ARPHRD_IEEE802154_MONITOR:
return IEEE802154_EXTENDED_ADDR_LEN;
case ARPHRD_PHONET_PIPE:
case ARPHRD_PPP:
case ARPHRD_NONE:
return 0;
case ARPHRD_6LOWPAN:
return EUI64_ADDR_LEN;
case ARPHRD_FDDI:
return FDDI_K_ALEN;
case ARPHRD_HIPPI:
return HIPPI_ALEN;
case ARPHRD_IEEE802:
return FC_ALEN;
case ARPHRD_ROSE:
return ROSE_ADDR_LEN;
case ARPHRD_NETROM:
return AX25_ADDR_LEN;
case ARPHRD_LOCALTLK:
return LTALK_ALEN;
default:
return 0;
}
}
static long __tun_chr_ioctl(struct file *file, unsigned int cmd, static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
unsigned long arg, int ifreq_len) unsigned long arg, int ifreq_len)
{ {
@@ -3018,6 +3065,7 @@ static long __tun_chr_ioctl(struct file *file, unsigned int cmd,
ret = -EBUSY; ret = -EBUSY;
} else { } else {
tun->dev->type = (int) arg; tun->dev->type = (int) arg;
tun->dev->addr_len = tun_get_addr_len(tun->dev->type);
tun_debug(KERN_INFO, tun, "linktype set to %d\n", tun_debug(KERN_INFO, tun, "linktype set to %d\n",
tun->dev->type); tun->dev->type);
ret = 0; ret = 0;

View File

@@ -625,7 +625,7 @@ static struct hso_serial *get_serial_by_index(unsigned index)
return serial; return serial;
} }
static int get_free_serial_index(void) static int obtain_minor(struct hso_serial *serial)
{ {
int index; int index;
unsigned long flags; unsigned long flags;
@@ -633,8 +633,10 @@ static int get_free_serial_index(void)
spin_lock_irqsave(&serial_table_lock, flags); spin_lock_irqsave(&serial_table_lock, flags);
for (index = 0; index < HSO_SERIAL_TTY_MINORS; index++) { for (index = 0; index < HSO_SERIAL_TTY_MINORS; index++) {
if (serial_table[index] == NULL) { if (serial_table[index] == NULL) {
serial_table[index] = serial->parent;
serial->minor = index;
spin_unlock_irqrestore(&serial_table_lock, flags); spin_unlock_irqrestore(&serial_table_lock, flags);
return index; return 0;
} }
} }
spin_unlock_irqrestore(&serial_table_lock, flags); spin_unlock_irqrestore(&serial_table_lock, flags);
@@ -643,15 +645,12 @@ static int get_free_serial_index(void)
return -1; return -1;
} }
static void set_serial_by_index(unsigned index, struct hso_serial *serial) static void release_minor(struct hso_serial *serial)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&serial_table_lock, flags); spin_lock_irqsave(&serial_table_lock, flags);
if (serial) serial_table[serial->minor] = NULL;
serial_table[index] = serial->parent;
else
serial_table[index] = NULL;
spin_unlock_irqrestore(&serial_table_lock, flags); spin_unlock_irqrestore(&serial_table_lock, flags);
} }
@@ -2244,6 +2243,7 @@ static int hso_stop_serial_device(struct hso_device *hso_dev)
static void hso_serial_tty_unregister(struct hso_serial *serial) static void hso_serial_tty_unregister(struct hso_serial *serial)
{ {
tty_unregister_device(tty_drv, serial->minor); tty_unregister_device(tty_drv, serial->minor);
release_minor(serial);
} }
static void hso_serial_common_free(struct hso_serial *serial) static void hso_serial_common_free(struct hso_serial *serial)
@@ -2267,24 +2267,22 @@ static void hso_serial_common_free(struct hso_serial *serial)
static int hso_serial_common_create(struct hso_serial *serial, int num_urbs, static int hso_serial_common_create(struct hso_serial *serial, int num_urbs,
int rx_size, int tx_size) int rx_size, int tx_size)
{ {
int minor;
int i; int i;
tty_port_init(&serial->port); tty_port_init(&serial->port);
minor = get_free_serial_index(); if (obtain_minor(serial))
if (minor < 0)
goto exit2; goto exit2;
/* register our minor number */ /* register our minor number */
serial->parent->dev = tty_port_register_device_attr(&serial->port, serial->parent->dev = tty_port_register_device_attr(&serial->port,
tty_drv, minor, &serial->parent->interface->dev, tty_drv, serial->minor, &serial->parent->interface->dev,
serial->parent, hso_serial_dev_groups); serial->parent, hso_serial_dev_groups);
if (IS_ERR(serial->parent->dev)) if (IS_ERR(serial->parent->dev)) {
release_minor(serial);
goto exit2; goto exit2;
}
/* fill in specific data for later use */
serial->minor = minor;
serial->magic = HSO_SERIAL_MAGIC; serial->magic = HSO_SERIAL_MAGIC;
spin_lock_init(&serial->serial_lock); spin_lock_init(&serial->serial_lock);
serial->num_rx_urbs = num_urbs; serial->num_rx_urbs = num_urbs;
@@ -2677,9 +2675,6 @@ static struct hso_device *hso_create_bulk_serial_device(
serial->write_data = hso_std_serial_write_data; serial->write_data = hso_std_serial_write_data;
/* and record this serial */
set_serial_by_index(serial->minor, serial);
/* setup the proc dirs and files if needed */ /* setup the proc dirs and files if needed */
hso_log_port(hso_dev); hso_log_port(hso_dev);
@@ -2736,9 +2731,6 @@ struct hso_device *hso_create_mux_serial_device(struct usb_interface *interface,
serial->shared_int->ref_count++; serial->shared_int->ref_count++;
mutex_unlock(&serial->shared_int->shared_int_lock); mutex_unlock(&serial->shared_int->shared_int_lock);
/* and record this serial */
set_serial_by_index(serial->minor, serial);
/* setup the proc dirs and files if needed */ /* setup the proc dirs and files if needed */
hso_log_port(hso_dev); hso_log_port(hso_dev);
@@ -3123,7 +3115,6 @@ static void hso_free_interface(struct usb_interface *interface)
cancel_work_sync(&serial_table[i]->async_get_intf); cancel_work_sync(&serial_table[i]->async_get_intf);
hso_serial_tty_unregister(serial); hso_serial_tty_unregister(serial);
kref_put(&serial_table[i]->ref, hso_serial_ref_free); kref_put(&serial_table[i]->ref, hso_serial_ref_free);
set_serial_by_index(i, NULL);
} }
} }

View File

@@ -383,7 +383,7 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
struct receive_queue *rq, struct receive_queue *rq,
struct page *page, unsigned int offset, struct page *page, unsigned int offset,
unsigned int len, unsigned int truesize, unsigned int len, unsigned int truesize,
bool hdr_valid) bool hdr_valid, unsigned int metasize)
{ {
struct sk_buff *skb; struct sk_buff *skb;
struct virtio_net_hdr_mrg_rxbuf *hdr; struct virtio_net_hdr_mrg_rxbuf *hdr;
@@ -405,6 +405,7 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
else else
hdr_padded_len = sizeof(struct padded_vnet_hdr); hdr_padded_len = sizeof(struct padded_vnet_hdr);
/* hdr_valid means no XDP, so we can copy the vnet header */
if (hdr_valid) if (hdr_valid)
memcpy(hdr, p, hdr_len); memcpy(hdr, p, hdr_len);
@@ -417,6 +418,11 @@ static struct sk_buff *page_to_skb(struct virtnet_info *vi,
copy = skb_tailroom(skb); copy = skb_tailroom(skb);
skb_put_data(skb, p, copy); skb_put_data(skb, p, copy);
if (metasize) {
__skb_pull(skb, metasize);
skb_metadata_set(skb, metasize);
}
len -= copy; len -= copy;
offset += copy; offset += copy;
@@ -462,10 +468,6 @@ static int __virtnet_xdp_xmit_one(struct virtnet_info *vi,
struct virtio_net_hdr_mrg_rxbuf *hdr; struct virtio_net_hdr_mrg_rxbuf *hdr;
int err; int err;
/* virtqueue want to use data area in-front of packet */
if (unlikely(xdpf->metasize > 0))
return -EOPNOTSUPP;
if (unlikely(xdpf->headroom < vi->hdr_len)) if (unlikely(xdpf->headroom < vi->hdr_len))
return -EOVERFLOW; return -EOVERFLOW;
@@ -656,6 +658,7 @@ static struct sk_buff *receive_small(struct net_device *dev,
unsigned int delta = 0; unsigned int delta = 0;
struct page *xdp_page; struct page *xdp_page;
int err; int err;
unsigned int metasize = 0;
len -= vi->hdr_len; len -= vi->hdr_len;
stats->bytes += len; stats->bytes += len;
@@ -695,8 +698,8 @@ static struct sk_buff *receive_small(struct net_device *dev,
xdp.data_hard_start = buf + VIRTNET_RX_PAD + vi->hdr_len; xdp.data_hard_start = buf + VIRTNET_RX_PAD + vi->hdr_len;
xdp.data = xdp.data_hard_start + xdp_headroom; xdp.data = xdp.data_hard_start + xdp_headroom;
xdp_set_data_meta_invalid(&xdp);
xdp.data_end = xdp.data + len; xdp.data_end = xdp.data + len;
xdp.data_meta = xdp.data;
xdp.rxq = &rq->xdp_rxq; xdp.rxq = &rq->xdp_rxq;
orig_data = xdp.data; orig_data = xdp.data;
act = bpf_prog_run_xdp(xdp_prog, &xdp); act = bpf_prog_run_xdp(xdp_prog, &xdp);
@@ -707,6 +710,7 @@ static struct sk_buff *receive_small(struct net_device *dev,
/* Recalculate length in case bpf program changed it */ /* Recalculate length in case bpf program changed it */
delta = orig_data - xdp.data; delta = orig_data - xdp.data;
len = xdp.data_end - xdp.data; len = xdp.data_end - xdp.data;
metasize = xdp.data - xdp.data_meta;
break; break;
case XDP_TX: case XDP_TX:
stats->xdp_tx++; stats->xdp_tx++;
@@ -752,6 +756,9 @@ static struct sk_buff *receive_small(struct net_device *dev,
memcpy(skb_vnet_hdr(skb), buf, vi->hdr_len); memcpy(skb_vnet_hdr(skb), buf, vi->hdr_len);
} /* keep zeroed vnet hdr since packet was changed by bpf */ } /* keep zeroed vnet hdr since packet was changed by bpf */
if (metasize)
skb_metadata_set(skb, metasize);
err: err:
return skb; return skb;
@@ -772,8 +779,8 @@ static struct sk_buff *receive_big(struct net_device *dev,
struct virtnet_rq_stats *stats) struct virtnet_rq_stats *stats)
{ {
struct page *page = buf; struct page *page = buf;
struct sk_buff *skb = page_to_skb(vi, rq, page, 0, len, struct sk_buff *skb =
PAGE_SIZE, true); page_to_skb(vi, rq, page, 0, len, PAGE_SIZE, true, 0);
stats->bytes += len - vi->hdr_len; stats->bytes += len - vi->hdr_len;
if (unlikely(!skb)) if (unlikely(!skb))
@@ -805,6 +812,7 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
unsigned int truesize; unsigned int truesize;
unsigned int headroom = mergeable_ctx_to_headroom(ctx); unsigned int headroom = mergeable_ctx_to_headroom(ctx);
int err; int err;
unsigned int metasize = 0;
head_skb = NULL; head_skb = NULL;
stats->bytes += len - vi->hdr_len; stats->bytes += len - vi->hdr_len;
@@ -851,8 +859,8 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
data = page_address(xdp_page) + offset; data = page_address(xdp_page) + offset;
xdp.data_hard_start = data - VIRTIO_XDP_HEADROOM + vi->hdr_len; xdp.data_hard_start = data - VIRTIO_XDP_HEADROOM + vi->hdr_len;
xdp.data = data + vi->hdr_len; xdp.data = data + vi->hdr_len;
xdp_set_data_meta_invalid(&xdp);
xdp.data_end = xdp.data + (len - vi->hdr_len); xdp.data_end = xdp.data + (len - vi->hdr_len);
xdp.data_meta = xdp.data;
xdp.rxq = &rq->xdp_rxq; xdp.rxq = &rq->xdp_rxq;
act = bpf_prog_run_xdp(xdp_prog, &xdp); act = bpf_prog_run_xdp(xdp_prog, &xdp);
@@ -860,24 +868,27 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
switch (act) { switch (act) {
case XDP_PASS: case XDP_PASS:
/* recalculate offset to account for any header metasize = xdp.data - xdp.data_meta;
* adjustments. Note other cases do not build an
* skb and avoid using offset
*/
offset = xdp.data -
page_address(xdp_page) - vi->hdr_len;
/* recalculate len if xdp.data or xdp.data_end were /* recalculate offset to account for any header
* adjusted * adjustments and minus the metasize to copy the
* metadata in page_to_skb(). Note other cases do not
* build an skb and avoid using offset
*/ */
len = xdp.data_end - xdp.data + vi->hdr_len; offset = xdp.data - page_address(xdp_page) -
vi->hdr_len - metasize;
/* recalculate len if xdp.data, xdp.data_end or
* xdp.data_meta were adjusted
*/
len = xdp.data_end - xdp.data + vi->hdr_len + metasize;
/* We can only create skb based on xdp_page. */ /* We can only create skb based on xdp_page. */
if (unlikely(xdp_page != page)) { if (unlikely(xdp_page != page)) {
rcu_read_unlock(); rcu_read_unlock();
put_page(page); put_page(page);
head_skb = page_to_skb(vi, rq, xdp_page, head_skb = page_to_skb(vi, rq, xdp_page, offset,
offset, len, len, PAGE_SIZE, false,
PAGE_SIZE, false); metasize);
return head_skb; return head_skb;
} }
break; break;
@@ -933,7 +944,8 @@ static struct sk_buff *receive_mergeable(struct net_device *dev,
goto err_skb; goto err_skb;
} }
head_skb = page_to_skb(vi, rq, page, offset, len, truesize, !xdp_prog); head_skb = page_to_skb(vi, rq, page, offset, len, truesize, !xdp_prog,
metasize);
curr_skb = head_skb; curr_skb = head_skb;
if (unlikely(!curr_skb)) if (unlikely(!curr_skb))

View File

@@ -132,7 +132,7 @@ static struct regulator_ops vid_ops = {
static struct regulator_desc regulators[] = { static struct regulator_desc regulators[] = {
BD9571MWV_REG("VD09", "vd09", VD09, avs_ops, 0, 0x7f, BD9571MWV_REG("VD09", "vd09", VD09, avs_ops, 0, 0x7f,
0x80, 600000, 10000, 0x3c), 0x6f, 600000, 10000, 0x3c),
BD9571MWV_REG("VD18", "vd18", VD18, vid_ops, BD9571MWV_VD18_VID, 0xf, BD9571MWV_REG("VD18", "vd18", VD18, vid_ops, BD9571MWV_VD18_VID, 0xf,
16, 1625000, 25000, 0), 16, 1625000, 25000, 0),
BD9571MWV_REG("VD25", "vd25", VD25, vid_ops, BD9571MWV_VD25_VID, 0xf, BD9571MWV_REG("VD25", "vd25", VD25, vid_ops, BD9571MWV_VD25_VID, 0xf,
@@ -141,7 +141,7 @@ static struct regulator_desc regulators[] = {
11, 2800000, 100000, 0), 11, 2800000, 100000, 0),
BD9571MWV_REG("DVFS", "dvfs", DVFS, reg_ops, BD9571MWV_REG("DVFS", "dvfs", DVFS, reg_ops,
BD9571MWV_DVFS_MONIVDAC, 0x7f, BD9571MWV_DVFS_MONIVDAC, 0x7f,
0x80, 600000, 10000, 0x3c), 0x6f, 600000, 10000, 0x3c),
}; };
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP

View File

@@ -184,7 +184,7 @@ struct qm_eqcr_entry {
__be32 tag; __be32 tag;
struct qm_fd fd; struct qm_fd fd;
u8 __reserved3[32]; u8 __reserved3[32];
} __packed; } __packed __aligned(8);
#define QM_EQCR_VERB_VBIT 0x80 #define QM_EQCR_VERB_VBIT 0x80
#define QM_EQCR_VERB_CMD_MASK 0x61 /* but only one value; */ #define QM_EQCR_VERB_CMD_MASK 0x61 /* but only one value; */
#define QM_EQCR_VERB_CMD_ENQUEUE 0x01 #define QM_EQCR_VERB_CMD_ENQUEUE 0x01

View File

@@ -63,6 +63,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a
dev_info(dev, "stub up\n"); dev_info(dev, "stub up\n");
mutex_lock(&sdev->ud.sysfs_lock);
spin_lock_irq(&sdev->ud.lock); spin_lock_irq(&sdev->ud.lock);
if (sdev->ud.status != SDEV_ST_AVAILABLE) { if (sdev->ud.status != SDEV_ST_AVAILABLE) {
@@ -87,13 +88,13 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a
tcp_rx = kthread_create(stub_rx_loop, &sdev->ud, "stub_rx"); tcp_rx = kthread_create(stub_rx_loop, &sdev->ud, "stub_rx");
if (IS_ERR(tcp_rx)) { if (IS_ERR(tcp_rx)) {
sockfd_put(socket); sockfd_put(socket);
return -EINVAL; goto unlock_mutex;
} }
tcp_tx = kthread_create(stub_tx_loop, &sdev->ud, "stub_tx"); tcp_tx = kthread_create(stub_tx_loop, &sdev->ud, "stub_tx");
if (IS_ERR(tcp_tx)) { if (IS_ERR(tcp_tx)) {
kthread_stop(tcp_rx); kthread_stop(tcp_rx);
sockfd_put(socket); sockfd_put(socket);
return -EINVAL; goto unlock_mutex;
} }
/* get task structs now */ /* get task structs now */
@@ -112,6 +113,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a
wake_up_process(sdev->ud.tcp_rx); wake_up_process(sdev->ud.tcp_rx);
wake_up_process(sdev->ud.tcp_tx); wake_up_process(sdev->ud.tcp_tx);
mutex_unlock(&sdev->ud.sysfs_lock);
} else { } else {
dev_info(dev, "stub down\n"); dev_info(dev, "stub down\n");
@@ -122,6 +125,7 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a
spin_unlock_irq(&sdev->ud.lock); spin_unlock_irq(&sdev->ud.lock);
usbip_event_add(&sdev->ud, SDEV_EVENT_DOWN); usbip_event_add(&sdev->ud, SDEV_EVENT_DOWN);
mutex_unlock(&sdev->ud.sysfs_lock);
} }
return count; return count;
@@ -130,6 +134,8 @@ static ssize_t usbip_sockfd_store(struct device *dev, struct device_attribute *a
sockfd_put(socket); sockfd_put(socket);
err: err:
spin_unlock_irq(&sdev->ud.lock); spin_unlock_irq(&sdev->ud.lock);
unlock_mutex:
mutex_unlock(&sdev->ud.sysfs_lock);
return -EINVAL; return -EINVAL;
} }
static DEVICE_ATTR_WO(usbip_sockfd); static DEVICE_ATTR_WO(usbip_sockfd);
@@ -295,6 +301,7 @@ static struct stub_device *stub_device_alloc(struct usb_device *udev)
sdev->ud.side = USBIP_STUB; sdev->ud.side = USBIP_STUB;
sdev->ud.status = SDEV_ST_AVAILABLE; sdev->ud.status = SDEV_ST_AVAILABLE;
spin_lock_init(&sdev->ud.lock); spin_lock_init(&sdev->ud.lock);
mutex_init(&sdev->ud.sysfs_lock);
sdev->ud.tcp_socket = NULL; sdev->ud.tcp_socket = NULL;
sdev->ud.sockfd = -1; sdev->ud.sockfd = -1;

View File

@@ -263,6 +263,9 @@ struct usbip_device {
/* lock for status */ /* lock for status */
spinlock_t lock; spinlock_t lock;
/* mutex for synchronizing sysfs store paths */
struct mutex sysfs_lock;
int sockfd; int sockfd;
struct socket *tcp_socket; struct socket *tcp_socket;

View File

@@ -70,6 +70,7 @@ static void event_handler(struct work_struct *work)
while ((ud = get_event()) != NULL) { while ((ud = get_event()) != NULL) {
usbip_dbg_eh("pending event %lx\n", ud->event); usbip_dbg_eh("pending event %lx\n", ud->event);
mutex_lock(&ud->sysfs_lock);
/* /*
* NOTE: shutdown must come first. * NOTE: shutdown must come first.
* Shutdown the device. * Shutdown the device.
@@ -90,6 +91,7 @@ static void event_handler(struct work_struct *work)
ud->eh_ops.unusable(ud); ud->eh_ops.unusable(ud);
unset_event(ud, USBIP_EH_UNUSABLE); unset_event(ud, USBIP_EH_UNUSABLE);
} }
mutex_unlock(&ud->sysfs_lock);
wake_up(&ud->eh_waitq); wake_up(&ud->eh_waitq);
} }

View File

@@ -1101,6 +1101,7 @@ static void vhci_device_init(struct vhci_device *vdev)
vdev->ud.side = USBIP_VHCI; vdev->ud.side = USBIP_VHCI;
vdev->ud.status = VDEV_ST_NULL; vdev->ud.status = VDEV_ST_NULL;
spin_lock_init(&vdev->ud.lock); spin_lock_init(&vdev->ud.lock);
mutex_init(&vdev->ud.sysfs_lock);
INIT_LIST_HEAD(&vdev->priv_rx); INIT_LIST_HEAD(&vdev->priv_rx);
INIT_LIST_HEAD(&vdev->priv_tx); INIT_LIST_HEAD(&vdev->priv_tx);

View File

@@ -185,6 +185,8 @@ static int vhci_port_disconnect(struct vhci_hcd *vhci_hcd, __u32 rhport)
usbip_dbg_vhci_sysfs("enter\n"); usbip_dbg_vhci_sysfs("enter\n");
mutex_lock(&vdev->ud.sysfs_lock);
/* lock */ /* lock */
spin_lock_irqsave(&vhci->lock, flags); spin_lock_irqsave(&vhci->lock, flags);
spin_lock(&vdev->ud.lock); spin_lock(&vdev->ud.lock);
@@ -195,6 +197,7 @@ static int vhci_port_disconnect(struct vhci_hcd *vhci_hcd, __u32 rhport)
/* unlock */ /* unlock */
spin_unlock(&vdev->ud.lock); spin_unlock(&vdev->ud.lock);
spin_unlock_irqrestore(&vhci->lock, flags); spin_unlock_irqrestore(&vhci->lock, flags);
mutex_unlock(&vdev->ud.sysfs_lock);
return -EINVAL; return -EINVAL;
} }
@@ -205,6 +208,8 @@ static int vhci_port_disconnect(struct vhci_hcd *vhci_hcd, __u32 rhport)
usbip_event_add(&vdev->ud, VDEV_EVENT_DOWN); usbip_event_add(&vdev->ud, VDEV_EVENT_DOWN);
mutex_unlock(&vdev->ud.sysfs_lock);
return 0; return 0;
} }
@@ -349,30 +354,36 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr,
else else
vdev = &vhci->vhci_hcd_hs->vdev[rhport]; vdev = &vhci->vhci_hcd_hs->vdev[rhport];
mutex_lock(&vdev->ud.sysfs_lock);
/* Extract socket from fd. */ /* Extract socket from fd. */
socket = sockfd_lookup(sockfd, &err); socket = sockfd_lookup(sockfd, &err);
if (!socket) { if (!socket) {
dev_err(dev, "failed to lookup sock"); dev_err(dev, "failed to lookup sock");
return -EINVAL; err = -EINVAL;
goto unlock_mutex;
} }
if (socket->type != SOCK_STREAM) { if (socket->type != SOCK_STREAM) {
dev_err(dev, "Expecting SOCK_STREAM - found %d", dev_err(dev, "Expecting SOCK_STREAM - found %d",
socket->type); socket->type);
sockfd_put(socket); sockfd_put(socket);
return -EINVAL; err = -EINVAL;
goto unlock_mutex;
} }
/* create threads before locking */ /* create threads before locking */
tcp_rx = kthread_create(vhci_rx_loop, &vdev->ud, "vhci_rx"); tcp_rx = kthread_create(vhci_rx_loop, &vdev->ud, "vhci_rx");
if (IS_ERR(tcp_rx)) { if (IS_ERR(tcp_rx)) {
sockfd_put(socket); sockfd_put(socket);
return -EINVAL; err = -EINVAL;
goto unlock_mutex;
} }
tcp_tx = kthread_create(vhci_tx_loop, &vdev->ud, "vhci_tx"); tcp_tx = kthread_create(vhci_tx_loop, &vdev->ud, "vhci_tx");
if (IS_ERR(tcp_tx)) { if (IS_ERR(tcp_tx)) {
kthread_stop(tcp_rx); kthread_stop(tcp_rx);
sockfd_put(socket); sockfd_put(socket);
return -EINVAL; err = -EINVAL;
goto unlock_mutex;
} }
/* get task structs now */ /* get task structs now */
@@ -397,7 +408,8 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr,
* Will be retried from userspace * Will be retried from userspace
* if there's another free port. * if there's another free port.
*/ */
return -EBUSY; err = -EBUSY;
goto unlock_mutex;
} }
dev_info(dev, "pdev(%u) rhport(%u) sockfd(%d)\n", dev_info(dev, "pdev(%u) rhport(%u) sockfd(%d)\n",
@@ -422,7 +434,15 @@ static ssize_t attach_store(struct device *dev, struct device_attribute *attr,
rh_port_connect(vdev, speed); rh_port_connect(vdev, speed);
dev_info(dev, "Device attached\n");
mutex_unlock(&vdev->ud.sysfs_lock);
return count; return count;
unlock_mutex:
mutex_unlock(&vdev->ud.sysfs_lock);
return err;
} }
static DEVICE_ATTR_WO(attach); static DEVICE_ATTR_WO(attach);

View File

@@ -571,6 +571,7 @@ static int init_vudc_hw(struct vudc *udc)
init_waitqueue_head(&udc->tx_waitq); init_waitqueue_head(&udc->tx_waitq);
spin_lock_init(&ud->lock); spin_lock_init(&ud->lock);
mutex_init(&ud->sysfs_lock);
ud->status = SDEV_ST_AVAILABLE; ud->status = SDEV_ST_AVAILABLE;
ud->side = USBIP_VUDC; ud->side = USBIP_VUDC;

View File

@@ -113,6 +113,7 @@ static ssize_t usbip_sockfd_store(struct device *dev,
dev_err(dev, "no device"); dev_err(dev, "no device");
return -ENODEV; return -ENODEV;
} }
mutex_lock(&udc->ud.sysfs_lock);
spin_lock_irqsave(&udc->lock, flags); spin_lock_irqsave(&udc->lock, flags);
/* Don't export what we don't have */ /* Don't export what we don't have */
if (!udc->driver || !udc->pullup) { if (!udc->driver || !udc->pullup) {
@@ -188,6 +189,8 @@ static ssize_t usbip_sockfd_store(struct device *dev,
wake_up_process(udc->ud.tcp_rx); wake_up_process(udc->ud.tcp_rx);
wake_up_process(udc->ud.tcp_tx); wake_up_process(udc->ud.tcp_tx);
mutex_unlock(&udc->ud.sysfs_lock);
return count; return count;
} else { } else {
@@ -208,6 +211,7 @@ static ssize_t usbip_sockfd_store(struct device *dev,
} }
spin_unlock_irqrestore(&udc->lock, flags); spin_unlock_irqrestore(&udc->lock, flags);
mutex_unlock(&udc->ud.sysfs_lock);
return count; return count;
@@ -217,6 +221,7 @@ static ssize_t usbip_sockfd_store(struct device *dev,
spin_unlock_irq(&udc->ud.lock); spin_unlock_irq(&udc->ud.lock);
unlock: unlock:
spin_unlock_irqrestore(&udc->lock, flags); spin_unlock_irqrestore(&udc->lock, flags);
mutex_unlock(&udc->ud.sysfs_lock);
return ret; return ret;
} }

View File

@@ -221,7 +221,7 @@ static int xen_irq_info_common_setup(struct irq_info *info,
info->evtchn = evtchn; info->evtchn = evtchn;
info->cpu = cpu; info->cpu = cpu;
info->mask_reason = EVT_MASK_REASON_EXPLICIT; info->mask_reason = EVT_MASK_REASON_EXPLICIT;
spin_lock_init(&info->lock); raw_spin_lock_init(&info->lock);
ret = set_evtchn_to_irq(evtchn, irq); ret = set_evtchn_to_irq(evtchn, irq);
if (ret < 0) if (ret < 0)
@@ -373,28 +373,28 @@ static void do_mask(struct irq_info *info, u8 reason)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&info->lock, flags); raw_spin_lock_irqsave(&info->lock, flags);
if (!info->mask_reason) if (!info->mask_reason)
mask_evtchn(info->evtchn); mask_evtchn(info->evtchn);
info->mask_reason |= reason; info->mask_reason |= reason;
spin_unlock_irqrestore(&info->lock, flags); raw_spin_unlock_irqrestore(&info->lock, flags);
} }
static void do_unmask(struct irq_info *info, u8 reason) static void do_unmask(struct irq_info *info, u8 reason)
{ {
unsigned long flags; unsigned long flags;
spin_lock_irqsave(&info->lock, flags); raw_spin_lock_irqsave(&info->lock, flags);
info->mask_reason &= ~reason; info->mask_reason &= ~reason;
if (!info->mask_reason) if (!info->mask_reason)
unmask_evtchn(info->evtchn); unmask_evtchn(info->evtchn);
spin_unlock_irqrestore(&info->lock, flags); raw_spin_unlock_irqrestore(&info->lock, flags);
} }
#ifdef CONFIG_X86 #ifdef CONFIG_X86

View File

@@ -47,7 +47,7 @@ struct irq_info {
unsigned short eoi_cpu; /* EOI must happen on this cpu */ unsigned short eoi_cpu; /* EOI must happen on this cpu */
unsigned int irq_epoch; /* If eoi_cpu valid: irq_epoch of event */ unsigned int irq_epoch; /* If eoi_cpu valid: irq_epoch of event */
u64 eoi_time; /* Time in jiffies when to EOI. */ u64 eoi_time; /* Time in jiffies when to EOI. */
spinlock_t lock; raw_spinlock_t lock;
union { union {
unsigned short virq; unsigned short virq;

View File

@@ -3882,7 +3882,6 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
cifs_sb->prepath = kstrdup(pvolume_info->prepath, GFP_KERNEL); cifs_sb->prepath = kstrdup(pvolume_info->prepath, GFP_KERNEL);
if (cifs_sb->prepath == NULL) if (cifs_sb->prepath == NULL)
return -ENOMEM; return -ENOMEM;
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH;
} }
return 0; return 0;

View File

@@ -869,6 +869,7 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page,
struct buffer_head *map_bh) struct buffer_head *map_bh)
{ {
int ret = 0; int ret = 0;
int boundary = sdio->boundary; /* dio_send_cur_page may clear it */
if (dio->op == REQ_OP_WRITE) { if (dio->op == REQ_OP_WRITE) {
/* /*
@@ -907,10 +908,10 @@ submit_page_section(struct dio *dio, struct dio_submit *sdio, struct page *page,
sdio->cur_page_fs_offset = sdio->block_in_file << sdio->blkbits; sdio->cur_page_fs_offset = sdio->block_in_file << sdio->blkbits;
out: out:
/* /*
* If sdio->boundary then we want to schedule the IO now to * If boundary then we want to schedule the IO now to
* avoid metadata seeks. * avoid metadata seeks.
*/ */
if (sdio->boundary) { if (boundary) {
ret = dio_send_cur_page(dio, sdio, map_bh); ret = dio_send_cur_page(dio, sdio, map_bh);
if (sdio->bio) if (sdio->bio)
dio_bio_submit(dio, sdio); dio_bio_submit(dio, sdio);

View File

@@ -2311,7 +2311,7 @@ static int ocfs2_dio_end_io_write(struct inode *inode,
struct ocfs2_alloc_context *meta_ac = NULL; struct ocfs2_alloc_context *meta_ac = NULL;
handle_t *handle = NULL; handle_t *handle = NULL;
loff_t end = offset + bytes; loff_t end = offset + bytes;
int ret = 0, credits = 0, locked = 0; int ret = 0, credits = 0;
ocfs2_init_dealloc_ctxt(&dealloc); ocfs2_init_dealloc_ctxt(&dealloc);
@@ -2322,13 +2322,6 @@ static int ocfs2_dio_end_io_write(struct inode *inode,
!dwc->dw_orphaned) !dwc->dw_orphaned)
goto out; goto out;
/* ocfs2_file_write_iter will get i_mutex, so we need not lock if we
* are in that context. */
if (dwc->dw_writer_pid != task_pid_nr(current)) {
inode_lock(inode);
locked = 1;
}
ret = ocfs2_inode_lock(inode, &di_bh, 1); ret = ocfs2_inode_lock(inode, &di_bh, 1);
if (ret < 0) { if (ret < 0) {
mlog_errno(ret); mlog_errno(ret);
@@ -2409,8 +2402,6 @@ static int ocfs2_dio_end_io_write(struct inode *inode,
if (meta_ac) if (meta_ac)
ocfs2_free_alloc_context(meta_ac); ocfs2_free_alloc_context(meta_ac);
ocfs2_run_deallocs(osb, &dealloc); ocfs2_run_deallocs(osb, &dealloc);
if (locked)
inode_unlock(inode);
ocfs2_dio_free_write_ctx(inode, dwc); ocfs2_dio_free_write_ctx(inode, dwc);
return ret; return ret;

View File

@@ -1252,22 +1252,24 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
goto bail_unlock; goto bail_unlock;
} }
} }
down_write(&OCFS2_I(inode)->ip_alloc_sem);
handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS + handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS +
2 * ocfs2_quota_trans_credits(sb)); 2 * ocfs2_quota_trans_credits(sb));
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
status = PTR_ERR(handle); status = PTR_ERR(handle);
mlog_errno(status); mlog_errno(status);
goto bail_unlock; goto bail_unlock_alloc;
} }
status = __dquot_transfer(inode, transfer_to); status = __dquot_transfer(inode, transfer_to);
if (status < 0) if (status < 0)
goto bail_commit; goto bail_commit;
} else { } else {
down_write(&OCFS2_I(inode)->ip_alloc_sem);
handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS); handle = ocfs2_start_trans(osb, OCFS2_INODE_UPDATE_CREDITS);
if (IS_ERR(handle)) { if (IS_ERR(handle)) {
status = PTR_ERR(handle); status = PTR_ERR(handle);
mlog_errno(status); mlog_errno(status);
goto bail_unlock; goto bail_unlock_alloc;
} }
} }
@@ -1280,6 +1282,8 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
bail_commit: bail_commit:
ocfs2_commit_trans(osb, handle); ocfs2_commit_trans(osb, handle);
bail_unlock_alloc:
up_write(&OCFS2_I(inode)->ip_alloc_sem);
bail_unlock: bail_unlock:
if (status && inode_locked) { if (status && inode_locked) {
ocfs2_inode_unlock_tracker(inode, 1, &oh, had_lock); ocfs2_inode_unlock_tracker(inode, 1, &oh, had_lock);

View File

@@ -357,11 +357,11 @@ struct mlx5_ifc_flow_table_prop_layout_bits {
u8 reserved_at_60[0x18]; u8 reserved_at_60[0x18];
u8 log_max_ft_num[0x8]; u8 log_max_ft_num[0x8];
u8 reserved_at_80[0x18]; u8 reserved_at_80[0x10];
u8 log_max_flow_counter[0x8];
u8 log_max_destination[0x8]; u8 log_max_destination[0x8];
u8 log_max_flow_counter[0x8]; u8 reserved_at_a0[0x18];
u8 reserved_at_a8[0x10];
u8 log_max_flow[0x8]; u8 log_max_flow[0x8];
u8 reserved_at_c0[0x40]; u8 reserved_at_c0[0x40];
@@ -8929,7 +8929,7 @@ struct mlx5_ifc_pbmc_reg_bits {
struct mlx5_ifc_bufferx_reg_bits buffer[10]; struct mlx5_ifc_bufferx_reg_bits buffer[10];
u8 reserved_at_2e0[0x40]; u8 reserved_at_2e0[0x80];
}; };
struct mlx5_ifc_qtct_reg_bits { struct mlx5_ifc_qtct_reg_bits {

View File

@@ -62,6 +62,8 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb,
return -EINVAL; return -EINVAL;
} }
skb_reset_mac_header(skb);
if (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { if (hdr->flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) {
u16 start = __virtio16_to_cpu(little_endian, hdr->csum_start); u16 start = __virtio16_to_cpu(little_endian, hdr->csum_start);
u16 off = __virtio16_to_cpu(little_endian, hdr->csum_offset); u16 off = __virtio16_to_cpu(little_endian, hdr->csum_offset);

View File

@@ -70,7 +70,9 @@ struct netns_xfrm {
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
struct dst_ops xfrm6_dst_ops; struct dst_ops xfrm6_dst_ops;
#endif #endif
spinlock_t xfrm_state_lock; spinlock_t xfrm_state_lock;
seqcount_t xfrm_state_hash_generation;
spinlock_t xfrm_policy_lock; spinlock_t xfrm_policy_lock;
struct mutex xfrm_cfg_mutex; struct mutex xfrm_cfg_mutex;
}; };

View File

@@ -171,9 +171,9 @@ static inline void red_set_vars(struct red_vars *v)
static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog, static inline bool red_check_params(u32 qth_min, u32 qth_max, u8 Wlog,
u8 Scell_log, u8 *stab) u8 Scell_log, u8 *stab)
{ {
if (fls(qth_min) + Wlog > 32) if (fls(qth_min) + Wlog >= 32)
return false; return false;
if (fls(qth_max) + Wlog > 32) if (fls(qth_max) + Wlog >= 32)
return false; return false;
if (Scell_log >= 32) if (Scell_log >= 32)
return false; return false;

View File

@@ -1397,7 +1397,6 @@ static void __queue_work(int cpu, struct workqueue_struct *wq,
*/ */
lockdep_assert_irqs_disabled(); lockdep_assert_irqs_disabled();
debug_work_activate(work);
/* if draining, only works from the same workqueue are allowed */ /* if draining, only works from the same workqueue are allowed */
if (unlikely(wq->flags & __WQ_DRAINING) && if (unlikely(wq->flags & __WQ_DRAINING) &&
@@ -1480,6 +1479,7 @@ static void __queue_work(int cpu, struct workqueue_struct *wq,
worklist = &pwq->delayed_works; worklist = &pwq->delayed_works;
} }
debug_work_activate(work);
insert_work(pwq, work, worklist, work_flags); insert_work(pwq, work, worklist, work_flags);
spin_unlock(&pwq->pool->lock); spin_unlock(&pwq->pool->lock);

View File

@@ -904,6 +904,7 @@ batadv_tt_prepare_tvlv_global_data(struct batadv_orig_node *orig_node,
hlist_for_each_entry_rcu(vlan, &orig_node->vlan_list, list) { hlist_for_each_entry_rcu(vlan, &orig_node->vlan_list, list) {
tt_vlan->vid = htons(vlan->vid); tt_vlan->vid = htons(vlan->vid);
tt_vlan->crc = htonl(vlan->tt.crc); tt_vlan->crc = htonl(vlan->tt.crc);
tt_vlan->reserved = 0;
tt_vlan++; tt_vlan++;
} }
@@ -987,6 +988,7 @@ batadv_tt_prepare_tvlv_local_data(struct batadv_priv *bat_priv,
tt_vlan->vid = htons(vlan->vid); tt_vlan->vid = htons(vlan->vid);
tt_vlan->crc = htonl(vlan->tt.crc); tt_vlan->crc = htonl(vlan->tt.crc);
tt_vlan->reserved = 0;
tt_vlan++; tt_vlan++;
} }

View File

@@ -559,9 +559,7 @@ ieee802154_llsec_parse_key_id(struct genl_info *info,
desc->mode = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_KEY_MODE]); desc->mode = nla_get_u8(info->attrs[IEEE802154_ATTR_LLSEC_KEY_MODE]);
if (desc->mode == IEEE802154_SCF_KEY_IMPLICIT) { if (desc->mode == IEEE802154_SCF_KEY_IMPLICIT) {
if (!info->attrs[IEEE802154_ATTR_PAN_ID] && if (!info->attrs[IEEE802154_ATTR_PAN_ID])
!(info->attrs[IEEE802154_ATTR_SHORT_ADDR] ||
info->attrs[IEEE802154_ATTR_HW_ADDR]))
return -EINVAL; return -EINVAL;
desc->device_addr.pan_id = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_PAN_ID]); desc->device_addr.pan_id = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_PAN_ID]);
@@ -570,6 +568,9 @@ ieee802154_llsec_parse_key_id(struct genl_info *info,
desc->device_addr.mode = IEEE802154_ADDR_SHORT; desc->device_addr.mode = IEEE802154_ADDR_SHORT;
desc->device_addr.short_addr = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_SHORT_ADDR]); desc->device_addr.short_addr = nla_get_shortaddr(info->attrs[IEEE802154_ATTR_SHORT_ADDR]);
} else { } else {
if (!info->attrs[IEEE802154_ATTR_HW_ADDR])
return -EINVAL;
desc->device_addr.mode = IEEE802154_ADDR_LONG; desc->device_addr.mode = IEEE802154_ADDR_LONG;
desc->device_addr.extended_addr = nla_get_hwaddr(info->attrs[IEEE802154_ATTR_HW_ADDR]); desc->device_addr.extended_addr = nla_get_hwaddr(info->attrs[IEEE802154_ATTR_HW_ADDR]);
} }

View File

@@ -836,8 +836,13 @@ nl802154_send_iface(struct sk_buff *msg, u32 portid, u32 seq, int flags,
goto nla_put_failure; goto nla_put_failure;
#ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL #ifdef CONFIG_IEEE802154_NL802154_EXPERIMENTAL
if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
goto out;
if (nl802154_get_llsec_params(msg, rdev, wpan_dev) < 0) if (nl802154_get_llsec_params(msg, rdev, wpan_dev) < 0)
goto nla_put_failure; goto nla_put_failure;
out:
#endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */ #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */
genlmsg_end(msg, hdr); genlmsg_end(msg, hdr);
@@ -1402,6 +1407,9 @@ static int nl802154_set_llsec_params(struct sk_buff *skb,
u32 changed = 0; u32 changed = 0;
int ret; int ret;
if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
return -EOPNOTSUPP;
if (info->attrs[NL802154_ATTR_SEC_ENABLED]) { if (info->attrs[NL802154_ATTR_SEC_ENABLED]) {
u8 enabled; u8 enabled;
@@ -1562,7 +1570,8 @@ static int nl802154_add_llsec_key(struct sk_buff *skb, struct genl_info *info)
struct ieee802154_llsec_key_id id = { }; struct ieee802154_llsec_key_id id = { };
u32 commands[NL802154_CMD_FRAME_NR_IDS / 32] = { }; u32 commands[NL802154_CMD_FRAME_NR_IDS / 32] = { };
if (nla_parse_nested(attrs, NL802154_KEY_ATTR_MAX, if (!info->attrs[NL802154_ATTR_SEC_KEY] ||
nla_parse_nested(attrs, NL802154_KEY_ATTR_MAX,
info->attrs[NL802154_ATTR_SEC_KEY], info->attrs[NL802154_ATTR_SEC_KEY],
nl802154_key_policy, info->extack)) nl802154_key_policy, info->extack))
return -EINVAL; return -EINVAL;
@@ -1612,7 +1621,8 @@ static int nl802154_del_llsec_key(struct sk_buff *skb, struct genl_info *info)
struct nlattr *attrs[NL802154_KEY_ATTR_MAX + 1]; struct nlattr *attrs[NL802154_KEY_ATTR_MAX + 1];
struct ieee802154_llsec_key_id id; struct ieee802154_llsec_key_id id;
if (nla_parse_nested(attrs, NL802154_KEY_ATTR_MAX, if (!info->attrs[NL802154_ATTR_SEC_KEY] ||
nla_parse_nested(attrs, NL802154_KEY_ATTR_MAX,
info->attrs[NL802154_ATTR_SEC_KEY], info->attrs[NL802154_ATTR_SEC_KEY],
nl802154_key_policy, info->extack)) nl802154_key_policy, info->extack))
return -EINVAL; return -EINVAL;
@@ -1780,7 +1790,8 @@ static int nl802154_del_llsec_dev(struct sk_buff *skb, struct genl_info *info)
struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1]; struct nlattr *attrs[NL802154_DEV_ATTR_MAX + 1];
__le64 extended_addr; __le64 extended_addr;
if (nla_parse_nested(attrs, NL802154_DEV_ATTR_MAX, if (!info->attrs[NL802154_ATTR_SEC_DEVICE] ||
nla_parse_nested(attrs, NL802154_DEV_ATTR_MAX,
info->attrs[NL802154_ATTR_SEC_DEVICE], info->attrs[NL802154_ATTR_SEC_DEVICE],
nl802154_dev_policy, info->extack)) nl802154_dev_policy, info->extack))
return -EINVAL; return -EINVAL;
@@ -1940,7 +1951,8 @@ static int nl802154_del_llsec_devkey(struct sk_buff *skb, struct genl_info *info
struct ieee802154_llsec_device_key key; struct ieee802154_llsec_device_key key;
__le64 extended_addr; __le64 extended_addr;
if (nla_parse_nested(attrs, NL802154_DEVKEY_ATTR_MAX, if (!info->attrs[NL802154_ATTR_SEC_DEVKEY] ||
nla_parse_nested(attrs, NL802154_DEVKEY_ATTR_MAX,
info->attrs[NL802154_ATTR_SEC_DEVKEY], info->attrs[NL802154_ATTR_SEC_DEVKEY],
nl802154_devkey_policy, info->extack)) nl802154_devkey_policy, info->extack))
return -EINVAL; return -EINVAL;
@@ -2115,6 +2127,9 @@ static int nl802154_del_llsec_seclevel(struct sk_buff *skb,
struct wpan_dev *wpan_dev = dev->ieee802154_ptr; struct wpan_dev *wpan_dev = dev->ieee802154_ptr;
struct ieee802154_llsec_seclevel sl; struct ieee802154_llsec_seclevel sl;
if (wpan_dev->iftype == NL802154_IFTYPE_MONITOR)
return -EOPNOTSUPP;
if (!info->attrs[NL802154_ATTR_SEC_LEVEL] || if (!info->attrs[NL802154_ATTR_SEC_LEVEL] ||
llsec_parse_seclevel(info->attrs[NL802154_ATTR_SEC_LEVEL], llsec_parse_seclevel(info->attrs[NL802154_ATTR_SEC_LEVEL],
&sl) < 0) &sl) < 0)

View File

@@ -303,7 +303,7 @@ static int rawv6_bind(struct sock *sk, struct sockaddr *uaddr, int addr_len)
*/ */
v4addr = LOOPBACK4_IPV6; v4addr = LOOPBACK4_IPV6;
if (!(addr_type & IPV6_ADDR_MULTICAST) && if (!(addr_type & IPV6_ADDR_MULTICAST) &&
!sock_net(sk)->ipv6.sysctl.ip_nonlocal_bind) { !ipv6_can_nonlocal_bind(sock_net(sk), inet)) {
err = -EADDRNOTAVAIL; err = -EADDRNOTAVAIL;
if (!ipv6_chk_addr(sock_net(sk), &addr->sin6_addr, if (!ipv6_chk_addr(sock_net(sk), &addr->sin6_addr,
dev, 0)) { dev, 0)) {

View File

@@ -4491,9 +4491,11 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
* nexthops have been replaced by first new, the rest should * nexthops have been replaced by first new, the rest should
* be added to it. * be added to it.
*/ */
cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL | if (cfg->fc_nlinfo.nlh) {
NLM_F_REPLACE); cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL |
cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE; NLM_F_REPLACE);
cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE;
}
nhn++; nhn++;
} }

View File

@@ -160,7 +160,7 @@ llsec_key_alloc(const struct ieee802154_llsec_key *template)
crypto_free_skcipher(key->tfm0); crypto_free_skcipher(key->tfm0);
err_tfm: err_tfm:
for (i = 0; i < ARRAY_SIZE(key->tfm); i++) for (i = 0; i < ARRAY_SIZE(key->tfm); i++)
if (key->tfm[i]) if (!IS_ERR_OR_NULL(key->tfm[i]))
crypto_free_aead(key->tfm[i]); crypto_free_aead(key->tfm[i]);
kzfree(key); kzfree(key);

View File

@@ -84,13 +84,20 @@ static void ncsi_channel_monitor(struct timer_list *t)
monitor_state = nc->monitor.state; monitor_state = nc->monitor.state;
spin_unlock_irqrestore(&nc->lock, flags); spin_unlock_irqrestore(&nc->lock, flags);
if (!enabled || chained) { if (!enabled)
ncsi_stop_channel_monitor(nc); return; /* expected race disabling timer */
return; if (WARN_ON_ONCE(chained))
} goto bad_state;
if (state != NCSI_CHANNEL_INACTIVE && if (state != NCSI_CHANNEL_INACTIVE &&
state != NCSI_CHANNEL_ACTIVE) { state != NCSI_CHANNEL_ACTIVE) {
ncsi_stop_channel_monitor(nc); bad_state:
netdev_warn(ndp->ndev.dev,
"Bad NCSI monitor state channel %d 0x%x %s queue\n",
nc->id, state, chained ? "on" : "off");
spin_lock_irqsave(&nc->lock, flags);
nc->monitor.enabled = false;
spin_unlock_irqrestore(&nc->lock, flags);
return; return;
} }
@@ -117,10 +124,9 @@ static void ncsi_channel_monitor(struct timer_list *t)
ndp->flags |= NCSI_DEV_RESHUFFLE; ndp->flags |= NCSI_DEV_RESHUFFLE;
} }
ncsi_stop_channel_monitor(nc);
ncm = &nc->modes[NCSI_MODE_LINK]; ncm = &nc->modes[NCSI_MODE_LINK];
spin_lock_irqsave(&nc->lock, flags); spin_lock_irqsave(&nc->lock, flags);
nc->monitor.enabled = false;
nc->state = NCSI_CHANNEL_INVISIBLE; nc->state = NCSI_CHANNEL_INVISIBLE;
ncm->data[2] &= ~0x1; ncm->data[2] &= ~0x1;
spin_unlock_irqrestore(&nc->lock, flags); spin_unlock_irqrestore(&nc->lock, flags);

View File

@@ -120,11 +120,13 @@ static int llcp_sock_bind(struct socket *sock, struct sockaddr *addr, int alen)
llcp_sock->service_name_len, llcp_sock->service_name_len,
GFP_KERNEL); GFP_KERNEL);
if (!llcp_sock->service_name) { if (!llcp_sock->service_name) {
nfc_llcp_local_put(llcp_sock->local);
ret = -ENOMEM; ret = -ENOMEM;
goto put_dev; goto put_dev;
} }
llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock); llcp_sock->ssap = nfc_llcp_get_sdp_ssap(local, llcp_sock);
if (llcp_sock->ssap == LLCP_SAP_MAX) { if (llcp_sock->ssap == LLCP_SAP_MAX) {
nfc_llcp_local_put(llcp_sock->local);
kfree(llcp_sock->service_name); kfree(llcp_sock->service_name);
llcp_sock->service_name = NULL; llcp_sock->service_name = NULL;
ret = -EADDRINUSE; ret = -EADDRINUSE;
@@ -683,6 +685,10 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
ret = -EISCONN; ret = -EISCONN;
goto error; goto error;
} }
if (sk->sk_state == LLCP_CONNECTING) {
ret = -EINPROGRESS;
goto error;
}
dev = nfc_get_device(addr->dev_idx); dev = nfc_get_device(addr->dev_idx);
if (dev == NULL) { if (dev == NULL) {
@@ -714,6 +720,7 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
llcp_sock->local = nfc_llcp_local_get(local); llcp_sock->local = nfc_llcp_local_get(local);
llcp_sock->ssap = nfc_llcp_get_local_ssap(local); llcp_sock->ssap = nfc_llcp_get_local_ssap(local);
if (llcp_sock->ssap == LLCP_SAP_MAX) { if (llcp_sock->ssap == LLCP_SAP_MAX) {
nfc_llcp_local_put(llcp_sock->local);
ret = -ENOMEM; ret = -ENOMEM;
goto put_dev; goto put_dev;
} }
@@ -751,8 +758,11 @@ static int llcp_sock_connect(struct socket *sock, struct sockaddr *_addr,
sock_unlink: sock_unlink:
nfc_llcp_put_ssap(local, llcp_sock->ssap); nfc_llcp_put_ssap(local, llcp_sock->ssap);
nfc_llcp_local_put(llcp_sock->local);
nfc_llcp_sock_unlink(&local->connecting_sockets, sk); nfc_llcp_sock_unlink(&local->connecting_sockets, sk);
kfree(llcp_sock->service_name);
llcp_sock->service_name = NULL;
put_dev: put_dev:
nfc_put_device(dev); nfc_put_device(dev);

View File

@@ -900,6 +900,9 @@ struct tc_action *tcf_action_init_1(struct net *net, struct tcf_proto *tp,
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
} }
if (!bind && ovr && err == ACT_P_CREATED)
refcount_set(&a->tcfa_refcnt, 2);
return a; return a;
err_mod: err_mod:

View File

@@ -138,6 +138,9 @@ teql_destroy(struct Qdisc *sch)
struct teql_sched_data *dat = qdisc_priv(sch); struct teql_sched_data *dat = qdisc_priv(sch);
struct teql_master *master = dat->m; struct teql_master *master = dat->m;
if (!master)
return;
prev = master->slaves; prev = master->slaves;
if (prev) { if (prev) {
do { do {

View File

@@ -655,8 +655,8 @@ static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp)
if (!(type & IPV6_ADDR_UNICAST)) if (!(type & IPV6_ADDR_UNICAST))
return 0; return 0;
return sp->inet.freebind || net->ipv6.sysctl.ip_nonlocal_bind || return ipv6_can_nonlocal_bind(net, &sp->inet) ||
ipv6_chk_addr(net, in6, NULL, 0); ipv6_chk_addr(net, in6, NULL, 0);
} }
/* This function checks if the address is a valid address to be used for /* This function checks if the address is a valid address to be used for
@@ -945,8 +945,7 @@ static int sctp_inet6_bind_verify(struct sctp_sock *opt, union sctp_addr *addr)
net = sock_net(&opt->inet.sk); net = sock_net(&opt->inet.sk);
rcu_read_lock(); rcu_read_lock();
dev = dev_get_by_index_rcu(net, addr->v6.sin6_scope_id); dev = dev_get_by_index_rcu(net, addr->v6.sin6_scope_id);
if (!dev || !(opt->inet.freebind || if (!dev || !(ipv6_can_nonlocal_bind(net, &opt->inet) ||
net->ipv6.sysctl.ip_nonlocal_bind ||
ipv6_chk_addr(net, &addr->v6.sin6_addr, ipv6_chk_addr(net, &addr->v6.sin6_addr,
dev, 0))) { dev, 0))) {
rcu_read_unlock(); rcu_read_unlock();

View File

@@ -1187,7 +1187,7 @@ void tipc_sk_mcast_rcv(struct net *net, struct sk_buff_head *arrvq,
spin_lock_bh(&inputq->lock); spin_lock_bh(&inputq->lock);
if (skb_peek(arrvq) == skb) { if (skb_peek(arrvq) == skb) {
skb_queue_splice_tail_init(&tmpq, inputq); skb_queue_splice_tail_init(&tmpq, inputq);
kfree_skb(__skb_dequeue(arrvq)); __skb_dequeue(arrvq);
} }
spin_unlock_bh(&inputq->lock); spin_unlock_bh(&inputq->lock);
__skb_queue_purge(&tmpq); __skb_queue_purge(&tmpq);

View File

@@ -530,7 +530,7 @@ static int cfg80211_sme_connect(struct wireless_dev *wdev,
cfg80211_sme_free(wdev); cfg80211_sme_free(wdev);
} }
if (WARN_ON(wdev->conn)) if (wdev->conn)
return -EINPROGRESS; return -EINPROGRESS;
wdev->conn = kzalloc(sizeof(*wdev->conn), GFP_KERNEL); wdev->conn = kzalloc(sizeof(*wdev->conn), GFP_KERNEL);

View File

@@ -302,6 +302,8 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); icmpv6_ndo_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu);
} else { } else {
if (!(ip_hdr(skb)->frag_off & htons(IP_DF)))
goto xmit;
icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, icmp_ndo_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,
htonl(mtu)); htonl(mtu));
} }
@@ -310,6 +312,7 @@ xfrmi_xmit2(struct sk_buff *skb, struct net_device *dev, struct flowi *fl)
return -EMSGSIZE; return -EMSGSIZE;
} }
xmit:
xfrmi_scrub_packet(skb, !net_eq(xi->net, dev_net(dev))); xfrmi_scrub_packet(skb, !net_eq(xi->net, dev_net(dev)));
skb_dst_set(skb, dst); skb_dst_set(skb, dst);
skb->dev = tdev; skb->dev = tdev;

View File

@@ -41,7 +41,6 @@ static void xfrm_state_gc_task(struct work_struct *work);
*/ */
static unsigned int xfrm_state_hashmax __read_mostly = 1 * 1024 * 1024; static unsigned int xfrm_state_hashmax __read_mostly = 1 * 1024 * 1024;
static __read_mostly seqcount_t xfrm_state_hash_generation = SEQCNT_ZERO(xfrm_state_hash_generation);
static struct kmem_cache *xfrm_state_cache __ro_after_init; static struct kmem_cache *xfrm_state_cache __ro_after_init;
static DECLARE_WORK(xfrm_state_gc_work, xfrm_state_gc_task); static DECLARE_WORK(xfrm_state_gc_work, xfrm_state_gc_task);
@@ -137,7 +136,7 @@ static void xfrm_hash_resize(struct work_struct *work)
} }
spin_lock_bh(&net->xfrm.xfrm_state_lock); spin_lock_bh(&net->xfrm.xfrm_state_lock);
write_seqcount_begin(&xfrm_state_hash_generation); write_seqcount_begin(&net->xfrm.xfrm_state_hash_generation);
nhashmask = (nsize / sizeof(struct hlist_head)) - 1U; nhashmask = (nsize / sizeof(struct hlist_head)) - 1U;
odst = xfrm_state_deref_prot(net->xfrm.state_bydst, net); odst = xfrm_state_deref_prot(net->xfrm.state_bydst, net);
@@ -153,7 +152,7 @@ static void xfrm_hash_resize(struct work_struct *work)
rcu_assign_pointer(net->xfrm.state_byspi, nspi); rcu_assign_pointer(net->xfrm.state_byspi, nspi);
net->xfrm.state_hmask = nhashmask; net->xfrm.state_hmask = nhashmask;
write_seqcount_end(&xfrm_state_hash_generation); write_seqcount_end(&net->xfrm.xfrm_state_hash_generation);
spin_unlock_bh(&net->xfrm.xfrm_state_lock); spin_unlock_bh(&net->xfrm.xfrm_state_lock);
osize = (ohashmask + 1) * sizeof(struct hlist_head); osize = (ohashmask + 1) * sizeof(struct hlist_head);
@@ -965,7 +964,7 @@ xfrm_state_find(const xfrm_address_t *daddr, const xfrm_address_t *saddr,
to_put = NULL; to_put = NULL;
sequence = read_seqcount_begin(&xfrm_state_hash_generation); sequence = read_seqcount_begin(&net->xfrm.xfrm_state_hash_generation);
rcu_read_lock(); rcu_read_lock();
h = xfrm_dst_hash(net, daddr, saddr, tmpl->reqid, encap_family); h = xfrm_dst_hash(net, daddr, saddr, tmpl->reqid, encap_family);
@@ -1076,7 +1075,7 @@ xfrm_state_find(const xfrm_address_t *daddr, const xfrm_address_t *saddr,
if (to_put) if (to_put)
xfrm_state_put(to_put); xfrm_state_put(to_put);
if (read_seqcount_retry(&xfrm_state_hash_generation, sequence)) { if (read_seqcount_retry(&net->xfrm.xfrm_state_hash_generation, sequence)) {
*err = -EAGAIN; *err = -EAGAIN;
if (x) { if (x) {
xfrm_state_put(x); xfrm_state_put(x);
@@ -2478,6 +2477,7 @@ int __net_init xfrm_state_init(struct net *net)
net->xfrm.state_num = 0; net->xfrm.state_num = 0;
INIT_WORK(&net->xfrm.state_hash_work, xfrm_hash_resize); INIT_WORK(&net->xfrm.state_hash_work, xfrm_hash_resize);
spin_lock_init(&net->xfrm.xfrm_state_lock); spin_lock_init(&net->xfrm.xfrm_state_lock);
seqcount_init(&net->xfrm.xfrm_state_hash_generation);
return 0; return 0;
out_byspi: out_byspi:

View File

@@ -1047,6 +1047,14 @@ static int loopback_mixer_new(struct loopback *loopback, int notify)
return -ENOMEM; return -ENOMEM;
kctl->id.device = dev; kctl->id.device = dev;
kctl->id.subdevice = substr; kctl->id.subdevice = substr;
/* Add the control before copying the id so that
* the numid field of the id is set in the copy.
*/
err = snd_ctl_add(card, kctl);
if (err < 0)
return err;
switch (idx) { switch (idx) {
case ACTIVE_IDX: case ACTIVE_IDX:
setup->active_id = kctl->id; setup->active_id = kctl->id;
@@ -1063,9 +1071,6 @@ static int loopback_mixer_new(struct loopback *loopback, int notify)
default: default:
break; break;
} }
err = snd_ctl_add(card, kctl);
if (err < 0)
return err;
} }
} }
} }

View File

@@ -710,7 +710,13 @@ int wm8960_configure_pll(struct snd_soc_component *component, int freq_in,
best_freq_out = -EINVAL; best_freq_out = -EINVAL;
*sysclk_idx = *dac_idx = *bclk_idx = -1; *sysclk_idx = *dac_idx = *bclk_idx = -1;
for (i = 0; i < ARRAY_SIZE(sysclk_divs); ++i) { /*
* From Datasheet, the PLL performs best when f2 is between
* 90MHz and 100MHz, the desired sysclk output is 11.2896MHz
* or 12.288MHz, then sysclkdiv = 2 is the best choice.
* So search sysclk_divs from 2 to 1 other than from 1 to 2.
*/
for (i = ARRAY_SIZE(sysclk_divs) - 1; i >= 0; --i) {
if (sysclk_divs[i] == -1) if (sysclk_divs[i] == -1)
continue; continue;
for (j = 0; j < ARRAY_SIZE(dac_divs); ++j) { for (j = 0; j < ARRAY_SIZE(dac_divs); ++j) {

View File

@@ -508,14 +508,14 @@ static struct snd_soc_dai_driver sst_platform_dai[] = {
.channels_min = SST_STEREO, .channels_min = SST_STEREO,
.channels_max = SST_STEREO, .channels_max = SST_STEREO,
.rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, .formats = SNDRV_PCM_FMTBIT_S16_LE,
}, },
.capture = { .capture = {
.stream_name = "Headset Capture", .stream_name = "Headset Capture",
.channels_min = 1, .channels_min = 1,
.channels_max = 2, .channels_max = 2,
.rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, .formats = SNDRV_PCM_FMTBIT_S16_LE,
}, },
}, },
{ {
@@ -526,7 +526,7 @@ static struct snd_soc_dai_driver sst_platform_dai[] = {
.channels_min = SST_STEREO, .channels_min = SST_STEREO,
.channels_max = SST_STEREO, .channels_max = SST_STEREO,
.rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000, .rates = SNDRV_PCM_RATE_44100|SNDRV_PCM_RATE_48000,
.formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE, .formats = SNDRV_PCM_FMTBIT_S16_LE,
}, },
}, },
{ {

View File

@@ -1235,6 +1235,7 @@ static struct snd_soc_card *sun4i_codec_create_card(struct device *dev)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
card->dev = dev; card->dev = dev;
card->owner = THIS_MODULE;
card->name = "sun4i-codec"; card->name = "sun4i-codec";
card->dapm_widgets = sun4i_codec_card_dapm_widgets; card->dapm_widgets = sun4i_codec_card_dapm_widgets;
card->num_dapm_widgets = ARRAY_SIZE(sun4i_codec_card_dapm_widgets); card->num_dapm_widgets = ARRAY_SIZE(sun4i_codec_card_dapm_widgets);
@@ -1267,6 +1268,7 @@ static struct snd_soc_card *sun6i_codec_create_card(struct device *dev)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
card->dev = dev; card->dev = dev;
card->owner = THIS_MODULE;
card->name = "A31 Audio Codec"; card->name = "A31 Audio Codec";
card->dapm_widgets = sun6i_codec_card_dapm_widgets; card->dapm_widgets = sun6i_codec_card_dapm_widgets;
card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets);
@@ -1320,6 +1322,7 @@ static struct snd_soc_card *sun8i_a23_codec_create_card(struct device *dev)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
card->dev = dev; card->dev = dev;
card->owner = THIS_MODULE;
card->name = "A23 Audio Codec"; card->name = "A23 Audio Codec";
card->dapm_widgets = sun6i_codec_card_dapm_widgets; card->dapm_widgets = sun6i_codec_card_dapm_widgets;
card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets);
@@ -1358,6 +1361,7 @@ static struct snd_soc_card *sun8i_h3_codec_create_card(struct device *dev)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
card->dev = dev; card->dev = dev;
card->owner = THIS_MODULE;
card->name = "H3 Audio Codec"; card->name = "H3 Audio Codec";
card->dapm_widgets = sun6i_codec_card_dapm_widgets; card->dapm_widgets = sun6i_codec_card_dapm_widgets;
card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets);
@@ -1396,6 +1400,7 @@ static struct snd_soc_card *sun8i_v3s_codec_create_card(struct device *dev)
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
card->dev = dev; card->dev = dev;
card->owner = THIS_MODULE;
card->name = "V3s Audio Codec"; card->name = "V3s Audio Codec";
card->dapm_widgets = sun6i_codec_card_dapm_widgets; card->dapm_widgets = sun6i_codec_card_dapm_widgets;
card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets); card->num_dapm_widgets = ARRAY_SIZE(sun6i_codec_card_dapm_widgets);