Merge remote-tracking branch 'origin/auto-kernel-base' into auto-kernel

* origin/auto-kernel-base:
  Linux 4.14.196
  ALSA: usb-audio: Update documentation comment for MS2109 quirk
  HID: hiddev: Fix slab-out-of-bounds write in hiddev_ioctl_usage()
  tpm: Unify the mismatching TPM space buffer sizes
  btrfs: check the right error variable in btrfs_del_dir_entries_in_log
  usb: storage: Add unusual_uas entry for Sony PSZ drives
  USB: cdc-acm: rework notification_buffer resizing
  USB: gadget: u_f: Unbreak offset calculation in VLAs
  USB: gadget: f_ncm: add bounds checks to ncm_unwrap_ntb()
  USB: gadget: u_f: add overflow checks to VLA macros
  overflow.h: Add allocation size calculation helpers
  usb: host: ohci-exynos: Fix error handling in exynos_ohci_probe()
  USB: Ignore UAS for JMicron JMS567 ATA/ATAPI Bridge
  USB: quirks: Add no-lpm quirk for another Raydium touchscreen
  usb: uas: Add quirk for PNY Pro Elite
  USB: yurex: Fix bad gfp argument
  drm/amdgpu: Fix buffer overflow in INFO ioctl
  device property: Fix the secondary firmware node handling in set_primary_fwnode()
  PM: sleep: core: Fix the handling of pending runtime resume requests
  xhci: Do warm-reset when both CAS and XDEV_RESUME are set
  XEN uses irqdesc::irq_data_common::handler_data to store a per interrupt XEN data pointer which contains XEN specific information.
  writeback: Fix sync livelock due to b_dirty_time processing
  writeback: Avoid skipping inode writeback
  writeback: Protect inode->i_io_list with inode->i_lock
  serial: 8250: change lock order in serial8250_do_startup()
  serial: 8250_exar: Fix number of ports for Commtech PCIe cards
  serial: pl011: Don't leak amba_ports entry on driver register error
  serial: pl011: Fix oops on -EPROBE_DEFER
  serial: samsung: Removes the IRQ not found warning
  vt_ioctl: change VT_RESIZEX ioctl to check for error return from vc_resize()
  vt: defer kfree() of vc_screenbuf in vc_do_resize()
  USB: lvtest: return proper error code in probe
  fbcon: prevent user font height or width change from causing potential out-of-bounds access
  btrfs: fix space cache memory leak after transaction abort
  HID: i2c-hid: Always sleep 60ms after I2C_HID_PWR_ON commands
  powerpc/perf: Fix soft lockups due to missed interrupt accounting
  net: gianfar: Add of_node_put() before goto statement
  scsi: ufs: Clean up completed request without interrupt notification
  scsi: ufs: Improve interrupt handling for shared interrupts
  scsi: ufs: Fix possible infinite loop in ufshcd_hold
  s390/cio: add cond_resched() in the slow_eval_known_fn() loop
  spi: stm32: fix stm32_spi_prepare_mbr in case of odd clk_rate
  fs: prevent BUG_ON in submit_bh_wbc()
  jbd2: abort journal if free a async write error metadata buffer
  ext4: don't BUG on inconsistent journal feature
  jbd2: make sure jh have b_transaction set in refile/unfile_buffer
  usb: gadget: f_tcm: Fix some resource leaks in some error paths
  i2c: rcar: in slave mode, clear NACK earlier
  null_blk: fix passing of REQ_FUA flag in null_handle_rq
  nvme-fc: Fix wrong return value in __nvme_fc_init_request()
  media: gpio-ir-tx: improve precision of transmitted signal due to scheduling
  Revert "ath10k: fix DMA related firmware crashes on multiple devices"
  efi: provide empty efi_enter_virtual_mode implementation
  USB: sisusbvga: Fix a potential UB casued by left shifting a negative value
  powerpc/spufs: add CONFIG_COREDUMP dependency
  KVM: arm64: Fix symbol dependency in __hyp_call_panic_nvhe
  media: davinci: vpif_capture: fix potential double free
  EDAC/ie31200: Fallback if host bridge device is already initialized
  scsi: fcoe: Memory leak fix in fcoe_sysfs_fcf_del()
  ceph: fix potential mdsc use-after-free crash
  scsi: iscsi: Do not put host in iscsi_set_flashnode_param()
  locking/lockdep: Fix overflow in presentation of average lock-time
  drm/nouveau: Fix reference count leak in nouveau_connector_detect
  drm/nouveau/drm/noveau: fix reference count leak in nouveau_fbcon_open
  f2fs: fix use-after-free issue
  cec-api: prevent leaking memory through hole in structure
  mips/vdso: Fix resource leaks in genvdso.c
  rtlwifi: rtl8192cu: Prevent leaking urb
  PCI: Fix pci_create_slot() reference count leak
  omapfb: fix multiple reference count leaks due to pm_runtime_get_sync
  selftests/powerpc: Purge extra count_pmc() calls of ebb selftests
  scsi: lpfc: Fix shost refcount mismatch when deleting vport
  drm/amdgpu/display: fix ref count leak when pm_runtime_get_sync fails
  drm/amdgpu: fix ref count leak in amdgpu_display_crtc_set_config
  drm/amd/display: fix ref count leak in amdgpu_drm_ioctl
  drm/amdgpu: fix ref count leak in amdgpu_driver_open_kms
  drm/radeon: fix multiple reference count leak
  drm/amdkfd: Fix reference count leaks.
  iommu/iova: Don't BUG on invalid PFNs
  scsi: target: tcmu: Fix crash on ARM during cmd completion
  blktrace: ensure our debugfs dir exists
  media: pci: ttpci: av7110: fix possible buffer overflow caused by bad DMA value in debiirq()
  powerpc/xive: Ignore kmemleak false positives
  arm64: dts: qcom: msm8916: Pull down PDM GPIOs during sleep
  mfd: intel-lpss: Add Intel Emmitsburg PCH PCI IDs
  ASoC: tegra: Fix reference count leaks.
  ALSA: pci: delete repeated words in comments
  gre6: Fix reception with IP6_TNL_F_RCV_DSCP_COPY
  ipvlan: fix device features
  tipc: fix uninit skb->data in tipc_nl_compat_dumpit()
  net: Fix potential wrong skb->protocol in skb_vlan_untag()
  powerpc/64s: Don't init FSCR_DSCR in __init_FSCR()
  ANDROID: cuttlefish_defconfig: initialize locals with zeroes
  BACKPORT: security: allow using Clang's zero initialization for stack variables
  Revert "binder: Prevent context manager from incrementing ref 0"

Signed-off-by: UtsavBalar1231 <utsavbalar1231@gmail.com>
This commit is contained in:
UtsavBalar1231
2020-09-06 10:59:51 +05:30
112 changed files with 756 additions and 344 deletions

View File

@@ -1,7 +1,7 @@
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
VERSION = 4 VERSION = 4
PATCHLEVEL = 14 PATCHLEVEL = 14
SUBLEVEL = 195 SUBLEVEL = 196
EXTRAVERSION = EXTRAVERSION =
NAME = Petit Gorille NAME = Petit Gorille
@@ -839,12 +839,20 @@ ifndef CONFIG_FUNCTION_TRACER
KBUILD_CFLAGS += -fomit-frame-pointer KBUILD_CFLAGS += -fomit-frame-pointer
endif endif
endif endif
# Initialize all stack variables with a 0xAA pattern.
# Initialize all stack variables with a pattern, if desired. ifdef CONFIG_INIT_STACK_ALL_PATTERN
ifdef CONFIG_INIT_STACK_ALL
KBUILD_CFLAGS += -ftrivial-auto-var-init=pattern KBUILD_CFLAGS += -ftrivial-auto-var-init=pattern
endif endif
# Initialize all stack variables with a zero value.
ifdef CONFIG_INIT_STACK_ALL_ZERO
# Future support for zero initialization is still being debated, see
# https://bugs.llvm.org/show_bug.cgi?id=45497. These flags are subject to being
# renamed or dropped.
KBUILD_CFLAGS += -ftrivial-auto-var-init=zero
KBUILD_CFLAGS += -enable-trivial-auto-var-init-zero-knowing-it-will-be-removed-from-clang
endif
KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments) KBUILD_CFLAGS += $(call cc-option, -fno-var-tracking-assignments)
ifdef CONFIG_DEBUG_INFO ifdef CONFIG_DEBUG_INFO

View File

@@ -555,7 +555,7 @@
pins = "gpio63", "gpio64", "gpio65", "gpio66", pins = "gpio63", "gpio64", "gpio65", "gpio66",
"gpio67", "gpio68"; "gpio67", "gpio68";
drive-strength = <2>; drive-strength = <2>;
bias-disable; bias-pull-down;
}; };
}; };
}; };

View File

@@ -473,7 +473,7 @@ CONFIG_LSM_MMAP_MIN_ADDR=65536
CONFIG_HARDENED_USERCOPY=y CONFIG_HARDENED_USERCOPY=y
CONFIG_STATIC_USERMODEHELPER=y CONFIG_STATIC_USERMODEHELPER=y
CONFIG_SECURITY_SELINUX=y CONFIG_SECURITY_SELINUX=y
CONFIG_INIT_STACK_ALL=y CONFIG_INIT_STACK_ALL_ZERO=y
CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
CONFIG_CRYPTO_ADIANTUM=y CONFIG_CRYPTO_ADIANTUM=y
CONFIG_CRYPTO_LZ4=y CONFIG_CRYPTO_LZ4=y

View File

@@ -444,7 +444,7 @@ static void __hyp_text __hyp_call_panic_nvhe(u64 spsr, u64 elr, u64 par,
* making sure it is a kernel address and not a PC-relative * making sure it is a kernel address and not a PC-relative
* reference. * reference.
*/ */
asm volatile("ldr %0, =__hyp_panic_string" : "=r" (str_va)); asm volatile("ldr %0, =%1" : "=r" (str_va) : "S" (__hyp_panic_string));
__hyp_do_panic(str_va, __hyp_do_panic(str_va,
spsr, elr, spsr, elr,

View File

@@ -126,6 +126,7 @@ static void *map_vdso(const char *path, size_t *_size)
if (fstat(fd, &stat) != 0) { if (fstat(fd, &stat) != 0) {
fprintf(stderr, "%s: Failed to stat '%s': %s\n", program_name, fprintf(stderr, "%s: Failed to stat '%s': %s\n", program_name,
path, strerror(errno)); path, strerror(errno));
close(fd);
return NULL; return NULL;
} }
@@ -134,6 +135,7 @@ static void *map_vdso(const char *path, size_t *_size)
if (addr == MAP_FAILED) { if (addr == MAP_FAILED) {
fprintf(stderr, "%s: Failed to map '%s': %s\n", program_name, fprintf(stderr, "%s: Failed to map '%s': %s\n", program_name,
path, strerror(errno)); path, strerror(errno));
close(fd);
return NULL; return NULL;
} }
@@ -143,6 +145,7 @@ static void *map_vdso(const char *path, size_t *_size)
if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0) { if (memcmp(ehdr->e_ident, ELFMAG, SELFMAG) != 0) {
fprintf(stderr, "%s: '%s' is not an ELF file\n", program_name, fprintf(stderr, "%s: '%s' is not an ELF file\n", program_name,
path); path);
close(fd);
return NULL; return NULL;
} }
@@ -154,6 +157,7 @@ static void *map_vdso(const char *path, size_t *_size)
default: default:
fprintf(stderr, "%s: '%s' has invalid ELF class\n", fprintf(stderr, "%s: '%s' has invalid ELF class\n",
program_name, path); program_name, path);
close(fd);
return NULL; return NULL;
} }
@@ -165,6 +169,7 @@ static void *map_vdso(const char *path, size_t *_size)
default: default:
fprintf(stderr, "%s: '%s' has invalid ELF data order\n", fprintf(stderr, "%s: '%s' has invalid ELF data order\n",
program_name, path); program_name, path);
close(fd);
return NULL; return NULL;
} }
@@ -172,15 +177,18 @@ static void *map_vdso(const char *path, size_t *_size)
fprintf(stderr, fprintf(stderr,
"%s: '%s' has invalid ELF machine (expected EM_MIPS)\n", "%s: '%s' has invalid ELF machine (expected EM_MIPS)\n",
program_name, path); program_name, path);
close(fd);
return NULL; return NULL;
} else if (swap_uint16(ehdr->e_type) != ET_DYN) { } else if (swap_uint16(ehdr->e_type) != ET_DYN) {
fprintf(stderr, fprintf(stderr,
"%s: '%s' has invalid ELF type (expected ET_DYN)\n", "%s: '%s' has invalid ELF type (expected ET_DYN)\n",
program_name, path); program_name, path);
close(fd);
return NULL; return NULL;
} }
*_size = stat.st_size; *_size = stat.st_size;
close(fd);
return addr; return addr;
} }
@@ -284,10 +292,12 @@ int main(int argc, char **argv)
/* Calculate and write symbol offsets to <output file> */ /* Calculate and write symbol offsets to <output file> */
if (!get_symbols(dbg_vdso_path, dbg_vdso)) { if (!get_symbols(dbg_vdso_path, dbg_vdso)) {
unlink(out_path); unlink(out_path);
fclose(out_file);
return EXIT_FAILURE; return EXIT_FAILURE;
} }
fprintf(out_file, "};\n"); fprintf(out_file, "};\n");
fclose(out_file);
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }

View File

@@ -189,7 +189,7 @@ __init_LPCR_ISA300:
__init_FSCR: __init_FSCR:
mfspr r3,SPRN_FSCR mfspr r3,SPRN_FSCR
ori r3,r3,FSCR_TAR|FSCR_DSCR|FSCR_EBB ori r3,r3,FSCR_TAR|FSCR_EBB
mtspr SPRN_FSCR,r3 mtspr SPRN_FSCR,r3
blr blr

View File

@@ -2095,6 +2095,10 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
if (perf_event_overflow(event, &data, regs)) if (perf_event_overflow(event, &data, regs))
power_pmu_stop(event, 0); power_pmu_stop(event, 0);
} else if (period) {
/* Account for interrupt in case of invalid SIAR */
if (perf_event_account_interrupt(event))
power_pmu_stop(event, 0);
} }
} }

View File

@@ -46,6 +46,7 @@ config SPU_FS
tristate "SPU file system" tristate "SPU file system"
default m default m
depends on PPC_CELL depends on PPC_CELL
depends on COREDUMP
select SPU_BASE select SPU_BASE
help help
The SPU file system is used to access Synergistic Processing The SPU file system is used to access Synergistic Processing

View File

@@ -22,6 +22,7 @@
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/cpumask.h> #include <linux/cpumask.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/kmemleak.h>
#include <asm/prom.h> #include <asm/prom.h>
#include <asm/io.h> #include <asm/io.h>
@@ -630,6 +631,7 @@ static bool xive_native_provision_pages(void)
pr_err("Failed to allocate provisioning page\n"); pr_err("Failed to allocate provisioning page\n");
return false; return false;
} }
kmemleak_ignore(p);
opal_xive_donate_page(chip, __pa(p)); opal_xive_donate_page(chip, __pa(p));
} }
return true; return true;

View File

@@ -509,7 +509,7 @@ CONFIG_HARDENED_USERCOPY=y
CONFIG_STATIC_USERMODEHELPER=y CONFIG_STATIC_USERMODEHELPER=y
CONFIG_SECURITY_SELINUX=y CONFIG_SECURITY_SELINUX=y
CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1 CONFIG_SECURITY_SELINUX_CHECKREQPROT_VALUE=1
CONFIG_INIT_STACK_ALL=y CONFIG_INIT_STACK_ALL_ZERO=y
CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y CONFIG_INIT_ON_ALLOC_DEFAULT_ON=y
# CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set # CONFIG_CRYPTO_MANAGER_DISABLE_TESTS is not set
CONFIG_CRYPTO_ADIANTUM=y CONFIG_CRYPTO_ADIANTUM=y

View File

@@ -3088,12 +3088,6 @@ static void binder_transaction(struct binder_proc *proc,
goto err_dead_binder; goto err_dead_binder;
} }
e->to_node = target_node->debug_id; e->to_node = target_node->debug_id;
if (WARN_ON(proc == target_proc)) {
return_error = BR_FAILED_REPLY;
return_error_param = -EINVAL;
return_error_line = __LINE__;
goto err_invalid_target_handle;
}
if (security_binder_transaction(proc->tsk, if (security_binder_transaction(proc->tsk,
target_proc->tsk) < 0) { target_proc->tsk) < 0) {
return_error = BR_FAILED_REPLY; return_error = BR_FAILED_REPLY;
@@ -3696,17 +3690,10 @@ static int binder_thread_write(struct binder_proc *proc,
struct binder_node *ctx_mgr_node; struct binder_node *ctx_mgr_node;
mutex_lock(&context->context_mgr_node_lock); mutex_lock(&context->context_mgr_node_lock);
ctx_mgr_node = context->binder_context_mgr_node; ctx_mgr_node = context->binder_context_mgr_node;
if (ctx_mgr_node) { if (ctx_mgr_node)
if (ctx_mgr_node->proc == proc) {
binder_user_error("%d:%d context manager tried to acquire desc 0\n",
proc->pid, thread->pid);
mutex_unlock(&context->context_mgr_node_lock);
return -EINVAL;
}
ret = binder_inc_ref_for_node( ret = binder_inc_ref_for_node(
proc, ctx_mgr_node, proc, ctx_mgr_node,
strong, NULL, &rdata); strong, NULL, &rdata);
}
mutex_unlock(&context->context_mgr_node_lock); mutex_unlock(&context->context_mgr_node_lock);
} }
if (ret) if (ret)

View File

@@ -3079,9 +3079,9 @@ static inline bool fwnode_is_primary(struct fwnode_handle *fwnode)
*/ */
void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode) void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
{ {
if (fwnode) { struct fwnode_handle *fn = dev->fwnode;
struct fwnode_handle *fn = dev->fwnode;
if (fwnode) {
if (fwnode_is_primary(fn)) if (fwnode_is_primary(fn))
fn = fn->secondary; fn = fn->secondary;
@@ -3091,8 +3091,12 @@ void set_primary_fwnode(struct device *dev, struct fwnode_handle *fwnode)
} }
dev->fwnode = fwnode; dev->fwnode = fwnode;
} else { } else {
dev->fwnode = fwnode_is_primary(dev->fwnode) ? if (fwnode_is_primary(fn)) {
dev->fwnode->secondary : NULL; dev->fwnode = fn->secondary;
fn->secondary = NULL;
} else {
dev->fwnode = NULL;
}
} }
} }
EXPORT_SYMBOL_GPL(set_primary_fwnode); EXPORT_SYMBOL_GPL(set_primary_fwnode);

View File

@@ -1474,13 +1474,17 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)
} }
/* /*
* If a device configured to wake up the system from sleep states * Wait for possible runtime PM transitions of the device in progress
* has been suspended at run time and there's a resume request pending * to complete and if there's a runtime resume request pending for it,
* for it, this is equivalent to the device signaling wakeup, so the * resume it before proceeding with invoking the system-wide suspend
* system suspend operation should be aborted. * callbacks for it.
*
* If the system-wide suspend callbacks below change the configuration
* of the device, they must disable runtime PM for it or otherwise
* ensure that its runtime-resume callbacks will not be confused by that
* change in case they are invoked going forward.
*/ */
if (pm_runtime_barrier(dev) && device_may_wakeup(dev)) pm_runtime_barrier(dev);
pm_wakeup_event(dev, 0);
if (pm_wakeup_pending()) { if (pm_wakeup_pending()) {
pm_get_active_wakeup_sources(suspend_abort, pm_get_active_wakeup_sources(suspend_abort,

View File

@@ -1135,7 +1135,7 @@ static int null_handle_rq(struct nullb_cmd *cmd)
len = bvec.bv_len; len = bvec.bv_len;
err = null_transfer(nullb, bvec.bv_page, len, bvec.bv_offset, err = null_transfer(nullb, bvec.bv_page, len, bvec.bv_offset,
op_is_write(req_op(rq)), sector, op_is_write(req_op(rq)), sector,
req_op(rq) & REQ_FUA); rq->cmd_flags & REQ_FUA);
if (err) { if (err) {
spin_unlock_irq(&nullb->lock); spin_unlock_irq(&nullb->lock);
return err; return err;

View File

@@ -247,13 +247,8 @@ struct tpm_chip *tpm_chip_alloc(struct device *pdev,
chip->cdev.owner = THIS_MODULE; chip->cdev.owner = THIS_MODULE;
chip->cdevs.owner = THIS_MODULE; chip->cdevs.owner = THIS_MODULE;
chip->work_space.context_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); rc = tpm2_init_space(&chip->work_space, TPM2_SPACE_BUFFER_SIZE);
if (!chip->work_space.context_buf) { if (rc) {
rc = -ENOMEM;
goto out;
}
chip->work_space.session_buf = kzalloc(PAGE_SIZE, GFP_KERNEL);
if (!chip->work_space.session_buf) {
rc = -ENOMEM; rc = -ENOMEM;
goto out; goto out;
} }

View File

@@ -174,6 +174,7 @@ struct tpm_space {
u8 *context_buf; u8 *context_buf;
u32 session_tbl[3]; u32 session_tbl[3];
u8 *session_buf; u8 *session_buf;
u32 buf_size;
}; };
enum tpm_chip_flags { enum tpm_chip_flags {
@@ -261,6 +262,9 @@ struct tpm_output_header {
#define TPM_TAG_RQU_COMMAND 193 #define TPM_TAG_RQU_COMMAND 193
/* TPM2 specific constants. */
#define TPM2_SPACE_BUFFER_SIZE 16384 /* 16 kB */
struct stclear_flags_t { struct stclear_flags_t {
__be16 tag; __be16 tag;
u8 deactivated; u8 deactivated;
@@ -583,7 +587,7 @@ void tpm2_shutdown(struct tpm_chip *chip, u16 shutdown_type);
unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal); unsigned long tpm2_calc_ordinal_duration(struct tpm_chip *chip, u32 ordinal);
int tpm2_probe(struct tpm_chip *chip); int tpm2_probe(struct tpm_chip *chip);
int tpm2_find_cc(struct tpm_chip *chip, u32 cc); int tpm2_find_cc(struct tpm_chip *chip, u32 cc);
int tpm2_init_space(struct tpm_space *space); int tpm2_init_space(struct tpm_space *space, unsigned int buf_size);
void tpm2_del_space(struct tpm_chip *chip, struct tpm_space *space); void tpm2_del_space(struct tpm_chip *chip, struct tpm_space *space);
int tpm2_prepare_space(struct tpm_chip *chip, struct tpm_space *space, u32 cc, int tpm2_prepare_space(struct tpm_chip *chip, struct tpm_space *space, u32 cc,
u8 *cmd); u8 *cmd);

View File

@@ -44,18 +44,21 @@ static void tpm2_flush_sessions(struct tpm_chip *chip, struct tpm_space *space)
} }
} }
int tpm2_init_space(struct tpm_space *space) int tpm2_init_space(struct tpm_space *space, unsigned int buf_size)
{ {
space->context_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); space->context_buf = kzalloc(buf_size, GFP_KERNEL);
if (!space->context_buf) if (!space->context_buf)
return -ENOMEM; return -ENOMEM;
space->session_buf = kzalloc(PAGE_SIZE, GFP_KERNEL); space->session_buf = kzalloc(buf_size, GFP_KERNEL);
if (space->session_buf == NULL) { if (space->session_buf == NULL) {
kfree(space->context_buf); kfree(space->context_buf);
/* Prevent caller getting a dangling pointer. */
space->context_buf = NULL;
return -ENOMEM; return -ENOMEM;
} }
space->buf_size = buf_size;
return 0; return 0;
} }
@@ -278,8 +281,10 @@ int tpm2_prepare_space(struct tpm_chip *chip, struct tpm_space *space, u32 cc,
sizeof(space->context_tbl)); sizeof(space->context_tbl));
memcpy(&chip->work_space.session_tbl, &space->session_tbl, memcpy(&chip->work_space.session_tbl, &space->session_tbl,
sizeof(space->session_tbl)); sizeof(space->session_tbl));
memcpy(chip->work_space.context_buf, space->context_buf, PAGE_SIZE); memcpy(chip->work_space.context_buf, space->context_buf,
memcpy(chip->work_space.session_buf, space->session_buf, PAGE_SIZE); space->buf_size);
memcpy(chip->work_space.session_buf, space->session_buf,
space->buf_size);
rc = tpm2_load_space(chip); rc = tpm2_load_space(chip);
if (rc) { if (rc) {
@@ -459,7 +464,7 @@ static int tpm2_save_space(struct tpm_chip *chip)
continue; continue;
rc = tpm2_save_context(chip, space->context_tbl[i], rc = tpm2_save_context(chip, space->context_tbl[i],
space->context_buf, PAGE_SIZE, space->context_buf, space->buf_size,
&offset); &offset);
if (rc == -ENOENT) { if (rc == -ENOENT) {
space->context_tbl[i] = 0; space->context_tbl[i] = 0;
@@ -478,9 +483,8 @@ static int tpm2_save_space(struct tpm_chip *chip)
continue; continue;
rc = tpm2_save_context(chip, space->session_tbl[i], rc = tpm2_save_context(chip, space->session_tbl[i],
space->session_buf, PAGE_SIZE, space->session_buf, space->buf_size,
&offset); &offset);
if (rc == -ENOENT) { if (rc == -ENOENT) {
/* handle error saving session, just forget it */ /* handle error saving session, just forget it */
space->session_tbl[i] = 0; space->session_tbl[i] = 0;
@@ -526,8 +530,10 @@ int tpm2_commit_space(struct tpm_chip *chip, struct tpm_space *space,
sizeof(space->context_tbl)); sizeof(space->context_tbl));
memcpy(&space->session_tbl, &chip->work_space.session_tbl, memcpy(&space->session_tbl, &chip->work_space.session_tbl,
sizeof(space->session_tbl)); sizeof(space->session_tbl));
memcpy(space->context_buf, chip->work_space.context_buf, PAGE_SIZE); memcpy(space->context_buf, chip->work_space.context_buf,
memcpy(space->session_buf, chip->work_space.session_buf, PAGE_SIZE); space->buf_size);
memcpy(space->session_buf, chip->work_space.session_buf,
space->buf_size);
return 0; return 0;
} }

View File

@@ -22,7 +22,7 @@ static int tpmrm_open(struct inode *inode, struct file *file)
if (priv == NULL) if (priv == NULL)
return -ENOMEM; return -ENOMEM;
rc = tpm2_init_space(&priv->space); rc = tpm2_init_space(&priv->space, TPM2_SPACE_BUFFER_SIZE);
if (rc) { if (rc) {
kfree(priv); kfree(priv);
return -ENOMEM; return -ENOMEM;

View File

@@ -147,6 +147,8 @@
(n << (28 + (2 * skl) - PAGE_SHIFT)) (n << (28 + (2 * skl) - PAGE_SHIFT))
static int nr_channels; static int nr_channels;
static struct pci_dev *mci_pdev;
static int ie31200_registered = 1;
struct ie31200_priv { struct ie31200_priv {
void __iomem *window; void __iomem *window;
@@ -518,12 +520,16 @@ fail_free:
static int ie31200_init_one(struct pci_dev *pdev, static int ie31200_init_one(struct pci_dev *pdev,
const struct pci_device_id *ent) const struct pci_device_id *ent)
{ {
edac_dbg(0, "MC:\n"); int rc;
edac_dbg(0, "MC:\n");
if (pci_enable_device(pdev) < 0) if (pci_enable_device(pdev) < 0)
return -EIO; return -EIO;
rc = ie31200_probe1(pdev, ent->driver_data);
if (rc == 0 && !mci_pdev)
mci_pdev = pci_dev_get(pdev);
return ie31200_probe1(pdev, ent->driver_data); return rc;
} }
static void ie31200_remove_one(struct pci_dev *pdev) static void ie31200_remove_one(struct pci_dev *pdev)
@@ -532,6 +538,8 @@ static void ie31200_remove_one(struct pci_dev *pdev)
struct ie31200_priv *priv; struct ie31200_priv *priv;
edac_dbg(0, "\n"); edac_dbg(0, "\n");
pci_dev_put(mci_pdev);
mci_pdev = NULL;
mci = edac_mc_del_mc(&pdev->dev); mci = edac_mc_del_mc(&pdev->dev);
if (!mci) if (!mci)
return; return;
@@ -583,17 +591,53 @@ static struct pci_driver ie31200_driver = {
static int __init ie31200_init(void) static int __init ie31200_init(void)
{ {
int pci_rc, i;
edac_dbg(3, "MC:\n"); edac_dbg(3, "MC:\n");
/* Ensure that the OPSTATE is set correctly for POLL or NMI */ /* Ensure that the OPSTATE is set correctly for POLL or NMI */
opstate_init(); opstate_init();
return pci_register_driver(&ie31200_driver); pci_rc = pci_register_driver(&ie31200_driver);
if (pci_rc < 0)
goto fail0;
if (!mci_pdev) {
ie31200_registered = 0;
for (i = 0; ie31200_pci_tbl[i].vendor != 0; i++) {
mci_pdev = pci_get_device(ie31200_pci_tbl[i].vendor,
ie31200_pci_tbl[i].device,
NULL);
if (mci_pdev)
break;
}
if (!mci_pdev) {
edac_dbg(0, "ie31200 pci_get_device fail\n");
pci_rc = -ENODEV;
goto fail1;
}
pci_rc = ie31200_init_one(mci_pdev, &ie31200_pci_tbl[i]);
if (pci_rc < 0) {
edac_dbg(0, "ie31200 init fail\n");
pci_rc = -ENODEV;
goto fail1;
}
}
return 0;
fail1:
pci_unregister_driver(&ie31200_driver);
fail0:
pci_dev_put(mci_pdev);
return pci_rc;
} }
static void __exit ie31200_exit(void) static void __exit ie31200_exit(void)
{ {
edac_dbg(3, "MC:\n"); edac_dbg(3, "MC:\n");
pci_unregister_driver(&ie31200_driver); pci_unregister_driver(&ie31200_driver);
if (!ie31200_registered)
ie31200_remove_one(mci_pdev);
} }
module_init(ie31200_init); module_init(ie31200_init);

View File

@@ -734,8 +734,10 @@ amdgpu_connector_lvds_detect(struct drm_connector *connector, bool force)
if (!drm_kms_helper_is_poll_worker()) { if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev); r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0) if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected; return connector_status_disconnected;
}
} }
if (encoder) { if (encoder) {
@@ -872,8 +874,10 @@ amdgpu_connector_vga_detect(struct drm_connector *connector, bool force)
if (!drm_kms_helper_is_poll_worker()) { if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev); r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0) if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected; return connector_status_disconnected;
}
} }
encoder = amdgpu_connector_best_single_encoder(connector); encoder = amdgpu_connector_best_single_encoder(connector);
@@ -996,8 +1000,10 @@ amdgpu_connector_dvi_detect(struct drm_connector *connector, bool force)
if (!drm_kms_helper_is_poll_worker()) { if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev); r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0) if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected; return connector_status_disconnected;
}
} }
if (!force && amdgpu_connector_check_hpd_status_unchanged(connector)) { if (!force && amdgpu_connector_check_hpd_status_unchanged(connector)) {
@@ -1371,8 +1377,10 @@ amdgpu_connector_dp_detect(struct drm_connector *connector, bool force)
if (!drm_kms_helper_is_poll_worker()) { if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev); r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0) if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected; return connector_status_disconnected;
}
} }
if (!force && amdgpu_connector_check_hpd_status_unchanged(connector)) { if (!force && amdgpu_connector_check_hpd_status_unchanged(connector)) {

View File

@@ -269,7 +269,7 @@ int amdgpu_crtc_set_config(struct drm_mode_set *set,
ret = pm_runtime_get_sync(dev->dev); ret = pm_runtime_get_sync(dev->dev);
if (ret < 0) if (ret < 0)
return ret; goto out;
ret = drm_crtc_helper_set_config(set, ctx); ret = drm_crtc_helper_set_config(set, ctx);
@@ -284,7 +284,7 @@ int amdgpu_crtc_set_config(struct drm_mode_set *set,
take the current one */ take the current one */
if (active && !adev->have_disp_power_ref) { if (active && !adev->have_disp_power_ref) {
adev->have_disp_power_ref = true; adev->have_disp_power_ref = true;
return ret; goto out;
} }
/* if we have no active crtcs, then drop the power ref /* if we have no active crtcs, then drop the power ref
we got before */ we got before */
@@ -293,6 +293,7 @@ int amdgpu_crtc_set_config(struct drm_mode_set *set,
adev->have_disp_power_ref = false; adev->have_disp_power_ref = false;
} }
out:
/* drop the power reference we got coming in here */ /* drop the power reference we got coming in here */
pm_runtime_put_autosuspend(dev->dev); pm_runtime_put_autosuspend(dev->dev);
return ret; return ret;

View File

@@ -801,11 +801,12 @@ long amdgpu_drm_ioctl(struct file *filp,
dev = file_priv->minor->dev; dev = file_priv->minor->dev;
ret = pm_runtime_get_sync(dev->dev); ret = pm_runtime_get_sync(dev->dev);
if (ret < 0) if (ret < 0)
return ret; goto out;
ret = drm_ioctl(filp, cmd, arg); ret = drm_ioctl(filp, cmd, arg);
pm_runtime_mark_last_busy(dev->dev); pm_runtime_mark_last_busy(dev->dev);
out:
pm_runtime_put_autosuspend(dev->dev); pm_runtime_put_autosuspend(dev->dev);
return ret; return ret;
} }

View File

@@ -502,8 +502,12 @@ static int amdgpu_info_ioctl(struct drm_device *dev, void *data, struct drm_file
* in the bitfields */ * in the bitfields */
if (se_num == AMDGPU_INFO_MMR_SE_INDEX_MASK) if (se_num == AMDGPU_INFO_MMR_SE_INDEX_MASK)
se_num = 0xffffffff; se_num = 0xffffffff;
else if (se_num >= AMDGPU_GFX_MAX_SE)
return -EINVAL;
if (sh_num == AMDGPU_INFO_MMR_SH_INDEX_MASK) if (sh_num == AMDGPU_INFO_MMR_SH_INDEX_MASK)
sh_num = 0xffffffff; sh_num = 0xffffffff;
else if (sh_num >= AMDGPU_GFX_MAX_SH_PER_SE)
return -EINVAL;
if (info->read_mmr_reg.count > 128) if (info->read_mmr_reg.count > 128)
return -EINVAL; return -EINVAL;
@@ -785,7 +789,7 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
r = pm_runtime_get_sync(dev->dev); r = pm_runtime_get_sync(dev->dev);
if (r < 0) if (r < 0)
return r; goto pm_put;
fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL); fpriv = kzalloc(sizeof(*fpriv), GFP_KERNEL);
if (unlikely(!fpriv)) { if (unlikely(!fpriv)) {
@@ -824,6 +828,7 @@ int amdgpu_driver_open_kms(struct drm_device *dev, struct drm_file *file_priv)
out_suspend: out_suspend:
pm_runtime_mark_last_busy(dev->dev); pm_runtime_mark_last_busy(dev->dev);
pm_put:
pm_runtime_put_autosuspend(dev->dev); pm_runtime_put_autosuspend(dev->dev);
return r; return r;

View File

@@ -821,8 +821,10 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
ret = kobject_init_and_add(dev->kobj_node, &node_type, ret = kobject_init_and_add(dev->kobj_node, &node_type,
sys_props.kobj_nodes, "%d", id); sys_props.kobj_nodes, "%d", id);
if (ret < 0) if (ret < 0) {
kobject_put(dev->kobj_node);
return ret; return ret;
}
dev->kobj_mem = kobject_create_and_add("mem_banks", dev->kobj_node); dev->kobj_mem = kobject_create_and_add("mem_banks", dev->kobj_node);
if (!dev->kobj_mem) if (!dev->kobj_mem)
@@ -865,8 +867,10 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
return -ENOMEM; return -ENOMEM;
ret = kobject_init_and_add(mem->kobj, &mem_type, ret = kobject_init_and_add(mem->kobj, &mem_type,
dev->kobj_mem, "%d", i); dev->kobj_mem, "%d", i);
if (ret < 0) if (ret < 0) {
kobject_put(mem->kobj);
return ret; return ret;
}
mem->attr.name = "properties"; mem->attr.name = "properties";
mem->attr.mode = KFD_SYSFS_FILE_MODE; mem->attr.mode = KFD_SYSFS_FILE_MODE;
@@ -884,8 +888,10 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
return -ENOMEM; return -ENOMEM;
ret = kobject_init_and_add(cache->kobj, &cache_type, ret = kobject_init_and_add(cache->kobj, &cache_type,
dev->kobj_cache, "%d", i); dev->kobj_cache, "%d", i);
if (ret < 0) if (ret < 0) {
kobject_put(cache->kobj);
return ret; return ret;
}
cache->attr.name = "properties"; cache->attr.name = "properties";
cache->attr.mode = KFD_SYSFS_FILE_MODE; cache->attr.mode = KFD_SYSFS_FILE_MODE;
@@ -903,8 +909,10 @@ static int kfd_build_sysfs_node_entry(struct kfd_topology_device *dev,
return -ENOMEM; return -ENOMEM;
ret = kobject_init_and_add(iolink->kobj, &iolink_type, ret = kobject_init_and_add(iolink->kobj, &iolink_type,
dev->kobj_iolink, "%d", i); dev->kobj_iolink, "%d", i);
if (ret < 0) if (ret < 0) {
kobject_put(iolink->kobj);
return ret; return ret;
}
iolink->attr.name = "properties"; iolink->attr.name = "properties";
iolink->attr.mode = KFD_SYSFS_FILE_MODE; iolink->attr.mode = KFD_SYSFS_FILE_MODE;
@@ -956,8 +964,10 @@ static int kfd_topology_update_sysfs(void)
ret = kobject_init_and_add(sys_props.kobj_topology, ret = kobject_init_and_add(sys_props.kobj_topology,
&sysprops_type, &kfd_device->kobj, &sysprops_type, &kfd_device->kobj,
"topology"); "topology");
if (ret < 0) if (ret < 0) {
kobject_put(sys_props.kobj_topology);
return ret; return ret;
}
sys_props.kobj_nodes = kobject_create_and_add("nodes", sys_props.kobj_nodes = kobject_create_and_add("nodes",
sys_props.kobj_topology); sys_props.kobj_topology);

View File

@@ -580,8 +580,10 @@ nouveau_connector_detect(struct drm_connector *connector, bool force)
pm_runtime_get_noresume(dev->dev); pm_runtime_get_noresume(dev->dev);
} else { } else {
ret = pm_runtime_get_sync(dev->dev); ret = pm_runtime_get_sync(dev->dev);
if (ret < 0 && ret != -EACCES) if (ret < 0 && ret != -EACCES) {
pm_runtime_put_autosuspend(dev->dev);
return conn_status; return conn_status;
}
} }
nv_encoder = nouveau_connector_ddc_detect(connector); nv_encoder = nouveau_connector_ddc_detect(connector);

View File

@@ -184,8 +184,10 @@ nouveau_fbcon_open(struct fb_info *info, int user)
struct nouveau_fbdev *fbcon = info->par; struct nouveau_fbdev *fbcon = info->par;
struct nouveau_drm *drm = nouveau_drm(fbcon->helper.dev); struct nouveau_drm *drm = nouveau_drm(fbcon->helper.dev);
int ret = pm_runtime_get_sync(drm->dev->dev); int ret = pm_runtime_get_sync(drm->dev->dev);
if (ret < 0 && ret != -EACCES) if (ret < 0 && ret != -EACCES) {
pm_runtime_put(drm->dev->dev);
return ret; return ret;
}
return 0; return 0;
} }

View File

@@ -895,8 +895,10 @@ radeon_lvds_detect(struct drm_connector *connector, bool force)
if (!drm_kms_helper_is_poll_worker()) { if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev); r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0) if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected; return connector_status_disconnected;
}
} }
if (encoder) { if (encoder) {
@@ -1041,8 +1043,10 @@ radeon_vga_detect(struct drm_connector *connector, bool force)
if (!drm_kms_helper_is_poll_worker()) { if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev); r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0) if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected; return connector_status_disconnected;
}
} }
encoder = radeon_best_single_encoder(connector); encoder = radeon_best_single_encoder(connector);
@@ -1179,8 +1183,10 @@ radeon_tv_detect(struct drm_connector *connector, bool force)
if (!drm_kms_helper_is_poll_worker()) { if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev); r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0) if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected; return connector_status_disconnected;
}
} }
encoder = radeon_best_single_encoder(connector); encoder = radeon_best_single_encoder(connector);
@@ -1263,8 +1269,10 @@ radeon_dvi_detect(struct drm_connector *connector, bool force)
if (!drm_kms_helper_is_poll_worker()) { if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev); r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0) if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected; return connector_status_disconnected;
}
} }
if (radeon_connector->detected_hpd_without_ddc) { if (radeon_connector->detected_hpd_without_ddc) {
@@ -1704,8 +1712,10 @@ radeon_dp_detect(struct drm_connector *connector, bool force)
if (!drm_kms_helper_is_poll_worker()) { if (!drm_kms_helper_is_poll_worker()) {
r = pm_runtime_get_sync(connector->dev->dev); r = pm_runtime_get_sync(connector->dev->dev);
if (r < 0) if (r < 0) {
pm_runtime_put_autosuspend(connector->dev->dev);
return connector_status_disconnected; return connector_status_disconnected;
}
} }
if (!force && radeon_check_hpd_status_unchanged(connector)) { if (!force && radeon_check_hpd_status_unchanged(connector)) {

View File

@@ -406,6 +406,19 @@ static int i2c_hid_set_power(struct i2c_client *client, int power_state)
dev_err(&client->dev, "failed to change power setting.\n"); dev_err(&client->dev, "failed to change power setting.\n");
set_pwr_exit: set_pwr_exit:
/*
* The HID over I2C specification states that if a DEVICE needs time
* after the PWR_ON request, it should utilise CLOCK stretching.
* However, it has been observered that the Windows driver provides a
* 1ms sleep between the PWR_ON and RESET requests.
* According to Goodix Windows even waits 60 ms after (other?)
* PWR_ON requests. Testing has confirmed that several devices
* will not work properly without a delay after a PWR_ON request.
*/
if (!ret && power_state == I2C_HID_PWR_ON)
msleep(60);
return ret; return ret;
} }
@@ -427,15 +440,6 @@ static int i2c_hid_hwreset(struct i2c_client *client)
if (ret) if (ret)
goto out_unlock; goto out_unlock;
/*
* The HID over I2C specification states that if a DEVICE needs time
* after the PWR_ON request, it should utilise CLOCK stretching.
* However, it has been observered that the Windows driver provides a
* 1ms sleep between the PWR_ON and RESET requests and that some devices
* rely on this.
*/
usleep_range(1000, 5000);
i2c_hid_dbg(ihid, "resetting...\n"); i2c_hid_dbg(ihid, "resetting...\n");
ret = i2c_hid_command(client, &hid_reset_cmd, NULL, 0); ret = i2c_hid_command(client, &hid_reset_cmd, NULL, 0);

View File

@@ -532,12 +532,16 @@ static noinline int hiddev_ioctl_usage(struct hiddev *hiddev, unsigned int cmd,
switch (cmd) { switch (cmd) {
case HIDIOCGUSAGE: case HIDIOCGUSAGE:
if (uref->usage_index >= field->report_count)
goto inval;
uref->value = field->value[uref->usage_index]; uref->value = field->value[uref->usage_index];
if (copy_to_user(user_arg, uref, sizeof(*uref))) if (copy_to_user(user_arg, uref, sizeof(*uref)))
goto fault; goto fault;
goto goodreturn; goto goodreturn;
case HIDIOCSUSAGE: case HIDIOCSUSAGE:
if (uref->usage_index >= field->report_count)
goto inval;
field->value[uref->usage_index] = uref->value; field->value[uref->usage_index] = uref->value;
goto goodreturn; goto goodreturn;

View File

@@ -545,6 +545,7 @@ static bool rcar_i2c_slave_irq(struct rcar_i2c_priv *priv)
/* master sent stop */ /* master sent stop */
if (ssr_filtered & SSR) { if (ssr_filtered & SSR) {
i2c_slave_event(priv->slave, I2C_SLAVE_STOP, &value); i2c_slave_event(priv->slave, I2C_SLAVE_STOP, &value);
rcar_i2c_write(priv, ICSCR, SIE | SDBS); /* clear our NACK */
rcar_i2c_write(priv, ICSIER, SAR); rcar_i2c_write(priv, ICSIER, SAR);
rcar_i2c_write(priv, ICSSR, ~SSR & 0xff); rcar_i2c_write(priv, ICSSR, ~SSR & 0xff);
} }

View File

@@ -959,7 +959,9 @@ iova_magazine_free_pfns(struct iova_magazine *mag, struct iova_domain *iovad)
for (i = 0 ; i < mag->size; ++i) { for (i = 0 ; i < mag->size; ++i) {
struct iova *iova = private_find_iova(iovad, mag->pfns[i]); struct iova *iova = private_find_iova(iovad, mag->pfns[i]);
BUG_ON(!iova); if (WARN_ON(!iova))
continue;
private_free_iova(iovad, iova); private_free_iova(iovad, iova);
} }

View File

@@ -159,7 +159,13 @@ static long cec_adap_g_log_addrs(struct cec_adapter *adap,
struct cec_log_addrs log_addrs; struct cec_log_addrs log_addrs;
mutex_lock(&adap->lock); mutex_lock(&adap->lock);
log_addrs = adap->log_addrs; /*
* We use memcpy here instead of assignment since there is a
* hole at the end of struct cec_log_addrs that an assignment
* might ignore. So when we do copy_to_user() we could leak
* one byte of memory.
*/
memcpy(&log_addrs, &adap->log_addrs, sizeof(log_addrs));
if (!adap->is_configured) if (!adap->is_configured)
memset(log_addrs.log_addr, CEC_LOG_ADDR_INVALID, memset(log_addrs.log_addr, CEC_LOG_ADDR_INVALID,
sizeof(log_addrs.log_addr)); sizeof(log_addrs.log_addr));

View File

@@ -423,14 +423,15 @@ static void debiirq(unsigned long cookie)
case DATA_CI_GET: case DATA_CI_GET:
{ {
u8 *data = av7110->debi_virt; u8 *data = av7110->debi_virt;
u8 data_0 = data[0];
if ((data[0] < 2) && data[2] == 0xff) { if (data_0 < 2 && data[2] == 0xff) {
int flags = 0; int flags = 0;
if (data[5] > 0) if (data[5] > 0)
flags |= CA_CI_MODULE_PRESENT; flags |= CA_CI_MODULE_PRESENT;
if (data[5] > 5) if (data[5] > 5)
flags |= CA_CI_MODULE_READY; flags |= CA_CI_MODULE_READY;
av7110->ci_slot[data[0]].flags = flags; av7110->ci_slot[data_0].flags = flags;
} else } else
ci_get_data(&av7110->ci_rbuffer, ci_get_data(&av7110->ci_rbuffer,
av7110->debi_virt, av7110->debi_virt,

View File

@@ -1489,8 +1489,6 @@ probe_out:
/* Unregister video device */ /* Unregister video device */
video_unregister_device(&ch->video_dev); video_unregister_device(&ch->video_dev);
} }
kfree(vpif_obj.sd);
v4l2_device_unregister(&vpif_obj.v4l2_dev);
return err; return err;
} }

View File

@@ -87,13 +87,8 @@ static int gpio_ir_tx(struct rc_dev *dev, unsigned int *txbuf,
// space // space
edge = ktime_add_us(edge, txbuf[i]); edge = ktime_add_us(edge, txbuf[i]);
delta = ktime_us_delta(edge, ktime_get()); delta = ktime_us_delta(edge, ktime_get());
if (delta > 10) { if (delta > 0)
spin_unlock_irqrestore(&gpio_ir->lock, flags);
usleep_range(delta, delta + 10);
spin_lock_irqsave(&gpio_ir->lock, flags);
} else if (delta > 0) {
udelay(delta); udelay(delta);
}
} else { } else {
// pulse // pulse
ktime_t last = ktime_add_us(edge, txbuf[i]); ktime_t last = ktime_add_us(edge, txbuf[i]);

View File

@@ -176,6 +176,9 @@ static const struct pci_device_id intel_lpss_pci_ids[] = {
{ PCI_VDEVICE(INTEL, 0x1ac4), (kernel_ulong_t)&bxt_info }, { PCI_VDEVICE(INTEL, 0x1ac4), (kernel_ulong_t)&bxt_info },
{ PCI_VDEVICE(INTEL, 0x1ac6), (kernel_ulong_t)&bxt_info }, { PCI_VDEVICE(INTEL, 0x1ac6), (kernel_ulong_t)&bxt_info },
{ PCI_VDEVICE(INTEL, 0x1aee), (kernel_ulong_t)&bxt_uart_info }, { PCI_VDEVICE(INTEL, 0x1aee), (kernel_ulong_t)&bxt_uart_info },
/* EBG */
{ PCI_VDEVICE(INTEL, 0x1bad), (kernel_ulong_t)&bxt_uart_info },
{ PCI_VDEVICE(INTEL, 0x1bae), (kernel_ulong_t)&bxt_uart_info },
/* GLK */ /* GLK */
{ PCI_VDEVICE(INTEL, 0x31ac), (kernel_ulong_t)&glk_i2c_info }, { PCI_VDEVICE(INTEL, 0x31ac), (kernel_ulong_t)&glk_i2c_info },
{ PCI_VDEVICE(INTEL, 0x31ae), (kernel_ulong_t)&glk_i2c_info }, { PCI_VDEVICE(INTEL, 0x31ae), (kernel_ulong_t)&glk_i2c_info },

View File

@@ -844,8 +844,10 @@ static int gfar_of_init(struct platform_device *ofdev, struct net_device **pdev)
continue; continue;
err = gfar_parse_group(child, priv, model); err = gfar_parse_group(child, priv, model);
if (err) if (err) {
of_node_put(child);
goto err_grp_init; goto err_grp_init;
}
} }
} else { /* SQ_SG_MODE */ } else { /* SQ_SG_MODE */
err = gfar_parse_group(np, priv, model); err = gfar_parse_group(np, priv, model);

View File

@@ -187,12 +187,21 @@ static void ipvlan_port_destroy(struct net_device *dev)
kfree(port); kfree(port);
} }
#define IPVLAN_ALWAYS_ON_OFLOADS \
(NETIF_F_SG | NETIF_F_HW_CSUM | \
NETIF_F_GSO_ROBUST | NETIF_F_GSO_SOFTWARE | NETIF_F_GSO_ENCAP_ALL)
#define IPVLAN_ALWAYS_ON \
(IPVLAN_ALWAYS_ON_OFLOADS | NETIF_F_LLTX | NETIF_F_VLAN_CHALLENGED)
#define IPVLAN_FEATURES \ #define IPVLAN_FEATURES \
(NETIF_F_SG | NETIF_F_CSUM_MASK | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \ (NETIF_F_SG | NETIF_F_HW_CSUM | NETIF_F_HIGHDMA | NETIF_F_FRAGLIST | \
NETIF_F_GSO | NETIF_F_TSO | NETIF_F_GSO_ROBUST | \ NETIF_F_GSO | NETIF_F_TSO | NETIF_F_GSO_ROBUST | \
NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO | NETIF_F_RXCSUM | \ NETIF_F_TSO_ECN | NETIF_F_TSO6 | NETIF_F_GRO | NETIF_F_RXCSUM | \
NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER) NETIF_F_HW_VLAN_CTAG_FILTER | NETIF_F_HW_VLAN_STAG_FILTER)
/* NETIF_F_GSO_ENCAP_ALL NETIF_F_GSO_SOFTWARE Newly added */
#define IPVLAN_STATE_MASK \ #define IPVLAN_STATE_MASK \
((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT)) ((1<<__LINK_STATE_NOCARRIER) | (1<<__LINK_STATE_DORMANT))
@@ -205,7 +214,9 @@ static int ipvlan_init(struct net_device *dev)
dev->state = (dev->state & ~IPVLAN_STATE_MASK) | dev->state = (dev->state & ~IPVLAN_STATE_MASK) |
(phy_dev->state & IPVLAN_STATE_MASK); (phy_dev->state & IPVLAN_STATE_MASK);
dev->features = phy_dev->features & IPVLAN_FEATURES; dev->features = phy_dev->features & IPVLAN_FEATURES;
dev->features |= NETIF_F_LLTX; dev->features |= IPVLAN_ALWAYS_ON;
dev->vlan_features = phy_dev->vlan_features & IPVLAN_FEATURES;
dev->vlan_features |= IPVLAN_ALWAYS_ON_OFLOADS;
dev->gso_max_size = phy_dev->gso_max_size; dev->gso_max_size = phy_dev->gso_max_size;
dev->gso_max_segs = phy_dev->gso_max_segs; dev->gso_max_segs = phy_dev->gso_max_segs;
dev->hard_header_len = phy_dev->hard_header_len; dev->hard_header_len = phy_dev->hard_header_len;
@@ -293,7 +304,14 @@ static netdev_features_t ipvlan_fix_features(struct net_device *dev,
{ {
struct ipvl_dev *ipvlan = netdev_priv(dev); struct ipvl_dev *ipvlan = netdev_priv(dev);
return features & (ipvlan->sfeatures | ~IPVLAN_FEATURES); features |= NETIF_F_ALL_FOR_ALL;
features &= (ipvlan->sfeatures | ~IPVLAN_FEATURES);
features = netdev_increment_features(ipvlan->phy_dev->features,
features, features);
features |= IPVLAN_ALWAYS_ON;
features &= (IPVLAN_FEATURES | IPVLAN_ALWAYS_ON);
return features;
} }
static void ipvlan_change_rx_flags(struct net_device *dev, int change) static void ipvlan_change_rx_flags(struct net_device *dev, int change)
@@ -743,10 +761,9 @@ static int ipvlan_device_event(struct notifier_block *unused,
case NETDEV_FEAT_CHANGE: case NETDEV_FEAT_CHANGE:
list_for_each_entry(ipvlan, &port->ipvlans, pnode) { list_for_each_entry(ipvlan, &port->ipvlans, pnode) {
ipvlan->dev->features = dev->features & IPVLAN_FEATURES;
ipvlan->dev->gso_max_size = dev->gso_max_size; ipvlan->dev->gso_max_size = dev->gso_max_size;
ipvlan->dev->gso_max_segs = dev->gso_max_segs; ipvlan->dev->gso_max_segs = dev->gso_max_segs;
netdev_features_change(ipvlan->dev); netdev_update_features(ipvlan->dev);
} }
break; break;

View File

@@ -755,7 +755,7 @@ ath10k_rx_desc_get_l3_pad_bytes(struct ath10k_hw_params *hw,
#define TARGET_10_4_TX_DBG_LOG_SIZE 1024 #define TARGET_10_4_TX_DBG_LOG_SIZE 1024
#define TARGET_10_4_NUM_WDS_ENTRIES 32 #define TARGET_10_4_NUM_WDS_ENTRIES 32
#define TARGET_10_4_DMA_BURST_SIZE 0 #define TARGET_10_4_DMA_BURST_SIZE 1
#define TARGET_10_4_MAC_AGGR_DELIM 0 #define TARGET_10_4_MAC_AGGR_DELIM 0
#define TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1 #define TARGET_10_4_RX_SKIP_DEFRAG_TIMEOUT_DUP_DETECTION_CHECK 1
#define TARGET_10_4_VOW_CONFIG 0 #define TARGET_10_4_VOW_CONFIG 0

View File

@@ -739,8 +739,11 @@ static int _rtl_usb_receive(struct ieee80211_hw *hw)
usb_anchor_urb(urb, &rtlusb->rx_submitted); usb_anchor_urb(urb, &rtlusb->rx_submitted);
err = usb_submit_urb(urb, GFP_KERNEL); err = usb_submit_urb(urb, GFP_KERNEL);
if (err) if (err) {
usb_unanchor_urb(urb);
usb_free_urb(urb);
goto err_out; goto err_out;
}
usb_free_urb(urb); usb_free_urb(urb);
} }
return 0; return 0;

View File

@@ -1492,7 +1492,7 @@ __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl,
if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.cmddma)) { if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.cmddma)) {
dev_err(ctrl->dev, dev_err(ctrl->dev,
"FCP Op failed - cmdiu dma mapping failed.\n"); "FCP Op failed - cmdiu dma mapping failed.\n");
ret = EFAULT; ret = -EFAULT;
goto out_on_error; goto out_on_error;
} }
@@ -1502,7 +1502,7 @@ __nvme_fc_init_request(struct nvme_fc_ctrl *ctrl,
if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.rspdma)) { if (fc_dma_mapping_error(ctrl->lport->dev, op->fcp_req.rspdma)) {
dev_err(ctrl->dev, dev_err(ctrl->dev,
"FCP Op failed - rspiu dma mapping failed.\n"); "FCP Op failed - rspiu dma mapping failed.\n");
ret = EFAULT; ret = -EFAULT;
} }
atomic_set(&op->state, FCPOP_STATE_IDLE); atomic_set(&op->state, FCPOP_STATE_IDLE);

View File

@@ -303,13 +303,16 @@ placeholder:
slot_name = make_slot_name(name); slot_name = make_slot_name(name);
if (!slot_name) { if (!slot_name) {
err = -ENOMEM; err = -ENOMEM;
kfree(slot);
goto err; goto err;
} }
err = kobject_init_and_add(&slot->kobj, &pci_slot_ktype, NULL, err = kobject_init_and_add(&slot->kobj, &pci_slot_ktype, NULL,
"%s", slot_name); "%s", slot_name);
if (err) if (err) {
kobject_put(&slot->kobj);
goto err; goto err;
}
INIT_LIST_HEAD(&slot->list); INIT_LIST_HEAD(&slot->list);
list_add(&slot->list, &parent->slots); list_add(&slot->list, &parent->slots);
@@ -328,7 +331,6 @@ out:
mutex_unlock(&pci_slot_mutex); mutex_unlock(&pci_slot_mutex);
return slot; return slot;
err: err:
kfree(slot);
slot = ERR_PTR(err); slot = ERR_PTR(err);
goto out; goto out;
} }

View File

@@ -581,6 +581,11 @@ static int slow_eval_known_fn(struct subchannel *sch, void *data)
rc = css_evaluate_known_subchannel(sch, 1); rc = css_evaluate_known_subchannel(sch, 1);
if (rc == -EAGAIN) if (rc == -EAGAIN)
css_schedule_eval(sch->schid); css_schedule_eval(sch->schid);
/*
* The loop might take long time for platforms with lots of
* known devices. Allow scheduling here.
*/
cond_resched();
} }
return 0; return 0;
} }

View File

@@ -267,9 +267,9 @@ static void fcoe_sysfs_fcf_del(struct fcoe_fcf *new)
WARN_ON(!fcf_dev); WARN_ON(!fcf_dev);
new->fcf_dev = NULL; new->fcf_dev = NULL;
fcoe_fcf_device_delete(fcf_dev); fcoe_fcf_device_delete(fcf_dev);
kfree(new);
mutex_unlock(&cdev->lock); mutex_unlock(&cdev->lock);
} }
kfree(new);
} }
/** /**

View File

@@ -644,27 +644,16 @@ lpfc_vport_delete(struct fc_vport *fc_vport)
vport->port_state < LPFC_VPORT_READY) vport->port_state < LPFC_VPORT_READY)
return -EAGAIN; return -EAGAIN;
} }
/* /*
* This is a bit of a mess. We want to ensure the shost doesn't get * Take early refcount for outstanding I/O requests we schedule during
* torn down until we're done with the embedded lpfc_vport structure. * delete processing for unreg_vpi. Always keep this before
* * scsi_remove_host() as we can no longer obtain a reference through
* Beyond holding a reference for this function, we also need a * scsi_host_get() after scsi_host_remove as shost is set to SHOST_DEL.
* reference for outstanding I/O requests we schedule during delete
* processing. But once we scsi_remove_host() we can no longer obtain
* a reference through scsi_host_get().
*
* So we take two references here. We release one reference at the
* bottom of the function -- after delinking the vport. And we
* release the other at the completion of the unreg_vpi that get's
* initiated after we've disposed of all other resources associated
* with the port.
*/ */
if (!scsi_host_get(shost)) if (!scsi_host_get(shost))
return VPORT_INVAL; return VPORT_INVAL;
if (!scsi_host_get(shost)) {
scsi_host_put(shost);
return VPORT_INVAL;
}
lpfc_free_sysfs_attr(vport); lpfc_free_sysfs_attr(vport);
lpfc_debugfs_terminate(vport); lpfc_debugfs_terminate(vport);
@@ -811,8 +800,9 @@ skip_logo:
if (!(vport->vpi_state & LPFC_VPI_REGISTERED) || if (!(vport->vpi_state & LPFC_VPI_REGISTERED) ||
lpfc_mbx_unreg_vpi(vport)) lpfc_mbx_unreg_vpi(vport))
scsi_host_put(shost); scsi_host_put(shost);
} else } else {
scsi_host_put(shost); scsi_host_put(shost);
}
lpfc_free_vpi(phba, vport->vpi); lpfc_free_vpi(phba, vport->vpi);
vport->work_port_events = 0; vport->work_port_events = 0;

View File

@@ -3172,7 +3172,7 @@ static int iscsi_set_flashnode_param(struct iscsi_transport *transport,
pr_err("%s could not find host no %u\n", pr_err("%s could not find host no %u\n",
__func__, ev->u.set_flashnode.host_no); __func__, ev->u.set_flashnode.host_no);
err = -ENODEV; err = -ENODEV;
goto put_host; goto exit_set_fnode;
} }
idx = ev->u.set_flashnode.flashnode_idx; idx = ev->u.set_flashnode.flashnode_idx;

View File

@@ -2194,6 +2194,7 @@ unblock_reqs:
int ufshcd_hold(struct ufs_hba *hba, bool async) int ufshcd_hold(struct ufs_hba *hba, bool async)
{ {
int rc = 0; int rc = 0;
bool flush_result;
unsigned long flags; unsigned long flags;
if (!ufshcd_is_clkgating_allowed(hba)) if (!ufshcd_is_clkgating_allowed(hba))
@@ -2226,7 +2227,9 @@ start:
} }
spin_unlock_irqrestore(hba->host->host_lock, flags); spin_unlock_irqrestore(hba->host->host_lock, flags);
flush_work(&hba->clk_gating.ungate_work); flush_result = flush_work(&hba->clk_gating.ungate_work);
if (hba->clk_gating.is_suspended && !flush_result)
goto out;
spin_lock_irqsave(hba->host->host_lock, flags); spin_lock_irqsave(hba->host->host_lock, flags);
if (hba->ufshcd_state == UFSHCD_STATE_OPERATIONAL) if (hba->ufshcd_state == UFSHCD_STATE_OPERATIONAL)
goto start; goto start;
@@ -7582,7 +7585,7 @@ static irqreturn_t ufshcd_sl_intr(struct ufs_hba *hba, u32 intr_status)
*/ */
static irqreturn_t ufshcd_intr(int irq, void *__hba) static irqreturn_t ufshcd_intr(int irq, void *__hba)
{ {
u32 intr_status, enabled_intr_status; u32 intr_status, enabled_intr_status = 0;
irqreturn_t retval = IRQ_NONE; irqreturn_t retval = IRQ_NONE;
struct ufs_hba *hba = __hba; struct ufs_hba *hba = __hba;
int retries = hba->nutrs; int retries = hba->nutrs;
@@ -7597,7 +7600,7 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba)
* read, make sure we handle them by checking the interrupt status * read, make sure we handle them by checking the interrupt status
* again in a loop until we process all of the reqs before returning. * again in a loop until we process all of the reqs before returning.
*/ */
do { while (intr_status && retries--) {
enabled_intr_status = enabled_intr_status =
intr_status & ufshcd_readl(hba, REG_INTERRUPT_ENABLE); intr_status & ufshcd_readl(hba, REG_INTERRUPT_ENABLE);
if (intr_status) if (intr_status)
@@ -7606,7 +7609,7 @@ static irqreturn_t ufshcd_intr(int irq, void *__hba)
retval |= ufshcd_sl_intr(hba, enabled_intr_status); retval |= ufshcd_sl_intr(hba, enabled_intr_status);
intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS); intr_status = ufshcd_readl(hba, REG_INTERRUPT_STATUS);
} while (intr_status && --retries); }
if (retval == IRQ_NONE) { if (retval == IRQ_NONE) {
dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x\n", dev_err(hba->dev, "%s: Unhandled interrupt 0x%08x\n",
@@ -7929,7 +7932,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
/* command completed already */ /* command completed already */
dev_err(hba->dev, "%s: cmd at tag %d successfully cleared from DB.\n", dev_err(hba->dev, "%s: cmd at tag %d successfully cleared from DB.\n",
__func__, tag); __func__, tag);
goto out; goto cleanup;
} else { } else {
dev_err(hba->dev, dev_err(hba->dev,
"%s: no response from device. tag = %d, err %d\n", "%s: no response from device. tag = %d, err %d\n",
@@ -7963,6 +7966,7 @@ static int ufshcd_abort(struct scsi_cmnd *cmd)
goto out; goto out;
} }
cleanup:
scsi_dma_unmap(cmd); scsi_dma_unmap(cmd);
spin_lock_irqsave(host->host_lock, flags); spin_lock_irqsave(host->host_lock, flags);

View File

@@ -254,7 +254,8 @@ static int stm32_spi_prepare_mbr(struct stm32_spi *spi, u32 speed_hz)
{ {
u32 div, mbrdiv; u32 div, mbrdiv;
div = DIV_ROUND_UP(spi->clk_rate, speed_hz); /* Ensure spi->clk_rate is even */
div = DIV_ROUND_UP(spi->clk_rate & ~0x1, speed_hz);
/* /*
* SPI framework set xfer->speed_hz to master->max_speed_hz if * SPI framework set xfer->speed_hz to master->max_speed_hz if

View File

@@ -997,7 +997,14 @@ static unsigned int tcmu_handle_completions(struct tcmu_dev *udev)
struct tcmu_cmd_entry *entry = (void *) mb + CMDR_OFF + udev->cmdr_last_cleaned; struct tcmu_cmd_entry *entry = (void *) mb + CMDR_OFF + udev->cmdr_last_cleaned;
struct tcmu_cmd *cmd; struct tcmu_cmd *cmd;
tcmu_flush_dcache_range(entry, sizeof(*entry)); /*
* Flush max. up to end of cmd ring since current entry might
* be a padding that is shorter than sizeof(*entry)
*/
size_t ring_left = head_to_end(udev->cmdr_last_cleaned,
udev->cmdr_size);
tcmu_flush_dcache_range(entry, ring_left < sizeof(*entry) ?
ring_left : sizeof(*entry));
if (tcmu_hdr_get_op(entry->hdr.len_op) == TCMU_OP_PAD) { if (tcmu_hdr_get_op(entry->hdr.len_op) == TCMU_OP_PAD) {
UPDATE_HEAD(udev->cmdr_last_cleaned, UPDATE_HEAD(udev->cmdr_last_cleaned,

View File

@@ -629,6 +629,24 @@ static const struct exar8250_board pbn_exar_XR17V35x = {
.exit = pci_xr17v35x_exit, .exit = pci_xr17v35x_exit,
}; };
static const struct exar8250_board pbn_fastcom35x_2 = {
.num_ports = 2,
.setup = pci_xr17v35x_setup,
.exit = pci_xr17v35x_exit,
};
static const struct exar8250_board pbn_fastcom35x_4 = {
.num_ports = 4,
.setup = pci_xr17v35x_setup,
.exit = pci_xr17v35x_exit,
};
static const struct exar8250_board pbn_fastcom35x_8 = {
.num_ports = 8,
.setup = pci_xr17v35x_setup,
.exit = pci_xr17v35x_exit,
};
static const struct exar8250_board pbn_exar_XR17V4358 = { static const struct exar8250_board pbn_exar_XR17V4358 = {
.num_ports = 12, .num_ports = 12,
.has_slave = true, .has_slave = true,
@@ -701,9 +719,9 @@ static const struct pci_device_id exar_pci_tbl[] = {
EXAR_DEVICE(EXAR, EXAR_XR17V358, pbn_exar_XR17V35x), EXAR_DEVICE(EXAR, EXAR_XR17V358, pbn_exar_XR17V35x),
EXAR_DEVICE(EXAR, EXAR_XR17V4358, pbn_exar_XR17V4358), EXAR_DEVICE(EXAR, EXAR_XR17V4358, pbn_exar_XR17V4358),
EXAR_DEVICE(EXAR, EXAR_XR17V8358, pbn_exar_XR17V8358), EXAR_DEVICE(EXAR, EXAR_XR17V8358, pbn_exar_XR17V8358),
EXAR_DEVICE(COMMTECH, COMMTECH_4222PCIE, pbn_exar_XR17V35x), EXAR_DEVICE(COMMTECH, COMMTECH_4222PCIE, pbn_fastcom35x_2),
EXAR_DEVICE(COMMTECH, COMMTECH_4224PCIE, pbn_exar_XR17V35x), EXAR_DEVICE(COMMTECH, COMMTECH_4224PCIE, pbn_fastcom35x_4),
EXAR_DEVICE(COMMTECH, COMMTECH_4228PCIE, pbn_exar_XR17V35x), EXAR_DEVICE(COMMTECH, COMMTECH_4228PCIE, pbn_fastcom35x_8),
EXAR_DEVICE(COMMTECH, COMMTECH_4222PCI335, pbn_fastcom335_2), EXAR_DEVICE(COMMTECH, COMMTECH_4222PCI335, pbn_fastcom335_2),
EXAR_DEVICE(COMMTECH, COMMTECH_4224PCI335, pbn_fastcom335_4), EXAR_DEVICE(COMMTECH, COMMTECH_4224PCI335, pbn_fastcom335_4),

View File

@@ -2264,6 +2264,10 @@ int serial8250_do_startup(struct uart_port *port)
if (port->irq && !(up->port.flags & UPF_NO_THRE_TEST)) { if (port->irq && !(up->port.flags & UPF_NO_THRE_TEST)) {
unsigned char iir1; unsigned char iir1;
if (port->irqflags & IRQF_SHARED)
disable_irq_nosync(port->irq);
/* /*
* Test for UARTs that do not reassert THRE when the * Test for UARTs that do not reassert THRE when the
* transmitter is idle and the interrupt has already * transmitter is idle and the interrupt has already
@@ -2273,8 +2277,6 @@ int serial8250_do_startup(struct uart_port *port)
* allow register changes to become visible. * allow register changes to become visible.
*/ */
spin_lock_irqsave(&port->lock, flags); spin_lock_irqsave(&port->lock, flags);
if (up->port.irqflags & IRQF_SHARED)
disable_irq_nosync(port->irq);
wait_for_xmitr(up, UART_LSR_THRE); wait_for_xmitr(up, UART_LSR_THRE);
serial_port_out_sync(port, UART_IER, UART_IER_THRI); serial_port_out_sync(port, UART_IER, UART_IER_THRI);
@@ -2286,9 +2288,10 @@ int serial8250_do_startup(struct uart_port *port)
iir = serial_port_in(port, UART_IIR); iir = serial_port_in(port, UART_IIR);
serial_port_out(port, UART_IER, 0); serial_port_out(port, UART_IER, 0);
spin_unlock_irqrestore(&port->lock, flags);
if (port->irqflags & IRQF_SHARED) if (port->irqflags & IRQF_SHARED)
enable_irq(port->irq); enable_irq(port->irq);
spin_unlock_irqrestore(&port->lock, flags);
/* /*
* If the interrupt is not reasserted, or we otherwise * If the interrupt is not reasserted, or we otherwise

View File

@@ -2272,9 +2272,8 @@ pl011_console_write(struct console *co, const char *s, unsigned int count)
clk_disable(uap->clk); clk_disable(uap->clk);
} }
static void __init static void pl011_console_get_options(struct uart_amba_port *uap, int *baud,
pl011_console_get_options(struct uart_amba_port *uap, int *baud, int *parity, int *bits)
int *parity, int *bits)
{ {
if (pl011_read(uap, REG_CR) & UART01x_CR_UARTEN) { if (pl011_read(uap, REG_CR) & UART01x_CR_UARTEN) {
unsigned int lcr_h, ibrd, fbrd; unsigned int lcr_h, ibrd, fbrd;
@@ -2307,7 +2306,7 @@ pl011_console_get_options(struct uart_amba_port *uap, int *baud,
} }
} }
static int __init pl011_console_setup(struct console *co, char *options) static int pl011_console_setup(struct console *co, char *options)
{ {
struct uart_amba_port *uap; struct uart_amba_port *uap;
int baud = 38400; int baud = 38400;
@@ -2375,8 +2374,8 @@ static int __init pl011_console_setup(struct console *co, char *options)
* *
* Returns 0 if console matches; otherwise non-zero to use default matching * Returns 0 if console matches; otherwise non-zero to use default matching
*/ */
static int __init pl011_console_match(struct console *co, char *name, int idx, static int pl011_console_match(struct console *co, char *name, int idx,
char *options) char *options)
{ {
unsigned char iotype; unsigned char iotype;
resource_size_t addr; resource_size_t addr;
@@ -2614,7 +2613,7 @@ static int pl011_setup_port(struct device *dev, struct uart_amba_port *uap,
static int pl011_register_port(struct uart_amba_port *uap) static int pl011_register_port(struct uart_amba_port *uap)
{ {
int ret; int ret, i;
/* Ensure interrupts from this UART are masked and cleared */ /* Ensure interrupts from this UART are masked and cleared */
pl011_write(0, uap, REG_IMSC); pl011_write(0, uap, REG_IMSC);
@@ -2625,6 +2624,9 @@ static int pl011_register_port(struct uart_amba_port *uap)
if (ret < 0) { if (ret < 0) {
dev_err(uap->port.dev, dev_err(uap->port.dev,
"Failed to register AMBA-PL011 driver\n"); "Failed to register AMBA-PL011 driver\n");
for (i = 0; i < ARRAY_SIZE(amba_ports); i++)
if (amba_ports[i] == uap)
amba_ports[i] = NULL;
return ret; return ret;
} }
} }

View File

@@ -1733,9 +1733,11 @@ static int s3c24xx_serial_init_port(struct s3c24xx_uart_port *ourport,
ourport->tx_irq = ret + 1; ourport->tx_irq = ret + 1;
} }
ret = platform_get_irq(platdev, 1); if (!s3c24xx_serial_has_interrupt_mask(port)) {
if (ret > 0) ret = platform_get_irq(platdev, 1);
ourport->tx_irq = ret; if (ret > 0)
ourport->tx_irq = ret;
}
/* /*
* DMA is currently supported only on DT platforms, if DMA properties * DMA is currently supported only on DT platforms, if DMA properties
* are specified. * are specified.

View File

@@ -865,7 +865,7 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
unsigned int old_rows, old_row_size; unsigned int old_rows, old_row_size;
unsigned int new_cols, new_rows, new_row_size, new_screen_size; unsigned int new_cols, new_rows, new_row_size, new_screen_size;
unsigned int user; unsigned int user;
unsigned short *newscreen; unsigned short *oldscreen, *newscreen;
WARN_CONSOLE_UNLOCKED(); WARN_CONSOLE_UNLOCKED();
@@ -947,10 +947,11 @@ static int vc_do_resize(struct tty_struct *tty, struct vc_data *vc,
if (new_scr_end > new_origin) if (new_scr_end > new_origin)
scr_memsetw((void *)new_origin, vc->vc_video_erase_char, scr_memsetw((void *)new_origin, vc->vc_video_erase_char,
new_scr_end - new_origin); new_scr_end - new_origin);
kfree(vc->vc_screenbuf); oldscreen = vc->vc_screenbuf;
vc->vc_screenbuf = newscreen; vc->vc_screenbuf = newscreen;
vc->vc_screenbuf_size = new_screen_size; vc->vc_screenbuf_size = new_screen_size;
set_origin(vc); set_origin(vc);
kfree(oldscreen);
/* do part of a reset_terminal() */ /* do part of a reset_terminal() */
vc->vc_top = 0; vc->vc_top = 0;

View File

@@ -893,12 +893,22 @@ int vt_ioctl(struct tty_struct *tty,
console_lock(); console_lock();
vcp = vc_cons[i].d; vcp = vc_cons[i].d;
if (vcp) { if (vcp) {
int ret;
int save_scan_lines = vcp->vc_scan_lines;
int save_font_height = vcp->vc_font.height;
if (v.v_vlin) if (v.v_vlin)
vcp->vc_scan_lines = v.v_vlin; vcp->vc_scan_lines = v.v_vlin;
if (v.v_clin) if (v.v_clin)
vcp->vc_font.height = v.v_clin; vcp->vc_font.height = v.v_clin;
vcp->vc_resize_user = 1; vcp->vc_resize_user = 1;
vc_resize(vcp, v.v_cols, v.v_rows); ret = vc_resize(vcp, v.v_cols, v.v_rows);
if (ret) {
vcp->vc_scan_lines = save_scan_lines;
vcp->vc_font.height = save_font_height;
console_unlock();
return ret;
}
} }
console_unlock(); console_unlock();
} }

View File

@@ -390,21 +390,19 @@ static void acm_ctrl_irq(struct urb *urb)
if (current_size < expected_size) { if (current_size < expected_size) {
/* notification is transmitted fragmented, reassemble */ /* notification is transmitted fragmented, reassemble */
if (acm->nb_size < expected_size) { if (acm->nb_size < expected_size) {
if (acm->nb_size) { u8 *new_buffer;
kfree(acm->notification_buffer);
acm->nb_size = 0;
}
alloc_size = roundup_pow_of_two(expected_size); alloc_size = roundup_pow_of_two(expected_size);
/* /* Final freeing is done on disconnect. */
* kmalloc ensures a valid notification_buffer after a new_buffer = krealloc(acm->notification_buffer,
* use of kfree in case the previous allocation was too alloc_size, GFP_ATOMIC);
* small. Final freeing is done on disconnect. if (!new_buffer) {
*/ acm->nb_index = 0;
acm->notification_buffer =
kmalloc(alloc_size, GFP_ATOMIC);
if (!acm->notification_buffer)
goto exit; goto exit;
}
acm->notification_buffer = new_buffer;
acm->nb_size = alloc_size; acm->nb_size = alloc_size;
dr = (struct usb_cdc_notification *)acm->notification_buffer;
} }
copy_size = min(current_size, copy_size = min(current_size,

View File

@@ -299,6 +299,8 @@ static const struct usb_device_id usb_quirk_list[] = {
{ USB_DEVICE(0x2386, 0x3119), .driver_info = USB_QUIRK_NO_LPM }, { USB_DEVICE(0x2386, 0x3119), .driver_info = USB_QUIRK_NO_LPM },
{ USB_DEVICE(0x2386, 0x350e), .driver_info = USB_QUIRK_NO_LPM },
/* DJI CineSSD */ /* DJI CineSSD */
{ USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM }, { USB_DEVICE(0x2ca3, 0x0031), .driver_info = USB_QUIRK_NO_LPM },

View File

@@ -1202,12 +1202,15 @@ static int ncm_unwrap_ntb(struct gether *port,
int ndp_index; int ndp_index;
unsigned dg_len, dg_len2; unsigned dg_len, dg_len2;
unsigned ndp_len; unsigned ndp_len;
unsigned block_len;
struct sk_buff *skb2; struct sk_buff *skb2;
int ret = -EINVAL; int ret = -EINVAL;
unsigned max_size = le32_to_cpu(ntb_parameters.dwNtbOutMaxSize); unsigned ntb_max = le32_to_cpu(ntb_parameters.dwNtbOutMaxSize);
unsigned frame_max = le16_to_cpu(ecm_desc.wMaxSegmentSize);
const struct ndp_parser_opts *opts = ncm->parser_opts; const struct ndp_parser_opts *opts = ncm->parser_opts;
unsigned crc_len = ncm->is_crc ? sizeof(uint32_t) : 0; unsigned crc_len = ncm->is_crc ? sizeof(uint32_t) : 0;
int dgram_counter; int dgram_counter;
bool ndp_after_header;
/* dwSignature */ /* dwSignature */
if (get_unaligned_le32(tmp) != opts->nth_sign) { if (get_unaligned_le32(tmp) != opts->nth_sign) {
@@ -1226,25 +1229,37 @@ static int ncm_unwrap_ntb(struct gether *port,
} }
tmp++; /* skip wSequence */ tmp++; /* skip wSequence */
block_len = get_ncm(&tmp, opts->block_length);
/* (d)wBlockLength */ /* (d)wBlockLength */
if (get_ncm(&tmp, opts->block_length) > max_size) { if (block_len > ntb_max) {
INFO(port->func.config->cdev, "OUT size exceeded\n"); INFO(port->func.config->cdev, "OUT size exceeded\n");
goto err; goto err;
} }
ndp_index = get_ncm(&tmp, opts->ndp_index); ndp_index = get_ncm(&tmp, opts->ndp_index);
ndp_after_header = false;
/* Run through all the NDP's in the NTB */ /* Run through all the NDP's in the NTB */
do { do {
/* NCM 3.2 */ /*
if (((ndp_index % 4) != 0) && * NCM 3.2
(ndp_index < opts->nth_size)) { * dwNdpIndex
*/
if (((ndp_index % 4) != 0) ||
(ndp_index < opts->nth_size) ||
(ndp_index > (block_len -
opts->ndp_size))) {
INFO(port->func.config->cdev, "Bad index: %#X\n", INFO(port->func.config->cdev, "Bad index: %#X\n",
ndp_index); ndp_index);
goto err; goto err;
} }
if (ndp_index == opts->nth_size)
ndp_after_header = true;
/* walk through NDP */ /*
* walk through NDP
* dwSignature
*/
tmp = (void *)(skb->data + ndp_index); tmp = (void *)(skb->data + ndp_index);
if (get_unaligned_le32(tmp) != ncm->ndp_sign) { if (get_unaligned_le32(tmp) != ncm->ndp_sign) {
INFO(port->func.config->cdev, "Wrong NDP SIGN\n"); INFO(port->func.config->cdev, "Wrong NDP SIGN\n");
@@ -1255,14 +1270,15 @@ static int ncm_unwrap_ntb(struct gether *port,
ndp_len = get_unaligned_le16(tmp++); ndp_len = get_unaligned_le16(tmp++);
/* /*
* NCM 3.3.1 * NCM 3.3.1
* wLength
* entry is 2 items * entry is 2 items
* item size is 16/32 bits, opts->dgram_item_len * 2 bytes * item size is 16/32 bits, opts->dgram_item_len * 2 bytes
* minimal: struct usb_cdc_ncm_ndpX + normal entry + zero entry * minimal: struct usb_cdc_ncm_ndpX + normal entry + zero entry
* Each entry is a dgram index and a dgram length. * Each entry is a dgram index and a dgram length.
*/ */
if ((ndp_len < opts->ndp_size if ((ndp_len < opts->ndp_size
+ 2 * 2 * (opts->dgram_item_len * 2)) + 2 * 2 * (opts->dgram_item_len * 2)) ||
|| (ndp_len % opts->ndplen_align != 0)) { (ndp_len % opts->ndplen_align != 0)) {
INFO(port->func.config->cdev, "Bad NDP length: %#X\n", INFO(port->func.config->cdev, "Bad NDP length: %#X\n",
ndp_len); ndp_len);
goto err; goto err;
@@ -1279,8 +1295,21 @@ static int ncm_unwrap_ntb(struct gether *port,
do { do {
index = index2; index = index2;
/* wDatagramIndex[0] */
if ((index < opts->nth_size) ||
(index > block_len - opts->dpe_size)) {
INFO(port->func.config->cdev,
"Bad index: %#X\n", index);
goto err;
}
dg_len = dg_len2; dg_len = dg_len2;
if (dg_len < 14 + crc_len) { /* ethernet hdr + crc */ /*
* wDatagramLength[0]
* ethernet hdr + crc or larger than max frame size
*/
if ((dg_len < 14 + crc_len) ||
(dg_len > frame_max)) {
INFO(port->func.config->cdev, INFO(port->func.config->cdev,
"Bad dgram length: %#X\n", dg_len); "Bad dgram length: %#X\n", dg_len);
goto err; goto err;
@@ -1304,6 +1333,37 @@ static int ncm_unwrap_ntb(struct gether *port,
index2 = get_ncm(&tmp, opts->dgram_item_len); index2 = get_ncm(&tmp, opts->dgram_item_len);
dg_len2 = get_ncm(&tmp, opts->dgram_item_len); dg_len2 = get_ncm(&tmp, opts->dgram_item_len);
if (index2 == 0 || dg_len2 == 0)
break;
/* wDatagramIndex[1] */
if (ndp_after_header) {
if (index2 < opts->nth_size + opts->ndp_size) {
INFO(port->func.config->cdev,
"Bad index: %#X\n", index2);
goto err;
}
} else {
if (index2 < opts->nth_size + opts->dpe_size) {
INFO(port->func.config->cdev,
"Bad index: %#X\n", index2);
goto err;
}
}
if (index2 > block_len - opts->dpe_size) {
INFO(port->func.config->cdev,
"Bad index: %#X\n", index2);
goto err;
}
/* wDatagramLength[1] */
if ((dg_len2 < 14 + crc_len) ||
(dg_len2 > frame_max)) {
INFO(port->func.config->cdev,
"Bad dgram length: %#X\n", dg_len);
goto err;
}
/* /*
* Copy the data into a new skb. * Copy the data into a new skb.
* This ensures the truesize is correct * This ensures the truesize is correct
@@ -1320,9 +1380,6 @@ static int ncm_unwrap_ntb(struct gether *port,
ndp_len -= 2 * (opts->dgram_item_len * 2); ndp_len -= 2 * (opts->dgram_item_len * 2);
dgram_counter++; dgram_counter++;
if (index2 == 0 || dg_len2 == 0)
break;
} while (ndp_len > 2 * (opts->dgram_item_len * 2)); } while (ndp_len > 2 * (opts->dgram_item_len * 2));
} while (ndp_index); } while (ndp_index);

View File

@@ -751,12 +751,13 @@ static int uasp_alloc_stream_res(struct f_uas *fu, struct uas_stream *stream)
goto err_sts; goto err_sts;
return 0; return 0;
err_sts: err_sts:
usb_ep_free_request(fu->ep_status, stream->req_status);
stream->req_status = NULL;
err_out:
usb_ep_free_request(fu->ep_out, stream->req_out); usb_ep_free_request(fu->ep_out, stream->req_out);
stream->req_out = NULL; stream->req_out = NULL;
err_out:
usb_ep_free_request(fu->ep_in, stream->req_in);
stream->req_in = NULL;
out: out:
return -ENOMEM; return -ENOMEM;
} }

View File

@@ -17,6 +17,7 @@
#define __U_F_H__ #define __U_F_H__
#include <linux/usb/gadget.h> #include <linux/usb/gadget.h>
#include <linux/overflow.h>
/* Variable Length Array Macros **********************************************/ /* Variable Length Array Macros **********************************************/
#define vla_group(groupname) size_t groupname##__next = 0 #define vla_group(groupname) size_t groupname##__next = 0
@@ -24,21 +25,36 @@
#define vla_item(groupname, type, name, n) \ #define vla_item(groupname, type, name, n) \
size_t groupname##_##name##__offset = ({ \ size_t groupname##_##name##__offset = ({ \
size_t align_mask = __alignof__(type) - 1; \ size_t offset = 0; \
size_t offset = (groupname##__next + align_mask) & ~align_mask;\ if (groupname##__next != SIZE_MAX) { \
size_t size = (n) * sizeof(type); \ size_t align_mask = __alignof__(type) - 1; \
groupname##__next = offset + size; \ size_t size = array_size(n, sizeof(type)); \
offset = (groupname##__next + align_mask) & \
~align_mask; \
if (check_add_overflow(offset, size, \
&groupname##__next)) { \
groupname##__next = SIZE_MAX; \
offset = 0; \
} \
} \
offset; \ offset; \
}) })
#define vla_item_with_sz(groupname, type, name, n) \ #define vla_item_with_sz(groupname, type, name, n) \
size_t groupname##_##name##__sz = (n) * sizeof(type); \ size_t groupname##_##name##__sz = array_size(n, sizeof(type)); \
size_t groupname##_##name##__offset = ({ \ size_t groupname##_##name##__offset = ({ \
size_t align_mask = __alignof__(type) - 1; \ size_t offset = 0; \
size_t offset = (groupname##__next + align_mask) & ~align_mask;\ if (groupname##__next != SIZE_MAX) { \
size_t size = groupname##_##name##__sz; \ size_t align_mask = __alignof__(type) - 1; \
groupname##__next = offset + size; \ offset = (groupname##__next + align_mask) & \
offset; \ ~align_mask; \
if (check_add_overflow(offset, groupname##_##name##__sz,\
&groupname##__next)) { \
groupname##__next = SIZE_MAX; \
offset = 0; \
} \
} \
offset; \
}) })
#define vla_ptr(ptr, groupname, name) \ #define vla_ptr(ptr, groupname, name) \

View File

@@ -166,9 +166,8 @@ skip_phy:
hcd->rsrc_len = resource_size(res); hcd->rsrc_len = resource_size(res);
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (!irq) { if (irq < 0) {
dev_err(&pdev->dev, "Failed to get IRQ\n"); err = irq;
err = -ENODEV;
goto fail_io; goto fail_io;
} }

View File

@@ -751,15 +751,6 @@ static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci,
{ {
u32 pls = status_reg & PORT_PLS_MASK; u32 pls = status_reg & PORT_PLS_MASK;
/* resume state is a xHCI internal state.
* Do not report it to usb core, instead, pretend to be U3,
* thus usb core knows it's not ready for transfer
*/
if (pls == XDEV_RESUME) {
*status |= USB_SS_PORT_LS_U3;
return;
}
/* When the CAS bit is set then warm reset /* When the CAS bit is set then warm reset
* should be performed on port * should be performed on port
*/ */
@@ -781,6 +772,16 @@ static void xhci_hub_report_usb3_link_state(struct xhci_hcd *xhci,
*/ */
pls |= USB_PORT_STAT_CONNECTION; pls |= USB_PORT_STAT_CONNECTION;
} else { } else {
/*
* Resume state is an xHCI internal state. Do not report it to
* usb core, instead, pretend to be U3, thus usb core knows
* it's not ready for transfer.
*/
if (pls == XDEV_RESUME) {
*status |= USB_SS_PORT_LS_U3;
return;
}
/* /*
* If CAS bit isn't set but the Port is already at * If CAS bit isn't set but the Port is already at
* Compliance Mode, fake a connection so the USB core * Compliance Mode, fake a connection so the USB core

View File

@@ -439,7 +439,7 @@ static int lvs_rh_probe(struct usb_interface *intf,
USB_DT_SS_HUB_SIZE, USB_CTRL_GET_TIMEOUT); USB_DT_SS_HUB_SIZE, USB_CTRL_GET_TIMEOUT);
if (ret < (USB_DT_HUB_NONVAR_SIZE + 2)) { if (ret < (USB_DT_HUB_NONVAR_SIZE + 2)) {
dev_err(&hdev->dev, "wrong root hub descriptor read %d\n", ret); dev_err(&hdev->dev, "wrong root hub descriptor read %d\n", ret);
return ret; return ret < 0 ? ret : -EINVAL;
} }
/* submit urb to poll interrupt endpoint */ /* submit urb to poll interrupt endpoint */

View File

@@ -760,7 +760,7 @@ static int sisusb_write_mem_bulk(struct sisusb_usb_data *sisusb, u32 addr,
u8 swap8, fromkern = kernbuffer ? 1 : 0; u8 swap8, fromkern = kernbuffer ? 1 : 0;
u16 swap16; u16 swap16;
u32 swap32, flag = (length >> 28) & 1; u32 swap32, flag = (length >> 28) & 1;
char buf[4]; u8 buf[4];
/* if neither kernbuffer not userbuffer are given, assume /* if neither kernbuffer not userbuffer are given, assume
* data in obuf * data in obuf

View File

@@ -496,7 +496,7 @@ static ssize_t yurex_write(struct file *file, const char __user *user_buffer,
prepare_to_wait(&dev->waitq, &wait, TASK_INTERRUPTIBLE); prepare_to_wait(&dev->waitq, &wait, TASK_INTERRUPTIBLE);
dev_dbg(&dev->interface->dev, "%s - submit %c\n", __func__, dev_dbg(&dev->interface->dev, "%s - submit %c\n", __func__,
dev->cntl_buffer[0]); dev->cntl_buffer[0]);
retval = usb_submit_urb(dev->cntl_urb, GFP_KERNEL); retval = usb_submit_urb(dev->cntl_urb, GFP_ATOMIC);
if (retval >= 0) if (retval >= 0)
timeout = schedule_timeout(YUREX_WRITE_TIMEOUT); timeout = schedule_timeout(YUREX_WRITE_TIMEOUT);
finish_wait(&dev->waitq, &wait); finish_wait(&dev->waitq, &wait);

View File

@@ -2347,7 +2347,7 @@ UNUSUAL_DEV( 0x357d, 0x7788, 0x0114, 0x0114,
"JMicron", "JMicron",
"USB to ATA/ATAPI Bridge", "USB to ATA/ATAPI Bridge",
USB_SC_DEVICE, USB_PR_DEVICE, NULL, USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_BROKEN_FUA ), US_FL_BROKEN_FUA | US_FL_IGNORE_UAS ),
/* Reported by Andrey Rahmatullin <wrar@altlinux.org> */ /* Reported by Andrey Rahmatullin <wrar@altlinux.org> */
UNUSUAL_DEV( 0x4102, 0x1020, 0x0100, 0x0100, UNUSUAL_DEV( 0x4102, 0x1020, 0x0100, 0x0100,

View File

@@ -41,6 +41,13 @@
* and don't forget to CC: the USB development list <linux-usb@vger.kernel.org> * and don't forget to CC: the USB development list <linux-usb@vger.kernel.org>
*/ */
/* Reported-by: Till Dörges <doerges@pre-sense.de> */
UNUSUAL_DEV(0x054c, 0x087d, 0x0000, 0x9999,
"Sony",
"PSZ-HA*",
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_NO_REPORT_OPCODES),
/* Reported-by: Julian Groß <julian.g@posteo.de> */ /* Reported-by: Julian Groß <julian.g@posteo.de> */
UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999, UNUSUAL_DEV(0x059f, 0x105f, 0x0000, 0x9999,
"LaCie", "LaCie",
@@ -156,6 +163,13 @@ UNUSUAL_DEV(0x152d, 0x0578, 0x0000, 0x9999,
USB_SC_DEVICE, USB_PR_DEVICE, NULL, USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_BROKEN_FUA), US_FL_BROKEN_FUA),
/* Reported-by: Thinh Nguyen <thinhn@synopsys.com> */
UNUSUAL_DEV(0x154b, 0xf00d, 0x0000, 0x9999,
"PNY",
"Pro Elite SSD",
USB_SC_DEVICE, USB_PR_DEVICE, NULL,
US_FL_NO_ATA_1X),
/* Reported-by: Hans de Goede <hdegoede@redhat.com> */ /* Reported-by: Hans de Goede <hdegoede@redhat.com> */
UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999, UNUSUAL_DEV(0x2109, 0x0711, 0x0000, 0x9999,
"VIA", "VIA",

View File

@@ -2131,6 +2131,9 @@ static void updatescrollmode(struct display *p,
} }
} }
#define PITCH(w) (((w) + 7) >> 3)
#define CALC_FONTSZ(h, p, c) ((h) * (p) * (c)) /* size = height * pitch * charcount */
static int fbcon_resize(struct vc_data *vc, unsigned int width, static int fbcon_resize(struct vc_data *vc, unsigned int width,
unsigned int height, unsigned int user) unsigned int height, unsigned int user)
{ {
@@ -2140,6 +2143,24 @@ static int fbcon_resize(struct vc_data *vc, unsigned int width,
struct fb_var_screeninfo var = info->var; struct fb_var_screeninfo var = info->var;
int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh; int x_diff, y_diff, virt_w, virt_h, virt_fw, virt_fh;
if (ops->p && ops->p->userfont && FNTSIZE(vc->vc_font.data)) {
int size;
int pitch = PITCH(vc->vc_font.width);
/*
* If user font, ensure that a possible change to user font
* height or width will not allow a font data out-of-bounds access.
* NOTE: must use original charcount in calculation as font
* charcount can change and cannot be used to determine the
* font data allocated size.
*/
if (pitch <= 0)
return -EINVAL;
size = CALC_FONTSZ(vc->vc_font.height, pitch, FNTCHARCNT(vc->vc_font.data));
if (size > FNTSIZE(vc->vc_font.data))
return -EINVAL;
}
virt_w = FBCON_SWAP(ops->rotate, width, height); virt_w = FBCON_SWAP(ops->rotate, width, height);
virt_h = FBCON_SWAP(ops->rotate, height, width); virt_h = FBCON_SWAP(ops->rotate, height, width);
virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width, virt_fw = FBCON_SWAP(ops->rotate, vc->vc_font.width,
@@ -2602,7 +2623,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
int size; int size;
int i, csum; int i, csum;
u8 *new_data, *data = font->data; u8 *new_data, *data = font->data;
int pitch = (font->width+7) >> 3; int pitch = PITCH(font->width);
/* Is there a reason why fbconsole couldn't handle any charcount >256? /* Is there a reason why fbconsole couldn't handle any charcount >256?
* If not this check should be changed to charcount < 256 */ * If not this check should be changed to charcount < 256 */
@@ -2618,7 +2639,7 @@ static int fbcon_set_font(struct vc_data *vc, struct console_font *font,
if (fbcon_invalid_charcount(info, charcount)) if (fbcon_invalid_charcount(info, charcount))
return -EINVAL; return -EINVAL;
size = h * pitch * charcount; size = CALC_FONTSZ(h, pitch, charcount);
new_data = kmalloc(FONT_EXTRA_WORDS * sizeof(int) + size, GFP_USER); new_data = kmalloc(FONT_EXTRA_WORDS * sizeof(int) + size, GFP_USER);

View File

@@ -531,8 +531,11 @@ int dispc_runtime_get(void)
DSSDBG("dispc_runtime_get\n"); DSSDBG("dispc_runtime_get\n");
r = pm_runtime_get_sync(&dispc.pdev->dev); r = pm_runtime_get_sync(&dispc.pdev->dev);
WARN_ON(r < 0); if (WARN_ON(r < 0)) {
return r < 0 ? r : 0; pm_runtime_put_sync(&dispc.pdev->dev);
return r;
}
return 0;
} }
EXPORT_SYMBOL(dispc_runtime_get); EXPORT_SYMBOL(dispc_runtime_get);

View File

@@ -1148,8 +1148,11 @@ static int dsi_runtime_get(struct platform_device *dsidev)
DSSDBG("dsi_runtime_get\n"); DSSDBG("dsi_runtime_get\n");
r = pm_runtime_get_sync(&dsi->pdev->dev); r = pm_runtime_get_sync(&dsi->pdev->dev);
WARN_ON(r < 0); if (WARN_ON(r < 0)) {
return r < 0 ? r : 0; pm_runtime_put_sync(&dsi->pdev->dev);
return r;
}
return 0;
} }
static void dsi_runtime_put(struct platform_device *dsidev) static void dsi_runtime_put(struct platform_device *dsidev)

View File

@@ -778,8 +778,11 @@ int dss_runtime_get(void)
DSSDBG("dss_runtime_get\n"); DSSDBG("dss_runtime_get\n");
r = pm_runtime_get_sync(&dss.pdev->dev); r = pm_runtime_get_sync(&dss.pdev->dev);
WARN_ON(r < 0); if (WARN_ON(r < 0)) {
return r < 0 ? r : 0; pm_runtime_put_sync(&dss.pdev->dev);
return r;
}
return 0;
} }
void dss_runtime_put(void) void dss_runtime_put(void)

View File

@@ -50,9 +50,10 @@ static int hdmi_runtime_get(void)
DSSDBG("hdmi_runtime_get\n"); DSSDBG("hdmi_runtime_get\n");
r = pm_runtime_get_sync(&hdmi.pdev->dev); r = pm_runtime_get_sync(&hdmi.pdev->dev);
WARN_ON(r < 0); if (WARN_ON(r < 0)) {
if (r < 0) pm_runtime_put_sync(&hdmi.pdev->dev);
return r; return r;
}
return 0; return 0;
} }

View File

@@ -54,9 +54,10 @@ static int hdmi_runtime_get(void)
DSSDBG("hdmi_runtime_get\n"); DSSDBG("hdmi_runtime_get\n");
r = pm_runtime_get_sync(&hdmi.pdev->dev); r = pm_runtime_get_sync(&hdmi.pdev->dev);
WARN_ON(r < 0); if (WARN_ON(r < 0)) {
if (r < 0) pm_runtime_put_sync(&hdmi.pdev->dev);
return r; return r;
}
return 0; return 0;
} }

View File

@@ -402,8 +402,11 @@ static int venc_runtime_get(void)
DSSDBG("venc_runtime_get\n"); DSSDBG("venc_runtime_get\n");
r = pm_runtime_get_sync(&venc.pdev->dev); r = pm_runtime_get_sync(&venc.pdev->dev);
WARN_ON(r < 0); if (WARN_ON(r < 0)) {
return r < 0 ? r : 0; pm_runtime_put_sync(&venc.pdev->dev);
return r;
}
return 0;
} }
static void venc_runtime_put(void) static void venc_runtime_put(void)

View File

@@ -154,7 +154,7 @@ int get_evtchn_to_irq(unsigned evtchn)
/* Get info for IRQ */ /* Get info for IRQ */
struct irq_info *info_for_irq(unsigned irq) struct irq_info *info_for_irq(unsigned irq)
{ {
return irq_get_handler_data(irq); return irq_get_chip_data(irq);
} }
/* Constructors for packed IRQ information. */ /* Constructors for packed IRQ information. */
@@ -375,7 +375,7 @@ static void xen_irq_init(unsigned irq)
info->type = IRQT_UNBOUND; info->type = IRQT_UNBOUND;
info->refcnt = -1; info->refcnt = -1;
irq_set_handler_data(irq, info); irq_set_chip_data(irq, info);
list_add_tail(&info->list, &xen_irq_list_head); list_add_tail(&info->list, &xen_irq_list_head);
} }
@@ -424,14 +424,14 @@ static int __must_check xen_allocate_irq_gsi(unsigned gsi)
static void xen_free_irq(unsigned irq) static void xen_free_irq(unsigned irq)
{ {
struct irq_info *info = irq_get_handler_data(irq); struct irq_info *info = irq_get_chip_data(irq);
if (WARN_ON(!info)) if (WARN_ON(!info))
return; return;
list_del(&info->list); list_del(&info->list);
irq_set_handler_data(irq, NULL); irq_set_chip_data(irq, NULL);
WARN_ON(info->refcnt > 0); WARN_ON(info->refcnt > 0);
@@ -601,7 +601,7 @@ EXPORT_SYMBOL_GPL(xen_irq_from_gsi);
static void __unbind_from_irq(unsigned int irq) static void __unbind_from_irq(unsigned int irq)
{ {
int evtchn = evtchn_from_irq(irq); int evtchn = evtchn_from_irq(irq);
struct irq_info *info = irq_get_handler_data(irq); struct irq_info *info = irq_get_chip_data(irq);
if (info->refcnt > 0) { if (info->refcnt > 0) {
info->refcnt--; info->refcnt--;
@@ -1105,7 +1105,7 @@ int bind_ipi_to_irqhandler(enum ipi_vector ipi,
void unbind_from_irqhandler(unsigned int irq, void *dev_id) void unbind_from_irqhandler(unsigned int irq, void *dev_id)
{ {
struct irq_info *info = irq_get_handler_data(irq); struct irq_info *info = irq_get_chip_data(irq);
if (WARN_ON(!info)) if (WARN_ON(!info))
return; return;
@@ -1139,7 +1139,7 @@ int evtchn_make_refcounted(unsigned int evtchn)
if (irq == -1) if (irq == -1)
return -ENOENT; return -ENOENT;
info = irq_get_handler_data(irq); info = irq_get_chip_data(irq);
if (!info) if (!info)
return -ENOENT; return -ENOENT;
@@ -1167,7 +1167,7 @@ int evtchn_get(unsigned int evtchn)
if (irq == -1) if (irq == -1)
goto done; goto done;
info = irq_get_handler_data(irq); info = irq_get_chip_data(irq);
if (!info) if (!info)
goto done; goto done;

View File

@@ -4344,6 +4344,7 @@ static void btrfs_cleanup_bg_io(struct btrfs_block_group_cache *cache)
cache->io_ctl.inode = NULL; cache->io_ctl.inode = NULL;
iput(inode); iput(inode);
} }
ASSERT(cache->io_ctl.pages == NULL);
btrfs_put_block_group(cache); btrfs_put_block_group(cache);
} }

View File

@@ -1169,7 +1169,6 @@ static int __btrfs_wait_cache_io(struct btrfs_root *root,
ret = update_cache_item(trans, root, inode, path, offset, ret = update_cache_item(trans, root, inode, path, offset,
io_ctl->entries, io_ctl->bitmaps); io_ctl->entries, io_ctl->bitmaps);
out: out:
io_ctl_free(io_ctl);
if (ret) { if (ret) {
invalidate_inode_pages2(inode->i_mapping); invalidate_inode_pages2(inode->i_mapping);
BTRFS_I(inode)->generation = 0; BTRFS_I(inode)->generation = 0;
@@ -1334,6 +1333,7 @@ static int __btrfs_write_out_cache(struct btrfs_root *root, struct inode *inode,
* them out later * them out later
*/ */
io_ctl_drop_pages(io_ctl); io_ctl_drop_pages(io_ctl);
io_ctl_free(io_ctl);
unlock_extent_cached(&BTRFS_I(inode)->io_tree, 0, unlock_extent_cached(&BTRFS_I(inode)->io_tree, 0,
i_size_read(inode) - 1, &cached_state, GFP_NOFS); i_size_read(inode) - 1, &cached_state, GFP_NOFS);

View File

@@ -3311,11 +3311,13 @@ fail:
btrfs_free_path(path); btrfs_free_path(path);
out_unlock: out_unlock:
mutex_unlock(&dir->log_mutex); mutex_unlock(&dir->log_mutex);
if (ret == -ENOSPC) { if (err == -ENOSPC) {
btrfs_set_log_full_commit(root->fs_info, trans); btrfs_set_log_full_commit(root->fs_info, trans);
ret = 0; err = 0;
} else if (ret < 0) } else if (err < 0 && err != -ENOENT) {
btrfs_abort_transaction(trans, ret); /* ENOENT can be returned if the entry hasn't been fsynced yet */
btrfs_abort_transaction(trans, err);
}
btrfs_end_log_trans(root); btrfs_end_log_trans(root);

View File

@@ -3286,6 +3286,15 @@ int __sync_dirty_buffer(struct buffer_head *bh, int op_flags)
WARN_ON(atomic_read(&bh->b_count) < 1); WARN_ON(atomic_read(&bh->b_count) < 1);
lock_buffer(bh); lock_buffer(bh);
if (test_clear_buffer_dirty(bh)) { if (test_clear_buffer_dirty(bh)) {
/*
* The bh should be mapped, but it might not be if the
* device was hot-removed. Not much we can do but fail the I/O.
*/
if (!buffer_mapped(bh)) {
unlock_buffer(bh);
return -EIO;
}
get_bh(bh); get_bh(bh);
bh->b_end_io = end_buffer_write_sync; bh->b_end_io = end_buffer_write_sync;
ret = submit_bh(REQ_OP_WRITE, op_flags, bh); ret = submit_bh(REQ_OP_WRITE, op_flags, bh);

View File

@@ -3519,6 +3519,9 @@ static void delayed_work(struct work_struct *work)
dout("mdsc delayed_work\n"); dout("mdsc delayed_work\n");
ceph_check_delayed_caps(mdsc); ceph_check_delayed_caps(mdsc);
if (mdsc->stopping)
return;
mutex_lock(&mdsc->mutex); mutex_lock(&mdsc->mutex);
renew_interval = mdsc->mdsmap->m_session_timeout >> 2; renew_interval = mdsc->mdsmap->m_session_timeout >> 2;
renew_caps = time_after_eq(jiffies, HZ*renew_interval + renew_caps = time_after_eq(jiffies, HZ*renew_interval +
@@ -3852,7 +3855,16 @@ void ceph_mdsc_force_umount(struct ceph_mds_client *mdsc)
static void ceph_mdsc_stop(struct ceph_mds_client *mdsc) static void ceph_mdsc_stop(struct ceph_mds_client *mdsc)
{ {
dout("stop\n"); dout("stop\n");
cancel_delayed_work_sync(&mdsc->delayed_work); /* cancel timer */ /*
* Make sure the delayed work stopped before releasing
* the resources.
*
* Because the cancel_delayed_work_sync() will only
* guarantee that the work finishes executing. But the
* delayed work will re-arm itself again after that.
*/
flush_delayed_work(&mdsc->delayed_work);
if (mdsc->mdsmap) if (mdsc->mdsmap)
ceph_mdsmap_destroy(mdsc->mdsmap); ceph_mdsmap_destroy(mdsc->mdsmap);
kfree(mdsc->sessions); kfree(mdsc->sessions);

View File

@@ -65,10 +65,10 @@ static int ext4_load_journal(struct super_block *, struct ext4_super_block *,
unsigned long journal_devnum); unsigned long journal_devnum);
static int ext4_show_options(struct seq_file *seq, struct dentry *root); static int ext4_show_options(struct seq_file *seq, struct dentry *root);
static int ext4_commit_super(struct super_block *sb, int sync); static int ext4_commit_super(struct super_block *sb, int sync);
static void ext4_mark_recovery_complete(struct super_block *sb, static int ext4_mark_recovery_complete(struct super_block *sb,
struct ext4_super_block *es); struct ext4_super_block *es);
static void ext4_clear_journal_err(struct super_block *sb, static int ext4_clear_journal_err(struct super_block *sb,
struct ext4_super_block *es); struct ext4_super_block *es);
static int ext4_sync_fs(struct super_block *sb, int wait); static int ext4_sync_fs(struct super_block *sb, int wait);
static void ext4_umount_end(struct super_block *sb, int flags); static void ext4_umount_end(struct super_block *sb, int flags);
static int ext4_remount(struct super_block *sb, int *flags, char *data); static int ext4_remount(struct super_block *sb, int *flags, char *data);
@@ -4543,7 +4543,9 @@ no_journal:
EXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS; EXT4_SB(sb)->s_mount_state &= ~EXT4_ORPHAN_FS;
if (needs_recovery) { if (needs_recovery) {
ext4_msg(sb, KERN_INFO, "recovery complete"); ext4_msg(sb, KERN_INFO, "recovery complete");
ext4_mark_recovery_complete(sb, es); err = ext4_mark_recovery_complete(sb, es);
if (err)
goto failed_mount8;
} }
if (EXT4_SB(sb)->s_journal) { if (EXT4_SB(sb)->s_journal) {
if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA) if (test_opt(sb, DATA_FLAGS) == EXT4_MOUNT_JOURNAL_DATA)
@@ -4586,10 +4588,8 @@ cantfind_ext4:
ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem"); ext4_msg(sb, KERN_ERR, "VFS: Can't find ext4 filesystem");
goto failed_mount; goto failed_mount;
#ifdef CONFIG_QUOTA
failed_mount8: failed_mount8:
ext4_unregister_sysfs(sb); ext4_unregister_sysfs(sb);
#endif
failed_mount7: failed_mount7:
ext4_unregister_li_request(sb); ext4_unregister_li_request(sb);
failed_mount6: failed_mount6:
@@ -4730,7 +4730,8 @@ static journal_t *ext4_get_journal(struct super_block *sb,
struct inode *journal_inode; struct inode *journal_inode;
journal_t *journal; journal_t *journal;
BUG_ON(!ext4_has_feature_journal(sb)); if (WARN_ON_ONCE(!ext4_has_feature_journal(sb)))
return NULL;
journal_inode = ext4_get_journal_inode(sb, journal_inum); journal_inode = ext4_get_journal_inode(sb, journal_inum);
if (!journal_inode) if (!journal_inode)
@@ -4760,7 +4761,8 @@ static journal_t *ext4_get_dev_journal(struct super_block *sb,
struct ext4_super_block *es; struct ext4_super_block *es;
struct block_device *bdev; struct block_device *bdev;
BUG_ON(!ext4_has_feature_journal(sb)); if (WARN_ON_ONCE(!ext4_has_feature_journal(sb)))
return NULL;
bdev = ext4_blkdev_get(j_dev, sb); bdev = ext4_blkdev_get(j_dev, sb);
if (bdev == NULL) if (bdev == NULL)
@@ -4852,7 +4854,8 @@ static int ext4_load_journal(struct super_block *sb,
int err = 0; int err = 0;
int really_read_only; int really_read_only;
BUG_ON(!ext4_has_feature_journal(sb)); if (WARN_ON_ONCE(!ext4_has_feature_journal(sb)))
return -EFSCORRUPTED;
if (journal_devnum && if (journal_devnum &&
journal_devnum != le32_to_cpu(es->s_journal_dev)) { journal_devnum != le32_to_cpu(es->s_journal_dev)) {
@@ -4921,7 +4924,12 @@ static int ext4_load_journal(struct super_block *sb,
} }
EXT4_SB(sb)->s_journal = journal; EXT4_SB(sb)->s_journal = journal;
ext4_clear_journal_err(sb, es); err = ext4_clear_journal_err(sb, es);
if (err) {
EXT4_SB(sb)->s_journal = NULL;
jbd2_journal_destroy(journal);
return err;
}
if (!really_read_only && journal_devnum && if (!really_read_only && journal_devnum &&
journal_devnum != le32_to_cpu(es->s_journal_dev)) { journal_devnum != le32_to_cpu(es->s_journal_dev)) {
@@ -4943,13 +4951,6 @@ static int ext4_commit_super(struct super_block *sb, int sync)
if (!sbh || block_device_ejected(sb)) if (!sbh || block_device_ejected(sb))
return error; return error;
/*
* The superblock bh should be mapped, but it might not be if the
* device was hot-removed. Not much we can do but fail the I/O.
*/
if (!buffer_mapped(sbh))
return error;
/* /*
* If the file system is mounted read-only, don't update the * If the file system is mounted read-only, don't update the
* superblock write time. This avoids updating the superblock * superblock write time. This avoids updating the superblock
@@ -5020,26 +5021,32 @@ static int ext4_commit_super(struct super_block *sb, int sync)
* remounting) the filesystem readonly, then we will end up with a * remounting) the filesystem readonly, then we will end up with a
* consistent fs on disk. Record that fact. * consistent fs on disk. Record that fact.
*/ */
static void ext4_mark_recovery_complete(struct super_block *sb, static int ext4_mark_recovery_complete(struct super_block *sb,
struct ext4_super_block *es) struct ext4_super_block *es)
{ {
int err;
journal_t *journal = EXT4_SB(sb)->s_journal; journal_t *journal = EXT4_SB(sb)->s_journal;
if (!ext4_has_feature_journal(sb)) { if (!ext4_has_feature_journal(sb)) {
BUG_ON(journal != NULL); if (journal != NULL) {
return; ext4_error(sb, "Journal got removed while the fs was "
"mounted!");
return -EFSCORRUPTED;
}
return 0;
} }
jbd2_journal_lock_updates(journal); jbd2_journal_lock_updates(journal);
if (jbd2_journal_flush(journal) < 0) err = jbd2_journal_flush(journal);
if (err < 0)
goto out; goto out;
if (ext4_has_feature_journal_needs_recovery(sb) && sb_rdonly(sb)) { if (ext4_has_feature_journal_needs_recovery(sb) && sb_rdonly(sb)) {
ext4_clear_feature_journal_needs_recovery(sb); ext4_clear_feature_journal_needs_recovery(sb);
ext4_commit_super(sb, 1); ext4_commit_super(sb, 1);
} }
out: out:
jbd2_journal_unlock_updates(journal); jbd2_journal_unlock_updates(journal);
return err;
} }
/* /*
@@ -5047,14 +5054,17 @@ out:
* has recorded an error from a previous lifetime, move that error to the * has recorded an error from a previous lifetime, move that error to the
* main filesystem now. * main filesystem now.
*/ */
static void ext4_clear_journal_err(struct super_block *sb, static int ext4_clear_journal_err(struct super_block *sb,
struct ext4_super_block *es) struct ext4_super_block *es)
{ {
journal_t *journal; journal_t *journal;
int j_errno; int j_errno;
const char *errstr; const char *errstr;
BUG_ON(!ext4_has_feature_journal(sb)); if (!ext4_has_feature_journal(sb)) {
ext4_error(sb, "Journal got removed while the fs was mounted!");
return -EFSCORRUPTED;
}
journal = EXT4_SB(sb)->s_journal; journal = EXT4_SB(sb)->s_journal;
@@ -5079,6 +5089,7 @@ static void ext4_clear_journal_err(struct super_block *sb,
jbd2_journal_clear_err(journal); jbd2_journal_clear_err(journal);
jbd2_journal_update_sb_errno(journal); jbd2_journal_update_sb_errno(journal);
} }
return 0;
} }
/* /*
@@ -5378,8 +5389,13 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
(sbi->s_mount_state & EXT4_VALID_FS)) (sbi->s_mount_state & EXT4_VALID_FS))
es->s_state = cpu_to_le16(sbi->s_mount_state); es->s_state = cpu_to_le16(sbi->s_mount_state);
if (sbi->s_journal) if (sbi->s_journal) {
/*
* We let remount-ro finish even if marking fs
* as clean failed...
*/
ext4_mark_recovery_complete(sb, es); ext4_mark_recovery_complete(sb, es);
}
if (sbi->s_mmp_tsk) if (sbi->s_mmp_tsk)
kthread_stop(sbi->s_mmp_tsk); kthread_stop(sbi->s_mmp_tsk);
} else { } else {
@@ -5427,8 +5443,11 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data)
* been changed by e2fsck since we originally mounted * been changed by e2fsck since we originally mounted
* the partition.) * the partition.)
*/ */
if (sbi->s_journal) if (sbi->s_journal) {
ext4_clear_journal_err(sb, es); err = ext4_clear_journal_err(sb, es);
if (err)
goto restore_opts;
}
sbi->s_mount_state = le16_to_cpu(es->s_state); sbi->s_mount_state = le16_to_cpu(es->s_state);
if (!ext4_setup_super(sb, es, 0)) if (!ext4_setup_super(sb, es, 0))
sb->s_flags &= ~MS_RDONLY; sb->s_flags &= ~MS_RDONLY;

View File

@@ -1914,6 +1914,9 @@ static void __jbd2_journal_temp_unlink_buffer(struct journal_head *jh)
*/ */
static void __jbd2_journal_unfile_buffer(struct journal_head *jh) static void __jbd2_journal_unfile_buffer(struct journal_head *jh)
{ {
J_ASSERT_JH(jh, jh->b_transaction != NULL);
J_ASSERT_JH(jh, jh->b_next_transaction == NULL);
__jbd2_journal_temp_unlink_buffer(jh); __jbd2_journal_temp_unlink_buffer(jh);
jh->b_transaction = NULL; jh->b_transaction = NULL;
jbd2_journal_put_journal_head(jh); jbd2_journal_put_journal_head(jh);
@@ -2005,6 +2008,7 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal,
{ {
struct buffer_head *head; struct buffer_head *head;
struct buffer_head *bh; struct buffer_head *bh;
bool has_write_io_error = false;
int ret = 0; int ret = 0;
J_ASSERT(PageLocked(page)); J_ASSERT(PageLocked(page));
@@ -2029,11 +2033,26 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal,
jbd_unlock_bh_state(bh); jbd_unlock_bh_state(bh);
if (buffer_jbd(bh)) if (buffer_jbd(bh))
goto busy; goto busy;
/*
* If we free a metadata buffer which has been failed to
* write out, the jbd2 checkpoint procedure will not detect
* this failure and may lead to filesystem inconsistency
* after cleanup journal tail.
*/
if (buffer_write_io_error(bh)) {
pr_err("JBD2: Error while async write back metadata bh %llu.",
(unsigned long long)bh->b_blocknr);
has_write_io_error = true;
}
} while ((bh = bh->b_this_page) != head); } while ((bh = bh->b_this_page) != head);
ret = try_to_free_buffers(page); ret = try_to_free_buffers(page);
busy: busy:
if (has_write_io_error)
jbd2_journal_abort(journal, -EIO);
return ret; return ret;
} }
@@ -2461,6 +2480,13 @@ void __jbd2_journal_refile_buffer(struct journal_head *jh)
was_dirty = test_clear_buffer_jbddirty(bh); was_dirty = test_clear_buffer_jbddirty(bh);
__jbd2_journal_temp_unlink_buffer(jh); __jbd2_journal_temp_unlink_buffer(jh);
/*
* b_transaction must be set, otherwise the new b_transaction won't
* be holding jh reference
*/
J_ASSERT_JH(jh, jh->b_transaction != NULL);
/* /*
* We set b_transaction here because b_next_transaction will inherit * We set b_transaction here because b_next_transaction will inherit
* our jh reference and thus __jbd2_journal_file_buffer() must not * our jh reference and thus __jbd2_journal_file_buffer() must not

View File

@@ -948,7 +948,11 @@ extern void *efi_get_pal_addr (void);
extern void efi_map_pal_code (void); extern void efi_map_pal_code (void);
extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg); extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg);
extern void efi_gettimeofday (struct timespec64 *ts); extern void efi_gettimeofday (struct timespec64 *ts);
#ifdef CONFIG_EFI
extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */ extern void efi_enter_virtual_mode (void); /* switch EFI to virtual mode, if possible */
#else
static inline void efi_enter_virtual_mode (void) {}
#endif
#ifdef CONFIG_X86 #ifdef CONFIG_X86
extern void efi_late_init(void); extern void efi_late_init(void);
extern void efi_free_boot_services(void); extern void efi_free_boot_services(void);

View File

@@ -202,6 +202,37 @@
#endif /* COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW */ #endif /* COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW */
/** check_shl_overflow() - Calculate a left-shifted value and check overflow
*
* @a: Value to be shifted
* @s: How many bits left to shift
* @d: Pointer to where to store the result
*
* Computes *@d = (@a << @s)
*
* Returns true if '*d' cannot hold the result or when 'a << s' doesn't
* make sense. Example conditions:
* - 'a << s' causes bits to be lost when stored in *d.
* - 's' is garbage (e.g. negative) or so large that the result of
* 'a << s' is guaranteed to be 0.
* - 'a' is negative.
* - 'a << s' sets the sign bit, if any, in '*d'.
*
* '*d' will hold the results of the attempted shift, but is not
* considered "safe for use" if false is returned.
*/
#define check_shl_overflow(a, s, d) ({ \
typeof(a) _a = a; \
typeof(s) _s = s; \
typeof(d) _d = d; \
u64 _a_full = _a; \
unsigned int _to_shift = \
_s >= 0 && _s < 8 * sizeof(*d) ? _s : 0; \
*_d = (_a_full << _to_shift); \
(_to_shift != _s || *_d < 0 || _a < 0 || \
(*_d >> _to_shift) != _a); \
})
/** /**
* array_size() - Calculate size of 2-dimensional array. * array_size() - Calculate size of 2-dimensional array.
* *
@@ -275,35 +306,4 @@ static inline __must_check size_t __ab_c_size(size_t n, size_t size, size_t c)
sizeof(*(p)->member) + __must_be_array((p)->member),\ sizeof(*(p)->member) + __must_be_array((p)->member),\
sizeof(*(p))) sizeof(*(p)))
/** check_shl_overflow() - Calculate a left-shifted value and check overflow
*
* @a: Value to be shifted
* @s: How many bits left to shift
* @d: Pointer to where to store the result
*
* Computes *@d = (@a << @s)
*
* Returns true if '*d' cannot hold the result or when 'a << s' doesn't
* make sense. Example conditions:
* - 'a << s' causes bits to be lost when stored in *d.
* - 's' is garbage (e.g. negative) or so large that the result of
* 'a << s' is guaranteed to be 0.
* - 'a' is negative.
* - 'a << s' sets the sign bit, if any, in '*d'.
*
* '*d' will hold the results of the attempted shift, but is not
* considered "safe for use" if false is returned.
*/
#define check_shl_overflow(a, s, d) ({ \
typeof(a) _a = a; \
typeof(s) _s = s; \
typeof(d) _d = d; \
u64 _a_full = _a; \
unsigned int _to_shift = \
_s >= 0 && _s < 8 * sizeof(*d) ? _s : 0; \
*_d = (_a_full << _to_shift); \
(_to_shift != _s || *_d < 0 || _a < 0 || \
(*_d >> _to_shift) != _a); \
})
#endif /* __LINUX_OVERFLOW_H */ #endif /* __LINUX_OVERFLOW_H */

View File

@@ -495,14 +495,16 @@ static void __init report_meminit(void)
{ {
const char *stack; const char *stack;
if (IS_ENABLED(CONFIG_INIT_STACK_ALL)) if (IS_ENABLED(CONFIG_INIT_STACK_ALL_PATTERN))
stack = "all"; stack = "all(pattern)";
else if (IS_ENABLED(CONFIG_INIT_STACK_ALL_ZERO))
stack = "all(zero)";
else if (IS_ENABLED(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL)) else if (IS_ENABLED(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF_ALL))
stack = "byref_all"; stack = "byref_all(zero)";
else if (IS_ENABLED(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF)) else if (IS_ENABLED(CONFIG_GCC_PLUGIN_STRUCTLEAK_BYREF))
stack = "byref"; stack = "byref(zero)";
else if (IS_ENABLED(CONFIG_GCC_PLUGIN_STRUCTLEAK_USER)) else if (IS_ENABLED(CONFIG_GCC_PLUGIN_STRUCTLEAK_USER))
stack = "__user"; stack = "__user(zero)";
else else
stack = "off"; stack = "off";

View File

@@ -430,7 +430,7 @@ static void seq_lock_time(struct seq_file *m, struct lock_time *lt)
seq_time(m, lt->min); seq_time(m, lt->min);
seq_time(m, lt->max); seq_time(m, lt->max);
seq_time(m, lt->total); seq_time(m, lt->total);
seq_time(m, lt->nr ? div_s64(lt->total, lt->nr) : 0); seq_time(m, lt->nr ? div64_u64(lt->total, lt->nr) : 0);
} }
static void seq_stats(struct seq_file *m, struct lock_stat_data *data) static void seq_stats(struct seq_file *m, struct lock_stat_data *data)

View File

@@ -541,6 +541,18 @@ static int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
if (!dir) if (!dir)
goto err; goto err;
/*
* As blktrace relies on debugfs for its interface the debugfs directory
* is required, contrary to the usual mantra of not checking for debugfs
* files or directories.
*/
if (IS_ERR_OR_NULL(dir)) {
pr_warn("debugfs_dir not present for %s so skipping\n",
buts->name);
ret = -ENOENT;
goto err;
}
bt->dev = dev; bt->dev = dev;
atomic_set(&bt->dropped, 0); atomic_set(&bt->dropped, 0);
INIT_LIST_HEAD(&bt->running_list); INIT_LIST_HEAD(&bt->running_list);

View File

@@ -5068,8 +5068,8 @@ struct sk_buff *skb_vlan_untag(struct sk_buff *skb)
skb = skb_share_check(skb, GFP_ATOMIC); skb = skb_share_check(skb, GFP_ATOMIC);
if (unlikely(!skb)) if (unlikely(!skb))
goto err_free; goto err_free;
/* We may access the two bytes after vlan_hdr in vlan_set_encap_proto(). */
if (unlikely(!pskb_may_pull(skb, VLAN_HLEN))) if (unlikely(!pskb_may_pull(skb, VLAN_HLEN + sizeof(unsigned short))))
goto err_free; goto err_free;
vhdr = (struct vlan_hdr *)skb->data; vhdr = (struct vlan_hdr *)skb->data;

View File

@@ -872,7 +872,15 @@ int ip6_tnl_rcv(struct ip6_tnl *t, struct sk_buff *skb,
struct metadata_dst *tun_dst, struct metadata_dst *tun_dst,
bool log_ecn_err) bool log_ecn_err)
{ {
return __ip6_tnl_rcv(t, skb, tpi, NULL, ip6ip6_dscp_ecn_decapsulate, int (*dscp_ecn_decapsulate)(const struct ip6_tnl *t,
const struct ipv6hdr *ipv6h,
struct sk_buff *skb);
dscp_ecn_decapsulate = ip6ip6_dscp_ecn_decapsulate;
if (tpi->proto == htons(ETH_P_IP))
dscp_ecn_decapsulate = ip4ip6_dscp_ecn_decapsulate;
return __ip6_tnl_rcv(t, skb, tpi, NULL, dscp_ecn_decapsulate,
log_ecn_err); log_ecn_err);
} }
EXPORT_SYMBOL(ip6_tnl_rcv); EXPORT_SYMBOL(ip6_tnl_rcv);

View File

@@ -250,8 +250,9 @@ err_out:
static int tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd, static int tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
struct tipc_nl_compat_msg *msg) struct tipc_nl_compat_msg *msg)
{ {
int err; struct nlmsghdr *nlh;
struct sk_buff *arg; struct sk_buff *arg;
int err;
if (msg->req_type && (!msg->req_size || if (msg->req_type && (!msg->req_size ||
!TLV_CHECK_TYPE(msg->req, msg->req_type))) !TLV_CHECK_TYPE(msg->req, msg->req_type)))
@@ -280,6 +281,15 @@ static int tipc_nl_compat_dumpit(struct tipc_nl_compat_cmd_dump *cmd,
return -ENOMEM; return -ENOMEM;
} }
nlh = nlmsg_put(arg, 0, 0, tipc_genl_family.id, 0, NLM_F_MULTI);
if (!nlh) {
kfree_skb(arg);
kfree_skb(msg->rep);
msg->rep = NULL;
return -EMSGSIZE;
}
nlmsg_end(arg, nlh);
err = __tipc_nl_compat_dumpit(cmd, msg, arg); err = __tipc_nl_compat_dumpit(cmd, msg, arg);
if (err) { if (err) {
kfree_skb(msg->rep); kfree_skb(msg->rep);

View File

@@ -25,7 +25,7 @@ choice
classes of uninitialized stack variable exploits classes of uninitialized stack variable exploits
and information exposures. and information exposures.
config INIT_STACK_ALL config INIT_STACK_ALL_PATTERN
bool "0xAA-init everything on the stack (strongest)" bool "0xAA-init everything on the stack (strongest)"
help help
Initializes everything on the stack with a 0xAA Initializes everything on the stack with a 0xAA
@@ -34,6 +34,23 @@ choice
exposures, even variables that were warned to have been exposures, even variables that were warned to have been
left uninitialized. left uninitialized.
Pattern initialization is known to provoke many existing bugs
related to uninitialized locals, e.g. pointers receive
non-NULL values, buffer sizes and indices are very big.
config INIT_STACK_ALL_ZERO
bool "zero-init everything on the stack (strongest and safest)"
help
Initializes everything on the stack with a zero
value. This is intended to eliminate all classes
of uninitialized stack variable exploits and information
exposures, even variables that were warned to have been
left uninitialized.
Zero initialization provides safe defaults for strings,
pointers, indices and sizes, and is therefore
more suitable as a security mitigation measure.
endchoice endchoice
config INIT_ON_ALLOC_DEFAULT_ON config INIT_ON_ALLOC_DEFAULT_ON

View File

@@ -780,7 +780,7 @@ static void snd_cs46xx_set_capture_sample_rate(struct snd_cs46xx *chip, unsigned
rate = 48000 / 9; rate = 48000 / 9;
/* /*
* We can not capture at at rate greater than the Input Rate (48000). * We can not capture at a rate greater than the Input Rate (48000).
* Return an error if an attempt is made to stray outside that limit. * Return an error if an attempt is made to stray outside that limit.
*/ */
if (rate > 48000) if (rate > 48000)

View File

@@ -1742,7 +1742,7 @@ int cs46xx_iec958_pre_open (struct snd_cs46xx *chip)
struct dsp_spos_instance * ins = chip->dsp_spos_instance; struct dsp_spos_instance * ins = chip->dsp_spos_instance;
if ( ins->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED ) { if ( ins->spdif_status_out & DSP_SPDIF_STATUS_OUTPUT_ENABLED ) {
/* remove AsynchFGTxSCB and and PCMSerialInput_II */ /* remove AsynchFGTxSCB and PCMSerialInput_II */
cs46xx_dsp_disable_spdif_out (chip); cs46xx_dsp_disable_spdif_out (chip);
/* save state */ /* save state */

View File

@@ -3394,7 +3394,7 @@ EXPORT_SYMBOL_GPL(snd_hda_set_power_save);
* @nid: NID to check / update * @nid: NID to check / update
* *
* Check whether the given NID is in the amp list. If it's in the list, * Check whether the given NID is in the amp list. If it's in the list,
* check the current AMP status, and update the the power-status according * check the current AMP status, and update the power-status according
* to the mute status. * to the mute status.
* *
* This function is supposed to be set or called from the check_power_status * This function is supposed to be set or called from the check_power_status

View File

@@ -823,7 +823,7 @@ static void activate_amp_in(struct hda_codec *codec, struct nid_path *path,
} }
} }
/* sync power of each widget in the the given path */ /* sync power of each widget in the given path */
static hda_nid_t path_power_update(struct hda_codec *codec, static hda_nid_t path_power_update(struct hda_codec *codec,
struct nid_path *path, struct nid_path *path,
bool allow_powerdown) bool allow_powerdown)

View File

@@ -863,7 +863,7 @@ static int stac_auto_create_beep_ctls(struct hda_codec *codec,
static struct snd_kcontrol_new beep_vol_ctl = static struct snd_kcontrol_new beep_vol_ctl =
HDA_CODEC_VOLUME(NULL, 0, 0, 0); HDA_CODEC_VOLUME(NULL, 0, 0, 0);
/* check for mute support for the the amp */ /* check for mute support for the amp */
if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) { if ((caps & AC_AMPCAP_MUTE) >> AC_AMPCAP_MUTE_SHIFT) {
const struct snd_kcontrol_new *temp; const struct snd_kcontrol_new *temp;
if (spec->anabeep_nid == nid) if (spec->anabeep_nid == nid)

View File

@@ -31,7 +31,7 @@
* Experimentally I found out that only a combination of * Experimentally I found out that only a combination of
* OCKS0=1, OCKS1=1 (128fs, 64fs output) and ice1724 - * OCKS0=1, OCKS1=1 (128fs, 64fs output) and ice1724 -
* VT1724_MT_I2S_MCLK_128X=0 (256fs input) yields correct * VT1724_MT_I2S_MCLK_128X=0 (256fs input) yields correct
* sampling rate. That means the the FPGA doubles the * sampling rate. That means that the FPGA doubles the
* MCK01 rate. * MCK01 rate.
* *
* Copyright (c) 2003 Takashi Iwai <tiwai@suse.de> * Copyright (c) 2003 Takashi Iwai <tiwai@suse.de>

View File

@@ -39,7 +39,7 @@
* GPIO 4 <- headphone detect * GPIO 4 <- headphone detect
* GPIO 5 -> enable ADC analog circuit for the left channel * GPIO 5 -> enable ADC analog circuit for the left channel
* GPIO 6 -> enable ADC analog circuit for the right channel * GPIO 6 -> enable ADC analog circuit for the right channel
* GPIO 7 -> switch green rear output jack between CS4245 and and the first * GPIO 7 -> switch green rear output jack between CS4245 and the first
* channel of CS4361 (mechanical relay) * channel of CS4361 (mechanical relay)
* GPIO 8 -> enable output to speakers * GPIO 8 -> enable output to speakers
* *

View File

@@ -655,8 +655,10 @@ static int tegra30_ahub_resume(struct device *dev)
int ret; int ret;
ret = pm_runtime_get_sync(dev); ret = pm_runtime_get_sync(dev);
if (ret < 0) if (ret < 0) {
pm_runtime_put(dev);
return ret; return ret;
}
ret = regcache_sync(ahub->regmap_ahub); ret = regcache_sync(ahub->regmap_ahub);
ret |= regcache_sync(ahub->regmap_apbif); ret |= regcache_sync(ahub->regmap_apbif);
pm_runtime_put(dev); pm_runtime_put(dev);

View File

@@ -551,8 +551,10 @@ static int tegra30_i2s_resume(struct device *dev)
int ret; int ret;
ret = pm_runtime_get_sync(dev); ret = pm_runtime_get_sync(dev);
if (ret < 0) if (ret < 0) {
pm_runtime_put(dev);
return ret; return ret;
}
ret = regcache_sync(i2s->regmap); ret = regcache_sync(i2s->regmap);
pm_runtime_put(dev); pm_runtime_put(dev);

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