Merge 5.10.168 into android12-5.10-lts

Changes in 5.10.168
	firewire: fix memory leak for payload of request subaction to IEC 61883-1 FCP region
	bus: sunxi-rsb: Fix error handling in sunxi_rsb_init()
	bpf: Fix incorrect state pruning for <8B spill/fill
	powerpc/imc-pmu: Revert nest_init_lock to being a mutex
	bpf: Fix a possible task gone issue with bpf_send_signal[_thread]() helpers
	ALSA: hda/via: Avoid potential array out-of-bound in add_secret_dac_path()
	bpf: Support <8-byte scalar spill and refill
	bpf: Fix to preserve reg parent/live fields when copying range info
	bpf, sockmap: Check for any of tcp_bpf_prots when cloning a listener
	arm64: dts: imx8mm: Fix pad control for UART1_DTE_RX
	drm/vc4: hdmi: make CEC adapter name unique
	scsi: Revert "scsi: core: map PQ=1, PDT=other values to SCSI_SCAN_TARGET_PRESENT"
	vhost/net: Clear the pending messages when the backend is removed
	WRITE is "data source", not destination...
	READ is "data destination", not source...
	fix iov_iter_bvec() "direction" argument
	fix "direction" argument of iov_iter_kvec()
	virtio-net: execute xdp_do_flush() before napi_complete_done()
	sfc: correctly advertise tunneled IPv6 segmentation
	net: phy: dp83822: Fix null pointer access on DP83825/DP83826 devices
	netrom: Fix use-after-free caused by accept on already connected socket
	netfilter: br_netfilter: disable sabotage_in hook after first suppression
	squashfs: harden sanity check in squashfs_read_xattr_id_table
	net: phy: meson-gxl: Add generic dummy stubs for MMD register access
	igc: return an error if the mac type is unknown in igc_ptp_systim_to_hwtstamp()
	can: j1939: fix errant WARN_ON_ONCE in j1939_session_deactivate
	ata: libata: Fix sata_down_spd_limit() when no link speed is reported
	selftests: net: udpgso_bench_rx: Fix 'used uninitialized' compiler warning
	selftests: net: udpgso_bench_rx/tx: Stop when wrong CLI args are provided
	selftests: net: udpgso_bench: Fix racing bug between the rx/tx programs
	selftests: net: udpgso_bench_tx: Cater for pending datagrams zerocopy benchmarking
	virtio-net: Keep stop() to follow mirror sequence of open()
	net: openvswitch: fix flow memory leak in ovs_flow_cmd_new
	efi: fix potential NULL deref in efi_mem_reserve_persistent
	qede: add netpoll support for qede driver
	qede: execute xdp_do_flush() before napi_complete_done()
	i2c: mxs: suppress probe-deferral error message
	scsi: target: core: Fix warning on RT kernels
	scsi: iscsi_tcp: Fix UAF during login when accessing the shost ipaddress
	i2c: rk3x: fix a bunch of kernel-doc warnings
	platform/x86: dell-wmi: Add a keymap for KEY_MUTE in type 0x0010 table
	net/x25: Fix to not accept on connected socket
	iio: adc: stm32-dfsdm: fill module aliases
	usb: dwc3: dwc3-qcom: Fix typo in the dwc3 vbus override API
	usb: dwc3: qcom: enable vbus override when in OTG dr-mode
	usb: gadget: f_fs: Fix unbalanced spinlock in __ffs_ep0_queue_wait
	vc_screen: move load of struct vc_data pointer in vcs_read() to avoid UAF
	Input: i8042 - move __initconst to fix code styling warning
	Input: i8042 - merge quirk tables
	Input: i8042 - add TUXEDO devices to i8042 quirk tables
	Input: i8042 - add Clevo PCX0DX to i8042 quirk table
	fbcon: Check font dimension limits
	net: qrtr: free memory on error path in radix_tree_insert()
	watchdog: diag288_wdt: do not use stack buffers for hardware data
	watchdog: diag288_wdt: fix __diag288() inline assembly
	ALSA: hda/realtek: Add Acer Predator PH315-54
	efi: Accept version 2 of memory attributes table
	iio: hid: fix the retval in accel_3d_capture_sample
	iio: adc: berlin2-adc: Add missing of_node_put() in error path
	iio:adc:twl6030: Enable measurements of VUSB, VBAT and others
	iio: imu: fxos8700: fix ACCEL measurement range selection
	iio: imu: fxos8700: fix incomplete ACCEL and MAGN channels readback
	iio: imu: fxos8700: fix IMU data bits returned to user space
	iio: imu: fxos8700: fix map label of channel type to MAGN sensor
	iio: imu: fxos8700: fix swapped ACCEL and MAGN channels readback
	iio: imu: fxos8700: fix incorrect ODR mode readback
	iio: imu: fxos8700: fix failed initialization ODR mode assignment
	iio: imu: fxos8700: remove definition FXOS8700_CTRL_ODR_MIN
	iio: imu: fxos8700: fix MAGN sensor scale and unit
	nvmem: qcom-spmi-sdam: fix module autoloading
	parisc: Fix return code of pdc_iodc_print()
	parisc: Wire up PTRACE_GETREGS/PTRACE_SETREGS for compat case
	riscv: disable generation of unwind tables
	mm: hugetlb: proc: check for hugetlb shared PMD in /proc/PID/smaps
	x86/debug: Fix stack recursion caused by wrongly ordered DR7 accesses
	fpga: stratix10-soc: Fix return value check in s10_ops_write_init()
	mm/swapfile: add cond_resched() in get_swap_pages()
	Squashfs: fix handling and sanity checking of xattr_ids count
	drm/i915: Fix potential bit_17 double-free
	nvmem: core: initialise nvmem->id early
	nvmem: core: fix cell removal on error
	serial: 8250_dma: Fix DMA Rx completion race
	serial: 8250_dma: Fix DMA Rx rearm race
	fbdev: smscufx: fix error handling code in ufx_usb_probe
	f2fs: fix to do sanity check on i_extra_isize in is_alive()
	wifi: brcmfmac: Check the count value of channel spec to prevent out-of-bounds reads
	nvmem: core: Fix a conflict between MTD and NVMEM on wp-gpios property
	bpf: Do not reject when the stack read size is different from the tracked scalar size
	iio:adc:twl6030: Enable measurement of VAC
	mm/migration: return errno when isolate_huge_page failed
	migrate: hugetlb: check for hugetlb shared PMD in node migration
	btrfs: limit device extents to the device size
	btrfs: zlib: zero-initialize zlib workspace
	ALSA: hda/realtek: Add Positivo N14KP6-TG
	ALSA: emux: Avoid potential array out-of-bound in snd_emux_xg_control()
	ALSA: hda/realtek: Fix the speaker output on Samsung Galaxy Book2 Pro 360
	tracing: Fix poll() and select() do not work on per_cpu trace_pipe and trace_pipe_raw
	of/address: Return an error when no valid dma-ranges are found
	can: j1939: do not wait 250 ms if the same addr was already claimed
	xfrm: compat: change expression for switch in xfrm_xlate64
	IB/hfi1: Restore allocated resources on failed copyout
	xfrm/compat: prevent potential spectre v1 gadget in xfrm_xlate32_attr()
	IB/IPoIB: Fix legacy IPoIB due to wrong number of queues
	RDMA/usnic: use iommu_map_atomic() under spin_lock()
	xfrm: fix bug with DSCP copy to v6 from v4 tunnel
	bonding: fix error checking in bond_debug_reregister()
	net: phy: meson-gxl: use MMD access dummy stubs for GXL, internal PHY
	ionic: clean interrupt before enabling queue to avoid credit race
	uapi: add missing ip/ipv6 header dependencies for linux/stddef.h
	ice: Do not use WQ_MEM_RECLAIM flag for workqueue
	net: mscc: ocelot: fix VCAP filters not matching on MAC with "protocol 802.1Q"
	net/mlx5e: IPoIB, Show unknown speed instead of error
	net/mlx5: fw_tracer, Clear load bit when freeing string DBs buffers
	net/mlx5: fw_tracer, Zero consumer index when reloading the tracer
	rds: rds_rm_zerocopy_callback() use list_first_entry()
	selftests: forwarding: lib: quote the sysctl values
	ALSA: pci: lx6464es: fix a debug loop
	pinctrl: aspeed: Fix confusing types in return value
	pinctrl: single: fix potential NULL dereference
	spi: dw: Fix wrong FIFO level setting for long xfers
	pinctrl: intel: Restore the pins that used to be in Direct IRQ mode
	cifs: Fix use-after-free in rdata->read_into_pages()
	net: USB: Fix wrong-direction WARNING in plusb.c
	btrfs: free device in btrfs_close_devices for a single device filesystem
	usb: core: add quirk for Alcor Link AK9563 smartcard reader
	usb: typec: altmodes/displayport: Fix probe pin assign check
	ceph: flush cap releases when the session is flushed
	riscv: Fixup race condition on PG_dcache_clean in flush_icache_pte
	arm64: dts: meson-gx: Make mmc host controller interrupts level-sensitive
	arm64: dts: meson-g12-common: Make mmc host controller interrupts level-sensitive
	arm64: dts: meson-axg: Make mmc host controller interrupts level-sensitive
	Fix page corruption caused by racy check in __free_pages
	Linux 5.10.168

Change-Id: I98d1e73edfaab3ce45c15283ae0964527d5e547e
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Greg Kroah-Hartman 2023-02-16 14:12:07 +00:00
commit 570621d64f
116 changed files with 1854 additions and 1141 deletions

View File

@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
VERSION = 5 VERSION = 5
PATCHLEVEL = 10 PATCHLEVEL = 10
SUBLEVEL = 167 SUBLEVEL = 168
EXTRAVERSION = EXTRAVERSION =
NAME = Dare mighty things NAME = Dare mighty things

View File

@ -1754,7 +1754,7 @@ apb: bus@ffe00000 {
sd_emmc_b: sd@5000 { sd_emmc_b: sd@5000 {
compatible = "amlogic,meson-axg-mmc"; compatible = "amlogic,meson-axg-mmc";
reg = <0x0 0x5000 0x0 0x800>; reg = <0x0 0x5000 0x0 0x800>;
interrupts = <GIC_SPI 217 IRQ_TYPE_EDGE_RISING>; interrupts = <GIC_SPI 217 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled"; status = "disabled";
clocks = <&clkc CLKID_SD_EMMC_B>, clocks = <&clkc CLKID_SD_EMMC_B>,
<&clkc CLKID_SD_EMMC_B_CLK0>, <&clkc CLKID_SD_EMMC_B_CLK0>,
@ -1766,7 +1766,7 @@ sd_emmc_b: sd@5000 {
sd_emmc_c: mmc@7000 { sd_emmc_c: mmc@7000 {
compatible = "amlogic,meson-axg-mmc"; compatible = "amlogic,meson-axg-mmc";
reg = <0x0 0x7000 0x0 0x800>; reg = <0x0 0x7000 0x0 0x800>;
interrupts = <GIC_SPI 218 IRQ_TYPE_EDGE_RISING>; interrupts = <GIC_SPI 218 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled"; status = "disabled";
clocks = <&clkc CLKID_SD_EMMC_C>, clocks = <&clkc CLKID_SD_EMMC_C>,
<&clkc CLKID_SD_EMMC_C_CLK0>, <&clkc CLKID_SD_EMMC_C_CLK0>,

View File

@ -2317,7 +2317,7 @@ uart_A: serial@24000 {
sd_emmc_a: sd@ffe03000 { sd_emmc_a: sd@ffe03000 {
compatible = "amlogic,meson-axg-mmc"; compatible = "amlogic,meson-axg-mmc";
reg = <0x0 0xffe03000 0x0 0x800>; reg = <0x0 0xffe03000 0x0 0x800>;
interrupts = <GIC_SPI 189 IRQ_TYPE_EDGE_RISING>; interrupts = <GIC_SPI 189 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled"; status = "disabled";
clocks = <&clkc CLKID_SD_EMMC_A>, clocks = <&clkc CLKID_SD_EMMC_A>,
<&clkc CLKID_SD_EMMC_A_CLK0>, <&clkc CLKID_SD_EMMC_A_CLK0>,
@ -2329,7 +2329,7 @@ sd_emmc_a: sd@ffe03000 {
sd_emmc_b: sd@ffe05000 { sd_emmc_b: sd@ffe05000 {
compatible = "amlogic,meson-axg-mmc"; compatible = "amlogic,meson-axg-mmc";
reg = <0x0 0xffe05000 0x0 0x800>; reg = <0x0 0xffe05000 0x0 0x800>;
interrupts = <GIC_SPI 190 IRQ_TYPE_EDGE_RISING>; interrupts = <GIC_SPI 190 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled"; status = "disabled";
clocks = <&clkc CLKID_SD_EMMC_B>, clocks = <&clkc CLKID_SD_EMMC_B>,
<&clkc CLKID_SD_EMMC_B_CLK0>, <&clkc CLKID_SD_EMMC_B_CLK0>,
@ -2341,7 +2341,7 @@ sd_emmc_b: sd@ffe05000 {
sd_emmc_c: mmc@ffe07000 { sd_emmc_c: mmc@ffe07000 {
compatible = "amlogic,meson-axg-mmc"; compatible = "amlogic,meson-axg-mmc";
reg = <0x0 0xffe07000 0x0 0x800>; reg = <0x0 0xffe07000 0x0 0x800>;
interrupts = <GIC_SPI 191 IRQ_TYPE_EDGE_RISING>; interrupts = <GIC_SPI 191 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled"; status = "disabled";
clocks = <&clkc CLKID_SD_EMMC_C>, clocks = <&clkc CLKID_SD_EMMC_C>,
<&clkc CLKID_SD_EMMC_C_CLK0>, <&clkc CLKID_SD_EMMC_C_CLK0>,

View File

@ -595,21 +595,21 @@ apb: apb@d0000000 {
sd_emmc_a: mmc@70000 { sd_emmc_a: mmc@70000 {
compatible = "amlogic,meson-gx-mmc", "amlogic,meson-gxbb-mmc"; compatible = "amlogic,meson-gx-mmc", "amlogic,meson-gxbb-mmc";
reg = <0x0 0x70000 0x0 0x800>; reg = <0x0 0x70000 0x0 0x800>;
interrupts = <GIC_SPI 216 IRQ_TYPE_EDGE_RISING>; interrupts = <GIC_SPI 216 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled"; status = "disabled";
}; };
sd_emmc_b: mmc@72000 { sd_emmc_b: mmc@72000 {
compatible = "amlogic,meson-gx-mmc", "amlogic,meson-gxbb-mmc"; compatible = "amlogic,meson-gx-mmc", "amlogic,meson-gxbb-mmc";
reg = <0x0 0x72000 0x0 0x800>; reg = <0x0 0x72000 0x0 0x800>;
interrupts = <GIC_SPI 217 IRQ_TYPE_EDGE_RISING>; interrupts = <GIC_SPI 217 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled"; status = "disabled";
}; };
sd_emmc_c: mmc@74000 { sd_emmc_c: mmc@74000 {
compatible = "amlogic,meson-gx-mmc", "amlogic,meson-gxbb-mmc"; compatible = "amlogic,meson-gx-mmc", "amlogic,meson-gxbb-mmc";
reg = <0x0 0x74000 0x0 0x800>; reg = <0x0 0x74000 0x0 0x800>;
interrupts = <GIC_SPI 218 IRQ_TYPE_EDGE_RISING>; interrupts = <GIC_SPI 218 IRQ_TYPE_LEVEL_HIGH>;
status = "disabled"; status = "disabled";
}; };
}; };

View File

@ -601,7 +601,7 @@
#define MX8MM_IOMUXC_UART1_RXD_GPIO5_IO22 0x234 0x49C 0x000 0x5 0x0 #define MX8MM_IOMUXC_UART1_RXD_GPIO5_IO22 0x234 0x49C 0x000 0x5 0x0
#define MX8MM_IOMUXC_UART1_RXD_TPSMP_HDATA24 0x234 0x49C 0x000 0x7 0x0 #define MX8MM_IOMUXC_UART1_RXD_TPSMP_HDATA24 0x234 0x49C 0x000 0x7 0x0
#define MX8MM_IOMUXC_UART1_TXD_UART1_DCE_TX 0x238 0x4A0 0x000 0x0 0x0 #define MX8MM_IOMUXC_UART1_TXD_UART1_DCE_TX 0x238 0x4A0 0x000 0x0 0x0
#define MX8MM_IOMUXC_UART1_TXD_UART1_DTE_RX 0x238 0x4A0 0x4F4 0x0 0x0 #define MX8MM_IOMUXC_UART1_TXD_UART1_DTE_RX 0x238 0x4A0 0x4F4 0x0 0x1
#define MX8MM_IOMUXC_UART1_TXD_ECSPI3_MOSI 0x238 0x4A0 0x000 0x1 0x0 #define MX8MM_IOMUXC_UART1_TXD_ECSPI3_MOSI 0x238 0x4A0 0x000 0x1 0x0
#define MX8MM_IOMUXC_UART1_TXD_GPIO5_IO23 0x238 0x4A0 0x000 0x5 0x0 #define MX8MM_IOMUXC_UART1_TXD_GPIO5_IO23 0x238 0x4A0 0x000 0x5 0x0
#define MX8MM_IOMUXC_UART1_TXD_TPSMP_HDATA25 0x238 0x4A0 0x000 0x7 0x0 #define MX8MM_IOMUXC_UART1_TXD_TPSMP_HDATA25 0x238 0x4A0 0x000 0x7 0x0

View File

@ -1230,7 +1230,7 @@ static char __attribute__((aligned(64))) iodc_dbuf[4096];
*/ */
int pdc_iodc_print(const unsigned char *str, unsigned count) int pdc_iodc_print(const unsigned char *str, unsigned count)
{ {
unsigned int i; unsigned int i, found = 0;
unsigned long flags; unsigned long flags;
for (i = 0; i < count;) { for (i = 0; i < count;) {
@ -1239,6 +1239,7 @@ int pdc_iodc_print(const unsigned char *str, unsigned count)
iodc_dbuf[i+0] = '\r'; iodc_dbuf[i+0] = '\r';
iodc_dbuf[i+1] = '\n'; iodc_dbuf[i+1] = '\n';
i += 2; i += 2;
found = 1;
goto print; goto print;
default: default:
iodc_dbuf[i] = str[i]; iodc_dbuf[i] = str[i];
@ -1255,7 +1256,7 @@ int pdc_iodc_print(const unsigned char *str, unsigned count)
__pa(iodc_retbuf), 0, __pa(iodc_dbuf), i, 0); __pa(iodc_retbuf), 0, __pa(iodc_dbuf), i, 0);
spin_unlock_irqrestore(&pdc_lock, flags); spin_unlock_irqrestore(&pdc_lock, flags);
return i; return i - found;
} }
#if !defined(BOOTLOADER) #if !defined(BOOTLOADER)

View File

@ -127,6 +127,12 @@ long arch_ptrace(struct task_struct *child, long request,
unsigned long tmp; unsigned long tmp;
long ret = -EIO; long ret = -EIO;
unsigned long user_regs_struct_size = sizeof(struct user_regs_struct);
#ifdef CONFIG_64BIT
if (is_compat_task())
user_regs_struct_size /= 2;
#endif
switch (request) { switch (request) {
/* Read the word at location addr in the USER area. For ptraced /* Read the word at location addr in the USER area. For ptraced
@ -182,14 +188,14 @@ long arch_ptrace(struct task_struct *child, long request,
return copy_regset_to_user(child, return copy_regset_to_user(child,
task_user_regset_view(current), task_user_regset_view(current),
REGSET_GENERAL, REGSET_GENERAL,
0, sizeof(struct user_regs_struct), 0, user_regs_struct_size,
datap); datap);
case PTRACE_SETREGS: /* Set all gp regs in the child. */ case PTRACE_SETREGS: /* Set all gp regs in the child. */
return copy_regset_from_user(child, return copy_regset_from_user(child,
task_user_regset_view(current), task_user_regset_view(current),
REGSET_GENERAL, REGSET_GENERAL,
0, sizeof(struct user_regs_struct), 0, user_regs_struct_size,
datap); datap);
case PTRACE_GETFPREGS: /* Get the child FPU state. */ case PTRACE_GETFPREGS: /* Get the child FPU state. */
@ -303,6 +309,11 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
} }
} }
break; break;
case PTRACE_GETREGS:
case PTRACE_SETREGS:
case PTRACE_GETFPREGS:
case PTRACE_SETFPREGS:
return arch_ptrace(child, request, addr, data);
default: default:
ret = compat_ptrace_request(child, request, addr, data); ret = compat_ptrace_request(child, request, addr, data);

View File

@ -21,7 +21,7 @@
* Used to avoid races in counting the nest-pmu units during hotplug * Used to avoid races in counting the nest-pmu units during hotplug
* register and unregister * register and unregister
*/ */
static DEFINE_SPINLOCK(nest_init_lock); static DEFINE_MUTEX(nest_init_lock);
static DEFINE_PER_CPU(struct imc_pmu_ref *, local_nest_imc_refc); static DEFINE_PER_CPU(struct imc_pmu_ref *, local_nest_imc_refc);
static struct imc_pmu **per_nest_pmu_arr; static struct imc_pmu **per_nest_pmu_arr;
static cpumask_t nest_imc_cpumask; static cpumask_t nest_imc_cpumask;
@ -1621,7 +1621,7 @@ static void imc_common_mem_free(struct imc_pmu *pmu_ptr)
static void imc_common_cpuhp_mem_free(struct imc_pmu *pmu_ptr) static void imc_common_cpuhp_mem_free(struct imc_pmu *pmu_ptr)
{ {
if (pmu_ptr->domain == IMC_DOMAIN_NEST) { if (pmu_ptr->domain == IMC_DOMAIN_NEST) {
spin_lock(&nest_init_lock); mutex_lock(&nest_init_lock);
if (nest_pmus == 1) { if (nest_pmus == 1) {
cpuhp_remove_state(CPUHP_AP_PERF_POWERPC_NEST_IMC_ONLINE); cpuhp_remove_state(CPUHP_AP_PERF_POWERPC_NEST_IMC_ONLINE);
kfree(nest_imc_refc); kfree(nest_imc_refc);
@ -1631,7 +1631,7 @@ static void imc_common_cpuhp_mem_free(struct imc_pmu *pmu_ptr)
if (nest_pmus > 0) if (nest_pmus > 0)
nest_pmus--; nest_pmus--;
spin_unlock(&nest_init_lock); mutex_unlock(&nest_init_lock);
} }
/* Free core_imc memory */ /* Free core_imc memory */
@ -1788,11 +1788,11 @@ int init_imc_pmu(struct device_node *parent, struct imc_pmu *pmu_ptr, int pmu_id
* rest. To handle the cpuhotplug callback unregister, we track * rest. To handle the cpuhotplug callback unregister, we track
* the number of nest pmus in "nest_pmus". * the number of nest pmus in "nest_pmus".
*/ */
spin_lock(&nest_init_lock); mutex_lock(&nest_init_lock);
if (nest_pmus == 0) { if (nest_pmus == 0) {
ret = init_nest_pmu_ref(); ret = init_nest_pmu_ref();
if (ret) { if (ret) {
spin_unlock(&nest_init_lock); mutex_unlock(&nest_init_lock);
kfree(per_nest_pmu_arr); kfree(per_nest_pmu_arr);
per_nest_pmu_arr = NULL; per_nest_pmu_arr = NULL;
goto err_free_mem; goto err_free_mem;
@ -1800,7 +1800,7 @@ int init_imc_pmu(struct device_node *parent, struct imc_pmu *pmu_ptr, int pmu_id
/* Register for cpu hotplug notification. */ /* Register for cpu hotplug notification. */
ret = nest_pmu_cpumask_init(); ret = nest_pmu_cpumask_init();
if (ret) { if (ret) {
spin_unlock(&nest_init_lock); mutex_unlock(&nest_init_lock);
kfree(nest_imc_refc); kfree(nest_imc_refc);
kfree(per_nest_pmu_arr); kfree(per_nest_pmu_arr);
per_nest_pmu_arr = NULL; per_nest_pmu_arr = NULL;
@ -1808,7 +1808,7 @@ int init_imc_pmu(struct device_node *parent, struct imc_pmu *pmu_ptr, int pmu_id
} }
} }
nest_pmus++; nest_pmus++;
spin_unlock(&nest_init_lock); mutex_unlock(&nest_init_lock);
break; break;
case IMC_DOMAIN_CORE: case IMC_DOMAIN_CORE:
ret = core_imc_pmu_cpumask_init(); ret = core_imc_pmu_cpumask_init();

View File

@ -74,6 +74,9 @@ ifeq ($(CONFIG_PERF_EVENTS),y)
KBUILD_CFLAGS += -fno-omit-frame-pointer KBUILD_CFLAGS += -fno-omit-frame-pointer
endif endif
# Avoid generating .eh_frame sections.
KBUILD_CFLAGS += -fno-asynchronous-unwind-tables -fno-unwind-tables
KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-relax) KBUILD_CFLAGS_MODULE += $(call cc-option,-mno-relax)
KBUILD_AFLAGS_MODULE += $(call as-option,-Wa$(comma)-mno-relax) KBUILD_AFLAGS_MODULE += $(call as-option,-Wa$(comma)-mno-relax)

View File

@ -85,7 +85,9 @@ void flush_icache_pte(pte_t pte)
{ {
struct page *page = pte_page(pte); struct page *page = pte_page(pte);
if (!test_and_set_bit(PG_dcache_clean, &page->flags)) if (!test_bit(PG_dcache_clean, &page->flags)) {
flush_icache_all(); flush_icache_all();
set_bit(PG_dcache_clean, &page->flags);
}
} }
#endif /* CONFIG_MMU */ #endif /* CONFIG_MMU */

View File

@ -39,7 +39,20 @@ static __always_inline unsigned long native_get_debugreg(int regno)
asm("mov %%db6, %0" :"=r" (val)); asm("mov %%db6, %0" :"=r" (val));
break; break;
case 7: case 7:
asm("mov %%db7, %0" :"=r" (val)); /*
* Apply __FORCE_ORDER to DR7 reads to forbid re-ordering them
* with other code.
*
* This is needed because a DR7 access can cause a #VC exception
* when running under SEV-ES. Taking a #VC exception is not a
* safe thing to do just anywhere in the entry code and
* re-ordering might place the access into an unsafe location.
*
* This happened in the NMI handler, where the DR7 read was
* re-ordered to happen before the call to sev_es_ist_enter(),
* causing stack recursion.
*/
asm volatile("mov %%db7, %0" : "=r" (val) : __FORCE_ORDER);
break; break;
default: default:
BUG(); BUG();
@ -66,7 +79,16 @@ static __always_inline void native_set_debugreg(int regno, unsigned long value)
asm("mov %0, %%db6" ::"r" (value)); asm("mov %0, %%db6" ::"r" (value));
break; break;
case 7: case 7:
asm("mov %0, %%db7" ::"r" (value)); /*
* Apply __FORCE_ORDER to DR7 writes to forbid re-ordering them
* with other code.
*
* While is didn't happen with a DR7 write (see the DR7 read
* comment above which explains where it happened), add the
* __FORCE_ORDER here too to avoid similar problems in the
* future.
*/
asm volatile("mov %0, %%db7" ::"r" (value), __FORCE_ORDER);
break; break;
default: default:
BUG(); BUG();

View File

@ -3051,7 +3051,7 @@ int sata_down_spd_limit(struct ata_link *link, u32 spd_limit)
*/ */
if (spd > 1) if (spd > 1)
mask &= (1 << (spd - 1)) - 1; mask &= (1 << (spd - 1)) - 1;
else else if (link->sata_spd)
return -EINVAL; return -EINVAL;
/* were we already at the bottom? */ /* were we already at the bottom? */

View File

@ -781,7 +781,13 @@ static int __init sunxi_rsb_init(void)
return ret; return ret;
} }
return platform_driver_register(&sunxi_rsb_driver); ret = platform_driver_register(&sunxi_rsb_driver);
if (ret) {
bus_unregister(&sunxi_rsb_bus);
return ret;
}
return 0;
} }
module_init(sunxi_rsb_init); module_init(sunxi_rsb_init);

View File

@ -818,8 +818,10 @@ static int ioctl_send_response(struct client *client, union ioctl_arg *arg)
r = container_of(resource, struct inbound_transaction_resource, r = container_of(resource, struct inbound_transaction_resource,
resource); resource);
if (is_fcp_request(r->request)) if (is_fcp_request(r->request)) {
kfree(r->data);
goto out; goto out;
}
if (a->length != fw_get_response_length(r->request)) { if (a->length != fw_get_response_length(r->request)) {
ret = -EINVAL; ret = -EINVAL;

View File

@ -950,6 +950,8 @@ int __ref efi_mem_reserve_persistent(phys_addr_t addr, u64 size)
/* first try to find a slot in an existing linked list entry */ /* first try to find a slot in an existing linked list entry */
for (prsv = efi_memreserve_root->next; prsv; ) { for (prsv = efi_memreserve_root->next; prsv; ) {
rsv = memremap(prsv, sizeof(*rsv), MEMREMAP_WB); rsv = memremap(prsv, sizeof(*rsv), MEMREMAP_WB);
if (!rsv)
return -ENOMEM;
index = atomic_fetch_add_unless(&rsv->count, 1, rsv->size); index = atomic_fetch_add_unless(&rsv->count, 1, rsv->size);
if (index < rsv->size) { if (index < rsv->size) {
rsv->entry[index].base = addr; rsv->entry[index].base = addr;

View File

@ -33,7 +33,7 @@ int __init efi_memattr_init(void)
return -ENOMEM; return -ENOMEM;
} }
if (tbl->version > 1) { if (tbl->version > 2) {
pr_warn("Unexpected EFI Memory Attributes table version %d\n", pr_warn("Unexpected EFI Memory Attributes table version %d\n",
tbl->version); tbl->version);
goto unmap; goto unmap;

View File

@ -213,9 +213,9 @@ static int s10_ops_write_init(struct fpga_manager *mgr,
/* Allocate buffers from the service layer's pool. */ /* Allocate buffers from the service layer's pool. */
for (i = 0; i < NUM_SVC_BUFS; i++) { for (i = 0; i < NUM_SVC_BUFS; i++) {
kbuf = stratix10_svc_allocate_memory(priv->chan, SVC_BUF_SIZE); kbuf = stratix10_svc_allocate_memory(priv->chan, SVC_BUF_SIZE);
if (!kbuf) { if (IS_ERR(kbuf)) {
s10_free_buffers(mgr); s10_free_buffers(mgr);
ret = -ENOMEM; ret = PTR_ERR(kbuf);
goto init_done; goto init_done;
} }

View File

@ -640,7 +640,7 @@ static void sbefifo_collect_async_ffdc(struct sbefifo *sbefifo)
} }
ffdc_iov.iov_base = ffdc; ffdc_iov.iov_base = ffdc;
ffdc_iov.iov_len = SBEFIFO_MAX_FFDC_SIZE; ffdc_iov.iov_len = SBEFIFO_MAX_FFDC_SIZE;
iov_iter_kvec(&ffdc_iter, WRITE, &ffdc_iov, 1, SBEFIFO_MAX_FFDC_SIZE); iov_iter_kvec(&ffdc_iter, READ, &ffdc_iov, 1, SBEFIFO_MAX_FFDC_SIZE);
cmd[0] = cpu_to_be32(2); cmd[0] = cpu_to_be32(2);
cmd[1] = cpu_to_be32(SBEFIFO_CMD_GET_SBE_FFDC); cmd[1] = cpu_to_be32(SBEFIFO_CMD_GET_SBE_FFDC);
rc = sbefifo_do_command(sbefifo, cmd, 2, &ffdc_iter); rc = sbefifo_do_command(sbefifo, cmd, 2, &ffdc_iter);
@ -737,7 +737,7 @@ int sbefifo_submit(struct device *dev, const __be32 *command, size_t cmd_len,
rbytes = (*resp_len) * sizeof(__be32); rbytes = (*resp_len) * sizeof(__be32);
resp_iov.iov_base = response; resp_iov.iov_base = response;
resp_iov.iov_len = rbytes; resp_iov.iov_len = rbytes;
iov_iter_kvec(&resp_iter, WRITE, &resp_iov, 1, rbytes); iov_iter_kvec(&resp_iter, READ, &resp_iov, 1, rbytes);
/* Perform the command */ /* Perform the command */
mutex_lock(&sbefifo->lock); mutex_lock(&sbefifo->lock);
@ -817,7 +817,7 @@ static ssize_t sbefifo_user_read(struct file *file, char __user *buf,
/* Prepare iov iterator */ /* Prepare iov iterator */
resp_iov.iov_base = buf; resp_iov.iov_base = buf;
resp_iov.iov_len = len; resp_iov.iov_len = len;
iov_iter_init(&resp_iter, WRITE, &resp_iov, 1, len); iov_iter_init(&resp_iter, READ, &resp_iov, 1, len);
/* Perform the command */ /* Perform the command */
mutex_lock(&sbefifo->lock); mutex_lock(&sbefifo->lock);

View File

@ -296,10 +296,6 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj,
spin_unlock(&obj->vma.lock); spin_unlock(&obj->vma.lock);
obj->tiling_and_stride = tiling | stride; obj->tiling_and_stride = tiling | stride;
i915_gem_object_unlock(obj);
/* Force the fence to be reacquired for GTT access */
i915_gem_object_release_mmap_gtt(obj);
/* Try to preallocate memory required to save swizzling on put-pages */ /* Try to preallocate memory required to save swizzling on put-pages */
if (i915_gem_object_needs_bit17_swizzle(obj)) { if (i915_gem_object_needs_bit17_swizzle(obj)) {
@ -312,6 +308,11 @@ i915_gem_object_set_tiling(struct drm_i915_gem_object *obj,
obj->bit_17 = NULL; obj->bit_17 = NULL;
} }
i915_gem_object_unlock(obj);
/* Force the fence to be reacquired for GTT access */
i915_gem_object_release_mmap_gtt(obj);
return 0; return 0;
} }

View File

@ -1491,7 +1491,8 @@ static int vc4_hdmi_cec_init(struct vc4_hdmi *vc4_hdmi)
return 0; return 0;
vc4_hdmi->cec_adap = cec_allocate_adapter(&vc4_hdmi_cec_adap_ops, vc4_hdmi->cec_adap = cec_allocate_adapter(&vc4_hdmi_cec_adap_ops,
vc4_hdmi, "vc4", vc4_hdmi,
vc4_hdmi->variant->card_name,
CEC_CAP_DEFAULTS | CEC_CAP_DEFAULTS |
CEC_CAP_CONNECTOR_INFO, 1); CEC_CAP_CONNECTOR_INFO, 1);
ret = PTR_ERR_OR_ZERO(vc4_hdmi->cec_adap); ret = PTR_ERR_OR_ZERO(vc4_hdmi->cec_adap);

View File

@ -842,8 +842,8 @@ static int mxs_i2c_probe(struct platform_device *pdev)
/* Setup the DMA */ /* Setup the DMA */
i2c->dmach = dma_request_chan(dev, "rx-tx"); i2c->dmach = dma_request_chan(dev, "rx-tx");
if (IS_ERR(i2c->dmach)) { if (IS_ERR(i2c->dmach)) {
dev_err(dev, "Failed to request dma\n"); return dev_err_probe(dev, PTR_ERR(i2c->dmach),
return PTR_ERR(i2c->dmach); "Failed to request dma\n");
} }
platform_set_drvdata(pdev, i2c); platform_set_drvdata(pdev, i2c);

View File

@ -80,7 +80,7 @@ enum {
#define DEFAULT_SCL_RATE (100 * 1000) /* Hz */ #define DEFAULT_SCL_RATE (100 * 1000) /* Hz */
/** /**
* struct i2c_spec_values: * struct i2c_spec_values - I2C specification values for various modes
* @min_hold_start_ns: min hold time (repeated) START condition * @min_hold_start_ns: min hold time (repeated) START condition
* @min_low_ns: min LOW period of the SCL clock * @min_low_ns: min LOW period of the SCL clock
* @min_high_ns: min HIGH period of the SCL cloc * @min_high_ns: min HIGH period of the SCL cloc
@ -136,7 +136,7 @@ static const struct i2c_spec_values fast_mode_plus_spec = {
}; };
/** /**
* struct rk3x_i2c_calced_timings: * struct rk3x_i2c_calced_timings - calculated V1 timings
* @div_low: Divider output for low * @div_low: Divider output for low
* @div_high: Divider output for high * @div_high: Divider output for high
* @tuning: Used to adjust setup/hold data time, * @tuning: Used to adjust setup/hold data time,
@ -159,7 +159,7 @@ enum rk3x_i2c_state {
}; };
/** /**
* struct rk3x_i2c_soc_data: * struct rk3x_i2c_soc_data - SOC-specific data
* @grf_offset: offset inside the grf regmap for setting the i2c type * @grf_offset: offset inside the grf regmap for setting the i2c type
* @calc_timings: Callback function for i2c timing information calculated * @calc_timings: Callback function for i2c timing information calculated
*/ */
@ -239,7 +239,8 @@ static inline void rk3x_i2c_clean_ipd(struct rk3x_i2c *i2c)
} }
/** /**
* Generate a START condition, which triggers a REG_INT_START interrupt. * rk3x_i2c_start - Generate a START condition, which triggers a REG_INT_START interrupt.
* @i2c: target controller data
*/ */
static void rk3x_i2c_start(struct rk3x_i2c *i2c) static void rk3x_i2c_start(struct rk3x_i2c *i2c)
{ {
@ -258,8 +259,8 @@ static void rk3x_i2c_start(struct rk3x_i2c *i2c)
} }
/** /**
* Generate a STOP condition, which triggers a REG_INT_STOP interrupt. * rk3x_i2c_stop - Generate a STOP condition, which triggers a REG_INT_STOP interrupt.
* * @i2c: target controller data
* @error: Error code to return in rk3x_i2c_xfer * @error: Error code to return in rk3x_i2c_xfer
*/ */
static void rk3x_i2c_stop(struct rk3x_i2c *i2c, int error) static void rk3x_i2c_stop(struct rk3x_i2c *i2c, int error)
@ -298,7 +299,8 @@ static void rk3x_i2c_stop(struct rk3x_i2c *i2c, int error)
} }
/** /**
* Setup a read according to i2c->msg * rk3x_i2c_prepare_read - Setup a read according to i2c->msg
* @i2c: target controller data
*/ */
static void rk3x_i2c_prepare_read(struct rk3x_i2c *i2c) static void rk3x_i2c_prepare_read(struct rk3x_i2c *i2c)
{ {
@ -329,7 +331,8 @@ static void rk3x_i2c_prepare_read(struct rk3x_i2c *i2c)
} }
/** /**
* Fill the transmit buffer with data from i2c->msg * rk3x_i2c_fill_transmit_buf - Fill the transmit buffer with data from i2c->msg
* @i2c: target controller data
*/ */
static void rk3x_i2c_fill_transmit_buf(struct rk3x_i2c *i2c) static void rk3x_i2c_fill_transmit_buf(struct rk3x_i2c *i2c)
{ {
@ -532,11 +535,10 @@ static irqreturn_t rk3x_i2c_irq(int irqno, void *dev_id)
} }
/** /**
* Get timing values of I2C specification * rk3x_i2c_get_spec - Get timing values of I2C specification
*
* @speed: Desired SCL frequency * @speed: Desired SCL frequency
* *
* Returns: Matched i2c spec values. * Return: Matched i2c_spec_values.
*/ */
static const struct i2c_spec_values *rk3x_i2c_get_spec(unsigned int speed) static const struct i2c_spec_values *rk3x_i2c_get_spec(unsigned int speed)
{ {
@ -549,13 +551,12 @@ static const struct i2c_spec_values *rk3x_i2c_get_spec(unsigned int speed)
} }
/** /**
* Calculate divider values for desired SCL frequency * rk3x_i2c_v0_calc_timings - Calculate divider values for desired SCL frequency
*
* @clk_rate: I2C input clock rate * @clk_rate: I2C input clock rate
* @t: Known I2C timing information * @t: Known I2C timing information
* @t_calc: Caculated rk3x private timings that would be written into regs * @t_calc: Caculated rk3x private timings that would be written into regs
* *
* Returns: 0 on success, -EINVAL if the goal SCL rate is too slow. In that case * Return: %0 on success, -%EINVAL if the goal SCL rate is too slow. In that case
* a best-effort divider value is returned in divs. If the target rate is * a best-effort divider value is returned in divs. If the target rate is
* too high, we silently use the highest possible rate. * too high, we silently use the highest possible rate.
*/ */
@ -710,13 +711,12 @@ static int rk3x_i2c_v0_calc_timings(unsigned long clk_rate,
} }
/** /**
* Calculate timing values for desired SCL frequency * rk3x_i2c_v1_calc_timings - Calculate timing values for desired SCL frequency
*
* @clk_rate: I2C input clock rate * @clk_rate: I2C input clock rate
* @t: Known I2C timing information * @t: Known I2C timing information
* @t_calc: Caculated rk3x private timings that would be written into regs * @t_calc: Caculated rk3x private timings that would be written into regs
* *
* Returns: 0 on success, -EINVAL if the goal SCL rate is too slow. In that case * Return: %0 on success, -%EINVAL if the goal SCL rate is too slow. In that case
* a best-effort divider value is returned in divs. If the target rate is * a best-effort divider value is returned in divs. If the target rate is
* too high, we silently use the highest possible rate. * too high, we silently use the highest possible rate.
* The following formulas are v1's method to calculate timings. * The following formulas are v1's method to calculate timings.
@ -960,14 +960,14 @@ static int rk3x_i2c_clk_notifier_cb(struct notifier_block *nb, unsigned long
} }
/** /**
* Setup I2C registers for an I2C operation specified by msgs, num. * rk3x_i2c_setup - Setup I2C registers for an I2C operation specified by msgs, num.
* * @i2c: target controller data
* Must be called with i2c->lock held.
*
* @msgs: I2C msgs to process * @msgs: I2C msgs to process
* @num: Number of msgs * @num: Number of msgs
* *
* returns: Number of I2C msgs processed or negative in case of error * Must be called with i2c->lock held.
*
* Return: Number of I2C msgs processed or negative in case of error
*/ */
static int rk3x_i2c_setup(struct rk3x_i2c *i2c, struct i2c_msg *msgs, int num) static int rk3x_i2c_setup(struct rk3x_i2c *i2c, struct i2c_msg *msgs, int num)
{ {

View File

@ -277,6 +277,7 @@ static int accel_3d_capture_sample(struct hid_sensor_hub_device *hsdev,
hid_sensor_convert_timestamp( hid_sensor_convert_timestamp(
&accel_state->common_attributes, &accel_state->common_attributes,
*(int64_t *)raw_data); *(int64_t *)raw_data);
ret = 0;
break; break;
default: default:
break; break;

View File

@ -289,8 +289,10 @@ static int berlin2_adc_probe(struct platform_device *pdev)
int ret; int ret;
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv)); indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*priv));
if (!indio_dev) if (!indio_dev) {
of_node_put(parent_np);
return -ENOMEM; return -ENOMEM;
}
priv = iio_priv(indio_dev); priv = iio_priv(indio_dev);
platform_set_drvdata(pdev, indio_dev); platform_set_drvdata(pdev, indio_dev);

View File

@ -1521,6 +1521,7 @@ static const struct of_device_id stm32_dfsdm_adc_match[] = {
}, },
{} {}
}; };
MODULE_DEVICE_TABLE(of, stm32_dfsdm_adc_match);
static int stm32_dfsdm_adc_probe(struct platform_device *pdev) static int stm32_dfsdm_adc_probe(struct platform_device *pdev)
{ {

View File

@ -57,6 +57,18 @@
#define TWL6030_GPADCS BIT(1) #define TWL6030_GPADCS BIT(1)
#define TWL6030_GPADCR BIT(0) #define TWL6030_GPADCR BIT(0)
#define USB_VBUS_CTRL_SET 0x04
#define USB_ID_CTRL_SET 0x06
#define TWL6030_MISC1 0xE4
#define VBUS_MEAS 0x01
#define ID_MEAS 0x01
#define VAC_MEAS 0x04
#define VBAT_MEAS 0x02
#define BB_MEAS 0x01
/** /**
* struct twl6030_chnl_calib - channel calibration * struct twl6030_chnl_calib - channel calibration
* @gain: slope coefficient for ideal curve * @gain: slope coefficient for ideal curve
@ -927,6 +939,26 @@ static int twl6030_gpadc_probe(struct platform_device *pdev)
return ret; return ret;
} }
ret = twl_i2c_write_u8(TWL_MODULE_USB, VBUS_MEAS, USB_VBUS_CTRL_SET);
if (ret < 0) {
dev_err(dev, "failed to wire up inputs\n");
return ret;
}
ret = twl_i2c_write_u8(TWL_MODULE_USB, ID_MEAS, USB_ID_CTRL_SET);
if (ret < 0) {
dev_err(dev, "failed to wire up inputs\n");
return ret;
}
ret = twl_i2c_write_u8(TWL6030_MODULE_ID0,
VBAT_MEAS | BB_MEAS | VAC_MEAS,
TWL6030_MISC1);
if (ret < 0) {
dev_err(dev, "failed to wire up inputs\n");
return ret;
}
indio_dev->name = DRIVER_NAME; indio_dev->name = DRIVER_NAME;
indio_dev->info = &twl6030_gpadc_iio_info; indio_dev->info = &twl6030_gpadc_iio_info;
indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->modes = INDIO_DIRECT_MODE;

View File

@ -10,6 +10,7 @@
#include <linux/regmap.h> #include <linux/regmap.h>
#include <linux/acpi.h> #include <linux/acpi.h>
#include <linux/bitops.h> #include <linux/bitops.h>
#include <linux/bitfield.h>
#include <linux/iio/iio.h> #include <linux/iio/iio.h>
#include <linux/iio/sysfs.h> #include <linux/iio/sysfs.h>
@ -144,9 +145,8 @@
#define FXOS8700_NVM_DATA_BNK0 0xa7 #define FXOS8700_NVM_DATA_BNK0 0xa7
/* Bit definitions for FXOS8700_CTRL_REG1 */ /* Bit definitions for FXOS8700_CTRL_REG1 */
#define FXOS8700_CTRL_ODR_MSK 0x38
#define FXOS8700_CTRL_ODR_MAX 0x00 #define FXOS8700_CTRL_ODR_MAX 0x00
#define FXOS8700_CTRL_ODR_MIN GENMASK(4, 3) #define FXOS8700_CTRL_ODR_MSK GENMASK(5, 3)
/* Bit definitions for FXOS8700_M_CTRL_REG1 */ /* Bit definitions for FXOS8700_M_CTRL_REG1 */
#define FXOS8700_HMS_MASK GENMASK(1, 0) #define FXOS8700_HMS_MASK GENMASK(1, 0)
@ -320,7 +320,7 @@ static enum fxos8700_sensor fxos8700_to_sensor(enum iio_chan_type iio_type)
switch (iio_type) { switch (iio_type) {
case IIO_ACCEL: case IIO_ACCEL:
return FXOS8700_ACCEL; return FXOS8700_ACCEL;
case IIO_ANGL_VEL: case IIO_MAGN:
return FXOS8700_MAGN; return FXOS8700_MAGN;
default: default:
return -EINVAL; return -EINVAL;
@ -345,15 +345,35 @@ static int fxos8700_set_active_mode(struct fxos8700_data *data,
static int fxos8700_set_scale(struct fxos8700_data *data, static int fxos8700_set_scale(struct fxos8700_data *data,
enum fxos8700_sensor t, int uscale) enum fxos8700_sensor t, int uscale)
{ {
int i; int i, ret, val;
bool active_mode;
static const int scale_num = ARRAY_SIZE(fxos8700_accel_scale); static const int scale_num = ARRAY_SIZE(fxos8700_accel_scale);
struct device *dev = regmap_get_device(data->regmap); struct device *dev = regmap_get_device(data->regmap);
if (t == FXOS8700_MAGN) { if (t == FXOS8700_MAGN) {
dev_err(dev, "Magnetometer scale is locked at 1200uT\n"); dev_err(dev, "Magnetometer scale is locked at 0.001Gs\n");
return -EINVAL; return -EINVAL;
} }
/*
* When device is in active mode, it failed to set an ACCEL
* full-scale range(2g/4g/8g) in FXOS8700_XYZ_DATA_CFG.
* This is not align with the datasheet, but it is a fxos8700
* chip behavier. Set the device in standby mode before setting
* an ACCEL full-scale range.
*/
ret = regmap_read(data->regmap, FXOS8700_CTRL_REG1, &val);
if (ret)
return ret;
active_mode = val & FXOS8700_ACTIVE;
if (active_mode) {
ret = regmap_write(data->regmap, FXOS8700_CTRL_REG1,
val & ~FXOS8700_ACTIVE);
if (ret)
return ret;
}
for (i = 0; i < scale_num; i++) for (i = 0; i < scale_num; i++)
if (fxos8700_accel_scale[i].uscale == uscale) if (fxos8700_accel_scale[i].uscale == uscale)
break; break;
@ -361,8 +381,12 @@ static int fxos8700_set_scale(struct fxos8700_data *data,
if (i == scale_num) if (i == scale_num)
return -EINVAL; return -EINVAL;
return regmap_write(data->regmap, FXOS8700_XYZ_DATA_CFG, ret = regmap_write(data->regmap, FXOS8700_XYZ_DATA_CFG,
fxos8700_accel_scale[i].bits); fxos8700_accel_scale[i].bits);
if (ret)
return ret;
return regmap_write(data->regmap, FXOS8700_CTRL_REG1,
active_mode);
} }
static int fxos8700_get_scale(struct fxos8700_data *data, static int fxos8700_get_scale(struct fxos8700_data *data,
@ -372,7 +396,7 @@ static int fxos8700_get_scale(struct fxos8700_data *data,
static const int scale_num = ARRAY_SIZE(fxos8700_accel_scale); static const int scale_num = ARRAY_SIZE(fxos8700_accel_scale);
if (t == FXOS8700_MAGN) { if (t == FXOS8700_MAGN) {
*uscale = 1200; /* Magnetometer is locked at 1200uT */ *uscale = 1000; /* Magnetometer is locked at 0.001Gs */
return 0; return 0;
} }
@ -394,22 +418,61 @@ static int fxos8700_get_data(struct fxos8700_data *data, int chan_type,
int axis, int *val) int axis, int *val)
{ {
u8 base, reg; u8 base, reg;
s16 tmp;
int ret; int ret;
enum fxos8700_sensor type = fxos8700_to_sensor(chan_type);
base = type ? FXOS8700_OUT_X_MSB : FXOS8700_M_OUT_X_MSB; /*
* Different register base addresses varies with channel types.
* This bug hasn't been noticed before because using an enum is
* really hard to read. Use an a switch statement to take over that.
*/
switch (chan_type) {
case IIO_ACCEL:
base = FXOS8700_OUT_X_MSB;
break;
case IIO_MAGN:
base = FXOS8700_M_OUT_X_MSB;
break;
default:
return -EINVAL;
}
/* Block read 6 bytes of device output registers to avoid data loss */ /* Block read 6 bytes of device output registers to avoid data loss */
ret = regmap_bulk_read(data->regmap, base, data->buf, ret = regmap_bulk_read(data->regmap, base, data->buf,
FXOS8700_DATA_BUF_SIZE); sizeof(data->buf));
if (ret) if (ret)
return ret; return ret;
/* Convert axis to buffer index */ /* Convert axis to buffer index */
reg = axis - IIO_MOD_X; reg = axis - IIO_MOD_X;
/*
* Convert to native endianness. The accel data and magn data
* are signed, so a forced type conversion is needed.
*/
tmp = be16_to_cpu(data->buf[reg]);
/*
* ACCEL output data registers contain the X-axis, Y-axis, and Z-axis
* 14-bit left-justified sample data and MAGN output data registers
* contain the X-axis, Y-axis, and Z-axis 16-bit sample data. Apply
* a signed 2 bits right shift to the readback raw data from ACCEL
* output data register and keep that from MAGN sensor as the origin.
* Value should be extended to 32 bit.
*/
switch (chan_type) {
case IIO_ACCEL:
tmp = tmp >> 2;
break;
case IIO_MAGN:
/* Nothing to do */
break;
default:
return -EINVAL;
}
/* Convert to native endianness */ /* Convert to native endianness */
*val = sign_extend32(be16_to_cpu(data->buf[reg]), 15); *val = sign_extend32(tmp, 15);
return 0; return 0;
} }
@ -445,10 +508,9 @@ static int fxos8700_set_odr(struct fxos8700_data *data, enum fxos8700_sensor t,
if (i >= odr_num) if (i >= odr_num)
return -EINVAL; return -EINVAL;
return regmap_update_bits(data->regmap, val &= ~FXOS8700_CTRL_ODR_MSK;
FXOS8700_CTRL_REG1, val |= FIELD_PREP(FXOS8700_CTRL_ODR_MSK, fxos8700_odr[i].bits) | FXOS8700_ACTIVE;
FXOS8700_CTRL_ODR_MSK + FXOS8700_ACTIVE, return regmap_write(data->regmap, FXOS8700_CTRL_REG1, val);
fxos8700_odr[i].bits << 3 | active_mode);
} }
static int fxos8700_get_odr(struct fxos8700_data *data, enum fxos8700_sensor t, static int fxos8700_get_odr(struct fxos8700_data *data, enum fxos8700_sensor t,
@ -461,7 +523,7 @@ static int fxos8700_get_odr(struct fxos8700_data *data, enum fxos8700_sensor t,
if (ret) if (ret)
return ret; return ret;
val &= FXOS8700_CTRL_ODR_MSK; val = FIELD_GET(FXOS8700_CTRL_ODR_MSK, val);
for (i = 0; i < odr_num; i++) for (i = 0; i < odr_num; i++)
if (val == fxos8700_odr[i].bits) if (val == fxos8700_odr[i].bits)
@ -526,7 +588,7 @@ static IIO_CONST_ATTR(in_accel_sampling_frequency_available,
static IIO_CONST_ATTR(in_magn_sampling_frequency_available, static IIO_CONST_ATTR(in_magn_sampling_frequency_available,
"1.5625 6.25 12.5 50 100 200 400 800"); "1.5625 6.25 12.5 50 100 200 400 800");
static IIO_CONST_ATTR(in_accel_scale_available, "0.000244 0.000488 0.000976"); static IIO_CONST_ATTR(in_accel_scale_available, "0.000244 0.000488 0.000976");
static IIO_CONST_ATTR(in_magn_scale_available, "0.000001200"); static IIO_CONST_ATTR(in_magn_scale_available, "0.001000");
static struct attribute *fxos8700_attrs[] = { static struct attribute *fxos8700_attrs[] = {
&iio_const_attr_in_accel_sampling_frequency_available.dev_attr.attr, &iio_const_attr_in_accel_sampling_frequency_available.dev_attr.attr,
@ -592,14 +654,19 @@ static int fxos8700_chip_init(struct fxos8700_data *data, bool use_spi)
if (ret) if (ret)
return ret; return ret;
/* Max ODR (800Hz individual or 400Hz hybrid), active mode */ /*
ret = regmap_write(data->regmap, FXOS8700_CTRL_REG1, * Set max full-scale range (+/-8G) for ACCEL sensor in chip
FXOS8700_CTRL_ODR_MAX | FXOS8700_ACTIVE); * initialization then activate the device.
*/
ret = regmap_write(data->regmap, FXOS8700_XYZ_DATA_CFG, MODE_8G);
if (ret) if (ret)
return ret; return ret;
/* Set for max full-scale range (+/-8G) */ /* Max ODR (800Hz individual or 400Hz hybrid), active mode */
return regmap_write(data->regmap, FXOS8700_XYZ_DATA_CFG, MODE_8G); return regmap_update_bits(data->regmap, FXOS8700_CTRL_REG1,
FXOS8700_CTRL_ODR_MSK | FXOS8700_ACTIVE,
FIELD_PREP(FXOS8700_CTRL_ODR_MSK, FXOS8700_CTRL_ODR_MAX) |
FXOS8700_ACTIVE);
} }
static void fxos8700_chip_uninit(void *data) static void fxos8700_chip_uninit(void *data)

View File

@ -1359,12 +1359,15 @@ static int user_exp_rcv_setup(struct hfi1_filedata *fd, unsigned long arg,
addr = arg + offsetof(struct hfi1_tid_info, tidcnt); addr = arg + offsetof(struct hfi1_tid_info, tidcnt);
if (copy_to_user((void __user *)addr, &tinfo.tidcnt, if (copy_to_user((void __user *)addr, &tinfo.tidcnt,
sizeof(tinfo.tidcnt))) sizeof(tinfo.tidcnt)))
return -EFAULT; ret = -EFAULT;
addr = arg + offsetof(struct hfi1_tid_info, length); addr = arg + offsetof(struct hfi1_tid_info, length);
if (copy_to_user((void __user *)addr, &tinfo.length, if (!ret && copy_to_user((void __user *)addr, &tinfo.length,
sizeof(tinfo.length))) sizeof(tinfo.length)))
ret = -EFAULT; ret = -EFAULT;
if (ret)
hfi1_user_exp_rcv_invalid(fd, &tinfo);
} }
return ret; return ret;

View File

@ -281,8 +281,8 @@ static int usnic_uiom_map_sorted_intervals(struct list_head *intervals,
size = pa_end - pa_start + PAGE_SIZE; size = pa_end - pa_start + PAGE_SIZE;
usnic_dbg("va 0x%lx pa %pa size 0x%zx flags 0x%x", usnic_dbg("va 0x%lx pa %pa size 0x%zx flags 0x%x",
va_start, &pa_start, size, flags); va_start, &pa_start, size, flags);
err = iommu_map(pd->domain, va_start, pa_start, err = iommu_map_atomic(pd->domain, va_start,
size, flags); pa_start, size, flags);
if (err) { if (err) {
usnic_err("Failed to map va 0x%lx pa %pa size 0x%zx with err %d\n", usnic_err("Failed to map va 0x%lx pa %pa size 0x%zx with err %d\n",
va_start, &pa_start, size, err); va_start, &pa_start, size, err);
@ -298,8 +298,8 @@ static int usnic_uiom_map_sorted_intervals(struct list_head *intervals,
size = pa - pa_start + PAGE_SIZE; size = pa - pa_start + PAGE_SIZE;
usnic_dbg("va 0x%lx pa %pa size 0x%zx flags 0x%x\n", usnic_dbg("va 0x%lx pa %pa size 0x%zx flags 0x%x\n",
va_start, &pa_start, size, flags); va_start, &pa_start, size, flags);
err = iommu_map(pd->domain, va_start, pa_start, err = iommu_map_atomic(pd->domain, va_start,
size, flags); pa_start, size, flags);
if (err) { if (err) {
usnic_err("Failed to map va 0x%lx pa %pa size 0x%zx with err %d\n", usnic_err("Failed to map va 0x%lx pa %pa size 0x%zx with err %d\n",
va_start, &pa_start, size, err); va_start, &pa_start, size, err);

View File

@ -2188,6 +2188,14 @@ int ipoib_intf_init(struct ib_device *hca, u8 port, const char *name,
rn->attach_mcast = ipoib_mcast_attach; rn->attach_mcast = ipoib_mcast_attach;
rn->detach_mcast = ipoib_mcast_detach; rn->detach_mcast = ipoib_mcast_detach;
rn->hca = hca; rn->hca = hca;
rc = netif_set_real_num_tx_queues(dev, 1);
if (rc)
goto out;
rc = netif_set_real_num_rx_queues(dev, 1);
if (rc)
goto out;
} }
priv->rn_ops = dev->netdev_ops; priv->rn_ops = dev->netdev_ops;

View File

@ -902,7 +902,7 @@ static void rtrs_clt_init_req(struct rtrs_clt_io_req *req,
req->need_inv_comp = false; req->need_inv_comp = false;
req->inv_errno = 0; req->inv_errno = 0;
iov_iter_kvec(&iter, READ, vec, 1, usr_len); iov_iter_kvec(&iter, WRITE, vec, 1, usr_len);
len = _copy_from_iter(req->iu->buf, usr_len, &iter); len = _copy_from_iter(req->iu->buf, usr_len, &iter);
WARN_ON(len != usr_len); WARN_ON(len != usr_len);

File diff suppressed because it is too large Load Diff

View File

@ -76,7 +76,7 @@ void bond_debug_reregister(struct bonding *bond)
d = debugfs_rename(bonding_debug_root, bond->debug_dir, d = debugfs_rename(bonding_debug_root, bond->debug_dir,
bonding_debug_root, bond->dev->name); bonding_debug_root, bond->dev->name);
if (d) { if (!IS_ERR(d)) {
bond->debug_dir = d; bond->debug_dir = d;
} else { } else {
netdev_warn(bond->dev, "failed to reregister, so just unregister old one\n"); netdev_warn(bond->dev, "failed to reregister, so just unregister old one\n");

View File

@ -4853,7 +4853,7 @@ static int __init ice_module_init(void)
pr_info("%s\n", ice_driver_string); pr_info("%s\n", ice_driver_string);
pr_info("%s\n", ice_copyright); pr_info("%s\n", ice_copyright);
ice_wq = alloc_workqueue("%s", WQ_MEM_RECLAIM, 0, KBUILD_MODNAME); ice_wq = alloc_workqueue("%s", 0, 0, KBUILD_MODNAME);
if (!ice_wq) { if (!ice_wq) {
pr_err("Failed to create workqueue\n"); pr_err("Failed to create workqueue\n");
return -ENOMEM; return -ENOMEM;

View File

@ -134,10 +134,12 @@ static int igc_ptp_feature_enable_i225(struct ptp_clock_info *ptp,
* *
* We need to convert the system time value stored in the RX/TXSTMP registers * We need to convert the system time value stored in the RX/TXSTMP registers
* into a hwtstamp which can be used by the upper level timestamping functions. * into a hwtstamp which can be used by the upper level timestamping functions.
*
* Returns 0 on success.
**/ **/
static void igc_ptp_systim_to_hwtstamp(struct igc_adapter *adapter, static int igc_ptp_systim_to_hwtstamp(struct igc_adapter *adapter,
struct skb_shared_hwtstamps *hwtstamps, struct skb_shared_hwtstamps *hwtstamps,
u64 systim) u64 systim)
{ {
switch (adapter->hw.mac.type) { switch (adapter->hw.mac.type) {
case igc_i225: case igc_i225:
@ -147,8 +149,9 @@ static void igc_ptp_systim_to_hwtstamp(struct igc_adapter *adapter,
systim & 0xFFFFFFFF); systim & 0xFFFFFFFF);
break; break;
default: default:
break; return -EINVAL;
} }
return 0;
} }
/** /**
@ -372,7 +375,8 @@ static void igc_ptp_tx_hwtstamp(struct igc_adapter *adapter)
regval = rd32(IGC_TXSTMPL); regval = rd32(IGC_TXSTMPL);
regval |= (u64)rd32(IGC_TXSTMPH) << 32; regval |= (u64)rd32(IGC_TXSTMPH) << 32;
igc_ptp_systim_to_hwtstamp(adapter, &shhwtstamps, regval); if (igc_ptp_systim_to_hwtstamp(adapter, &shhwtstamps, regval))
return;
switch (adapter->link_speed) { switch (adapter->link_speed) {
case SPEED_10: case SPEED_10:

View File

@ -64,6 +64,7 @@ static int mlx5_query_mtrc_caps(struct mlx5_fw_tracer *tracer)
MLX5_GET(mtrc_cap, out, num_string_trace); MLX5_GET(mtrc_cap, out, num_string_trace);
tracer->str_db.num_string_db = MLX5_GET(mtrc_cap, out, num_string_db); tracer->str_db.num_string_db = MLX5_GET(mtrc_cap, out, num_string_db);
tracer->owner = !!MLX5_GET(mtrc_cap, out, trace_owner); tracer->owner = !!MLX5_GET(mtrc_cap, out, trace_owner);
tracer->str_db.loaded = false;
for (i = 0; i < tracer->str_db.num_string_db; i++) { for (i = 0; i < tracer->str_db.num_string_db; i++) {
mtrc_cap_sp = MLX5_ADDR_OF(mtrc_cap, out, string_db_param[i]); mtrc_cap_sp = MLX5_ADDR_OF(mtrc_cap, out, string_db_param[i]);
@ -756,6 +757,7 @@ static int mlx5_fw_tracer_set_mtrc_conf(struct mlx5_fw_tracer *tracer)
if (err) if (err)
mlx5_core_warn(dev, "FWTracer: Failed to set tracer configurations %d\n", err); mlx5_core_warn(dev, "FWTracer: Failed to set tracer configurations %d\n", err);
tracer->buff.consumer_index = 0;
return err; return err;
} }
@ -820,7 +822,6 @@ static void mlx5_fw_tracer_ownership_change(struct work_struct *work)
mlx5_core_dbg(tracer->dev, "FWTracer: ownership changed, current=(%d)\n", tracer->owner); mlx5_core_dbg(tracer->dev, "FWTracer: ownership changed, current=(%d)\n", tracer->owner);
if (tracer->owner) { if (tracer->owner) {
tracer->owner = false; tracer->owner = false;
tracer->buff.consumer_index = 0;
return; return;
} }

View File

@ -166,16 +166,16 @@ static inline int mlx5_ptys_rate_enum_to_int(enum mlx5_ptys_rate rate)
} }
} }
static int mlx5i_get_speed_settings(u16 ib_link_width_oper, u16 ib_proto_oper) static u32 mlx5i_get_speed_settings(u16 ib_link_width_oper, u16 ib_proto_oper)
{ {
int rate, width; int rate, width;
rate = mlx5_ptys_rate_enum_to_int(ib_proto_oper); rate = mlx5_ptys_rate_enum_to_int(ib_proto_oper);
if (rate < 0) if (rate < 0)
return -EINVAL; return SPEED_UNKNOWN;
width = mlx5_ptys_width_enum_to_int(ib_link_width_oper); width = mlx5_ptys_width_enum_to_int(ib_link_width_oper);
if (width < 0) if (width < 0)
return -EINVAL; return SPEED_UNKNOWN;
return rate * width; return rate * width;
} }
@ -198,16 +198,13 @@ static int mlx5i_get_link_ksettings(struct net_device *netdev,
ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising); ethtool_link_ksettings_zero_link_mode(link_ksettings, advertising);
speed = mlx5i_get_speed_settings(ib_link_width_oper, ib_proto_oper); speed = mlx5i_get_speed_settings(ib_link_width_oper, ib_proto_oper);
if (speed < 0) link_ksettings->base.speed = speed;
return -EINVAL; link_ksettings->base.duplex = speed == SPEED_UNKNOWN ? DUPLEX_UNKNOWN : DUPLEX_FULL;
link_ksettings->base.duplex = DUPLEX_FULL;
link_ksettings->base.port = PORT_OTHER; link_ksettings->base.port = PORT_OTHER;
link_ksettings->base.autoneg = AUTONEG_DISABLE; link_ksettings->base.autoneg = AUTONEG_DISABLE;
link_ksettings->base.speed = speed;
return 0; return 0;
} }

View File

@ -468,6 +468,18 @@ ocelot_flower_parse_key(struct ocelot *ocelot, int port, bool ingress,
flow_rule_match_control(rule, &match); flow_rule_match_control(rule, &match);
} }
if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_VLAN)) {
struct flow_match_vlan match;
flow_rule_match_vlan(rule, &match);
filter->key_type = OCELOT_VCAP_KEY_ANY;
filter->vlan.vid.value = match.key->vlan_id;
filter->vlan.vid.mask = match.mask->vlan_id;
filter->vlan.pcp.value[0] = match.key->vlan_priority;
filter->vlan.pcp.mask[0] = match.mask->vlan_priority;
match_protocol = false;
}
if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ETH_ADDRS)) { if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_ETH_ADDRS)) {
struct flow_match_eth_addrs match; struct flow_match_eth_addrs match;
@ -600,18 +612,6 @@ ocelot_flower_parse_key(struct ocelot *ocelot, int port, bool ingress,
match_protocol = false; match_protocol = false;
} }
if (flow_rule_match_key(rule, FLOW_DISSECTOR_KEY_VLAN)) {
struct flow_match_vlan match;
flow_rule_match_vlan(rule, &match);
filter->key_type = OCELOT_VCAP_KEY_ANY;
filter->vlan.vid.value = match.key->vlan_id;
filter->vlan.vid.mask = match.mask->vlan_id;
filter->vlan.pcp.value[0] = match.key->vlan_priority;
filter->vlan.pcp.mask[0] = match.mask->vlan_priority;
match_protocol = false;
}
finished_key_parsing: finished_key_parsing:
if (match_protocol && proto != ETH_P_ALL) { if (match_protocol && proto != ETH_P_ALL) {
if (filter->block_id == VCAP_ES0) { if (filter->block_id == VCAP_ES0) {

View File

@ -257,6 +257,7 @@ static int ionic_qcq_enable(struct ionic_qcq *qcq)
.oper = IONIC_Q_ENABLE, .oper = IONIC_Q_ENABLE,
}, },
}; };
int ret;
idev = &lif->ionic->idev; idev = &lif->ionic->idev;
dev = lif->ionic->dev; dev = lif->ionic->dev;
@ -264,16 +265,24 @@ static int ionic_qcq_enable(struct ionic_qcq *qcq)
dev_dbg(dev, "q_enable.index %d q_enable.qtype %d\n", dev_dbg(dev, "q_enable.index %d q_enable.qtype %d\n",
ctx.cmd.q_control.index, ctx.cmd.q_control.type); ctx.cmd.q_control.index, ctx.cmd.q_control.type);
if (qcq->flags & IONIC_QCQ_F_INTR)
ionic_intr_clean(idev->intr_ctrl, qcq->intr.index);
ret = ionic_adminq_post_wait(lif, &ctx);
if (ret)
return ret;
if (qcq->napi.poll)
napi_enable(&qcq->napi);
if (qcq->flags & IONIC_QCQ_F_INTR) { if (qcq->flags & IONIC_QCQ_F_INTR) {
irq_set_affinity_hint(qcq->intr.vector, irq_set_affinity_hint(qcq->intr.vector,
&qcq->intr.affinity_mask); &qcq->intr.affinity_mask);
napi_enable(&qcq->napi);
ionic_intr_clean(idev->intr_ctrl, qcq->intr.index);
ionic_intr_mask(idev->intr_ctrl, qcq->intr.index, ionic_intr_mask(idev->intr_ctrl, qcq->intr.index,
IONIC_INTR_MASK_CLEAR); IONIC_INTR_MASK_CLEAR);
} }
return ionic_adminq_post_wait(lif, &ctx); return 0;
} }
static int ionic_qcq_disable(struct ionic_qcq *qcq, bool send_to_hw) static int ionic_qcq_disable(struct ionic_qcq *qcq, bool send_to_hw)

View File

@ -1456,7 +1456,12 @@ int qede_poll(struct napi_struct *napi, int budget)
rx_work_done = (likely(fp->type & QEDE_FASTPATH_RX) && rx_work_done = (likely(fp->type & QEDE_FASTPATH_RX) &&
qede_has_rx_work(fp->rxq)) ? qede_has_rx_work(fp->rxq)) ?
qede_rx_int(fp, budget) : 0; qede_rx_int(fp, budget) : 0;
if (rx_work_done < budget) {
if (fp->xdp_xmit & QEDE_XDP_REDIRECT)
xdp_do_flush();
/* Handle case where we are called by netpoll with a budget of 0 */
if (rx_work_done < budget || !budget) {
if (!qede_poll_is_more_work(fp)) { if (!qede_poll_is_more_work(fp)) {
napi_complete_done(napi, rx_work_done); napi_complete_done(napi, rx_work_done);
@ -1474,9 +1479,6 @@ int qede_poll(struct napi_struct *napi, int budget)
qede_update_tx_producer(fp->xdp_tx); qede_update_tx_producer(fp->xdp_tx);
} }
if (fp->xdp_xmit & QEDE_XDP_REDIRECT)
xdp_do_flush_map();
return rx_work_done; return rx_work_done;
} }

View File

@ -1047,8 +1047,11 @@ static int efx_pci_probe_post_io(struct efx_nic *efx)
/* Determine netdevice features */ /* Determine netdevice features */
net_dev->features |= (efx->type->offload_features | NETIF_F_SG | net_dev->features |= (efx->type->offload_features | NETIF_F_SG |
NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_RXALL); NETIF_F_TSO | NETIF_F_RXCSUM | NETIF_F_RXALL);
if (efx->type->offload_features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM)) if (efx->type->offload_features & (NETIF_F_IPV6_CSUM | NETIF_F_HW_CSUM)) {
net_dev->features |= NETIF_F_TSO6; net_dev->features |= NETIF_F_TSO6;
if (efx_has_cap(efx, TX_TSO_V2_ENCAP))
net_dev->hw_enc_features |= NETIF_F_TSO6;
}
/* Check whether device supports TSO */ /* Check whether device supports TSO */
if (!efx->type->tso_versions || !efx->type->tso_versions(efx)) if (!efx->type->tso_versions || !efx->type->tso_versions(efx))
net_dev->features &= ~NETIF_F_ALL_TSO; net_dev->features &= ~NETIF_F_ALL_TSO;

View File

@ -247,7 +247,8 @@ static int dp83822_config_intr(struct phy_device *phydev)
DP83822_ENERGY_DET_INT_EN | DP83822_ENERGY_DET_INT_EN |
DP83822_LINK_QUAL_INT_EN); DP83822_LINK_QUAL_INT_EN);
if (!dp83822->fx_enabled) /* Private data pointer is NULL on DP83825/26 */
if (!dp83822 || !dp83822->fx_enabled)
misr_status |= DP83822_ANEG_COMPLETE_INT_EN | misr_status |= DP83822_ANEG_COMPLETE_INT_EN |
DP83822_DUP_MODE_CHANGE_INT_EN | DP83822_DUP_MODE_CHANGE_INT_EN |
DP83822_SPEED_CHANGED_INT_EN; DP83822_SPEED_CHANGED_INT_EN;
@ -267,7 +268,8 @@ static int dp83822_config_intr(struct phy_device *phydev)
DP83822_PAGE_RX_INT_EN | DP83822_PAGE_RX_INT_EN |
DP83822_EEE_ERROR_CHANGE_INT_EN); DP83822_EEE_ERROR_CHANGE_INT_EN);
if (!dp83822->fx_enabled) /* Private data pointer is NULL on DP83825/26 */
if (!dp83822 || !dp83822->fx_enabled)
misr_status |= DP83822_ANEG_ERR_INT_EN | misr_status |= DP83822_ANEG_ERR_INT_EN |
DP83822_WOL_PKT_INT_EN; DP83822_WOL_PKT_INT_EN;

View File

@ -235,6 +235,8 @@ static struct phy_driver meson_gxl_phy[] = {
.config_intr = meson_gxl_config_intr, .config_intr = meson_gxl_config_intr,
.suspend = genphy_suspend, .suspend = genphy_suspend,
.resume = genphy_resume, .resume = genphy_resume,
.read_mmd = genphy_read_mmd_unsupported,
.write_mmd = genphy_write_mmd_unsupported,
}, { }, {
PHY_ID_MATCH_EXACT(0x01803301), PHY_ID_MATCH_EXACT(0x01803301),
.name = "Meson G12A Internal PHY", .name = "Meson G12A Internal PHY",
@ -245,6 +247,8 @@ static struct phy_driver meson_gxl_phy[] = {
.config_intr = meson_gxl_config_intr, .config_intr = meson_gxl_config_intr,
.suspend = genphy_suspend, .suspend = genphy_suspend,
.resume = genphy_resume, .resume = genphy_resume,
.read_mmd = genphy_read_mmd_unsupported,
.write_mmd = genphy_write_mmd_unsupported,
}, },
}; };

View File

@ -57,9 +57,7 @@
static inline int static inline int
pl_vendor_req(struct usbnet *dev, u8 req, u8 val, u8 index) pl_vendor_req(struct usbnet *dev, u8 req, u8 val, u8 index)
{ {
return usbnet_read_cmd(dev, req, return usbnet_write_cmd(dev, req, USB_TYPE_VENDOR | USB_RECIP_DEVICE,
USB_DIR_IN | USB_TYPE_VENDOR |
USB_RECIP_DEVICE,
val, index, NULL, 0); val, index, NULL, 0);
} }

View File

@ -1525,13 +1525,13 @@ static int virtnet_poll(struct napi_struct *napi, int budget)
received = virtnet_receive(rq, budget, &xdp_xmit); received = virtnet_receive(rq, budget, &xdp_xmit);
if (xdp_xmit & VIRTIO_XDP_REDIR)
xdp_do_flush();
/* Out of packets? */ /* Out of packets? */
if (received < budget) if (received < budget)
virtqueue_napi_complete(napi, rq->vq, received); virtqueue_napi_complete(napi, rq->vq, received);
if (xdp_xmit & VIRTIO_XDP_REDIR)
xdp_do_flush();
if (xdp_xmit & VIRTIO_XDP_TX) { if (xdp_xmit & VIRTIO_XDP_TX) {
sq = virtnet_xdp_get_sq(vi); sq = virtnet_xdp_get_sq(vi);
if (virtqueue_kick_prepare(sq->vq) && virtqueue_notify(sq->vq)) { if (virtqueue_kick_prepare(sq->vq) && virtqueue_notify(sq->vq)) {
@ -1928,8 +1928,8 @@ static int virtnet_close(struct net_device *dev)
cancel_delayed_work_sync(&vi->refill); cancel_delayed_work_sync(&vi->refill);
for (i = 0; i < vi->max_queue_pairs; i++) { for (i = 0; i < vi->max_queue_pairs; i++) {
xdp_rxq_info_unreg(&vi->rq[i].xdp_rxq);
napi_disable(&vi->rq[i].napi); napi_disable(&vi->rq[i].napi);
xdp_rxq_info_unreg(&vi->rq[i].xdp_rxq);
virtnet_napi_tx_disable(&vi->sq[i].napi); virtnet_napi_tx_disable(&vi->sq[i].napi);
} }

View File

@ -90,6 +90,9 @@
#define BRCMF_ASSOC_PARAMS_FIXED_SIZE \ #define BRCMF_ASSOC_PARAMS_FIXED_SIZE \
(sizeof(struct brcmf_assoc_params_le) - sizeof(u16)) (sizeof(struct brcmf_assoc_params_le) - sizeof(u16))
#define BRCMF_MAX_CHANSPEC_LIST \
(BRCMF_DCMD_MEDLEN / sizeof(__le32) - 1)
static bool check_vif_up(struct brcmf_cfg80211_vif *vif) static bool check_vif_up(struct brcmf_cfg80211_vif *vif)
{ {
if (!test_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state)) { if (!test_bit(BRCMF_VIF_STATUS_READY, &vif->sme_state)) {
@ -6459,6 +6462,13 @@ static int brcmf_construct_chaninfo(struct brcmf_cfg80211_info *cfg,
band->channels[i].flags = IEEE80211_CHAN_DISABLED; band->channels[i].flags = IEEE80211_CHAN_DISABLED;
total = le32_to_cpu(list->count); total = le32_to_cpu(list->count);
if (total > BRCMF_MAX_CHANSPEC_LIST) {
bphy_err(drvr, "Invalid count of channel Spec. (%u)\n",
total);
err = -EINVAL;
goto fail_pbuf;
}
for (i = 0; i < total; i++) { for (i = 0; i < total; i++) {
ch.chspec = (u16)le32_to_cpu(list->element[i]); ch.chspec = (u16)le32_to_cpu(list->element[i]);
cfg->d11inf.decchspec(&ch); cfg->d11inf.decchspec(&ch);
@ -6604,6 +6614,13 @@ static int brcmf_enable_bw40_2g(struct brcmf_cfg80211_info *cfg)
band = cfg_to_wiphy(cfg)->bands[NL80211_BAND_2GHZ]; band = cfg_to_wiphy(cfg)->bands[NL80211_BAND_2GHZ];
list = (struct brcmf_chanspec_list *)pbuf; list = (struct brcmf_chanspec_list *)pbuf;
num_chan = le32_to_cpu(list->count); num_chan = le32_to_cpu(list->count);
if (num_chan > BRCMF_MAX_CHANSPEC_LIST) {
bphy_err(drvr, "Invalid count of channel Spec. (%u)\n",
num_chan);
kfree(pbuf);
return -EINVAL;
}
for (i = 0; i < num_chan; i++) { for (i = 0; i < num_chan; i++) {
ch.chspec = (u16)le32_to_cpu(list->element[i]); ch.chspec = (u16)le32_to_cpu(list->element[i]);
cfg->d11inf.decchspec(&ch); cfg->d11inf.decchspec(&ch);

View File

@ -625,9 +625,11 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
return ERR_PTR(rval); return ERR_PTR(rval);
} }
nvmem->id = rval;
if (config->wp_gpio) if (config->wp_gpio)
nvmem->wp_gpio = config->wp_gpio; nvmem->wp_gpio = config->wp_gpio;
else else if (!config->ignore_wp)
nvmem->wp_gpio = gpiod_get_optional(config->dev, "wp", nvmem->wp_gpio = gpiod_get_optional(config->dev, "wp",
GPIOD_OUT_HIGH); GPIOD_OUT_HIGH);
if (IS_ERR(nvmem->wp_gpio)) { if (IS_ERR(nvmem->wp_gpio)) {
@ -640,7 +642,6 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
kref_init(&nvmem->refcnt); kref_init(&nvmem->refcnt);
INIT_LIST_HEAD(&nvmem->cells); INIT_LIST_HEAD(&nvmem->cells);
nvmem->id = rval;
nvmem->owner = config->owner; nvmem->owner = config->owner;
if (!nvmem->owner && config->dev->driver) if (!nvmem->owner && config->dev->driver)
nvmem->owner = config->dev->driver->owner; nvmem->owner = config->dev->driver->owner;
@ -694,7 +695,7 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
if (config->cells) { if (config->cells) {
rval = nvmem_add_cells(nvmem, config->cells, config->ncells); rval = nvmem_add_cells(nvmem, config->cells, config->ncells);
if (rval) if (rval)
goto err_teardown_compat; goto err_remove_cells;
} }
rval = nvmem_add_cells_from_table(nvmem); rval = nvmem_add_cells_from_table(nvmem);
@ -711,7 +712,6 @@ struct nvmem_device *nvmem_register(const struct nvmem_config *config)
err_remove_cells: err_remove_cells:
nvmem_device_remove_all_cells(nvmem); nvmem_device_remove_all_cells(nvmem);
err_teardown_compat:
if (config->compat) if (config->compat)
nvmem_sysfs_remove_compat(nvmem, config); nvmem_sysfs_remove_compat(nvmem, config);
err_device_del: err_device_del:

View File

@ -166,6 +166,7 @@ static const struct of_device_id sdam_match_table[] = {
{ .compatible = "qcom,spmi-sdam" }, { .compatible = "qcom,spmi-sdam" },
{}, {},
}; };
MODULE_DEVICE_TABLE(of, sdam_match_table);
static struct platform_driver sdam_driver = { static struct platform_driver sdam_driver = {
.driver = { .driver = {

View File

@ -990,8 +990,19 @@ int of_dma_get_range(struct device_node *np, const struct bus_dma_region **map)
} }
of_dma_range_parser_init(&parser, node); of_dma_range_parser_init(&parser, node);
for_each_of_range(&parser, &range) for_each_of_range(&parser, &range) {
if (range.cpu_addr == OF_BAD_ADDR) {
pr_err("translation of DMA address(%llx) to CPU address failed node(%pOF)\n",
range.bus_addr, node);
continue;
}
num_ranges++; num_ranges++;
}
if (!num_ranges) {
ret = -EINVAL;
goto out;
}
r = kcalloc(num_ranges + 1, sizeof(*r), GFP_KERNEL); r = kcalloc(num_ranges + 1, sizeof(*r), GFP_KERNEL);
if (!r) { if (!r) {
@ -1000,18 +1011,16 @@ int of_dma_get_range(struct device_node *np, const struct bus_dma_region **map)
} }
/* /*
* Record all info in the generic DMA ranges array for struct device. * Record all info in the generic DMA ranges array for struct device,
* returning an error if we don't find any parsable ranges.
*/ */
*map = r; *map = r;
of_dma_range_parser_init(&parser, node); of_dma_range_parser_init(&parser, node);
for_each_of_range(&parser, &range) { for_each_of_range(&parser, &range) {
pr_debug("dma_addr(%llx) cpu_addr(%llx) size(%llx)\n", pr_debug("dma_addr(%llx) cpu_addr(%llx) size(%llx)\n",
range.bus_addr, range.cpu_addr, range.size); range.bus_addr, range.cpu_addr, range.size);
if (range.cpu_addr == OF_BAD_ADDR) { if (range.cpu_addr == OF_BAD_ADDR)
pr_err("translation of DMA address(%llx) to CPU address failed node(%pOF)\n",
range.bus_addr, node);
continue; continue;
}
r->cpu_start = range.cpu_addr; r->cpu_start = range.cpu_addr;
r->dma_start = range.bus_addr; r->dma_start = range.bus_addr;
r->size = range.size; r->size = range.size;

View File

@ -121,7 +121,7 @@ static int aspeed_disable_sig(struct aspeed_pinmux_data *ctx,
int ret = 0; int ret = 0;
if (!exprs) if (!exprs)
return true; return -EINVAL;
while (*exprs && !ret) { while (*exprs && !ret) {
ret = aspeed_sig_expr_disable(ctx, *exprs); ret = aspeed_sig_expr_disable(ctx, *exprs);

View File

@ -1606,6 +1606,12 @@ const struct intel_pinctrl_soc_data *intel_pinctrl_get_soc_data(struct platform_
EXPORT_SYMBOL_GPL(intel_pinctrl_get_soc_data); EXPORT_SYMBOL_GPL(intel_pinctrl_get_soc_data);
#ifdef CONFIG_PM_SLEEP #ifdef CONFIG_PM_SLEEP
static bool __intel_gpio_is_direct_irq(u32 value)
{
return (value & PADCFG0_GPIROUTIOXAPIC) && (value & PADCFG0_GPIOTXDIS) &&
(__intel_gpio_get_gpio_mode(value) == PADCFG0_PMODE_GPIO);
}
static bool intel_pinctrl_should_save(struct intel_pinctrl *pctrl, unsigned int pin) static bool intel_pinctrl_should_save(struct intel_pinctrl *pctrl, unsigned int pin)
{ {
const struct pin_desc *pd = pin_desc_get(pctrl->pctldev, pin); const struct pin_desc *pd = pin_desc_get(pctrl->pctldev, pin);
@ -1639,8 +1645,7 @@ static bool intel_pinctrl_should_save(struct intel_pinctrl *pctrl, unsigned int
* See https://bugzilla.kernel.org/show_bug.cgi?id=214749. * See https://bugzilla.kernel.org/show_bug.cgi?id=214749.
*/ */
value = readl(intel_get_padcfg(pctrl, pin, PADCFG0)); value = readl(intel_get_padcfg(pctrl, pin, PADCFG0));
if ((value & PADCFG0_GPIROUTIOXAPIC) && (value & PADCFG0_GPIOTXDIS) && if (__intel_gpio_is_direct_irq(value))
(__intel_gpio_get_gpio_mode(value) == PADCFG0_PMODE_GPIO))
return true; return true;
return false; return false;
@ -1770,7 +1775,12 @@ int intel_pinctrl_resume_noirq(struct device *dev)
for (i = 0; i < pctrl->soc->npins; i++) { for (i = 0; i < pctrl->soc->npins; i++) {
const struct pinctrl_pin_desc *desc = &pctrl->soc->pins[i]; const struct pinctrl_pin_desc *desc = &pctrl->soc->pins[i];
if (!intel_pinctrl_should_save(pctrl, desc->number)) if (!(intel_pinctrl_should_save(pctrl, desc->number) ||
/*
* If the firmware mangled the register contents too much,
* check the saved value for the Direct IRQ mode.
*/
__intel_gpio_is_direct_irq(pads[i].padcfg0)))
continue; continue;
intel_restore_padcfg(pctrl, desc->number, PADCFG0, pads[i].padcfg0); intel_restore_padcfg(pctrl, desc->number, PADCFG0, pads[i].padcfg0);

View File

@ -372,6 +372,8 @@ static int pcs_set_mux(struct pinctrl_dev *pctldev, unsigned fselector,
if (!pcs->fmask) if (!pcs->fmask)
return 0; return 0;
function = pinmux_generic_get_function(pctldev, fselector); function = pinmux_generic_get_function(pctldev, fselector);
if (!function)
return -EINVAL;
func = function->data; func = function->data;
if (!func) if (!func)
return -EINVAL; return -EINVAL;

View File

@ -259,6 +259,9 @@ static const struct key_entry dell_wmi_keymap_type_0010[] = {
{ KE_KEY, 0x57, { KEY_BRIGHTNESSDOWN } }, { KE_KEY, 0x57, { KEY_BRIGHTNESSDOWN } },
{ KE_KEY, 0x58, { KEY_BRIGHTNESSUP } }, { KE_KEY, 0x58, { KEY_BRIGHTNESSUP } },
/*Speaker Mute*/
{ KE_KEY, 0x109, { KEY_MUTE} },
/* Mic mute */ /* Mic mute */
{ KE_KEY, 0x150, { KEY_MICMUTE } }, { KE_KEY, 0x150, { KEY_MICMUTE } },

View File

@ -802,7 +802,7 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost,
enum iscsi_host_param param, char *buf) enum iscsi_host_param param, char *buf)
{ {
struct iscsi_sw_tcp_host *tcp_sw_host = iscsi_host_priv(shost); struct iscsi_sw_tcp_host *tcp_sw_host = iscsi_host_priv(shost);
struct iscsi_session *session = tcp_sw_host->session; struct iscsi_session *session;
struct iscsi_conn *conn; struct iscsi_conn *conn;
struct iscsi_tcp_conn *tcp_conn; struct iscsi_tcp_conn *tcp_conn;
struct iscsi_sw_tcp_conn *tcp_sw_conn; struct iscsi_sw_tcp_conn *tcp_sw_conn;
@ -812,6 +812,7 @@ static int iscsi_sw_tcp_host_get_param(struct Scsi_Host *shost,
switch (param) { switch (param) {
case ISCSI_HOST_PARAM_IPADDRESS: case ISCSI_HOST_PARAM_IPADDRESS:
session = tcp_sw_host->session;
if (!session) if (!session)
return -ENOTCONN; return -ENOTCONN;
@ -906,12 +907,14 @@ iscsi_sw_tcp_session_create(struct iscsi_endpoint *ep, uint16_t cmds_max,
if (!cls_session) if (!cls_session)
goto remove_host; goto remove_host;
session = cls_session->dd_data; session = cls_session->dd_data;
tcp_sw_host = iscsi_host_priv(shost);
tcp_sw_host->session = session;
shost->can_queue = session->scsi_cmds_max; shost->can_queue = session->scsi_cmds_max;
if (iscsi_tcp_r2tpool_alloc(session)) if (iscsi_tcp_r2tpool_alloc(session))
goto remove_session; goto remove_session;
/* We are now fully setup so expose the session to sysfs. */
tcp_sw_host = iscsi_host_priv(shost);
tcp_sw_host->session = session;
return cls_session; return cls_session;
remove_session: remove_session:

View File

@ -1129,8 +1129,7 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
* that no LUN is present, so don't add sdev in these cases. * that no LUN is present, so don't add sdev in these cases.
* Two specific examples are: * Two specific examples are:
* 1) NetApp targets: return PQ=1, PDT=0x1f * 1) NetApp targets: return PQ=1, PDT=0x1f
* 2) IBM/2145 targets: return PQ=1, PDT=0 * 2) USB UFI: returns PDT=0x1f, with the PQ bits being "reserved"
* 3) USB UFI: returns PDT=0x1f, with the PQ bits being "reserved"
* in the UFI 1.0 spec (we cannot rely on reserved bits). * in the UFI 1.0 spec (we cannot rely on reserved bits).
* *
* References: * References:
@ -1144,8 +1143,8 @@ static int scsi_probe_and_add_lun(struct scsi_target *starget,
* PDT=00h Direct-access device (floppy) * PDT=00h Direct-access device (floppy)
* PDT=1Fh none (no FDD connected to the requested logical unit) * PDT=1Fh none (no FDD connected to the requested logical unit)
*/ */
if (((result[0] >> 5) == 1 || if (((result[0] >> 5) == 1 || starget->pdt_1f_for_no_lun) &&
(starget->pdt_1f_for_no_lun && (result[0] & 0x1f) == 0x1f)) && (result[0] & 0x1f) == 0x1f &&
!scsi_is_wlun(lun)) { !scsi_is_wlun(lun)) {
SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev, SCSI_LOG_SCAN_BUS(3, sdev_printk(KERN_INFO, sdev,
"scsi scan: peripheral device type" "scsi scan: peripheral device type"

View File

@ -353,7 +353,7 @@ static void dw_spi_irq_setup(struct dw_spi *dws)
* will be adjusted at the final stage of the IRQ-based SPI transfer * will be adjusted at the final stage of the IRQ-based SPI transfer
* execution so not to lose the leftover of the incoming data. * execution so not to lose the leftover of the incoming data.
*/ */
level = min_t(u16, dws->fifo_len / 2, dws->tx_len); level = min_t(unsigned int, dws->fifo_len / 2, dws->tx_len);
dw_writel(dws, DW_SPI_TXFTLR, level); dw_writel(dws, DW_SPI_TXFTLR, level);
dw_writel(dws, DW_SPI_RXFTLR, level - 1); dw_writel(dws, DW_SPI_RXFTLR, level - 1);

View File

@ -340,7 +340,7 @@ static int fd_do_rw(struct se_cmd *cmd, struct file *fd,
len += sg->length; len += sg->length;
} }
iov_iter_bvec(&iter, READ, bvec, sgl_nents, len); iov_iter_bvec(&iter, is_write, bvec, sgl_nents, len);
if (is_write) if (is_write)
ret = vfs_iter_write(fd, &iter, &pos, 0); ret = vfs_iter_write(fd, &iter, &pos, 0);
else else
@ -477,7 +477,7 @@ fd_execute_write_same(struct se_cmd *cmd)
len += se_dev->dev_attrib.block_size; len += se_dev->dev_attrib.block_size;
} }
iov_iter_bvec(&iter, READ, bvec, nolb, len); iov_iter_bvec(&iter, WRITE, bvec, nolb, len);
ret = vfs_iter_write(fd_dev->fd_file, &iter, &pos, 0); ret = vfs_iter_write(fd_dev->fd_file, &iter, &pos, 0);
kfree(bvec); kfree(bvec);

View File

@ -82,8 +82,8 @@ static bool __target_check_io_state(struct se_cmd *se_cmd,
{ {
struct se_session *sess = se_cmd->se_sess; struct se_session *sess = se_cmd->se_sess;
assert_spin_locked(&sess->sess_cmd_lock); lockdep_assert_held(&sess->sess_cmd_lock);
WARN_ON_ONCE(!irqs_disabled());
/* /*
* If command already reached CMD_T_COMPLETE state within * If command already reached CMD_T_COMPLETE state within
* target_complete_cmd() or CMD_T_FABRIC_STOP due to shutdown, * target_complete_cmd() or CMD_T_FABRIC_STOP due to shutdown,

View File

@ -46,19 +46,39 @@ static void __dma_rx_complete(void *param)
struct uart_8250_dma *dma = p->dma; struct uart_8250_dma *dma = p->dma;
struct tty_port *tty_port = &p->port.state->port; struct tty_port *tty_port = &p->port.state->port;
struct dma_tx_state state; struct dma_tx_state state;
enum dma_status dma_status;
int count; int count;
dma->rx_running = 0; /*
dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state); * New DMA Rx can be started during the completion handler before it
* could acquire port's lock and it might still be ongoing. Don't to
* anything in such case.
*/
dma_status = dmaengine_tx_status(dma->rxchan, dma->rx_cookie, &state);
if (dma_status == DMA_IN_PROGRESS)
return;
count = dma->rx_size - state.residue; count = dma->rx_size - state.residue;
tty_insert_flip_string(tty_port, dma->rx_buf, count); tty_insert_flip_string(tty_port, dma->rx_buf, count);
p->port.icount.rx += count; p->port.icount.rx += count;
dma->rx_running = 0;
tty_flip_buffer_push(tty_port); tty_flip_buffer_push(tty_port);
} }
static void dma_rx_complete(void *param)
{
struct uart_8250_port *p = param;
struct uart_8250_dma *dma = p->dma;
unsigned long flags;
spin_lock_irqsave(&p->port.lock, flags);
if (dma->rx_running)
__dma_rx_complete(p);
spin_unlock_irqrestore(&p->port.lock, flags);
}
int serial8250_tx_dma(struct uart_8250_port *p) int serial8250_tx_dma(struct uart_8250_port *p)
{ {
struct uart_8250_dma *dma = p->dma; struct uart_8250_dma *dma = p->dma;
@ -130,7 +150,7 @@ int serial8250_rx_dma(struct uart_8250_port *p)
return -EBUSY; return -EBUSY;
dma->rx_running = 1; dma->rx_running = 1;
desc->callback = __dma_rx_complete; desc->callback = dma_rx_complete;
desc->callback_param = p; desc->callback_param = p;
dma->rx_cookie = dmaengine_submit(desc); dma->rx_cookie = dmaengine_submit(desc);

View File

@ -386,10 +386,6 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
uni_mode = use_unicode(inode); uni_mode = use_unicode(inode);
attr = use_attributes(inode); attr = use_attributes(inode);
ret = -ENXIO;
vc = vcs_vc(inode, &viewed);
if (!vc)
goto unlock_out;
ret = -EINVAL; ret = -EINVAL;
if (pos < 0) if (pos < 0)
@ -407,6 +403,11 @@ vcs_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
unsigned int this_round, skip = 0; unsigned int this_round, skip = 0;
int size; int size;
ret = -ENXIO;
vc = vcs_vc(inode, &viewed);
if (!vc)
goto unlock_out;
/* Check whether we are above size each round, /* Check whether we are above size each round,
* as copy_to_user at the end of this loop * as copy_to_user at the end of this loop
* could sleep. * could sleep.

View File

@ -527,6 +527,9 @@ static const struct usb_device_id usb_quirk_list[] = {
/* DJI CineSSD */ /* DJI CineSSD */
{ USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },
/* Alcor Link AK9563 SC Reader used in 2022 Lenovo ThinkPads */
{ USB_DEVICE(0x2ce3, 0x9563), .driver_info = USB_QUIRK_NO_LPM },
/* DELL USB GEN2 */ /* DELL USB GEN2 */
{ USB_DEVICE(0x413c, 0xb062), .driver_info = USB_QUIRK_NO_LPM | USB_QUIRK_RESET_RESUME }, { USB_DEVICE(0x413c, 0xb062), .driver_info = USB_QUIRK_NO_LPM | USB_QUIRK_RESET_RESUME },

View File

@ -115,7 +115,7 @@ static inline void dwc3_qcom_clrbits(void __iomem *base, u32 offset, u32 val)
readl(base + offset); readl(base + offset);
} }
static void dwc3_qcom_vbus_overrride_enable(struct dwc3_qcom *qcom, bool enable) static void dwc3_qcom_vbus_override_enable(struct dwc3_qcom *qcom, bool enable)
{ {
if (enable) { if (enable) {
dwc3_qcom_setbits(qcom->qscratch_base, QSCRATCH_SS_PHY_CTRL, dwc3_qcom_setbits(qcom->qscratch_base, QSCRATCH_SS_PHY_CTRL,
@ -136,7 +136,7 @@ static int dwc3_qcom_vbus_notifier(struct notifier_block *nb,
struct dwc3_qcom *qcom = container_of(nb, struct dwc3_qcom, vbus_nb); struct dwc3_qcom *qcom = container_of(nb, struct dwc3_qcom, vbus_nb);
/* enable vbus override for device mode */ /* enable vbus override for device mode */
dwc3_qcom_vbus_overrride_enable(qcom, event); dwc3_qcom_vbus_override_enable(qcom, event);
qcom->mode = event ? USB_DR_MODE_PERIPHERAL : USB_DR_MODE_HOST; qcom->mode = event ? USB_DR_MODE_PERIPHERAL : USB_DR_MODE_HOST;
return NOTIFY_DONE; return NOTIFY_DONE;
@ -148,7 +148,7 @@ static int dwc3_qcom_host_notifier(struct notifier_block *nb,
struct dwc3_qcom *qcom = container_of(nb, struct dwc3_qcom, host_nb); struct dwc3_qcom *qcom = container_of(nb, struct dwc3_qcom, host_nb);
/* disable vbus override in host mode */ /* disable vbus override in host mode */
dwc3_qcom_vbus_overrride_enable(qcom, !event); dwc3_qcom_vbus_override_enable(qcom, !event);
qcom->mode = event ? USB_DR_MODE_HOST : USB_DR_MODE_PERIPHERAL; qcom->mode = event ? USB_DR_MODE_HOST : USB_DR_MODE_PERIPHERAL;
return NOTIFY_DONE; return NOTIFY_DONE;
@ -832,8 +832,8 @@ static int dwc3_qcom_probe(struct platform_device *pdev)
qcom->mode = usb_get_dr_mode(&qcom->dwc3->dev); qcom->mode = usb_get_dr_mode(&qcom->dwc3->dev);
/* enable vbus override for device mode */ /* enable vbus override for device mode */
if (qcom->mode == USB_DR_MODE_PERIPHERAL) if (qcom->mode != USB_DR_MODE_HOST)
dwc3_qcom_vbus_overrride_enable(qcom, true); dwc3_qcom_vbus_override_enable(qcom, true);
/* register extcon to override sw_vbus on Vbus change later */ /* register extcon to override sw_vbus on Vbus change later */
ret = dwc3_qcom_register_extcon(qcom); ret = dwc3_qcom_register_extcon(qcom);

View File

@ -279,8 +279,10 @@ static int __ffs_ep0_queue_wait(struct ffs_data *ffs, char *data, size_t len)
struct usb_request *req = ffs->ep0req; struct usb_request *req = ffs->ep0req;
int ret; int ret;
if (!req) if (!req) {
spin_unlock_irq(&ffs->ev.waitq.lock);
return -EINVAL; return -EINVAL;
}
req->zero = len < le16_to_cpu(ffs->ev.setup.wLength); req->zero = len < le16_to_cpu(ffs->ev.setup.wLength);

View File

@ -533,10 +533,10 @@ int dp_altmode_probe(struct typec_altmode *alt)
/* FIXME: Port can only be DFP_U. */ /* FIXME: Port can only be DFP_U. */
/* Make sure we have compatiple pin configurations */ /* Make sure we have compatiple pin configurations */
if (!(DP_CAP_DFP_D_PIN_ASSIGN(port->vdo) & if (!(DP_CAP_PIN_ASSIGN_DFP_D(port->vdo) &
DP_CAP_UFP_D_PIN_ASSIGN(alt->vdo)) && DP_CAP_PIN_ASSIGN_UFP_D(alt->vdo)) &&
!(DP_CAP_UFP_D_PIN_ASSIGN(port->vdo) & !(DP_CAP_PIN_ASSIGN_UFP_D(port->vdo) &
DP_CAP_DFP_D_PIN_ASSIGN(alt->vdo))) DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo)))
return -ENODEV; return -ENODEV;
ret = sysfs_create_group(&alt->dev.kobj, &dp_altmode_group); ret = sysfs_create_group(&alt->dev.kobj, &dp_altmode_group);

View File

@ -1517,6 +1517,9 @@ static long vhost_net_set_backend(struct vhost_net *n, unsigned index, int fd)
nvq = &n->vqs[index]; nvq = &n->vqs[index];
mutex_lock(&vq->mutex); mutex_lock(&vq->mutex);
if (fd == -1)
vhost_clear_msg(&n->dev);
/* Verify that ring has been setup correctly. */ /* Verify that ring has been setup correctly. */
if (!vhost_vq_access_ok(vq)) { if (!vhost_vq_access_ok(vq)) {
r = -EFAULT; r = -EFAULT;

View File

@ -669,7 +669,7 @@ void vhost_dev_stop(struct vhost_dev *dev)
} }
EXPORT_SYMBOL_GPL(vhost_dev_stop); EXPORT_SYMBOL_GPL(vhost_dev_stop);
static void vhost_clear_msg(struct vhost_dev *dev) void vhost_clear_msg(struct vhost_dev *dev)
{ {
struct vhost_msg_node *node, *n; struct vhost_msg_node *node, *n;
@ -687,6 +687,7 @@ static void vhost_clear_msg(struct vhost_dev *dev)
spin_unlock(&dev->iotlb_lock); spin_unlock(&dev->iotlb_lock);
} }
EXPORT_SYMBOL_GPL(vhost_clear_msg);
void vhost_dev_cleanup(struct vhost_dev *dev) void vhost_dev_cleanup(struct vhost_dev *dev)
{ {

View File

@ -183,6 +183,7 @@ long vhost_dev_ioctl(struct vhost_dev *, unsigned int ioctl, void __user *argp);
long vhost_vring_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp); long vhost_vring_ioctl(struct vhost_dev *d, unsigned int ioctl, void __user *argp);
bool vhost_vq_access_ok(struct vhost_virtqueue *vq); bool vhost_vq_access_ok(struct vhost_virtqueue *vq);
bool vhost_log_access_ok(struct vhost_dev *); bool vhost_log_access_ok(struct vhost_dev *);
void vhost_clear_msg(struct vhost_dev *dev);
int vhost_get_vq_desc(struct vhost_virtqueue *, int vhost_get_vq_desc(struct vhost_virtqueue *,
struct iovec iov[], unsigned int iov_count, struct iovec iov[], unsigned int iov_count,

View File

@ -2513,9 +2513,12 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres)) h > FBCON_SWAP(info->var.rotate, info->var.yres, info->var.xres))
return -EINVAL; return -EINVAL;
if (font->width > 32 || font->height > 32)
return -EINVAL;
/* Make sure drawing engine can handle the font */ /* Make sure drawing engine can handle the font */
if (!(info->pixmap.blit_x & (1 << (font->width - 1))) || if (!(info->pixmap.blit_x & BIT(font->width - 1)) ||
!(info->pixmap.blit_y & (1 << (font->height - 1)))) !(info->pixmap.blit_y & BIT(font->height - 1)))
return -EINVAL; return -EINVAL;
/* Make sure driver can handle the font length */ /* Make sure driver can handle the font length */

View File

@ -1621,7 +1621,7 @@ static int ufx_usb_probe(struct usb_interface *interface,
struct usb_device *usbdev; struct usb_device *usbdev;
struct ufx_data *dev; struct ufx_data *dev;
struct fb_info *info; struct fb_info *info;
int retval; int retval = -ENOMEM;
u32 id_rev, fpga_rev; u32 id_rev, fpga_rev;
/* usb initialization */ /* usb initialization */
@ -1653,15 +1653,17 @@ static int ufx_usb_probe(struct usb_interface *interface,
if (!ufx_alloc_urb_list(dev, WRITES_IN_FLIGHT, MAX_TRANSFER)) { if (!ufx_alloc_urb_list(dev, WRITES_IN_FLIGHT, MAX_TRANSFER)) {
dev_err(dev->gdev, "ufx_alloc_urb_list failed\n"); dev_err(dev->gdev, "ufx_alloc_urb_list failed\n");
goto e_nomem; goto put_ref;
} }
/* We don't register a new USB class. Our client interface is fbdev */ /* We don't register a new USB class. Our client interface is fbdev */
/* allocates framebuffer driver structure, not framebuffer memory */ /* allocates framebuffer driver structure, not framebuffer memory */
info = framebuffer_alloc(0, &usbdev->dev); info = framebuffer_alloc(0, &usbdev->dev);
if (!info) if (!info) {
goto e_nomem; dev_err(dev->gdev, "framebuffer_alloc failed\n");
goto free_urb_list;
}
dev->info = info; dev->info = info;
info->par = dev; info->par = dev;
@ -1704,22 +1706,34 @@ static int ufx_usb_probe(struct usb_interface *interface,
check_warn_goto_error(retval, "unable to find common mode for display and adapter"); check_warn_goto_error(retval, "unable to find common mode for display and adapter");
retval = ufx_reg_set_bits(dev, 0x4000, 0x00000001); retval = ufx_reg_set_bits(dev, 0x4000, 0x00000001);
check_warn_goto_error(retval, "error %d enabling graphics engine", retval); if (retval < 0) {
dev_err(dev->gdev, "error %d enabling graphics engine", retval);
goto setup_modes;
}
/* ready to begin using device */ /* ready to begin using device */
atomic_set(&dev->usb_active, 1); atomic_set(&dev->usb_active, 1);
dev_dbg(dev->gdev, "checking var"); dev_dbg(dev->gdev, "checking var");
retval = ufx_ops_check_var(&info->var, info); retval = ufx_ops_check_var(&info->var, info);
check_warn_goto_error(retval, "error %d ufx_ops_check_var", retval); if (retval < 0) {
dev_err(dev->gdev, "error %d ufx_ops_check_var", retval);
goto reset_active;
}
dev_dbg(dev->gdev, "setting par"); dev_dbg(dev->gdev, "setting par");
retval = ufx_ops_set_par(info); retval = ufx_ops_set_par(info);
check_warn_goto_error(retval, "error %d ufx_ops_set_par", retval); if (retval < 0) {
dev_err(dev->gdev, "error %d ufx_ops_set_par", retval);
goto reset_active;
}
dev_dbg(dev->gdev, "registering framebuffer"); dev_dbg(dev->gdev, "registering framebuffer");
retval = register_framebuffer(info); retval = register_framebuffer(info);
check_warn_goto_error(retval, "error %d register_framebuffer", retval); if (retval < 0) {
dev_err(dev->gdev, "error %d register_framebuffer", retval);
goto reset_active;
}
dev_info(dev->gdev, "SMSC UDX USB device /dev/fb%d attached. %dx%d resolution." dev_info(dev->gdev, "SMSC UDX USB device /dev/fb%d attached. %dx%d resolution."
" Using %dK framebuffer memory\n", info->node, " Using %dK framebuffer memory\n", info->node,
@ -1727,21 +1741,23 @@ static int ufx_usb_probe(struct usb_interface *interface,
return 0; return 0;
error: reset_active:
fb_dealloc_cmap(&info->cmap); atomic_set(&dev->usb_active, 0);
destroy_modedb: setup_modes:
fb_destroy_modedb(info->monspecs.modedb); fb_destroy_modedb(info->monspecs.modedb);
vfree(info->screen_base); vfree(info->screen_base);
fb_destroy_modelist(&info->modelist); fb_destroy_modelist(&info->modelist);
error:
fb_dealloc_cmap(&info->cmap);
destroy_modedb:
framebuffer_release(info); framebuffer_release(info);
free_urb_list:
if (dev->urbs.count > 0)
ufx_free_urb_list(dev);
put_ref: put_ref:
kref_put(&dev->kref, ufx_free); /* ref for framebuffer */ kref_put(&dev->kref, ufx_free); /* ref for framebuffer */
kref_put(&dev->kref, ufx_free); /* last ref from kref_init */ kref_put(&dev->kref, ufx_free); /* last ref from kref_init */
return retval; return retval;
e_nomem:
retval = -ENOMEM;
goto put_ref;
} }
static void ufx_usb_disconnect(struct usb_interface *interface) static void ufx_usb_disconnect(struct usb_interface *interface)

View File

@ -86,7 +86,7 @@ static int __diag288(unsigned int func, unsigned int timeout,
"1:\n" "1:\n"
EX_TABLE(0b, 1b) EX_TABLE(0b, 1b)
: "+d" (err) : "d"(__func), "d"(__timeout), : "+d" (err) : "d"(__func), "d"(__timeout),
"d"(__action), "d"(__len) : "1", "cc"); "d"(__action), "d"(__len) : "1", "cc", "memory");
return err; return err;
} }
@ -272,12 +272,21 @@ static int __init diag288_init(void)
char ebc_begin[] = { char ebc_begin[] = {
194, 197, 199, 201, 213 194, 197, 199, 201, 213
}; };
char *ebc_cmd;
watchdog_set_nowayout(&wdt_dev, nowayout_info); watchdog_set_nowayout(&wdt_dev, nowayout_info);
if (MACHINE_IS_VM) { if (MACHINE_IS_VM) {
if (__diag288_vm(WDT_FUNC_INIT, 15, ebc_cmd = kmalloc(sizeof(ebc_begin), GFP_KERNEL);
ebc_begin, sizeof(ebc_begin)) != 0) { if (!ebc_cmd) {
pr_err("The watchdog cannot be initialized\n");
return -ENOMEM;
}
memcpy(ebc_cmd, ebc_begin, sizeof(ebc_begin));
ret = __diag288_vm(WDT_FUNC_INIT, 15,
ebc_cmd, sizeof(ebc_begin));
kfree(ebc_cmd);
if (ret != 0) {
pr_err("The watchdog cannot be initialized\n"); pr_err("The watchdog cannot be initialized\n");
return -EINVAL; return -EINVAL;
} }

View File

@ -129,13 +129,13 @@ static bool pvcalls_conn_back_read(void *opaque)
if (masked_prod < masked_cons) { if (masked_prod < masked_cons) {
vec[0].iov_base = data->in + masked_prod; vec[0].iov_base = data->in + masked_prod;
vec[0].iov_len = wanted; vec[0].iov_len = wanted;
iov_iter_kvec(&msg.msg_iter, WRITE, vec, 1, wanted); iov_iter_kvec(&msg.msg_iter, READ, vec, 1, wanted);
} else { } else {
vec[0].iov_base = data->in + masked_prod; vec[0].iov_base = data->in + masked_prod;
vec[0].iov_len = array_size - masked_prod; vec[0].iov_len = array_size - masked_prod;
vec[1].iov_base = data->in; vec[1].iov_base = data->in;
vec[1].iov_len = wanted - vec[0].iov_len; vec[1].iov_len = wanted - vec[0].iov_len;
iov_iter_kvec(&msg.msg_iter, WRITE, vec, 2, wanted); iov_iter_kvec(&msg.msg_iter, READ, vec, 2, wanted);
} }
atomic_set(&map->read, 0); atomic_set(&map->read, 0);
@ -188,13 +188,13 @@ static bool pvcalls_conn_back_write(struct sock_mapping *map)
if (pvcalls_mask(prod, array_size) > pvcalls_mask(cons, array_size)) { if (pvcalls_mask(prod, array_size) > pvcalls_mask(cons, array_size)) {
vec[0].iov_base = data->out + pvcalls_mask(cons, array_size); vec[0].iov_base = data->out + pvcalls_mask(cons, array_size);
vec[0].iov_len = size; vec[0].iov_len = size;
iov_iter_kvec(&msg.msg_iter, READ, vec, 1, size); iov_iter_kvec(&msg.msg_iter, WRITE, vec, 1, size);
} else { } else {
vec[0].iov_base = data->out + pvcalls_mask(cons, array_size); vec[0].iov_base = data->out + pvcalls_mask(cons, array_size);
vec[0].iov_len = array_size - pvcalls_mask(cons, array_size); vec[0].iov_len = array_size - pvcalls_mask(cons, array_size);
vec[1].iov_base = data->out; vec[1].iov_base = data->out;
vec[1].iov_len = size - vec[0].iov_len; vec[1].iov_len = size - vec[0].iov_len;
iov_iter_kvec(&msg.msg_iter, READ, vec, 2, size); iov_iter_kvec(&msg.msg_iter, WRITE, vec, 2, size);
} }
atomic_set(&map->write, 0); atomic_set(&map->write, 0);

View File

@ -381,6 +381,7 @@ void btrfs_free_device(struct btrfs_device *device)
static void free_fs_devices(struct btrfs_fs_devices *fs_devices) static void free_fs_devices(struct btrfs_fs_devices *fs_devices)
{ {
struct btrfs_device *device; struct btrfs_device *device;
WARN_ON(fs_devices->opened); WARN_ON(fs_devices->opened);
while (!list_empty(&fs_devices->devices)) { while (!list_empty(&fs_devices->devices)) {
device = list_entry(fs_devices->devices.next, device = list_entry(fs_devices->devices.next,
@ -1227,9 +1228,22 @@ void btrfs_close_devices(struct btrfs_fs_devices *fs_devices)
mutex_lock(&uuid_mutex); mutex_lock(&uuid_mutex);
close_fs_devices(fs_devices); close_fs_devices(fs_devices);
if (!fs_devices->opened) if (!fs_devices->opened) {
list_splice_init(&fs_devices->seed_list, &list); list_splice_init(&fs_devices->seed_list, &list);
/*
* If the struct btrfs_fs_devices is not assembled with any
* other device, it can be re-initialized during the next mount
* without the needing device-scan step. Therefore, it can be
* fully freed.
*/
if (fs_devices->num_devices == 1) {
list_del(&fs_devices->fs_list);
free_fs_devices(fs_devices);
}
}
list_for_each_entry_safe(fs_devices, tmp, &list, seed_list) { list_for_each_entry_safe(fs_devices, tmp, &list, seed_list) {
close_fs_devices(fs_devices); close_fs_devices(fs_devices);
list_del(&fs_devices->seed_list); list_del(&fs_devices->seed_list);
@ -1579,7 +1593,7 @@ static int find_free_dev_extent_start(struct btrfs_device *device,
goto out; goto out;
} }
while (1) { while (search_start < search_end) {
l = path->nodes[0]; l = path->nodes[0];
slot = path->slots[0]; slot = path->slots[0];
if (slot >= btrfs_header_nritems(l)) { if (slot >= btrfs_header_nritems(l)) {
@ -1602,6 +1616,9 @@ static int find_free_dev_extent_start(struct btrfs_device *device,
if (key.type != BTRFS_DEV_EXTENT_KEY) if (key.type != BTRFS_DEV_EXTENT_KEY)
goto next; goto next;
if (key.offset > search_end)
break;
if (key.offset > search_start) { if (key.offset > search_start) {
hole_size = key.offset - search_start; hole_size = key.offset - search_start;
dev_extent_hole_check(device, &search_start, &hole_size, dev_extent_hole_check(device, &search_start, &hole_size,
@ -1662,6 +1679,7 @@ static int find_free_dev_extent_start(struct btrfs_device *device,
else else
ret = 0; ret = 0;
ASSERT(max_hole_start + max_hole_size <= search_end);
out: out:
btrfs_free_path(path); btrfs_free_path(path);
*start = max_hole_start; *start = max_hole_start;

View File

@ -63,7 +63,7 @@ struct list_head *zlib_alloc_workspace(unsigned int level)
workspacesize = max(zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL), workspacesize = max(zlib_deflate_workspacesize(MAX_WBITS, MAX_MEM_LEVEL),
zlib_inflate_workspacesize()); zlib_inflate_workspacesize());
workspace->strm.workspace = kvmalloc(workspacesize, GFP_KERNEL); workspace->strm.workspace = kvzalloc(workspacesize, GFP_KERNEL);
workspace->level = level; workspace->level = level;
workspace->buf = NULL; workspace->buf = NULL;
/* /*

View File

@ -3496,6 +3496,12 @@ static void handle_session(struct ceph_mds_session *session,
break; break;
case CEPH_SESSION_FLUSHMSG: case CEPH_SESSION_FLUSHMSG:
/* flush cap releases */
spin_lock(&session->s_cap_lock);
if (session->s_num_cap_releases)
ceph_flush_cap_releases(mdsc, session);
spin_unlock(&session->s_cap_lock);
send_flushmsg_ack(mdsc, session, seq); send_flushmsg_ack(mdsc, session, seq);
break; break;

View File

@ -3539,7 +3539,7 @@ uncached_fill_pages(struct TCP_Server_Info *server,
rdata->got_bytes += result; rdata->got_bytes += result;
} }
return rdata->got_bytes > 0 && result != -ECONNABORTED ? return result != -ECONNABORTED && rdata->got_bytes > 0 ?
rdata->got_bytes : result; rdata->got_bytes : result;
} }
@ -4302,7 +4302,7 @@ readpages_fill_pages(struct TCP_Server_Info *server,
rdata->got_bytes += result; rdata->got_bytes += result;
} }
return rdata->got_bytes > 0 && result != -ECONNABORTED ? return result != -ECONNABORTED && rdata->got_bytes > 0 ?
rdata->got_bytes : result; rdata->got_bytes : result;
} }

View File

@ -1000,7 +1000,7 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
{ {
struct page *node_page; struct page *node_page;
nid_t nid; nid_t nid;
unsigned int ofs_in_node, max_addrs; unsigned int ofs_in_node, max_addrs, base;
block_t source_blkaddr; block_t source_blkaddr;
nid = le32_to_cpu(sum->nid); nid = le32_to_cpu(sum->nid);
@ -1026,11 +1026,17 @@ static bool is_alive(struct f2fs_sb_info *sbi, struct f2fs_summary *sum,
return false; return false;
} }
max_addrs = IS_INODE(node_page) ? DEF_ADDRS_PER_INODE : if (IS_INODE(node_page)) {
DEF_ADDRS_PER_BLOCK; base = offset_in_addr(F2FS_INODE(node_page));
if (ofs_in_node >= max_addrs) { max_addrs = DEF_ADDRS_PER_INODE;
f2fs_err(sbi, "Inconsistent ofs_in_node:%u in summary, ino:%u, nid:%u, max:%u", } else {
ofs_in_node, dni->ino, dni->nid, max_addrs); base = 0;
max_addrs = DEF_ADDRS_PER_BLOCK;
}
if (base + ofs_in_node >= max_addrs) {
f2fs_err(sbi, "Inconsistent blkaddr offset: base:%u, ofs_in_node:%u, max:%u, ino:%u, nid:%u",
base, ofs_in_node, max_addrs, dni->ino, dni->nid);
f2fs_put_page(node_page, 1); f2fs_put_page(node_page, 1);
return false; return false;
} }

View File

@ -774,9 +774,7 @@ static int smaps_hugetlb_range(pte_t *pte, unsigned long hmask,
page = device_private_entry_to_page(swpent); page = device_private_entry_to_page(swpent);
} }
if (page) { if (page) {
int mapcount = page_mapcount(page); if (page_mapcount(page) >= 2 || hugetlb_pmd_shared(pte))
if (mapcount >= 2)
mss->shared_hugetlb += huge_page_size(hstate_vma(vma)); mss->shared_hugetlb += huge_page_size(hstate_vma(vma));
else else
mss->private_hugetlb += huge_page_size(hstate_vma(vma)); mss->private_hugetlb += huge_page_size(hstate_vma(vma));

View File

@ -183,7 +183,7 @@ static inline int squashfs_block_size(__le32 raw)
#define SQUASHFS_ID_BLOCK_BYTES(A) (SQUASHFS_ID_BLOCKS(A) *\ #define SQUASHFS_ID_BLOCK_BYTES(A) (SQUASHFS_ID_BLOCKS(A) *\
sizeof(u64)) sizeof(u64))
/* xattr id lookup table defines */ /* xattr id lookup table defines */
#define SQUASHFS_XATTR_BYTES(A) ((A) * sizeof(struct squashfs_xattr_id)) #define SQUASHFS_XATTR_BYTES(A) (((u64) (A)) * sizeof(struct squashfs_xattr_id))
#define SQUASHFS_XATTR_BLOCK(A) (SQUASHFS_XATTR_BYTES(A) / \ #define SQUASHFS_XATTR_BLOCK(A) (SQUASHFS_XATTR_BYTES(A) / \
SQUASHFS_METADATA_SIZE) SQUASHFS_METADATA_SIZE)

View File

@ -63,7 +63,7 @@ struct squashfs_sb_info {
long long bytes_used; long long bytes_used;
unsigned int inodes; unsigned int inodes;
unsigned int fragments; unsigned int fragments;
int xattr_ids; unsigned int xattr_ids;
unsigned int ids; unsigned int ids;
}; };
#endif #endif

View File

@ -10,12 +10,12 @@
#ifdef CONFIG_SQUASHFS_XATTR #ifdef CONFIG_SQUASHFS_XATTR
extern __le64 *squashfs_read_xattr_id_table(struct super_block *, u64, extern __le64 *squashfs_read_xattr_id_table(struct super_block *, u64,
u64 *, int *); u64 *, unsigned int *);
extern int squashfs_xattr_lookup(struct super_block *, unsigned int, int *, extern int squashfs_xattr_lookup(struct super_block *, unsigned int, int *,
unsigned int *, unsigned long long *); unsigned int *, unsigned long long *);
#else #else
static inline __le64 *squashfs_read_xattr_id_table(struct super_block *sb, static inline __le64 *squashfs_read_xattr_id_table(struct super_block *sb,
u64 start, u64 *xattr_table_start, int *xattr_ids) u64 start, u64 *xattr_table_start, unsigned int *xattr_ids)
{ {
struct squashfs_xattr_id_table *id_table; struct squashfs_xattr_id_table *id_table;

View File

@ -56,7 +56,7 @@ int squashfs_xattr_lookup(struct super_block *sb, unsigned int index,
* Read uncompressed xattr id lookup table indexes from disk into memory * Read uncompressed xattr id lookup table indexes from disk into memory
*/ */
__le64 *squashfs_read_xattr_id_table(struct super_block *sb, u64 table_start, __le64 *squashfs_read_xattr_id_table(struct super_block *sb, u64 table_start,
u64 *xattr_table_start, int *xattr_ids) u64 *xattr_table_start, unsigned int *xattr_ids)
{ {
struct squashfs_sb_info *msblk = sb->s_fs_info; struct squashfs_sb_info *msblk = sb->s_fs_info;
unsigned int len, indexes; unsigned int len, indexes;
@ -76,7 +76,7 @@ __le64 *squashfs_read_xattr_id_table(struct super_block *sb, u64 table_start,
/* Sanity check values */ /* Sanity check values */
/* there is always at least one xattr id */ /* there is always at least one xattr id */
if (*xattr_ids == 0) if (*xattr_ids <= 0)
return ERR_PTR(-EINVAL); return ERR_PTR(-EINVAL);
len = SQUASHFS_XATTR_BLOCK_BYTES(*xattr_ids); len = SQUASHFS_XATTR_BLOCK_BYTES(*xattr_ids);

View File

@ -7,6 +7,7 @@
#include <linux/fs.h> #include <linux/fs.h>
#include <linux/hugetlb_inline.h> #include <linux/hugetlb_inline.h>
#include <linux/cgroup.h> #include <linux/cgroup.h>
#include <linux/page_ref.h>
#include <linux/list.h> #include <linux/list.h>
#include <linux/kref.h> #include <linux/kref.h>
#include <linux/pgtable.h> #include <linux/pgtable.h>
@ -148,7 +149,7 @@ int hugetlb_reserve_pages(struct inode *inode, long from, long to,
vm_flags_t vm_flags); vm_flags_t vm_flags);
long hugetlb_unreserve_pages(struct inode *inode, long start, long end, long hugetlb_unreserve_pages(struct inode *inode, long start, long end,
long freed); long freed);
bool isolate_huge_page(struct page *page, struct list_head *list); int isolate_hugetlb(struct page *page, struct list_head *list);
void putback_active_hugepage(struct page *page); void putback_active_hugepage(struct page *page);
void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason); void move_hugetlb_state(struct page *oldpage, struct page *newpage, int reason);
void free_huge_page(struct page *page); void free_huge_page(struct page *page);
@ -334,9 +335,9 @@ static inline pte_t *huge_pte_offset(struct mm_struct *mm, unsigned long addr,
return NULL; return NULL;
} }
static inline bool isolate_huge_page(struct page *page, struct list_head *list) static inline int isolate_hugetlb(struct page *page, struct list_head *list)
{ {
return false; return -EBUSY;
} }
static inline void putback_active_hugepage(struct page *page) static inline void putback_active_hugepage(struct page *page)
@ -963,4 +964,16 @@ bool want_pmd_share(struct vm_area_struct *vma, unsigned long addr);
#define flush_hugetlb_tlb_range(vma, addr, end) flush_tlb_range(vma, addr, end) #define flush_hugetlb_tlb_range(vma, addr, end) flush_tlb_range(vma, addr, end)
#endif #endif
#ifdef CONFIG_ARCH_WANT_HUGE_PMD_SHARE
static inline bool hugetlb_pmd_shared(pte_t *pte)
{
return page_count(virt_to_page(pte)) > 1;
}
#else
static inline bool hugetlb_pmd_shared(pte_t *pte)
{
return false;
}
#endif
#endif /* _LINUX_HUGETLB_H */ #endif /* _LINUX_HUGETLB_H */

View File

@ -49,7 +49,8 @@ enum nvmem_type {
* @word_size: Minimum read/write access granularity. * @word_size: Minimum read/write access granularity.
* @stride: Minimum read/write access stride. * @stride: Minimum read/write access stride.
* @priv: User context passed to read/write callbacks. * @priv: User context passed to read/write callbacks.
* @wp-gpio: Write protect pin * @wp-gpio: Write protect pin
* @ignore_wp: Write Protect pin is managed by the provider.
* *
* Note: A default "nvmem<id>" name will be assigned to the device if * Note: A default "nvmem<id>" name will be assigned to the device if
* no name is specified in its configuration. In such case "<id>" is * no name is specified in its configuration. In such case "<id>" is
@ -69,6 +70,7 @@ struct nvmem_config {
enum nvmem_type type; enum nvmem_type type;
bool read_only; bool read_only;
bool root_only; bool root_only;
bool ignore_wp;
bool no_of_node; bool no_of_node;
nvmem_reg_read_t reg_read; nvmem_reg_read_t reg_read;
nvmem_reg_write_t reg_write; nvmem_reg_write_t reg_write;

View File

@ -38,4 +38,16 @@
*/ */
#define find_closest_descending(x, a, as) __find_closest(x, a, as, >=) #define find_closest_descending(x, a, as) __find_closest(x, a, as, >=)
/**
* is_insidevar - check if the @ptr points inside the @var memory range.
* @ptr: the pointer to a memory address.
* @var: the variable which address and size identify the memory range.
*
* Evaluates to true if the address in @ptr lies within the memory
* range allocated to @var.
*/
#define is_insidevar(ptr, var) \
((uintptr_t)(ptr) >= (uintptr_t)(var) && \
(uintptr_t)(ptr) < (uintptr_t)(var) + sizeof(var))
#endif #endif

View File

@ -18,6 +18,7 @@
#ifndef _UAPI_LINUX_IP_H #ifndef _UAPI_LINUX_IP_H
#define _UAPI_LINUX_IP_H #define _UAPI_LINUX_IP_H
#include <linux/types.h> #include <linux/types.h>
#include <linux/stddef.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>
#define IPTOS_TOS_MASK 0x1E #define IPTOS_TOS_MASK 0x1E

View File

@ -4,6 +4,7 @@
#include <linux/libc-compat.h> #include <linux/libc-compat.h>
#include <linux/types.h> #include <linux/types.h>
#include <linux/stddef.h>
#include <linux/in6.h> #include <linux/in6.h>
#include <asm/byteorder.h> #include <asm/byteorder.h>

View File

@ -570,6 +570,12 @@ static bool is_spilled_reg(const struct bpf_stack_state *stack)
return stack->slot_type[BPF_REG_SIZE - 1] == STACK_SPILL; return stack->slot_type[BPF_REG_SIZE - 1] == STACK_SPILL;
} }
static void scrub_spilled_slot(u8 *stype)
{
if (*stype != STACK_INVALID)
*stype = STACK_MISC;
}
static void print_verifier_state(struct bpf_verifier_env *env, static void print_verifier_state(struct bpf_verifier_env *env,
const struct bpf_func_state *state) const struct bpf_func_state *state)
{ {
@ -1876,8 +1882,6 @@ static int backtrack_insn(struct bpf_verifier_env *env, int idx,
*/ */
if (insn->src_reg != BPF_REG_FP) if (insn->src_reg != BPF_REG_FP)
return 0; return 0;
if (BPF_SIZE(insn->code) != BPF_DW)
return 0;
/* dreg = *(u64 *)[fp - off] was a fill from the stack. /* dreg = *(u64 *)[fp - off] was a fill from the stack.
* that [fp - off] slot contains scalar that needs to be * that [fp - off] slot contains scalar that needs to be
@ -1900,8 +1904,6 @@ static int backtrack_insn(struct bpf_verifier_env *env, int idx,
/* scalars can only be spilled into stack */ /* scalars can only be spilled into stack */
if (insn->dst_reg != BPF_REG_FP) if (insn->dst_reg != BPF_REG_FP)
return 0; return 0;
if (BPF_SIZE(insn->code) != BPF_DW)
return 0;
spi = (-insn->off - 1) / BPF_REG_SIZE; spi = (-insn->off - 1) / BPF_REG_SIZE;
if (spi >= 64) { if (spi >= 64) {
verbose(env, "BUG spi %d\n", spi); verbose(env, "BUG spi %d\n", spi);
@ -2272,16 +2274,33 @@ static bool __is_pointer_value(bool allow_ptr_leaks,
return reg->type != SCALAR_VALUE; return reg->type != SCALAR_VALUE;
} }
/* Copy src state preserving dst->parent and dst->live fields */
static void copy_register_state(struct bpf_reg_state *dst, const struct bpf_reg_state *src)
{
struct bpf_reg_state *parent = dst->parent;
enum bpf_reg_liveness live = dst->live;
*dst = *src;
dst->parent = parent;
dst->live = live;
}
static void save_register_state(struct bpf_func_state *state, static void save_register_state(struct bpf_func_state *state,
int spi, struct bpf_reg_state *reg) int spi, struct bpf_reg_state *reg,
int size)
{ {
int i; int i;
state->stack[spi].spilled_ptr = *reg; copy_register_state(&state->stack[spi].spilled_ptr, reg);
state->stack[spi].spilled_ptr.live |= REG_LIVE_WRITTEN; if (size == BPF_REG_SIZE)
state->stack[spi].spilled_ptr.live |= REG_LIVE_WRITTEN;
for (i = 0; i < BPF_REG_SIZE; i++) for (i = BPF_REG_SIZE; i > BPF_REG_SIZE - size; i--)
state->stack[spi].slot_type[i] = STACK_SPILL; state->stack[spi].slot_type[i - 1] = STACK_SPILL;
/* size < 8 bytes spill */
for (; i; i--)
scrub_spilled_slot(&state->stack[spi].slot_type[i - 1]);
} }
/* check_stack_{read,write}_fixed_off functions track spill/fill of registers, /* check_stack_{read,write}_fixed_off functions track spill/fill of registers,
@ -2331,7 +2350,7 @@ static int check_stack_write_fixed_off(struct bpf_verifier_env *env,
env->insn_aux_data[insn_idx].sanitize_stack_spill = true; env->insn_aux_data[insn_idx].sanitize_stack_spill = true;
} }
if (reg && size == BPF_REG_SIZE && register_is_bounded(reg) && if (reg && !(off % BPF_REG_SIZE) && register_is_bounded(reg) &&
!register_is_null(reg) && env->bpf_capable) { !register_is_null(reg) && env->bpf_capable) {
if (dst_reg != BPF_REG_FP) { if (dst_reg != BPF_REG_FP) {
/* The backtracking logic can only recognize explicit /* The backtracking logic can only recognize explicit
@ -2344,7 +2363,7 @@ static int check_stack_write_fixed_off(struct bpf_verifier_env *env,
if (err) if (err)
return err; return err;
} }
save_register_state(state, spi, reg); save_register_state(state, spi, reg, size);
} else if (reg && is_spillable_regtype(reg->type)) { } else if (reg && is_spillable_regtype(reg->type)) {
/* register containing pointer is being spilled into stack */ /* register containing pointer is being spilled into stack */
if (size != BPF_REG_SIZE) { if (size != BPF_REG_SIZE) {
@ -2356,7 +2375,7 @@ static int check_stack_write_fixed_off(struct bpf_verifier_env *env,
verbose(env, "cannot spill pointers to stack into stack frame of the caller\n"); verbose(env, "cannot spill pointers to stack into stack frame of the caller\n");
return -EINVAL; return -EINVAL;
} }
save_register_state(state, spi, reg); save_register_state(state, spi, reg, size);
} else { } else {
u8 type = STACK_MISC; u8 type = STACK_MISC;
@ -2365,7 +2384,7 @@ static int check_stack_write_fixed_off(struct bpf_verifier_env *env,
/* Mark slots as STACK_MISC if they belonged to spilled ptr. */ /* Mark slots as STACK_MISC if they belonged to spilled ptr. */
if (is_spilled_reg(&state->stack[spi])) if (is_spilled_reg(&state->stack[spi]))
for (i = 0; i < BPF_REG_SIZE; i++) for (i = 0; i < BPF_REG_SIZE; i++)
state->stack[spi].slot_type[i] = STACK_MISC; scrub_spilled_slot(&state->stack[spi].slot_type[i]);
/* only mark the slot as written if all 8 bytes were written /* only mark the slot as written if all 8 bytes were written
* otherwise read propagation may incorrectly stop too soon * otherwise read propagation may incorrectly stop too soon
@ -2572,35 +2591,56 @@ static int check_stack_read_fixed_off(struct bpf_verifier_env *env,
struct bpf_func_state *state = vstate->frame[vstate->curframe]; struct bpf_func_state *state = vstate->frame[vstate->curframe];
int i, slot = -off - 1, spi = slot / BPF_REG_SIZE; int i, slot = -off - 1, spi = slot / BPF_REG_SIZE;
struct bpf_reg_state *reg; struct bpf_reg_state *reg;
u8 *stype; u8 *stype, type;
stype = reg_state->stack[spi].slot_type; stype = reg_state->stack[spi].slot_type;
reg = &reg_state->stack[spi].spilled_ptr; reg = &reg_state->stack[spi].spilled_ptr;
if (is_spilled_reg(&reg_state->stack[spi])) { if (is_spilled_reg(&reg_state->stack[spi])) {
if (size != BPF_REG_SIZE) { u8 spill_size = 1;
for (i = BPF_REG_SIZE - 1; i > 0 && stype[i - 1] == STACK_SPILL; i--)
spill_size++;
if (size != BPF_REG_SIZE || spill_size != BPF_REG_SIZE) {
if (reg->type != SCALAR_VALUE) { if (reg->type != SCALAR_VALUE) {
verbose_linfo(env, env->insn_idx, "; "); verbose_linfo(env, env->insn_idx, "; ");
verbose(env, "invalid size of register fill\n"); verbose(env, "invalid size of register fill\n");
return -EACCES; return -EACCES;
} }
if (dst_regno >= 0) {
mark_reg_unknown(env, state->regs, dst_regno);
state->regs[dst_regno].live |= REG_LIVE_WRITTEN;
}
mark_reg_read(env, reg, reg->parent, REG_LIVE_READ64); mark_reg_read(env, reg, reg->parent, REG_LIVE_READ64);
return 0; if (dst_regno < 0)
} return 0;
for (i = 1; i < BPF_REG_SIZE; i++) {
if (stype[(slot - i) % BPF_REG_SIZE] != STACK_SPILL) { if (!(off % BPF_REG_SIZE) && size == spill_size) {
verbose(env, "corrupted spill memory\n"); /* The earlier check_reg_arg() has decided the
return -EACCES; * subreg_def for this insn. Save it first.
*/
s32 subreg_def = state->regs[dst_regno].subreg_def;
copy_register_state(&state->regs[dst_regno], reg);
state->regs[dst_regno].subreg_def = subreg_def;
} else {
for (i = 0; i < size; i++) {
type = stype[(slot - i) % BPF_REG_SIZE];
if (type == STACK_SPILL)
continue;
if (type == STACK_MISC)
continue;
verbose(env, "invalid read from stack off %d+%d size %d\n",
off, i, size);
return -EACCES;
}
mark_reg_unknown(env, state->regs, dst_regno);
} }
state->regs[dst_regno].live |= REG_LIVE_WRITTEN;
return 0;
} }
if (dst_regno >= 0) { if (dst_regno >= 0) {
/* restore register state from stack */ /* restore register state from stack */
state->regs[dst_regno] = *reg; copy_register_state(&state->regs[dst_regno], reg);
/* mark reg as written since spilled pointer state likely /* mark reg as written since spilled pointer state likely
* has its liveness marks cleared by is_state_visited() * has its liveness marks cleared by is_state_visited()
* which resets stack/reg liveness for state transitions * which resets stack/reg liveness for state transitions
@ -2619,8 +2659,6 @@ static int check_stack_read_fixed_off(struct bpf_verifier_env *env,
} }
mark_reg_read(env, reg, reg->parent, REG_LIVE_READ64); mark_reg_read(env, reg, reg->parent, REG_LIVE_READ64);
} else { } else {
u8 type;
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
type = stype[(slot - i) % BPF_REG_SIZE]; type = stype[(slot - i) % BPF_REG_SIZE];
if (type == STACK_MISC) if (type == STACK_MISC)
@ -4106,7 +4144,7 @@ static int check_stack_range_initialized(
if (clobber) { if (clobber) {
__mark_reg_unknown(env, &state->stack[spi].spilled_ptr); __mark_reg_unknown(env, &state->stack[spi].spilled_ptr);
for (j = 0; j < BPF_REG_SIZE; j++) for (j = 0; j < BPF_REG_SIZE; j++)
state->stack[spi].slot_type[j] = STACK_MISC; scrub_spilled_slot(&state->stack[spi].slot_type[j]);
} }
goto mark; goto mark;
} }
@ -5863,7 +5901,7 @@ static int sanitize_ptr_alu(struct bpf_verifier_env *env,
*/ */
if (!ptr_is_dst_reg) { if (!ptr_is_dst_reg) {
tmp = *dst_reg; tmp = *dst_reg;
*dst_reg = *ptr_reg; copy_register_state(dst_reg, ptr_reg);
} }
ret = sanitize_speculative_path(env, NULL, env->insn_idx + 1, ret = sanitize_speculative_path(env, NULL, env->insn_idx + 1,
env->insn_idx); env->insn_idx);
@ -7117,7 +7155,7 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn)
* to propagate min/max range. * to propagate min/max range.
*/ */
src_reg->id = ++env->id_gen; src_reg->id = ++env->id_gen;
*dst_reg = *src_reg; copy_register_state(dst_reg, src_reg);
dst_reg->live |= REG_LIVE_WRITTEN; dst_reg->live |= REG_LIVE_WRITTEN;
dst_reg->subreg_def = DEF_NOT_SUBREG; dst_reg->subreg_def = DEF_NOT_SUBREG;
} else { } else {
@ -7128,7 +7166,7 @@ static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn)
insn->src_reg); insn->src_reg);
return -EACCES; return -EACCES;
} else if (src_reg->type == SCALAR_VALUE) { } else if (src_reg->type == SCALAR_VALUE) {
*dst_reg = *src_reg; copy_register_state(dst_reg, src_reg);
/* Make sure ID is cleared otherwise /* Make sure ID is cleared otherwise
* dst_reg min/max could be incorrectly * dst_reg min/max could be incorrectly
* propagated into src_reg by find_equal_scalars() * propagated into src_reg by find_equal_scalars()
@ -7948,7 +7986,7 @@ static void find_equal_scalars(struct bpf_verifier_state *vstate,
bpf_for_each_reg_in_vstate(vstate, state, reg, ({ bpf_for_each_reg_in_vstate(vstate, state, reg, ({
if (reg->type == SCALAR_VALUE && reg->id == known_reg->id) if (reg->type == SCALAR_VALUE && reg->id == known_reg->id)
*reg = *known_reg; copy_register_state(reg, known_reg);
})); }));
} }

View File

@ -1055,6 +1055,7 @@ static void do_bpf_send_signal(struct irq_work *entry)
work = container_of(entry, struct send_signal_irq_work, irq_work); work = container_of(entry, struct send_signal_irq_work, irq_work);
group_send_sig_info(work->sig, SEND_SIG_PRIV, work->task, work->type); group_send_sig_info(work->sig, SEND_SIG_PRIV, work->task, work->type);
put_task_struct(work->task);
} }
static int bpf_send_signal_common(u32 sig, enum pid_type type) static int bpf_send_signal_common(u32 sig, enum pid_type type)
@ -1091,7 +1092,7 @@ static int bpf_send_signal_common(u32 sig, enum pid_type type)
* to the irq_work. The current task may change when queued * to the irq_work. The current task may change when queued
* irq works get executed. * irq works get executed.
*/ */
work->task = current; work->task = get_task_struct(current);
work->sig = sig; work->sig = sig;
work->type = type; work->type = type;
irq_work_queue(&work->irq_work); irq_work_queue(&work->irq_work);

View File

@ -8570,9 +8570,6 @@ buffer_percent_write(struct file *filp, const char __user *ubuf,
if (val > 100) if (val > 100)
return -EINVAL; return -EINVAL;
if (!val)
val = 1;
tr->buffer_percent = val; tr->buffer_percent = val;
(*ppos)++; (*ppos)++;

View File

@ -1645,7 +1645,7 @@ static long check_and_migrate_cma_pages(struct mm_struct *mm,
*/ */
if (is_migrate_cma_page(head)) { if (is_migrate_cma_page(head)) {
if (PageHuge(head)) { if (PageHuge(head)) {
if (!isolate_huge_page(head, &cma_page_list)) if (isolate_hugetlb(head, &cma_page_list))
isolation_error_count++; isolation_error_count++;
} else { } else {
if (!PageLRU(head) && drain_allow) { if (!PageLRU(head) && drain_allow) {

View File

@ -5696,14 +5696,14 @@ follow_huge_pgd(struct mm_struct *mm, unsigned long address, pgd_t *pgd, int fla
return pte_page(*(pte_t *)pgd) + ((address & ~PGDIR_MASK) >> PAGE_SHIFT); return pte_page(*(pte_t *)pgd) + ((address & ~PGDIR_MASK) >> PAGE_SHIFT);
} }
bool isolate_huge_page(struct page *page, struct list_head *list) int isolate_hugetlb(struct page *page, struct list_head *list)
{ {
bool ret = true; int ret = 0;
spin_lock(&hugetlb_lock); spin_lock(&hugetlb_lock);
if (!PageHeadHuge(page) || !page_huge_active(page) || if (!PageHeadHuge(page) || !page_huge_active(page) ||
!get_page_unless_zero(page)) { !get_page_unless_zero(page)) {
ret = false; ret = -EBUSY;
goto unlock; goto unlock;
} }
clear_page_huge_active(page); clear_page_huge_active(page);

View File

@ -1763,7 +1763,7 @@ static bool isolate_page(struct page *page, struct list_head *pagelist)
bool lru = PageLRU(page); bool lru = PageLRU(page);
if (PageHuge(page)) { if (PageHuge(page)) {
isolated = isolate_huge_page(page, pagelist); isolated = !isolate_hugetlb(page, pagelist);
} else { } else {
if (lru) if (lru)
isolated = !isolate_lru_page(page); isolated = !isolate_lru_page(page);

View File

@ -1334,7 +1334,7 @@ do_migrate_range(unsigned long start_pfn, unsigned long end_pfn)
if (PageHuge(page)) { if (PageHuge(page)) {
pfn = page_to_pfn(head) + compound_nr(head) - 1; pfn = page_to_pfn(head) + compound_nr(head) - 1;
isolate_huge_page(head, &source); isolate_hugetlb(head, &source);
continue; continue;
} else if (PageTransHuge(page)) } else if (PageTransHuge(page))
pfn = page_to_pfn(head) + thp_nr_pages(page) - 1; pfn = page_to_pfn(head) + thp_nr_pages(page) - 1;

View File

@ -625,8 +625,9 @@ static int queue_pages_hugetlb(pte_t *pte, unsigned long hmask,
/* With MPOL_MF_MOVE, we migrate only unshared hugepage. */ /* With MPOL_MF_MOVE, we migrate only unshared hugepage. */
if (flags & (MPOL_MF_MOVE_ALL) || if (flags & (MPOL_MF_MOVE_ALL) ||
(flags & MPOL_MF_MOVE && page_mapcount(page) == 1)) { (flags & MPOL_MF_MOVE && page_mapcount(page) == 1 &&
if (!isolate_huge_page(page, qp->pagelist) && !hugetlb_pmd_shared(pte))) {
if (isolate_hugetlb(page, qp->pagelist) &&
(flags & MPOL_MF_STRICT)) (flags & MPOL_MF_STRICT))
/* /*
* Failed to isolate page but allow migrating pages * Failed to isolate page but allow migrating pages

View File

@ -141,7 +141,7 @@ void putback_movable_page(struct page *page)
* *
* This function shall be used whenever the isolated pageset has been * This function shall be used whenever the isolated pageset has been
* built from lru, balloon, hugetlbfs page. See isolate_migratepages_range() * built from lru, balloon, hugetlbfs page. See isolate_migratepages_range()
* and isolate_huge_page(). * and isolate_hugetlb().
*/ */
void putback_movable_pages(struct list_head *l) void putback_movable_pages(struct list_head *l)
{ {
@ -1642,8 +1642,9 @@ static int add_page_for_migration(struct mm_struct *mm, unsigned long addr,
if (PageHuge(page)) { if (PageHuge(page)) {
if (PageHead(page)) { if (PageHead(page)) {
isolate_huge_page(page, pagelist); err = isolate_hugetlb(page, pagelist);
err = 1; if (!err)
err = 1;
} }
} else { } else {
struct page *head; struct page *head;

View File

@ -5234,10 +5234,13 @@ static inline void free_the_page(struct page *page, unsigned int order)
void __free_pages(struct page *page, unsigned int order) void __free_pages(struct page *page, unsigned int order)
{ {
/* get PageHead before we drop reference */
int head = PageHead(page);
trace_android_vh_free_pages(page, order); trace_android_vh_free_pages(page, order);
if (put_page_testzero(page)) if (put_page_testzero(page))
free_the_page(page, order); free_the_page(page, order);
else if (!PageHead(page)) else if (!head)
while (order-- > 0) while (order-- > 0)
free_the_page(page + (1 << order), order); free_the_page(page + (1 << order), order);
} }

View File

@ -1111,6 +1111,7 @@ int get_swap_pages(int n_goal, swp_entry_t swp_entries[], int entry_size)
goto check_out; goto check_out;
pr_debug("scan_swap_map of si %d failed to find offset\n", pr_debug("scan_swap_map of si %d failed to find offset\n",
si->type); si->type);
cond_resched();
spin_lock(&swap_avail_lock); spin_lock(&swap_avail_lock);
nextsi: nextsi:

View File

@ -871,6 +871,7 @@ static unsigned int ip_sabotage_in(void *priv,
if (nf_bridge && !nf_bridge->in_prerouting && if (nf_bridge && !nf_bridge->in_prerouting &&
!netif_is_l3_master(skb->dev) && !netif_is_l3_master(skb->dev) &&
!netif_is_l3_slave(skb->dev)) { !netif_is_l3_slave(skb->dev)) {
nf_bridge_info_free(skb);
state->okfn(state->net, state->sk, skb); state->okfn(state->net, state->sk, skb);
return NF_STOLEN; return NF_STOLEN;
} }

View File

@ -165,6 +165,46 @@ static void j1939_ac_process(struct j1939_priv *priv, struct sk_buff *skb)
* leaving this function. * leaving this function.
*/ */
ecu = j1939_ecu_get_by_name_locked(priv, name); ecu = j1939_ecu_get_by_name_locked(priv, name);
if (ecu && ecu->addr == skcb->addr.sa) {
/* The ISO 11783-5 standard, in "4.5.2 - Address claim
* requirements", states:
* d) No CF shall begin, or resume, transmission on the
* network until 250 ms after it has successfully claimed
* an address except when responding to a request for
* address-claimed.
*
* But "Figure 6" and "Figure 7" in "4.5.4.2 - Address-claim
* prioritization" show that the CF begins the transmission
* after 250 ms from the first AC (address-claimed) message
* even if it sends another AC message during that time window
* to resolve the address contention with another CF.
*
* As stated in "4.4.2.3 - Address-claimed message":
* In order to successfully claim an address, the CF sending
* an address claimed message shall not receive a contending
* claim from another CF for at least 250 ms.
*
* As stated in "4.4.3.2 - NAME management (NM) message":
* 1) A commanding CF can
* d) request that a CF with a specified NAME transmit
* the address-claimed message with its current NAME.
* 2) A target CF shall
* d) send an address-claimed message in response to a
* request for a matching NAME
*
* Taking the above arguments into account, the 250 ms wait is
* requested only during network initialization.
*
* Do not restart the timer on AC message if both the NAME and
* the address match and so if the address has already been
* claimed (timer has expired) or the AC message has been sent
* to resolve the contention with another CF (timer is still
* running).
*/
goto out_ecu_put;
}
if (!ecu && j1939_address_is_unicast(skcb->addr.sa)) if (!ecu && j1939_address_is_unicast(skcb->addr.sa))
ecu = j1939_ecu_create_locked(priv, name); ecu = j1939_ecu_create_locked(priv, name);

View File

@ -1087,10 +1087,6 @@ static bool j1939_session_deactivate(struct j1939_session *session)
bool active; bool active;
j1939_session_list_lock(priv); j1939_session_list_lock(priv);
/* This function should be called with a session ref-count of at
* least 2.
*/
WARN_ON_ONCE(kref_read(&session->kref) < 2);
active = j1939_session_deactivate_locked(session); active = j1939_session_deactivate_locked(session);
j1939_session_list_unlock(priv); j1939_session_list_unlock(priv);

Some files were not shown because too many files have changed in this diff Show More