2993 lines
98 KiB
Diff
2993 lines
98 KiB
Diff
diff --git a/Makefile b/Makefile
|
|
index b594484788a8..f0290097784a 100644
|
|
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -1,6 +1,6 @@
|
|
VERSION = 4
|
|
PATCHLEVEL = 9
|
|
-SUBLEVEL = 215
|
|
+SUBLEVEL = 216
|
|
EXTRAVERSION =
|
|
NAME = Roaring Lionus
|
|
|
|
diff --git a/arch/arm/boot/dts/ls1021a.dtsi b/arch/arm/boot/dts/ls1021a.dtsi
|
|
index 27133c3a4b12..0de4ba698d1d 100644
|
|
--- a/arch/arm/boot/dts/ls1021a.dtsi
|
|
+++ b/arch/arm/boot/dts/ls1021a.dtsi
|
|
@@ -505,7 +505,7 @@
|
|
};
|
|
|
|
mdio0: mdio@2d24000 {
|
|
- compatible = "fsl,etsec2-mdio";
|
|
+ compatible = "gianfar";
|
|
device_type = "mdio";
|
|
#address-cells = <1>;
|
|
#size-cells = <0>;
|
|
@@ -513,7 +513,7 @@
|
|
};
|
|
|
|
mdio1: mdio@2d64000 {
|
|
- compatible = "fsl,etsec2-mdio";
|
|
+ compatible = "gianfar";
|
|
device_type = "mdio";
|
|
#address-cells = <1>;
|
|
#size-cells = <0>;
|
|
diff --git a/arch/arm/mach-imx/Makefile b/arch/arm/mach-imx/Makefile
|
|
index cab128913e72..3a4014870a91 100644
|
|
--- a/arch/arm/mach-imx/Makefile
|
|
+++ b/arch/arm/mach-imx/Makefile
|
|
@@ -86,6 +86,8 @@ AFLAGS_suspend-imx6.o :=-Wa,-march=armv7-a
|
|
obj-$(CONFIG_SOC_IMX6) += suspend-imx6.o
|
|
obj-$(CONFIG_SOC_IMX53) += suspend-imx53.o
|
|
endif
|
|
+AFLAGS_resume-imx6.o :=-Wa,-march=armv7-a
|
|
+obj-$(CONFIG_SOC_IMX6) += resume-imx6.o
|
|
obj-$(CONFIG_SOC_IMX6) += pm-imx6.o
|
|
|
|
obj-$(CONFIG_SOC_IMX1) += mach-imx1.o
|
|
diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h
|
|
index c4436d9c52ff..a3f6885cefbf 100644
|
|
--- a/arch/arm/mach-imx/common.h
|
|
+++ b/arch/arm/mach-imx/common.h
|
|
@@ -112,17 +112,17 @@ void imx_cpu_die(unsigned int cpu);
|
|
int imx_cpu_kill(unsigned int cpu);
|
|
|
|
#ifdef CONFIG_SUSPEND
|
|
-void v7_cpu_resume(void);
|
|
void imx53_suspend(void __iomem *ocram_vbase);
|
|
extern const u32 imx53_suspend_sz;
|
|
void imx6_suspend(void __iomem *ocram_vbase);
|
|
#else
|
|
-static inline void v7_cpu_resume(void) {}
|
|
static inline void imx53_suspend(void __iomem *ocram_vbase) {}
|
|
static const u32 imx53_suspend_sz;
|
|
static inline void imx6_suspend(void __iomem *ocram_vbase) {}
|
|
#endif
|
|
|
|
+void v7_cpu_resume(void);
|
|
+
|
|
void imx6_pm_ccm_init(const char *ccm_compat);
|
|
void imx6q_pm_init(void);
|
|
void imx6dl_pm_init(void);
|
|
diff --git a/arch/arm/mach-imx/resume-imx6.S b/arch/arm/mach-imx/resume-imx6.S
|
|
new file mode 100644
|
|
index 000000000000..5bd1ba7ef15b
|
|
--- /dev/null
|
|
+++ b/arch/arm/mach-imx/resume-imx6.S
|
|
@@ -0,0 +1,24 @@
|
|
+/* SPDX-License-Identifier: GPL-2.0-or-later */
|
|
+/*
|
|
+ * Copyright 2014 Freescale Semiconductor, Inc.
|
|
+ */
|
|
+
|
|
+#include <linux/linkage.h>
|
|
+#include <asm/assembler.h>
|
|
+#include <asm/asm-offsets.h>
|
|
+#include <asm/hardware/cache-l2x0.h>
|
|
+#include "hardware.h"
|
|
+
|
|
+/*
|
|
+ * The following code must assume it is running from physical address
|
|
+ * where absolute virtual addresses to the data section have to be
|
|
+ * turned into relative ones.
|
|
+ */
|
|
+
|
|
+ENTRY(v7_cpu_resume)
|
|
+ bl v7_invalidate_l1
|
|
+#ifdef CONFIG_CACHE_L2X0
|
|
+ bl l2c310_early_resume
|
|
+#endif
|
|
+ b cpu_resume
|
|
+ENDPROC(v7_cpu_resume)
|
|
diff --git a/arch/arm/mach-imx/suspend-imx6.S b/arch/arm/mach-imx/suspend-imx6.S
|
|
index 76ee2ceec8d5..7d84b617af48 100644
|
|
--- a/arch/arm/mach-imx/suspend-imx6.S
|
|
+++ b/arch/arm/mach-imx/suspend-imx6.S
|
|
@@ -333,17 +333,3 @@ resume:
|
|
|
|
ret lr
|
|
ENDPROC(imx6_suspend)
|
|
-
|
|
-/*
|
|
- * The following code must assume it is running from physical address
|
|
- * where absolute virtual addresses to the data section have to be
|
|
- * turned into relative ones.
|
|
- */
|
|
-
|
|
-ENTRY(v7_cpu_resume)
|
|
- bl v7_invalidate_l1
|
|
-#ifdef CONFIG_CACHE_L2X0
|
|
- bl l2c310_early_resume
|
|
-#endif
|
|
- b cpu_resume
|
|
-ENDPROC(v7_cpu_resume)
|
|
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
|
|
index 544ea21bfef9..b2683aca401f 100644
|
|
--- a/arch/mips/kernel/vpe.c
|
|
+++ b/arch/mips/kernel/vpe.c
|
|
@@ -134,7 +134,7 @@ void release_vpe(struct vpe *v)
|
|
{
|
|
list_del(&v->list);
|
|
if (v->load_addr)
|
|
- release_progmem(v);
|
|
+ release_progmem(v->load_addr);
|
|
kfree(v);
|
|
}
|
|
|
|
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
|
|
index 7471ed48f41f..514e04b62261 100644
|
|
--- a/arch/powerpc/kernel/cputable.c
|
|
+++ b/arch/powerpc/kernel/cputable.c
|
|
@@ -2199,11 +2199,13 @@ static struct cpu_spec * __init setup_cpu_spec(unsigned long offset,
|
|
* oprofile_cpu_type already has a value, then we are
|
|
* possibly overriding a real PVR with a logical one,
|
|
* and, in that case, keep the current value for
|
|
- * oprofile_cpu_type.
|
|
+ * oprofile_cpu_type. Futhermore, let's ensure that the
|
|
+ * fix for the PMAO bug is enabled on compatibility mode.
|
|
*/
|
|
if (old.oprofile_cpu_type != NULL) {
|
|
t->oprofile_cpu_type = old.oprofile_cpu_type;
|
|
t->oprofile_type = old.oprofile_type;
|
|
+ t->cpu_features |= old.cpu_features & CPU_FTR_PMAO_BUG;
|
|
}
|
|
}
|
|
|
|
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
|
|
index 477df9782fdf..f490a4fab2f7 100644
|
|
--- a/arch/x86/kernel/cpu/common.c
|
|
+++ b/arch/x86/kernel/cpu/common.c
|
|
@@ -388,7 +388,7 @@ static __always_inline void setup_pku(struct cpuinfo_x86 *c)
|
|
* cpuid bit to be set. We need to ensure that we
|
|
* update that bit in this CPU's "cpu_info".
|
|
*/
|
|
- get_cpu_cap(c);
|
|
+ set_cpu_cap(c, X86_FEATURE_OSPKE);
|
|
}
|
|
|
|
#ifdef CONFIG_X86_INTEL_MEMORY_PROTECTION_KEYS
|
|
diff --git a/crypto/algif_skcipher.c b/crypto/algif_skcipher.c
|
|
index aaf2f810d170..b28f45aca2ef 100644
|
|
--- a/crypto/algif_skcipher.c
|
|
+++ b/crypto/algif_skcipher.c
|
|
@@ -538,7 +538,7 @@ static int skcipher_recvmsg_async(struct socket *sock, struct msghdr *msg,
|
|
lock_sock(sk);
|
|
tx_nents = skcipher_all_sg_nents(ctx);
|
|
sreq->tsg = kcalloc(tx_nents, sizeof(*sg), GFP_KERNEL);
|
|
- if (unlikely(!sreq->tsg))
|
|
+ if (unlikely(ZERO_OR_NULL_PTR(sreq->tsg)))
|
|
goto unlock;
|
|
sg_init_table(sreq->tsg, tx_nents);
|
|
memcpy(iv, ctx->iv, ivsize);
|
|
diff --git a/drivers/acpi/acpi_watchdog.c b/drivers/acpi/acpi_watchdog.c
|
|
index 396e358c2cee..7ef0a0e105e1 100644
|
|
--- a/drivers/acpi/acpi_watchdog.c
|
|
+++ b/drivers/acpi/acpi_watchdog.c
|
|
@@ -129,12 +129,11 @@ void __init acpi_watchdog_init(void)
|
|
gas = &entries[i].register_region;
|
|
|
|
res.start = gas->address;
|
|
+ res.end = res.start + ACPI_ACCESS_BYTE_WIDTH(gas->access_width) - 1;
|
|
if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
|
|
res.flags = IORESOURCE_MEM;
|
|
- res.end = res.start + ALIGN(gas->access_width, 4) - 1;
|
|
} else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
|
|
res.flags = IORESOURCE_IO;
|
|
- res.end = res.start + gas->access_width - 1;
|
|
} else {
|
|
pr_warn("Unsupported address space: %u\n",
|
|
gas->space_id);
|
|
diff --git a/drivers/char/ipmi/ipmi_ssif.c b/drivers/char/ipmi/ipmi_ssif.c
|
|
index 996b9ae15404..a4ef9a6bd367 100644
|
|
--- a/drivers/char/ipmi/ipmi_ssif.c
|
|
+++ b/drivers/char/ipmi/ipmi_ssif.c
|
|
@@ -746,10 +746,14 @@ static void msg_done_handler(struct ssif_info *ssif_info, int result,
|
|
flags = ipmi_ssif_lock_cond(ssif_info, &oflags);
|
|
msg = ssif_info->curr_msg;
|
|
if (msg) {
|
|
+ if (data) {
|
|
+ if (len > IPMI_MAX_MSG_LENGTH)
|
|
+ len = IPMI_MAX_MSG_LENGTH;
|
|
+ memcpy(msg->rsp, data, len);
|
|
+ } else {
|
|
+ len = 0;
|
|
+ }
|
|
msg->rsp_size = len;
|
|
- if (msg->rsp_size > IPMI_MAX_MSG_LENGTH)
|
|
- msg->rsp_size = IPMI_MAX_MSG_LENGTH;
|
|
- memcpy(msg->rsp, data, msg->rsp_size);
|
|
ssif_info->curr_msg = NULL;
|
|
}
|
|
|
|
diff --git a/drivers/dma/coh901318.c b/drivers/dma/coh901318.c
|
|
index 6d7d2d54eacf..f0932f25a9b1 100644
|
|
--- a/drivers/dma/coh901318.c
|
|
+++ b/drivers/dma/coh901318.c
|
|
@@ -1944,8 +1944,6 @@ static void dma_tc_handle(struct coh901318_chan *cohc)
|
|
return;
|
|
}
|
|
|
|
- spin_lock(&cohc->lock);
|
|
-
|
|
/*
|
|
* When we reach this point, at least one queue item
|
|
* should have been moved over from cohc->queue to
|
|
@@ -1966,8 +1964,6 @@ static void dma_tc_handle(struct coh901318_chan *cohc)
|
|
if (coh901318_queue_start(cohc) == NULL)
|
|
cohc->busy = 0;
|
|
|
|
- spin_unlock(&cohc->lock);
|
|
-
|
|
/*
|
|
* This tasklet will remove items from cohc->active
|
|
* and thus terminates them.
|
|
diff --git a/drivers/dma/tegra20-apb-dma.c b/drivers/dma/tegra20-apb-dma.c
|
|
index 22f7f0c68a48..4eaf92b2b886 100644
|
|
--- a/drivers/dma/tegra20-apb-dma.c
|
|
+++ b/drivers/dma/tegra20-apb-dma.c
|
|
@@ -288,7 +288,7 @@ static struct tegra_dma_desc *tegra_dma_desc_get(
|
|
|
|
/* Do not allocate if desc are waiting for ack */
|
|
list_for_each_entry(dma_desc, &tdc->free_dma_desc, node) {
|
|
- if (async_tx_test_ack(&dma_desc->txd)) {
|
|
+ if (async_tx_test_ack(&dma_desc->txd) && !dma_desc->cb_count) {
|
|
list_del(&dma_desc->node);
|
|
spin_unlock_irqrestore(&tdc->lock, flags);
|
|
dma_desc->txd.flags = 0;
|
|
@@ -755,10 +755,6 @@ static int tegra_dma_terminate_all(struct dma_chan *dc)
|
|
bool was_busy;
|
|
|
|
spin_lock_irqsave(&tdc->lock, flags);
|
|
- if (list_empty(&tdc->pending_sg_req)) {
|
|
- spin_unlock_irqrestore(&tdc->lock, flags);
|
|
- return 0;
|
|
- }
|
|
|
|
if (!tdc->busy)
|
|
goto skip_dma_stop;
|
|
diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c
|
|
index c8d1f19c9a6d..d46b9e75a847 100644
|
|
--- a/drivers/gpu/drm/msm/dsi/dsi_manager.c
|
|
+++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c
|
|
@@ -306,7 +306,7 @@ static int dsi_mgr_connector_get_modes(struct drm_connector *connector)
|
|
return num;
|
|
}
|
|
|
|
-static int dsi_mgr_connector_mode_valid(struct drm_connector *connector,
|
|
+static enum drm_mode_status dsi_mgr_connector_mode_valid(struct drm_connector *connector,
|
|
struct drm_display_mode *mode)
|
|
{
|
|
int id = dsi_mgr_connector_get_id(connector);
|
|
@@ -438,6 +438,7 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge *bridge)
|
|
struct msm_dsi *msm_dsi1 = dsi_mgr_get_dsi(DSI_1);
|
|
struct mipi_dsi_host *host = msm_dsi->host;
|
|
struct drm_panel *panel = msm_dsi->panel;
|
|
+ struct msm_dsi_pll *src_pll;
|
|
bool is_dual_dsi = IS_DUAL_DSI();
|
|
int ret;
|
|
|
|
@@ -471,6 +472,10 @@ static void dsi_mgr_bridge_post_disable(struct drm_bridge *bridge)
|
|
id, ret);
|
|
}
|
|
|
|
+ /* Save PLL status if it is a clock source */
|
|
+ src_pll = msm_dsi_phy_get_pll(msm_dsi->phy);
|
|
+ msm_dsi_pll_save_state(src_pll);
|
|
+
|
|
ret = msm_dsi_host_power_off(host);
|
|
if (ret)
|
|
pr_err("%s: host %d power off failed,%d\n", __func__, id, ret);
|
|
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
|
|
index 6abf315fd6da..ce32f41fc28a 100644
|
|
--- a/drivers/gpu/drm/msm/msm_drv.c
|
|
+++ b/drivers/gpu/drm/msm/msm_drv.c
|
|
@@ -396,6 +396,14 @@ static int msm_drm_init(struct device *dev, struct drm_driver *drv)
|
|
if (ret)
|
|
goto fail;
|
|
|
|
+ if (!dev->dma_parms) {
|
|
+ dev->dma_parms = devm_kzalloc(dev, sizeof(*dev->dma_parms),
|
|
+ GFP_KERNEL);
|
|
+ if (!dev->dma_parms)
|
|
+ return -ENOMEM;
|
|
+ }
|
|
+ dma_set_max_seg_size(dev, DMA_BIT_MASK(32));
|
|
+
|
|
msm_gem_shrinker_init(ddev);
|
|
|
|
switch (get_mdp_ver(pdev)) {
|
|
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c
|
|
index e382d6f23097..b4b9d8152536 100644
|
|
--- a/drivers/hid/hid-core.c
|
|
+++ b/drivers/hid/hid-core.c
|
|
@@ -1547,7 +1547,9 @@ int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
|
|
|
|
rsize = ((report->size - 1) >> 3) + 1;
|
|
|
|
- if (rsize > HID_MAX_BUFFER_SIZE)
|
|
+ if (report_enum->numbered && rsize >= HID_MAX_BUFFER_SIZE)
|
|
+ rsize = HID_MAX_BUFFER_SIZE - 1;
|
|
+ else if (rsize > HID_MAX_BUFFER_SIZE)
|
|
rsize = HID_MAX_BUFFER_SIZE;
|
|
|
|
if (csize < rsize) {
|
|
diff --git a/drivers/hid/usbhid/hiddev.c b/drivers/hid/usbhid/hiddev.c
|
|
index 8903ea09ac58..dbdd265075da 100644
|
|
--- a/drivers/hid/usbhid/hiddev.c
|
|
+++ b/drivers/hid/usbhid/hiddev.c
|
|
@@ -962,9 +962,9 @@ void hiddev_disconnect(struct hid_device *hid)
|
|
hiddev->exist = 0;
|
|
|
|
if (hiddev->open) {
|
|
- mutex_unlock(&hiddev->existancelock);
|
|
usbhid_close(hiddev->hid);
|
|
wake_up_interruptible(&hiddev->wait);
|
|
+ mutex_unlock(&hiddev->existancelock);
|
|
} else {
|
|
mutex_unlock(&hiddev->existancelock);
|
|
kfree(hiddev);
|
|
diff --git a/drivers/hwmon/adt7462.c b/drivers/hwmon/adt7462.c
|
|
index 5929e126da63..d9923d63eb4f 100644
|
|
--- a/drivers/hwmon/adt7462.c
|
|
+++ b/drivers/hwmon/adt7462.c
|
|
@@ -426,7 +426,7 @@ static int ADT7462_REG_VOLT(struct adt7462_data *data, int which)
|
|
return 0x95;
|
|
break;
|
|
}
|
|
- return -ENODEV;
|
|
+ return 0;
|
|
}
|
|
|
|
/* Provide labels for sysfs */
|
|
diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c
|
|
index 30132c3957cd..41ca9ff7b5da 100644
|
|
--- a/drivers/i2c/busses/i2c-jz4780.c
|
|
+++ b/drivers/i2c/busses/i2c-jz4780.c
|
|
@@ -82,25 +82,6 @@
|
|
#define JZ4780_I2C_STA_TFNF BIT(1)
|
|
#define JZ4780_I2C_STA_ACT BIT(0)
|
|
|
|
-static const char * const jz4780_i2c_abrt_src[] = {
|
|
- "ABRT_7B_ADDR_NOACK",
|
|
- "ABRT_10ADDR1_NOACK",
|
|
- "ABRT_10ADDR2_NOACK",
|
|
- "ABRT_XDATA_NOACK",
|
|
- "ABRT_GCALL_NOACK",
|
|
- "ABRT_GCALL_READ",
|
|
- "ABRT_HS_ACKD",
|
|
- "SBYTE_ACKDET",
|
|
- "ABRT_HS_NORSTRT",
|
|
- "SBYTE_NORSTRT",
|
|
- "ABRT_10B_RD_NORSTRT",
|
|
- "ABRT_MASTER_DIS",
|
|
- "ARB_LOST",
|
|
- "SLVFLUSH_TXFIFO",
|
|
- "SLV_ARBLOST",
|
|
- "SLVRD_INTX",
|
|
-};
|
|
-
|
|
#define JZ4780_I2C_INTST_IGC BIT(11)
|
|
#define JZ4780_I2C_INTST_ISTT BIT(10)
|
|
#define JZ4780_I2C_INTST_ISTP BIT(9)
|
|
@@ -538,21 +519,8 @@ done:
|
|
|
|
static void jz4780_i2c_txabrt(struct jz4780_i2c *i2c, int src)
|
|
{
|
|
- int i;
|
|
-
|
|
- dev_err(&i2c->adap.dev, "txabrt: 0x%08x\n", src);
|
|
- dev_err(&i2c->adap.dev, "device addr=%x\n",
|
|
- jz4780_i2c_readw(i2c, JZ4780_I2C_TAR));
|
|
- dev_err(&i2c->adap.dev, "send cmd count:%d %d\n",
|
|
- i2c->cmd, i2c->cmd_buf[i2c->cmd]);
|
|
- dev_err(&i2c->adap.dev, "receive data count:%d %d\n",
|
|
- i2c->cmd, i2c->data_buf[i2c->cmd]);
|
|
-
|
|
- for (i = 0; i < 16; i++) {
|
|
- if (src & BIT(i))
|
|
- dev_dbg(&i2c->adap.dev, "I2C TXABRT[%d]=%s\n",
|
|
- i, jz4780_i2c_abrt_src[i]);
|
|
- }
|
|
+ dev_dbg(&i2c->adap.dev, "txabrt: 0x%08x, cmd: %d, send: %d, recv: %d\n",
|
|
+ src, i2c->cmd, i2c->cmd_buf[i2c->cmd], i2c->data_buf[i2c->cmd]);
|
|
}
|
|
|
|
static inline int jz4780_i2c_xfer_read(struct jz4780_i2c *i2c,
|
|
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
|
|
index 71c7c4c328ef..304429fd04dd 100644
|
|
--- a/drivers/infiniband/core/cm.c
|
|
+++ b/drivers/infiniband/core/cm.c
|
|
@@ -1073,6 +1073,7 @@ struct ib_cm_id *ib_cm_insert_listen(struct ib_device *device,
|
|
/* Sharing an ib_cm_id with different handlers is not
|
|
* supported */
|
|
spin_unlock_irqrestore(&cm.lock, flags);
|
|
+ ib_destroy_cm_id(cm_id);
|
|
return ERR_PTR(-EINVAL);
|
|
}
|
|
atomic_inc(&cm_id_priv->refcount);
|
|
diff --git a/drivers/infiniband/core/iwcm.c b/drivers/infiniband/core/iwcm.c
|
|
index 5495e22839a7..1f71c306923f 100644
|
|
--- a/drivers/infiniband/core/iwcm.c
|
|
+++ b/drivers/infiniband/core/iwcm.c
|
|
@@ -137,8 +137,10 @@ static void dealloc_work_entries(struct iwcm_id_private *cm_id_priv)
|
|
{
|
|
struct list_head *e, *tmp;
|
|
|
|
- list_for_each_safe(e, tmp, &cm_id_priv->work_free_list)
|
|
+ list_for_each_safe(e, tmp, &cm_id_priv->work_free_list) {
|
|
+ list_del(e);
|
|
kfree(list_entry(e, struct iwcm_work, free_list));
|
|
+ }
|
|
}
|
|
|
|
static int alloc_work_entries(struct iwcm_id_private *cm_id_priv, int count)
|
|
diff --git a/drivers/md/dm-cache-target.c b/drivers/md/dm-cache-target.c
|
|
index 58b97226050f..1b7d77080d6b 100644
|
|
--- a/drivers/md/dm-cache-target.c
|
|
+++ b/drivers/md/dm-cache-target.c
|
|
@@ -2192,8 +2192,8 @@ static void wait_for_migrations(struct cache *cache)
|
|
|
|
static void stop_worker(struct cache *cache)
|
|
{
|
|
- cancel_delayed_work(&cache->waker);
|
|
- flush_workqueue(cache->wq);
|
|
+ cancel_delayed_work_sync(&cache->waker);
|
|
+ drain_workqueue(cache->wq);
|
|
}
|
|
|
|
static void requeue_deferred_cells(struct cache *cache)
|
|
diff --git a/drivers/net/ethernet/amazon/ena/ena_com.c b/drivers/net/ethernet/amazon/ena/ena_com.c
|
|
index 912dc09bc7a7..905911f78693 100644
|
|
--- a/drivers/net/ethernet/amazon/ena/ena_com.c
|
|
+++ b/drivers/net/ethernet/amazon/ena/ena_com.c
|
|
@@ -199,6 +199,11 @@ static inline void comp_ctxt_release(struct ena_com_admin_queue *queue,
|
|
static struct ena_comp_ctx *get_comp_ctxt(struct ena_com_admin_queue *queue,
|
|
u16 command_id, bool capture)
|
|
{
|
|
+ if (unlikely(!queue->comp_ctx)) {
|
|
+ pr_err("Completion context is NULL\n");
|
|
+ return NULL;
|
|
+ }
|
|
+
|
|
if (unlikely(command_id >= queue->q_depth)) {
|
|
pr_err("command id is larger than the queue size. cmd_id: %u queue size %d\n",
|
|
command_id, queue->q_depth);
|
|
@@ -839,6 +844,24 @@ static int ena_com_get_feature(struct ena_com_dev *ena_dev,
|
|
0);
|
|
}
|
|
|
|
+static void ena_com_hash_key_fill_default_key(struct ena_com_dev *ena_dev)
|
|
+{
|
|
+ struct ena_admin_feature_rss_flow_hash_control *hash_key =
|
|
+ (ena_dev->rss).hash_key;
|
|
+
|
|
+ netdev_rss_key_fill(&hash_key->key, sizeof(hash_key->key));
|
|
+ /* The key is stored in the device in u32 array
|
|
+ * as well as the API requires the key to be passed in this
|
|
+ * format. Thus the size of our array should be divided by 4
|
|
+ */
|
|
+ hash_key->keys_num = sizeof(hash_key->key) / sizeof(u32);
|
|
+}
|
|
+
|
|
+int ena_com_get_current_hash_function(struct ena_com_dev *ena_dev)
|
|
+{
|
|
+ return ena_dev->rss.hash_func;
|
|
+}
|
|
+
|
|
static int ena_com_hash_key_allocate(struct ena_com_dev *ena_dev)
|
|
{
|
|
struct ena_rss *rss = &ena_dev->rss;
|
|
@@ -2034,15 +2057,16 @@ int ena_com_fill_hash_function(struct ena_com_dev *ena_dev,
|
|
|
|
switch (func) {
|
|
case ENA_ADMIN_TOEPLITZ:
|
|
- if (key_len > sizeof(hash_key->key)) {
|
|
- pr_err("key len (%hu) is bigger than the max supported (%zu)\n",
|
|
- key_len, sizeof(hash_key->key));
|
|
- return -EINVAL;
|
|
+ if (key) {
|
|
+ if (key_len != sizeof(hash_key->key)) {
|
|
+ pr_err("key len (%hu) doesn't equal the supported size (%zu)\n",
|
|
+ key_len, sizeof(hash_key->key));
|
|
+ return -EINVAL;
|
|
+ }
|
|
+ memcpy(hash_key->key, key, key_len);
|
|
+ rss->hash_init_val = init_val;
|
|
+ hash_key->keys_num = key_len >> 2;
|
|
}
|
|
-
|
|
- memcpy(hash_key->key, key, key_len);
|
|
- rss->hash_init_val = init_val;
|
|
- hash_key->keys_num = key_len >> 2;
|
|
break;
|
|
case ENA_ADMIN_CRC32:
|
|
rss->hash_init_val = init_val;
|
|
@@ -2079,7 +2103,11 @@ int ena_com_get_hash_function(struct ena_com_dev *ena_dev,
|
|
if (unlikely(rc))
|
|
return rc;
|
|
|
|
- rss->hash_func = get_resp.u.flow_hash_func.selected_func;
|
|
+ /* ffs() returns 1 in case the lsb is set */
|
|
+ rss->hash_func = ffs(get_resp.u.flow_hash_func.selected_func);
|
|
+ if (rss->hash_func)
|
|
+ rss->hash_func--;
|
|
+
|
|
if (func)
|
|
*func = rss->hash_func;
|
|
|
|
@@ -2366,6 +2394,8 @@ int ena_com_rss_init(struct ena_com_dev *ena_dev, u16 indr_tbl_log_size)
|
|
if (unlikely(rc))
|
|
goto err_hash_key;
|
|
|
|
+ ena_com_hash_key_fill_default_key(ena_dev);
|
|
+
|
|
rc = ena_com_hash_ctrl_init(ena_dev);
|
|
if (unlikely(rc))
|
|
goto err_hash_ctrl;
|
|
diff --git a/drivers/net/ethernet/amazon/ena/ena_com.h b/drivers/net/ethernet/amazon/ena/ena_com.h
|
|
index 509d7b8e15ab..98b2ad20f599 100644
|
|
--- a/drivers/net/ethernet/amazon/ena/ena_com.h
|
|
+++ b/drivers/net/ethernet/amazon/ena/ena_com.h
|
|
@@ -41,6 +41,7 @@
|
|
#include <linux/spinlock.h>
|
|
#include <linux/types.h>
|
|
#include <linux/wait.h>
|
|
+#include <linux/netdevice.h>
|
|
|
|
#include "ena_common_defs.h"
|
|
#include "ena_admin_defs.h"
|
|
@@ -622,6 +623,14 @@ int ena_com_rss_init(struct ena_com_dev *ena_dev, u16 log_size);
|
|
*/
|
|
void ena_com_rss_destroy(struct ena_com_dev *ena_dev);
|
|
|
|
+/* ena_com_get_current_hash_function - Get RSS hash function
|
|
+ * @ena_dev: ENA communication layer struct
|
|
+ *
|
|
+ * Return the current hash function.
|
|
+ * @return: 0 or one of the ena_admin_hash_functions values.
|
|
+ */
|
|
+int ena_com_get_current_hash_function(struct ena_com_dev *ena_dev);
|
|
+
|
|
/* ena_com_fill_hash_function - Fill RSS hash function
|
|
* @ena_dev: ENA communication layer struct
|
|
* @func: The hash function (Toeplitz or crc)
|
|
diff --git a/drivers/net/ethernet/amazon/ena/ena_ethtool.c b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
|
|
index 06fd061a20e9..0ef0a7b75751 100644
|
|
--- a/drivers/net/ethernet/amazon/ena/ena_ethtool.c
|
|
+++ b/drivers/net/ethernet/amazon/ena/ena_ethtool.c
|
|
@@ -651,6 +651,28 @@ static u32 ena_get_rxfh_key_size(struct net_device *netdev)
|
|
return ENA_HASH_KEY_SIZE;
|
|
}
|
|
|
|
+static int ena_indirection_table_get(struct ena_adapter *adapter, u32 *indir)
|
|
+{
|
|
+ struct ena_com_dev *ena_dev = adapter->ena_dev;
|
|
+ int i, rc;
|
|
+
|
|
+ if (!indir)
|
|
+ return 0;
|
|
+
|
|
+ rc = ena_com_indirect_table_get(ena_dev, indir);
|
|
+ if (rc)
|
|
+ return rc;
|
|
+
|
|
+ /* Our internal representation of the indices is: even indices
|
|
+ * for Tx and uneven indices for Rx. We need to convert the Rx
|
|
+ * indices to be consecutive
|
|
+ */
|
|
+ for (i = 0; i < ENA_RX_RSS_TABLE_SIZE; i++)
|
|
+ indir[i] = ENA_IO_RXQ_IDX_TO_COMBINED_IDX(indir[i]);
|
|
+
|
|
+ return rc;
|
|
+}
|
|
+
|
|
static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
|
|
u8 *hfunc)
|
|
{
|
|
@@ -659,11 +681,25 @@ static int ena_get_rxfh(struct net_device *netdev, u32 *indir, u8 *key,
|
|
u8 func;
|
|
int rc;
|
|
|
|
- rc = ena_com_indirect_table_get(adapter->ena_dev, indir);
|
|
+ rc = ena_indirection_table_get(adapter, indir);
|
|
if (rc)
|
|
return rc;
|
|
|
|
+ /* We call this function in order to check if the device
|
|
+ * supports getting/setting the hash function.
|
|
+ */
|
|
rc = ena_com_get_hash_function(adapter->ena_dev, &ena_func, key);
|
|
+
|
|
+ if (rc) {
|
|
+ if (rc == -EOPNOTSUPP) {
|
|
+ key = NULL;
|
|
+ hfunc = NULL;
|
|
+ rc = 0;
|
|
+ }
|
|
+
|
|
+ return rc;
|
|
+ }
|
|
+
|
|
if (rc)
|
|
return rc;
|
|
|
|
@@ -715,6 +751,9 @@ static int ena_set_rxfh(struct net_device *netdev, const u32 *indir,
|
|
}
|
|
|
|
switch (hfunc) {
|
|
+ case ETH_RSS_HASH_NO_CHANGE:
|
|
+ func = ena_com_get_current_hash_function(ena_dev);
|
|
+ break;
|
|
case ETH_RSS_HASH_TOP:
|
|
func = ENA_ADMIN_TOEPLITZ;
|
|
break;
|
|
@@ -819,6 +858,7 @@ static const struct ethtool_ops ena_ethtool_ops = {
|
|
.get_channels = ena_get_channels,
|
|
.get_tunable = ena_get_tunable,
|
|
.set_tunable = ena_set_tunable,
|
|
+ .get_ts_info = ethtool_op_get_ts_info,
|
|
};
|
|
|
|
void ena_set_ethtool_ops(struct net_device *netdev)
|
|
diff --git a/drivers/net/ethernet/amazon/ena/ena_netdev.h b/drivers/net/ethernet/amazon/ena/ena_netdev.h
|
|
index 008f2d594d40..326c2e1437b3 100644
|
|
--- a/drivers/net/ethernet/amazon/ena/ena_netdev.h
|
|
+++ b/drivers/net/ethernet/amazon/ena/ena_netdev.h
|
|
@@ -110,6 +110,8 @@
|
|
|
|
#define ENA_IO_TXQ_IDX(q) (2 * (q))
|
|
#define ENA_IO_RXQ_IDX(q) (2 * (q) + 1)
|
|
+#define ENA_IO_TXQ_IDX_TO_COMBINED_IDX(q) ((q) / 2)
|
|
+#define ENA_IO_RXQ_IDX_TO_COMBINED_IDX(q) (((q) - 1) / 2)
|
|
|
|
#define ENA_MGMNT_IRQ_IDX 0
|
|
#define ENA_IO_IRQ_FIRST_IDX 1
|
|
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
|
|
index de4b5d267c30..17c07837033f 100644
|
|
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
|
|
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_main.c
|
|
@@ -1711,7 +1711,7 @@ static int xgene_enet_probe(struct platform_device *pdev)
|
|
int ret;
|
|
|
|
ndev = alloc_etherdev_mqs(sizeof(struct xgene_enet_pdata),
|
|
- XGENE_NUM_RX_RING, XGENE_NUM_TX_RING);
|
|
+ XGENE_NUM_TX_RING, XGENE_NUM_RX_RING);
|
|
if (!ndev)
|
|
return -ENOMEM;
|
|
|
|
diff --git a/drivers/net/ethernet/micrel/ks8851_mll.c b/drivers/net/ethernet/micrel/ks8851_mll.c
|
|
index 8dc1f0277117..d94e151cff12 100644
|
|
--- a/drivers/net/ethernet/micrel/ks8851_mll.c
|
|
+++ b/drivers/net/ethernet/micrel/ks8851_mll.c
|
|
@@ -474,24 +474,6 @@ static int msg_enable;
|
|
* chip is busy transferring packet data (RX/TX FIFO accesses).
|
|
*/
|
|
|
|
-/**
|
|
- * ks_rdreg8 - read 8 bit register from device
|
|
- * @ks : The chip information
|
|
- * @offset: The register address
|
|
- *
|
|
- * Read a 8bit register from the chip, returning the result
|
|
- */
|
|
-static u8 ks_rdreg8(struct ks_net *ks, int offset)
|
|
-{
|
|
- u16 data;
|
|
- u8 shift_bit = offset & 0x03;
|
|
- u8 shift_data = (offset & 1) << 3;
|
|
- ks->cmd_reg_cache = (u16) offset | (u16)(BE0 << shift_bit);
|
|
- iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
|
|
- data = ioread16(ks->hw_addr);
|
|
- return (u8)(data >> shift_data);
|
|
-}
|
|
-
|
|
/**
|
|
* ks_rdreg16 - read 16 bit register from device
|
|
* @ks : The chip information
|
|
@@ -502,27 +484,11 @@ static u8 ks_rdreg8(struct ks_net *ks, int offset)
|
|
|
|
static u16 ks_rdreg16(struct ks_net *ks, int offset)
|
|
{
|
|
- ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02));
|
|
+ ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02));
|
|
iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
|
|
return ioread16(ks->hw_addr);
|
|
}
|
|
|
|
-/**
|
|
- * ks_wrreg8 - write 8bit register value to chip
|
|
- * @ks: The chip information
|
|
- * @offset: The register address
|
|
- * @value: The value to write
|
|
- *
|
|
- */
|
|
-static void ks_wrreg8(struct ks_net *ks, int offset, u8 value)
|
|
-{
|
|
- u8 shift_bit = (offset & 0x03);
|
|
- u16 value_write = (u16)(value << ((offset & 1) << 3));
|
|
- ks->cmd_reg_cache = (u16)offset | (BE0 << shift_bit);
|
|
- iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
|
|
- iowrite16(value_write, ks->hw_addr);
|
|
-}
|
|
-
|
|
/**
|
|
* ks_wrreg16 - write 16bit register value to chip
|
|
* @ks: The chip information
|
|
@@ -533,7 +499,7 @@ static void ks_wrreg8(struct ks_net *ks, int offset, u8 value)
|
|
|
|
static void ks_wrreg16(struct ks_net *ks, int offset, u16 value)
|
|
{
|
|
- ks->cmd_reg_cache = (u16)offset | ((BE1 | BE0) << (offset & 0x02));
|
|
+ ks->cmd_reg_cache = (u16)offset | ((BE3 | BE2) >> (offset & 0x02));
|
|
iowrite16(ks->cmd_reg_cache, ks->hw_addr_cmd);
|
|
iowrite16(value, ks->hw_addr);
|
|
}
|
|
@@ -549,7 +515,7 @@ static inline void ks_inblk(struct ks_net *ks, u16 *wptr, u32 len)
|
|
{
|
|
len >>= 1;
|
|
while (len--)
|
|
- *wptr++ = (u16)ioread16(ks->hw_addr);
|
|
+ *wptr++ = be16_to_cpu(ioread16(ks->hw_addr));
|
|
}
|
|
|
|
/**
|
|
@@ -563,7 +529,7 @@ static inline void ks_outblk(struct ks_net *ks, u16 *wptr, u32 len)
|
|
{
|
|
len >>= 1;
|
|
while (len--)
|
|
- iowrite16(*wptr++, ks->hw_addr);
|
|
+ iowrite16(cpu_to_be16(*wptr++), ks->hw_addr);
|
|
}
|
|
|
|
static void ks_disable_int(struct ks_net *ks)
|
|
@@ -642,8 +608,7 @@ static void ks_read_config(struct ks_net *ks)
|
|
u16 reg_data = 0;
|
|
|
|
/* Regardless of bus width, 8 bit read should always work.*/
|
|
- reg_data = ks_rdreg8(ks, KS_CCR) & 0x00FF;
|
|
- reg_data |= ks_rdreg8(ks, KS_CCR+1) << 8;
|
|
+ reg_data = ks_rdreg16(ks, KS_CCR);
|
|
|
|
/* addr/data bus are multiplexed */
|
|
ks->sharedbus = (reg_data & CCR_SHARED) == CCR_SHARED;
|
|
@@ -747,7 +712,7 @@ static inline void ks_read_qmu(struct ks_net *ks, u16 *buf, u32 len)
|
|
|
|
/* 1. set sudo DMA mode */
|
|
ks_wrreg16(ks, KS_RXFDPR, RXFDPR_RXFPAI);
|
|
- ks_wrreg8(ks, KS_RXQCR, (ks->rc_rxqcr | RXQCR_SDA) & 0xff);
|
|
+ ks_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_SDA);
|
|
|
|
/* 2. read prepend data */
|
|
/**
|
|
@@ -764,7 +729,7 @@ static inline void ks_read_qmu(struct ks_net *ks, u16 *buf, u32 len)
|
|
ks_inblk(ks, buf, ALIGN(len, 4));
|
|
|
|
/* 4. reset sudo DMA Mode */
|
|
- ks_wrreg8(ks, KS_RXQCR, ks->rc_rxqcr);
|
|
+ ks_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr);
|
|
}
|
|
|
|
/**
|
|
@@ -997,13 +962,13 @@ static void ks_write_qmu(struct ks_net *ks, u8 *pdata, u16 len)
|
|
ks->txh.txw[1] = cpu_to_le16(len);
|
|
|
|
/* 1. set sudo-DMA mode */
|
|
- ks_wrreg8(ks, KS_RXQCR, (ks->rc_rxqcr | RXQCR_SDA) & 0xff);
|
|
+ ks_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr | RXQCR_SDA);
|
|
/* 2. write status/lenth info */
|
|
ks_outblk(ks, ks->txh.txw, 4);
|
|
/* 3. write pkt data */
|
|
ks_outblk(ks, (u16 *)pdata, ALIGN(len, 4));
|
|
/* 4. reset sudo-DMA mode */
|
|
- ks_wrreg8(ks, KS_RXQCR, ks->rc_rxqcr);
|
|
+ ks_wrreg16(ks, KS_RXQCR, ks->rc_rxqcr);
|
|
/* 5. Enqueue Tx(move the pkt from TX buffer into TXQ) */
|
|
ks_wrreg16(ks, KS_TXQCR, TXQCR_METFE);
|
|
/* 6. wait until TXQCR_METFE is auto-cleared */
|
|
diff --git a/drivers/net/phy/mdio-bcm-iproc.c b/drivers/net/phy/mdio-bcm-iproc.c
|
|
index 46fe1ae919a3..51ce3ea17fb3 100644
|
|
--- a/drivers/net/phy/mdio-bcm-iproc.c
|
|
+++ b/drivers/net/phy/mdio-bcm-iproc.c
|
|
@@ -188,6 +188,23 @@ static int iproc_mdio_remove(struct platform_device *pdev)
|
|
return 0;
|
|
}
|
|
|
|
+#ifdef CONFIG_PM_SLEEP
|
|
+int iproc_mdio_resume(struct device *dev)
|
|
+{
|
|
+ struct platform_device *pdev = to_platform_device(dev);
|
|
+ struct iproc_mdio_priv *priv = platform_get_drvdata(pdev);
|
|
+
|
|
+ /* restore the mii clock configuration */
|
|
+ iproc_mdio_config_clk(priv->base);
|
|
+
|
|
+ return 0;
|
|
+}
|
|
+
|
|
+static const struct dev_pm_ops iproc_mdio_pm_ops = {
|
|
+ .resume = iproc_mdio_resume
|
|
+};
|
|
+#endif /* CONFIG_PM_SLEEP */
|
|
+
|
|
static const struct of_device_id iproc_mdio_of_match[] = {
|
|
{ .compatible = "brcm,iproc-mdio", },
|
|
{ /* sentinel */ },
|
|
@@ -198,6 +215,9 @@ static struct platform_driver iproc_mdio_driver = {
|
|
.driver = {
|
|
.name = "iproc-mdio",
|
|
.of_match_table = iproc_mdio_of_match,
|
|
+#ifdef CONFIG_PM_SLEEP
|
|
+ .pm = &iproc_mdio_pm_ops,
|
|
+#endif
|
|
},
|
|
.probe = iproc_mdio_probe,
|
|
.remove = iproc_mdio_remove,
|
|
diff --git a/drivers/net/slip/slip.c b/drivers/net/slip/slip.c
|
|
index 2af09c3851a5..cc841126147e 100644
|
|
--- a/drivers/net/slip/slip.c
|
|
+++ b/drivers/net/slip/slip.c
|
|
@@ -868,7 +868,6 @@ err_free_chan:
|
|
tty->disc_data = NULL;
|
|
clear_bit(SLF_INUSE, &sl->flags);
|
|
sl_free_netdev(sl->dev);
|
|
- free_netdev(sl->dev);
|
|
|
|
err_exit:
|
|
rtnl_unlock();
|
|
diff --git a/drivers/net/tun.c b/drivers/net/tun.c
|
|
index 17be1f6a813f..44b16d945e33 100644
|
|
--- a/drivers/net/tun.c
|
|
+++ b/drivers/net/tun.c
|
|
@@ -1106,6 +1106,13 @@ static void tun_net_init(struct net_device *dev)
|
|
}
|
|
}
|
|
|
|
+static bool tun_sock_writeable(struct tun_struct *tun, struct tun_file *tfile)
|
|
+{
|
|
+ struct sock *sk = tfile->socket.sk;
|
|
+
|
|
+ return (tun->dev->flags & IFF_UP) && sock_writeable(sk);
|
|
+}
|
|
+
|
|
/* Character device part */
|
|
|
|
/* Poll */
|
|
@@ -1128,10 +1135,14 @@ static unsigned int tun_chr_poll(struct file *file, poll_table *wait)
|
|
if (!skb_array_empty(&tfile->tx_array))
|
|
mask |= POLLIN | POLLRDNORM;
|
|
|
|
- if (tun->dev->flags & IFF_UP &&
|
|
- (sock_writeable(sk) ||
|
|
- (!test_and_set_bit(SOCKWQ_ASYNC_NOSPACE, &sk->sk_socket->flags) &&
|
|
- sock_writeable(sk))))
|
|
+ /* Make sure SOCKWQ_ASYNC_NOSPACE is set if not writable to
|
|
+ * guarantee EPOLLOUT to be raised by either here or
|
|
+ * tun_sock_write_space(). Then process could get notification
|
|
+ * after it writes to a down device and meets -EIO.
|
|
+ */
|
|
+ if (tun_sock_writeable(tun, tfile) ||
|
|
+ (!test_and_set_bit(SOCKWQ_ASYNC_NOSPACE, &sk->sk_socket->flags) &&
|
|
+ tun_sock_writeable(tun, tfile)))
|
|
mask |= POLLOUT | POLLWRNORM;
|
|
|
|
if (tun->dev->reg_state != NETREG_REGISTERED)
|
|
diff --git a/drivers/net/usb/qmi_wwan.c b/drivers/net/usb/qmi_wwan.c
|
|
index de7b431fdd6b..97f6b8130db3 100644
|
|
--- a/drivers/net/usb/qmi_wwan.c
|
|
+++ b/drivers/net/usb/qmi_wwan.c
|
|
@@ -951,6 +951,7 @@ static const struct usb_device_id products[] = {
|
|
{QMI_FIXED_INTF(0x413c, 0x81b6, 8)}, /* Dell Wireless 5811e */
|
|
{QMI_FIXED_INTF(0x413c, 0x81b6, 10)}, /* Dell Wireless 5811e */
|
|
{QMI_FIXED_INTF(0x413c, 0x81d7, 0)}, /* Dell Wireless 5821e */
|
|
+ {QMI_FIXED_INTF(0x413c, 0x81d7, 1)}, /* Dell Wireless 5821e preproduction config */
|
|
{QMI_FIXED_INTF(0x413c, 0x81e0, 0)}, /* Dell Wireless 5821e with eSIM support*/
|
|
{QMI_FIXED_INTF(0x03f0, 0x4e1d, 8)}, /* HP lt4111 LTE/EV-DO/HSPA+ Gobi 4G Module */
|
|
{QMI_FIXED_INTF(0x03f0, 0x9d1d, 1)}, /* HP lt4120 Snapdragon X5 LTE */
|
|
diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
|
|
index a2ebe46bcfc5..395bbe2c0f98 100644
|
|
--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
|
|
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
|
|
@@ -898,9 +898,13 @@ int iwl_pcie_rx_init(struct iwl_trans *trans)
|
|
return err;
|
|
}
|
|
def_rxq = trans_pcie->rxq;
|
|
- if (!rba->alloc_wq)
|
|
+ if (!rba->alloc_wq) {
|
|
rba->alloc_wq = alloc_workqueue("rb_allocator",
|
|
WQ_HIGHPRI | WQ_UNBOUND, 1);
|
|
+ if (!rba->alloc_wq)
|
|
+ return -ENOMEM;
|
|
+ }
|
|
+
|
|
INIT_WORK(&rba->rx_alloc, iwl_pcie_rx_allocator_work);
|
|
|
|
cancel_work_sync(&rba->rx_alloc);
|
|
diff --git a/drivers/nfc/pn544/i2c.c b/drivers/nfc/pn544/i2c.c
|
|
index f837c39a8017..0f6905123b0a 100644
|
|
--- a/drivers/nfc/pn544/i2c.c
|
|
+++ b/drivers/nfc/pn544/i2c.c
|
|
@@ -240,6 +240,7 @@ static void pn544_hci_i2c_platform_init(struct pn544_i2c_phy *phy)
|
|
|
|
out:
|
|
gpio_set_value_cansleep(phy->gpio_en, !phy->en_polarity);
|
|
+ usleep_range(10000, 15000);
|
|
}
|
|
|
|
static void pn544_hci_i2c_enable_mode(struct pn544_i2c_phy *phy, int run_mode)
|
|
diff --git a/drivers/s390/cio/blacklist.c b/drivers/s390/cio/blacklist.c
|
|
index 9082476b51db..4e9f794176d3 100644
|
|
--- a/drivers/s390/cio/blacklist.c
|
|
+++ b/drivers/s390/cio/blacklist.c
|
|
@@ -302,8 +302,10 @@ static void *
|
|
cio_ignore_proc_seq_next(struct seq_file *s, void *it, loff_t *offset)
|
|
{
|
|
struct ccwdev_iter *iter;
|
|
+ loff_t p = *offset;
|
|
|
|
- if (*offset >= (__MAX_SUBCHANNEL + 1) * (__MAX_SSID + 1))
|
|
+ (*offset)++;
|
|
+ if (p >= (__MAX_SUBCHANNEL + 1) * (__MAX_SSID + 1))
|
|
return NULL;
|
|
iter = it;
|
|
if (iter->devno == __MAX_SUBCHANNEL) {
|
|
@@ -313,7 +315,6 @@ cio_ignore_proc_seq_next(struct seq_file *s, void *it, loff_t *offset)
|
|
return NULL;
|
|
} else
|
|
iter->devno++;
|
|
- (*offset)++;
|
|
return iter;
|
|
}
|
|
|
|
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
|
|
index e8819aa20415..c4e9eba36023 100644
|
|
--- a/drivers/tty/serial/8250/8250_core.c
|
|
+++ b/drivers/tty/serial/8250/8250_core.c
|
|
@@ -181,7 +181,7 @@ static int serial_link_irq_chain(struct uart_8250_port *up)
|
|
struct hlist_head *h;
|
|
struct hlist_node *n;
|
|
struct irq_info *i;
|
|
- int ret, irq_flags = up->port.flags & UPF_SHARE_IRQ ? IRQF_SHARED : 0;
|
|
+ int ret;
|
|
|
|
mutex_lock(&hash_mutex);
|
|
|
|
@@ -216,9 +216,8 @@ static int serial_link_irq_chain(struct uart_8250_port *up)
|
|
INIT_LIST_HEAD(&up->list);
|
|
i->head = &up->list;
|
|
spin_unlock_irq(&i->lock);
|
|
- irq_flags |= up->port.irqflags;
|
|
ret = request_irq(up->port.irq, serial8250_interrupt,
|
|
- irq_flags, "serial", i);
|
|
+ up->port.irqflags, "serial", i);
|
|
if (ret < 0)
|
|
serial_do_unlink(i, up);
|
|
}
|
|
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
|
|
index 8f1233324586..c7a7574172fa 100644
|
|
--- a/drivers/tty/serial/8250/8250_port.c
|
|
+++ b/drivers/tty/serial/8250/8250_port.c
|
|
@@ -2199,6 +2199,10 @@ int serial8250_do_startup(struct uart_port *port)
|
|
}
|
|
}
|
|
|
|
+ /* Check if we need to have shared IRQs */
|
|
+ if (port->irq && (up->port.flags & UPF_SHARE_IRQ))
|
|
+ up->port.irqflags |= IRQF_SHARED;
|
|
+
|
|
if (port->irq) {
|
|
unsigned char iir1;
|
|
/*
|
|
diff --git a/drivers/tty/serial/ar933x_uart.c b/drivers/tty/serial/ar933x_uart.c
|
|
index d4462512605b..246f4aab7407 100644
|
|
--- a/drivers/tty/serial/ar933x_uart.c
|
|
+++ b/drivers/tty/serial/ar933x_uart.c
|
|
@@ -289,6 +289,10 @@ static void ar933x_uart_set_termios(struct uart_port *port,
|
|
ar933x_uart_rmw_set(up, AR933X_UART_CS_REG,
|
|
AR933X_UART_CS_HOST_INT_EN);
|
|
|
|
+ /* enable RX and TX ready overide */
|
|
+ ar933x_uart_rmw_set(up, AR933X_UART_CS_REG,
|
|
+ AR933X_UART_CS_TX_READY_ORIDE | AR933X_UART_CS_RX_READY_ORIDE);
|
|
+
|
|
/* reenable the UART */
|
|
ar933x_uart_rmw(up, AR933X_UART_CS_REG,
|
|
AR933X_UART_CS_IF_MODE_M << AR933X_UART_CS_IF_MODE_S,
|
|
@@ -421,6 +425,10 @@ static int ar933x_uart_startup(struct uart_port *port)
|
|
ar933x_uart_rmw_set(up, AR933X_UART_CS_REG,
|
|
AR933X_UART_CS_HOST_INT_EN);
|
|
|
|
+ /* enable RX and TX ready overide */
|
|
+ ar933x_uart_rmw_set(up, AR933X_UART_CS_REG,
|
|
+ AR933X_UART_CS_TX_READY_ORIDE | AR933X_UART_CS_RX_READY_ORIDE);
|
|
+
|
|
/* Enable RX interrupts */
|
|
up->ier = AR933X_UART_INT_RX_VALID;
|
|
ar933x_uart_write(up, AR933X_UART_INT_EN_REG, up->ier);
|
|
diff --git a/drivers/tty/serial/mvebu-uart.c b/drivers/tty/serial/mvebu-uart.c
|
|
index 401c983ec5f3..a10e4aa9e18e 100644
|
|
--- a/drivers/tty/serial/mvebu-uart.c
|
|
+++ b/drivers/tty/serial/mvebu-uart.c
|
|
@@ -581,7 +581,7 @@ static int mvebu_uart_probe(struct platform_device *pdev)
|
|
|
|
port->membase = devm_ioremap_resource(&pdev->dev, reg);
|
|
if (IS_ERR(port->membase))
|
|
- return -PTR_ERR(port->membase);
|
|
+ return PTR_ERR(port->membase);
|
|
|
|
data = devm_kzalloc(&pdev->dev, sizeof(struct mvebu_uart_data),
|
|
GFP_KERNEL);
|
|
diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
|
|
index 53cbf4ebef10..b6ff01131eef 100644
|
|
--- a/drivers/tty/sysrq.c
|
|
+++ b/drivers/tty/sysrq.c
|
|
@@ -543,7 +543,6 @@ void __handle_sysrq(int key, bool check_mask)
|
|
*/
|
|
orig_log_level = console_loglevel;
|
|
console_loglevel = CONSOLE_LOGLEVEL_DEFAULT;
|
|
- pr_info("SysRq : ");
|
|
|
|
op_p = __sysrq_get_key_op(key);
|
|
if (op_p) {
|
|
@@ -552,14 +551,15 @@ void __handle_sysrq(int key, bool check_mask)
|
|
* should not) and is the invoked operation enabled?
|
|
*/
|
|
if (!check_mask || sysrq_on_mask(op_p->enable_mask)) {
|
|
- pr_cont("%s\n", op_p->action_msg);
|
|
+ pr_info("%s\n", op_p->action_msg);
|
|
console_loglevel = orig_log_level;
|
|
op_p->handler(key);
|
|
} else {
|
|
- pr_cont("This sysrq operation is disabled.\n");
|
|
+ pr_info("This sysrq operation is disabled.\n");
|
|
+ console_loglevel = orig_log_level;
|
|
}
|
|
} else {
|
|
- pr_cont("HELP : ");
|
|
+ pr_info("HELP : ");
|
|
/* Only print the help msg once per handler */
|
|
for (i = 0; i < ARRAY_SIZE(sysrq_key_table); i++) {
|
|
if (sysrq_key_table[i]) {
|
|
diff --git a/drivers/tty/vt/selection.c b/drivers/tty/vt/selection.c
|
|
index 6ac05021c4a7..1edc1a36db4a 100644
|
|
--- a/drivers/tty/vt/selection.c
|
|
+++ b/drivers/tty/vt/selection.c
|
|
@@ -13,6 +13,7 @@
|
|
#include <linux/tty.h>
|
|
#include <linux/sched.h>
|
|
#include <linux/mm.h>
|
|
+#include <linux/mutex.h>
|
|
#include <linux/slab.h>
|
|
#include <linux/types.h>
|
|
|
|
@@ -40,6 +41,7 @@ static volatile int sel_start = -1; /* cleared by clear_selection */
|
|
static int sel_end;
|
|
static int sel_buffer_lth;
|
|
static char *sel_buffer;
|
|
+static DEFINE_MUTEX(sel_lock);
|
|
|
|
/* clear_selection, highlight and highlight_pointer can be called
|
|
from interrupt (via scrollback/front) */
|
|
@@ -156,14 +158,14 @@ static int store_utf8(u16 c, char *p)
|
|
* The entire selection process is managed under the console_lock. It's
|
|
* a lot under the lock but its hardly a performance path
|
|
*/
|
|
-int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty)
|
|
+static int __set_selection(const struct tiocl_selection __user *sel, struct tty_struct *tty)
|
|
{
|
|
struct vc_data *vc = vc_cons[fg_console].d;
|
|
int sel_mode, new_sel_start, new_sel_end, spc;
|
|
char *bp, *obp;
|
|
int i, ps, pe, multiplier;
|
|
u16 c;
|
|
- int mode;
|
|
+ int mode, ret = 0;
|
|
|
|
poke_blanked_console();
|
|
|
|
@@ -324,7 +326,21 @@ int set_selection(const struct tiocl_selection __user *sel, struct tty_struct *t
|
|
}
|
|
}
|
|
sel_buffer_lth = bp - sel_buffer;
|
|
- return 0;
|
|
+
|
|
+ return ret;
|
|
+}
|
|
+
|
|
+int set_selection(const struct tiocl_selection __user *v, struct tty_struct *tty)
|
|
+{
|
|
+ int ret;
|
|
+
|
|
+ mutex_lock(&sel_lock);
|
|
+ console_lock();
|
|
+ ret = __set_selection(v, tty);
|
|
+ console_unlock();
|
|
+ mutex_unlock(&sel_lock);
|
|
+
|
|
+ return ret;
|
|
}
|
|
|
|
/* Insert the contents of the selection buffer into the
|
|
@@ -353,6 +369,7 @@ int paste_selection(struct tty_struct *tty)
|
|
tty_buffer_lock_exclusive(&vc->port);
|
|
|
|
add_wait_queue(&vc->paste_wait, &wait);
|
|
+ mutex_lock(&sel_lock);
|
|
while (sel_buffer && sel_buffer_lth > pasted) {
|
|
set_current_state(TASK_INTERRUPTIBLE);
|
|
if (signal_pending(current)) {
|
|
@@ -360,7 +377,9 @@ int paste_selection(struct tty_struct *tty)
|
|
break;
|
|
}
|
|
if (tty_throttled(tty)) {
|
|
+ mutex_unlock(&sel_lock);
|
|
schedule();
|
|
+ mutex_lock(&sel_lock);
|
|
continue;
|
|
}
|
|
__set_current_state(TASK_RUNNING);
|
|
@@ -369,6 +388,7 @@ int paste_selection(struct tty_struct *tty)
|
|
count);
|
|
pasted += count;
|
|
}
|
|
+ mutex_unlock(&sel_lock);
|
|
remove_wait_queue(&vc->paste_wait, &wait);
|
|
__set_current_state(TASK_RUNNING);
|
|
|
|
diff --git a/drivers/tty/vt/vt.c b/drivers/tty/vt/vt.c
|
|
index 232cb0a760b9..c1d3b685a587 100644
|
|
--- a/drivers/tty/vt/vt.c
|
|
+++ b/drivers/tty/vt/vt.c
|
|
@@ -2690,9 +2690,7 @@ int tioclinux(struct tty_struct *tty, unsigned long arg)
|
|
switch (type)
|
|
{
|
|
case TIOCL_SETSEL:
|
|
- console_lock();
|
|
ret = set_selection((struct tiocl_selection __user *)(p+1), tty);
|
|
- console_unlock();
|
|
break;
|
|
case TIOCL_PASTESEL:
|
|
ret = paste_selection(tty);
|
|
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
|
|
index 3fcc3e74ae2e..c958cf42a1bb 100644
|
|
--- a/drivers/usb/core/hub.c
|
|
+++ b/drivers/usb/core/hub.c
|
|
@@ -954,13 +954,17 @@ int usb_remove_device(struct usb_device *udev)
|
|
{
|
|
struct usb_hub *hub;
|
|
struct usb_interface *intf;
|
|
+ int ret;
|
|
|
|
if (!udev->parent) /* Can't remove a root hub */
|
|
return -EINVAL;
|
|
hub = usb_hub_to_struct_hub(udev->parent);
|
|
intf = to_usb_interface(hub->intfdev);
|
|
|
|
- usb_autopm_get_interface(intf);
|
|
+ ret = usb_autopm_get_interface(intf);
|
|
+ if (ret < 0)
|
|
+ return ret;
|
|
+
|
|
set_bit(udev->portnum, hub->removed_bits);
|
|
hub_port_logical_disconnect(hub, udev->portnum);
|
|
usb_autopm_put_interface(intf);
|
|
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
|
|
index 460c855be0d0..53c1f6e604b1 100644
|
|
--- a/drivers/usb/core/port.c
|
|
+++ b/drivers/usb/core/port.c
|
|
@@ -179,7 +179,10 @@ static int usb_port_runtime_resume(struct device *dev)
|
|
if (!port_dev->is_superspeed && peer)
|
|
pm_runtime_get_sync(&peer->dev);
|
|
|
|
- usb_autopm_get_interface(intf);
|
|
+ retval = usb_autopm_get_interface(intf);
|
|
+ if (retval < 0)
|
|
+ return retval;
|
|
+
|
|
retval = usb_hub_set_port_power(hdev, hub, port1, true);
|
|
msleep(hub_power_on_good_delay(hub));
|
|
if (udev && !retval) {
|
|
@@ -232,7 +235,10 @@ static int usb_port_runtime_suspend(struct device *dev)
|
|
if (usb_port_block_power_off)
|
|
return -EBUSY;
|
|
|
|
- usb_autopm_get_interface(intf);
|
|
+ retval = usb_autopm_get_interface(intf);
|
|
+ if (retval < 0)
|
|
+ return retval;
|
|
+
|
|
retval = usb_hub_set_port_power(hdev, hub, port1, false);
|
|
usb_clear_port_feature(hdev, port1, USB_PORT_FEAT_C_CONNECTION);
|
|
if (!port_dev->is_superspeed)
|
|
diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c
|
|
index ad8307140df8..64c03e871f2d 100644
|
|
--- a/drivers/usb/core/quirks.c
|
|
+++ b/drivers/usb/core/quirks.c
|
|
@@ -86,6 +86,9 @@ static const struct usb_device_id usb_quirk_list[] = {
|
|
/* Logitech PTZ Pro Camera */
|
|
{ USB_DEVICE(0x046d, 0x0853), .driver_info = USB_QUIRK_DELAY_INIT },
|
|
|
|
+ /* Logitech Screen Share */
|
|
+ { USB_DEVICE(0x046d, 0x086c), .driver_info = USB_QUIRK_NO_LPM },
|
|
+
|
|
/* Logitech Quickcam Fusion */
|
|
{ USB_DEVICE(0x046d, 0x08c1), .driver_info = USB_QUIRK_RESET_RESUME },
|
|
|
|
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
|
|
index 4d7df2f6caf5..3a0452ff1a56 100644
|
|
--- a/drivers/usb/gadget/composite.c
|
|
+++ b/drivers/usb/gadget/composite.c
|
|
@@ -438,9 +438,13 @@ static u8 encode_bMaxPower(enum usb_device_speed speed,
|
|
if (!val)
|
|
return 0;
|
|
if (speed < USB_SPEED_SUPER)
|
|
- return DIV_ROUND_UP(val, 2);
|
|
+ return min(val, 500U) / 2;
|
|
else
|
|
- return DIV_ROUND_UP(val, 8);
|
|
+ /*
|
|
+ * USB 3.x supports up to 900mA, but since 900 isn't divisible
|
|
+ * by 8 the integral division will effectively cap to 896mA.
|
|
+ */
|
|
+ return min(val, 900U) / 8;
|
|
}
|
|
|
|
static int config_buf(struct usb_configuration *config,
|
|
@@ -833,6 +837,10 @@ static int set_config(struct usb_composite_dev *cdev,
|
|
|
|
/* when we return, be sure our power usage is valid */
|
|
power = c->MaxPower ? c->MaxPower : CONFIG_USB_GADGET_VBUS_DRAW;
|
|
+ if (gadget->speed < USB_SPEED_SUPER)
|
|
+ power = min(power, 500U);
|
|
+ else
|
|
+ power = min(power, 900U);
|
|
done:
|
|
usb_gadget_vbus_draw(gadget, power);
|
|
if (result >= 0 && cdev->delayed_status)
|
|
@@ -2272,7 +2280,7 @@ void composite_resume(struct usb_gadget *gadget)
|
|
{
|
|
struct usb_composite_dev *cdev = get_gadget_data(gadget);
|
|
struct usb_function *f;
|
|
- u16 maxpower;
|
|
+ unsigned maxpower;
|
|
|
|
/* REVISIT: should we have config level
|
|
* suspend/resume callbacks?
|
|
@@ -2286,10 +2294,14 @@ void composite_resume(struct usb_gadget *gadget)
|
|
f->resume(f);
|
|
}
|
|
|
|
- maxpower = cdev->config->MaxPower;
|
|
+ maxpower = cdev->config->MaxPower ?
|
|
+ cdev->config->MaxPower : CONFIG_USB_GADGET_VBUS_DRAW;
|
|
+ if (gadget->speed < USB_SPEED_SUPER)
|
|
+ maxpower = min(maxpower, 500U);
|
|
+ else
|
|
+ maxpower = min(maxpower, 900U);
|
|
|
|
- usb_gadget_vbus_draw(gadget, maxpower ?
|
|
- maxpower : CONFIG_USB_GADGET_VBUS_DRAW);
|
|
+ usb_gadget_vbus_draw(gadget, maxpower);
|
|
}
|
|
|
|
cdev->suspended = 0;
|
|
diff --git a/drivers/usb/gadget/function/f_fs.c b/drivers/usb/gadget/function/f_fs.c
|
|
index d1278d2d544b..b5747f1270a6 100644
|
|
--- a/drivers/usb/gadget/function/f_fs.c
|
|
+++ b/drivers/usb/gadget/function/f_fs.c
|
|
@@ -1077,18 +1077,19 @@ static int ffs_aio_cancel(struct kiocb *kiocb)
|
|
{
|
|
struct ffs_io_data *io_data = kiocb->private;
|
|
struct ffs_epfile *epfile = kiocb->ki_filp->private_data;
|
|
+ unsigned long flags;
|
|
int value;
|
|
|
|
ENTER();
|
|
|
|
- spin_lock_irq(&epfile->ffs->eps_lock);
|
|
+ spin_lock_irqsave(&epfile->ffs->eps_lock, flags);
|
|
|
|
if (likely(io_data && io_data->ep && io_data->req))
|
|
value = usb_ep_dequeue(io_data->ep, io_data->req);
|
|
else
|
|
value = -EINVAL;
|
|
|
|
- spin_unlock_irq(&epfile->ffs->eps_lock);
|
|
+ spin_unlock_irqrestore(&epfile->ffs->eps_lock, flags);
|
|
|
|
return value;
|
|
}
|
|
diff --git a/drivers/usb/gadget/function/u_serial.c b/drivers/usb/gadget/function/u_serial.c
|
|
index 510a54f88963..5d7d0f2e80a5 100644
|
|
--- a/drivers/usb/gadget/function/u_serial.c
|
|
+++ b/drivers/usb/gadget/function/u_serial.c
|
|
@@ -715,8 +715,10 @@ static int gs_start_io(struct gs_port *port)
|
|
port->n_read = 0;
|
|
started = gs_start_rx(port);
|
|
|
|
- /* unblock any pending writes into our circular buffer */
|
|
if (started) {
|
|
+ gs_start_tx(port);
|
|
+ /* Unblock any pending writes into our circular buffer, in case
|
|
+ * we didn't in gs_start_tx() */
|
|
tty_wakeup(port->port.tty);
|
|
} else {
|
|
gs_free_requests(ep, head, &port->read_allocated);
|
|
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h
|
|
index 3ebf6307217c..a52ae34fb1c3 100644
|
|
--- a/drivers/usb/storage/unusual_devs.h
|
|
+++ b/drivers/usb/storage/unusual_devs.h
|
|
@@ -1277,6 +1277,12 @@ UNUSUAL_DEV( 0x090a, 0x1200, 0x0000, 0x9999,
|
|
USB_SC_RBC, USB_PR_BULK, NULL,
|
|
0 ),
|
|
|
|
+UNUSUAL_DEV(0x090c, 0x1000, 0x1100, 0x1100,
|
|
+ "Samsung",
|
|
+ "Flash Drive FIT",
|
|
+ USB_SC_DEVICE, USB_PR_DEVICE, NULL,
|
|
+ US_FL_MAX_SECTORS_64),
|
|
+
|
|
/* aeb */
|
|
UNUSUAL_DEV( 0x090c, 0x1132, 0x0000, 0xffff,
|
|
"Feiya",
|
|
diff --git a/drivers/vhost/net.c b/drivers/vhost/net.c
|
|
index dd8798bf88e7..861f43f8f9ce 100644
|
|
--- a/drivers/vhost/net.c
|
|
+++ b/drivers/vhost/net.c
|
|
@@ -914,11 +914,7 @@ static int vhost_net_release(struct inode *inode, struct file *f)
|
|
|
|
static struct socket *get_raw_socket(int fd)
|
|
{
|
|
- struct {
|
|
- struct sockaddr_ll sa;
|
|
- char buf[MAX_ADDR_LEN];
|
|
- } uaddr;
|
|
- int uaddr_len = sizeof uaddr, r;
|
|
+ int r;
|
|
struct socket *sock = sockfd_lookup(fd, &r);
|
|
|
|
if (!sock)
|
|
@@ -930,12 +926,7 @@ static struct socket *get_raw_socket(int fd)
|
|
goto err;
|
|
}
|
|
|
|
- r = sock->ops->getname(sock, (struct sockaddr *)&uaddr.sa,
|
|
- &uaddr_len, 0);
|
|
- if (r)
|
|
- goto err;
|
|
-
|
|
- if (uaddr.sa.sll_family != AF_PACKET) {
|
|
+ if (sock->sk->sk_family != AF_PACKET) {
|
|
r = -EPFNOSUPPORT;
|
|
goto err;
|
|
}
|
|
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
|
|
index dda1c4b3a229..42c0a26646f6 100644
|
|
--- a/drivers/video/console/vgacon.c
|
|
+++ b/drivers/video/console/vgacon.c
|
|
@@ -1323,6 +1323,9 @@ static int vgacon_font_get(struct vc_data *c, struct console_font *font)
|
|
static int vgacon_resize(struct vc_data *c, unsigned int width,
|
|
unsigned int height, unsigned int user)
|
|
{
|
|
+ if ((width << 1) * height > vga_vram_size)
|
|
+ return -EINVAL;
|
|
+
|
|
if (width % 2 || width > screen_info.orig_video_cols ||
|
|
height > (screen_info.orig_video_lines * vga_default_font_height)/
|
|
c->vc_font.height)
|
|
diff --git a/drivers/watchdog/da9062_wdt.c b/drivers/watchdog/da9062_wdt.c
|
|
index 7386111220d5..daeb645fcea8 100644
|
|
--- a/drivers/watchdog/da9062_wdt.c
|
|
+++ b/drivers/watchdog/da9062_wdt.c
|
|
@@ -126,13 +126,6 @@ static int da9062_wdt_stop(struct watchdog_device *wdd)
|
|
struct da9062_watchdog *wdt = watchdog_get_drvdata(wdd);
|
|
int ret;
|
|
|
|
- ret = da9062_reset_watchdog_timer(wdt);
|
|
- if (ret) {
|
|
- dev_err(wdt->hw->dev, "Failed to ping the watchdog (err = %d)\n",
|
|
- ret);
|
|
- return ret;
|
|
- }
|
|
-
|
|
ret = regmap_update_bits(wdt->hw->regmap,
|
|
DA9062AA_CONTROL_D,
|
|
DA9062AA_TWDSCALE_MASK,
|
|
diff --git a/drivers/watchdog/wdat_wdt.c b/drivers/watchdog/wdat_wdt.c
|
|
index 0da9943d405f..c310e841561c 100644
|
|
--- a/drivers/watchdog/wdat_wdt.c
|
|
+++ b/drivers/watchdog/wdat_wdt.c
|
|
@@ -392,7 +392,7 @@ static int wdat_wdt_probe(struct platform_device *pdev)
|
|
|
|
memset(&r, 0, sizeof(r));
|
|
r.start = gas->address;
|
|
- r.end = r.start + gas->access_width - 1;
|
|
+ r.end = r.start + ACPI_ACCESS_BYTE_WIDTH(gas->access_width) - 1;
|
|
if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_MEMORY) {
|
|
r.flags = IORESOURCE_MEM;
|
|
} else if (gas->space_id == ACPI_ADR_SPACE_SYSTEM_IO) {
|
|
diff --git a/fs/cifs/cifsacl.c b/fs/cifs/cifsacl.c
|
|
index 15bac390dff9..10aedc2a4c2d 100644
|
|
--- a/fs/cifs/cifsacl.c
|
|
+++ b/fs/cifs/cifsacl.c
|
|
@@ -603,7 +603,7 @@ static void access_flags_to_mode(__le32 ace_flags, int type, umode_t *pmode,
|
|
((flags & FILE_EXEC_RIGHTS) == FILE_EXEC_RIGHTS))
|
|
*pmode |= (S_IXUGO & (*pbits_to_set));
|
|
|
|
- cifs_dbg(NOISY, "access flags 0x%x mode now 0x%x\n", flags, *pmode);
|
|
+ cifs_dbg(NOISY, "access flags 0x%x mode now %04o\n", flags, *pmode);
|
|
return;
|
|
}
|
|
|
|
@@ -632,7 +632,7 @@ static void mode_to_access_flags(umode_t mode, umode_t bits_to_use,
|
|
if (mode & S_IXUGO)
|
|
*pace_flags |= SET_FILE_EXEC_RIGHTS;
|
|
|
|
- cifs_dbg(NOISY, "mode: 0x%x, access flags now 0x%x\n",
|
|
+ cifs_dbg(NOISY, "mode: %04o, access flags now 0x%x\n",
|
|
mode, *pace_flags);
|
|
return;
|
|
}
|
|
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
|
|
index 961fcb40183a..f2707ff795d4 100644
|
|
--- a/fs/cifs/connect.c
|
|
+++ b/fs/cifs/connect.c
|
|
@@ -3401,7 +3401,7 @@ int cifs_setup_cifs_sb(struct smb_vol *pvolume_info,
|
|
cifs_sb->mnt_gid = pvolume_info->linux_gid;
|
|
cifs_sb->mnt_file_mode = pvolume_info->file_mode;
|
|
cifs_sb->mnt_dir_mode = pvolume_info->dir_mode;
|
|
- cifs_dbg(FYI, "file mode: 0x%hx dir mode: 0x%hx\n",
|
|
+ cifs_dbg(FYI, "file mode: %04ho dir mode: %04ho\n",
|
|
cifs_sb->mnt_file_mode, cifs_sb->mnt_dir_mode);
|
|
|
|
cifs_sb->actimeo = pvolume_info->actimeo;
|
|
diff --git a/fs/cifs/inode.c b/fs/cifs/inode.c
|
|
index b1c0961e6b3f..dfa85ad5b481 100644
|
|
--- a/fs/cifs/inode.c
|
|
+++ b/fs/cifs/inode.c
|
|
@@ -1573,7 +1573,7 @@ int cifs_mkdir(struct inode *inode, struct dentry *direntry, umode_t mode)
|
|
struct TCP_Server_Info *server;
|
|
char *full_path;
|
|
|
|
- cifs_dbg(FYI, "In cifs_mkdir, mode = 0x%hx inode = 0x%p\n",
|
|
+ cifs_dbg(FYI, "In cifs_mkdir, mode = %04ho inode = 0x%p\n",
|
|
mode, inode);
|
|
|
|
cifs_sb = CIFS_SB(inode->i_sb);
|
|
@@ -1990,6 +1990,7 @@ int cifs_revalidate_dentry_attr(struct dentry *dentry)
|
|
struct inode *inode = d_inode(dentry);
|
|
struct super_block *sb = dentry->d_sb;
|
|
char *full_path = NULL;
|
|
+ int count = 0;
|
|
|
|
if (inode == NULL)
|
|
return -ENOENT;
|
|
@@ -2011,15 +2012,18 @@ int cifs_revalidate_dentry_attr(struct dentry *dentry)
|
|
full_path, inode, inode->i_count.counter,
|
|
dentry, cifs_get_time(dentry), jiffies);
|
|
|
|
+again:
|
|
if (cifs_sb_master_tcon(CIFS_SB(sb))->unix_ext)
|
|
rc = cifs_get_inode_info_unix(&inode, full_path, sb, xid);
|
|
else
|
|
rc = cifs_get_inode_info(&inode, full_path, NULL, sb,
|
|
xid, NULL);
|
|
-
|
|
+ if (rc == -EAGAIN && count++ < 10)
|
|
+ goto again;
|
|
out:
|
|
kfree(full_path);
|
|
free_xid(xid);
|
|
+
|
|
return rc;
|
|
}
|
|
|
|
diff --git a/fs/ecryptfs/keystore.c b/fs/ecryptfs/keystore.c
|
|
index 3f3ec50bf773..b134315fb69d 100644
|
|
--- a/fs/ecryptfs/keystore.c
|
|
+++ b/fs/ecryptfs/keystore.c
|
|
@@ -1285,7 +1285,7 @@ parse_tag_1_packet(struct ecryptfs_crypt_stat *crypt_stat,
|
|
printk(KERN_ERR "Enter w/ first byte != 0x%.2x\n",
|
|
ECRYPTFS_TAG_1_PACKET_TYPE);
|
|
rc = -EINVAL;
|
|
- goto out_free;
|
|
+ goto out;
|
|
}
|
|
/* Released: wipe_auth_tok_list called in ecryptfs_parse_packet_set or
|
|
* at end of function upon failure */
|
|
@@ -1335,7 +1335,7 @@ parse_tag_1_packet(struct ecryptfs_crypt_stat *crypt_stat,
|
|
printk(KERN_WARNING "Tag 1 packet contains key larger "
|
|
"than ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES");
|
|
rc = -EINVAL;
|
|
- goto out;
|
|
+ goto out_free;
|
|
}
|
|
memcpy((*new_auth_tok)->session_key.encrypted_key,
|
|
&data[(*packet_size)], (body_size - (ECRYPTFS_SIG_SIZE + 2)));
|
|
diff --git a/fs/ext4/balloc.c b/fs/ext4/balloc.c
|
|
index 2455fe1446d6..de601f3c023d 100644
|
|
--- a/fs/ext4/balloc.c
|
|
+++ b/fs/ext4/balloc.c
|
|
@@ -279,6 +279,7 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block *sb,
|
|
ext4_group_t ngroups = ext4_get_groups_count(sb);
|
|
struct ext4_group_desc *desc;
|
|
struct ext4_sb_info *sbi = EXT4_SB(sb);
|
|
+ struct buffer_head *bh_p;
|
|
|
|
if (block_group >= ngroups) {
|
|
ext4_error(sb, "block_group >= groups_count - block_group = %u,"
|
|
@@ -289,7 +290,14 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block *sb,
|
|
|
|
group_desc = block_group >> EXT4_DESC_PER_BLOCK_BITS(sb);
|
|
offset = block_group & (EXT4_DESC_PER_BLOCK(sb) - 1);
|
|
- if (!sbi->s_group_desc[group_desc]) {
|
|
+ bh_p = sbi_array_rcu_deref(sbi, s_group_desc, group_desc);
|
|
+ /*
|
|
+ * sbi_array_rcu_deref returns with rcu unlocked, this is ok since
|
|
+ * the pointer being dereferenced won't be dereferenced again. By
|
|
+ * looking at the usage in add_new_gdb() the value isn't modified,
|
|
+ * just the pointer, and so it remains valid.
|
|
+ */
|
|
+ if (!bh_p) {
|
|
ext4_error(sb, "Group descriptor not loaded - "
|
|
"block_group = %u, group_desc = %u, desc = %u",
|
|
block_group, group_desc, offset);
|
|
@@ -297,10 +305,10 @@ struct ext4_group_desc * ext4_get_group_desc(struct super_block *sb,
|
|
}
|
|
|
|
desc = (struct ext4_group_desc *)(
|
|
- (__u8 *)sbi->s_group_desc[group_desc]->b_data +
|
|
+ (__u8 *)bh_p->b_data +
|
|
offset * EXT4_DESC_SIZE(sb));
|
|
if (bh)
|
|
- *bh = sbi->s_group_desc[group_desc];
|
|
+ *bh = bh_p;
|
|
return desc;
|
|
}
|
|
|
|
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
|
|
index 9713d3d41412..eb0ec5068423 100644
|
|
--- a/fs/ext4/ext4.h
|
|
+++ b/fs/ext4/ext4.h
|
|
@@ -1367,7 +1367,7 @@ struct ext4_sb_info {
|
|
loff_t s_bitmap_maxbytes; /* max bytes for bitmap files */
|
|
struct buffer_head * s_sbh; /* Buffer containing the super block */
|
|
struct ext4_super_block *s_es; /* Pointer to the super block in the buffer */
|
|
- struct buffer_head **s_group_desc;
|
|
+ struct buffer_head * __rcu *s_group_desc;
|
|
unsigned int s_mount_opt;
|
|
unsigned int s_mount_opt2;
|
|
unsigned int s_mount_flags;
|
|
@@ -1427,7 +1427,7 @@ struct ext4_sb_info {
|
|
#endif
|
|
|
|
/* for buddy allocator */
|
|
- struct ext4_group_info ***s_group_info;
|
|
+ struct ext4_group_info ** __rcu *s_group_info;
|
|
struct inode *s_buddy_cache;
|
|
spinlock_t s_md_lock;
|
|
unsigned short *s_mb_offsets;
|
|
@@ -1475,7 +1475,7 @@ struct ext4_sb_info {
|
|
unsigned int s_extent_max_zeroout_kb;
|
|
|
|
unsigned int s_log_groups_per_flex;
|
|
- struct flex_groups *s_flex_groups;
|
|
+ struct flex_groups * __rcu *s_flex_groups;
|
|
ext4_group_t s_flex_groups_allocated;
|
|
|
|
/* workqueue for reserved extent conversions (buffered io) */
|
|
@@ -1549,6 +1549,23 @@ static inline int ext4_valid_inum(struct super_block *sb, unsigned long ino)
|
|
ino <= le32_to_cpu(EXT4_SB(sb)->s_es->s_inodes_count));
|
|
}
|
|
|
|
+/*
|
|
+ * Returns: sbi->field[index]
|
|
+ * Used to access an array element from the following sbi fields which require
|
|
+ * rcu protection to avoid dereferencing an invalid pointer due to reassignment
|
|
+ * - s_group_desc
|
|
+ * - s_group_info
|
|
+ * - s_flex_group
|
|
+ */
|
|
+#define sbi_array_rcu_deref(sbi, field, index) \
|
|
+({ \
|
|
+ typeof(*((sbi)->field)) _v; \
|
|
+ rcu_read_lock(); \
|
|
+ _v = ((typeof(_v)*)rcu_dereference((sbi)->field))[index]; \
|
|
+ rcu_read_unlock(); \
|
|
+ _v; \
|
|
+})
|
|
+
|
|
/*
|
|
* Inode dynamic state flags
|
|
*/
|
|
@@ -2558,6 +2575,7 @@ extern int ext4_generic_delete_entry(handle_t *handle,
|
|
extern bool ext4_empty_dir(struct inode *inode);
|
|
|
|
/* resize.c */
|
|
+extern void ext4_kvfree_array_rcu(void *to_free);
|
|
extern int ext4_group_add(struct super_block *sb,
|
|
struct ext4_new_group_data *input);
|
|
extern int ext4_group_extend(struct super_block *sb,
|
|
@@ -2798,13 +2816,13 @@ static inline
|
|
struct ext4_group_info *ext4_get_group_info(struct super_block *sb,
|
|
ext4_group_t group)
|
|
{
|
|
- struct ext4_group_info ***grp_info;
|
|
+ struct ext4_group_info **grp_info;
|
|
long indexv, indexh;
|
|
BUG_ON(group >= EXT4_SB(sb)->s_groups_count);
|
|
- grp_info = EXT4_SB(sb)->s_group_info;
|
|
indexv = group >> (EXT4_DESC_PER_BLOCK_BITS(sb));
|
|
indexh = group & ((EXT4_DESC_PER_BLOCK(sb)) - 1);
|
|
- return grp_info[indexv][indexh];
|
|
+ grp_info = sbi_array_rcu_deref(EXT4_SB(sb), s_group_info, indexv);
|
|
+ return grp_info[indexh];
|
|
}
|
|
|
|
/*
|
|
diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c
|
|
index 4f78e099de1d..c5af7bbf906f 100644
|
|
--- a/fs/ext4/ialloc.c
|
|
+++ b/fs/ext4/ialloc.c
|
|
@@ -331,11 +331,13 @@ void ext4_free_inode(handle_t *handle, struct inode *inode)
|
|
|
|
percpu_counter_inc(&sbi->s_freeinodes_counter);
|
|
if (sbi->s_log_groups_per_flex) {
|
|
- ext4_group_t f = ext4_flex_group(sbi, block_group);
|
|
+ struct flex_groups *fg;
|
|
|
|
- atomic_inc(&sbi->s_flex_groups[f].free_inodes);
|
|
+ fg = sbi_array_rcu_deref(sbi, s_flex_groups,
|
|
+ ext4_flex_group(sbi, block_group));
|
|
+ atomic_inc(&fg->free_inodes);
|
|
if (is_directory)
|
|
- atomic_dec(&sbi->s_flex_groups[f].used_dirs);
|
|
+ atomic_dec(&fg->used_dirs);
|
|
}
|
|
BUFFER_TRACE(bh2, "call ext4_handle_dirty_metadata");
|
|
fatal = ext4_handle_dirty_metadata(handle, NULL, bh2);
|
|
@@ -376,12 +378,13 @@ static void get_orlov_stats(struct super_block *sb, ext4_group_t g,
|
|
int flex_size, struct orlov_stats *stats)
|
|
{
|
|
struct ext4_group_desc *desc;
|
|
- struct flex_groups *flex_group = EXT4_SB(sb)->s_flex_groups;
|
|
|
|
if (flex_size > 1) {
|
|
- stats->free_inodes = atomic_read(&flex_group[g].free_inodes);
|
|
- stats->free_clusters = atomic64_read(&flex_group[g].free_clusters);
|
|
- stats->used_dirs = atomic_read(&flex_group[g].used_dirs);
|
|
+ struct flex_groups *fg = sbi_array_rcu_deref(EXT4_SB(sb),
|
|
+ s_flex_groups, g);
|
|
+ stats->free_inodes = atomic_read(&fg->free_inodes);
|
|
+ stats->free_clusters = atomic64_read(&fg->free_clusters);
|
|
+ stats->used_dirs = atomic_read(&fg->used_dirs);
|
|
return;
|
|
}
|
|
|
|
@@ -988,7 +991,8 @@ got:
|
|
if (sbi->s_log_groups_per_flex) {
|
|
ext4_group_t f = ext4_flex_group(sbi, group);
|
|
|
|
- atomic_inc(&sbi->s_flex_groups[f].used_dirs);
|
|
+ atomic_inc(&sbi_array_rcu_deref(sbi, s_flex_groups,
|
|
+ f)->used_dirs);
|
|
}
|
|
}
|
|
if (ext4_has_group_desc_csum(sb)) {
|
|
@@ -1011,7 +1015,8 @@ got:
|
|
|
|
if (sbi->s_log_groups_per_flex) {
|
|
flex_group = ext4_flex_group(sbi, group);
|
|
- atomic_dec(&sbi->s_flex_groups[flex_group].free_inodes);
|
|
+ atomic_dec(&sbi_array_rcu_deref(sbi, s_flex_groups,
|
|
+ flex_group)->free_inodes);
|
|
}
|
|
|
|
inode->i_ino = ino + group * EXT4_INODES_PER_GROUP(sb);
|
|
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
|
|
index a49d0e5d7baf..c18668e3135e 100644
|
|
--- a/fs/ext4/mballoc.c
|
|
+++ b/fs/ext4/mballoc.c
|
|
@@ -2377,7 +2377,7 @@ int ext4_mb_alloc_groupinfo(struct super_block *sb, ext4_group_t ngroups)
|
|
{
|
|
struct ext4_sb_info *sbi = EXT4_SB(sb);
|
|
unsigned size;
|
|
- struct ext4_group_info ***new_groupinfo;
|
|
+ struct ext4_group_info ***old_groupinfo, ***new_groupinfo;
|
|
|
|
size = (ngroups + EXT4_DESC_PER_BLOCK(sb) - 1) >>
|
|
EXT4_DESC_PER_BLOCK_BITS(sb);
|
|
@@ -2390,13 +2390,16 @@ int ext4_mb_alloc_groupinfo(struct super_block *sb, ext4_group_t ngroups)
|
|
ext4_msg(sb, KERN_ERR, "can't allocate buddy meta group");
|
|
return -ENOMEM;
|
|
}
|
|
- if (sbi->s_group_info) {
|
|
- memcpy(new_groupinfo, sbi->s_group_info,
|
|
+ rcu_read_lock();
|
|
+ old_groupinfo = rcu_dereference(sbi->s_group_info);
|
|
+ if (old_groupinfo)
|
|
+ memcpy(new_groupinfo, old_groupinfo,
|
|
sbi->s_group_info_size * sizeof(*sbi->s_group_info));
|
|
- kvfree(sbi->s_group_info);
|
|
- }
|
|
- sbi->s_group_info = new_groupinfo;
|
|
+ rcu_read_unlock();
|
|
+ rcu_assign_pointer(sbi->s_group_info, new_groupinfo);
|
|
sbi->s_group_info_size = size / sizeof(*sbi->s_group_info);
|
|
+ if (old_groupinfo)
|
|
+ ext4_kvfree_array_rcu(old_groupinfo);
|
|
ext4_debug("allocated s_groupinfo array for %d meta_bg's\n",
|
|
sbi->s_group_info_size);
|
|
return 0;
|
|
@@ -2408,6 +2411,7 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
|
|
{
|
|
int i;
|
|
int metalen = 0;
|
|
+ int idx = group >> EXT4_DESC_PER_BLOCK_BITS(sb);
|
|
struct ext4_sb_info *sbi = EXT4_SB(sb);
|
|
struct ext4_group_info **meta_group_info;
|
|
struct kmem_cache *cachep = get_groupinfo_cache(sb->s_blocksize_bits);
|
|
@@ -2426,12 +2430,12 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
|
|
"for a buddy group");
|
|
goto exit_meta_group_info;
|
|
}
|
|
- sbi->s_group_info[group >> EXT4_DESC_PER_BLOCK_BITS(sb)] =
|
|
- meta_group_info;
|
|
+ rcu_read_lock();
|
|
+ rcu_dereference(sbi->s_group_info)[idx] = meta_group_info;
|
|
+ rcu_read_unlock();
|
|
}
|
|
|
|
- meta_group_info =
|
|
- sbi->s_group_info[group >> EXT4_DESC_PER_BLOCK_BITS(sb)];
|
|
+ meta_group_info = sbi_array_rcu_deref(sbi, s_group_info, idx);
|
|
i = group & (EXT4_DESC_PER_BLOCK(sb) - 1);
|
|
|
|
meta_group_info[i] = kmem_cache_zalloc(cachep, GFP_NOFS);
|
|
@@ -2479,8 +2483,13 @@ int ext4_mb_add_groupinfo(struct super_block *sb, ext4_group_t group,
|
|
exit_group_info:
|
|
/* If a meta_group_info table has been allocated, release it now */
|
|
if (group % EXT4_DESC_PER_BLOCK(sb) == 0) {
|
|
- kfree(sbi->s_group_info[group >> EXT4_DESC_PER_BLOCK_BITS(sb)]);
|
|
- sbi->s_group_info[group >> EXT4_DESC_PER_BLOCK_BITS(sb)] = NULL;
|
|
+ struct ext4_group_info ***group_info;
|
|
+
|
|
+ rcu_read_lock();
|
|
+ group_info = rcu_dereference(sbi->s_group_info);
|
|
+ kfree(group_info[idx]);
|
|
+ group_info[idx] = NULL;
|
|
+ rcu_read_unlock();
|
|
}
|
|
exit_meta_group_info:
|
|
return -ENOMEM;
|
|
@@ -2493,6 +2502,7 @@ static int ext4_mb_init_backend(struct super_block *sb)
|
|
struct ext4_sb_info *sbi = EXT4_SB(sb);
|
|
int err;
|
|
struct ext4_group_desc *desc;
|
|
+ struct ext4_group_info ***group_info;
|
|
struct kmem_cache *cachep;
|
|
|
|
err = ext4_mb_alloc_groupinfo(sb, ngroups);
|
|
@@ -2527,11 +2537,16 @@ err_freebuddy:
|
|
while (i-- > 0)
|
|
kmem_cache_free(cachep, ext4_get_group_info(sb, i));
|
|
i = sbi->s_group_info_size;
|
|
+ rcu_read_lock();
|
|
+ group_info = rcu_dereference(sbi->s_group_info);
|
|
while (i-- > 0)
|
|
- kfree(sbi->s_group_info[i]);
|
|
+ kfree(group_info[i]);
|
|
+ rcu_read_unlock();
|
|
iput(sbi->s_buddy_cache);
|
|
err_freesgi:
|
|
- kvfree(sbi->s_group_info);
|
|
+ rcu_read_lock();
|
|
+ kvfree(rcu_dereference(sbi->s_group_info));
|
|
+ rcu_read_unlock();
|
|
return -ENOMEM;
|
|
}
|
|
|
|
@@ -2720,7 +2735,7 @@ int ext4_mb_release(struct super_block *sb)
|
|
ext4_group_t ngroups = ext4_get_groups_count(sb);
|
|
ext4_group_t i;
|
|
int num_meta_group_infos;
|
|
- struct ext4_group_info *grinfo;
|
|
+ struct ext4_group_info *grinfo, ***group_info;
|
|
struct ext4_sb_info *sbi = EXT4_SB(sb);
|
|
struct kmem_cache *cachep = get_groupinfo_cache(sb->s_blocksize_bits);
|
|
|
|
@@ -2738,9 +2753,12 @@ int ext4_mb_release(struct super_block *sb)
|
|
num_meta_group_infos = (ngroups +
|
|
EXT4_DESC_PER_BLOCK(sb) - 1) >>
|
|
EXT4_DESC_PER_BLOCK_BITS(sb);
|
|
+ rcu_read_lock();
|
|
+ group_info = rcu_dereference(sbi->s_group_info);
|
|
for (i = 0; i < num_meta_group_infos; i++)
|
|
- kfree(sbi->s_group_info[i]);
|
|
- kvfree(sbi->s_group_info);
|
|
+ kfree(group_info[i]);
|
|
+ kvfree(group_info);
|
|
+ rcu_read_unlock();
|
|
}
|
|
kfree(sbi->s_mb_offsets);
|
|
kfree(sbi->s_mb_maxs);
|
|
@@ -2998,7 +3016,8 @@ ext4_mb_mark_diskspace_used(struct ext4_allocation_context *ac,
|
|
ext4_group_t flex_group = ext4_flex_group(sbi,
|
|
ac->ac_b_ex.fe_group);
|
|
atomic64_sub(ac->ac_b_ex.fe_len,
|
|
- &sbi->s_flex_groups[flex_group].free_clusters);
|
|
+ &sbi_array_rcu_deref(sbi, s_flex_groups,
|
|
+ flex_group)->free_clusters);
|
|
}
|
|
|
|
err = ext4_handle_dirty_metadata(handle, NULL, bitmap_bh);
|
|
@@ -4888,7 +4907,8 @@ do_more:
|
|
if (sbi->s_log_groups_per_flex) {
|
|
ext4_group_t flex_group = ext4_flex_group(sbi, block_group);
|
|
atomic64_add(count_clusters,
|
|
- &sbi->s_flex_groups[flex_group].free_clusters);
|
|
+ &sbi_array_rcu_deref(sbi, s_flex_groups,
|
|
+ flex_group)->free_clusters);
|
|
}
|
|
|
|
if (!(flags & EXT4_FREE_BLOCKS_NO_QUOT_UPDATE))
|
|
@@ -5033,7 +5053,8 @@ int ext4_group_add_blocks(handle_t *handle, struct super_block *sb,
|
|
if (sbi->s_log_groups_per_flex) {
|
|
ext4_group_t flex_group = ext4_flex_group(sbi, block_group);
|
|
atomic64_add(EXT4_NUM_B2C(sbi, blocks_freed),
|
|
- &sbi->s_flex_groups[flex_group].free_clusters);
|
|
+ &sbi_array_rcu_deref(sbi, s_flex_groups,
|
|
+ flex_group)->free_clusters);
|
|
}
|
|
|
|
ext4_mb_unload_buddy(&e4b);
|
|
diff --git a/fs/ext4/resize.c b/fs/ext4/resize.c
|
|
index aef2a24dc9f9..845d9841c91c 100644
|
|
--- a/fs/ext4/resize.c
|
|
+++ b/fs/ext4/resize.c
|
|
@@ -16,6 +16,33 @@
|
|
|
|
#include "ext4_jbd2.h"
|
|
|
|
+struct ext4_rcu_ptr {
|
|
+ struct rcu_head rcu;
|
|
+ void *ptr;
|
|
+};
|
|
+
|
|
+static void ext4_rcu_ptr_callback(struct rcu_head *head)
|
|
+{
|
|
+ struct ext4_rcu_ptr *ptr;
|
|
+
|
|
+ ptr = container_of(head, struct ext4_rcu_ptr, rcu);
|
|
+ kvfree(ptr->ptr);
|
|
+ kfree(ptr);
|
|
+}
|
|
+
|
|
+void ext4_kvfree_array_rcu(void *to_free)
|
|
+{
|
|
+ struct ext4_rcu_ptr *ptr = kzalloc(sizeof(*ptr), GFP_KERNEL);
|
|
+
|
|
+ if (ptr) {
|
|
+ ptr->ptr = to_free;
|
|
+ call_rcu(&ptr->rcu, ext4_rcu_ptr_callback);
|
|
+ return;
|
|
+ }
|
|
+ synchronize_rcu();
|
|
+ kvfree(to_free);
|
|
+}
|
|
+
|
|
int ext4_resize_begin(struct super_block *sb)
|
|
{
|
|
struct ext4_sb_info *sbi = EXT4_SB(sb);
|
|
@@ -541,8 +568,8 @@ static int setup_new_flex_group_blocks(struct super_block *sb,
|
|
brelse(gdb);
|
|
goto out;
|
|
}
|
|
- memcpy(gdb->b_data, sbi->s_group_desc[j]->b_data,
|
|
- gdb->b_size);
|
|
+ memcpy(gdb->b_data, sbi_array_rcu_deref(sbi,
|
|
+ s_group_desc, j)->b_data, gdb->b_size);
|
|
set_buffer_uptodate(gdb);
|
|
|
|
err = ext4_handle_dirty_metadata(handle, NULL, gdb);
|
|
@@ -849,13 +876,15 @@ static int add_new_gdb(handle_t *handle, struct inode *inode,
|
|
}
|
|
brelse(dind);
|
|
|
|
- o_group_desc = EXT4_SB(sb)->s_group_desc;
|
|
+ rcu_read_lock();
|
|
+ o_group_desc = rcu_dereference(EXT4_SB(sb)->s_group_desc);
|
|
memcpy(n_group_desc, o_group_desc,
|
|
EXT4_SB(sb)->s_gdb_count * sizeof(struct buffer_head *));
|
|
+ rcu_read_unlock();
|
|
n_group_desc[gdb_num] = gdb_bh;
|
|
- EXT4_SB(sb)->s_group_desc = n_group_desc;
|
|
+ rcu_assign_pointer(EXT4_SB(sb)->s_group_desc, n_group_desc);
|
|
EXT4_SB(sb)->s_gdb_count++;
|
|
- kvfree(o_group_desc);
|
|
+ ext4_kvfree_array_rcu(o_group_desc);
|
|
|
|
le16_add_cpu(&es->s_reserved_gdt_blocks, -1);
|
|
err = ext4_handle_dirty_super(handle, sb);
|
|
@@ -903,9 +932,11 @@ static int add_new_gdb_meta_bg(struct super_block *sb,
|
|
return err;
|
|
}
|
|
|
|
- o_group_desc = EXT4_SB(sb)->s_group_desc;
|
|
+ rcu_read_lock();
|
|
+ o_group_desc = rcu_dereference(EXT4_SB(sb)->s_group_desc);
|
|
memcpy(n_group_desc, o_group_desc,
|
|
EXT4_SB(sb)->s_gdb_count * sizeof(struct buffer_head *));
|
|
+ rcu_read_unlock();
|
|
n_group_desc[gdb_num] = gdb_bh;
|
|
|
|
BUFFER_TRACE(gdb_bh, "get_write_access");
|
|
@@ -916,9 +947,9 @@ static int add_new_gdb_meta_bg(struct super_block *sb,
|
|
return err;
|
|
}
|
|
|
|
- EXT4_SB(sb)->s_group_desc = n_group_desc;
|
|
+ rcu_assign_pointer(EXT4_SB(sb)->s_group_desc, n_group_desc);
|
|
EXT4_SB(sb)->s_gdb_count++;
|
|
- kvfree(o_group_desc);
|
|
+ ext4_kvfree_array_rcu(o_group_desc);
|
|
return err;
|
|
}
|
|
|
|
@@ -1180,7 +1211,8 @@ static int ext4_add_new_descs(handle_t *handle, struct super_block *sb,
|
|
* use non-sparse filesystems anymore. This is already checked above.
|
|
*/
|
|
if (gdb_off) {
|
|
- gdb_bh = sbi->s_group_desc[gdb_num];
|
|
+ gdb_bh = sbi_array_rcu_deref(sbi, s_group_desc,
|
|
+ gdb_num);
|
|
BUFFER_TRACE(gdb_bh, "get_write_access");
|
|
err = ext4_journal_get_write_access(handle, gdb_bh);
|
|
|
|
@@ -1262,7 +1294,7 @@ static int ext4_setup_new_descs(handle_t *handle, struct super_block *sb,
|
|
/*
|
|
* get_write_access() has been called on gdb_bh by ext4_add_new_desc().
|
|
*/
|
|
- gdb_bh = sbi->s_group_desc[gdb_num];
|
|
+ gdb_bh = sbi_array_rcu_deref(sbi, s_group_desc, gdb_num);
|
|
/* Update group descriptor block for new group */
|
|
gdp = (struct ext4_group_desc *)(gdb_bh->b_data +
|
|
gdb_off * EXT4_DESC_SIZE(sb));
|
|
@@ -1390,11 +1422,14 @@ static void ext4_update_super(struct super_block *sb,
|
|
percpu_counter_read(&sbi->s_freeclusters_counter));
|
|
if (ext4_has_feature_flex_bg(sb) && sbi->s_log_groups_per_flex) {
|
|
ext4_group_t flex_group;
|
|
+ struct flex_groups *fg;
|
|
+
|
|
flex_group = ext4_flex_group(sbi, group_data[0].group);
|
|
+ fg = sbi_array_rcu_deref(sbi, s_flex_groups, flex_group);
|
|
atomic64_add(EXT4_NUM_B2C(sbi, free_blocks),
|
|
- &sbi->s_flex_groups[flex_group].free_clusters);
|
|
+ &fg->free_clusters);
|
|
atomic_add(EXT4_INODES_PER_GROUP(sb) * flex_gd->count,
|
|
- &sbi->s_flex_groups[flex_group].free_inodes);
|
|
+ &fg->free_inodes);
|
|
}
|
|
|
|
/*
|
|
@@ -1489,7 +1524,8 @@ exit_journal:
|
|
for (; gdb_num <= gdb_num_end; gdb_num++) {
|
|
struct buffer_head *gdb_bh;
|
|
|
|
- gdb_bh = sbi->s_group_desc[gdb_num];
|
|
+ gdb_bh = sbi_array_rcu_deref(sbi, s_group_desc,
|
|
+ gdb_num);
|
|
if (old_gdb == gdb_bh->b_blocknr)
|
|
continue;
|
|
update_backups(sb, gdb_bh->b_blocknr, gdb_bh->b_data,
|
|
diff --git a/fs/ext4/super.c b/fs/ext4/super.c
|
|
index b69a78c061cb..75f71e52ffc7 100644
|
|
--- a/fs/ext4/super.c
|
|
+++ b/fs/ext4/super.c
|
|
@@ -826,6 +826,8 @@ static void ext4_put_super(struct super_block *sb)
|
|
{
|
|
struct ext4_sb_info *sbi = EXT4_SB(sb);
|
|
struct ext4_super_block *es = sbi->s_es;
|
|
+ struct buffer_head **group_desc;
|
|
+ struct flex_groups **flex_groups;
|
|
int aborted = 0;
|
|
int i, err;
|
|
|
|
@@ -857,10 +859,18 @@ static void ext4_put_super(struct super_block *sb)
|
|
if (!(sb->s_flags & MS_RDONLY))
|
|
ext4_commit_super(sb, 1);
|
|
|
|
+ rcu_read_lock();
|
|
+ group_desc = rcu_dereference(sbi->s_group_desc);
|
|
for (i = 0; i < sbi->s_gdb_count; i++)
|
|
- brelse(sbi->s_group_desc[i]);
|
|
- kvfree(sbi->s_group_desc);
|
|
- kvfree(sbi->s_flex_groups);
|
|
+ brelse(group_desc[i]);
|
|
+ kvfree(group_desc);
|
|
+ flex_groups = rcu_dereference(sbi->s_flex_groups);
|
|
+ if (flex_groups) {
|
|
+ for (i = 0; i < sbi->s_flex_groups_allocated; i++)
|
|
+ kvfree(flex_groups[i]);
|
|
+ kvfree(flex_groups);
|
|
+ }
|
|
+ rcu_read_unlock();
|
|
percpu_counter_destroy(&sbi->s_freeclusters_counter);
|
|
percpu_counter_destroy(&sbi->s_freeinodes_counter);
|
|
percpu_counter_destroy(&sbi->s_dirs_counter);
|
|
@@ -2109,8 +2119,8 @@ done:
|
|
int ext4_alloc_flex_bg_array(struct super_block *sb, ext4_group_t ngroup)
|
|
{
|
|
struct ext4_sb_info *sbi = EXT4_SB(sb);
|
|
- struct flex_groups *new_groups;
|
|
- int size;
|
|
+ struct flex_groups **old_groups, **new_groups;
|
|
+ int size, i, j;
|
|
|
|
if (!sbi->s_log_groups_per_flex)
|
|
return 0;
|
|
@@ -2119,22 +2129,37 @@ int ext4_alloc_flex_bg_array(struct super_block *sb, ext4_group_t ngroup)
|
|
if (size <= sbi->s_flex_groups_allocated)
|
|
return 0;
|
|
|
|
- size = roundup_pow_of_two(size * sizeof(struct flex_groups));
|
|
- new_groups = ext4_kvzalloc(size, GFP_KERNEL);
|
|
+ new_groups = ext4_kvzalloc(roundup_pow_of_two(size *
|
|
+ sizeof(*sbi->s_flex_groups)), GFP_KERNEL);
|
|
if (!new_groups) {
|
|
- ext4_msg(sb, KERN_ERR, "not enough memory for %d flex groups",
|
|
- size / (int) sizeof(struct flex_groups));
|
|
+ ext4_msg(sb, KERN_ERR,
|
|
+ "not enough memory for %d flex group pointers", size);
|
|
return -ENOMEM;
|
|
}
|
|
-
|
|
- if (sbi->s_flex_groups) {
|
|
- memcpy(new_groups, sbi->s_flex_groups,
|
|
- (sbi->s_flex_groups_allocated *
|
|
- sizeof(struct flex_groups)));
|
|
- kvfree(sbi->s_flex_groups);
|
|
+ for (i = sbi->s_flex_groups_allocated; i < size; i++) {
|
|
+ new_groups[i] = ext4_kvzalloc(roundup_pow_of_two(
|
|
+ sizeof(struct flex_groups)),
|
|
+ GFP_KERNEL);
|
|
+ if (!new_groups[i]) {
|
|
+ for (j = sbi->s_flex_groups_allocated; j < i; j++)
|
|
+ kvfree(new_groups[j]);
|
|
+ kvfree(new_groups);
|
|
+ ext4_msg(sb, KERN_ERR,
|
|
+ "not enough memory for %d flex groups", size);
|
|
+ return -ENOMEM;
|
|
+ }
|
|
}
|
|
- sbi->s_flex_groups = new_groups;
|
|
- sbi->s_flex_groups_allocated = size / sizeof(struct flex_groups);
|
|
+ rcu_read_lock();
|
|
+ old_groups = rcu_dereference(sbi->s_flex_groups);
|
|
+ if (old_groups)
|
|
+ memcpy(new_groups, old_groups,
|
|
+ (sbi->s_flex_groups_allocated *
|
|
+ sizeof(struct flex_groups *)));
|
|
+ rcu_read_unlock();
|
|
+ rcu_assign_pointer(sbi->s_flex_groups, new_groups);
|
|
+ sbi->s_flex_groups_allocated = size;
|
|
+ if (old_groups)
|
|
+ ext4_kvfree_array_rcu(old_groups);
|
|
return 0;
|
|
}
|
|
|
|
@@ -2142,6 +2167,7 @@ static int ext4_fill_flex_info(struct super_block *sb)
|
|
{
|
|
struct ext4_sb_info *sbi = EXT4_SB(sb);
|
|
struct ext4_group_desc *gdp = NULL;
|
|
+ struct flex_groups *fg;
|
|
ext4_group_t flex_group;
|
|
int i, err;
|
|
|
|
@@ -2159,12 +2185,11 @@ static int ext4_fill_flex_info(struct super_block *sb)
|
|
gdp = ext4_get_group_desc(sb, i, NULL);
|
|
|
|
flex_group = ext4_flex_group(sbi, i);
|
|
- atomic_add(ext4_free_inodes_count(sb, gdp),
|
|
- &sbi->s_flex_groups[flex_group].free_inodes);
|
|
+ fg = sbi_array_rcu_deref(sbi, s_flex_groups, flex_group);
|
|
+ atomic_add(ext4_free_inodes_count(sb, gdp), &fg->free_inodes);
|
|
atomic64_add(ext4_free_group_clusters(sb, gdp),
|
|
- &sbi->s_flex_groups[flex_group].free_clusters);
|
|
- atomic_add(ext4_used_dirs_count(sb, gdp),
|
|
- &sbi->s_flex_groups[flex_group].used_dirs);
|
|
+ &fg->free_clusters);
|
|
+ atomic_add(ext4_used_dirs_count(sb, gdp), &fg->used_dirs);
|
|
}
|
|
|
|
return 1;
|
|
@@ -3403,9 +3428,10 @@ static void ext4_set_resv_clusters(struct super_block *sb)
|
|
static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
|
{
|
|
char *orig_data = kstrdup(data, GFP_KERNEL);
|
|
- struct buffer_head *bh;
|
|
+ struct buffer_head *bh, **group_desc;
|
|
struct ext4_super_block *es = NULL;
|
|
struct ext4_sb_info *sbi = kzalloc(sizeof(*sbi), GFP_KERNEL);
|
|
+ struct flex_groups **flex_groups;
|
|
ext4_fsblk_t block;
|
|
ext4_fsblk_t sb_block = get_sb_block(&data);
|
|
ext4_fsblk_t logical_sb_block;
|
|
@@ -3955,9 +3981,10 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
|
goto failed_mount;
|
|
}
|
|
}
|
|
- sbi->s_group_desc = ext4_kvmalloc(db_count *
|
|
+ rcu_assign_pointer(sbi->s_group_desc,
|
|
+ ext4_kvmalloc(db_count *
|
|
sizeof(struct buffer_head *),
|
|
- GFP_KERNEL);
|
|
+ GFP_KERNEL));
|
|
if (sbi->s_group_desc == NULL) {
|
|
ext4_msg(sb, KERN_ERR, "not enough memory");
|
|
ret = -ENOMEM;
|
|
@@ -3967,14 +3994,19 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
|
bgl_lock_init(sbi->s_blockgroup_lock);
|
|
|
|
for (i = 0; i < db_count; i++) {
|
|
+ struct buffer_head *bh;
|
|
+
|
|
block = descriptor_loc(sb, logical_sb_block, i);
|
|
- sbi->s_group_desc[i] = sb_bread_unmovable(sb, block);
|
|
- if (!sbi->s_group_desc[i]) {
|
|
+ bh = sb_bread_unmovable(sb, block);
|
|
+ if (!bh) {
|
|
ext4_msg(sb, KERN_ERR,
|
|
"can't read group descriptor %d", i);
|
|
db_count = i;
|
|
goto failed_mount2;
|
|
}
|
|
+ rcu_read_lock();
|
|
+ rcu_dereference(sbi->s_group_desc)[i] = bh;
|
|
+ rcu_read_unlock();
|
|
}
|
|
sbi->s_gdb_count = db_count;
|
|
if (!ext4_check_descriptors(sb, logical_sb_block, &first_not_zeroed)) {
|
|
@@ -4316,8 +4348,14 @@ failed_mount7:
|
|
ext4_unregister_li_request(sb);
|
|
failed_mount6:
|
|
ext4_mb_release(sb);
|
|
- if (sbi->s_flex_groups)
|
|
- kvfree(sbi->s_flex_groups);
|
|
+ rcu_read_lock();
|
|
+ flex_groups = rcu_dereference(sbi->s_flex_groups);
|
|
+ if (flex_groups) {
|
|
+ for (i = 0; i < sbi->s_flex_groups_allocated; i++)
|
|
+ kvfree(flex_groups[i]);
|
|
+ kvfree(flex_groups);
|
|
+ }
|
|
+ rcu_read_unlock();
|
|
percpu_counter_destroy(&sbi->s_freeclusters_counter);
|
|
percpu_counter_destroy(&sbi->s_freeinodes_counter);
|
|
percpu_counter_destroy(&sbi->s_dirs_counter);
|
|
@@ -4349,9 +4387,12 @@ failed_mount3:
|
|
if (sbi->s_mmp_tsk)
|
|
kthread_stop(sbi->s_mmp_tsk);
|
|
failed_mount2:
|
|
+ rcu_read_lock();
|
|
+ group_desc = rcu_dereference(sbi->s_group_desc);
|
|
for (i = 0; i < db_count; i++)
|
|
- brelse(sbi->s_group_desc[i]);
|
|
- kvfree(sbi->s_group_desc);
|
|
+ brelse(group_desc[i]);
|
|
+ kvfree(group_desc);
|
|
+ rcu_read_unlock();
|
|
failed_mount:
|
|
if (sbi->s_chksum_driver)
|
|
crypto_free_shash(sbi->s_chksum_driver);
|
|
diff --git a/fs/fat/inode.c b/fs/fat/inode.c
|
|
index 88720011a6eb..f0387d040331 100644
|
|
--- a/fs/fat/inode.c
|
|
+++ b/fs/fat/inode.c
|
|
@@ -736,6 +736,13 @@ static struct inode *fat_alloc_inode(struct super_block *sb)
|
|
return NULL;
|
|
|
|
init_rwsem(&ei->truncate_lock);
|
|
+ /* Zeroing to allow iput() even if partial initialized inode. */
|
|
+ ei->mmu_private = 0;
|
|
+ ei->i_start = 0;
|
|
+ ei->i_logstart = 0;
|
|
+ ei->i_attrs = 0;
|
|
+ ei->i_pos = 0;
|
|
+
|
|
return &ei->vfs_inode;
|
|
}
|
|
|
|
@@ -1366,16 +1373,6 @@ out:
|
|
return 0;
|
|
}
|
|
|
|
-static void fat_dummy_inode_init(struct inode *inode)
|
|
-{
|
|
- /* Initialize this dummy inode to work as no-op. */
|
|
- MSDOS_I(inode)->mmu_private = 0;
|
|
- MSDOS_I(inode)->i_start = 0;
|
|
- MSDOS_I(inode)->i_logstart = 0;
|
|
- MSDOS_I(inode)->i_attrs = 0;
|
|
- MSDOS_I(inode)->i_pos = 0;
|
|
-}
|
|
-
|
|
static int fat_read_root(struct inode *inode)
|
|
{
|
|
struct msdos_sb_info *sbi = MSDOS_SB(inode->i_sb);
|
|
@@ -1820,13 +1817,11 @@ int fat_fill_super(struct super_block *sb, void *data, int silent, int isvfat,
|
|
fat_inode = new_inode(sb);
|
|
if (!fat_inode)
|
|
goto out_fail;
|
|
- fat_dummy_inode_init(fat_inode);
|
|
sbi->fat_inode = fat_inode;
|
|
|
|
fsinfo_inode = new_inode(sb);
|
|
if (!fsinfo_inode)
|
|
goto out_fail;
|
|
- fat_dummy_inode_init(fsinfo_inode);
|
|
fsinfo_inode->i_ino = MSDOS_FSINFO_INO;
|
|
sbi->fsinfo_inode = fsinfo_inode;
|
|
insert_inode_hash(fsinfo_inode);
|
|
diff --git a/fs/namei.c b/fs/namei.c
|
|
index 757a50ecf0f4..0953281430b1 100644
|
|
--- a/fs/namei.c
|
|
+++ b/fs/namei.c
|
|
@@ -1370,7 +1370,7 @@ static int follow_dotdot_rcu(struct nameidata *nd)
|
|
nd->path.dentry = parent;
|
|
nd->seq = seq;
|
|
if (unlikely(!path_connected(&nd->path)))
|
|
- return -ENOENT;
|
|
+ return -ECHILD;
|
|
break;
|
|
} else {
|
|
struct mount *mnt = real_mount(nd->path.mnt);
|
|
diff --git a/include/acpi/actypes.h b/include/acpi/actypes.h
|
|
index 1d798abae710..f502d257d494 100644
|
|
--- a/include/acpi/actypes.h
|
|
+++ b/include/acpi/actypes.h
|
|
@@ -551,6 +551,8 @@ typedef u64 acpi_integer;
|
|
#define ACPI_VALIDATE_RSDP_SIG(a) (!strncmp (ACPI_CAST_PTR (char, (a)), ACPI_SIG_RSDP, 8))
|
|
#define ACPI_MAKE_RSDP_SIG(dest) (memcpy (ACPI_CAST_PTR (char, (dest)), ACPI_SIG_RSDP, 8))
|
|
|
|
+#define ACPI_ACCESS_BYTE_WIDTH(size) (1 << ((size) - 1))
|
|
+
|
|
/*******************************************************************************
|
|
*
|
|
* Miscellaneous constants
|
|
diff --git a/include/linux/bitops.h b/include/linux/bitops.h
|
|
index 76ad8a957ffa..cee74a52b9eb 100644
|
|
--- a/include/linux/bitops.h
|
|
+++ b/include/linux/bitops.h
|
|
@@ -3,7 +3,8 @@
|
|
#include <asm/types.h>
|
|
#include <linux/bits.h>
|
|
|
|
-#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
|
|
+#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
|
|
+#define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_TYPE(long))
|
|
|
|
extern unsigned int __sw_hweight8(unsigned int w);
|
|
extern unsigned int __sw_hweight16(unsigned int w);
|
|
diff --git a/include/linux/hid.h b/include/linux/hid.h
|
|
index 04bdf5477ec5..eda06f7ee84a 100644
|
|
--- a/include/linux/hid.h
|
|
+++ b/include/linux/hid.h
|
|
@@ -453,7 +453,7 @@ struct hid_report_enum {
|
|
};
|
|
|
|
#define HID_MIN_BUFFER_SIZE 64 /* make sure there is at least a packet size of space */
|
|
-#define HID_MAX_BUFFER_SIZE 4096 /* 4kb */
|
|
+#define HID_MAX_BUFFER_SIZE 8192 /* 8kb */
|
|
#define HID_CONTROL_FIFO_SIZE 256 /* to init devices with >100 reports */
|
|
#define HID_OUTPUT_FIFO_SIZE 64
|
|
|
|
diff --git a/include/net/flow_dissector.h b/include/net/flow_dissector.h
|
|
index 1505cf7a4aaf..7a85a4ef6868 100644
|
|
--- a/include/net/flow_dissector.h
|
|
+++ b/include/net/flow_dissector.h
|
|
@@ -4,6 +4,7 @@
|
|
#include <linux/types.h>
|
|
#include <linux/in6.h>
|
|
#include <linux/siphash.h>
|
|
+#include <linux/string.h>
|
|
#include <uapi/linux/if_ether.h>
|
|
|
|
/**
|
|
@@ -204,4 +205,12 @@ static inline void *skb_flow_dissector_target(struct flow_dissector *flow_dissec
|
|
return ((char *)target_container) + flow_dissector->offset[key_id];
|
|
}
|
|
|
|
+static inline void
|
|
+flow_dissector_init_keys(struct flow_dissector_key_control *key_control,
|
|
+ struct flow_dissector_key_basic *key_basic)
|
|
+{
|
|
+ memset(key_control, 0, sizeof(*key_control));
|
|
+ memset(key_basic, 0, sizeof(*key_basic));
|
|
+}
|
|
+
|
|
#endif
|
|
diff --git a/kernel/audit.c b/kernel/audit.c
|
|
index 3461a3d874fe..53dcaa3b67bc 100644
|
|
--- a/kernel/audit.c
|
|
+++ b/kernel/audit.c
|
|
@@ -751,13 +751,11 @@ static void audit_log_feature_change(int which, u32 old_feature, u32 new_feature
|
|
audit_log_end(ab);
|
|
}
|
|
|
|
-static int audit_set_feature(struct sk_buff *skb)
|
|
+static int audit_set_feature(struct audit_features *uaf)
|
|
{
|
|
- struct audit_features *uaf;
|
|
int i;
|
|
|
|
BUILD_BUG_ON(AUDIT_LAST_FEATURE + 1 > ARRAY_SIZE(audit_feature_names));
|
|
- uaf = nlmsg_data(nlmsg_hdr(skb));
|
|
|
|
/* if there is ever a version 2 we should handle that here */
|
|
|
|
@@ -823,6 +821,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
|
{
|
|
u32 seq;
|
|
void *data;
|
|
+ int data_len;
|
|
int err;
|
|
struct audit_buffer *ab;
|
|
u16 msg_type = nlh->nlmsg_type;
|
|
@@ -846,6 +845,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
|
}
|
|
seq = nlh->nlmsg_seq;
|
|
data = nlmsg_data(nlh);
|
|
+ data_len = nlmsg_len(nlh);
|
|
|
|
switch (msg_type) {
|
|
case AUDIT_GET: {
|
|
@@ -867,7 +867,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
|
struct audit_status s;
|
|
memset(&s, 0, sizeof(s));
|
|
/* guard against past and future API changes */
|
|
- memcpy(&s, data, min_t(size_t, sizeof(s), nlmsg_len(nlh)));
|
|
+ memcpy(&s, data, min_t(size_t, sizeof(s), data_len));
|
|
if (s.mask & AUDIT_STATUS_ENABLED) {
|
|
err = audit_set_enabled(s.enabled);
|
|
if (err < 0)
|
|
@@ -930,7 +930,9 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
|
return err;
|
|
break;
|
|
case AUDIT_SET_FEATURE:
|
|
- err = audit_set_feature(skb);
|
|
+ if (data_len < sizeof(struct audit_features))
|
|
+ return -EINVAL;
|
|
+ err = audit_set_feature(data);
|
|
if (err)
|
|
return err;
|
|
break;
|
|
@@ -942,6 +944,8 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
|
|
|
err = audit_filter(msg_type, AUDIT_FILTER_USER);
|
|
if (err == 1) { /* match or error */
|
|
+ char *str = data;
|
|
+
|
|
err = 0;
|
|
if (msg_type == AUDIT_USER_TTY) {
|
|
err = tty_audit_push();
|
|
@@ -950,19 +954,17 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
|
}
|
|
mutex_unlock(&audit_cmd_mutex);
|
|
audit_log_common_recv_msg(&ab, msg_type);
|
|
- if (msg_type != AUDIT_USER_TTY)
|
|
+ if (msg_type != AUDIT_USER_TTY) {
|
|
+ /* ensure NULL termination */
|
|
+ str[data_len - 1] = '\0';
|
|
audit_log_format(ab, " msg='%.*s'",
|
|
AUDIT_MESSAGE_TEXT_MAX,
|
|
- (char *)data);
|
|
- else {
|
|
- int size;
|
|
-
|
|
+ str);
|
|
+ } else {
|
|
audit_log_format(ab, " data=");
|
|
- size = nlmsg_len(nlh);
|
|
- if (size > 0 &&
|
|
- ((unsigned char *)data)[size - 1] == '\0')
|
|
- size--;
|
|
- audit_log_n_untrustedstring(ab, data, size);
|
|
+ if (data_len > 0 && str[data_len - 1] == '\0')
|
|
+ data_len--;
|
|
+ audit_log_n_untrustedstring(ab, str, data_len);
|
|
}
|
|
audit_set_portid(ab, NETLINK_CB(skb).portid);
|
|
audit_log_end(ab);
|
|
@@ -971,7 +973,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
|
break;
|
|
case AUDIT_ADD_RULE:
|
|
case AUDIT_DEL_RULE:
|
|
- if (nlmsg_len(nlh) < sizeof(struct audit_rule_data))
|
|
+ if (data_len < sizeof(struct audit_rule_data))
|
|
return -EINVAL;
|
|
if (audit_enabled == AUDIT_LOCKED) {
|
|
audit_log_common_recv_msg(&ab, AUDIT_CONFIG_CHANGE);
|
|
@@ -980,7 +982,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
|
return -EPERM;
|
|
}
|
|
err = audit_rule_change(msg_type, NETLINK_CB(skb).portid,
|
|
- seq, data, nlmsg_len(nlh));
|
|
+ seq, data, data_len);
|
|
break;
|
|
case AUDIT_LIST_RULES:
|
|
err = audit_list_rules_send(skb, seq);
|
|
@@ -994,7 +996,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
|
case AUDIT_MAKE_EQUIV: {
|
|
void *bufp = data;
|
|
u32 sizes[2];
|
|
- size_t msglen = nlmsg_len(nlh);
|
|
+ size_t msglen = data_len;
|
|
char *old, *new;
|
|
|
|
err = -EINVAL;
|
|
@@ -1070,7 +1072,7 @@ static int audit_receive_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
|
|
|
|
memset(&s, 0, sizeof(s));
|
|
/* guard against past and future API changes */
|
|
- memcpy(&s, data, min_t(size_t, sizeof(s), nlmsg_len(nlh)));
|
|
+ memcpy(&s, data, min_t(size_t, sizeof(s), data_len));
|
|
/* check if new data is valid */
|
|
if ((s.enabled != 0 && s.enabled != 1) ||
|
|
(s.log_passwd != 0 && s.log_passwd != 1))
|
|
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
|
|
index 42b7251c597f..a71ff9965cba 100644
|
|
--- a/kernel/auditfilter.c
|
|
+++ b/kernel/auditfilter.c
|
|
@@ -434,6 +434,7 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
|
|
bufp = data->buf;
|
|
for (i = 0; i < data->field_count; i++) {
|
|
struct audit_field *f = &entry->rule.fields[i];
|
|
+ u32 f_val;
|
|
|
|
err = -EINVAL;
|
|
|
|
@@ -442,12 +443,12 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
|
|
goto exit_free;
|
|
|
|
f->type = data->fields[i];
|
|
- f->val = data->values[i];
|
|
+ f_val = data->values[i];
|
|
|
|
/* Support legacy tests for a valid loginuid */
|
|
- if ((f->type == AUDIT_LOGINUID) && (f->val == AUDIT_UID_UNSET)) {
|
|
+ if ((f->type == AUDIT_LOGINUID) && (f_val == AUDIT_UID_UNSET)) {
|
|
f->type = AUDIT_LOGINUID_SET;
|
|
- f->val = 0;
|
|
+ f_val = 0;
|
|
entry->rule.pflags |= AUDIT_LOGINUID_LEGACY;
|
|
}
|
|
|
|
@@ -463,7 +464,7 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
|
|
case AUDIT_SUID:
|
|
case AUDIT_FSUID:
|
|
case AUDIT_OBJ_UID:
|
|
- f->uid = make_kuid(current_user_ns(), f->val);
|
|
+ f->uid = make_kuid(current_user_ns(), f_val);
|
|
if (!uid_valid(f->uid))
|
|
goto exit_free;
|
|
break;
|
|
@@ -472,11 +473,12 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
|
|
case AUDIT_SGID:
|
|
case AUDIT_FSGID:
|
|
case AUDIT_OBJ_GID:
|
|
- f->gid = make_kgid(current_user_ns(), f->val);
|
|
+ f->gid = make_kgid(current_user_ns(), f_val);
|
|
if (!gid_valid(f->gid))
|
|
goto exit_free;
|
|
break;
|
|
case AUDIT_ARCH:
|
|
+ f->val = f_val;
|
|
entry->rule.arch_f = f;
|
|
break;
|
|
case AUDIT_SUBJ_USER:
|
|
@@ -489,11 +491,13 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
|
|
case AUDIT_OBJ_TYPE:
|
|
case AUDIT_OBJ_LEV_LOW:
|
|
case AUDIT_OBJ_LEV_HIGH:
|
|
- str = audit_unpack_string(&bufp, &remain, f->val);
|
|
- if (IS_ERR(str))
|
|
+ str = audit_unpack_string(&bufp, &remain, f_val);
|
|
+ if (IS_ERR(str)) {
|
|
+ err = PTR_ERR(str);
|
|
goto exit_free;
|
|
- entry->rule.buflen += f->val;
|
|
-
|
|
+ }
|
|
+ entry->rule.buflen += f_val;
|
|
+ f->lsm_str = str;
|
|
err = security_audit_rule_init(f->type, f->op, str,
|
|
(void **)&f->lsm_rule);
|
|
/* Keep currently invalid fields around in case they
|
|
@@ -502,68 +506,71 @@ static struct audit_entry *audit_data_to_entry(struct audit_rule_data *data,
|
|
pr_warn("audit rule for LSM \'%s\' is invalid\n",
|
|
str);
|
|
err = 0;
|
|
- }
|
|
- if (err) {
|
|
- kfree(str);
|
|
+ } else if (err)
|
|
goto exit_free;
|
|
- } else
|
|
- f->lsm_str = str;
|
|
break;
|
|
case AUDIT_WATCH:
|
|
- str = audit_unpack_string(&bufp, &remain, f->val);
|
|
- if (IS_ERR(str))
|
|
+ str = audit_unpack_string(&bufp, &remain, f_val);
|
|
+ if (IS_ERR(str)) {
|
|
+ err = PTR_ERR(str);
|
|
goto exit_free;
|
|
- entry->rule.buflen += f->val;
|
|
-
|
|
- err = audit_to_watch(&entry->rule, str, f->val, f->op);
|
|
+ }
|
|
+ err = audit_to_watch(&entry->rule, str, f_val, f->op);
|
|
if (err) {
|
|
kfree(str);
|
|
goto exit_free;
|
|
}
|
|
+ entry->rule.buflen += f_val;
|
|
break;
|
|
case AUDIT_DIR:
|
|
- str = audit_unpack_string(&bufp, &remain, f->val);
|
|
- if (IS_ERR(str))
|
|
+ str = audit_unpack_string(&bufp, &remain, f_val);
|
|
+ if (IS_ERR(str)) {
|
|
+ err = PTR_ERR(str);
|
|
goto exit_free;
|
|
- entry->rule.buflen += f->val;
|
|
-
|
|
+ }
|
|
err = audit_make_tree(&entry->rule, str, f->op);
|
|
kfree(str);
|
|
if (err)
|
|
goto exit_free;
|
|
+ entry->rule.buflen += f_val;
|
|
break;
|
|
case AUDIT_INODE:
|
|
+ f->val = f_val;
|
|
err = audit_to_inode(&entry->rule, f);
|
|
if (err)
|
|
goto exit_free;
|
|
break;
|
|
case AUDIT_FILTERKEY:
|
|
- if (entry->rule.filterkey || f->val > AUDIT_MAX_KEY_LEN)
|
|
+ if (entry->rule.filterkey || f_val > AUDIT_MAX_KEY_LEN)
|
|
goto exit_free;
|
|
- str = audit_unpack_string(&bufp, &remain, f->val);
|
|
- if (IS_ERR(str))
|
|
+ str = audit_unpack_string(&bufp, &remain, f_val);
|
|
+ if (IS_ERR(str)) {
|
|
+ err = PTR_ERR(str);
|
|
goto exit_free;
|
|
- entry->rule.buflen += f->val;
|
|
+ }
|
|
+ entry->rule.buflen += f_val;
|
|
entry->rule.filterkey = str;
|
|
break;
|
|
case AUDIT_EXE:
|
|
- if (entry->rule.exe || f->val > PATH_MAX)
|
|
+ if (entry->rule.exe || f_val > PATH_MAX)
|
|
goto exit_free;
|
|
- str = audit_unpack_string(&bufp, &remain, f->val);
|
|
+ str = audit_unpack_string(&bufp, &remain, f_val);
|
|
if (IS_ERR(str)) {
|
|
err = PTR_ERR(str);
|
|
goto exit_free;
|
|
}
|
|
- entry->rule.buflen += f->val;
|
|
-
|
|
- audit_mark = audit_alloc_mark(&entry->rule, str, f->val);
|
|
+ audit_mark = audit_alloc_mark(&entry->rule, str, f_val);
|
|
if (IS_ERR(audit_mark)) {
|
|
kfree(str);
|
|
err = PTR_ERR(audit_mark);
|
|
goto exit_free;
|
|
}
|
|
+ entry->rule.buflen += f_val;
|
|
entry->rule.exe = audit_mark;
|
|
break;
|
|
+ default:
|
|
+ f->val = f_val;
|
|
+ break;
|
|
}
|
|
}
|
|
|
|
diff --git a/mm/huge_memory.c b/mm/huge_memory.c
|
|
index f32f73fa5d3a..5fbd77d52602 100644
|
|
--- a/mm/huge_memory.c
|
|
+++ b/mm/huge_memory.c
|
|
@@ -2095,7 +2095,7 @@ int split_huge_page_to_list(struct page *page, struct list_head *list)
|
|
unsigned long flags;
|
|
pgoff_t end;
|
|
|
|
- VM_BUG_ON_PAGE(is_huge_zero_page(page), page);
|
|
+ VM_BUG_ON_PAGE(is_huge_zero_page(head), head);
|
|
VM_BUG_ON_PAGE(!PageLocked(page), page);
|
|
VM_BUG_ON_PAGE(!PageSwapBacked(page), page);
|
|
VM_BUG_ON_PAGE(!PageCompound(page), page);
|
|
diff --git a/net/core/fib_rules.c b/net/core/fib_rules.c
|
|
index be4629c344a6..9f172906cc88 100644
|
|
--- a/net/core/fib_rules.c
|
|
+++ b/net/core/fib_rules.c
|
|
@@ -640,7 +640,7 @@ static int fib_nl_fill_rule(struct sk_buff *skb, struct fib_rule *rule,
|
|
|
|
frh = nlmsg_data(nlh);
|
|
frh->family = ops->family;
|
|
- frh->table = rule->table;
|
|
+ frh->table = rule->table < 256 ? rule->table : RT_TABLE_COMPAT;
|
|
if (nla_put_u32(skb, FRA_TABLE, rule->table))
|
|
goto nla_put_failure;
|
|
if (nla_put_u32(skb, FRA_SUPPRESS_PREFIXLEN, rule->suppress_prefixlen))
|
|
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
|
|
index 5da864997495..85c7e250c7a8 100644
|
|
--- a/net/ipv6/ip6_fib.c
|
|
+++ b/net/ipv6/ip6_fib.c
|
|
@@ -784,8 +784,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
|
|
found++;
|
|
break;
|
|
}
|
|
- if (rt_can_ecmp)
|
|
- fallback_ins = fallback_ins ?: ins;
|
|
+ fallback_ins = fallback_ins ?: ins;
|
|
goto next_iter;
|
|
}
|
|
|
|
@@ -825,7 +824,9 @@ next_iter:
|
|
}
|
|
|
|
if (fallback_ins && !found) {
|
|
- /* No ECMP-able route found, replace first non-ECMP one */
|
|
+ /* No matching route with same ecmp-able-ness found, replace
|
|
+ * first matching route
|
|
+ */
|
|
ins = fallback_ins;
|
|
iter = *ins;
|
|
found++;
|
|
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
|
|
index 27c93baed708..2c4743f2d50e 100644
|
|
--- a/net/ipv6/route.c
|
|
+++ b/net/ipv6/route.c
|
|
@@ -3069,6 +3069,7 @@ static int ip6_route_multipath_add(struct fib6_config *cfg)
|
|
*/
|
|
cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL |
|
|
NLM_F_REPLACE);
|
|
+ cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_CREATE;
|
|
nhn++;
|
|
}
|
|
|
|
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
|
|
index ca7de02e0a6e..52f9742c438a 100644
|
|
--- a/net/mac80211/util.c
|
|
+++ b/net/mac80211/util.c
|
|
@@ -943,16 +943,22 @@ u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
|
|
elem_parse_failed = true;
|
|
break;
|
|
case WLAN_EID_VHT_OPERATION:
|
|
- if (elen >= sizeof(struct ieee80211_vht_operation))
|
|
+ if (elen >= sizeof(struct ieee80211_vht_operation)) {
|
|
elems->vht_operation = (void *)pos;
|
|
- else
|
|
- elem_parse_failed = true;
|
|
+ if (calc_crc)
|
|
+ crc = crc32_be(crc, pos - 2, elen + 2);
|
|
+ break;
|
|
+ }
|
|
+ elem_parse_failed = true;
|
|
break;
|
|
case WLAN_EID_OPMODE_NOTIF:
|
|
- if (elen > 0)
|
|
+ if (elen > 0) {
|
|
elems->opmode_notif = pos;
|
|
- else
|
|
- elem_parse_failed = true;
|
|
+ if (calc_crc)
|
|
+ crc = crc32_be(crc, pos - 2, elen + 2);
|
|
+ break;
|
|
+ }
|
|
+ elem_parse_failed = true;
|
|
break;
|
|
case WLAN_EID_MESH_ID:
|
|
elems->mesh_id = pos;
|
|
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
|
|
index 025487436438..205865292ba3 100644
|
|
--- a/net/netlink/af_netlink.c
|
|
+++ b/net/netlink/af_netlink.c
|
|
@@ -1003,7 +1003,8 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
|
|
if (nlk->netlink_bind && groups) {
|
|
int group;
|
|
|
|
- for (group = 0; group < nlk->ngroups; group++) {
|
|
+ /* nl_groups is a u32, so cap the maximum groups we can bind */
|
|
+ for (group = 0; group < BITS_PER_TYPE(u32); group++) {
|
|
if (!test_bit(group, &groups))
|
|
continue;
|
|
err = nlk->netlink_bind(net, group + 1);
|
|
@@ -1022,7 +1023,7 @@ static int netlink_bind(struct socket *sock, struct sockaddr *addr,
|
|
netlink_insert(sk, nladdr->nl_pid) :
|
|
netlink_autobind(sock);
|
|
if (err) {
|
|
- netlink_undo_bind(nlk->ngroups, groups, sk);
|
|
+ netlink_undo_bind(BITS_PER_TYPE(u32), groups, sk);
|
|
return err;
|
|
}
|
|
}
|
|
diff --git a/net/sched/cls_flower.c b/net/sched/cls_flower.c
|
|
index de03b7b49e05..18904313bd4e 100644
|
|
--- a/net/sched/cls_flower.c
|
|
+++ b/net/sched/cls_flower.c
|
|
@@ -141,6 +141,7 @@ static int fl_classify(struct sk_buff *skb, const struct tcf_proto *tp,
|
|
if (!atomic_read(&head->ht.nelems))
|
|
return -1;
|
|
|
|
+ flow_dissector_init_keys(&skb_key.control, &skb_key.basic);
|
|
fl_clear_masked_range(&skb_key, &head->mask);
|
|
|
|
info = skb_tunnel_info(skb);
|
|
diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
|
|
index bfd068679710..1a3c75347f48 100644
|
|
--- a/net/sctp/sm_statefuns.c
|
|
+++ b/net/sctp/sm_statefuns.c
|
|
@@ -177,6 +177,16 @@ sctp_chunk_length_valid(struct sctp_chunk *chunk,
|
|
return 1;
|
|
}
|
|
|
|
+/* Check for format error in an ABORT chunk */
|
|
+static inline bool sctp_err_chunk_valid(struct sctp_chunk *chunk)
|
|
+{
|
|
+ struct sctp_errhdr *err;
|
|
+
|
|
+ sctp_walk_errors(err, chunk->chunk_hdr);
|
|
+
|
|
+ return (void *)err == (void *)chunk->chunk_end;
|
|
+}
|
|
+
|
|
/**********************************************************
|
|
* These are the state functions for handling chunk events.
|
|
**********************************************************/
|
|
@@ -2159,6 +2169,9 @@ sctp_disposition_t sctp_sf_shutdown_pending_abort(
|
|
sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest))
|
|
return sctp_sf_discard_chunk(net, ep, asoc, type, arg, commands);
|
|
|
|
+ if (!sctp_err_chunk_valid(chunk))
|
|
+ return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
|
+
|
|
return __sctp_sf_do_9_1_abort(net, ep, asoc, type, arg, commands);
|
|
}
|
|
|
|
@@ -2201,6 +2214,9 @@ sctp_disposition_t sctp_sf_shutdown_sent_abort(struct net *net,
|
|
sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest))
|
|
return sctp_sf_discard_chunk(net, ep, asoc, type, arg, commands);
|
|
|
|
+ if (!sctp_err_chunk_valid(chunk))
|
|
+ return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
|
+
|
|
/* Stop the T2-shutdown timer. */
|
|
sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_STOP,
|
|
SCTP_TO(SCTP_EVENT_TIMEOUT_T2_SHUTDOWN));
|
|
@@ -2466,6 +2482,9 @@ sctp_disposition_t sctp_sf_do_9_1_abort(struct net *net,
|
|
sctp_bind_addr_state(&asoc->base.bind_addr, &chunk->dest))
|
|
return sctp_sf_discard_chunk(net, ep, asoc, type, arg, commands);
|
|
|
|
+ if (!sctp_err_chunk_valid(chunk))
|
|
+ return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
|
+
|
|
return __sctp_sf_do_9_1_abort(net, ep, asoc, type, arg, commands);
|
|
}
|
|
|
|
@@ -2482,15 +2501,9 @@ static sctp_disposition_t __sctp_sf_do_9_1_abort(struct net *net,
|
|
|
|
/* See if we have an error cause code in the chunk. */
|
|
len = ntohs(chunk->chunk_hdr->length);
|
|
- if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr)) {
|
|
-
|
|
- sctp_errhdr_t *err;
|
|
- sctp_walk_errors(err, chunk->chunk_hdr);
|
|
- if ((void *)err != (void *)chunk->chunk_end)
|
|
- return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands);
|
|
|
|
+ if (len >= sizeof(struct sctp_chunkhdr) + sizeof(struct sctp_errhdr))
|
|
error = ((sctp_errhdr_t *)chunk->skb->data)->cause;
|
|
- }
|
|
|
|
sctp_add_cmd_sf(commands, SCTP_CMD_SET_SK_ERR, SCTP_ERROR(ECONNRESET));
|
|
/* ASSOC_FAILED will DELETE_TCB. */
|
|
diff --git a/net/wireless/ethtool.c b/net/wireless/ethtool.c
|
|
index e9e91298c70d..3cedf2c2b60b 100644
|
|
--- a/net/wireless/ethtool.c
|
|
+++ b/net/wireless/ethtool.c
|
|
@@ -6,9 +6,13 @@
|
|
void cfg80211_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
|
|
{
|
|
struct wireless_dev *wdev = dev->ieee80211_ptr;
|
|
+ struct device *pdev = wiphy_dev(wdev->wiphy);
|
|
|
|
- strlcpy(info->driver, wiphy_dev(wdev->wiphy)->driver->name,
|
|
- sizeof(info->driver));
|
|
+ if (pdev->driver)
|
|
+ strlcpy(info->driver, pdev->driver->name,
|
|
+ sizeof(info->driver));
|
|
+ else
|
|
+ strlcpy(info->driver, "N/A", sizeof(info->driver));
|
|
|
|
strlcpy(info->version, init_utsname()->release, sizeof(info->version));
|
|
|
|
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
|
|
index bb19be78aed7..9823bef65e5e 100644
|
|
--- a/net/wireless/nl80211.c
|
|
+++ b/net/wireless/nl80211.c
|
|
@@ -333,6 +333,7 @@ static const struct nla_policy nl80211_policy[NUM_NL80211_ATTR] = {
|
|
[NL80211_ATTR_CONTROL_PORT_ETHERTYPE] = { .type = NLA_U16 },
|
|
[NL80211_ATTR_CONTROL_PORT_NO_ENCRYPT] = { .type = NLA_FLAG },
|
|
[NL80211_ATTR_PRIVACY] = { .type = NLA_FLAG },
|
|
+ [NL80211_ATTR_STATUS_CODE] = { .type = NLA_U16 },
|
|
[NL80211_ATTR_CIPHER_SUITE_GROUP] = { .type = NLA_U32 },
|
|
[NL80211_ATTR_WPA_VERSIONS] = { .type = NLA_U32 },
|
|
[NL80211_ATTR_PID] = { .type = NLA_U32 },
|
|
diff --git a/sound/soc/codecs/pcm512x.c b/sound/soc/codecs/pcm512x.c
|
|
index 72b19e62f626..c0807b82399a 100644
|
|
--- a/sound/soc/codecs/pcm512x.c
|
|
+++ b/sound/soc/codecs/pcm512x.c
|
|
@@ -1441,13 +1441,15 @@ int pcm512x_probe(struct device *dev, struct regmap *regmap)
|
|
}
|
|
|
|
pcm512x->sclk = devm_clk_get(dev, NULL);
|
|
- if (PTR_ERR(pcm512x->sclk) == -EPROBE_DEFER)
|
|
- return -EPROBE_DEFER;
|
|
+ if (PTR_ERR(pcm512x->sclk) == -EPROBE_DEFER) {
|
|
+ ret = -EPROBE_DEFER;
|
|
+ goto err;
|
|
+ }
|
|
if (!IS_ERR(pcm512x->sclk)) {
|
|
ret = clk_prepare_enable(pcm512x->sclk);
|
|
if (ret != 0) {
|
|
dev_err(dev, "Failed to enable SCLK: %d\n", ret);
|
|
- return ret;
|
|
+ goto err;
|
|
}
|
|
}
|
|
|
|
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
|
|
index 08bfc91c686f..a04672411bef 100644
|
|
--- a/sound/soc/soc-dapm.c
|
|
+++ b/sound/soc/soc-dapm.c
|
|
@@ -4363,7 +4363,7 @@ static void soc_dapm_shutdown_dapm(struct snd_soc_dapm_context *dapm)
|
|
continue;
|
|
if (w->power) {
|
|
dapm_seq_insert(w, &down_list, false);
|
|
- w->power = 0;
|
|
+ w->new_power = 0;
|
|
powerdown = 1;
|
|
}
|
|
}
|
|
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
|
|
index 280bb5cab87f..9df0c8102dc0 100644
|
|
--- a/sound/soc/soc-pcm.c
|
|
+++ b/sound/soc/soc-pcm.c
|
|
@@ -2979,16 +2979,16 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe,
|
|
ssize_t offset = 0;
|
|
|
|
/* FE state */
|
|
- offset += snprintf(buf + offset, size - offset,
|
|
+ offset += scnprintf(buf + offset, size - offset,
|
|
"[%s - %s]\n", fe->dai_link->name,
|
|
stream ? "Capture" : "Playback");
|
|
|
|
- offset += snprintf(buf + offset, size - offset, "State: %s\n",
|
|
+ offset += scnprintf(buf + offset, size - offset, "State: %s\n",
|
|
dpcm_state_string(fe->dpcm[stream].state));
|
|
|
|
if ((fe->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) &&
|
|
(fe->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP))
|
|
- offset += snprintf(buf + offset, size - offset,
|
|
+ offset += scnprintf(buf + offset, size - offset,
|
|
"Hardware Params: "
|
|
"Format = %s, Channels = %d, Rate = %d\n",
|
|
snd_pcm_format_name(params_format(params)),
|
|
@@ -2996,10 +2996,10 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe,
|
|
params_rate(params));
|
|
|
|
/* BEs state */
|
|
- offset += snprintf(buf + offset, size - offset, "Backends:\n");
|
|
+ offset += scnprintf(buf + offset, size - offset, "Backends:\n");
|
|
|
|
if (list_empty(&fe->dpcm[stream].be_clients)) {
|
|
- offset += snprintf(buf + offset, size - offset,
|
|
+ offset += scnprintf(buf + offset, size - offset,
|
|
" No active DSP links\n");
|
|
goto out;
|
|
}
|
|
@@ -3008,16 +3008,16 @@ static ssize_t dpcm_show_state(struct snd_soc_pcm_runtime *fe,
|
|
struct snd_soc_pcm_runtime *be = dpcm->be;
|
|
params = &dpcm->hw_params;
|
|
|
|
- offset += snprintf(buf + offset, size - offset,
|
|
+ offset += scnprintf(buf + offset, size - offset,
|
|
"- %s\n", be->dai_link->name);
|
|
|
|
- offset += snprintf(buf + offset, size - offset,
|
|
+ offset += scnprintf(buf + offset, size - offset,
|
|
" State: %s\n",
|
|
dpcm_state_string(be->dpcm[stream].state));
|
|
|
|
if ((be->dpcm[stream].state >= SND_SOC_DPCM_STATE_HW_PARAMS) &&
|
|
(be->dpcm[stream].state <= SND_SOC_DPCM_STATE_STOP))
|
|
- offset += snprintf(buf + offset, size - offset,
|
|
+ offset += scnprintf(buf + offset, size - offset,
|
|
" Hardware Params: "
|
|
"Format = %s, Channels = %d, Rate = %d\n",
|
|
snd_pcm_format_name(params_format(params)),
|
|
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
|
|
index a53fef0c673b..ade6abda9f46 100644
|
|
--- a/tools/perf/ui/browsers/hists.c
|
|
+++ b/tools/perf/ui/browsers/hists.c
|
|
@@ -2930,6 +2930,7 @@ static int perf_evsel__hists_browse(struct perf_evsel *evsel, int nr_events,
|
|
|
|
continue;
|
|
}
|
|
+ actions->ms.map = map;
|
|
top = pstack__peek(browser->pstack);
|
|
if (top == &browser->hists->dso_filter) {
|
|
/*
|
|
diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
|
|
index c0dff5337a50..4e4bb5dd2dcd 100644
|
|
--- a/virt/kvm/kvm_main.c
|
|
+++ b/virt/kvm/kvm_main.c
|
|
@@ -2045,12 +2045,12 @@ int kvm_write_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
|
|
if (slots->generation != ghc->generation)
|
|
kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa, ghc->len);
|
|
|
|
- if (unlikely(!ghc->memslot))
|
|
- return kvm_write_guest(kvm, ghc->gpa, data, len);
|
|
-
|
|
if (kvm_is_error_hva(ghc->hva))
|
|
return -EFAULT;
|
|
|
|
+ if (unlikely(!ghc->memslot))
|
|
+ return kvm_write_guest(kvm, ghc->gpa, data, len);
|
|
+
|
|
r = __copy_to_user((void __user *)ghc->hva, data, len);
|
|
if (r)
|
|
return -EFAULT;
|
|
@@ -2071,12 +2071,12 @@ int kvm_read_guest_cached(struct kvm *kvm, struct gfn_to_hva_cache *ghc,
|
|
if (slots->generation != ghc->generation)
|
|
kvm_gfn_to_hva_cache_init(kvm, ghc, ghc->gpa, ghc->len);
|
|
|
|
- if (unlikely(!ghc->memslot))
|
|
- return kvm_read_guest(kvm, ghc->gpa, data, len);
|
|
-
|
|
if (kvm_is_error_hva(ghc->hva))
|
|
return -EFAULT;
|
|
|
|
+ if (unlikely(!ghc->memslot))
|
|
+ return kvm_read_guest(kvm, ghc->gpa, data, len);
|
|
+
|
|
r = __copy_from_user(data, (void __user *)ghc->hva, len);
|
|
if (r)
|
|
return -EFAULT;
|