Skip to content
This repository has been archived by the owner on Dec 28, 2020. It is now read-only.

Commit

Permalink
Merge 4.9.170 into neutrino-msm-fajita-4.9
Browse files Browse the repository at this point in the history
Changes in 4.9.170: (51 commits)
        ARC: u-boot args: check that magic number is correct
        perf/core: Restore mmap record type correctly
        ext4: add missing brelse() in add_new_gdb_meta_bg()
        ext4: report real fs size after failed resize
        ALSA: echoaudio: add a check for ioremap_nocache
        ALSA: sb8: add a check for request_region
        IB/mlx4: Fix race condition between catas error reset and aliasguid flows
        mmc: davinci: remove extraneous __init annotation
        ALSA: opl3: fix mismatch between snd_opl3_drum_switch definition and declaration
        thermal/int340x_thermal: Add additional UUIDs
        thermal/int340x_thermal: fix mode setting
        tools/power turbostat: return the exit status of a command
        perf config: Fix an error in the config template documentation
        perf config: Fix a memory leak in collect_config()
        perf build-id: Fix memory leak in print_sdt_events()
        perf top: Fix error handling in cmd_top()
        perf hist: Add missing map__put() in error case
        perf evsel: Free evsel->counts in perf_evsel__exit()
        perf tests: Fix a memory leak of cpu_map object in the openat_syscall_event_on_all_cpus test
        perf tests: Fix a memory leak in test__perf_evsel__tp_sched_test()
        irqchip/mbigen: Don't clear eventid when freeing an MSI
        x86/hpet: Prevent potential NULL pointer dereference
        x86/cpu/cyrix: Use correct macros for Cyrix calls on Geode processors
        iommu/vt-d: Check capability before disabling protected memory
        x86/hw_breakpoints: Make default case in hw_breakpoint_arch_parse() return an error
        fix incorrect error code mapping for OBJECTID_NOT_FOUND
        ext4: prohibit fstrim in norecovery mode
        gpio: pxa: handle corner case of unprobed device
        rsi: improve kernel thread handling to fix kernel panic
        9p: do not trust pdu content for stat item size
        9p locks: add mount option for lock retry interval
        f2fs: fix to do sanity check with current segment number
        serial: uartps: console_setup() can't be placed to init section
        HID: i2c-hid: override HID descriptors for certain devices
        ARM: samsung: Limit SAMSUNG_PM_CHECK config option to non-Exynos platforms
        ACPI / SBS: Fix GPE storm on recent MacBookPro's
        cifs: fallback to older infolevels on findfirst queryinfo retry
        kernel: hung_task.c: disable on suspend
        crypto: sha256/arm - fix crash bug in Thumb2 build
        crypto: sha512/arm - fix crash bug in Thumb2 build
        iommu/dmar: Fix buffer overflow during PCI bus notification
        soc/tegra: pmc: Drop locking from tegra_powergate_is_powered()
        lkdtm: Add tests for NULL pointer dereference
        ARM: 8839/1: kprobe: make patch_lock a raw_spinlock_t
        appletalk: Fix use-after-free in atalk_proc_exit
        lib/div64.c: off by one in shift
        include/linux/swap.h: use offsetof() instead of custom __swapoffset macro
        tpm/tpm_crb: Avoid unaligned reads in crb_recv()
        net: stmmac: Set dma ring length before enabling the DMA
        appletalk: Fix compile regression
        Linux 4.9.170

Signed-off-by: Adam W. Willis <return.of.octobot@gmail.com>

Conflicts:
	fs/ext4/ioctl.c
  • Loading branch information
0ctobot committed Apr 23, 2019
2 parents 72b9821 + ad387ec commit fdb2709
Show file tree
Hide file tree
Showing 62 changed files with 758 additions and 130 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION = 4
PATCHLEVEL = 9
SUBLEVEL = 169
SUBLEVEL = 170
EXTRAVERSION =
NAME = Roaring Lionus

Expand Down
1 change: 1 addition & 0 deletions arch/arc/kernel/head.S
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ ENTRY(stext)
; r2 = pointer to uboot provided cmdline or external DTB in mem
; These are handled later in handle_uboot_args()
st r0, [@uboot_tag]
st r1, [@uboot_magic]
st r2, [@uboot_arg]
#endif

Expand Down
8 changes: 8 additions & 0 deletions arch/arc/kernel/setup.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ unsigned int intr_to_DE_cnt;

/* Part of U-boot ABI: see head.S */
int __initdata uboot_tag;
int __initdata uboot_magic;
char __initdata *uboot_arg;

const struct machine_desc *machine_desc;
Expand Down Expand Up @@ -400,6 +401,8 @@ static inline bool uboot_arg_invalid(unsigned long addr)
#define UBOOT_TAG_NONE 0
#define UBOOT_TAG_CMDLINE 1
#define UBOOT_TAG_DTB 2
/* We always pass 0 as magic from U-boot */
#define UBOOT_MAGIC_VALUE 0

void __init handle_uboot_args(void)
{
Expand All @@ -415,6 +418,11 @@ void __init handle_uboot_args(void)
goto ignore_uboot_args;
}

if (uboot_magic != UBOOT_MAGIC_VALUE) {
pr_warn(IGNORE_ARGS "non zero uboot magic\n");
goto ignore_uboot_args;
}

if (uboot_tag != UBOOT_TAG_NONE &&
uboot_arg_invalid((unsigned long)uboot_arg)) {
pr_warn(IGNORE_ARGS "invalid uboot arg: '%px'\n", uboot_arg);
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/crypto/sha256-armv4.pl
Original file line number Diff line number Diff line change
Expand Up @@ -205,10 +205,11 @@ sub BODY_16_XX {
.global sha256_block_data_order
.type sha256_block_data_order,%function
sha256_block_data_order:
.Lsha256_block_data_order:
#if __ARM_ARCH__<7
sub r3,pc,#8 @ sha256_block_data_order
#else
adr r3,sha256_block_data_order
adr r3,.Lsha256_block_data_order
#endif
#if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
ldr r12,.LOPENSSL_armcap
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/crypto/sha256-core.S_shipped
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ K256:
.global sha256_block_data_order
.type sha256_block_data_order,%function
sha256_block_data_order:
.Lsha256_block_data_order:
#if __ARM_ARCH__<7
sub r3,pc,#8 @ sha256_block_data_order
#else
adr r3,sha256_block_data_order
adr r3,.Lsha256_block_data_order
#endif
#if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
ldr r12,.LOPENSSL_armcap
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/crypto/sha512-armv4.pl
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,11 @@ ()
.global sha512_block_data_order
.type sha512_block_data_order,%function
sha512_block_data_order:
.Lsha512_block_data_order:
#if __ARM_ARCH__<7
sub r3,pc,#8 @ sha512_block_data_order
#else
adr r3,sha512_block_data_order
adr r3,.Lsha512_block_data_order
#endif
#if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
ldr r12,.LOPENSSL_armcap
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/crypto/sha512-core.S_shipped
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,11 @@ WORD64(0x5fcb6fab,0x3ad6faec, 0x6c44198c,0x4a475817)
.global sha512_block_data_order
.type sha512_block_data_order,%function
sha512_block_data_order:
.Lsha512_block_data_order:
#if __ARM_ARCH__<7
sub r3,pc,#8 @ sha512_block_data_order
#else
adr r3,sha512_block_data_order
adr r3,.Lsha512_block_data_order
#endif
#if __ARM_MAX_ARCH__>=7 && !defined(__KERNEL__)
ldr r12,.LOPENSSL_armcap
Expand Down
6 changes: 3 additions & 3 deletions arch/arm/kernel/patch.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct patch {
unsigned int insn;
};

static DEFINE_SPINLOCK(patch_lock);
static DEFINE_RAW_SPINLOCK(patch_lock);

static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags)
__acquires(&patch_lock)
Expand All @@ -32,7 +32,7 @@ static void __kprobes *patch_map(void *addr, int fixmap, unsigned long *flags)
return addr;

if (flags)
spin_lock_irqsave(&patch_lock, *flags);
raw_spin_lock_irqsave(&patch_lock, *flags);
else
__acquire(&patch_lock);

Expand All @@ -47,7 +47,7 @@ static void __kprobes patch_unmap(int fixmap, unsigned long *flags)
clear_fixmap(fixmap);

if (flags)
spin_unlock_irqrestore(&patch_lock, *flags);
raw_spin_unlock_irqrestore(&patch_lock, *flags);
else
__release(&patch_lock);
}
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/plat-samsung/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ config S3C_PM_DEBUG_LED_SMDK

config SAMSUNG_PM_CHECK
bool "S3C2410 PM Suspend Memory CRC"
depends on PM
depends on PM && (PLAT_S3C24XX || ARCH_S3C64XX || ARCH_S5PV210)
select CRC32
help
Enable the PM code's memory area checksum over sleep. This option
Expand Down
14 changes: 7 additions & 7 deletions arch/x86/kernel/cpu/cyrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ static void set_cx86_reorder(void)
setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */

/* Load/Store Serialize to mem access disable (=reorder it) */
setCx86_old(CX86_PCR0, getCx86_old(CX86_PCR0) & ~0x80);
setCx86(CX86_PCR0, getCx86(CX86_PCR0) & ~0x80);
/* set load/store serialize from 1GB to 4GB */
ccr3 |= 0xe0;
setCx86(CX86_CCR3, ccr3);
Expand All @@ -132,11 +132,11 @@ static void set_cx86_memwb(void)
pr_info("Enable Memory-Write-back mode on Cyrix/NSC processor.\n");

/* CCR2 bit 2: unlock NW bit */
setCx86_old(CX86_CCR2, getCx86_old(CX86_CCR2) & ~0x04);
setCx86(CX86_CCR2, getCx86(CX86_CCR2) & ~0x04);
/* set 'Not Write-through' */
write_cr0(read_cr0() | X86_CR0_NW);
/* CCR2 bit 2: lock NW bit and set WT1 */
setCx86_old(CX86_CCR2, getCx86_old(CX86_CCR2) | 0x14);
setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x14);
}

/*
Expand All @@ -150,14 +150,14 @@ static void geode_configure(void)
local_irq_save(flags);

/* Suspend on halt power saving and enable #SUSP pin */
setCx86_old(CX86_CCR2, getCx86_old(CX86_CCR2) | 0x88);
setCx86(CX86_CCR2, getCx86(CX86_CCR2) | 0x88);

ccr3 = getCx86(CX86_CCR3);
setCx86(CX86_CCR3, (ccr3 & 0x0f) | 0x10); /* enable MAPEN */


/* FPU fast, DTE cache, Mem bypass */
setCx86_old(CX86_CCR4, getCx86_old(CX86_CCR4) | 0x38);
setCx86(CX86_CCR4, getCx86(CX86_CCR4) | 0x38);
setCx86(CX86_CCR3, ccr3); /* disable MAPEN */

set_cx86_memwb();
Expand Down Expand Up @@ -293,7 +293,7 @@ static void init_cyrix(struct cpuinfo_x86 *c)
/* GXm supports extended cpuid levels 'ala' AMD */
if (c->cpuid_level == 2) {
/* Enable cxMMX extensions (GX1 Datasheet 54) */
setCx86_old(CX86_CCR7, getCx86_old(CX86_CCR7) | 1);
setCx86(CX86_CCR7, getCx86(CX86_CCR7) | 1);

/*
* GXm : 0x30 ... 0x5f GXm datasheet 51
Expand All @@ -316,7 +316,7 @@ static void init_cyrix(struct cpuinfo_x86 *c)
if (dir1 > 7) {
dir0_msn++; /* M II */
/* Enable MMX extensions (App note 108) */
setCx86_old(CX86_CCR7, getCx86_old(CX86_CCR7)|1);
setCx86(CX86_CCR7, getCx86(CX86_CCR7)|1);
} else {
/* A 6x86MX - it has the bug. */
set_cpu_bug(c, X86_BUG_COMA);
Expand Down
2 changes: 2 additions & 0 deletions arch/x86/kernel/hpet.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,6 +914,8 @@ int __init hpet_enable(void)
return 0;

hpet_set_mapping();
if (!hpet_virt_address)
return 0;

/*
* Read the period and check for a sane value:
Expand Down
1 change: 1 addition & 0 deletions arch/x86/kernel/hw_breakpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,7 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
#endif
default:
WARN_ON_ONCE(1);
return -EINVAL;
}

/*
Expand Down
8 changes: 6 additions & 2 deletions drivers/acpi/sbs.c
Original file line number Diff line number Diff line change
Expand Up @@ -443,9 +443,13 @@ static int acpi_ac_get_present(struct acpi_sbs *sbs)

/*
* The spec requires that bit 4 always be 1. If it's not set, assume
* that the implementation doesn't support an SBS charger
* that the implementation doesn't support an SBS charger.
*
* And on some MacBooks a status of 0xffff is always returned, no
* matter whether the charger is plugged in or not, which is also
* wrong, so ignore the SBS charger for those too.
*/
if (!((status >> 4) & 0x1))
if (!((status >> 4) & 0x1) || status == 0xffff)
return -ENODEV;

sbs->charger_present = (status >> 15) & 0x1;
Expand Down
22 changes: 16 additions & 6 deletions drivers/char/tpm/tpm_crb.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,29 @@ static int crb_recv(struct tpm_chip *chip, u8 *buf, size_t count)
struct crb_priv *priv = dev_get_drvdata(&chip->dev);
unsigned int expected;

/* sanity check */
if (count < 6)
/* A sanity check that the upper layer wants to get at least the header
* as that is the minimum size for any TPM response.
*/
if (count < TPM_HEADER_SIZE)
return -EIO;

/* If this bit is set, according to the spec, the TPM is in
* unrecoverable condition.
*/
if (ioread32(&priv->cca->sts) & CRB_CTRL_STS_ERROR)
return -EIO;

memcpy_fromio(buf, priv->rsp, 6);
expected = be32_to_cpup((__be32 *) &buf[2]);
if (expected > count || expected < 6)
/* Read the first 8 bytes in order to get the length of the response.
* We read exactly a quad word in order to make sure that the remaining
* reads will be aligned.
*/
memcpy_fromio(buf, priv->rsp, 8);

expected = be32_to_cpup((__be32 *)&buf[2]);
if (expected > count || expected < TPM_HEADER_SIZE)
return -EIO;

memcpy_fromio(&buf[6], &priv->rsp[6], expected - 6);
memcpy_fromio(&buf[8], &priv->rsp[8], expected - 8);

return expected;
}
Expand Down
6 changes: 6 additions & 0 deletions drivers/gpio/gpio-pxa.c
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,9 @@ static int pxa_gpio_suspend(void)
struct pxa_gpio_bank *c;
int gpio;

if (!pchip)
return 0;

for_each_gpio_bank(gpio, c, pchip) {
c->saved_gplr = readl_relaxed(c->regbase + GPLR_OFFSET);
c->saved_gpdr = readl_relaxed(c->regbase + GPDR_OFFSET);
Expand All @@ -792,6 +795,9 @@ static void pxa_gpio_resume(void)
struct pxa_gpio_bank *c;
int gpio;

if (!pchip)
return;

for_each_gpio_bank(gpio, c, pchip) {
/* restore level with set/clear */
writel_relaxed(c->saved_gplr, c->regbase + GPSR_OFFSET);
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/i2c-hid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@
#

obj-$(CONFIG_I2C_HID) += i2c-hid.o

i2c-hid-objs = i2c-hid-core.o
i2c-hid-$(CONFIG_DMI) += i2c-hid-dmi-quirks.o
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <linux/i2c/i2c-hid.h>

#include "../hid-ids.h"
#include "i2c-hid.h"

/* quirks to control the device */
#define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0)
Expand Down Expand Up @@ -724,6 +725,7 @@ static int i2c_hid_parse(struct hid_device *hid)
char *rdesc;
int ret;
int tries = 3;
char *use_override;

i2c_hid_dbg(ihid, "entering %s\n", __func__);

Expand All @@ -742,26 +744,37 @@ static int i2c_hid_parse(struct hid_device *hid)
if (ret)
return ret;

rdesc = kzalloc(rsize, GFP_KERNEL);
use_override = i2c_hid_get_dmi_hid_report_desc_override(client->name,
&rsize);

if (!rdesc) {
dbg_hid("couldn't allocate rdesc memory\n");
return -ENOMEM;
}
if (use_override) {
rdesc = use_override;
i2c_hid_dbg(ihid, "Using a HID report descriptor override\n");
} else {
rdesc = kzalloc(rsize, GFP_KERNEL);

i2c_hid_dbg(ihid, "asking HID report descriptor\n");
if (!rdesc) {
dbg_hid("couldn't allocate rdesc memory\n");
return -ENOMEM;
}

ret = i2c_hid_command(client, &hid_report_descr_cmd, rdesc, rsize);
if (ret) {
hid_err(hid, "reading report descriptor failed\n");
kfree(rdesc);
return -EIO;
i2c_hid_dbg(ihid, "asking HID report descriptor\n");

ret = i2c_hid_command(client, &hid_report_descr_cmd,
rdesc, rsize);
if (ret) {
hid_err(hid, "reading report descriptor failed\n");
kfree(rdesc);
return -EIO;
}
}

i2c_hid_dbg(ihid, "Report Descriptor: %*ph\n", rsize, rdesc);

ret = hid_parse_report(hid, rdesc, rsize);
kfree(rdesc);
if (!use_override)
kfree(rdesc);

if (ret) {
dbg_hid("parsing report descriptor failed\n");
return ret;
Expand Down Expand Up @@ -899,12 +912,19 @@ static int i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid)
int ret;

/* i2c hid fetch using a fixed descriptor size (30 bytes) */
i2c_hid_dbg(ihid, "Fetching the HID descriptor\n");
ret = i2c_hid_command(client, &hid_descr_cmd, ihid->hdesc_buffer,
sizeof(struct i2c_hid_desc));
if (ret) {
dev_err(&client->dev, "hid_descr_cmd failed\n");
return -ENODEV;
if (i2c_hid_get_dmi_i2c_hid_desc_override(client->name)) {
i2c_hid_dbg(ihid, "Using a HID descriptor override\n");
ihid->hdesc =
*i2c_hid_get_dmi_i2c_hid_desc_override(client->name);
} else {
i2c_hid_dbg(ihid, "Fetching the HID descriptor\n");
ret = i2c_hid_command(client, &hid_descr_cmd,
ihid->hdesc_buffer,
sizeof(struct i2c_hid_desc));
if (ret) {
dev_err(&client->dev, "hid_descr_cmd failed\n");
return -ENODEV;
}
}

/* Validate the length of HID descriptor, the 4 first bytes:
Expand Down
Loading

0 comments on commit fdb2709

Please sign in to comment.