Linux 4.19.321
Greg Kroah-Hartman
maintainerI'm announcing the release of the 4.19.321 kernel.
All users of the 4.19 kernel series must upgrade.
The updated 4.19.y git tree can be found at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-4.19.y
and can be browsed at the normal kernel.org git web browser:
https://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git;a=summary
thanks,
greg k-h
------------
Makefile | 2 arch/arm64/kernel/acpi_numa.c | 2 arch/openrisc/kernel/setup.c | 6 arch/parisc/kernel/irq.c | 4 arch/powerpc/boot/simple_alloc.c | 7 arch/powerpc/sysdev/xics/icp-native.c | 2 drivers/ata/libata-core.c | 3 drivers/atm/idt77252.c | 9 drivers/bluetooth/hci_ldisc.c | 3 drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c | 8 drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 3 drivers/gpu/drm/drm_fb_helper.c | 3 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h | 14 - drivers/hid/wacom_wac.c | 4 drivers/i2c/busses/i2c-riic.c | 2 drivers/input/input-mt.c | 3 drivers/irqchip/irq-gic-v3-its.c | 2 drivers/md/dm-ioctl.c | 22 + drivers/md/dm.c | 2 drivers/md/md.c | 5 drivers/md/persistent-data/dm-space-map-metadata.c | 4 drivers/media/pci/cx23885/cx23885-video.c | 8 drivers/media/usb/uvc/uvc_video.c | 10 drivers/mmc/core/mmc_test.c | 9 drivers/mmc/host/dw_mmc.c | 8 drivers/net/dsa/vitesse-vsc73xx.c | 2 drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c | 3 drivers/net/ethernet/i825xx/sun3_82586.c | 2 drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c | 2 drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 4 drivers/net/gtp.c | 5 drivers/net/wireless/intel/iwlwifi/mvm/scan.c | 2 drivers/net/wireless/marvell/mwifiex/cfg80211.c | 32 +- drivers/net/wireless/st/cw1200/txrx.c | 2 drivers/nvme/target/rdma.c | 16 - drivers/pinctrl/pinctrl-single.c | 2 drivers/s390/cio/idset.c | 12 drivers/scsi/aacraid/comminit.c | 2 drivers/scsi/lpfc/lpfc_sli.c | 2 drivers/scsi/mpt3sas/mpt3sas_base.c | 20 + drivers/scsi/scsi_transport_spi.c | 4 drivers/soundwire/stream.c | 8 drivers/ssb/main.c | 2 drivers/staging/ks7010/ks7010_sdio.c | 4 drivers/usb/class/cdc-acm.c | 3 drivers/usb/core/sysfs.c | 1 drivers/usb/dwc3/core.c | 21 + drivers/usb/dwc3/dwc3-omap.c | 4 drivers/usb/dwc3/dwc3-st.c | 11 drivers/usb/gadget/udc/fsl_udc_core.c | 2 drivers/usb/host/xhci.c | 8 drivers/usb/serial/option.c | 5 drivers/video/fbdev/core/fbcon.c | 28 ++ drivers/video/fbdev/core/fbmem.c | 20 + fs/binfmt_elf_fdpic.c | 2 fs/binfmt_misc.c | 216 ++++++++++++---- fs/btrfs/delayed-inode.c | 2 fs/btrfs/free-space-cache.c | 8 fs/btrfs/inode.c | 9 fs/btrfs/qgroup.c | 2 fs/btrfs/send.c | 7 fs/ext4/extents.c | 3 fs/ext4/mballoc.c | 3 fs/f2fs/segment.c | 5 fs/file.c | 30 -- fs/fuse/dev.c | 6 fs/gfs2/inode.c | 2 fs/locks.c | 4 fs/nfs/pnfs.c | 8 fs/quota/dquot.c | 5 include/linux/bitmap.h | 20 + include/linux/blkdev.h | 2 include/linux/cpumask.h | 2 include/linux/fbcon.h | 4 include/linux/overflow.h | 113 ++++++-- include/net/busy_poll.h | 2 include/net/kcm.h | 1 ipc/msg.c | 2 ipc/sem.c | 7 ipc/shm.c | 2 kernel/cgroup/cpuset.c | 13 kernel/time/hrtimer.c | 2 lib/idr.c | 2 lib/test_ida.c | 40 ++ lib/test_overflow.c | 98 +++++++ mm/memcontrol.c | 7 net/bluetooth/bnep/core.c | 3 net/bluetooth/hci_core.c | 58 ++-- net/bluetooth/mgmt.c | 4 net/core/skbuff.c | 3 net/ipv6/ip6_output.c | 2 net/iucv/iucv.c | 3 net/kcm/kcmsock.c | 4 net/netfilter/nft_counter.c | 5 net/rds/recv.c | 13 security/selinux/avc.c | 2 sound/core/timer.c | 2 sound/usb/quirks-table.h | 1 tools/include/linux/align.h | 12 tools/include/linux/bitmap.h | 8 100 files changed, 840 insertions(+), 283 deletions(-)
Al Viro (2):
fix bitmap corruption on close_range() with CLOSE_RANGE_UNSHARE memcg_write_event_control(): fix a user-triggerable oops
Alexander Gordeev (1):
s390/iucv: fix receive buffer virtual vs physical address confusion
Alexander Lobakin (4):
bitmap: introduce generic optimized bitmap_size() s390/cio: rename bitmap_size() -> idset_bitmap_size()
btrfs: rename bitmap_set_bits() -> btrfs_bitmap_set_bits()
tools: move alignment-related macros to new <linux/align.h>
Allison Henderson (1):
net:rds: Fix possible deadlock in rds_message_put
Andreas Gruenbacher (1):
gfs2: setattr_chown: Add missing initialization
Baokun Li (2):
ext4: do not trim the group with corrupted block bitmap
ext4: set the type of max_zeroout to unsigned int to avoid overflow
Bas Nieuwenhuizen (1):
drm/amdgpu: Actually check flags for all context ops.
Ben Hutchings (1):
scsi: aacraid: Fix double-free on probe failure
Ben Whitten (1):
mmc: dw_mmc: allow biu and ciu clocks to defer
Chen Ridong (1):
cgroup/cpuset: Prevent UAF in proc_cpuset_show()
Chengfeng Ye (1):
staging: ks7010: disable bh on tx_dev_lock
Christian Brauner (1):
binfmt_misc: cleanup on filesystem umount
Cong Wang (1):
gtp: fix a potential NULL pointer dereference
Cosmin Ratiu (1):
net/mlx5e: Correctly report errors for ethtool rx flows
Damien Le Moal (1):
scsi: mpt3sas: Avoid IOMMU page faults on REPORT ZONES
Dan Carpenter (2):
atm: idt77252: prevent use after free in dequeue_rx()
mmc: mmc_test: Fix NULL dereference on allocation failure
Daniel Vetter (1):
drm/fb-helper: set x/yres_virtual in drm_fb_helper_check_var
David Sterba (4):
btrfs: change BUG_ON to assertion when checking for delayed_node root
btrfs: handle invalid root reference found in may_destroy_subvol()
btrfs: send: handle unexpected data in header buffer in begin_cmd()
btrfs: delete pointless BUG_ON check on quota root in btrfs_qgroup_account_extent()
Dmitry Baryshkov (1):
drm/msm/dpu: don't play tricks with debug macros
Eric Dumazet (4):
gtp: pull network headers in gtp_dev_xmit()
ipv6: prevent UAF in ip6_send_skb()
net: prevent mss overflow in skb_segment()
net: busy-poll: use ktime_get_ns() instead of local_clock()
Greg Kroah-Hartman (1):
Linux 4.19.321
Griffin Kroah-Hartman (1):
Bluetooth: MGMT: Add error handling to pair_device()
Guanrui Huang (1):
irqchip/gic-v3-its: Remove BUG_ON in its_vpe_irq_domain_alloc
Gustavo A. R. Silva (1):
overflow.h: Add flex_array_size() helper
Haibo Xu (1):
arm64: ACPI: NUMA: initialize all values of acpi_early_node_map to NUMA_NO_NODE
Hans Verkuil (1):
media: pci: cx23885: check cx23885_vdev_init() return
Helge Deller (3):
parisc: Use irq_enter_rcu() to fix warning at kernel/context_tracking.c:367
fbcon: Prevent that screen size is smaller than font size
fbmem: Check virtual screen sizes in fb_set_var()
Ian Ray (1):
cdc-acm: Add DISABLE_ECHO quirk for GE HealthCare UI Controller
Jan Kara (1):
quota: Remove BUG_ON from dqget()
Jani Nikula (1):
drm/msm: use drm_debug_enabled() to check for debug categories
Jann Horn (1):
fuse: Initialize beyond-EOF page contents before setting uptodate
Jason Gerecke (1):
HID: wacom: Defer calculation of resolution until resolution_code is known
Jeff Johnson (1):
wifi: cw1200: Avoid processing an invalid TIM IE
Jesse Zhang (1):
drm/amdgpu: Using uninitialized value *size when calling amdgpu_vce_cs_reloc
Juan José Arboleda (1):
ALSA: usb-audio: Support Yamaha P-125 quirk entry
Justin Tee (1):
scsi: lpfc: Initialize status local variable in lpfc_sli4_repost_sgl_list()
Kees Cook (2):
overflow: Implement size_t saturating arithmetic helpers net/sun3_82586: Avoid reading past buffer in debug output
Khazhismel Kumykov (1):
dm resume: don't return EINVAL when signalled
Krishna Kurapati (1):
usb: dwc3: core: Skip setting event buffers for host only controllers
Krzysztof Kozlowski (3):
soundwire: stream: fix programming slave ports for non-continous port maps
usb: dwc3: omap: add missing depopulate in probe error path
usb: dwc3: st: fix probed platform device ref count on probe error path
Kuniyuki Iwashima (1):
kcm: Serialise kcm_sendmsg() for the same socket.
Kunwu Chan (1):
powerpc/xics: Check return value of kasprintf in icp_native_map_one_cpu
Lee, Chun-Yi (1):
Bluetooth: hci_ldisc: check HCI_UART_PROTO_READY flag in HCIUARTGETPROTO
Li Nan (1):
md: clean up invalid BUG_ON in md_ioctl
Li zeming (1):
powerpc/boot: Handle allocation failure in simple_realloc()
Long Li (1):
filelock: Correct the filelock owner in fcntl_setlk/fcntl_setlk64
Luiz Augusto von Dentz (4):
Bluetooth: bnep: Fix out-of-bound access
Bluetooth: Make use of __check_timeout on hci_sched_le
Bluetooth: hci_core: Fix not handling link timeouts propertly
Bluetooth: hci_core: Fix LE quote calculation
Ma Ke (1):
pinctrl: single: fix potential NULL dereference in pcs_get_function()
Mathias Nyman (1):
xhci: Fix Panther point NULL pointer deref at full-speed re-enumeration
Matthew Wilcox (Oracle) (1):
ida: Fix crash in ida_free when the bitmap is empty
Max Filippov (1):
fs: binfmt_elf_efpic: don't use missing interpreter's properties
Michael Ellerman (1):
powerpc/boot: Only free if realloc() succeeds
Mike Christie (1):
scsi: spi: Fix sshdr use
Mikulas Patocka (2):
dm persistent data: fix memory allocation failure dm suspend: return -ERESTARTSYS instead of -EINTR
Miri Korenblit (1):
wifi: iwlwifi: abort scan when rfkill on but device enabled
NeilBrown (1):
NFS: avoid infinite loop in pnfs_update_layout.
Niklas Cassel (1):
ata: libata-core: Fix null pointer dereference on error
Nikolay Kuratov (1):
cxgb4: add forgotten u64 ivlan cast before shift
Oreoluwa Babatunde (1):
openrisc: Call setup_memory() earlier in the init sequence
Pawel Dembicki (1):
net: dsa: vsc73xx: pass value in phy_write operation
Phil Chang (1):
hrtimer: Prevent queuing of hrtimer without a function callback
Rand Deeb (1):
ssb: Fix division by zero issue in ssb_calc_clock_rate
Ricardo Ribalda (1):
media: uvcvideo: Fix integer overflow calculating timestamp
Sagi Grimberg (1):
nvmet-rdma: fix possible bad dereference when freeing rsps
Sascha Hauer (1):
wifi: mwifiex: duplicate static structs used in driver instances
Sean Anderson (1):
net: xilinx: axienet: Always disable promiscuous mode
Sebastian Andrzej Siewior (1):
netfilter: nft_counter: Synchronize nft_counter_reset() against reader.
Selvarasu Ganesan (1):
usb: dwc3: core: Prevent USB core invalid event buffer address access
Takashi Iwai (1):
ALSA: timer: Relax start tick time check for slave timer elements
Tetsuo Handa (2):
block: use "unsigned long" for blk_validate_block_size().
Input: MT - limit max slots
Uwe Kleine-König (1):
usb: gadget: fsl: Increase size of name buffer for endpoints
Vasily Averin (2):
memcg: enable accounting of ipc resources
ipc: remove memcg accounting for sops objects in do_semtimedop()
Wolfram Sang (1):
i2c: riic: avoid potential division by zero
ZHANG Yuntian (1):
USB: serial: option: add MeiG Smart SRM825L
Zhen Lei (1):
selinux: fix potential counting error in avc_add_xperms_decision()
Zhiguo Niu (1):
f2fs: fix to do sanity check in update_sit_entry
Zijun Hu (1):
usb: core: sysfs: Unmerge @usb3_hardware_lpm_attr_group in remove_power_attributes()
Greg Kroah-Hartman
maintainerMakefile +1 -1
@@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0 VERSION = 4 PATCHLEVEL = 19 -SUBLEVEL = 320 +SUBLEVEL = 321 EXTRAVERSION = NAME = "People's Front"
arch/arm64/kernel/acpi_numa.c +1 -1
@@ -28,7 +28,7 @@#include <asm/numa.h> -static int acpi_early_node_map[NR_CPUS ]__initdata = {NUMA_NO_NODE }; +static int acpi_early_node_map[NR_CPUS ]__initdata = { [0 ...NR_CPUS -1 ] =NUMA_NO_NODE };int __init acpi_numa_get_nid (unsigned int cpu) {
arch/openrisc/kernel/setup.c +3 -3
@@ -287,6 +287,9 @@ void calibrate_delay(void)void __init setup_arch (char **cmdline_p) { +/* setup memblock allocator */ +setup_memory (); +unflatten_and_copy_device_tree ();setup_cpuinfo ();
@@ -311,9 +314,6 @@ void __init setup_arch(char **cmdline_p) initrd_below_start_ok =1 ;#endif -/* setup memblock allocator */ -setup_memory (); -/* paging_init() sets up the MMU and marks all pages as reserved */ paging_init ();
arch/parisc/kernel/irq.c +2 -2
@@ -524,7 +524,7 @@ void do_cpu_irq_mask(struct pt_regs *regs) old_regs =set_irq_regs (regs);local_irq_disable (); -irq_enter (); +irq_enter_rcu (); eirr_val =mfctl (23 ) & cpu_eiem &per_cpu (local_ack_eiem, cpu);if (!eirr_val)
@@ -559,7 +559,7 @@ void do_cpu_irq_mask(struct pt_regs *regs)#endif /* CONFIG_IRQSTACKS */ out: -irq_exit (); +irq_exit_rcu ();set_irq_regs (old_regs);return ;
arch/powerpc/boot/simple_alloc.c +5 -2
@@ -114,8 +114,11 @@ static void *simple_realloc(void *ptr, unsigned long size)return ptr; new =simple_malloc (size); -memcpy (new, ptr, p->size); -simple_free (ptr); +if (new) { +memcpy (new, ptr, p->size); +simple_free (ptr); + } +return new; }
arch/powerpc/sysdev/xics/icp-native.c +2 -0
@@ -240,6 +240,8 @@ static int __init icp_native_map_one_cpu(int hw_id, unsigned long addr, rname =kasprintf (GFP_KERNEL ,"CPU %d [0x%x] Interrupt Presentation" , cpu, hw_id); +if (!rname) +return -ENOMEM ;if (!request_mem_region (addr, size, rname)) {pr_warn ("icp_native: Could not reserve ICP MMIO for CPU %d, interrupt server #0x%x\n" , cpu, hw_id);
drivers/ata/libata-core.c +3 -0
@@ -6159,6 +6159,9 @@ static void ata_host_release(struct kref *kref)for (i =0 ; i < host->n_ports; i++) {struct ata_port *ap = host->ports[i]; +if (!ap) +continue ; +kfree (ap->pmp_link);kfree (ap->slave_link);kfree (ap);
drivers/atm/idt77252.c +5 -4
@@ -1117,8 +1117,8 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe) rpp->len += skb->len;if (stat &SAR_RSQE_EPDU ) { +unsigned int len, truesize;unsigned char *l1l2; -unsigned int len; l1l2 = (unsigned char *) ((unsigned long ) skb->data + skb->len -6 );
@@ -1188,14 +1188,15 @@ dequeue_rx(struct idt77252_dev *card, struct rsq_entry *rsqe)ATM_SKB (skb)->vcc = vcc;__net_timestamp (skb); + truesize = skb->truesize; vcc->push (vcc, skb);atomic_inc (&vcc->stats->rx); -if (skb->truesize >SAR_FB_SIZE_3 ) +if (truesize >SAR_FB_SIZE_3 )add_rx_skb (card,3 ,SAR_FB_SIZE_3 ,1 ); -else if (skb->truesize >SAR_FB_SIZE_2 ) +else if (truesize >SAR_FB_SIZE_2 )add_rx_skb (card,2 ,SAR_FB_SIZE_2 ,1 ); -else if (skb->truesize >SAR_FB_SIZE_1 ) +else if (truesize >SAR_FB_SIZE_1 )add_rx_skb (card,1 ,SAR_FB_SIZE_1 ,1 );else add_rx_skb (card,0 ,SAR_FB_SIZE_0 ,1 );
drivers/bluetooth/hci_ldisc.c +2 -1
@@ -773,7 +773,8 @@ static int hci_uart_tty_ioctl(struct tty_struct *tty, struct file *file,break ;case HCIUARTGETPROTO : -if (test_bit (HCI_UART_PROTO_SET , &hu->flags)) +if (test_bit (HCI_UART_PROTO_SET , &hu->flags) && +test_bit (HCI_UART_PROTO_READY , &hu->flags)) err = hu->proto->id;else err = -EUNATCH ;
drivers/gpu/drm/amd/amdgpu/amdgpu_ctx.c +8 -0
@@ -288,16 +288,24 @@ int amdgpu_ctx_ioctl(struct drm_device *dev, void *data,switch (args->in.op) {case AMDGPU_CTX_OP_ALLOC_CTX : +if (args->in.flags) +return -EINVAL ; r =amdgpu_ctx_alloc (adev, fpriv, filp, priority, &id); args->out.alloc.ctx_id = id;break ;case AMDGPU_CTX_OP_FREE_CTX : +if (args->in.flags) +return -EINVAL ; r =amdgpu_ctx_free (fpriv, id);break ;case AMDGPU_CTX_OP_QUERY_STATE : +if (args->in.flags) +return -EINVAL ; r =amdgpu_ctx_query (adev, fpriv, id, &args->out);break ;case AMDGPU_CTX_OP_QUERY_STATE2 : +if (args->in.flags) +return -EINVAL ; r =amdgpu_ctx_query2 (adev, fpriv, id, &args->out);break ;default :
drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c +2 -1
@@ -714,7 +714,8 @@ int amdgpu_vce_ring_parse_cs(struct amdgpu_cs_parser *p, uint32_t ib_idx)uint32_t created =0 ;uint32_t allocated =0 ;uint32_t tmp, handle =0 ; -uint32_t *size = &tmp; +uint32_t dummy =0xffffffff ; +uint32_t *size = &dummy;unsigned idx;int i, r =0 ;
drivers/gpu/drm/drm_fb_helper.c +3 -0
@@ -1713,6 +1713,9 @@ int drm_fb_helper_check_var(struct fb_var_screeninfo *var,return -EINVAL ; } + var->xres_virtual = fb->width; + var->yres_virtual = fb->height; +/* * Workaround for SDL 1.2, which is known to be setting all pixel format * fields values to zero in some cases. We treat this situation as a
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.h +2 -12
@@ -41,24 +41,14 @@* @fmt: Pointer to format string */ #define DPU_DEBUG (fmt, ...) \ - do { \ - if (unlikely(drm_debug & DRM_UT_KMS)) \ - DRM_DEBUG(fmt, ##__VA_ARGS__); \ - else \ - pr_debug(fmt, ##__VA_ARGS__); \ - } while (0) + DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__)/** * DPU_DEBUG_DRIVER - macro for hardware driver logging * @fmt: Pointer to format string */ #define DPU_DEBUG_DRIVER (fmt, ...) \ - do { \ - if (unlikely(drm_debug & DRM_UT_DRIVER)) \ - DRM_ERROR(fmt, ##__VA_ARGS__); \ - else \ - pr_debug(fmt, ##__VA_ARGS__); \ - } while (0) + DRM_DEBUG_DRIVER(fmt, ##__VA_ARGS__)#define DPU_ERROR (fmt, ...) pr_err("[dpu error]" fmt, ##__VA_ARGS__)#define DPU_ERROR_RATELIMITED (fmt, ...) pr_err_ratelimited("[dpu error]" fmt, ##__VA_ARGS__)
drivers/hid/wacom_wac.c +3 -1
@@ -1830,12 +1830,14 @@ static void wacom_map_usage(struct input_dev *input, struct hid_usage *usage,int fmax = field->logical_maximum;unsigned int equivalent_usage =wacom_equivalent_usage (usage->hid);int resolution_code = code; -int resolution =hidinput_calc_abs_res (field, resolution_code); +int resolution;if (equivalent_usage ==HID_DG_TWIST ) { resolution_code =ABS_RZ ; } + resolution =hidinput_calc_abs_res (field, resolution_code); +if (equivalent_usage ==HID_GD_X ) { fmin += features->offset_left; fmax -= features->offset_right;
drivers/i2c/busses/i2c-riic.c +1 -1
@@ -315,7 +315,7 @@ static int riic_init_hw(struct riic_dev *riic, struct i2c_timings *t)* frequency with only 62 clock ticks max (31 high, 31 low). * Aim for a duty of 60% LOW, 40% HIGH. */ - total_ticks =DIV_ROUND_UP (rate, t->bus_freq_hz); + total_ticks =DIV_ROUND_UP (rate, t->bus_freq_hz ?:1 );for (cks =0 ; cks <7 ; cks++) {/*
drivers/input/input-mt.c +3 -0
@@ -48,6 +48,9 @@ int input_mt_init_slots(struct input_dev *dev, unsigned int num_slots,return 0 ;if (mt)return mt->num_slots != num_slots ? -EINVAL :0 ; +/* Arbitrary limit for avoiding too large memory allocation. */ +if (num_slots >1024 ) +return -EINVAL ; mt =kzalloc (struct_size (mt, slots, num_slots),GFP_KERNEL );if (!mt)
drivers/irqchip/irq-gic-v3-its.c +0 -2
@@ -2958,8 +2958,6 @@ static int its_vpe_irq_domain_alloc(struct irq_domain *domain, unsigned int virqstruct page *vprop_page;int base, nr_ids, i, err =0 ; -BUG_ON (!vm); - bitmap =its_lpi_alloc (roundup_pow_of_two (nr_irqs), &base, &nr_ids);if (!bitmap)return -ENOMEM ;
drivers/md/dm-ioctl.c +20 -2
@@ -1039,8 +1039,26 @@ static int do_resume(struct dm_ioctl *param) suspend_flags &= ~DM_SUSPEND_LOCKFS_FLAG ;if (param->flags &DM_NOFLUSH_FLAG ) suspend_flags |=DM_SUSPEND_NOFLUSH_FLAG ; -if (!dm_suspended_md (md)) -dm_suspend (md, suspend_flags); +if (!dm_suspended_md (md)) { + r =dm_suspend (md, suspend_flags); +if (r) { +down_write (&_hash_lock); + hc =dm_get_mdptr (md); +if (hc && !hc->new_map) { + hc->new_map = new_map; + new_map =NULL ; + }else { + r = -ENXIO ; + } +up_write (&_hash_lock); +if (new_map) { +dm_sync_table (md); +dm_table_destroy (new_map); + } +dm_put (md); +return r; + } + } old_map =dm_swap_table (md, new_map);if (IS_ERR (old_map)) {
drivers/md/dm.c +1 -1
@@ -2468,7 +2468,7 @@ static int dm_wait_for_completion(struct mapped_device *md, long task_state)break ;if (signal_pending_state (task_state, current)) { - r = -EINTR ; + r = -ERESTARTSYS ;break ; }
drivers/md/md.c +0 -5
@@ -7245,11 +7245,6 @@ static int md_ioctl(struct block_device *bdev, fmode_t mode, mddev = bdev->bd_disk->private_data; -if (!mddev) { -BUG (); - goto out; - } -/* Some actions do not requires the mutex */ switch (cmd) {case GET_ARRAY_INFO :
drivers/md/persistent-data/dm-space-map-metadata.c +2 -2
@@ -275,7 +275,7 @@ static void sm_metadata_destroy(struct dm_space_map *sm) { struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm); -kfree (smm); +kvfree (smm); }static int sm_metadata_get_nr_blocks (struct dm_space_map *sm,dm_block_t *count)
@@ -759,7 +759,7 @@ struct dm_space_map *dm_sm_metadata_init(void) {struct sm_metadata *smm; - smm =kmalloc (sizeof (*smm),GFP_KERNEL ); + smm =kvmalloc (sizeof (*smm),GFP_KERNEL );if (!smm)return ERR_PTR (-ENOMEM );
drivers/media/pci/cx23885/cx23885-video.c +8 -0
@@ -1297,6 +1297,10 @@ int cx23885_video_register(struct cx23885_dev *dev)/* register Video device */ dev->video_dev =cx23885_vdev_init (dev, dev->pci, &cx23885_video_template,"video" ); +if (!dev->video_dev) { + err = -ENOMEM ; + goto fail_unreg; + } dev->video_dev->queue = &dev->vb2_vidq; err =video_register_device (dev->video_dev,VFL_TYPE_GRABBER , video_nr[dev->nr]);
@@ -1311,6 +1315,10 @@ int cx23885_video_register(struct cx23885_dev *dev)/* register VBI device */ dev->vbi_dev =cx23885_vdev_init (dev, dev->pci, &cx23885_vbi_template,"vbi" ); +if (!dev->vbi_dev) { + err = -ENOMEM ; + goto fail_unreg; + } dev->vbi_dev->queue = &dev->vb2_vbiq; err =video_register_device (dev->vbi_dev,VFL_TYPE_VBI , vbi_nr[dev->nr]);
drivers/media/usb/uvc/uvc_video.c +5 -5
@@ -728,11 +728,11 @@ void uvc_video_clock_update(struct uvc_streaming *stream,unsigned long flags;u64 timestamp;u32 delta_stc; -u32 y1, y2; +u32 y1;u32 x1, x2;u32 mean;u32 sof; -u64 y; +u64 y, y2;if (!uvc_hw_timestamps_param)return ;
@@ -772,7 +772,7 @@ void uvc_video_clock_update(struct uvc_streaming *stream, sof = y; uvc_trace(UVC_TRACE_CLOCK, "%s: PTS %u y %llu.%06llu SOF %u.%06llu " - "(x1 %u x2 %u y1 %u y2 %u SOF offset %u)\n", + "(x1 %u x2 %u y1 %u y2 %llu SOF offset %u)\n", stream->dev->name, buf->pts, y >> 16, div_u64((y & 0xffff) * 1000000, 65536), sof >> 16, div_u64(((u64)sof & 0xffff) * 1000000LLU, 65536),
@@ -787,7 +787,7 @@ void uvc_video_clock_update(struct uvc_streaming *stream, goto done; y1 =NSEC_PER_SEC ; - y2 = (u32 )ktime_to_ns (ktime_sub (last->host_time, first->host_time)) + y1; + y2 =ktime_to_ns (ktime_sub (last->host_time, first->host_time)) + y1;/* Interpolated and host SOF timestamps can wrap around at slightly * different times. Handle this by adding or removing 2048 to or from
@@ -807,7 +807,7 @@ void uvc_video_clock_update(struct uvc_streaming *stream, timestamp =ktime_to_ns (first->host_time) + y - y1; uvc_trace(UVC_TRACE_CLOCK, "%s: SOF %u.%06llu y %llu ts %llu " - "buf ts %llu (x1 %u/%u/%u x2 %u/%u/%u y1 %u y2 %u)\n", + "buf ts %llu (x1 %u/%u/%u x2 %u/%u/%u y1 %u y2 %llu)\n", stream->dev->name, sof >> 16, div_u64(((u64)sof & 0xffff) * 1000000LLU, 65536), y, timestamp, vbuf->vb2_buf.timestamp,
drivers/mmc/core/mmc_test.c +5 -4
@@ -3101,13 +3101,13 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf, test->buffer =kzalloc (BUFFER_SIZE ,GFP_KERNEL );#ifdef CONFIG_HIGHMEM test->highmem =alloc_pages (GFP_KERNEL | __GFP_HIGHMEM,BUFFER_ORDER ); +if (!test->highmem) { + count = -ENOMEM ; + goto free_test_buffer; + }#endif -#ifdef CONFIG_HIGHMEM -if (test->buffer && test->highmem) { -#else if (test->buffer) { -#endif mutex_lock (&mmc_test_lock);mmc_test_run (test, testcase);mutex_unlock (&mmc_test_lock);
@@ -3115,6 +3115,7 @@ static ssize_t mtf_test_write(struct file *file, const char __user *buf,#ifdef CONFIG_HIGHMEM __free_pages (test->highmem,BUFFER_ORDER ); +free_test_buffer:#endif kfree (test->buffer);kfree (test);
drivers/mmc/host/dw_mmc.c +8 -0
@@ -3205,6 +3205,10 @@ int dw_mci_probe(struct dw_mci *host) host->biu_clk =devm_clk_get (host->dev,"biu" );if (IS_ERR (host->biu_clk)) {dev_dbg (host->dev,"biu clock not available\n" ); + ret =PTR_ERR (host->biu_clk); +if (ret == -EPROBE_DEFER ) +return ret; + }else { ret =clk_prepare_enable (host->biu_clk);if (ret) {
@@ -3216,6 +3220,10 @@ int dw_mci_probe(struct dw_mci *host) host->ciu_clk =devm_clk_get (host->dev,"ciu" );if (IS_ERR (host->ciu_clk)) {dev_dbg (host->dev,"ciu clock not available\n" ); + ret =PTR_ERR (host->ciu_clk); +if (ret == -EPROBE_DEFER ) + goto err_clk_biu; + host->bus_hz = host->pdata->bus_hz; }else { ret =clk_prepare_enable (host->ciu_clk);
drivers/net/dsa/vitesse-vsc73xx.c +1 -1
@@ -649,7 +649,7 @@ static int vsc73xx_phy_write(struct dsa_switch *ds, int phy, int regnum,return 0 ; } - cmd = (phy <<21 ) | (regnum <<16 ); + cmd = (phy <<21 ) | (regnum <<16 ) | val; ret =vsc73xx_write (vsc,VSC73XX_BLOCK_MII ,0 ,1 , cmd);if (ret)return ret;
drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c +2 -1
@@ -940,7 +940,8 @@ static u64 hash_filter_ntuple(struct ch_filter_specification *fs,* in the Compressed Filter Tuple. */ if (tp->vlan_shift >=0 && fs->mask.ivlan) - ntuple |= (FT_VLAN_VLD_F | fs->val.ivlan) << tp->vlan_shift; + ntuple |= (u64)(FT_VLAN_VLD_F | + fs->val.ivlan) << tp->vlan_shift;if (tp->port_shift >=0 && fs->mask.iport) ntuple |= (u64 )fs->val.iport << tp->port_shift;
drivers/net/ethernet/i825xx/sun3_82586.c +1 -1
@@ -990,7 +990,7 @@ static void sun3_82586_timeout(struct net_device *dev) {#ifdef DEBUG printk ("%s: xmitter timed out, try to restart! stat: %02x\n" ,dev->name,p->scb->cus); -printk ("%s: command-stats: %04x %04x\n" ,dev->name,swab16 (p->xmit_cmds[0 ]->cmd_status),swab16 (p->xmit_cmds[1 ]->cmd_status)); +printk ("%s: command-stats: %04x\n" , dev->name,swab16 (p->xmit_cmds[0 ]->cmd_status));printk ("%s: check, whether you set the right interrupt number!\n" ,dev->name);#endif sun3_82586_close (dev);
drivers/net/ethernet/mellanox/mlx5/core/en_fs_ethtool.c +1 -1
@@ -689,7 +689,7 @@ mlx5e_ethtool_flow_replace(struct mlx5e_priv *priv,if (num_tuples <=0 ) {netdev_warn (priv->netdev,"%s: flow is not valid %d\n" , __func__, num_tuples); -return num_tuples; +return num_tuples <0 ? num_tuples : -EINVAL ; } eth_ft =get_flow_table (priv, fs, num_tuples);
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +4 -0
@@ -375,6 +375,10 @@ static void axienet_set_multicast_list(struct net_device *ndev) }else if (!netdev_mc_empty (ndev)) {struct netdev_hw_addr *ha; + reg =axienet_ior (lp,XAE_FMI_OFFSET ); + reg &= ~XAE_FMI_PM_MASK ; +axienet_iow (lp,XAE_FMI_OFFSET , reg); + i =0 ;netdev_for_each_mc_addr (ha, ndev) {if (i >=XAE_MULTICAST_CAM_TABLE_NUM )
drivers/net/gtp.c +4 -1
@@ -577,6 +577,9 @@ static netdev_tx_t gtp_dev_xmit(struct sk_buff *skb, struct net_device *dev)if (skb_cow_head (skb, dev->needed_headroom)) goto tx_err; +if (!pskb_inet_may_pull (skb)) + goto tx_err; +skb_reset_inner_headers (skb);/* PDP context lookups in gtp_build_skb_*() need rcu read-side lock. */
@@ -809,7 +812,7 @@ static struct sock *gtp_encap_enable_socket(int fd, int type, sock =sockfd_lookup (fd, &err);if (!sock) {pr_debug ("gtp socket fd=%d not found\n" , fd); -return NULL ; +return ERR_PTR (err); } sk = sock->sk;
drivers/net/wireless/intel/iwlwifi/mvm/scan.c +1 -1
@@ -1993,7 +1993,7 @@ int iwl_mvm_scan_stop(struct iwl_mvm *mvm, int type, bool notify)if (!(mvm->scan_status & type))return 0 ; -if (iwl_mvm_is_radio_killed (mvm)) { +if (!test_bit (STATUS_DEVICE_ENABLED , &mvm->trans->status)) { ret =0 ; goto out; }
drivers/net/wireless/marvell/mwifiex/cfg80211.c +26 -6
@@ -4294,11 +4294,27 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)if (ISSUPP_ADHOC_ENABLED (adapter->fw_cap_info)) wiphy->interface_modes |=BIT (NL80211_IFTYPE_ADHOC ); - wiphy->bands[NL80211_BAND_2GHZ ] = &mwifiex_band_2ghz; -if (adapter->config_bands &BAND_A ) - wiphy->bands[NL80211_BAND_5GHZ ] = &mwifiex_band_5ghz; -else + wiphy->bands[NL80211_BAND_2GHZ ] =devm_kmemdup (adapter->dev, + &mwifiex_band_2ghz, +sizeof (mwifiex_band_2ghz), +GFP_KERNEL ); +if (!wiphy->bands[NL80211_BAND_2GHZ ]) { + ret = -ENOMEM ; + goto err; + } + +if (adapter->config_bands &BAND_A ) { + wiphy->bands[NL80211_BAND_5GHZ ] =devm_kmemdup (adapter->dev, + &mwifiex_band_5ghz, +sizeof (mwifiex_band_5ghz), +GFP_KERNEL ); +if (!wiphy->bands[NL80211_BAND_5GHZ ]) { + ret = -ENOMEM ; + goto err; + } + }else { wiphy->bands[NL80211_BAND_5GHZ ] =NULL ; + }if (adapter->drcs_enabled &&ISSUPP_DRCS_ENABLED (adapter->fw_cap_info)) wiphy->iface_combinations = &mwifiex_iface_comb_ap_sta_drcs;
@@ -4386,8 +4402,7 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter)if (ret <0 ) {mwifiex_dbg (adapter,ERROR ,"%s: wiphy_register failed: %d\n" , __func__, ret); -wiphy_free (wiphy); -return ret; + goto err; }if (!adapter->regd) {
@@ -4429,4 +4444,9 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) adapter->wiphy = wiphy;return ret; + +err: +wiphy_free (wiphy); + +return ret; }
drivers/net/wireless/st/cw1200/txrx.c +1 -1
@@ -1173,7 +1173,7 @@ void cw1200_rx_cb(struct cw1200_common *priv,size_t ies_len = skb->len - (ies - (u8 *)(skb->data)); tim_ie =cfg80211_find_ie (WLAN_EID_TIM , ies, ies_len); -if (tim_ie) { +if (tim_ie && tim_ie[1 ] >=sizeof (struct ieee80211_tim_ie )) {struct ieee80211_tim_ie *tim = (struct ieee80211_tim_ie *)&tim_ie[2 ];
drivers/nvme/target/rdma.c +4 -12
@@ -435,12 +435,8 @@ nvmet_rdma_alloc_rsps(struct nvmet_rdma_queue *queue)return 0 ; out_free: -while (--i >=0 ) { -struct nvmet_rdma_rsp *rsp = &queue->rsps[i]; - -list_del (&rsp->free_list); -nvmet_rdma_free_rsp (ndev, rsp); - } +while (--i >=0 ) +nvmet_rdma_free_rsp (ndev, &queue->rsps[i]);kfree (queue->rsps); out:return ret;
@@ -451,12 +447,8 @@ static void nvmet_rdma_free_rsps(struct nvmet_rdma_queue *queue)struct nvmet_rdma_device *ndev = queue->dev;int i, nr_rsps = queue->recv_queue_size *2 ; -for (i =0 ; i < nr_rsps; i++) { -struct nvmet_rdma_rsp *rsp = &queue->rsps[i]; - -list_del (&rsp->free_list); -nvmet_rdma_free_rsp (ndev, rsp); - } +for (i =0 ; i < nr_rsps; i++) +nvmet_rdma_free_rsp (ndev, &queue->rsps[i]);kfree (queue->rsps); }
drivers/pinctrl/pinctrl-single.c +2 -0
@@ -323,6 +323,8 @@ static int pcs_get_function(struct pinctrl_dev *pctldev, unsigned pin,return -ENOTSUPP ; fselector = setting->func; function =pinmux_generic_get_function (pctldev, fselector); +if (!function) +return -EINVAL ; *func = function->data;if (!(*func)) { dev_err(pcs->dev, "%s could not find function%i\n",
drivers/s390/cio/idset.c +7 -5
@@ -16,20 +16,21 @@ struct idset {unsigned long bitmap[0 ]; }; -static inline unsigned long bitmap_size (int num_ssid,int num_id) +static inline unsigned long idset_bitmap_size (int num_ssid,int num_id) { -return BITS_TO_LONGS (num_ssid * num_id) *sizeof (unsigned long ); +return bitmap_size (size_mul (num_ssid, num_id)); }static struct idset *idset_new (int num_ssid,int num_id) {struct idset *set; - set =vmalloc (sizeof (struct idset ) +bitmap_size (num_ssid, num_id)); + set =vmalloc (sizeof (struct idset ) + +idset_bitmap_size (num_ssid, num_id));if (set) { set->num_ssid = num_ssid; set->num_id = num_id; -memset (set->bitmap,0 ,bitmap_size (num_ssid, num_id)); +memset (set->bitmap,0 ,idset_bitmap_size (num_ssid, num_id)); }return set; }
@@ -41,7 +42,8 @@ void idset_free(struct idset *set)void idset_fill (struct idset *set) { -memset (set->bitmap,0xff ,bitmap_size (set->num_ssid, set->num_id)); +memset (set->bitmap,0xff , +idset_bitmap_size (set->num_ssid, set->num_id)); }static inline void idset_add (struct idset *set,int ssid,int id)
drivers/scsi/aacraid/comminit.c +2 -0
@@ -652,6 +652,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)if (aac_comm_init (dev)<0 ){kfree (dev->queues); + dev->queues =NULL ;return NULL ; }/*
@@ -659,6 +660,7 @@ struct aac_dev *aac_init_adapter(struct aac_dev *dev)*/ if (aac_fib_setup (dev) <0 ) {kfree (dev->queues); + dev->queues =NULL ;return NULL ; }
drivers/scsi/lpfc/lpfc_sli.c +1 -1
@@ -6597,7 +6597,7 @@ lpfc_sli4_repost_sgl_list(struct lpfc_hba *phba,struct lpfc_sglq *sglq_entry =NULL ;struct lpfc_sglq *sglq_entry_next =NULL ;struct lpfc_sglq *sglq_entry_first =NULL ; -int status, total_cnt; +int status =0 , total_cnt;int post_cnt =0 , num_posted =0 , block_cnt =0 ;int last_xritag =NO_XRI ;LIST_HEAD (prep_sgl_list);
drivers/scsi/mpt3sas/mpt3sas_base.c +18 -2
@@ -2221,6 +2221,22 @@ _base_build_zero_len_sge_ieee(struct MPT3SAS_ADAPTER *ioc, void *paddr)_base_add_sg_single_ieee (paddr, sgl_flags,0 ,0 ,-1 ); } +static inline int _base_scsi_dma_map (struct scsi_cmnd *cmd) +{ +/* +* Some firmware versions byte-swap the REPORT ZONES command reply from +* ATA-ZAC devices by directly accessing in the host buffer. This does +* not respect the default command DMA direction and causes IOMMU page +* faults on some architectures with an IOMMU enforcing write mappings +* (e.g. AMD hosts). Avoid such issue by making the report zones buffer +* mapping bi-directional. +*/ +if (cmd->cmnd[0 ] ==ZBC_IN && cmd->cmnd[1 ] ==ZI_REPORT_ZONES ) + cmd->sc_data_direction =DMA_BIDIRECTIONAL ; + +return scsi_dma_map (cmd); +} +/** * _base_build_sg_scmd - main sg creation routine * pcie_device is unused here!
@@ -2267,7 +2283,7 @@ _base_build_sg_scmd(struct MPT3SAS_ADAPTER *ioc, sgl_flags = sgl_flags <<MPI2_SGE_FLAGS_SHIFT ; sg_scmd =scsi_sglist (scmd); - sges_left =scsi_dma_map (scmd); + sges_left =_base_scsi_dma_map (scmd);if (sges_left <0 ) { sdev_printk(KERN_ERR, scmd->device, "pci_map_sg failed: request for %d bytes!\n",
@@ -2415,7 +2431,7 @@ _base_build_sg_scmd_ieee(struct MPT3SAS_ADAPTER *ioc, } sg_scmd =scsi_sglist (scmd); - sges_left =scsi_dma_map (scmd); + sges_left =_base_scsi_dma_map (scmd);if (sges_left <0 ) { sdev_printk(KERN_ERR, scmd->device, "pci_map_sg failed: request for %d bytes!\n",
drivers/scsi/scsi_transport_spi.c +2 -2
@@ -690,10 +690,10 @@ spi_dv_device_echo_buffer(struct scsi_device *sdev, u8 *buffer,for (r =0 ; r < retries; r++) { result =spi_execute (sdev, spi_write_buffer,DMA_TO_DEVICE , buffer, len, &sshdr); -if (result || !scsi_device_online (sdev)) { +if (result || !scsi_device_online (sdev)) {scsi_device_set_state (sdev,SDEV_QUIESCE ); -if (scsi_sense_valid (&sshdr) +if (result >0 &&scsi_sense_valid (&sshdr) && sshdr.sense_key ==ILLEGAL_REQUEST /* INVALID FIELD IN CDB */ && sshdr.asc ==0x24 && sshdr.ascq ==0x00 )
drivers/soundwire/stream.c +4 -4
@@ -1232,18 +1232,18 @@ struct sdw_dpn_prop *sdw_get_slave_dpn_prop(struct sdw_slave *slave, unsigned int port_num) {struct sdw_dpn_prop *dpn_prop; -u8 num_ports; +unsigned long mask;int i;if (direction ==SDW_DATA_DIR_TX ) { - num_ports =hweight32 (slave->prop.source_ports); + mask = slave->prop.source_ports; dpn_prop = slave->prop.src_dpn_prop; }else { - num_ports =hweight32 (slave->prop.sink_ports); + mask = slave->prop.sink_ports; dpn_prop = slave->prop.sink_dpn_prop; } -for (i =0 ; i < num_ports; i++) { +for_each_set_bit (i, &mask,32 ) {if (dpn_prop[i].num == port_num)return &dpn_prop[i]; }
drivers/ssb/main.c +1 -1
@@ -835,7 +835,7 @@ static u32 clkfactor_f6_resolve(u32 v)case SSB_CHIPCO_CLK_F6_7 :return 7 ; } -return 0 ; +return 1 ; }/* Calculate the speed the backplane would run at a given set of clockcontrol values */
drivers/staging/ks7010/ks7010_sdio.c +2 -2
@@ -395,9 +395,9 @@ int ks_wlan_hw_tx(struct ks_wlan_private *priv, void *p, unsigned long size, priv->hostt.buff[priv->hostt.qtail] =le16_to_cpu (hdr->event); priv->hostt.qtail = (priv->hostt.qtail +1 ) %SME_EVENT_BUFF_SIZE ; -spin_lock (&priv->tx_dev.tx_dev_lock); +spin_lock_bh (&priv->tx_dev.tx_dev_lock); result =enqueue_txdev (priv, p, size, complete_handler, skb); -spin_unlock (&priv->tx_dev.tx_dev_lock); +spin_unlock_bh (&priv->tx_dev.tx_dev_lock);if (txq_has_space (priv))queue_delayed_work (priv->wq, &priv->rw_dwork,0 );
drivers/usb/class/cdc-acm.c +3 -0
@@ -1807,6 +1807,9 @@ static const struct usb_device_id acm_ids[] = { { USB_DEVICE(0x11ca, 0x0201), /* VeriFone Mx870 Gadget Serial */ .driver_info =SINGLE_RX_URB , }, + { USB_DEVICE(0x1901, 0x0006), /* GE Healthcare Patient Monitor UI Controller */ + .driver_info = DISABLE_ECHO, /* DISABLE ECHO in termios flag */ + }, { USB_DEVICE(0x1965, 0x0018), /* Uniden UBC125XLT */ .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ },
drivers/usb/core/sysfs.c +1 -0
@@ -689,6 +689,7 @@ static int add_power_attributes(struct device *dev)static void remove_power_attributes (struct device *dev) { +sysfs_unmerge_group (&dev->kobj, &usb3_hardware_lpm_attr_group);sysfs_unmerge_group (&dev->kobj, &usb2_hardware_lpm_attr_group);sysfs_unmerge_group (&dev->kobj, &power_attr_group); }
drivers/usb/dwc3/core.c +21 -0
@@ -372,6 +372,13 @@ static void dwc3_free_event_buffers(struct dwc3 *dwc)static int dwc3_alloc_event_buffers (struct dwc3 *dwc,unsigned length) {struct dwc3_event_buffer *evt; +unsigned int hw_mode; + + hw_mode =DWC3_GHWPARAMS0_MODE (dwc->hwparams.hwparams0); +if (hw_mode ==DWC3_GHWPARAMS0_MODE_HOST ) { + dwc->ev_buf =NULL ; +return 0 ; + } evt =dwc3_alloc_one_event_buffer (dwc, length);if (IS_ERR (evt)) {
@@ -393,6 +400,9 @@ int dwc3_event_buffers_setup(struct dwc3 *dwc) {struct dwc3_event_buffer *evt; +if (!dwc->ev_buf) +return 0 ; + evt = dwc->ev_buf; evt->lpos =0 ; dwc3_writel(dwc->regs, DWC3_GEVNTADRLO(0),
@@ -409,6 +419,17 @@ int dwc3_event_buffers_setup(struct dwc3 *dwc)void dwc3_event_buffers_cleanup (struct dwc3 *dwc) {struct dwc3_event_buffer *evt; +u32 reg; + +if (!dwc->ev_buf) +return ; +/* +* Exynos platforms may not be able to access event buffer if the +* controller failed to halt on dwc3_core_exit(). +*/ + reg =dwc3_readl (dwc->regs,DWC3_DSTS ); +if (!(reg &DWC3_DSTS_DEVCTRLHLT )) +return ; evt = dwc->ev_buf;
drivers/usb/dwc3/dwc3-omap.c +3 -1
@@ -526,11 +526,13 @@ static int dwc3_omap_probe(struct platform_device *pdev)if (ret) {dev_err (dev,"failed to request IRQ #%d --> %d\n" , omap->irq, ret); - goto err1; + goto err2; }dwc3_omap_enable_irqs (omap);return 0 ; +err2: +of_platform_depopulate (dev); err1:pm_runtime_put_sync (dev);pm_runtime_disable (dev);
drivers/usb/dwc3/dwc3-st.c +3 -8
@@ -219,10 +219,8 @@ static int st_dwc3_probe(struct platform_device *pdev) dwc3_data->regmap = regmap; res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"syscfg-reg" ); -if (!res) { - ret = -ENXIO ; - goto undo_platform_dev_alloc; - } +if (!res) +return -ENXIO ; dwc3_data->syscfg_reg_off = res->start;
@@ -233,8 +231,7 @@ static int st_dwc3_probe(struct platform_device *pdev)devm_reset_control_get_exclusive (dev,"powerdown" );if (IS_ERR (dwc3_data->rstc_pwrdn)) {dev_err (&pdev->dev,"could not get power controller\n" ); - ret =PTR_ERR (dwc3_data->rstc_pwrdn); - goto undo_platform_dev_alloc; +return PTR_ERR (dwc3_data->rstc_pwrdn); }/* Manage PowerDown */
@@ -296,8 +293,6 @@ static int st_dwc3_probe(struct platform_device *pdev)reset_control_assert (dwc3_data->rstc_rst); undo_powerdown:reset_control_assert (dwc3_data->rstc_pwrdn); -undo_platform_dev_alloc: -platform_device_put (pdev);return ret; }
drivers/usb/gadget/udc/fsl_udc_core.c +1 -1
@@ -2501,7 +2501,7 @@ static int fsl_udc_probe(struct platform_device *pdev)/* setup the udc->eps[] for non-control endpoints and link * to gadget.ep_list */ for (i =1 ; i < (int )(udc_controller->max_ep /2 ); i++) { -char name[14 ]; +char name[16 ];sprintf (name,"ep%dout" , i);struct_ep_setup (udc_controller, i *2 , name,1 );
drivers/usb/host/xhci.c +5 -3
@@ -2790,7 +2790,7 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci, xhci->num_active_eps);return -ENOMEM ; } -if ((xhci->quirks &XHCI_SW_BW_CHECKING ) && +if ((xhci->quirks &XHCI_SW_BW_CHECKING ) && !ctx_change &&xhci_reserve_bandwidth (xhci, virt_dev, command->in_ctx)) {if ((xhci->quirks &XHCI_EP_LIMIT_QUIRK ))xhci_free_host_resources (xhci, ctrl_ctx);
@@ -4145,8 +4145,10 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,mutex_unlock (&xhci->mutex); ret =xhci_disable_slot (xhci, udev->slot_id);xhci_free_virt_device (xhci, udev->slot_id); -if (!ret) -xhci_alloc_dev (hcd, udev); +if (!ret) { +if (xhci_alloc_dev (hcd, udev) ==1 ) +xhci_setup_addressable_virt_dev (xhci, udev); + }kfree (command->completion);kfree (command);return -EPROTO ;
drivers/usb/serial/option.c +5 -0
@@ -619,6 +619,8 @@ static void option_instat_callback(struct urb *urb);/* MeiG Smart Technology products */ #define MEIGSMART_VENDOR_ID 0x2dee +/* MeiG Smart SRM825L based on Qualcomm 315 */ +#define MEIGSMART_PRODUCT_SRM825L 0x4d22/* MeiG Smart SLM320 based on UNISOC UIS8910 */ #define MEIGSMART_PRODUCT_SLM320 0x4d41
@@ -2366,6 +2368,9 @@ static const struct usb_device_id option_ids[] = { { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, TOZED_PRODUCT_LT70C, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(UNISOC_VENDOR_ID, LUAT_PRODUCT_AIR720U, 0xff, 0, 0) }, { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SLM320, 0xff, 0, 0) }, + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x30) }, + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x40) }, + { USB_DEVICE_AND_INTERFACE_INFO(MEIGSMART_VENDOR_ID, MEIGSMART_PRODUCT_SRM825L, 0xff, 0xff, 0x60) }, { } /* Terminating entry */ };MODULE_DEVICE_TABLE (usb, option_ids);
drivers/video/fbdev/core/fbcon.c +28 -0
@@ -2734,6 +2734,34 @@ static void fbcon_set_all_vcs(struct fb_info *info)fbcon_modechanged (info); } +/* let fbcon check if it supports a new screen resolution */ +int fbcon_modechange_possible (struct fb_info *info,struct fb_var_screeninfo *var) +{ +struct fbcon_ops *ops = info->fbcon_par; +struct vc_data *vc; +unsigned int i; + +WARN_CONSOLE_UNLOCKED (); + +if (!ops) +return 0 ; + +/* prevent setting a screen size which is smaller than font size */ +for (i = first_fb_vc; i <= last_fb_vc; i++) { + vc = vc_cons[i].d; +if (!vc || vc->vc_mode !=KD_TEXT || + registered_fb[con2fb_map[i]] != info) +continue ; + +if (vc->vc_font.width >FBCON_SWAP (var->rotate, var->xres, var->yres) || + vc->vc_font.height >FBCON_SWAP (var->rotate, var->yres, var->xres)) +return -EINVAL ; + } + +return 0 ; +} +EXPORT_SYMBOL_GPL (fbcon_modechange_possible); +static int fbcon_mode_deleted (struct fb_info *info,struct fb_videomode *mode) {
drivers/video/fbdev/core/fbmem.c +17 -3
@@ -1006,6 +1006,17 @@ fb_set_var(struct fb_info *info, struct fb_var_screeninfo *var)if (ret) goto done; +/* verify that virtual resolution >= physical resolution */ +if (var->xres_virtual < var->xres || + var->yres_virtual < var->yres) { +pr_warn ("WARNING: fbcon: Driver '%s' missed to adjust virtual screen size (%ux%u vs. %ux%u)\n" , + info->fix.id, + var->xres_virtual, var->yres_virtual, + var->xres, var->yres); + ret = -EINVAL ; + goto done; + } +if ((var->activate &FB_ACTIVATE_MASK ) ==FB_ACTIVATE_NOW ) {struct fb_var_screeninfo old_var;struct fb_videomode mode;
@@ -1121,9 +1132,12 @@ static long do_fb_ioctl(struct fb_info *info, unsigned int cmd,console_unlock ();return -ENODEV ; } - info->flags |=FBINFO_MISC_USEREVENT ; - ret =fb_set_var (info, &var); - info->flags &= ~FBINFO_MISC_USEREVENT ; + ret =fbcon_modechange_possible (info, &var); +if (!ret) { + info->flags |=FBINFO_MISC_USEREVENT ; + ret =fb_set_var (info, &var); + info->flags &= ~FBINFO_MISC_USEREVENT ; + }unlock_fb_info (info);console_unlock ();if (!ret &©_to_user (argp, &var,sizeof (var)))
fs/binfmt_elf_fdpic.c +1 -1
@@ -324,7 +324,7 @@ static int load_elf_fdpic_binary(struct linux_binprm *bprm)else executable_stack =EXSTACK_DEFAULT ; -if (stack_size ==0 ) { +if (stack_size ==0 && interp_params.flags &ELF_FDPIC_FLAG_PRESENT ) { stack_size = interp_params.stack_size;if (interp_params.flags &ELF_FDPIC_FLAG_EXEC_STACK ) executable_stack =EXSTACK_ENABLE_X ;
fs/binfmt_misc.c +168 -48
311 lines not on this page · raw message
fs/btrfs/delayed-inode.c +1 -1
@@ -984,7 +984,7 @@ static void btrfs_release_delayed_inode(struct btrfs_delayed_node *delayed_node)if (delayed_node &&test_bit (BTRFS_DELAYED_NODE_INODE_DIRTY , &delayed_node->flags)) { -BUG_ON (!delayed_node->root); +ASSERT (delayed_node->root);clear_bit (BTRFS_DELAYED_NODE_INODE_DIRTY , &delayed_node->flags); delayed_node->count--;
fs/btrfs/free-space-cache.c +4 -4
@@ -1732,9 +1732,9 @@ static void bitmap_clear_bits(struct btrfs_free_space_ctl *ctl, ctl->free_space -= bytes; } -static void bitmap_set_bits (struct btrfs_free_space_ctl *ctl, -struct btrfs_free_space *info,u64 offset, -u64 bytes) +static void btrfs_bitmap_set_bits (struct btrfs_free_space_ctl *ctl, +struct btrfs_free_space *info,u64 offset, +u64 bytes) {unsigned long start, count;
@@ -1991,7 +1991,7 @@ static u64 add_bytes_to_bitmap(struct btrfs_free_space_ctl *ctl, bytes_to_set =min (end - offset, bytes); -bitmap_set_bits (ctl, info, offset, bytes_to_set); +btrfs_bitmap_set_bits (ctl, info, offset, bytes_to_set);/* * We set some bytes, we have no idea what the max extent size is
fs/btrfs/inode.c +8 -1
@@ -4296,7 +4296,14 @@ static noinline int may_destroy_subvol(struct btrfs_root *root) ret =btrfs_search_slot (NULL , fs_info->tree_root, &key, path,0 ,0 );if (ret <0 ) goto out; -BUG_ON (ret ==0 ); +if (ret ==0 ) { +/* +* Key with offset -1 found, there would have to exist a root +* with such id, but this is out of valid range. +*/ + ret = -EUCLEAN ; + goto out; + } ret =0 ;if (path->slots[0 ] >0 ) {
fs/btrfs/qgroup.c +0 -2
@@ -2095,8 +2095,6 @@ int btrfs_qgroup_account_extent(struct btrfs_trans_handle *trans, u64 bytenr,if (nr_old_roots ==0 && nr_new_roots ==0 ) goto out_free; -BUG_ON (!fs_info->quota_root); -trace_btrfs_qgroup_account_extent (fs_info, trans->transid, bytenr, num_bytes, nr_old_roots, nr_new_roots);
fs/btrfs/send.c +6 -1
@@ -677,7 +677,12 @@ static int begin_cmd(struct send_ctx *sctx, int cmd)if (WARN_ON (!sctx->send_buf))return -EINVAL ; -BUG_ON (sctx->send_size); +if (unlikely (sctx->send_size !=0 )) { +btrfs_err (sctx->send_root->fs_info, +"send: command header buffer not empty cmd %d offset %llu" , + cmd, sctx->send_off); +return -EINVAL ; + } sctx->send_size +=sizeof (*hdr); hdr = (struct btrfs_cmd_header *)sctx->send_buf;
fs/ext4/extents.c +2 -1
@@ -3445,9 +3445,10 @@ static int ext4_ext_convert_to_initialized(handle_t *handle,struct ext4_extent *ex, *abut_ex;ext4_lblk_t ee_block, eof_block;unsigned int ee_len, depth, map_len = map->m_len; -int allocated =0 , max_zeroout =0 ;int err =0 ;int split_flag =EXT4_EXT_DATA_VALID2 ; +int allocated =0 ; +unsigned int max_zeroout =0 ; ext_debug("ext4_ext_convert_to_initialized: inode %lu, logical" "block %llu, max_blocks %u\n", inode->i_ino,
fs/ext4/mballoc.c +3 -0
@@ -5219,6 +5219,9 @@ static int ext4_try_to_trim_range(struct super_block *sb,bool set_trimmed = false;void *bitmap; +if (unlikely (EXT4_MB_GRP_BBITMAP_CORRUPT (e4b->bd_info))) +return 0 ; + last =ext4_last_grp_cluster (sb, e4b->bd_group); bitmap = e4b->bd_bitmap;if (start ==0 && max >= last)
fs/f2fs/segment.c +3 -2
@@ -2018,6 +2018,8 @@ static void update_sit_entry(struct f2fs_sb_info *sbi, block_t blkaddr, int del)#endif segno =GET_SEGNO (sbi, blkaddr); +if (segno ==NULL_SEGNO ) +return ; se =get_seg_entry (sbi, segno); new_vblocks = se->valid_blocks + del;
@@ -2935,8 +2937,7 @@ void f2fs_allocate_data_block(struct f2fs_sb_info *sbi, struct page *page,* since SSR needs latest valid block information. */ update_sit_entry (sbi, *new_blkaddr,1 ); -if (GET_SEGNO (sbi, old_blkaddr) !=NULL_SEGNO ) -update_sit_entry (sbi, old_blkaddr,-1 ); +update_sit_entry (sbi, old_blkaddr,-1 );if (!__has_curseg_space (sbi, type)) sit_i->s_ops->allocate_segment (sbi, type, false);
fs/file.c +13 -17
@@ -41,27 +41,23 @@ static void free_fdtable_rcu(struct rcu_head *rcu)#define BITBIT_NR (nr) BITS_TO_LONGS(BITS_TO_LONGS(nr))#define BITBIT_SIZE (nr) (BITBIT_NR(nr) * sizeof(long)) +#define fdt_words (fdt) ((fdt)->max_fds / BITS_PER_LONG) // words in ->open_fds/* * Copy 'count' fd bits from the old table to the new table and clear the extra * space if any. This does not copy the file pointers. Called with the files * spinlock held for write. */ -static void copy_fd_bitmaps (struct fdtable *nfdt,struct fdtable *ofdt, -unsigned int count) +static inline void copy_fd_bitmaps (struct fdtable *nfdt,struct fdtable *ofdt, +unsigned int copy_words) { -unsigned int cpy, set; - - cpy = count /BITS_PER_BYTE ; - set = (nfdt->max_fds - count) /BITS_PER_BYTE ; -memcpy (nfdt->open_fds, ofdt->open_fds, cpy); -memset ((char *)nfdt->open_fds + cpy,0 , set); -memcpy (nfdt->close_on_exec, ofdt->close_on_exec, cpy); -memset ((char *)nfdt->close_on_exec + cpy,0 , set); - - cpy =BITBIT_SIZE (count); - set =BITBIT_SIZE (nfdt->max_fds) - cpy; -memcpy (nfdt->full_fds_bits, ofdt->full_fds_bits, cpy); -memset ((char *)nfdt->full_fds_bits + cpy,0 , set); +unsigned int nwords =fdt_words (nfdt); + +bitmap_copy_and_extend (nfdt->open_fds, ofdt->open_fds, + copy_words *BITS_PER_LONG , nwords *BITS_PER_LONG ); +bitmap_copy_and_extend (nfdt->close_on_exec, ofdt->close_on_exec, + copy_words *BITS_PER_LONG , nwords *BITS_PER_LONG ); +bitmap_copy_and_extend (nfdt->full_fds_bits, ofdt->full_fds_bits, + copy_words, nwords); }/*
@@ -79,7 +75,7 @@ static void copy_fdtable(struct fdtable *nfdt, struct fdtable *ofdt)memcpy (nfdt->fd, ofdt->fd, cpy);memset ((char *)nfdt->fd + cpy,0 , set); -copy_fd_bitmaps (nfdt, ofdt, ofdt->max_fds); +copy_fd_bitmaps (nfdt, ofdt,fdt_words (ofdt)); }static struct fdtable *alloc_fdtable (unsigned int nr)
@@ -330,7 +326,7 @@ struct files_struct *dup_fd(struct files_struct *oldf, int *errorp) open_files =count_open_files (old_fdt); } -copy_fd_bitmaps (new_fdt, old_fdt, open_files); +copy_fd_bitmaps (new_fdt, old_fdt, open_files /BITS_PER_LONG ); old_fds = old_fdt->fd; new_fds = new_fdt->fd;
fs/fuse/dev.c +4 -2
@@ -1671,9 +1671,11 @@ static int fuse_notify_store(struct fuse_conn *fc, unsigned int size, this_num =min_t (unsigned, num,PAGE_SIZE - offset); err =fuse_copy_page (cs, &page, offset, this_num,0 ); -if (!err && offset ==0 && - (this_num ==PAGE_SIZE || file_size == end)) +if (!PageUptodate (page) && !err && offset ==0 && + (this_num ==PAGE_SIZE || file_size == end)) { +zero_user_segment (page, this_num,PAGE_SIZE );SetPageUptodate (page); + }unlock_page (page);put_page (page);
fs/gfs2/inode.c +1 -1
@@ -1847,7 +1847,7 @@ static int setattr_chown(struct inode *inode, struct iattr *attr)kuid_t ouid, nuid;kgid_t ogid, ngid;int error; -struct gfs2_alloc_parms ap; +struct gfs2_alloc_parms ap = {}; ouid = inode->i_uid; ogid = inode->i_gid;
fs/locks.c +2 -2
@@ -2313,7 +2313,7 @@ int fcntl_setlk(unsigned int fd, struct file *filp, unsigned int cmd, f =fcheck (fd);spin_unlock (¤t->files->file_lock);if (f != filp) { -locks_remove_posix (filp, ¤t->files); +locks_remove_posix (filp, current->files); error = -EBADF ; } }
@@ -2443,7 +2443,7 @@ int fcntl_setlk64(unsigned int fd, struct file *filp, unsigned int cmd, f =fcheck (fd);spin_unlock (¤t->files->file_lock);if (f != filp) { -locks_remove_posix (filp, ¤t->files); +locks_remove_posix (filp, current->files); error = -EBADF ; } }
fs/nfs/pnfs.c +8 -0
@@ -1889,6 +1889,14 @@ pnfs_update_layout(struct inode *ino, } lookup_again: +if (!nfs4_valid_open_stateid (ctx->state)) { +trace_pnfs_update_layout (ino, pos, count, + iomode, lo, lseg, +PNFS_UPDATE_LAYOUT_INVALID_OPEN ); + lseg =ERR_PTR (-EIO ); + goto out; + } + lseg =ERR_PTR (nfs4_client_recover_expired_lease (clp));if (IS_ERR (lseg)) goto out;
fs/quota/dquot.c +2 -3
@@ -985,9 +985,8 @@ struct dquot *dqget(struct super_block *sb, struct kqid qid)* smp_mb__before_atomic() in dquot_acquire(). */ smp_rmb (); -#ifdef CONFIG_QUOTA_DEBUG -BUG_ON (!dquot->dq_sb);/* Has somebody invalidated entry under us? */ -#endif +/* Has somebody invalidated entry under us? */ +WARN_ON_ONCE (hlist_unhashed (&dquot->dq_hash)); out:if (empty)do_destroy_dquot (empty);
include/linux/bitmap.h +17 -3
@@ -212,12 +212,14 @@ extern int bitmap_print_to_pagebuf(bool list, char *buf,#define small_const_nbits (nbits) \ (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG && (nbits) > 0) +#define bitmap_size (nbits) (ALIGN(nbits, BITS_PER_LONG) / BITS_PER_BYTE) +static inline void bitmap_zero (unsigned long *dst,unsigned int nbits) {if (small_const_nbits (nbits)) *dst =0UL ;else { -unsigned int len =BITS_TO_LONGS (nbits) *sizeof (unsigned long ); +unsigned int len =bitmap_size (nbits);memset (dst,0 , len); } }
@@ -227,7 +229,7 @@ static inline void bitmap_fill(unsigned long *dst, unsigned int nbits)if (small_const_nbits (nbits)) *dst = ~0UL ;else { -unsigned int len =BITS_TO_LONGS (nbits) *sizeof (unsigned long ); +unsigned int len =bitmap_size (nbits);memset (dst,0xff , len); } }
@@ -238,7 +240,7 @@ static inline void bitmap_copy(unsigned long *dst, const unsigned long *src,if (small_const_nbits (nbits)) *dst = *src;else { -unsigned int len =BITS_TO_LONGS (nbits) *sizeof (unsigned long ); +unsigned int len =bitmap_size (nbits);memcpy (dst, src, len); } }
@@ -254,6 +256,18 @@ static inline void bitmap_copy_clear_tail(unsigned long *dst, dst[nbits /BITS_PER_LONG ] &=BITMAP_LAST_WORD_MASK (nbits); } +static inline void bitmap_copy_and_extend (unsigned long *to, +const unsigned long *from, +unsigned int count,unsigned int size) +{ +unsigned int copy =BITS_TO_LONGS (count); + +memcpy (to, from, copy *sizeof (long )); +if (count %BITS_PER_LONG ) + to[copy -1 ] &=BITMAP_LAST_WORD_MASK (count); +memset (to + copy,0 ,bitmap_size (size) - copy *sizeof (long )); +} +/* * On 32-bit systems bitmaps are represented as u32 arrays internally, and * therefore conversion is not needed when copying data from/to arrays of u32.
include/linux/blkdev.h +1 -1
@@ -56,7 +56,7 @@ struct blk_stat_callback;*/ #define BLKCG_MAX_POLS 5 -static inline int blk_validate_block_size (unsigned int bsize) +static inline int blk_validate_block_size (unsigned long bsize) {if (bsize <512 || bsize >PAGE_SIZE || !is_power_of_2 (bsize))return -EINVAL ;
include/linux/cpumask.h +1 -1
@@ -656,7 +656,7 @@ static inline int cpulist_parse(const char *buf, struct cpumask *dstp)*/ static inline unsigned int cpumask_size (void ) { -return BITS_TO_LONGS (nr_cpumask_bits) *sizeof (long ); +return bitmap_size (nr_cpumask_bits); }/*
include/linux/fbcon.h +4 -0
@@ -4,9 +4,13 @@#ifdef CONFIG_FRAMEBUFFER_CONSOLE void __init fb_console_init (void ); void __exit fb_console_exit(void); +int fbcon_modechange_possible (struct fb_info *info, +struct fb_var_screeninfo *var);#else static inline void fb_console_init (void ) {}static inline void fb_console_exit (void ) {} +static inline int fbcon_modechange_possible (struct fb_info *info, +struct fb_var_screeninfo *var) {return 0 ; }#endif #endif /* _LINUX_FBCON_H */
include/linux/overflow.h +81 -32
157 lines not on this page · raw message
include/net/busy_poll.h +1 -1
@@ -73,7 +73,7 @@ static inline bool sk_can_busy_loop(struct sock *sk)static inline unsigned long busy_loop_current_time (void ) {#ifdef CONFIG_NET_RX_BUSY_POLL -return (unsigned long )(local_clock () >>10 ); +return (unsigned long )(ktime_get_ns () >>10 );#else return 0 ;#endif
include/net/kcm.h +1 -0
@@ -73,6 +73,7 @@ struct kcm_sock {struct work_struct tx_work;struct list_head wait_psock_list;struct sk_buff *seq_skb; +struct mutex tx_mutex; u32 tx_stopped : 1;/* Don't use bit fields here, these are set under different locks */
ipc/msg.c +1 -1
@@ -137,7 +137,7 @@ static int newque(struct ipc_namespace *ns, struct ipc_params *params)key_t key = params->key;int msgflg = params->flg; - msq =kvmalloc (sizeof (*msq),GFP_KERNEL ); + msq =kvmalloc (sizeof (*msq),GFP_KERNEL_ACCOUNT );if (unlikely (!msq))return -ENOMEM ;
ipc/sem.c +4 -3
@@ -494,7 +494,7 @@ static struct sem_array *sem_alloc(size_t nsems)return NULL ; size =sizeof (*sma) + nsems *sizeof (sma->sems[0 ]); - sma =kvmalloc (size,GFP_KERNEL ); + sma =kvmalloc (size,GFP_KERNEL_ACCOUNT );if (unlikely (!sma))return NULL ;
@@ -1813,7 +1813,7 @@ static inline int get_undo_list(struct sem_undo_list **undo_listp) undo_list = current->sysvsem.undo_list;if (!undo_list) { - undo_list =kzalloc (sizeof (*undo_list),GFP_KERNEL ); + undo_list =kzalloc (sizeof (*undo_list),GFP_KERNEL_ACCOUNT );if (undo_list ==NULL )return -ENOMEM ;spin_lock_init (&undo_list->lock);
@@ -1897,7 +1897,8 @@ static struct sem_undo *find_alloc_undo(struct ipc_namespace *ns, int semid)rcu_read_unlock ();/* step 2: allocate new undo structure */ - new =kzalloc (sizeof (struct sem_undo ) +sizeof (short )*nsems,GFP_KERNEL ); + new =kzalloc (sizeof (struct sem_undo ) +sizeof (short )*nsems, +GFP_KERNEL_ACCOUNT );if (!new) {ipc_rcu_putref (&sma->sem_perm, sem_rcu_free);return ERR_PTR (-ENOMEM );
ipc/shm.c +1 -1
@@ -711,7 +711,7 @@ static int newseg(struct ipc_namespace *ns, struct ipc_params *params) ns->shm_tot + numpages > ns->shm_ctlall)return -ENOSPC ; - shp =kvmalloc (sizeof (*shp),GFP_KERNEL ); + shp =kvmalloc (sizeof (*shp),GFP_KERNEL_ACCOUNT );if (unlikely (!shp))return -ENOMEM ;
kernel/cgroup/cpuset.c +9 -4
@@ -22,6 +22,7 @@* distribution for more details. */ +#include "cgroup-internal.h" #include <linux/cpu.h> #include <linux/cpumask.h> #include <linux/cpuset.h>
@@ -2758,10 +2759,14 @@ int proc_cpuset_show(struct seq_file *m, struct pid_namespace *ns,if (!buf) goto out; - css =task_get_css (tsk, cpuset_cgrp_id); - retval =cgroup_path_ns (css->cgroup, buf,PATH_MAX , - current->nsproxy->cgroup_ns); -css_put (css); +rcu_read_lock (); +spin_lock_irq (&css_set_lock); + css =task_css (tsk, cpuset_cgrp_id); + retval =cgroup_path_ns_locked (css->cgroup, buf,PATH_MAX , + current->nsproxy->cgroup_ns); +spin_unlock_irq (&css_set_lock); +rcu_read_unlock (); +if (retval >=PATH_MAX ) retval = -ENAMETOOLONG ;if (retval <0 )
kernel/time/hrtimer.c +2 -0
@@ -1172,6 +1172,8 @@ void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,struct hrtimer_clock_base *base;unsigned long flags; +if (WARN_ON_ONCE (!timer->function)) +return ;/* * Check whether the HRTIMER_MODE_SOFT bit and hrtimer.is_soft * match.
lib/idr.c +1 -1
@@ -471,7 +471,7 @@ static void ida_remove(struct ida *ida, int id) }else { btmp = bitmap->bitmap; } -if (!test_bit (offset, btmp)) +if (!bitmap || !test_bit (offset, btmp)) goto err;__clear_bit (offset, btmp);
lib/test_ida.c +40 -0
@@ -150,6 +150,45 @@ static void ida_check_conv(struct ida *ida)IDA_BUG_ON (ida, !ida_is_empty (ida)); } +/* +* Check various situations where we attempt to free an ID we don't own. +*/ +static void ida_check_bad_free (struct ida *ida) +{ +unsigned long i; + +printk ("vvv Ignore \"not allocated\" warnings\n" ); +/* IDA is empty; all of these will fail */ +ida_free (ida,0 ); +for (i =0 ; i <31 ; i++) +ida_free (ida,1 << i); + +/* IDA contains a single value entry */ +IDA_BUG_ON (ida,ida_alloc_min (ida,3 ,GFP_KERNEL ) !=3 ); +ida_free (ida,0 ); +for (i =0 ; i <31 ; i++) +ida_free (ida,1 << i); + +/* IDA contains a single bitmap */ +IDA_BUG_ON (ida,ida_alloc_min (ida,1023 ,GFP_KERNEL ) !=1023 ); +ida_free (ida,0 ); +for (i =0 ; i <31 ; i++) +ida_free (ida,1 << i); + +/* IDA contains a tree */ +IDA_BUG_ON (ida,ida_alloc_min (ida, (1 <<20 ) -1 ,GFP_KERNEL ) != (1 <<20 ) -1 ); +ida_free (ida,0 ); +for (i =0 ; i <31 ; i++) +ida_free (ida,1 << i); +printk ("^^^ \"not allocated\" warnings over\n" ); + +ida_free (ida,3 ); +ida_free (ida,1023 ); +ida_free (ida, (1 <<20 ) -1 ); + +IDA_BUG_ON (ida, !ida_is_empty (ida)); +} +static DEFINE_IDA (ida);static int ida_checks (void )
@@ -162,6 +201,7 @@ static int ida_checks(void)ida_check_leaf (&ida,1024 *64 );ida_check_max (&ida);ida_check_conv (&ida); +ida_check_bad_free (&ida);printk ("IDA: %u of %u tests passed\n" , tests_passed, tests_run);return (tests_run != tests_passed) ?0 : -EINVAL ;
lib/test_overflow.c +98 -0
110 lines not on this page · raw message
mm/memcontrol.c +5 -2
@@ -4140,9 +4140,12 @@ static ssize_t memcg_write_event_control(struct kernfs_open_file *of, buf = endp +1 ; cfd =simple_strtoul (buf, &endp,10 ); -if ((*endp !=' ' ) && (*endp !='\0' )) +if (*endp =='\0' ) + buf = endp; +else if (*endp ==' ' ) + buf = endp +1 ; +else return -EINVAL ; - buf = endp +1 ; event =kzalloc (sizeof (*event),GFP_KERNEL );if (!event)
net/bluetooth/bnep/core.c +2 -1
@@ -385,7 +385,8 @@ static int bnep_rx_frame(struct bnep_session *s, struct sk_buff *skb)case BNEP_COMPRESSED_DST_ONLY :__skb_put_data (nskb,skb_mac_header (skb),ETH_ALEN ); -__skb_put_data (nskb, s->eh.h_source,ETH_ALEN +2 ); +__skb_put_data (nskb, s->eh.h_source,ETH_ALEN ); +put_unaligned (s->eh.h_proto, (__be16 *)__skb_put (nskb,2 ));break ;case BNEP_GENERAL :
net/bluetooth/hci_core.c +30 -28
108 lines not on this page · raw message
net/bluetooth/mgmt.c +4 -0
@@ -2913,6 +2913,10 @@ static int pair_device(struct sock *sk, struct hci_dev *hdev, void *data,* will be kept and this function does nothing. */ p =hci_conn_params_add (hdev, &cp->addr.bdaddr, addr_type); +if (!p) { + err = -EIO ; + goto unlock; + }if (p->auto_connect ==HCI_AUTO_CONN_EXPLICIT ) p->auto_connect =HCI_AUTO_CONN_DISABLED ;
net/core/skbuff.c +2 -1
@@ -3625,8 +3625,9 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,/* GSO partial only requires that we trim off any excess that * doesn't fit into an MSS sized block, so take care of that * now. +* Cap len to not accidentally hit GSO_BY_FRAGS. */ - partial_segs = len / mss; + partial_segs =min (len, (unsigned int )(GSO_BY_FRAGS -1 )) / mss;if (partial_segs >1 ) mss *= partial_segs;else
net/ipv6/ip6_output.c +2 -0
@@ -1757,6 +1757,7 @@ int ip6_send_skb(struct sk_buff *skb)struct rt6_info *rt = (struct rt6_info *)skb_dst (skb);int err; +rcu_read_lock (); err =ip6_local_out (net, skb->sk, skb);if (err) {if (err >0 )
@@ -1766,6 +1767,7 @@ int ip6_send_skb(struct sk_buff *skb) IPSTATS_MIB_OUTDISCARDS); } +rcu_read_unlock ();return err; }
net/iucv/iucv.c +1 -2
@@ -1149,8 +1149,7 @@ static int iucv_message_receive_iprmdata(struct iucv_path *path, size = (size <8 ) ? size :8 ;for (array = buffer; size >0 ; array++) { copy =min_t (size_t, size, array->length); -memcpy ((u8 *)(addr_t ) array->address, - rmmsg, copy); +memcpy (phys_to_virt (array->address), rmmsg, copy); rmmsg += copy; size -= copy; }
net/kcm/kcmsock.c +4 -0
@@ -912,6 +912,7 @@ static int kcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) !(msg->msg_flags & MSG_MORE) : !!(msg->msg_flags & MSG_EOR);int err = -EPIPE ; +mutex_lock (&kcm->tx_mutex);lock_sock (sk);/* Per tcp_sendmsg this should be in poll */
@@ -1060,6 +1061,7 @@ static int kcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t len)KCM_STATS_ADD (kcm->stats.tx_bytes, copied);release_sock (sk); +mutex_unlock (&kcm->tx_mutex);return copied; out_error:
@@ -1085,6 +1087,7 @@ static int kcm_sendmsg(struct socket *sock, struct msghdr *msg, size_t len) sk->sk_write_space (sk);release_sock (sk); +mutex_unlock (&kcm->tx_mutex);return err; }
@@ -1327,6 +1330,7 @@ static void init_kcm_sock(struct kcm_sock *kcm, struct kcm_mux *mux)spin_unlock_bh (&mux->lock);INIT_WORK (&kcm->tx_work, kcm_tx_work); +mutex_init (&kcm->tx_mutex);spin_lock_bh (&mux->rx_lock);kcm_rcv_ready (kcm);
net/netfilter/nft_counter.c +5 -0
@@ -108,11 +108,16 @@ static void nft_counter_reset(struct nft_counter_percpu_priv __percpu *priv, struct nft_counter *total) {struct nft_counter *this_cpu; +seqcount_t *myseq;local_bh_disable (); this_cpu =this_cpu_ptr (priv->counter); + myseq =this_cpu_ptr (&nft_counter_seq); + +write_seqcount_begin (myseq); this_cpu->packets -= total->packets; this_cpu->bytes -= total->bytes; +write_seqcount_end (myseq);local_bh_enable (); }
net/rds/recv.c +11 -2
@@ -429,6 +429,7 @@ static int rds_still_queued(struct rds_sock *rs, struct rds_incoming *inc,struct sock *sk =rds_rs_to_sk (rs);int ret =0 ;unsigned long flags; +struct rds_incoming *to_drop =NULL ;write_lock_irqsave (&rs->rs_recv_lock, flags);if (!list_empty (&inc->i_item)) {
@@ -439,11 +440,14 @@ static int rds_still_queued(struct rds_sock *rs, struct rds_incoming *inc, -be32_to_cpu (inc->i_hdr.h_len), inc->i_hdr.h_dport);list_del_init (&inc->i_item); -rds_inc_put (inc); + to_drop = inc; } }write_unlock_irqrestore (&rs->rs_recv_lock, flags); +if (to_drop) +rds_inc_put (to_drop); +rdsdebug ("inc %p rs %p still %d dropped %d\n" , inc, rs, ret, drop);return ret; }
@@ -752,16 +756,21 @@ void rds_clear_recv_queue(struct rds_sock *rs)struct sock *sk =rds_rs_to_sk (rs);struct rds_incoming *inc, *tmp;unsigned long flags; +LIST_HEAD (to_drop);write_lock_irqsave (&rs->rs_recv_lock, flags);list_for_each_entry_safe (inc, tmp, &rs->rs_recv_queue, i_item) {rds_recv_rcvbuf_delta (rs, sk, inc->i_conn->c_lcong, -be32_to_cpu (inc->i_hdr.h_len), inc->i_hdr.h_dport); +list_move (&inc->i_item, &to_drop); + } +write_unlock_irqrestore (&rs->rs_recv_lock, flags); + +list_for_each_entry_safe (inc, tmp, &to_drop, i_item) {list_del_init (&inc->i_item);rds_inc_put (inc); } -write_unlock_irqrestore (&rs->rs_recv_lock, flags); }/*
security/selinux/avc.c +1 -1
@@ -401,12 +401,12 @@ static int avc_add_xperms_decision(struct avc_node *node, {struct avc_xperms_decision_node *dest_xpd; - node->ae.xp_node->xp.len++; dest_xpd =avc_xperms_decision_alloc (src->used);if (!dest_xpd)return -ENOMEM ;avc_copy_xperms_decision (&dest_xpd->xpd, src);list_add (&dest_xpd->xpd_list, &node->ae.xp_node->xpd_head); + node->ae.xp_node->xp.len++;return 0 ; }
sound/core/timer.c +1 -1
@@ -532,7 +532,7 @@ static int snd_timer_start1(struct snd_timer_instance *timeri,/* check the actual time for the start tick; * bail out as error if it's way too low (< 100us) */ -if (start) { +if (start && !(timer->hw.flags &SNDRV_TIMER_HW_SLAVE )) {if ((u64 )snd_timer_hw_resolution (timer) * ticks <100000 ) { result = -EINVAL ; goto unlock;
sound/usb/quirks-table.h +1 -0
@@ -352,6 +352,7 @@ YAMAHA_DEVICE(0x105a, NULL), YAMAHA_DEVICE(0x105b, NULL), YAMAHA_DEVICE(0x105c, NULL), YAMAHA_DEVICE(0x105d, NULL), +YAMAHA_DEVICE(0x1718, "P-125"), { USB_DEVICE(0x0499, 0x1503), .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
tools/include/linux/align.h new file +12 -0
@@ -0,0 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef _TOOLS_LINUX_ALIGN_H +#define _TOOLS_LINUX_ALIGN_H + +#include <linux/const.h> + +#define ALIGN (x, a) __ALIGN_KERNEL((x), (a)) +#define ALIGN_DOWN (x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a)) +#define IS_ALIGNED (x, a) (((x) & ((typeof(x))(a) - 1)) == 0) + +#endif /* _TOOLS_LINUX_ALIGN_H */
tools/include/linux/bitmap.h +5 -3
@@ -3,6 +3,7 @@#define _PERF_BITOPS_H#include <string.h> +#include <linux/align.h> #include <linux/bitops.h> #include <stdlib.h> #include <linux/kernel.h>
@@ -27,13 +28,14 @@ int __bitmap_and(unsigned long *dst, const unsigned long *bitmap1,#define small_const_nbits (nbits) \ (__builtin_constant_p(nbits) && (nbits) <= BITS_PER_LONG) +#define bitmap_size (nbits) (ALIGN(nbits, BITS_PER_LONG) / BITS_PER_BYTE) +static inline void bitmap_zero (unsigned long *dst,int nbits) {if (small_const_nbits (nbits)) *dst =0UL ;else { -int len =BITS_TO_LONGS (nbits) *sizeof (unsigned long ); -memset (dst,0 , len); +memset (dst,0 ,bitmap_size (nbits)); } }
@@ -119,7 +121,7 @@ static inline int test_and_clear_bit(int nr, unsigned long *addr)*/ static inline unsigned long *bitmap_alloc (int nbits) { -return calloc (1 ,BITS_TO_LONGS (nbits) *sizeof (unsigned long )); +return calloc (1 ,bitmap_size (nbits)); }/*