Linux 4.9.98
Greg KH
maintainerI'm announcing the release of the 4.9.98 kernel.
All users of the 4.9 kernel series must upgrade.
The updated 4.9.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.9.y
and can be browsed at the normal kernel.org git web browser:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 2 arch/powerpc/kernel/eeh_driver.c | 61 +++++++++++++-------- arch/powerpc/platforms/powernv/opal-rtc.c | 8 +- arch/x86/include/uapi/asm/msgbuf.h | 31 ++++++++++ arch/x86/include/uapi/asm/shmbuf.h | 42 ++++++++++++++ arch/x86/kernel/cpu/microcode/intel.c | 2 arch/x86/kernel/smpboot.c | 2 crypto/drbg.c | 2 drivers/amba/bus.c | 17 +++--- drivers/char/random.c | 85 ++++++++++++++++++++++-------- drivers/char/virtio_console.c | 49 ++++++++--------- drivers/cpufreq/powernv-cpufreq.c | 14 +++- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 7 +- drivers/gpu/drm/virtio/virtgpu_vq.c | 4 - drivers/mtd/chips/cfi_cmdset_0001.c | 33 +++++++++-- drivers/mtd/chips/cfi_cmdset_0002.c | 9 ++- drivers/of/fdt.c | 7 +- drivers/pci/host/pci-aardvark.c | 12 ++-- drivers/rtc/rtc-opal.c | 37 ++++++++----- drivers/scsi/sd.c | 2 drivers/tty/n_gsm.c | 23 +++++++- drivers/tty/serial/earlycon.c | 6 +- drivers/tty/tty_io.c | 5 + drivers/tty/tty_ldisc.c | 16 ++--- drivers/usb/core/hcd.c | 1 drivers/usb/core/hub.c | 10 +++ drivers/usb/core/quirks.c | 3 + drivers/usb/serial/Kconfig | 1 drivers/usb/serial/cp210x.c | 1 drivers/usb/serial/ftdi_sio.c | 3 - drivers/usb/serial/usb-serial-simple.c | 7 ++ drivers/usb/usbip/stub_main.c | 5 + drivers/usb/usbip/usbip_common.h | 2 drivers/usb/usbip/usbip_event.c | 4 - fs/ext4/balloc.c | 17 +++++- fs/ext4/extents.c | 16 +++-- fs/ext4/ialloc.c | 7 ++ fs/jbd2/transaction.c | 1 include/asm-generic/vmlinux.lds.h | 2 include/linux/mtd/flashchip.h | 1 include/linux/serial_core.h | 21 ++++--- include/linux/tty.h | 2 include/linux/virtio.h | 3 + include/sound/control.h | 7 +- lib/kobject.c | 12 +--- net/ceph/messenger.c | 7 ++ net/ceph/mon_client.c | 14 +++- sound/core/pcm_native.c | 1 sound/core/seq/oss/seq_oss_event.c | 15 +++-- sound/core/seq/oss/seq_oss_midi.c | 2 sound/core/seq/oss/seq_oss_synth.c | 85 +++++++++++++++++------------- sound/core/seq/oss/seq_oss_synth.h | 3 - sound/drivers/opl3/opl3_synth.c | 7 +- sound/firewire/dice/dice-stream.c | 2 sound/firewire/dice/dice.c | 2 sound/pci/asihpi/hpimsginit.c | 13 +++- sound/pci/asihpi/hpioctl.c | 4 + sound/pci/hda/hda_hwdep.c | 12 +++- sound/pci/hda/patch_realtek.c | 2 sound/pci/rme9652/hdspm.c | 24 ++++---- sound/pci/rme9652/rme9652.c | 6 +- sound/soc/fsl/fsl_esai.c | 7 ++ sound/usb/mixer_maps.c | 3 + tools/lib/str_error_r.c | 2 tools/lib/subcmd/pager.c | 5 + 65 files changed, 586 insertions(+), 232 deletions(-)
Arnd Bergmann (1):
x86/ipc: Fix x32 version of shmid64_ds and msqid64_ds
Borislav Petkov (1):
x86/microcode/intel: Save microcode patch unconditionally
Collin May (1):
USB: serial: simple: add libtransistor console
Daniel Kurtz (1):
earlycon: Use a pointer table to fix __earlycon_table stride
David Henningsson (1):
ALSA: core: Report audio_tstamp in snd_pcm_sync_ptr
Dmitry Vyukov (1):
kobject: don't use WARN for registration failures
Eric Biggers (1):
ext4: prevent right-shifting extents beyond EXT_MAX_BLOCKS
Evan Wang (1):
PCI: aardvark: Fix PCIe Max Read Request Size setting
Geert Uytterhoeven (3):
ARM: amba: Make driver_override output consistent with other buses
ARM: amba: Fix race condition with driver_override
ARM: amba: Don't read past the end of sysfs "driver_override" buffer
Gerd Hoffmann (1):
drm/virtio: fix vq wait_event condition
Greg Kroah-Hartman (1):
Linux 4.9.98
Ilya Dryomov (3):
libceph: un-backoff on tick when we have a authenticated session
libceph: reschedule a tick in finish_hunting()
libceph: validate con->state at the top of try_write()
Joakim Tjernlund (3):
mtd: cfi: cmdset_0001: Do not allow read/write to suspend erase block.
mtd: cfi: cmdset_0001: Workaround Micron Erase suspend bug.
mtd: cfi: cmdset_0002: Do not allow read/write to suspend erase block.
Josh Poimboeuf (1):
objtool, perf: Fix GCC 8 -Wrestrict error
Kailang Yang (1):
ALSA: hda/realtek - Add some fixes for ALC233
Kamil Lulko (1):
usb: core: Add quirk for HP v222w 16GB Mini
Kyle Roeschley (1):
USB: serial: cp210x: add ID for NI USB serial console
Lukas Czerner (1):
ext4: fix bitmap position validation
Mahesh Rajashekhara (1):
scsi: sd: Defer spinning up drive while SANITIZE is in progress
Michael Neuling (1):
powerpc/eeh: Fix race with driver un/bind
Michael S. Tsirkin (2):
virtio: add ability to iterate over vqs
virtio_console: free buffers after reset
Nicholas Piggin (1):
rtc: opal: Fix OPAL RTC driver OPAL_BUSY loops
Nicolai Hähnle (1):
drm/amdgpu: set COMPUTE_PGM_RSRC1 for SGPR/VGPR clearing shaders
Nicolin Chen (1):
ASoC: fsl_esai: Fix divisor calculation failure at lower ratio
Ravi Chandra Sadineni (1):
USB: Increment wakeup count on remote wakeup.
Sergey Senozhatsky (1):
tools/lib/subcmd/pager.c: do not alias select() params
Shilpasri G Bhat (1):
cpufreq: powernv: Fix hardlockup due to synchronous smp_call in timer interrupt
Shuah Khan (3):
usbip: usbip_event: fix to not print kernel pointer address
usbip: usbip_host: fix to hold parent lock for device_attach() calls
usbip: vhci_hcd: Fix usb device and sockfd leaks
Stephan Mueller (1):
crypto: drbg - set freed buffers to NULL
Takashi Iwai (9):
ALSA: usb-audio: Skip broken EU on Dell dock USB-audio
ALSA: opl3: Hardening for potential Spectre v1
ALSA: asihpi: Hardening for potential Spectre v1
ALSA: hdspm: Hardening for potential Spectre v1
ALSA: rme9652: Hardening for potential Spectre v1
ALSA: control: Hardening for potential Spectre v1
ALSA: seq: oss: Fix unbalanced use lock for synth MIDI device
ALSA: seq: oss: Hardening for potential Spectre v1
ALSA: hda: Hardening for potential Spectre v1
Takashi Sakamoto (2):
ALSA: dice: fix OUI for TC group
ALSA: dice: fix error path to destroy initialized stream data
Tetsuo Handa (2):
tty: Don't call panic() at tty_ldisc_init()
tty: Use __GFP_NOFAIL for tty_ldisc_get()
Theodore Ts'o (5):
ext4: set h_journal if there is a failure starting a reserved handle
ext4: add validity checks for bitmap block numbers
random: set up the NUMA crng instances after the CRNG is fully initialized
random: fix possible sleeping allocation from irq context
random: rate limit unseeded randomness warnings
Tony Lindgren (2):
tty: n_gsm: Fix long delays with control frame timeouts in ADM mode
tty: n_gsm: Fix DLCI handling for ADM mode if debug & 2 is not set
Vasyl Vavrychuk (1):
USB: serial: ftdi_sio: use jtag quirk for Arrow USB Blaster
Victor Gu (2):
PCI: aardvark: Fix logic in advk_pcie_{rd,wr}_conf()
PCI: aardvark: Set PIO_ADDR_LS correctly in advk_pcie_rd_conf()
Yazen Ghannam (1):
x86/smpboot: Don't use mwait_play_dead() on AMD systems
Greg KH
maintainerMakefile +1 -1
@@ -1,6 +1,6 @@ VERSION = 4 PATCHLEVEL = 9 -SUBLEVEL = 97 +SUBLEVEL = 98 EXTRAVERSION = NAME = Roaring Lionus
arch/powerpc/kernel/eeh_driver.c +38 -23
157 lines not on this page · raw message
arch/powerpc/platforms/powernv/opal-rtc.c +5 -3
@@ -48,10 +48,12 @@ unsigned long __init opal_get_boot_time(void)while (rc ==OPAL_BUSY || rc ==OPAL_BUSY_EVENT ) { rc =opal_rtc_read (&__y_m_d, &__h_m_s_ms); -if (rc ==OPAL_BUSY_EVENT ) +if (rc ==OPAL_BUSY_EVENT ) { +mdelay (OPAL_BUSY_DELAY_MS );opal_poll_events (NULL ); -else if (rc ==OPAL_BUSY ) -mdelay (10 ); + }else if (rc ==OPAL_BUSY ) { +mdelay (OPAL_BUSY_DELAY_MS ); + } }if (rc !=OPAL_SUCCESS )return 0 ;
arch/x86/include/uapi/asm/msgbuf.h +31 -0
@@ -1 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ +#ifndef __ASM_X64_MSGBUF_H +#define __ASM_X64_MSGBUF_H + +#if !defined(__x86_64__) || !defined(__ILP32__)#include <asm-generic/msgbuf.h> +#else +/* +* The msqid64_ds structure for x86 architecture with x32 ABI. +* +* On x86-32 and x86-64 we can just use the generic definition, but +* x32 uses the same binary layout as x86_64, which is differnet +* from other 32-bit architectures. +*/ + +struct msqid64_ds { +struct ipc64_perm msg_perm; +__kernel_time_t msg_stime;/* last msgsnd time */ +__kernel_time_t msg_rtime;/* last msgrcv time */ +__kernel_time_t msg_ctime;/* last change time */ +__kernel_ulong_t msg_cbytes;/* current number of bytes on queue */ +__kernel_ulong_t msg_qnum;/* number of messages in queue */ +__kernel_ulong_t msg_qbytes;/* max number of bytes on queue */ +__kernel_pid_t msg_lspid;/* pid of last msgsnd */ +__kernel_pid_t msg_lrpid;/* last receive pid */ +__kernel_ulong_t __unused4; +__kernel_ulong_t __unused5; +}; + +#endif + +#endif /* __ASM_GENERIC_MSGBUF_H */
arch/x86/include/uapi/asm/shmbuf.h +42 -0
43 lines not on this page · raw message
arch/x86/kernel/cpu/microcode/intel.c +0 -2
@@ -474,7 +474,6 @@ static void show_saved_mc(void)*/ static void save_mc_for_early (u8 *mc) { -#ifdef CONFIG_HOTPLUG_CPU /* Synchronization during CPU hotplug. */ static DEFINE_MUTEX (x86_cpu_microcode_mutex);
@@ -521,7 +520,6 @@ static void save_mc_for_early(u8 *mc) out:mutex_unlock (&x86_cpu_microcode_mutex); -#endif }static bool __init load_builtin_intel_microcode (struct cpio_data *cp)
arch/x86/kernel/smpboot.c +2 -0
@@ -1591,6 +1591,8 @@ static inline void mwait_play_dead(void)void *mwait_ptr;int i; +if (boot_cpu_data.x86_vendor ==X86_VENDOR_AMD ) +return ;if (!this_cpu_has (X86_FEATURE_MWAIT ))return ;if (!this_cpu_has (X86_FEATURE_CLFLUSH ))
crypto/drbg.c +2 -0
@@ -1134,8 +1134,10 @@ static inline void drbg_dealloc_state(struct drbg_state *drbg)if (!drbg)return ;kzfree (drbg->Vbuf); + drbg->Vbuf =NULL ; drbg->V =NULL ;kzfree (drbg->Cbuf); + drbg->Cbuf =NULL ; drbg->C =NULL ;kzfree (drbg->scratchpadbuf); drbg->scratchpadbuf =NULL ;
drivers/amba/bus.c +11 -6
@@ -69,11 +69,12 @@ static ssize_t driver_override_show(struct device *_dev, struct device_attribute *attr, char *buf) { struct amba_device *dev = to_amba_device(_dev); +ssize_t len; -if (!dev->driver_override) -return 0 ; - -return sprintf (buf,"%s\n" , dev->driver_override); +device_lock (_dev); + len =sprintf (buf,"%s\n" , dev->driver_override); +device_unlock (_dev); +return len; } static ssize_t driver_override_store(struct device *_dev,
@@ -81,9 +82,10 @@ static ssize_t driver_override_store(struct device *_dev, const char *buf, size_t count) {struct amba_device *dev =to_amba_device (_dev); -char *driver_override, *old = dev->driver_override, *cp; +char *driver_override, *old, *cp; -if (count >PATH_MAX ) +/* We need to keep extra room for a newline */ +if (count >= (PAGE_SIZE -1 ))return -EINVAL ; driver_override =kstrndup (buf, count,GFP_KERNEL );
@@ -94,12 +96,15 @@ static ssize_t driver_override_store(struct device *_dev,if (cp) *cp ='\0' ; +device_lock (_dev); + old = dev->driver_override;if (strlen (driver_override)) { dev->driver_override = driver_override; }else {kfree (driver_override); dev->driver_override =NULL ; } +device_unlock (_dev);kfree (old);
drivers/char/random.c +64 -21
130 lines not on this page · raw message
drivers/char/virtio_console.c +24 -25
100 lines not on this page · raw message
drivers/cpufreq/powernv-cpufreq.c +11 -3
@@ -599,6 +599,16 @@ void gpstate_timer_handler(unsigned long data)if (!spin_trylock (&gpstates->gpstate_lock))return ; +/* +* If the timer has migrated to the different cpu then bring +* it back to one of the policy->cpus +*/ +if (!cpumask_test_cpu (raw_smp_processor_id (), policy->cpus)) { + gpstates->timer.expires = jiffies +msecs_to_jiffies (1 ); +add_timer_on (&gpstates->timer,cpumask_first (policy->cpus)); +spin_unlock (&gpstates->gpstate_lock); +return ; + } gpstates->last_sampled_time += time_diff; gpstates->elapsed_time += time_diff;
@@ -626,10 +636,8 @@ void gpstate_timer_handler(unsigned long data) gpstates->last_gpstate_idx =pstate_to_idx (freq_data.gpstate_id); gpstates->last_lpstate_idx =pstate_to_idx (freq_data.pstate_id); +set_pstate (&freq_data);spin_unlock (&gpstates->gpstate_lock); - -/* Timer may get migrated to a different cpu on cpu hot unplug */ -smp_call_function_any (policy->cpus, set_pstate, &freq_data,1 ); }/*
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +5 -2
@@ -1484,10 +1484,11 @@ static const u32 sgpr_init_compute_shader[] =static const u32 vgpr_init_regs[] = { mmCOMPUTE_STATIC_THREAD_MGMT_SE0,0xffffffff , - mmCOMPUTE_RESOURCE_LIMITS,0 , + mmCOMPUTE_RESOURCE_LIMITS,0x1000000 ,/* CU_GROUP_COUNT=1 */ mmCOMPUTE_NUM_THREAD_X,256 *4 , mmCOMPUTE_NUM_THREAD_Y,1 , mmCOMPUTE_NUM_THREAD_Z,1 , + mmCOMPUTE_PGM_RSRC1,0x100004f ,/* VGPRS=15 (64 logical VGPRs), SGPRS=1 (16 SGPRs), BULKY=1 */ mmCOMPUTE_PGM_RSRC2,20 , mmCOMPUTE_USER_DATA_0,0xedcedc00 , mmCOMPUTE_USER_DATA_1,0xedcedc01 ,
@@ -1504,10 +1505,11 @@ static const u32 vgpr_init_regs[] =static const u32 sgpr1_init_regs[] = { mmCOMPUTE_STATIC_THREAD_MGMT_SE0,0x0f , - mmCOMPUTE_RESOURCE_LIMITS,0x1000000 , + mmCOMPUTE_RESOURCE_LIMITS,0x1000000 ,/* CU_GROUP_COUNT=1 */ mmCOMPUTE_NUM_THREAD_X,256 *5 , mmCOMPUTE_NUM_THREAD_Y,1 , mmCOMPUTE_NUM_THREAD_Z,1 , + mmCOMPUTE_PGM_RSRC1,0x240 ,/* SGPRS=9 (80 GPRS) */ mmCOMPUTE_PGM_RSRC2,20 , mmCOMPUTE_USER_DATA_0,0xedcedc00 , mmCOMPUTE_USER_DATA_1,0xedcedc01 ,
@@ -1528,6 +1530,7 @@ static const u32 sgpr2_init_regs[] = mmCOMPUTE_NUM_THREAD_X,256 *5 , mmCOMPUTE_NUM_THREAD_Y,1 , mmCOMPUTE_NUM_THREAD_Z,1 , + mmCOMPUTE_PGM_RSRC1,0x240 ,/* SGPRS=9 (80 GPRS) */ mmCOMPUTE_PGM_RSRC2,20 , mmCOMPUTE_USER_DATA_0,0xedcedc00 , mmCOMPUTE_USER_DATA_1, 0xedcedc01,
drivers/gpu/drm/virtio/virtgpu_vq.c +2 -2
@@ -324,7 +324,7 @@ static int virtio_gpu_queue_ctrl_buffer_locked(struct virtio_gpu_device *vgdev, ret =virtqueue_add_sgs (vq, sgs, outcnt, incnt, vbuf,GFP_ATOMIC );if (ret == -ENOSPC ) {spin_unlock (&vgdev->ctrlq.qlock); -wait_event (vgdev->ctrlq.ack_queue, vq->num_free); +wait_event (vgdev->ctrlq.ack_queue, vq->num_free >= outcnt + incnt);spin_lock (&vgdev->ctrlq.qlock); goto retry; }else {
@@ -399,7 +399,7 @@ static int virtio_gpu_queue_cursor(struct virtio_gpu_device *vgdev, ret =virtqueue_add_sgs (vq, sgs, outcnt,0 , vbuf,GFP_ATOMIC );if (ret == -ENOSPC ) {spin_unlock (&vgdev->cursorq.qlock); -wait_event (vgdev->cursorq.ack_queue, vq->num_free); +wait_event (vgdev->cursorq.ack_queue, vq->num_free >= outcnt);spin_lock (&vgdev->cursorq.qlock); goto retry; }else {
drivers/mtd/chips/cfi_cmdset_0001.c +28 -5
@@ -45,6 +45,7 @@#define I82802AB 0x00ad#define I82802AC 0x00ac#define PF38F4476 0x881c +#define M28F00AP30 0x8963/* STMicroelectronics chips */ #define M50LPW080 0x002F#define M50FLW080A 0x0080
@@ -375,6 +376,17 @@ static void cfi_fixup_major_minor(struct cfi_private *cfi, extp->MinorVersion ='1' ; } +static int cfi_is_micron_28F00AP30 (struct cfi_private *cfi,struct flchip *chip) +{ +/* +* Micron(was Numonyx) 1Gbit bottom boot are buggy w.r.t +* Erase Supend for their small Erase Blocks(0x8000) +*/ +if (cfi->mfr ==CFI_MFR_INTEL && cfi->id ==M28F00AP30 ) +return 1 ; +return 0 ; +} +static inline struct cfi_pri_intelext *read_pri_intelext (struct map_info *map,__u16 adr) {
@@ -831,21 +843,30 @@ static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long (mode == FL_WRITING && (cfip->SuspendCmdSupport & 1)))) goto sleep; +/* Do not allow suspend iff read/write to EB address */ +if ((adr & chip->in_progress_block_mask) == + chip->in_progress_block_addr) + goto sleep; + +/* do not suspend small EBs, buggy Micron Chips */ +if (cfi_is_micron_28F00AP30 (cfi, chip) && + (chip->in_progress_block_mask == ~(0x8000 -1 ))) + goto sleep;/* Erase suspend */ -map_write (map,CMD (0xB0 ), adr); +map_write (map,CMD (0xB0 ), chip->in_progress_block_addr);/* If the flash has finished erasing, then 'erase suspend' * appears to make some (28F320) flash devices switch to * 'read' mode. Make sure that we switch to 'read status' * mode so we get the right data. --rmk */ -map_write (map,CMD (0x70 ), adr); +map_write (map,CMD (0x70 ), chip->in_progress_block_addr); chip->oldstate =FL_ERASING ; chip->state =FL_ERASE_SUSPENDING ; chip->erase_suspended =1 ;for (;;) { - status =map_read (map, adr); + status =map_read (map, chip->in_progress_block_addr);if (map_word_andequal (map, status, status_OK, status_OK))break ;
@@ -1041,8 +1062,8 @@ static void put_chip(struct map_info *map, struct flchip *chip, unsigned long adsending the 0x70 (Read Status) command to an erasing chip and expecting it to be ignored, that's what we do. */ -map_write (map,CMD (0xd0 ), adr); -map_write (map,CMD (0x70 ), adr); +map_write (map,CMD (0xd0 ), chip->in_progress_block_addr); +map_write (map,CMD (0x70 ), chip->in_progress_block_addr); chip->oldstate =FL_READY ; chip->state =FL_ERASING ;break ;
@@ -1933,6 +1954,8 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip,map_write (map,CMD (0xD0 ), adr); chip->state =FL_ERASING ; chip->erase_suspended =0 ; + chip->in_progress_block_addr = adr; + chip->in_progress_block_mask = ~(len -1 ); ret = INVAL_CACHE_AND_WAIT(map, chip, adr, adr, len,
drivers/mtd/chips/cfi_cmdset_0002.c +6 -3
@@ -812,9 +812,10 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr (mode == FL_WRITING && (cfip->EraseSuspend & 0x2)))) goto sleep; -/* We could check to see if we're trying to access the sector -* that is currently being erased. However, no user will try -* anything like that so we just wait for the timeout. */ +/* Do not allow suspend iff read/write to EB address */ +if ((adr & chip->in_progress_block_mask) == + chip->in_progress_block_addr) + goto sleep;/* Erase suspend */ /* It's harmless to issue the Erase-Suspend and Erase-Resume
@@ -2263,6 +2264,7 @@ static int __xipram do_erase_chip(struct map_info *map, struct flchip *chip) chip->state =FL_ERASING ; chip->erase_suspended =0 ; chip->in_progress_block_addr = adr; + chip->in_progress_block_mask = ~(map->size -1 ); INVALIDATE_CACHE_UDELAY(map, chip, adr, map->size,
@@ -2352,6 +2354,7 @@ static int __xipram do_erase_oneblock(struct map_info *map, struct flchip *chip, chip->state =FL_ERASING ; chip->erase_suspended =0 ; chip->in_progress_block_addr = adr; + chip->in_progress_block_mask = ~(len -1 ); INVALIDATE_CACHE_UDELAY(map, chip, adr, len,
drivers/of/fdt.c +5 -2
@@ -935,7 +935,7 @@ int __init early_init_dt_scan_chosen_stdout(void)int offset;const char *p, *q, *options =NULL ;int l; -const struct earlycon_id *match; +const struct earlycon_id **p_match;const void *fdt = initial_boot_params; offset =fdt_path_offset (fdt,"/chosen" );
@@ -962,7 +962,10 @@ int __init early_init_dt_scan_chosen_stdout(void)return 0 ; } -for (match = __earlycon_table; match < __earlycon_table_end; match++) { +for (p_match = __earlycon_table; p_match < __earlycon_table_end; + p_match++) { +const struct earlycon_id *match = *p_match; +if (!match->compatible[0 ])continue ;
drivers/pci/host/pci-aardvark.c +6 -6
@@ -32,6 +32,7 @@#define PCIE_CORE_DEV_CTRL_STATS_MAX_PAYLOAD_SZ_SHIFT 5#define PCIE_CORE_DEV_CTRL_STATS_SNOOP_DISABLE (0 << 11)#define PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SIZE_SHIFT 12 +#define PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SZ 0x2#define PCIE_CORE_LINK_CTRL_STAT_REG 0xd0#define PCIE_CORE_LINK_L0S_ENTRY BIT(0)#define PCIE_CORE_LINK_TRAINING BIT(5)
@@ -175,8 +176,6 @@#define PCIE_CONFIG_WR_TYPE0 0xa#define PCIE_CONFIG_WR_TYPE1 0xb -/* PCI_BDF shifts 8bit, so we need extra 4bit shift */ -#define PCIE_BDF (dev) (dev << 4)#define PCIE_CONF_BUS (bus) (((bus) & 0xff) << 20)#define PCIE_CONF_DEV (dev) (((dev) & 0x1f) << 15)#define PCIE_CONF_FUNC (fun) (((fun) & 0x7) << 12)
@@ -298,7 +297,8 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) reg =PCIE_CORE_DEV_CTRL_STATS_RELAX_ORDER_DISABLE | (7 <<PCIE_CORE_DEV_CTRL_STATS_MAX_PAYLOAD_SZ_SHIFT ) |PCIE_CORE_DEV_CTRL_STATS_SNOOP_DISABLE | -PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SIZE_SHIFT ; + (PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SZ << +PCIE_CORE_DEV_CTRL_STATS_MAX_RD_REQ_SIZE_SHIFT );advk_writel (pcie, reg,PCIE_CORE_DEV_CTRL_STATS_REG );/* Program PCIe Control 2 to disable strict ordering */
@@ -439,7 +439,7 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,u32 reg;int ret; -if (PCI_SLOT (devfn) !=0 ) { +if ((bus->number == pcie->root_bus_nr) &&PCI_SLOT (devfn) !=0 ) { *val =0xffffffff ;return PCIBIOS_DEVICE_NOT_FOUND ; }
@@ -458,7 +458,7 @@ static int advk_pcie_rd_conf(struct pci_bus *bus, u32 devfn,advk_writel (pcie, reg,PIO_CTRL );/* Program the address registers */ - reg =PCIE_BDF (devfn) |PCIE_CONF_REG (where); + reg =PCIE_CONF_ADDR (bus->number, devfn, where);advk_writel (pcie, reg,PIO_ADDR_LS );advk_writel (pcie,0 ,PIO_ADDR_MS );
@@ -493,7 +493,7 @@ static int advk_pcie_wr_conf(struct pci_bus *bus, u32 devfn,int offset;int ret; -if (PCI_SLOT (devfn) !=0 ) +if ((bus->number == pcie->root_bus_nr) &&PCI_SLOT (devfn) !=0 )return PCIBIOS_DEVICE_NOT_FOUND ;if (where % size)
drivers/rtc/rtc-opal.c +23 -14
@@ -57,7 +57,7 @@ static void tm_to_opal(struct rtc_time *tm, u32 *y_m_d, u64 *h_m_s_ms)static int opal_get_rtc_time (struct device *dev,struct rtc_time *tm) { -long rc =OPAL_BUSY ; +s64 rc =OPAL_BUSY ;int retries =10 ;u32 y_m_d;u64 h_m_s_ms;
@@ -66,13 +66,17 @@ static int opal_get_rtc_time(struct device *dev, struct rtc_time *tm)while (rc ==OPAL_BUSY || rc ==OPAL_BUSY_EVENT ) { rc =opal_rtc_read (&__y_m_d, &__h_m_s_ms); -if (rc ==OPAL_BUSY_EVENT ) +if (rc ==OPAL_BUSY_EVENT ) { +msleep (OPAL_BUSY_DELAY_MS );opal_poll_events (NULL ); -else if (retries-- && (rc ==OPAL_HARDWARE - || rc ==OPAL_INTERNAL_ERROR )) -msleep (10 ); -else if (rc !=OPAL_BUSY && rc !=OPAL_BUSY_EVENT ) -break ; + }else if (rc ==OPAL_BUSY ) { +msleep (OPAL_BUSY_DELAY_MS ); + }else if (rc ==OPAL_HARDWARE || rc ==OPAL_INTERNAL_ERROR ) { +if (retries--) { +msleep (10 );/* Wait 10ms before retry */ + rc =OPAL_BUSY ;/* go around again */ + } + } }if (rc !=OPAL_SUCCESS )
@@ -87,21 +91,26 @@ static int opal_get_rtc_time(struct device *dev, struct rtc_time *tm)static int opal_set_rtc_time (struct device *dev,struct rtc_time *tm) { -long rc =OPAL_BUSY ; +s64 rc =OPAL_BUSY ;int retries =10 ;u32 y_m_d =0 ;u64 h_m_s_ms =0 ;tm_to_opal (tm, &y_m_d, &h_m_s_ms); +while (rc ==OPAL_BUSY || rc ==OPAL_BUSY_EVENT ) { rc =opal_rtc_write (y_m_d, h_m_s_ms); -if (rc ==OPAL_BUSY_EVENT ) +if (rc ==OPAL_BUSY_EVENT ) { +msleep (OPAL_BUSY_DELAY_MS );opal_poll_events (NULL ); -else if (retries-- && (rc ==OPAL_HARDWARE - || rc ==OPAL_INTERNAL_ERROR )) -msleep (10 ); -else if (rc !=OPAL_BUSY && rc !=OPAL_BUSY_EVENT ) -break ; + }else if (rc ==OPAL_BUSY ) { +msleep (OPAL_BUSY_DELAY_MS ); + }else if (rc ==OPAL_HARDWARE || rc ==OPAL_INTERNAL_ERROR ) { +if (retries--) { +msleep (10 );/* Wait 10ms before retry */ + rc =OPAL_BUSY ;/* go around again */ + } + } }return rc ==OPAL_SUCCESS ?0 : -EIO ;
drivers/scsi/sd.c +2 -0
@@ -1935,6 +1935,8 @@ sd_spinup_disk(struct scsi_disk *sdkp)break ;/* standby */ if (sshdr.asc ==4 && sshdr.ascq ==0xc )break ;/* unavailable */ +if (sshdr.asc ==4 && sshdr.ascq ==0x1b ) +break ;/* sanitize in progress */ /* * Issue command to spin up drive when not ready */
drivers/tty/n_gsm.c +22 -1
@@ -137,6 +137,9 @@ struct gsm_dlci {struct mutex mutex;/* Link layer */ +int mode; +#define DLCI_MODE_ABM 0/* Normal Asynchronous Balanced Mode */ +#define DLCI_MODE_ADM 1/* Asynchronous Disconnected Mode */ spinlock_t lock;/* Protects the internal state */ struct timer_list t1;/* Retransmit timer for SABM and UA */ int retries;
@@ -1380,7 +1383,13 @@ static struct gsm_control *gsm_control_send(struct gsm_mux *gsm, ctrl->data = data; ctrl->len = clen; gsm->pending_cmd = ctrl; - gsm->cretries = gsm->n2; + +/* If DLCI0 is in ADM mode skip retries, it won't respond */ +if (gsm->dlci[0 ]->mode ==DLCI_MODE_ADM ) + gsm->cretries =1 ; +else + gsm->cretries = gsm->n2; +mod_timer (&gsm->t2_timer, jiffies + gsm->t2 *HZ /100 );gsm_control_transmit (gsm, ctrl);spin_unlock_irqrestore (&gsm->control_lock, flags);
@@ -1488,6 +1497,7 @@ static void gsm_dlci_t1(unsigned long data)if (debug &8 )pr_info ("DLCI %d opening in ADM mode.\n" , dlci->addr); + dlci->mode =DLCI_MODE_ADM ;gsm_dlci_open (dlci); }else {gsm_dlci_close (dlci);
@@ -2865,11 +2875,22 @@ static int gsmtty_modem_update(struct gsm_dlci *dlci, u8 brk)static int gsm_carrier_raised (struct tty_port *port) { struct gsm_dlci *dlci = container_of(port, struct gsm_dlci, port); +struct gsm_mux *gsm = dlci->gsm; +/* Not yet open so no carrier info */ if (dlci->state !=DLCI_OPEN )return 0 ;if (debug &2 )return 1 ; + +/* +* Basic mode with control channel in ADM mode may not respond +* to CMD_MSC at all and modem_rx is empty. +*/ +if (gsm->encoding ==0 && gsm->dlci[0 ]->mode ==DLCI_MODE_ADM && + !dlci->modem_rx) +return 1 ; +return dlci->modem_rx &TIOCM_CD ; }
drivers/tty/serial/earlycon.c +4 -2
@@ -172,7 +172,7 @@ static int __init register_earlycon(char *buf, const struct earlycon_id *match)*/ int __init setup_earlycon (char *buf) { -const struct earlycon_id *match; +const struct earlycon_id **p_match;if (!buf || !buf[0 ])return -EINVAL ;
@@ -180,7 +180,9 @@ int __init setup_earlycon(char *buf)if (early_con.flags &CON_ENABLED )return -EALREADY ; -for (match = __earlycon_table; match < __earlycon_table_end; match++) { +for (p_match = __earlycon_table; p_match < __earlycon_table_end; + p_match++) { +const struct earlycon_id *match = *p_match;size_t len =strlen (match->name);if (strncmp (buf, match->name, len))
drivers/tty/tty_io.c +4 -1
@@ -3170,7 +3170,10 @@ struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx)kref_init (&tty->kref); tty->magic =TTY_MAGIC ; -tty_ldisc_init (tty); +if (tty_ldisc_init (tty)) { +kfree (tty); +return NULL ; + } tty->session =NULL ; tty->pgrp =NULL ;mutex_init (&tty->legacy_mutex);
drivers/tty/tty_ldisc.c +8 -8
@@ -175,12 +175,11 @@ static struct tty_ldisc *tty_ldisc_get(struct tty_struct *tty, int disc)return ERR_CAST (ldops); } - ld =kmalloc (sizeof (struct tty_ldisc ),GFP_KERNEL ); -if (ld ==NULL ) { -put_ldops (ldops); -return ERR_PTR (-ENOMEM ); - } - +/* +* There is no way to handle allocation failure of only 16 bytes. +* Let's simplify error handling and save more memory. +*/ + ld =kmalloc (sizeof (struct tty_ldisc ),GFP_KERNEL | __GFP_NOFAIL); ld->ops = ldops; ld->tty = tty;
@@ -753,12 +752,13 @@ void tty_ldisc_release(struct tty_struct *tty)* the tty structure is not completely set up when this call is made. */ -void tty_ldisc_init (struct tty_struct *tty) +int tty_ldisc_init (struct tty_struct *tty) {struct tty_ldisc *ld =tty_ldisc_get (tty,N_TTY );if (IS_ERR (ld)) -panic ("n_tty: init_tty" ); +return PTR_ERR (ld); tty->ldisc = ld; +return 0 ; }/**
drivers/usb/core/hcd.c +1 -0
@@ -2365,6 +2365,7 @@ void usb_hcd_resume_root_hub (struct usb_hcd *hcd)spin_lock_irqsave (&hcd_root_hub_lock, flags);if (hcd->rh_registered) { +pm_wakeup_event (&hcd->self.root_hub->dev,0 );set_bit (HCD_FLAG_WAKEUP_PENDING , &hcd->flags);queue_work (pm_wq, &hcd->wakeup_work); }
drivers/usb/core/hub.c +9 -1
@@ -648,12 +648,17 @@ void usb_wakeup_notification(struct usb_device *hdev, unsigned int portnum) {struct usb_hub *hub; +struct usb_port *port_dev;if (!hdev)return ; hub =usb_hub_to_struct_hub (hdev);if (hub) { + port_dev = hub->ports[portnum -1 ]; +if (port_dev && port_dev->child) +pm_wakeup_event (&port_dev->child->dev,0 ); +set_bit (portnum, hub->wakeup_bits);kick_hub_wq (hub); }
@@ -3417,8 +3422,11 @@ int usb_port_resume(struct usb_device *udev, pm_message_t msg)/* Skip the initial Clear-Suspend step for a remote wakeup */ status =hub_port_status (hub, port1, &portstatus, &portchange); -if (status ==0 && !port_is_suspended (hub, portstatus)) +if (status ==0 && !port_is_suspended (hub, portstatus)) { +if (portchange &USB_PORT_STAT_C_SUSPEND ) +pm_wakeup_event (&udev->dev,0 ); goto SuspendCleared; + }/* see 7.1.7.7; affects power usage, but not budgeting */ if (hub_is_superspeed (hub->hdev))
drivers/usb/core/quirks.c +3 -0
@@ -45,6 +45,9 @@ static const struct usb_device_id usb_quirk_list[] = { { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 }, + /* HP v222w 16GB Mini USB Drive */ + { USB_DEVICE(0x03f0, 0x3f40), .driver_info = USB_QUIRK_DELAY_INIT }, + /* Creative SB Audigy 2 NX */ { USB_DEVICE(0x041e, 0x3020), .driver_info = USB_QUIRK_RESET_RESUME },
drivers/usb/serial/Kconfig +1 -0
@@ -62,6 +62,7 @@ config USB_SERIAL_SIMPLE - Fundamental Software dongle. - Google USB serial devices - HP4x calculators + - Libtransistor USB console - a number of Motorola phones - Motorola Tetra devices - Novatel Wireless GPS receivers
drivers/usb/serial/cp210x.c +1 -0
@@ -211,6 +211,7 @@ static const struct usb_device_id id_table[] = { { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ { USB_DEVICE(0x3195, 0xF280) }, /* Link Instruments MSO-28 */ { USB_DEVICE(0x3195, 0xF281) }, /* Link Instruments MSO-28 */ + { USB_DEVICE(0x3923, 0x7A0B) }, /* National Instruments USB Serial Console */ { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ { } /* Terminating Entry */ };
drivers/usb/serial/ftdi_sio.c +2 -1
@@ -1911,7 +1911,8 @@ static int ftdi_8u2232c_probe(struct usb_serial *serial)return ftdi_jtag_probe (serial);if (udev->product && - (!strcmp (udev->product,"BeagleBone/XDS100V2" ) || + (!strcmp (udev->product,"Arrow USB Blaster" ) || + !strcmp (udev->product,"BeagleBone/XDS100V2" ) || !strcmp (udev->product,"SNAP Connect E10" )))return ftdi_jtag_probe (serial);
drivers/usb/serial/usb-serial-simple.c +7 -0
@@ -66,6 +66,11 @@ DEVICE(flashloader, FLASHLOADER_IDS); 0x01) }DEVICE (google,GOOGLE_IDS ); +/* Libtransistor USB console */ +#define LIBTRANSISTOR_IDS () \ + { USB_DEVICE(0x1209, 0x8b00) } +DEVICE (libtransistor,LIBTRANSISTOR_IDS ); +/* ViVOpay USB Serial Driver */ #define VIVOPAY_IDS () \ { USB_DEVICE(0x1d5f, 0x1004) }/* ViVOpay 8800 */
@@ -113,6 +118,7 @@ static struct usb_serial_driver * const serial_drivers[] = { &funsoft_device, &flashloader_device, &google_device, + &libtransistor_device, &vivopay_device, &moto_modem_device, &motorola_tetra_device,
@@ -129,6 +135,7 @@ static const struct usb_device_id id_table[] = {FUNSOFT_IDS (),FLASHLOADER_IDS (),GOOGLE_IDS (), +LIBTRANSISTOR_IDS (),VIVOPAY_IDS (),MOTO_IDS (), MOTOROLA_TETRA_IDS(),
drivers/usb/usbip/stub_main.c +5 -0
@@ -201,7 +201,12 @@ static ssize_t rebind_store(struct device_driver *dev, const char *buf,if (!bid)return -ENODEV ; +/* device_attach() callers should hold parent lock for USB */ +if (bid->udev->dev.parent) +device_lock (bid->udev->dev.parent); ret =device_attach (&bid->udev->dev); +if (bid->udev->dev.parent) +device_unlock (bid->udev->dev.parent);if (ret <0 ) {dev_err (&bid->udev->dev,"rebind failed\n" );return ret;
drivers/usb/usbip/usbip_common.h +1 -1
@@ -258,7 +258,7 @@ enum usbip_side {#define VUDC_EVENT_ERROR_USB (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE)#define VUDC_EVENT_ERROR_MALLOC (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE) -#define VDEV_EVENT_REMOVED (USBIP_EH_SHUTDOWN | USBIP_EH_BYE) +#define VDEV_EVENT_REMOVED (USBIP_EH_SHUTDOWN | USBIP_EH_RESET | USBIP_EH_BYE)#define VDEV_EVENT_DOWN (USBIP_EH_SHUTDOWN | USBIP_EH_RESET)#define VDEV_EVENT_ERROR_TCP (USBIP_EH_SHUTDOWN | USBIP_EH_RESET)#define VDEV_EVENT_ERROR_MALLOC (USBIP_EH_SHUTDOWN | USBIP_EH_UNUSABLE)
drivers/usb/usbip/usbip_event.c +0 -4
@@ -105,10 +105,6 @@ static void event_handler(struct work_struct *work)unset_event (ud,USBIP_EH_UNUSABLE ); } -/* Stop the error handler. */ -if (ud->event &USBIP_EH_BYE ) -usbip_dbg_eh ("removed %p\n" , ud); -wake_up (&ud->eh_waitq); } }
fs/ext4/balloc.c +15 -2
@@ -320,6 +320,7 @@ static ext4_fsblk_t ext4_valid_block_bitmap(struct super_block *sb,struct ext4_sb_info *sbi =EXT4_SB (sb);ext4_grpblk_t offset;ext4_grpblk_t next_zero_bit; +ext4_grpblk_t max_bit =EXT4_CLUSTERS_PER_GROUP (sb);ext4_fsblk_t blk;ext4_fsblk_t group_first_block;
@@ -337,20 +338,25 @@ static ext4_fsblk_t ext4_valid_block_bitmap(struct super_block *sb,/* check whether block bitmap block number is set */ blk =ext4_block_bitmap (sb, desc); offset = blk - group_first_block; -if (!ext4_test_bit (EXT4_B2C (sbi, offset), bh->b_data)) +if (offset <0 ||EXT4_B2C (sbi, offset) >= max_bit || + !ext4_test_bit (EXT4_B2C (sbi, offset), bh->b_data))/* bad block bitmap */ return blk;/* check whether the inode bitmap block number is set */ blk =ext4_inode_bitmap (sb, desc); offset = blk - group_first_block; -if (!ext4_test_bit (EXT4_B2C (sbi, offset), bh->b_data)) +if (offset <0 ||EXT4_B2C (sbi, offset) >= max_bit || + !ext4_test_bit (EXT4_B2C (sbi, offset), bh->b_data))/* bad block bitmap */ return blk;/* check whether the inode table block number is set */ blk =ext4_inode_table (sb, desc); offset = blk - group_first_block; +if (offset <0 ||EXT4_B2C (sbi, offset) >= max_bit || +EXT4_B2C (sbi, offset + sbi->s_itb_per_group) >= max_bit) +return blk; next_zero_bit =ext4_find_next_zero_bit (bh->b_data,EXT4_B2C (sbi, offset +EXT4_SB (sb)->s_itb_per_group),EXT4_B2C (sbi, offset));
@@ -416,6 +422,7 @@ struct buffer_head * ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group) {struct ext4_group_desc *desc; +struct ext4_sb_info *sbi =EXT4_SB (sb);struct buffer_head *bh;ext4_fsblk_t bitmap_blk;int err;
@@ -424,6 +431,12 @@ ext4_read_block_bitmap_nowait(struct super_block *sb, ext4_group_t block_group)if (!desc)return ERR_PTR (-EFSCORRUPTED ); bitmap_blk =ext4_block_bitmap (sb, desc); +if ((bitmap_blk <=le32_to_cpu (sbi->s_es->s_first_data_block)) || + (bitmap_blk >=ext4_blocks_count (sbi->s_es))) { +ext4_error (sb,"Invalid block bitmap block %llu in " +"block_group %u" , bitmap_blk, block_group); +return ERR_PTR (-EFSCORRUPTED ); + } bh =sb_getblk (sb, bitmap_blk);if (unlikely (!bh)) { ext4_error(sb, "Cannot get buffer for block bitmap - "
fs/ext4/extents.c +11 -5
@@ -5356,8 +5356,9 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle, stop =le32_to_cpu (extent->ee_block);/* -* In case of left shift, Don't start shifting extents until we make -* sure the hole is big enough to accommodate the shift. +* For left shifts, make sure the hole on the left is big enough to +* accommodate the shift. For right shifts, make sure the last extent +* won't be shifted beyond EXT_MAX_BLOCKS. */ if (SHIFT ==SHIFT_LEFT ) { path = ext4_find_extent(inode, start - 1, &path,
@@ -5377,9 +5378,14 @@ ext4_ext_shift_extents(struct inode *inode, handle_t *handle,if ((start == ex_start && shift > ex_start) || (shift > start - ex_end)) { -ext4_ext_drop_refs (path); -kfree (path); -return -EINVAL ; + ret = -EINVAL ; + goto out; + } + }else { +if (shift >EXT_MAX_BLOCKS - + (stop +ext4_ext_get_actual_len (extent))) { + ret = -EINVAL ; + goto out; } }
fs/ext4/ialloc.c +7 -0
@@ -119,6 +119,7 @@ static struct buffer_head * ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group) {struct ext4_group_desc *desc; +struct ext4_sb_info *sbi =EXT4_SB (sb);struct buffer_head *bh =NULL ;ext4_fsblk_t bitmap_blk;int err;
@@ -128,6 +129,12 @@ ext4_read_inode_bitmap(struct super_block *sb, ext4_group_t block_group)return ERR_PTR (-EFSCORRUPTED ); bitmap_blk =ext4_inode_bitmap (sb, desc); +if ((bitmap_blk <=le32_to_cpu (sbi->s_es->s_first_data_block)) || + (bitmap_blk >=ext4_blocks_count (sbi->s_es))) { +ext4_error (sb,"Invalid inode bitmap blk %llu in " +"block_group %u" , bitmap_blk, block_group); +return ERR_PTR (-EFSCORRUPTED ); + } bh =sb_getblk (sb, bitmap_blk);if (unlikely (!bh)) { ext4_error(sb, "Cannot read inode bitmap - "
fs/jbd2/transaction.c +1 -0
@@ -528,6 +528,7 @@ int jbd2_journal_start_reserved(handle_t *handle, unsigned int type,*/ ret =start_this_handle (journal, handle,GFP_NOFS );if (ret <0 ) { + handle->h_journal = journal;jbd2_journal_free_reserved (handle);return ret; }
include/asm-generic/vmlinux.lds.h +1 -1
@@ -170,7 +170,7 @@#endif #ifdef CONFIG_SERIAL_EARLYCON -#define EARLYCON_TABLE () STRUCT_ALIGN(); \ +#define EARLYCON_TABLE () . = ALIGN(8); \ VMLINUX_SYMBOL(__earlycon_table) = .; \ *(__earlycon_table) \ VMLINUX_SYMBOL(__earlycon_table_end) = .;
include/linux/mtd/flashchip.h +1 -0
@@ -85,6 +85,7 @@ struct flchip { unsigned int write_suspended:1; unsigned int erase_suspended:1;unsigned long in_progress_block_addr; +unsigned long in_progress_block_mask;struct mutex mutex;wait_queue_head_t wq;/* Wait on here when we're waiting for the chip
include/linux/serial_core.h +14 -7
@@ -347,10 +347,10 @@ struct earlycon_id {char name[16 ];char compatible[128 ];int (*setup)(struct earlycon_device *,const char *options); -}__aligned(32) ; +}; -extern const struct earlycon_id __earlycon_table[]; -extern const struct earlycon_id __earlycon_table_end[]; +extern const struct earlycon_id *__earlycon_table[]; +extern const struct earlycon_id *__earlycon_table_end[];#if defined(CONFIG_SERIAL_EARLYCON ) && !defined(MODULE )#define EARLYCON_USED_OR_UNUSED __used
@@ -358,12 +358,19 @@ extern const struct earlycon_id __earlycon_table_end[];#define EARLYCON_USED_OR_UNUSED __maybe_unused#endif -#define OF_EARLYCON_DECLARE (_name, compat, fn) \ - static const struct earlycon_id __UNIQUE_ID(__earlycon_##_name) \ - EARLYCON_USED_OR_UNUSED __section(__earlycon_table) \ +#define _OF_EARLYCON_DECLARE (_name, compat, fn, unique_id) \ + static const struct earlycon_id unique_id \ + EARLYCON_USED_OR_UNUSED __initconst \ = { .name = __stringify(_name), \ .compatible = compat, \ - .setup = fn } + .setup = fn }; \ + static const struct earlycon_id EARLYCON_USED_OR_UNUSED \ + __section(__earlycon_table) \ + * const __PASTE(__p, unique_id) = &unique_id + +#define OF_EARLYCON_DECLARE (_name, compat, fn) \ + _OF_EARLYCON_DECLARE(_name, compat, fn, \ + __UNIQUE_ID(__earlycon_##_name))#define EARLYCON_DECLARE (_name, fn) OF_EARLYCON_DECLARE(_name, "", fn)
include/linux/tty.h +1 -1
@@ -657,7 +657,7 @@ extern int tty_unregister_ldisc(int disc);extern int tty_set_ldisc (struct tty_struct *tty,int disc);extern int tty_ldisc_setup (struct tty_struct *tty,struct tty_struct *o_tty);extern void tty_ldisc_release (struct tty_struct *tty); -extern void tty_ldisc_init (struct tty_struct *tty); +extern int __must_check tty_ldisc_init (struct tty_struct *tty);extern void tty_ldisc_deinit (struct tty_struct *tty);extern int tty_ldisc_receive_buf (struct tty_ldisc *ld,unsigned char *p,char *f,int count);
include/linux/virtio.h +3 -0
@@ -143,6 +143,9 @@ int virtio_device_freeze(struct virtio_device *dev);int virtio_device_restore (struct virtio_device *dev);#endif +#define virtio_device_for_each_vq (vdev, vq) \ + list_for_each_entry(vq, &vdev->vqs, list) +/** * virtio_driver - operations for a virtio I/O driver * @driver: underlying device driver (populate name and owner).
include/sound/control.h +5 -2
@@ -22,6 +22,7 @@* */ +#include <linux/nospec.h> #include <sound/asound.h> #define snd_kcontrol_chip (kcontrol) ((kcontrol)->private_data)
@@ -147,12 +148,14 @@ int snd_ctl_get_preferred_subdevice(struct snd_card *card, int type);static inline unsigned int snd_ctl_get_ioffnum (struct snd_kcontrol *kctl,struct snd_ctl_elem_id *id) { -return id->numid - kctl->id.numid; +unsigned int ioff = id->numid - kctl->id.numid; +return array_index_nospec (ioff, kctl->count); }static inline unsigned int snd_ctl_get_ioffidx (struct snd_kcontrol *kctl,struct snd_ctl_elem_id *id) { -return id->index - kctl->id.index; +unsigned int ioff = id->index - kctl->id.index; +return array_index_nospec (ioff, kctl->count); }static inline unsigned int snd_ctl_get_ioff (struct snd_kcontrol *kctl,struct snd_ctl_elem_id *id)
lib/kobject.c +5 -7
@@ -234,14 +234,12 @@ static int kobject_add_internal(struct kobject *kobj)/* be noisy on error issues */ if (error == -EEXIST ) -WARN (1 ,"%s failed for %s with " -"-EEXIST, don't try to register things with " -"the same name in the same directory.\n" , - __func__,kobject_name (kobj)); +pr_err ("%s failed for %s with -EEXIST, don't try to register things with the same name in the same directory.\n" , + __func__,kobject_name (kobj));else -WARN (1 ,"%s failed for %s (error: %d parent: %s)\n" , - __func__,kobject_name (kobj), error, - parent ?kobject_name (parent) :"'none'" ); +pr_err ("%s failed for %s (error: %d parent: %s)\n" , + __func__,kobject_name (kobj), error, + parent ?kobject_name (parent) :"'none'" ); }else kobj->state_in_sysfs =1 ;
net/ceph/messenger.c +7 -0
@@ -2512,6 +2512,11 @@ static int try_write(struct ceph_connection *con)int ret =1 ;dout ("try_write start %p state %lu\n" , con, con->state); +if (con->state !=CON_STATE_PREOPEN && + con->state !=CON_STATE_CONNECTING && + con->state !=CON_STATE_NEGOTIATING && + con->state !=CON_STATE_OPEN ) +return 0 ; more:dout ("try_write out_kvec_bytes %d\n" , con->out_kvec_bytes);
@@ -2537,6 +2542,8 @@ static int try_write(struct ceph_connection *con) } more_kvec: +BUG_ON (!con->sock); +/* kvec data queued? */ if (con->out_kvec_left) { ret =write_partial_kvec (con);
net/ceph/mon_client.c +11 -3
@@ -209,6 +209,14 @@ static void reopen_session(struct ceph_mon_client *monc)__open_session (monc); } +static void un_backoff (struct ceph_mon_client *monc) +{ + monc->hunt_mult /=2 ;/* reduce by 50% */ +if (monc->hunt_mult <1 ) + monc->hunt_mult =1 ; +dout ("%s hunt_mult now %d\n" , __func__, monc->hunt_mult); +} +/* * Reschedule delayed work timer. */
@@ -955,6 +963,7 @@ static void delayed_work(struct work_struct *work)if (!monc->hunting) {ceph_con_keepalive (&monc->con);__validate_auth (monc); +un_backoff (monc); }if (is_auth) {
@@ -1114,9 +1123,8 @@ static void finish_hunting(struct ceph_mon_client *monc)dout ("%s found mon%d\n" , __func__, monc->cur_mon); monc->hunting = false; monc->had_a_connection = true; - monc->hunt_mult /=2 ;/* reduce by 50% */ -if (monc->hunt_mult <1 ) - monc->hunt_mult =1 ; +un_backoff (monc); +__schedule_delayed (monc); } }
sound/core/pcm_native.c +1 -0
@@ -2729,6 +2729,7 @@ static int snd_pcm_sync_ptr(struct snd_pcm_substream *substream, sync_ptr.s.status.hw_ptr = status->hw_ptr; sync_ptr.s.status.tstamp = status->tstamp; sync_ptr.s.status.suspended_state = status->suspended_state; + sync_ptr.s.status.audio_tstamp = status->audio_tstamp;snd_pcm_stream_unlock_irq (substream);if (copy_to_user (_sync_ptr, &sync_ptr,sizeof (sync_ptr)))return -EFAULT ;
sound/core/seq/oss/seq_oss_event.c +9 -6
@@ -26,6 +26,7 @@#include <sound/seq_oss_legacy.h> #include "seq_oss_readq.h" #include "seq_oss_writeq.h" +#include <linux/nospec.h> /*
@@ -287,10 +288,10 @@ note_on_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, st {struct seq_oss_synthinfo *info; -if (!snd_seq_oss_synth_is_valid (dp, dev)) + info =snd_seq_oss_synth_info (dp, dev); +if (!info)return -ENXIO ; - info = &dp->synths[dev];switch (info->arg.event_passing) {case SNDRV_SEQ_OSS_PROCESS_EVENTS :if (! info->ch || ch <0 || ch >= info->nr_voices) {
@@ -298,6 +299,7 @@ note_on_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, streturn set_note_event (dp, dev,SNDRV_SEQ_EVENT_NOTEON , ch, note, vel, ev); } + ch =array_index_nospec (ch, info->nr_voices);if (note ==255 && info->ch[ch].note >=0 ) {/* volume control */ int type;
@@ -347,10 +349,10 @@ note_off_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, s {struct seq_oss_synthinfo *info; -if (!snd_seq_oss_synth_is_valid (dp, dev)) + info =snd_seq_oss_synth_info (dp, dev); +if (!info)return -ENXIO ; - info = &dp->synths[dev];switch (info->arg.event_passing) {case SNDRV_SEQ_OSS_PROCESS_EVENTS :if (! info->ch || ch <0 || ch >= info->nr_voices) {
@@ -358,6 +360,7 @@ note_off_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, sreturn set_note_event (dp, dev,SNDRV_SEQ_EVENT_NOTEON , ch, note, vel, ev); } + ch =array_index_nospec (ch, info->nr_voices);if (info->ch[ch].note >=0 ) { note = info->ch[ch].note; info->ch[ch].vel =0 ;
@@ -381,7 +384,7 @@ note_off_event(struct seq_oss_devinfo *dp, int dev, int ch, int note, int vel, sstatic int set_note_event (struct seq_oss_devinfo *dp,int dev,int type,int ch,int note,int vel,struct snd_seq_event *ev) { -if (!snd_seq_oss_synth_is_valid (dp, dev)) +if (!snd_seq_oss_synth_info (dp, dev))return -ENXIO ; ev->type = type;
@@ -399,7 +402,7 @@ set_note_event(struct seq_oss_devinfo *dp, int dev, int type, int ch, int note,static int set_control_event (struct seq_oss_devinfo *dp,int dev,int type,int ch,int param,int val,struct snd_seq_event *ev) { -if (!snd_seq_oss_synth_is_valid (dp, dev)) +if (!snd_seq_oss_synth_info (dp, dev))return -ENXIO ; ev->type = type;
sound/core/seq/oss/seq_oss_midi.c +2 -0
@@ -29,6 +29,7 @@#include "../seq_lock.h" #include <linux/init.h> #include <linux/slab.h> +#include <linux/nospec.h> /*
@@ -315,6 +316,7 @@ get_mididev(struct seq_oss_devinfo *dp, int dev) {if (dev <0 || dev >= dp->max_mididev)return NULL ; + dev =array_index_nospec (dev, dp->max_mididev);return get_mdev (dev); }
sound/core/seq/oss/seq_oss_synth.c +49 -36
181 lines not on this page · raw message
sound/core/seq/oss/seq_oss_synth.h +2 -1
@@ -37,7 +37,8 @@ void snd_seq_oss_synth_cleanup(struct seq_oss_devinfo *dp);void snd_seq_oss_synth_reset (struct seq_oss_devinfo *dp,int dev);int snd_seq_oss_synth_load_patch (struct seq_oss_devinfo *dp,int dev,int fmt,const char __user *buf,int p,int c); -int snd_seq_oss_synth_is_valid (struct seq_oss_devinfo *dp,int dev); +struct seq_oss_synthinfo *snd_seq_oss_synth_info (struct seq_oss_devinfo *dp, +int dev);int snd_seq_oss_synth_sysex (struct seq_oss_devinfo *dp,int dev,unsigned char *buf,struct snd_seq_event *ev);int snd_seq_oss_synth_addr (struct seq_oss_devinfo *dp,int dev,struct snd_seq_event *ev);
sound/drivers/opl3/opl3_synth.c +5 -2
@@ -21,6 +21,7 @@#include <linux/slab.h> #include <linux/export.h> +#include <linux/nospec.h> #include <sound/opl3.h> #include <sound/asound_fm.h>
@@ -448,7 +449,7 @@ static int snd_opl3_set_voice(struct snd_opl3 * opl3, struct snd_dm_fm_voice * v {unsigned short reg_side;unsigned char op_offset; -unsigned char voice_offset; +unsigned char voice_offset, voice_op;unsigned short opl3_reg;unsigned char reg_val;
@@ -473,7 +474,9 @@ static int snd_opl3_set_voice(struct snd_opl3 * opl3, struct snd_dm_fm_voice * v voice_offset = voice->voice -MAX_OPL2_VOICES ; }/* Get register offset of operator */ - op_offset = snd_opl3_regmap[voice_offset][voice->op]; + voice_offset =array_index_nospec (voice_offset,MAX_OPL2_VOICES ); + voice_op =array_index_nospec (voice->op,4 ); + op_offset = snd_opl3_regmap[voice_offset][voice_op]; reg_val =0x00 ;/* Set amplitude modulation (tremolo) effect */
sound/firewire/dice/dice-stream.c +1 -1
@@ -425,7 +425,7 @@ int snd_dice_stream_init_duplex(struct snd_dice *dice) err =init_stream (dice,AMDTP_IN_STREAM , i);if (err <0 ) {for (; i >=0 ; i--) -destroy_stream (dice,AMDTP_OUT_STREAM , i); +destroy_stream (dice,AMDTP_IN_STREAM , i); goto end; } }
sound/firewire/dice/dice.c +1 -1
@@ -14,7 +14,7 @@ MODULE_LICENSE("GPL v2");#define OUI_WEISS 0x001c6a#define OUI_LOUD 0x000ff2#define OUI_FOCUSRITE 0x00130e -#define OUI_TCELECTRONIC 0x001486 +#define OUI_TCELECTRONIC 0x000166#define DICE_CATEGORY_ID 0x04#define WEISS_CATEGORY_ID 0x00
sound/pci/asihpi/hpimsginit.c +9 -4
@@ -23,6 +23,7 @@#include "hpi_internal.h" #include "hpimsginit.h" +#include <linux/nospec.h> /* The actual message size for each object type */ static u16 msg_size[HPI_OBJ_MAXINDEX +1 ] =HPI_MESSAGE_SIZE_BY_OBJECT ;
@@ -39,10 +40,12 @@ static void hpi_init_message(struct hpi_message *phm, u16 object, {u16 size; -if ((object >0 ) && (object <=HPI_OBJ_MAXINDEX )) +if ((object >0 ) && (object <=HPI_OBJ_MAXINDEX )) { + object =array_index_nospec (object,HPI_OBJ_MAXINDEX +1 ); size = msg_size[object]; -else + }else { size =sizeof (*phm); + }memset (phm,0 , size); phm->size = size;
@@ -66,10 +69,12 @@ void hpi_init_response(struct hpi_response *phr, u16 object, u16 function, {u16 size; -if ((object >0 ) && (object <=HPI_OBJ_MAXINDEX )) +if ((object >0 ) && (object <=HPI_OBJ_MAXINDEX )) { + object =array_index_nospec (object,HPI_OBJ_MAXINDEX +1 ); size = res_size[object]; -else + }else { size =sizeof (*phr); + }memset (phr,0 ,sizeof (*phr)); phr->size = size;
sound/pci/asihpi/hpioctl.c +3 -1
@@ -33,6 +33,7 @@#include <linux/stringify.h> #include <linux/module.h> #include <linux/vmalloc.h> +#include <linux/nospec.h> #ifdef MODULE_FIRMWARE MODULE_FIRMWARE ("asihpi/dsp5000.bin" );
@@ -182,7 +183,8 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg)struct hpi_adapter *pa =NULL ;if (hm->h.adapter_index <ARRAY_SIZE (adapters)) - pa = &adapters[hm->h.adapter_index]; + pa = &adapters[array_index_nospec (hm->h.adapter_index, +ARRAY_SIZE (adapters))];if (!pa || !pa->adapter || !pa->adapter->type) { hpi_init_response(&hr->r0, hm->h.object,
sound/pci/hda/hda_hwdep.c +11 -1
@@ -21,6 +21,7 @@#include <linux/init.h> #include <linux/slab.h> #include <linux/compat.h> +#include <linux/nospec.h> #include <sound/core.h> #include "hda_codec.h" #include "hda_local.h"
@@ -51,7 +52,16 @@ static int get_wcap_ioctl(struct hda_codec *codec,if (get_user (verb, &arg->verb))return -EFAULT ; - res =get_wcaps (codec, verb >>24 ); +/* open-code get_wcaps(verb>>24) with nospec */ + verb >>=24 ; +if (verb < codec->core.start_nid || + verb >= codec->core.start_nid + codec->core.num_nodes) { + res =0 ; + }else { + verb -= codec->core.start_nid; + verb =array_index_nospec (verb, codec->core.num_nodes); + res = codec->wcaps[verb]; + }if (put_user (res, &arg->res))return -EFAULT ;return 0 ;
sound/pci/hda/patch_realtek.c +2 -0
@@ -329,6 +329,7 @@ static void alc_fill_eapd_coef(struct hda_codec *codec)break ;case 0x10ec0225 :case 0x10ec0233 : +case 0x10ec0235 :case 0x10ec0236 :case 0x10ec0255 :case 0x10ec0256 :
@@ -6359,6 +6360,7 @@ static int patch_alc269(struct hda_codec *codec)case 0x10ec0298 : spec->codec_variant =ALC269_TYPE_ALC298 ;break ; +case 0x10ec0235 :case 0x10ec0255 : spec->codec_variant =ALC269_TYPE_ALC255 ;break ;
sound/pci/rme9652/hdspm.c +14 -10
@@ -137,6 +137,7 @@#include <linux/pci.h> #include <linux/math64.h> #include <linux/io.h> +#include <linux/nospec.h> #include <sound/core.h> #include <sound/control.h>
@@ -5692,40 +5693,43 @@ static int snd_hdspm_channel_info(struct snd_pcm_substream *substream, struct snd_pcm_channel_info *info) {struct hdspm *hdspm =snd_pcm_substream_chip (substream); +unsigned int channel = info->channel;if (substream->stream ==SNDRV_PCM_STREAM_PLAYBACK ) { -if (snd_BUG_ON (info->channel >= hdspm->max_channels_out)) { +if (snd_BUG_ON (channel >= hdspm->max_channels_out)) {dev_info (hdspm->card->dev,"snd_hdspm_channel_info: output channel out of range (%d)\n" , - info->channel); + channel);return -EINVAL ; } -if (hdspm->channel_map_out[info->channel] <0 ) { + channel =array_index_nospec (channel, hdspm->max_channels_out); +if (hdspm->channel_map_out[channel] <0 ) {dev_info (hdspm->card->dev,"snd_hdspm_channel_info: output channel %d mapped out\n" , - info->channel); + channel);return -EINVAL ; } - info->offset = hdspm->channel_map_out[info->channel] * + info->offset = hdspm->channel_map_out[channel] *HDSPM_CHANNEL_BUFFER_BYTES ; }else { -if (snd_BUG_ON (info->channel >= hdspm->max_channels_in)) { +if (snd_BUG_ON (channel >= hdspm->max_channels_in)) {dev_info (hdspm->card->dev,"snd_hdspm_channel_info: input channel out of range (%d)\n" , - info->channel); + channel);return -EINVAL ; } -if (hdspm->channel_map_in[info->channel] <0 ) { + channel =array_index_nospec (channel, hdspm->max_channels_in); +if (hdspm->channel_map_in[channel] <0 ) {dev_info (hdspm->card->dev,"snd_hdspm_channel_info: input channel %d mapped out\n" , - info->channel); + channel);return -EINVAL ; } - info->offset = hdspm->channel_map_in[info->channel] * + info->offset = hdspm->channel_map_in[channel] *HDSPM_CHANNEL_BUFFER_BYTES ; }
sound/pci/rme9652/rme9652.c +4 -2
@@ -26,6 +26,7 @@#include <linux/pci.h> #include <linux/module.h> #include <linux/io.h> +#include <linux/nospec.h> #include <sound/core.h> #include <sound/control.h>
@@ -2036,9 +2037,10 @@ static int snd_rme9652_channel_info(struct snd_pcm_substream *substream,if (snd_BUG_ON (info->channel >=RME9652_NCHANNELS ))return -EINVAL ; -if ((chn = rme9652->channel_map[info->channel]) <0 ) { + chn = rme9652->channel_map[array_index_nospec (info->channel, +RME9652_NCHANNELS )]; +if (chn <0 )return -EINVAL ; - } info->offset = chn *RME9652_CHANNEL_BUFFER_BYTES ; info->first =0 ;
sound/soc/fsl/fsl_esai.c +7 -0
@@ -145,6 +145,13 @@ static int fsl_esai_divisor_cal(struct snd_soc_dai *dai, bool tx, u32 ratio, psr = ratio <=256 * maxfp ? ESAI_xCCR_xPSR_BYPASS : ESAI_xCCR_xPSR_DIV8; +/* Do not loop-search if PM (1 ~ 256) alone can serve the ratio */ +if (ratio <=256 ) { + pm = ratio; + fp =1 ; + goto out; + } +/* Set the max fluctuation -- 0.1% of the max devisor */ savesub = (psr ?1 :8 ) *256 * maxfp /1000 ;
sound/usb/mixer_maps.c +3 -0
@@ -353,8 +353,11 @@ static struct usbmix_name_map bose_companion5_map[] = {/* * Dell usb dock with ALC4020 codec had a firmware problem where it got * screwed up when zero volume is passed; just skip it as a workaround +* +* Also the extension unit gives an access error, so skip it as well. */ static const struct usbmix_name_map dell_alc4020_map[] = { + {4 ,NULL },/* extension unit */ {16 ,NULL }, {19 ,NULL }, {0 }
tools/lib/str_error_r.c +1 -1
@@ -21,6 +21,6 @@ char *str_error_r(int errnum, char *buf, size_t buflen) {int err =strerror_r (errnum, buf, buflen);if (err) -snprintf (buf, buflen,"INTERNAL ERROR: strerror_r(%d, %p, %zd)=%d" , errnum, buf, buflen, err); +snprintf (buf, buflen,"INTERNAL ERROR: strerror_r(%d, [buf], %zd)=%d" , errnum, buflen, err);return buf; }
tools/lib/subcmd/pager.c +4 -1
@@ -29,10 +29,13 @@ static void pager_preexec(void)* have real input */ fd_set in; +fd_set exception;FD_ZERO (&in); +FD_ZERO (&exception);FD_SET (0 , &in); -select (1 , &in,NULL , &in,NULL ); +FD_SET (0 , &exception); +select (1 , &in,NULL , &exception,NULL );setenv ("LESS" ,"FRSX" ,0 ); }