4.14.182-rc1 review
Subsystems (3)
Greg Kroah-Hartman
maintainercover 4.14.182-rc1 review
This is the start of the stable review cycle for the 4.14.182 release. There are 59 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 28 May 2020 18:36:22 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.182-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.14.182-rc1
Fabrice Gasnier <[email protected]>
iio: adc: stm32-adc: fix device used to request dma
Peter Ujfalusi <[email protected]>
iio: adc: stm32-adc: Use dma_request_chan() instead dma_request_slave_channel()
Josh Poimboeuf <[email protected]>
x86/unwind/orc: Fix unwind_get_return_address_ptr() for inactive tasks
Qiushi Wu <[email protected]>
rxrpc: Fix a memory leak in rxkad_verify_response()
John Hubbard <[email protected]>
rapidio: fix an error in get_user_pages_fast() error handling
Alexander Usyskin <[email protected]>
mei: release me_cl object reference
Christophe JAILLET <[email protected]>
iio: dac: vf610: Fix an error handling path in 'vf610_dac_probe()'
Christophe JAILLET <[email protected]>
iio: sca3000: Remove an erroneous 'get_device()'
Oscar Carter <[email protected]>
staging: greybus: Fix uninitialized scalar variable
Dragos Bogdan <[email protected]>
staging: iio: ad2s1210: Fix SPI reading
Bob Peterson <[email protected]>
Revert "gfs2: Don't demote a glock until its revokes are written"
Arjun Vynipadath <[email protected]>
cxgb4/cxgb4vf: Fix mac_hlist initialization and free
Arjun Vynipadath <[email protected]>
cxgb4: free mac_hlist properly
Geert Uytterhoeven <[email protected]>
media: fdp1: Fix R-Car M3-N naming in debug message
Vishal Verma <[email protected]>
libnvdimm/btt: Fix LBA masking during 'free list' population
Vishal Verma <[email protected]>
libnvdimm/btt: Remove unnecessary code in btt_freelist_init
Arnd Bergmann <[email protected]>
ubsan: build ubsan.c more conservatively
Peter Zijlstra <[email protected]>
x86/uaccess, ubsan: Fix UBSAN vs. SMAP
Michael Ellerman <[email protected]>
powerpc/64s: Disable STRICT_KERNEL_RWX
Russell Currey <[email protected]>
powerpc: Remove STRICT_KERNEL_RWX incompatibility with RELOCATABLE
Christophe Leroy <[email protected]>
powerpc: restore alphabetic order in Kconfig
Christophe JAILLET <[email protected]>
dmaengine: tegra210-adma: Fix an error handling path in 'tegra_adma_probe()'
Xiyu Yang <[email protected]>
apparmor: Fix aa_label refcnt leak in policy_update
Brent Lu <[email protected]>
ALSA: pcm: fix incorrect hw_base increase
Scott Bahling <[email protected]>
ALSA: iec1712: Initialize STDSP24 properly when using the model=staudio option
Guillaume Nault <[email protected]>
l2tp: initialise PPP sessions before registering them
Guillaume Nault <[email protected]>
l2tp: protect sock pointer of struct pppol2tp_session with RCU
Guillaume Nault <[email protected]>
l2tp: initialise l2tp_eth sessions before registering them
Guillaume Nault <[email protected]>
l2tp: don't register sessions in l2tp_session_create()
Christoph Hellwig <[email protected]>
arm64: fix the flush_icache_range arguments in machine_kexec
Daniel Jordan <[email protected]>
padata: purge get_cpu and reorder_via_wq from padata_do_serial
Daniel Jordan <[email protected]>
padata: initialize pd->cpu with effective cpumask
Herbert Xu <[email protected]>
padata: Replace delayed timer with immediate workqueue in padata_reorder
Mathias Krause <[email protected]>
padata: set cpu_index of unused CPUs to -1
Thomas Gleixner <[email protected]>
ARM: futex: Address build warning
Hans de Goede <[email protected]>
platform/x86: asus-nb-wmi: Do not load on Asus T100TA and T200TA
Alan Stern <[email protected]>
USB: core: Fix misleading driver bug report
Wu Bo <[email protected]>
ceph: fix double unlock in handle_cap_export()
Yoshiyuki Kurauchi <[email protected]>
gtp: set NLM_F_MULTI flag in gtp_genl_dump_pdp()
Thomas Gleixner <[email protected]>
x86/apic: Move TSC deadline timer debug printk
Tyrel Datwyler <[email protected]>
scsi: ibmvscsi: Fix WARN_ON during event pool release
James Hilliard <[email protected]>
component: Silence bind error on -EPROBE_DEFER
Stefano Garzarella <[email protected]>
vhost/vsock: fix packet delivery order to monitoring devices
Xiyu Yang <[email protected]>
configfs: fix config_item refcnt leak in configfs_rmdir()
Arun Easi <[email protected]>
scsi: qla2xxx: Fix hang when issuing nvme disconnect-all in NPIV
Sebastian Reichel <[email protected]>
HID: multitouch: add eGalaxTouch P80H84 support
Frédéric Pierret (fepitre) <[email protected]>
gcc-common.h: Update for GCC 10
Richard Weinberger <[email protected]>
ubi: Fix seq_file usage in detailed_erase_block_info debugfs file
Christophe JAILLET <[email protected]>
i2c: mux: demux-pinctrl: Fix an error handling path in 'i2c_demux_pinctrl_probe()'
Alexander Monakov <[email protected]>
iommu/amd: Fix over-read of ACPI UID from IVRS table
Al Viro <[email protected]>
fix multiplication overflow in copy_fdtable()
Roberto Sassu <[email protected]>
ima: Fix return value of ima_write_policy()
Roberto Sassu <[email protected]>
evm: Check also if *tfm is an error pointer in init_desc()
Roberto Sassu <[email protected]>
ima: Set file->f_mode instead of file->f_flags in ima_calc_file_hash()
Mathias Krause <[email protected]>
padata: ensure padata_do_serial() runs on the correct CPU
Mathias Krause <[email protected]>
padata: ensure the reorder timer callback runs on the correct CPU
Kevin Hao <[email protected]>
i2c: dev: Fix the race between the release of i2c_dev and cdev
Kevin Hao <[email protected]>
watchdog: Fix the race between the release of watchdog_core_data and cdev
Shijie Luo <[email protected]>
ext4: add cond_resched() to ext4_protect_reserved_inode
-------------
Diffstat:
Makefile | 4 +- arch/arm/include/asm/futex.h | 9 +- arch/arm64/kernel/machine_kexec.c | 3 +- arch/powerpc/Kconfig | 4 +- arch/x86/kernel/apic/apic.c | 27 +-- arch/x86/kernel/unwind_orc.c | 7 + drivers/base/component.c | 8 +- drivers/dma/tegra210-adma.c | 2 +- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-multitouch.c | 3 + drivers/i2c/i2c-dev.c | 48 +++-- drivers/i2c/muxes/i2c-demux-pinctrl.c | 1 + drivers/iio/accel/sca3000.c | 2 +- drivers/iio/adc/stm32-adc.c | 20 +- drivers/iio/dac/vf610_dac.c | 1 + drivers/iommu/amd_iommu_init.c | 9 +- drivers/media/platform/rcar_fdp1.c | 2 +- drivers/misc/mei/client.c | 2 + drivers/mtd/ubi/debug.c | 12 +- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 13 +- .../net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 6 +- drivers/net/gtp.c | 9 +- drivers/nvdimm/btt.c | 33 +-- drivers/nvdimm/btt.h | 2 + drivers/nvdimm/btt_devs.c | 8 + drivers/platform/x86/asus-nb-wmi.c | 24 +++ drivers/rapidio/devices/rio_mport_cdev.c | 5 + drivers/scsi/ibmvscsi/ibmvscsi.c | 4 - drivers/scsi/qla2xxx/qla_mbx.c | 2 +- drivers/staging/greybus/uart.c | 4 +- drivers/staging/iio/resolver/ad2s1210.c | 17 +- drivers/usb/core/message.c | 4 +- drivers/vhost/vsock.c | 10 +- drivers/watchdog/watchdog_dev.c | 67 +++--- fs/ceph/caps.c | 1 + fs/configfs/dir.c | 1 + fs/ext4/block_validity.c | 1 + fs/file.c | 2 +- fs/gfs2/glock.c | 3 - include/linux/padata.h | 13 +- kernel/padata.c | 71 +++--- lib/Makefile | 2 + net/l2tp/l2tp_core.c | 21 +- net/l2tp/l2tp_core.h | 3 + net/l2tp/l2tp_eth.c | 99 +++++++-- net/l2tp/l2tp_ppp.c | 238 +++++++++++++-------- net/rxrpc/rxkad.c | 3 +- scripts/gcc-plugins/Makefile | 1 + scripts/gcc-plugins/gcc-common.h | 4 + security/apparmor/apparmorfs.c | 3 +- security/integrity/evm/evm_crypto.c | 2 +- security/integrity/ima/ima_crypto.c | 12 +- security/integrity/ima/ima_fs.c | 3 +- sound/core/pcm_lib.c | 1 + sound/pci/ice1712/ice1712.c | 3 +- 55 files changed, 529 insertions(+), 331 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/59 ext4: add cond_resched() to ext4_protect_reserved_inode
From: Shijie Luo <[email protected]>
commit af133ade9a40794a37104ecbcc2827c0ea373a3c upstream.
When journal size is set too big by "mkfs.ext4 -J size=", or when we mount a crafted image to make journal inode->i_size too big, the loop, "while (i < num)", holds cpu too long. This could cause soft lockup.
[ 529.357541] Call trace: [ 529.357551] dump_backtrace+0x0/0x198 [ 529.357555] show_stack+0x24/0x30 [ 529.357562] dump_stack+0xa4/0xcc [ 529.357568] watchdog_timer_fn+0x300/0x3e8 [ 529.357574] __hrtimer_run_queues+0x114/0x358 [ 529.357576] hrtimer_interrupt+0x104/0x2d8 [ 529.357580] arch_timer_handler_virt+0x38/0x58 [ 529.357584] handle_percpu_devid_irq+0x90/0x248 [ 529.357588] generic_handle_irq+0x34/0x50 [ 529.357590] __handle_domain_irq+0x68/0xc0 [ 529.357593] gic_handle_irq+0x6c/0x150 [ 529.357595] el1_irq+0xb8/0x140 [ 529.357599] __ll_sc_atomic_add_return_acquire+0x14/0x20 [ 529.357668] ext4_map_blocks+0x64/0x5c0 [ext4] [ 529.357693] ext4_setup_system_zone+0x330/0x458 [ext4] [ 529.357717] ext4_fill_super+0x2170/0x2ba8 [ext4] [ 529.357722] mount_bdev+0x1a8/0x1e8 [ 529.357746] ext4_mount+0x44/0x58 [ext4] [ 529.357748] mount_fs+0x50/0x170 [ 529.357752] vfs_kern_mount.part.9+0x54/0x188 [ 529.357755] do_mount+0x5ac/0xd78 [ 529.357758] ksys_mount+0x9c/0x118 [ 529.357760] __arm64_sys_mount+0x28/0x38 [ 529.357764] el0_svc_common+0x78/0x130 [ 529.357766] el0_svc_handler+0x38/0x78 [ 529.357769] el0_svc+0x8/0xc [ 541.356516] watchdog: BUG: soft lockup - CPU#0 stuck for 23s! [mount:18674]
--- fs/ext4/block_validity.c | 1 + 1 file changed, 1 insertion(+)
fs/ext4/block_validity.c +1 -0
@@ -153,6 +153,7 @@ static int ext4_protect_reserved_inode(sreturn PTR_ERR (inode); num = (inode->i_size + sb->s_blocksize -1 ) >> sb->s_blocksize_bits;while (i < num) { +cond_resched (); map.m_lblk = i; map.m_len = num - i; n =ext4_map_blocks (NULL , inode, &map,0 );
Greg Kroah-Hartman
maintainerPATCH 2/59 watchdog: Fix the race between the release of watchdog_core_data and cdev
In reply to Greg Kroah-HartmanFrom: Kevin Hao <[email protected]>
commit 72139dfa2464e43957d330266994740bb7be2535 upstream.
The struct cdev is embedded in the struct watchdog_core_data. In the
current code, we manage the watchdog_core_data with a kref, but the
cdev is manged by a kobject. There is no any relationship between
this kref and kobject. So it is possible that the watchdog_core_data is
freed before the cdev is entirely released. We can easily get the
following call trace with CONFIG_DEBUG_KOBJECT_RELEASE and CONFIG_DEBUG_OBJECTS_TIMERS enabled.
ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x38
WARNING: CPU: 23 PID: 1028 at lib/debugobjects.c:481 debug_print_object+0xb0/0xf0 Modules linked in: softdog(-) deflate ctr twofish_generic twofish_common camellia_generic serpent_generic blowfish_generic blowfish_common cast5_generic cast_common cmac xcbc af_key sch_fq_codel openvswitch nsh nf_conncount nf_nat nf_conntrack nf_defrag_ipv6 nf_defrag_ipv4 CPU: 23 PID: 1028 Comm: modprobe Not tainted 5.3.0-next-20190924-yoctodev-standard+ #180 Hardware name: Marvell OcteonTX CN96XX board (DT) pstate: 00400009 (nzcv daif +PAN -UAO) pc : debug_print_object+0xb0/0xf0 lr : debug_print_object+0xb0/0xf0 sp : ffff80001cbcfc70 x29: ffff80001cbcfc70 x28: ffff800010ea2128 x27: ffff800010bad000 x26: 0000000000000000 x25: ffff80001103c640 x24: ffff80001107b268 x23: ffff800010bad9e8 x22: ffff800010ea2128 x21: ffff000bc2c62af8 x20: ffff80001103c600 x19: ffff800010e867d8 x18: 0000000000000060 x17: 0000000000000000 x16: 0000000000000000 x15: ffff000bd7240470 x14: 6e6968207473696c x13: 5f72656d6974203a x12: 6570797420746365 x11: 6a626f2029302065 x10: 7461747320657669 x9 : 7463612820657669 x8 : 3378302f3078302b x7 : 0000000000001d7a x6 : ffff800010fd5889 x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000000000 x2 : ffff000bff948548 x1 : 276a1c9e1edc2300 x0 : 0000000000000000 Call trace: debug_print_object+0xb0/0xf0 debug_check_no_obj_freed+0x1e8/0x210 kfree+0x1b8/0x368 watchdog_cdev_unregister+0x88/0xc8 watchdog_dev_unregister+0x38/0x48 watchdog_unregister_device+0xa8/0x100 softdog_exit+0x18/0xfec4 [softdog] __arm64_sys_delete_module+0x174/0x200 el0_svc_handler+0xd0/0x1c8 el0_svc+0x8/0xc
This is a common issue when using cdev embedded in a struct. Fortunately, we already have a mechanism to solve this kind of issue. Please see commit 233ed09d7fda ("chardev: add helper function to register char devs with a struct device") for more detail.
In this patch, we choose to embed the struct device into the watchdog_core_data, and use the API provided by the commit 233ed09d7fda to make sure that the release of watchdog_core_data and cdev are in sequence.
[bwh: Backported to 4.14:
- There's no reboot notifier here
- Adjust context]
--- drivers/watchdog/watchdog_dev.c | 67 +++++++++++++++++----------------------- 1 file changed, 30 insertions(+), 37 deletions(-)
drivers/watchdog/watchdog_dev.c +30 -37
@@ -38,7 +38,6 @@#include <linux/init.h> /* For __init/__exit/... */ #include <linux/jiffies.h> /* For timeout functions */ #include <linux/kernel.h> /* For printk/panic/... */ -#include <linux/kref.h> /* For data references */ #include <linux/miscdevice.h> /* For handling misc devices */ #include <linux/module.h> /* For module stuff/... */ #include <linux/mutex.h> /* For mutexes */
@@ -53,14 +52,14 @@/* * struct watchdog_core_data - watchdog core internal data -* @kref: Reference count. +* @dev: The watchdog's internal device * @cdev: The watchdog's Character device. * @wdd: Pointer to watchdog device. * @lock: Lock for watchdog core. * @status: Watchdog core internal status bits. */ struct watchdog_core_data { -struct kref kref; +struct device dev;struct cdev cdev;struct watchdog_device *wdd;struct mutex lock;
@@ -802,7 +801,7 @@ static int watchdog_open(struct inode *i file->private_data = wd_data;if (!hw_running) -kref_get (&wd_data->kref); +get_device (&wd_data->dev);/* dev/watchdog is a virtual (and thus non-seekable) filesystem */ return nonseekable_open (inode, file);
@@ -814,11 +813,11 @@ out_clear:return err; } -static void watchdog_core_data_release (struct kref *kref) +static void watchdog_core_data_release (struct device *dev) {struct watchdog_core_data *wd_data; - wd_data = container_of(kref, struct watchdog_core_data, kref); + wd_data = container_of(dev, struct watchdog_core_data, dev);kfree (wd_data); }
@@ -878,7 +877,7 @@ done:*/ if (!running) {module_put (wd_data->cdev.owner); -kref_put (&wd_data->kref, watchdog_core_data_release); +put_device (&wd_data->dev); }return 0 ; }
@@ -897,17 +896,22 @@ static struct miscdevice watchdog_miscde .fops = &watchdog_fops, }; +static struct class watchdog_class = { + .name ="watchdog" , + .owner =THIS_MODULE , + .dev_groups = wdt_groups, +}; +/* * watchdog_cdev_register: register watchdog character device * @wdd: watchdog device -* @devno: character device number * * Register a watchdog character device including handling the legacy * /dev/watchdog node. /dev/watchdog is actually a miscdevice and * thus we set it up like that. */ -static int watchdog_cdev_register (struct watchdog_device *wdd,dev_t devno) +static int watchdog_cdev_register (struct watchdog_device *wdd) {struct watchdog_core_data *wd_data;int err;
@@ -915,7 +919,6 @@ static int watchdog_cdev_register(struct wd_data =kzalloc (sizeof (struct watchdog_core_data ),GFP_KERNEL );if (!wd_data)return -ENOMEM ; -kref_init (&wd_data->kref);mutex_init (&wd_data->lock); wd_data->wdd = wdd;
@@ -942,23 +945,33 @@ static int watchdog_cdev_register(struct } } +device_initialize (&wd_data->dev); + wd_data->dev.devt =MKDEV (MAJOR (watchdog_devt), wdd->id); + wd_data->dev.class = &watchdog_class; + wd_data->dev.parent = wdd->parent; + wd_data->dev.groups = wdd->groups; + wd_data->dev.release = watchdog_core_data_release; +dev_set_drvdata (&wd_data->dev, wdd); +dev_set_name (&wd_data->dev,"watchdog%d" , wdd->id); +/* Fill in the data structures */ cdev_init (&wd_data->cdev, &watchdog_fops); - wd_data->cdev.owner = wdd->ops->owner;/* Add the device */ - err =cdev_add (&wd_data->cdev, devno,1 ); + err =cdev_device_add (&wd_data->cdev, &wd_data->dev);if (err) {pr_err ("watchdog%d unable to add device %d:%d\n" , wdd->id,MAJOR (watchdog_devt), wdd->id);if (wdd->id ==0 ) {misc_deregister (&watchdog_miscdev); old_wd_data =NULL ; -kref_put (&wd_data->kref, watchdog_core_data_release); +put_device (&wd_data->dev); }return err; } + wd_data->cdev.owner = wdd->ops->owner; +/* Record time of most recent heartbeat as 'just before now'. */ wd_data->last_hw_keepalive = jiffies -1 ;
@@ -968,7 +981,7 @@ static int watchdog_cdev_register(struct*/ if (watchdog_hw_running (wdd)) {__module_get (wdd->ops->owner); -kref_get (&wd_data->kref); +get_device (&wd_data->dev);if (handle_boot_enabled)queue_delayed_work (watchdog_wq, &wd_data->work,0 );else
@@ -991,7 +1004,7 @@ static void watchdog_cdev_unregister(str {struct watchdog_core_data *wd_data = wdd->wd_data; -cdev_del (&wd_data->cdev); +cdev_device_del (&wd_data->cdev, &wd_data->dev);if (wdd->id ==0 ) {misc_deregister (&watchdog_miscdev); old_wd_data =NULL ;
@@ -1009,15 +1022,9 @@ static void watchdog_cdev_unregister(strcancel_delayed_work_sync (&wd_data->work); -kref_put (&wd_data->kref, watchdog_core_data_release); +put_device (&wd_data->dev); } -static struct class watchdog_class = { - .name ="watchdog" , - .owner =THIS_MODULE , - .dev_groups = wdt_groups, -}; -/* * watchdog_dev_register: register a watchdog device * @wdd: watchdog device
@@ -1029,27 +1036,14 @@ static struct class watchdog_class = {int watchdog_dev_register (struct watchdog_device *wdd) { -struct device *dev; -dev_t devno;int ret; - devno =MKDEV (MAJOR (watchdog_devt), wdd->id); - - ret =watchdog_cdev_register (wdd, devno); + ret =watchdog_cdev_register (wdd);if (ret)return ret; - dev =device_create_with_groups (&watchdog_class, wdd->parent, - devno, wdd, wdd->groups, -"watchdog%d" , wdd->id); -if (IS_ERR (dev)) { -watchdog_cdev_unregister (wdd); -return PTR_ERR (dev); - } - ret =watchdog_register_pretimeout (wdd);if (ret) { -device_destroy (&watchdog_class, devno);watchdog_cdev_unregister (wdd); }
@@ -1067,7 +1061,6 @@ int watchdog_dev_register(struct watchdovoid watchdog_dev_unregister (struct watchdog_device *wdd) {watchdog_unregister_pretimeout (wdd); -device_destroy (&watchdog_class, wdd->wd_data->cdev.dev);watchdog_cdev_unregister (wdd); }
Greg Kroah-Hartman
maintainerPATCH 3/59 i2c: dev: Fix the race between the release of i2c_dev and cdev
In reply to Greg Kroah-HartmanFrom: Kevin Hao <[email protected]>
commit 1413ef638abae4ab5621901cf4d8ef08a4a48ba6 upstream.
The struct cdev is embedded in the struct i2c_dev. In the current code,
we would free the i2c_dev struct directly in put_i2c_dev(), but the
cdev is manged by a kobject, and the release of it is not predictable.
So it is very possible that the i2c_dev is freed before the cdev is
entirely released. We can easily get the following call trace with CONFIG_DEBUG_KOBJECT_RELEASE and CONFIG_DEBUG_OBJECTS_TIMERS enabled.
ODEBUG: free active (active state 0) object type: timer_list hint: delayed_work_timer_fn+0x0/0x38
WARNING: CPU: 19 PID: 1 at lib/debugobjects.c:325 debug_print_object+0xb0/0xf0 Modules linked in: CPU: 19 PID: 1 Comm: swapper/0 Tainted: G W 5.2.20-yocto-standard+ #120 Hardware name: Marvell OcteonTX CN96XX board (DT) pstate: 80c00089 (Nzcv daIf +PAN +UAO) pc : debug_print_object+0xb0/0xf0 lr : debug_print_object+0xb0/0xf0 sp : ffff00001292f7d0 x29: ffff00001292f7d0 x28: ffff800b82151788 x27: 0000000000000001 x26: ffff800b892c0000 x25: ffff0000124a2558 x24: 0000000000000000 x23: ffff00001107a1d8 x22: ffff0000116b5088 x21: ffff800bdc6afca8 x20: ffff000012471ae8 x19: ffff00001168f2c8 x18: 0000000000000010 x17: 00000000fd6f304b x16: 00000000ee79de43 x15: ffff800bc0e80568 x14: 79616c6564203a74 x13: 6e6968207473696c x12: 5f72656d6974203a x11: ffff0000113f0018 x10: 0000000000000000 x9 : 000000000000001f x8 : 0000000000000000 x7 : ffff0000101294cc x6 : 0000000000000000 x5 : 0000000000000000 x4 : 0000000000000001 x3 : 00000000ffffffff x2 : 0000000000000000 x1 : 387fc15c8ec0f200 x0 : 0000000000000000 Call trace: debug_print_object+0xb0/0xf0 __debug_check_no_obj_freed+0x19c/0x228 debug_check_no_obj_freed+0x1c/0x28 kfree+0x250/0x440 put_i2c_dev+0x68/0x78 i2cdev_detach_adapter+0x60/0xc8 i2cdev_notifier_call+0x3c/0x70 notifier_call_chain+0x8c/0xe8 blocking_notifier_call_chain+0x64/0x88 device_del+0x74/0x380 device_unregister+0x54/0x78 i2c_del_adapter+0x278/0x2d0 unittest_i2c_bus_remove+0x3c/0x80 platform_drv_remove+0x30/0x50 device_release_driver_internal+0xf4/0x1c0 driver_detach+0x58/0xa0 bus_remove_driver+0x84/0xd8 driver_unregister+0x34/0x60 platform_driver_unregister+0x20/0x30 of_unittest_overlay+0x8d4/0xbe0 of_unittest+0xae8/0xb3c do_one_initcall+0xac/0x450 do_initcall_level+0x208/0x224 kernel_init_freeable+0x2d8/0x36c kernel_init+0x18/0x108 ret_from_fork+0x10/0x1c irq event stamp: 3934661 hardirqs last enabled at (3934661): [<ffff00001009fa04>] debug_exception_exit+0x4c/0x58 hardirqs last disabled at (3934660): [<ffff00001009fb14>] debug_exception_enter+0xa4/0xe0 softirqs last enabled at (3934654): [<ffff000010081d94>] __do_softirq+0x46c/0x628 softirqs last disabled at (3934649): [<ffff0000100b4a1c>] irq_exit+0x104/0x118
This is a common issue when using cdev embedded in a struct. Fortunately, we already have a mechanism to solve this kind of issue. Please see commit 233ed09d7fda ("chardev: add helper function to register char devs with a struct device") for more detail.
In this patch, we choose to embed the struct device into the i2c_dev, and use the API provided by the commit 233ed09d7fda to make sure that the release of i2c_dev and cdev are in sequence.
--- drivers/i2c/i2c-dev.c | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-)
drivers/i2c/i2c-dev.c +26 -22
@@ -47,7 +47,7 @@struct i2c_dev {struct list_head list;struct i2c_adapter *adap; -struct device *dev; +struct device dev;struct cdev cdev; };
@@ -91,12 +91,14 @@ static struct i2c_dev *get_free_i2c_dev(return i2c_dev; } -static void put_i2c_dev (struct i2c_dev *i2c_dev) +static void put_i2c_dev (struct i2c_dev *i2c_dev,bool del_cdev) {spin_lock (&i2c_dev_list_lock);list_del (&i2c_dev->list);spin_unlock (&i2c_dev_list_lock); -kfree (i2c_dev); +if (del_cdev) +cdev_device_del (&i2c_dev->cdev, &i2c_dev->dev); +put_device (&i2c_dev->dev); } static ssize_t name_show(struct device *dev,
@@ -542,6 +544,14 @@ static const struct file_operations i2cdstatic struct class *i2c_dev_class; +static void i2cdev_dev_release (struct device *dev) +{ +struct i2c_dev *i2c_dev; + + i2c_dev = container_of(dev, struct i2c_dev, dev); +kfree (i2c_dev); +} +static int i2cdev_attach_adapter (struct device *dev,void *dummy) {struct i2c_adapter *adap;
@@ -558,27 +568,23 @@ static int i2cdev_attach_adapter(structcdev_init (&i2c_dev->cdev, &i2cdev_fops); i2c_dev->cdev.owner =THIS_MODULE ; - res =cdev_add (&i2c_dev->cdev,MKDEV (I2C_MAJOR , adap->nr),1 ); -if (res) - goto error_cdev; - -/* register this i2c device with the driver core */ - i2c_dev->dev =device_create (i2c_dev_class, &adap->dev, -MKDEV (I2C_MAJOR , adap->nr),NULL , -"i2c-%d" , adap->nr); -if (IS_ERR (i2c_dev->dev)) { - res =PTR_ERR (i2c_dev->dev); - goto error; + +device_initialize (&i2c_dev->dev); + i2c_dev->dev.devt =MKDEV (I2C_MAJOR , adap->nr); + i2c_dev->dev.class = i2c_dev_class; + i2c_dev->dev.parent = &adap->dev; + i2c_dev->dev.release = i2cdev_dev_release; +dev_set_name (&i2c_dev->dev,"i2c-%d" , adap->nr); + + res =cdev_device_add (&i2c_dev->cdev, &i2c_dev->dev); +if (res) { +put_i2c_dev (i2c_dev, false); +return res; }pr_debug ("i2c-dev: adapter [%s] registered as minor %d\n" , adap->name, adap->nr);return 0 ; -error: -cdev_del (&i2c_dev->cdev); -error_cdev: -put_i2c_dev (i2c_dev); -return res; }static int i2cdev_detach_adapter (struct device *dev,void *dummy)
@@ -594,9 +600,7 @@ static int i2cdev_detach_adapter(structif (!i2c_dev)/* attach_adapter must have failed */ return 0 ; -cdev_del (&i2c_dev->cdev); -put_i2c_dev (i2c_dev); -device_destroy (i2c_dev_class,MKDEV (I2C_MAJOR , adap->nr)); +put_i2c_dev (i2c_dev, true);pr_debug ("i2c-dev: adapter [%s] unregistered\n" , adap->name);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 4/59 padata: ensure the reorder timer callback runs on the correct CPU
In reply to Greg Kroah-HartmanFrom: Mathias Krause <[email protected]>
commit cf5868c8a22dc2854b96e9569064bb92365549ca upstream.
The reorder timer function runs on the CPU where the timer interrupt was handled which is not necessarily one of the CPUs of the 'pcpu' CPU mask set.
Ensure the padata_reorder() callback runs on the correct CPU, which is one in the 'pcpu' CPU mask set and, preferrably, the next expected one. Do so by comparing the current CPU with the expected target CPU. If they match, call padata_reorder() right away. If they differ, schedule a work item on the target CPU that does the padata_reorder() call for us.
--- include/linux/padata.h | 2 ++ kernel/padata.c | 43 ++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 1 deletion(-)
include/linux/padata.h +2 -0
@@ -85,6 +85,7 @@ struct padata_serial_queue {* @swork: work struct for serialization. * @pd: Backpointer to the internal control structure. * @work: work struct for parallelization. +* @reorder_work: work struct for reordering. * @num_obj: Number of objects that are processed by this cpu. * @cpu_index: Index of the cpu. */
@@ -93,6 +94,7 @@ struct padata_parallel_queue {struct padata_list reorder;struct parallel_data *pd;struct work_struct work; +struct work_struct reorder_work;atomic_t num_obj;int cpu_index; };
kernel/padata.c +42 -1
59 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 5/59 padata: ensure padata_do_serial() runs on the correct CPU
In reply to Greg Kroah-HartmanFrom: Mathias Krause <[email protected]>
commit 350ef88e7e922354f82a931897ad4a4ce6c686ff upstream.
If the algorithm we're parallelizing is asynchronous we might change CPUs between padata_do_parallel() and padata_do_serial(). However, we don't expect this to happen as we need to enqueue the padata object into the per-cpu reorder queue we took it from, i.e. the same-cpu's parallel queue.
Ensure we're not switching CPUs for a given padata object by tracking the CPU within the padata object. If the serial callback gets called on the wrong CPU, defer invoking padata_reorder() via a kernel worker on the CPU we're expected to run on.
--- include/linux/padata.h | 2 ++ kernel/padata.c | 20 +++++++++++++++++++- 2 files changed, 21 insertions(+), 1 deletion(-)
include/linux/padata.h +2 -0
@@ -37,6 +37,7 @@* @list: List entry, to attach to the padata lists. * @pd: Pointer to the internal control structure. * @cb_cpu: Callback cpu for serializatioon. +* @cpu: Cpu for parallelization. * @seq_nr: Sequence number of the parallelized data object. * @info: Used to pass information from the parallel to the serial function. * @parallel: Parallel execution function.
@@ -46,6 +47,7 @@ struct padata_priv {struct list_head list;struct parallel_data *pd;int cb_cpu; +int cpu;int info;void (*parallel)(struct padata_priv *padata);void (*serial)(struct padata_priv *padata);
kernel/padata.c +19 -1
@@ -133,6 +133,7 @@ int padata_do_parallel(struct padata_ins padata->cb_cpu = cb_cpu; target_cpu =padata_cpu_hash (pd); + padata->cpu = target_cpu; queue =per_cpu_ptr (pd->pqueue, target_cpu);spin_lock (&queue->parallel.lock);
@@ -376,10 +377,21 @@ void padata_do_serial(struct padata_privint cpu;struct padata_parallel_queue *pqueue;struct parallel_data *pd; +int reorder_via_wq =0 ; pd = padata->pd; cpu =get_cpu (); + +/* We need to run on the same CPU padata_do_parallel(.., padata, ..) +* was called on -- or, at least, enqueue the padata object into the +* correct per-cpu queue. +*/ +if (cpu != padata->cpu) { + reorder_via_wq =1 ; + cpu = padata->cpu; + } + pqueue =per_cpu_ptr (pd->pqueue, cpu);spin_lock (&pqueue->reorder.lock);
@@ -396,7 +408,13 @@ void padata_do_serial(struct padata_privput_cpu (); -padata_reorder (pd); +/* If we're running on the wrong CPU, call padata_reorder() via a +* kernel worker. +*/ +if (reorder_via_wq) +queue_work_on (cpu, pd->pinst->wq, &pqueue->reorder_work); +else +padata_reorder (pd); }EXPORT_SYMBOL (padata_do_serial);
Greg Kroah-Hartman
maintainerPATCH 6/59 ima: Set file->f_mode instead of file->f_flags in ima_calc_file_hash()
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
[ Upstream commit 0014cc04e8ec077dc482f00c87dfd949cfe2b98f ]
Commit a408e4a86b36 ("ima: open a new file instance if no read permissions") tries to create a new file descriptor to calculate a file digest if the file has not been opened with O_RDONLY flag. However, if a new file descriptor cannot be obtained, it sets the FMODE_READ flag to file->f_flags instead of file->f_mode.
This patch fixes this issue by replacing f_flags with f_mode as it was before that commit.
--- security/integrity/ima/ima_crypto.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
security/integrity/ima/ima_crypto.c +6 -6
@@ -432,7 +432,7 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash)loff_t i_size;int rc;struct file *f = file; -bool new_file_instance = false, modified_flags = false; +bool new_file_instance = false, modified_mode = false;/* * For consistency, fail file's opened with the O_DIRECT flag on
@@ -452,13 +452,13 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) f =dentry_open (&file->f_path, flags, file->f_cred);if (IS_ERR (f)) {/* -* Cannot open the file again, lets modify f_flags +* Cannot open the file again, lets modify f_mode * of original and continue */ pr_info_ratelimited ("Unable to reopen file for reading.\n" ); f = file; - f->f_flags |=FMODE_READ ; - modified_flags = true; + f->f_mode |=FMODE_READ ; + modified_mode = true; }else { new_file_instance = true; }
@@ -476,8 +476,8 @@ int ima_calc_file_hash(struct file *file, struct ima_digest_data *hash) out:if (new_file_instance)fput (f); -else if (modified_flags) - f->f_flags &= ~FMODE_READ ; +else if (modified_mode) + f->f_mode &= ~FMODE_READ ;return rc; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 7/59 evm: Check also if *tfm is an error pointer in init_desc()
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
[ Upstream commit 53de3b080d5eae31d0de219617155dcc34e7d698 ]
This patch avoids a kernel panic due to accessing an error pointer set by crypto_alloc_shash(). It occurs especially when there are many files that require an unsupported algorithm, as it would increase the likelihood of the following race condition:
Task A: *tfm = crypto_alloc_shash() <= error pointer Task B: if (*tfm == NULL) <= *tfm is not NULL, use it Task B: rc = crypto_shash_init(desc) <= panic Task A: *tfm = NULL
This patch uses the IS_ERR_OR_NULL macro to determine whether or not a new crypto context must be created.
--- security/integrity/evm/evm_crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/integrity/evm/evm_crypto.c +1 -1
@@ -90,7 +90,7 @@ static struct shash_desc *init_desc(char type) algo = evm_hash; } -if (*tfm ==NULL ) { +if (IS_ERR_OR_NULL (*tfm)) {mutex_lock (&mutex);if (*tfm) goto out;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 8/59 ima: Fix return value of ima_write_policy()
In reply to Greg Kroah-HartmanFrom: Roberto Sassu <[email protected]>
[ Upstream commit 2e3a34e9f409ebe83d1af7cd2f49fca7af97dfac ]
This patch fixes the return value of ima_write_policy() when a new policy is directly passed to IMA and the current policy requires appraisal of the file containing the policy. Currently, if appraisal is not in ENFORCE mode, ima_write_policy() returns 0 and leads user space applications to an endless loop. Fix this issue by denying the operation regardless of the appraisal mode.
--- security/integrity/ima/ima_fs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
security/integrity/ima/ima_fs.c +1 -2
@@ -340,8 +340,7 @@ static ssize_t ima_write_policy(struct file *file, const char __user *buf,integrity_audit_msg (AUDIT_INTEGRITY_STATUS ,NULL ,NULL ,"policy_update" ,"signed policy required" ,1 ,0 ); -if (ima_appraise &IMA_APPRAISE_ENFORCE ) - result = -EACCES ; + result = -EACCES ; }else { result =ima_parse_add_rule (data); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 9/59 fix multiplication overflow in copy_fdtable()
In reply to Greg Kroah-HartmanFrom: Al Viro <[email protected]>
[ Upstream commit 4e89b7210403fa4a8acafe7c602b6212b7af6c3b ]
cpy and set really should be size_t; we won't get an overflow on that, since sysctl_nr_open can't be set above ~(size_t)0 / sizeof(void *), so nr that would've managed to overflow size_t on that multiplication won't get anywhere near copy_fdtable() - we'll fail with EMFILE before that.
--- fs/file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/file.c +1 -1
@@ -75,7 +75,7 @@ static void copy_fd_bitmaps(struct fdtable *nfdt, struct fdtable *ofdt,*/ static void copy_fdtable (struct fdtable *nfdt,struct fdtable *ofdt) { -unsigned int cpy, set; +size_t cpy, set;BUG_ON (nfdt->max_fds < ofdt->max_fds);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 10/59 iommu/amd: Fix over-read of ACPI UID from IVRS table
In reply to Greg Kroah-HartmanFrom: Alexander Monakov <[email protected]>
[ Upstream commit e461b8c991b9202b007ea2059d953e264240b0c9 ]
IVRS parsing code always tries to read 255 bytes from memory when retrieving ACPI device path, and makes an assumption that firmware provides a zero-terminated string. Both of those are bugs: the entry is likely to be shorter than 255 bytes, and zero-termination is not guaranteed.
With Acer SF314-42 firmware these issues manifest visibly in dmesg:
AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR0\xf0\xa5, rdevid:160
AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR1\xf0\xa5, rdevid:160
AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR2\xf0\xa5, rdevid:160
AMD-Vi: ivrs, add hid:AMDI0020, uid:\_SB.FUR3>\x83e\x8d\x9a\xd1...
The first three lines show how the code over-reads adjacent table entries into the UID, and in the last line it even reads garbage data beyond the end of the IVRS table itself.
Since each entry has the length of the UID (uidl member of ivhd_entry struct), use that for memcpy, and manually add a zero terminator.
Avoid zero-filling hid and uid arrays up front, and instead ensure the uid array is always zero-terminated. No change needed for the hid array, as it was already properly zero-terminated.
--- drivers/iommu/amd_iommu_init.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/iommu/amd_iommu_init.c +5 -4
@@ -1317,8 +1317,8 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu, }case IVHD_DEV_ACPI_HID : {u16 devid; -u8 hid[ACPIHID_HID_LEN ] = {0 }; -u8 uid[ACPIHID_UID_LEN ] = {0 }; +u8 hid[ACPIHID_HID_LEN ]; +u8 uid[ACPIHID_UID_LEN ];int ret;if (h->type !=0x40 ) {
@@ -1335,6 +1335,7 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,break ; } + uid[0 ] ='\0' ;switch (e->uidf) {case UID_NOT_PRESENT :
@@ -1349,8 +1350,8 @@ static int __init init_iommu_from_acpi(struct amd_iommu *iommu,break ;case UID_IS_CHARACTER : -memcpy (uid, (u8 *)(&e->uid),ACPIHID_UID_LEN -1 ); - uid[ACPIHID_UID_LEN -1 ] ='\0' ; +memcpy (uid, &e->uid, e->uidl); + uid[e->uidl] ='\0' ;break ;default :
Signature · 8 lines
2.25.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Greg Kroah-Hartman
maintainerPATCH 11/59 i2c: mux: demux-pinctrl: Fix an error handling path in i2c_demux_pinctrl_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit e9d1a0a41d4486955e96552293c1fcf1fce61602 ]
A call to 'i2c_demux_deactivate_master()' is missing in the error handling path, as already done in the remove function.
--- drivers/i2c/muxes/i2c-demux-pinctrl.c | 1 + 1 file changed, 1 insertion(+)
drivers/i2c/muxes/i2c-demux-pinctrl.c +1 -0
@@ -270,6 +270,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) err_rollback_available:device_remove_file (&pdev->dev, &dev_attr_available_masters); err_rollback: +i2c_demux_deactivate_master (priv);for (j =0 ; j < i; j++) {of_node_put (priv->chan[j].parent_np);of_changeset_destroy (&priv->chan[j].chgset);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 12/59 ubi: Fix seq_file usage in detailed_erase_block_info debugfs file
In reply to Greg Kroah-HartmanFrom: Richard Weinberger <[email protected]>
[ Upstream commit 0e7572cffe442290c347e779bf8bd4306bb0aa7c ]
3bfa7e141b0b ("fs/seq_file.c: seq_read(): add info message about buggy .next functions") showed that we don't use seq_file correctly.
So make sure that our ->next function always updates the position.
--- drivers/mtd/ubi/debug.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
drivers/mtd/ubi/debug.c +2 -10
@@ -405,9 +405,6 @@ static void *eraseblk_count_seq_start(struct seq_file *s, loff_t *pos) {struct ubi_device *ubi = s->private; -if (*pos ==0 ) -return SEQ_START_TOKEN ; -if (*pos < ubi->peb_count)return pos;
@@ -421,8 +418,6 @@ static void *eraseblk_count_seq_next(struct seq_file *s, void *v, loff_t *pos) {struct ubi_device *ubi = s->private; -if (v ==SEQ_START_TOKEN ) -return pos; (*pos)++;if (*pos < ubi->peb_count)
@@ -444,11 +439,8 @@ static int eraseblk_count_seq_show(struct seq_file *s, void *iter)int err;/* If this is the start, print a header */ -if (iter ==SEQ_START_TOKEN ) { -seq_puts (s, -"physical_block_number\terase_count\tblock_status\tread_status\n" ); -return 0 ; - } +if (*block_number ==0 ) +seq_puts (s,"physical_block_number\terase_count\n" ); err =ubi_io_is_bad (ubi, *block_number);if (err)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 13/59 gcc-common.h: Update for GCC 10
In reply to Greg Kroah-HartmanFrom: Frédéric Pierret (fepitre) <[email protected]>
[ Upstream commit c7527373fe28f97d8a196ab562db5589be0d34b9 ]
Remove "params.h" include, which has been dropped in GCC 10.
Remove is_a_helper() macro, which is now defined in gimple.h, as seen when running './scripts/gcc-plugin.sh g++ g++ gcc':
In file included from <stdin>:1:./gcc-plugins/gcc-common.h:852:13: error: redefinition of ‘static bool is_a_helper<T>::test(U*) [with U = const gimple; T = const ggoto*]’
852 | inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from ./gcc-plugins/gcc-common.h:125,
from <stdin>:1:
/usr/lib/gcc/x86_64-redhat-linux/10/plugin/include/gimple.h:1037:1: note: ‘static bool is_a_helper<T>::test(U*) [with U = const gimple; T = const ggoto*]’ previously declared here
1037 | is_a_helper <const ggoto *>::test (const gimple *gs)
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~Add -Wno-format-diag to scripts/gcc-plugins/Makefile to avoid meaningless warnings from error() formats used by plugins:
scripts/gcc-plugins/structleak_plugin.c: In function ‘int plugin_init(plugin_name_args*, plugin_gcc_version*)’:scripts/gcc-plugins/structleak_plugin.c:253:12: warning: unquoted sequence of 2 consecutive punctuation characters ‘'-’ in format [-Wformat-diag]
253 | error(G_("unknown option '-fplugin-arg-%s-%s'"), plugin_name, argv[i].key);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~--- scripts/gcc-plugins/Makefile | 1 + scripts/gcc-plugins/gcc-common.h | 4 ++++ 2 files changed, 5 insertions(+)
scripts/gcc-plugins/Makefile +1 -0
@@ -10,6 +10,7 @@ else HOST_EXTRACXXFLAGS += -I$(GCC_PLUGINS_DIR)/include -I$(src) -std=gnu++98 -fno-rtti HOST_EXTRACXXFLAGS += -fno-exceptions -fasynchronous-unwind-tables -ggdb HOST_EXTRACXXFLAGS += -Wno-narrowing -Wno-unused-variable + HOST_EXTRACXXFLAGS += -Wno-format-diag export HOST_EXTRACXXFLAGS endif
scripts/gcc-plugins/gcc-common.h +4 -0
@@ -35,7 +35,9 @@#include "ggc.h" #include "timevar.h" +#if BUILDING_GCC_VERSION <10000 #include "params.h" +#endif #if BUILDING_GCC_VERSION <=4009 #include "pointer-set.h"
@@ -841,6 +843,7 @@ static inline gimple gimple_build_assign_with_ops(enum tree_code subcode, tree l return gimple_build_assign(lhs, subcode, op1, op2 PASS_MEM_STAT); } +#if BUILDING_GCC_VERSION <10000 template <> template <> inline bool is_a_helper<const ggoto *>::test(const_gimple gs)
@@ -854,6 +857,7 @@ inline bool is_a_helper<const greturn *>::test(const_gimple gs) {return gs->code ==GIMPLE_RETURN ; } +#endif static inline gasm *as_a_gasm (gimple stmt) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 14/59 HID: multitouch: add eGalaxTouch P80H84 support
In reply to Greg Kroah-HartmanFrom: Sebastian Reichel <[email protected]>
[ Upstream commit f9e82295eec141a0569649d400d249333d74aa91 ]
Add support for P80H84 touchscreen from eGalaxy:
idVendor 0x0eef D-WAV Scientific Co., Ltd
idProduct 0xc002
iManufacturer 1 eGalax Inc.
iProduct 2 eGalaxTouch P80H84 2019 vDIVA_1204_T01 k4.02.146
--- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-multitouch.c | 3 +++ 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +1 -0
@@ -369,6 +369,7 @@#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7349 0x7349#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_73F7 0x73f7#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001 0xa001 +#define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_C002 0xc002#define USB_VENDOR_ID_ELAN 0x04f3
drivers/hid/hid-multitouch.c +3 -0
@@ -1550,6 +1550,9 @@ static const struct hid_device_id mt_devices[] = { { .driver_data = MT_CLS_EGALAX_SERIAL,MT_USB_DEVICE (USB_VENDOR_ID_DWAV , USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_A001) }, + { .driver_data = MT_CLS_EGALAX, +MT_USB_DEVICE (USB_VENDOR_ID_DWAV , + USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_C002) }, /* Elitegroup panel */ { .driver_data = MT_CLS_SERIAL,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 15/59 scsi: qla2xxx: Fix hang when issuing nvme disconnect-all in NPIV
In reply to Greg Kroah-HartmanFrom: Arun Easi <[email protected]>
[ Upstream commit 45a76264c26fd8cfd0c9746196892d9b7e2657ee ]
In NPIV environment, a NPIV host may use a queue pair created by base host or other NPIVs, so the check for a queue pair created by this NPIV is not correct, and can cause an abort to fail, which in turn means the NVME command not returned. This leads to hang in nvme_fc layer in nvme_fc_delete_association() which waits for all I/Os to be returned, which is seen as hang in the application.
--- drivers/scsi/qla2xxx/qla_mbx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/qla2xxx/qla_mbx.c +1 -1
@@ -2998,7 +2998,7 @@ qla24xx_abort_command(srb_t *sp)ql_dbg (ql_dbg_mbx + ql_dbg_verbose, vha,0x108c ,"Entered %s.\n" , __func__); -if (vha->flags.qpairs_available && sp->qpair) +if (sp->qpair) req = sp->qpair->req;if (ql2xasynctmfenable)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 16/59 configfs: fix config_item refcnt leak in configfs_rmdir()
In reply to Greg Kroah-HartmanFrom: Xiyu Yang <[email protected]>
[ Upstream commit 8aebfffacfa379ba400da573a5bf9e49634e38cb ]
configfs_rmdir() invokes configfs_get_config_item(), which returns a reference of the specified config_item object to "parent_item" with increased refcnt.
When configfs_rmdir() returns, local variable "parent_item" becomes invalid, so the refcount should be decreased to keep refcount balanced.
The reference counting issue happens in one exception handling path of configfs_rmdir(). When down_write_killable() fails, the function forgets to decrease the refcnt increased by configfs_get_config_item(), causing a refcnt leak.
Fix this issue by calling config_item_put() when down_write_killable() fails.
--- fs/configfs/dir.c | 1 + 1 file changed, 1 insertion(+)
fs/configfs/dir.c +1 -0
@@ -1537,6 +1537,7 @@ static int configfs_rmdir(struct inode *dir, struct dentry *dentry)spin_lock (&configfs_dirent_lock);configfs_detach_rollback (dentry);spin_unlock (&configfs_dirent_lock); +config_item_put (parent_item);return -EINTR ; } frag->frag_dead = true;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 17/59 vhost/vsock: fix packet delivery order to monitoring devices
In reply to Greg Kroah-HartmanFrom: Stefano Garzarella <[email protected]>
[ Upstream commit 107bc0766b9feb5113074c753735a3f115c2141f ]
We want to deliver packets to monitoring devices before it is put in the virtqueue, to avoid that replies can appear in the packet capture before the transmitted packet.
--- drivers/vhost/vsock.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/vhost/vsock.c +5 -5
@@ -182,14 +182,14 @@ vhost_transport_do_send_pkt(struct vhost_vsock *vsock,break ; } -vhost_add_used (vq, head,sizeof (pkt->hdr) + payload_len); - added = true; - -/* Deliver to monitoring devices all correctly transmitted -* packets. +/* Deliver to monitoring devices all packets that we +* will transmit. */ virtio_transport_deliver_tap_pkt (pkt); +vhost_add_used (vq, head,sizeof (pkt->hdr) + payload_len); + added = true; + pkt->off += payload_len; total_len += payload_len;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 18/59 component: Silence bind error on -EPROBE_DEFER
In reply to Greg Kroah-HartmanFrom: James Hilliard <[email protected]>
[ Upstream commit 7706b0a76a9697021e2bf395f3f065c18f51043d ]
If a component fails to bind due to -EPROBE_DEFER we should not log an error as this is not a real failure.
Fixes messages like:
vc4-drm soc:gpu: failed to bind 3f902000.hdmi (ops vc4_hdmi_ops): -517 vc4-drm soc:gpu: master bind failed: -517
--- drivers/base/component.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/base/component.c +5 -3
@@ -162,7 +162,8 @@ static int try_to_bring_up_master(struct master *master, ret = master->ops->bind (master->dev);if (ret <0 ) {devres_release_group (master->dev,NULL ); -dev_info (master->dev,"master bind failed: %d\n" , ret); +if (ret != -EPROBE_DEFER ) +dev_info (master->dev,"master bind failed: %d\n" , ret);return ret; }
@@ -431,8 +432,9 @@ static int component_bind(struct component *component, struct master *master,devres_release_group (component->dev,NULL );devres_release_group (master->dev,NULL ); -dev_err (master->dev,"failed to bind %s (ops %ps): %d\n" , -dev_name (component->dev), component->ops, ret); +if (ret != -EPROBE_DEFER ) +dev_err (master->dev,"failed to bind %s (ops %ps): %d\n" , +dev_name (component->dev), component->ops, ret); }return ret;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 19/59 scsi: ibmvscsi: Fix WARN_ON during event pool release
In reply to Greg Kroah-HartmanFrom: Tyrel Datwyler <[email protected]>
[ Upstream commit b36522150e5b85045f868768d46fbaaa034174b2 ]
While removing an ibmvscsi client adapter a WARN_ON like the following is seen in the kernel log:
drmgr: drmgr: -r -c slot -s U9080.M9S.783AEC8-V11-C11 -w 5 -d 1
WARNING: CPU: 9 PID: 24062 at ../kernel/dma/mapping.c:311 dma_free_attrs+0x78/0x110 Supported: No, Unreleased kernel CPU: 9 PID: 24062 Comm: drmgr Kdump: loaded Tainted: G X 5.3.18-12-default NIP: c0000000001fa758 LR: c0000000001fa744 CTR: c0000000001fa6e0 REGS: c0000002173375d0 TRAP: 0700 Tainted: G X (5.3.18-12-default) MSR: 8000000000029033 <SF,EE,ME,IR,DR,RI,LE> CR: 28088282 XER: 20000000
CFAR: c0000000001fbf0c IRQMASK: 1
GPR00: c0000000001fa744 c000000217337860 c00000000161ab00 0000000000000000
GPR04: 0000000000000000 c000011e12250000 0000000018010000 0000000000000000
GPR08: 0000000000000000 0000000000000001 0000000000000001 c0080000190f4fa8
GPR12: c0000000001fa6e0 c000000007fc2a00 0000000000000000 0000000000000000
GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR24: 000000011420e310 0000000000000000 0000000000000000 0000000018010000
GPR28: c00000000159de50 c000011e12250000 0000000000006600 c000011e5c994848 NIP [c0000000001fa758] dma_free_attrs+0x78/0x110
LR [c0000000001fa744] dma_free_attrs+0x64/0x110
Call Trace:
[c000000217337860] [000000011420e310] 0x11420e310 (unreliable) [c0000002173378b0] [c0080000190f0280] release_event_pool+0xd8/0x120 [ibmvscsi] [c000000217337930] [c0080000190f3f74] ibmvscsi_remove+0x6c/0x160 [ibmvscsi] [c000000217337960] [c0000000000f3cac] vio_bus_remove+0x5c/0x100 [c0000002173379a0] [c00000000087a0a4] device_release_driver_internal+0x154/0x280 [c0000002173379e0] [c0000000008777cc] bus_remove_device+0x11c/0x220 [c000000217337a60] [c000000000870fc4] device_del+0x1c4/0x470 [c000000217337b10] [c0000000008712a0] device_unregister+0x30/0xa0 [c000000217337b80] [c0000000000f39ec] vio_unregister_device+0x2c/0x60 [c000000217337bb0] [c00800001a1d0964] dlpar_remove_slot+0x14c/0x250 [rpadlpar_io] [c000000217337c50] [c00800001a1d0bcc] remove_slot_store+0xa4/0x110 [rpadlpar_io] [c000000217337cd0] [c000000000c091a0] kobj_attr_store+0x30/0x50 [c000000217337cf0] [c00000000057c934] sysfs_kf_write+0x64/0x90 [c000000217337d10] [c00000000057be10] kernfs_fop_write+0x1b0/0x290 [c000000217337d60] [c000000000488c4c] __vfs_write+0x3c/0x70 [c000000217337d80] [c00000000048c648] vfs_write+0xd8/0x260 [c000000217337dd0] [c00000000048ca8c] ksys_write+0xdc/0x130 [c000000217337e20] [c00000000000b488] system_call+0x5c/0x70 Instruction dump:7c840074 f8010010 f821ffb1 20840040 eb830218 7c8407b4 48002019 60000000 2fa30000 409e003c 892d0988 792907e0 <0b090000> 2fbd0000 419e0028 2fbc0000
---[ end trace 5955b3c0cc079942 ]---
rpadlpar_io: slot U9080.M9S.783AEC8-V11-C11 removed
This is tripped as a result of irqs being disabled during the call to dma_free_coherent() by release_event_pool(). At this point in the code path we have quiesced the adapter and it is overly paranoid to be holding the host lock.
[mkp: fixed build warning reported by sfr]
--- drivers/scsi/ibmvscsi/ibmvscsi.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/scsi/ibmvscsi/ibmvscsi.c +0 -4
@@ -2299,16 +2299,12 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)static int ibmvscsi_remove (struct vio_dev *vdev) {struct ibmvscsi_host_data *hostdata =dev_get_drvdata (&vdev->dev); -unsigned long flags;srp_remove_host (hostdata->host);scsi_remove_host (hostdata->host);purge_requests (hostdata,DID_ERROR ); - -spin_lock_irqsave (hostdata->host->host_lock, flags);release_event_pool (&hostdata->pool, hostdata); -spin_unlock_irqrestore (hostdata->host->host_lock, flags);ibmvscsi_release_crq_queue (&hostdata->queue, hostdata, max_events);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 20/59 x86/apic: Move TSC deadline timer debug printk
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit c84cb3735fd53c91101ccdb191f2e3331a9262cb ]
Leon reported that the printk_once() in __setup_APIC_LVTT() triggers a lockdep splat due to a lock order violation between hrtimer_base::lock and console_sem, when the 'once' condition is reset via /sys/kernel/debug/clear_warn_once after boot.
The initial printk cannot trigger this because that happens during boot when the local APIC timer is set up on the boot CPU.
Prevent it by moving the printk to a place which is guaranteed to be only called once during boot.
Mark the deadline timer check related functions and data __init while at it.
--- arch/x86/kernel/apic/apic.c | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-)
arch/x86/kernel/apic/apic.c +14 -13
@@ -353,8 +353,6 @@ static void __setup_APIC_LVTT(unsigned int clocks, int oneshot, int irqen)* According to Intel, MFENCE can do the serialization here. */ asmvolatile ("mfence" : : :"memory" ); - -printk_once (KERN_DEBUG "TSC deadline timer enabled\n" );return ; }
@@ -553,7 +551,7 @@ static DEFINE_PER_CPU(struct clock_event_device, lapic_events);#define DEADLINE_MODEL_MATCH_REV (model, rev) \ { X86_VENDOR_INTEL, 6, model, X86_FEATURE_ANY, (unsigned long)rev } -static u32 hsx_deadline_rev (void ) +static __init u32 hsx_deadline_rev (void ) {switch (boot_cpu_data.x86_stepping) {case 0x02 :return 0x3a ;/* EP */
@@ -563,7 +561,7 @@ static u32 hsx_deadline_rev(void)return ~0U ; } -static u32 bdx_deadline_rev (void ) +static __init u32 bdx_deadline_rev (void ) {switch (boot_cpu_data.x86_stepping) {case 0x02 :return 0x00000011 ;
@@ -575,7 +573,7 @@ static u32 bdx_deadline_rev(void)return ~0U ; } -static u32 skx_deadline_rev (void ) +static __init u32 skx_deadline_rev (void ) {switch (boot_cpu_data.x86_stepping) {case 0x03 :return 0x01000136 ;
@@ -588,7 +586,7 @@ static u32 skx_deadline_rev(void)return ~0U ; } -static const struct x86_cpu_id deadline_match[] = { +static const struct x86_cpu_id deadline_match[]__initconst = {DEADLINE_MODEL_MATCH_FUNC (INTEL_FAM6_HASWELL_X , hsx_deadline_rev),DEADLINE_MODEL_MATCH_REV (INTEL_FAM6_BROADWELL_X ,0x0b000020 ),DEADLINE_MODEL_MATCH_FUNC (INTEL_FAM6_BROADWELL_XEON_D , bdx_deadline_rev),
@@ -610,18 +608,19 @@ static const struct x86_cpu_id deadline_match[] = { {}, }; -static void apic_check_deadline_errata (void ) +static __init bool apic_validate_deadline_timer (void ) {const struct x86_cpu_id *m;u32 rev; -if (!boot_cpu_has (X86_FEATURE_TSC_DEADLINE_TIMER ) || -boot_cpu_has (X86_FEATURE_HYPERVISOR )) -return ; +if (!boot_cpu_has (X86_FEATURE_TSC_DEADLINE_TIMER )) +return false; +if (boot_cpu_has (X86_FEATURE_HYPERVISOR )) +return true; m =x86_match_cpu (deadline_match);if (!m) -return ; +return true;/* * Function pointers will have the MSB set due to address layout,
@@ -633,11 +632,12 @@ static void apic_check_deadline_errata(void) rev = (u32 )m->driver_data;if (boot_cpu_data.microcode >= rev) -return ; +return true;setup_clear_cpu_cap (X86_FEATURE_TSC_DEADLINE_TIMER );pr_err (FW_BUG "TSC_DEADLINE disabled due to Errata; " "please update microcode to version: 0x%x (or later)\n" , rev); +return false; }/*
@@ -1914,7 +1914,8 @@ void __init init_apic_mappings(void) {unsigned int new_apicid; -apic_check_deadline_errata (); +if (apic_validate_deadline_timer ()) +pr_debug ("TSC deadline timer available\n" );if (x2apic_mode) { boot_cpu_physical_apicid =read_apic_id ();
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 21/59 gtp: set NLM_F_MULTI flag in gtp_genl_dump_pdp()
In reply to Greg Kroah-HartmanFrom: Yoshiyuki Kurauchi <[email protected]>
[ Upstream commit 846c68f7f1ac82c797a2f1db3344a2966c0fe2e1 ]
In drivers/net/gtp.c, gtp_genl_dump_pdp() should set NLM_F_MULTI flag since it returns multipart message.
This patch adds a new arg "flags" in gtp_genl_fill_info() so that flags can be set by the callers.
--- drivers/net/gtp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/gtp.c +5 -4
@@ -1177,11 +1177,11 @@ out_unlock:static struct genl_family gtp_genl_family;static int gtp_genl_fill_info (struct sk_buff *skb,u32 snd_portid,u32 snd_seq, -u32 type,struct pdp_ctx *pctx) +int flags,u32 type,struct pdp_ctx *pctx) {void *genlh; - genlh =genlmsg_put (skb, snd_portid, snd_seq, >p_genl_family,0 , + genlh =genlmsg_put (skb, snd_portid, snd_seq, >p_genl_family, flags, type);if (genlh ==NULL ) goto nlmsg_failure;
@@ -1235,8 +1235,8 @@ static int gtp_genl_get_pdp(struct sk_buff *skb, struct genl_info *info) goto err_unlock; } - err =gtp_genl_fill_info (skb2,NETLINK_CB (skb).portid, - info->snd_seq, info->nlhdr->nlmsg_type, pctx); + err =gtp_genl_fill_info (skb2,NETLINK_CB (skb).portid, info->snd_seq, +0 , info->nlhdr->nlmsg_type, pctx);if (err <0 ) goto err_unlock_free;
@@ -1279,6 +1279,7 @@ static int gtp_genl_dump_pdp(struct sk_buff *skb,gtp_genl_fill_info (skb,NETLINK_CB (cb->skb).portid, cb->nlh->nlmsg_seq, +NLM_F_MULTI , cb->nlh->nlmsg_type, pctx)) { cb->args[0] = i; cb->args[1 ] = j;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 22/59 ceph: fix double unlock in handle_cap_export()
In reply to Greg Kroah-HartmanFrom: Wu Bo <[email protected]>
[ Upstream commit 4d8e28ff3106b093d98bfd2eceb9b430c70a8758 ]
If the ceph_mdsc_open_export_target_session() return fails, it will do a "goto retry", but the session mutex has already been unlocked. Re-lock the mutex in that case to ensure that we don't unlock it twice.
--- fs/ceph/caps.c | 1 + 1 file changed, 1 insertion(+)
fs/ceph/caps.c +1 -0
@@ -3502,6 +3502,7 @@ retry:WARN_ON (1 ); tsession =NULL ; target =-1 ; +mutex_lock (&session->s_mutex); } goto retry;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 23/59 USB: core: Fix misleading driver bug report
In reply to Greg Kroah-HartmanFrom: Alan Stern <[email protected]>
[ Upstream commit ac854131d9844f79e2fdcef67a7707227538d78a ]
The syzbot fuzzer found a race between URB submission to endpoint 0 and device reset. Namely, during the reset we call usb_ep0_reinit() because the characteristics of ep0 may have changed (if the reset follows a firmware update, for example). While usb_ep0_reinit() is running there is a brief period during which the pointers stored in udev->ep_in[0] and udev->ep_out[0] are set to NULL, and if an URB is submitted to ep0 during that period, usb_urb_ep_type_check() will report it as a driver bug. In the absence of those pointers, the routine thinks that the endpoint doesn't exist. The log message looks like this:
------------[ cut here ]------------ usb 2-1: BOGUS urb xfer, pipe 2 != type 2 WARNING: CPU: 0 PID: 9241 at drivers/usb/core/urb.c:478 usb_submit_urb+0x1188/0x1460 drivers/usb/core/urb.c:478
Now, although submitting an URB while the device is being reset is a questionable thing to do, it shouldn't count as a driver bug as severe as submitting an URB for an endpoint that doesn't exist. Indeed, endpoint 0 always exists, even while the device is in its unconfigured state.
To prevent these misleading driver bug reports, this patch updates usb_disable_endpoint() to avoid clearing the ep_in[] and ep_out[] pointers when the endpoint being disabled is ep0. There's no danger of leaving a stale pointer in place, because the usb_host_endpoint structure being pointed to is stored permanently in udev->ep0; it doesn't get deallocated until the entire usb_device structure does.
--- drivers/usb/core/message.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/core/message.c +2 -2
@@ -1082,11 +1082,11 @@ void usb_disable_endpoint(struct usb_device *dev, unsigned int epaddr,if (usb_endpoint_out (epaddr)) { ep = dev->ep_out[epnum]; -if (reset_hardware) +if (reset_hardware && epnum !=0 ) dev->ep_out[epnum] =NULL ; }else { ep = dev->ep_in[epnum]; -if (reset_hardware) +if (reset_hardware && epnum !=0 ) dev->ep_in[epnum] =NULL ; }if (ep) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 24/59 platform/x86: asus-nb-wmi: Do not load on Asus T100TA and T200TA
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 3bd12da7f50b8bc191fcb3bab1f55c582234df59 ]
asus-nb-wmi does not add any extra functionality on these Asus Transformer books. They have detachable keyboards, so the hotkeys are send through a HID device (and handled by the hid-asus driver) and also the rfkill functionality is not used on these devices.
Besides not adding any extra functionality, initializing the WMI interface on these devices actually has a negative side-effect. For some reason the \_SB.ATKD.INIT() function which asus_wmi_platform_init() calls drives GPO2 (INT33FC:02) pin 8, which is connected to the front facing webcam LED, high and there is no (WMI or other) interface to drive this low again causing the LED to be permanently on, even during suspend.
This commit adds a blacklist of DMI system_ids on which not to load the asus-nb-wmi and adds these Transformer books to this list. This fixes the webcam LED being permanently on under Linux.
--- drivers/platform/x86/asus-nb-wmi.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/platform/x86/asus-nb-wmi.c +24 -0
@@ -517,9 +517,33 @@ static struct asus_wmi_driver asus_nb_wmi_driver = { .detect_quirks = asus_nb_wmi_quirks, }; +static const struct dmi_system_id asus_nb_wmi_blacklist[]__initconst = { + { +/* +* asus-nb-wm adds no functionality. The T100TA has a detachable +* USB kbd, so no hotkeys and it has no WMI rfkill; and loading +* asus-nb-wm causes the camera LED to turn and _stay_ on. +*/ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"T100TA" ), + }, + }, + { +/* The Asus T200TA has the same issue as the T100TA */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"ASUSTeK COMPUTER INC." ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"T200TA" ), + }, + }, + {}/* Terminating entry */ +};static int __init asus_nb_wmi_init (void ) { +if (dmi_check_system (asus_nb_wmi_blacklist)) +return -ENODEV ; +return asus_wmi_register_driver (&asus_nb_wmi_driver); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 25/59 ARM: futex: Address build warning
In reply to Greg Kroah-HartmanFrom: Thomas Gleixner <[email protected]>
[ Upstream commit 8101b5a1531f3390b3a69fa7934c70a8fd6566ad ]
Stephen reported the following build warning on a ARM multi_v7_defconfig build with GCC 9.2.1:
kernel/futex.c: In function 'do_futex':kernel/futex.c:1676:17: warning: 'oldval' may be used uninitialized in this function [-Wmaybe-uninitialized]
1676 | return oldval == cmparg;
| ~~~~~~~^~~~~~~~~
kernel/futex.c:1652:6: note: 'oldval' was declared here
1652 | int oldval, ret;
| ^~~~~~introduced by commit a08971e9488d ("futex: arch_futex_atomic_op_inuser() calling conventions change").
While that change should not make any difference it confuses GCC which fails to work out that oldval is not referenced when the return value is not zero.
GCC fails to properly analyze arch_futex_atomic_op_inuser(). It's not the early return, the issue is with the assembly macros. GCC fails to detect that those either set 'ret' to 0 and set oldval or set 'ret' to -EFAULT which makes oldval uninteresting. The store to the callsite supplied oldval pointer is conditional on ret == 0.
The straight forward way to solve this is to make the store unconditional.
Aside of addressing the build warning this makes sense anyway because it removes the conditional from the fastpath. In the error case the stored value is uninteresting and the extra store does not matter at all.
--- arch/arm/include/asm/futex.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
arch/arm/include/asm/futex.h +7 -2
@@ -163,8 +163,13 @@ arch_futex_atomic_op_inuser(int op, int oparg, int *oval, u32 __user *uaddr)preempt_enable ();#endif -if (!ret) - *oval = oldval; +/* +* Store unconditionally. If ret != 0 the extra store is the least +* of the worries but GCC cannot figure out that __futex_atomic_op() +* is either setting ret to -EFAULT or storing the old value in +* oldval which results in a uninitialized warning at the call site. +*/ + *oval = oldval;return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 26/59 padata: set cpu_index of unused CPUs to -1
In reply to Greg Kroah-HartmanFrom: Mathias Krause <[email protected]>
[ Upstream commit 1bd845bcb41d5b7f83745e0cb99273eb376f2ec5 ]
The parallel queue per-cpu data structure gets initialized only for CPUs in the 'pcpu' CPU mask set. This is not sufficient as the reorder timer may run on a different CPU and might wrongly decide it's the target CPU for the next reorder item as per-cpu memory gets memset(0) and we might be waiting for the first CPU in cpumask.pcpu, i.e. cpu_index 0.
Make the '__this_cpu_read(pd->pqueue->cpu_index) == next_queue->cpu_index' compare in padata_get_next() fail in this case by initializing the cpu_index member of all per-cpu parallel queues. Use -1 for unused ones.
--- kernel/padata.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
kernel/padata.c +7 -1
@@ -462,8 +462,14 @@ static void padata_init_pqueues(struct parallel_data *pd)struct padata_parallel_queue *pqueue; cpu_index =0 ; -for_each_cpu (cpu, pd->cpumask.pcpu) { +for_each_possible_cpu (cpu) { pqueue =per_cpu_ptr (pd->pqueue, cpu); + +if (!cpumask_test_cpu (cpu, pd->cpumask.pcpu)) { + pqueue->cpu_index =-1 ; +continue ; + } + pqueue->pd = pd; pqueue->cpu_index = cpu_index; cpu_index++;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 27/59 padata: Replace delayed timer with immediate workqueue in padata_reorder
In reply to Greg Kroah-HartmanFrom: Herbert Xu <[email protected]>
[ Upstream commit 6fc4dbcf0276279d488c5fbbfabe94734134f4fa ]
The function padata_reorder will use a timer when it cannot progress while completed jobs are outstanding (pd->reorder_objects > 0). This is suboptimal as if we do end up using the timer then it would have introduced a gratuitous delay of one second.
In fact we can easily distinguish between whether completed jobs are outstanding and whether we can make progress. All we have to do is look at the next pqueue list.
This patch does that by replacing pd->processed with pd->cpu so that the next pqueue is more accessible.
A work queue is used instead of the original try_again to avoid hogging the CPU.
Note that we don't bother removing the work queue in padata_flush_queues because the whole premise is broken. You cannot flush async crypto requests so it makes no sense to even try. A subsequent patch will fix it by replacing it with a ref counting scheme.
[dj: - adjust context
- corrected setup_timer -> timer_setup to delete hunk
- skip padata_flush_queues() hunk, function already removed in 4.14]
--- include/linux/padata.h | 13 ++---- kernel/padata.c | 95 ++++++++---------------------------------- 2 files changed, 22 insertions(+), 86 deletions(-)
include/linux/padata.h +4 -9
@@ -24,7 +24,6 @@#include <linux/workqueue.h> #include <linux/spinlock.h> #include <linux/list.h> -#include <linux/timer.h> #include <linux/notifier.h> #include <linux/kobject.h>
@@ -85,18 +84,14 @@ struct padata_serial_queue {* @serial: List to wait for serialization after reordering. * @pwork: work struct for parallelization. * @swork: work struct for serialization. -* @pd: Backpointer to the internal control structure. * @work: work struct for parallelization. -* @reorder_work: work struct for reordering. * @num_obj: Number of objects that are processed by this cpu. * @cpu_index: Index of the cpu. */ struct padata_parallel_queue {struct padata_list parallel;struct padata_list reorder; -struct parallel_data *pd;struct work_struct work; -struct work_struct reorder_work;atomic_t num_obj;int cpu_index; };
@@ -122,10 +117,10 @@ struct padata_cpumask {* @reorder_objects: Number of objects waiting in the reorder queues. * @refcnt: Number of objects holding a reference on this parallel_data. * @max_seq_nr: Maximal used sequence number. +* @cpu: Next CPU to be processed. * @cpumask: The cpumasks in use for parallel and serial workers. +* @reorder_work: work struct for reordering. * @lock: Reorder lock. -* @processed: Number of already processed objects. -* @timer: Reorder timer. */ struct parallel_data {struct padata_instance *pinst;
@@ -134,10 +129,10 @@ struct parallel_data {atomic_t reorder_objects;atomic_t refcnt;atomic_t seq_nr; +int cpu;struct padata_cpumask cpumask; +struct work_struct reorder_work;spinlock_t lock____cacheline_aligned ; -unsigned int processed; -struct timer_list timer; };/**
kernel/padata.c +18 -77
191 lines not on this page · raw message
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 28/59 padata: initialize pd->cpu with effective cpumask
In reply to Greg Kroah-HartmanFrom: Daniel Jordan <[email protected]>
[ Upstream commit ec9c7d19336ee98ecba8de80128aa405c45feebb ]
Exercising CPU hotplug on a 5.2 kernel with recent padata fixes from cryptodev-2.6.git in an 8-CPU kvm guest...
# modprobe tcrypt alg="pcrypt(rfc4106(gcm(aes)))" type=3
# echo 0 > /sys/devices/system/cpu/cpu1/online
# echo c > /sys/kernel/pcrypt/pencrypt/parallel_cpumask
# modprobe tcrypt mode=215...caused the following crash:
BUG: kernel NULL pointer dereference, address: 0000000000000000
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 0 P4D 0
Oops: 0000 [#1] SMP PTI
CPU: 2 PID: 134 Comm: kworker/2:2 Not tainted 5.2.0-padata-base+ #7
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-<snip>
Workqueue: pencrypt padata_parallel_worker
RIP: 0010:padata_reorder+0xcb/0x180
...
Call Trace:
padata_do_serial+0x57/0x60
pcrypt_aead_enc+0x3a/0x50 [pcrypt]
padata_parallel_worker+0x9b/0xe0
process_one_work+0x1b5/0x3f0
worker_thread+0x4a/0x3c0
...In padata_alloc_pd, pd->cpu is set using the user-supplied cpumask instead of the effective cpumask, and in this case cpumask_first picked an offline CPU.
The offline CPU's reorder->list.next is NULL in padata_reorder because the list wasn't initialized in padata_init_pqueues, which only operates on CPUs in the effective mask.
Fix by using the effective mask in padata_alloc_pd.
--- kernel/padata.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/padata.c +1 -1
@@ -450,7 +450,7 @@ static struct parallel_data *padata_alloc_pd(struct padata_instance *pinst,atomic_set (&pd->refcnt,1 ); pd->pinst = pinst;spin_lock_init (&pd->lock); - pd->cpu =cpumask_first (pcpumask); + pd->cpu =cpumask_first (pd->cpumask.pcpu);INIT_WORK (&pd->reorder_work, invoke_padata_reorder);return pd;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 29/59 padata: purge get_cpu and reorder_via_wq from padata_do_serial
In reply to Greg Kroah-HartmanFrom: Daniel Jordan <[email protected]>
[ Upstream commit 065cf577135a4977931c7a1e1edf442bfd9773dd ]
With the removal of the padata timer, padata_do_serial no longer needs special CPU handling, so remove it.
--- kernel/padata.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-)
kernel/padata.c +3 -20
@@ -323,24 +323,9 @@ static void padata_serial_worker(struct work_struct *serial_work)*/ void padata_do_serial (struct padata_priv *padata) { -int cpu; -struct padata_parallel_queue *pqueue; -struct parallel_data *pd; -int reorder_via_wq =0 ; - - pd = padata->pd; - - cpu =get_cpu (); - -/* We need to enqueue the padata object into the correct -* per-cpu queue. -*/ -if (cpu != padata->cpu) { - reorder_via_wq =1 ; - cpu = padata->cpu; - } - - pqueue =per_cpu_ptr (pd->pqueue, cpu); +struct parallel_data *pd = padata->pd; +struct padata_parallel_queue *pqueue =per_cpu_ptr (pd->pqueue, + padata->cpu);spin_lock (&pqueue->reorder.lock);list_add_tail (&padata->list, &pqueue->reorder.list);
@@ -354,8 +339,6 @@ void padata_do_serial(struct padata_priv *padata)*/ smp_mb__after_atomic (); -put_cpu (); -padata_reorder (pd); }EXPORT_SYMBOL (padata_do_serial);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 30/59 arm64: fix the flush_icache_range arguments in machine_kexec
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
Commit d51c214541c5154dda3037289ee895ea3ded5ebd upstream.
The second argument is the end "pointer", not the length.
--- arch/arm64/kernel/machine_kexec.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/arm64/kernel/machine_kexec.c +2 -1
@@ -184,7 +184,8 @@ void machine_kexec(struct kimage *kimage/* Flush the reboot_code_buffer in preparation for its execution. */ __flush_dcache_area (reboot_code_buffer, arm64_relocate_new_kernel_size);flush_icache_range ((uintptr_t )reboot_code_buffer, - arm64_relocate_new_kernel_size); + (uintptr_t )reboot_code_buffer + + arm64_relocate_new_kernel_size);/* Flush the kimage list and its buffers. */ kexec_list_flush (kimage);
Greg Kroah-Hartman
maintainerPATCH 31/59 l2tp: dont register sessions in l2tp_session_create()
In reply to Greg Kroah-HartmanFrom: Guillaume Nault <[email protected]>
commit 3953ae7b218df4d1e544b98a393666f9ae58a78c upstream.
Sessions created by l2tp_session_create() aren't fully initialised:
some pseudo-wire specific operations need to be done before making the session usable. Therefore the PPP and Ethernet pseudo-wires continue working on the returned l2tp session while it's already been exposed to the rest of the system.
This can lead to various issues. In particular, the session may enter the deletion process before having been fully initialised, which will confuse the session removal code.
This patch moves session registration out of l2tp_session_create(), so that callers can control when the session is exposed to the rest of the system. This is done by the new l2tp_session_register() function.
Only pppol2tp_session_create() can be easily converted to avoid modifying its session after registration (the debug message is dropped in order to avoid the need for holding a reference on the session).
For pppol2tp_connect() and l2tp_eth_create()), more work is needed. That'll be done in followup patches. For now, let's just register the session right after its creation, like it was done before. The only difference is that we can easily take a reference on the session before registering it, so, at least, we're sure it's not going to be freed while we're working on it.
--- net/l2tp/l2tp_core.c | 21 +++++++-------------- net/l2tp/l2tp_core.h | 3 +++ net/l2tp/l2tp_eth.c | 9 +++++++++ net/l2tp/l2tp_ppp.c | 27 +++++++++++++++++++-------- 4 files changed, 38 insertions(+), 22 deletions(-)
net/l2tp/l2tp_core.c +7 -14
@@ -328,8 +328,8 @@ struct l2tp_session *l2tp_session_get_by }EXPORT_SYMBOL_GPL (l2tp_session_get_by_ifname); -static int l2tp_session_add_to_tunnel (struct l2tp_tunnel *tunnel, -struct l2tp_session *session) +int l2tp_session_register (struct l2tp_session *session, +struct l2tp_tunnel *tunnel) {struct l2tp_session *session_walk;struct hlist_head *g_head;
@@ -382,6 +382,10 @@ static int l2tp_session_add_to_tunnel(sthlist_add_head (&session->hlist, head);write_unlock_bh (&tunnel->hlist_lock); +/* Ignore management session in session count value */ +if (session->session_id !=0 ) +atomic_inc (&l2tp_session_count); +return 0 ; err_tlock_pnlock:
@@ -391,6 +395,7 @@ err_tlock:return err; } +EXPORT_SYMBOL_GPL (l2tp_session_register);/* Lookup a tunnel by id */
@@ -1791,7 +1796,6 @@ EXPORT_SYMBOL_GPL(l2tp_session_set_headestruct l2tp_session *l2tp_session_create (int priv_size,struct l2tp_tunnel *tunnel,u32 session_id,u32 peer_session_id,struct l2tp_session_cfg *cfg) {struct l2tp_session *session; -int err; session =kzalloc (sizeof (struct l2tp_session ) + priv_size,GFP_KERNEL );if (session !=NULL ) {
@@ -1848,17 +1852,6 @@ struct l2tp_session *l2tp_session_createrefcount_set (&session->ref_count,1 ); - err =l2tp_session_add_to_tunnel (tunnel, session); -if (err) { -kfree (session); - -return ERR_PTR (err); - } - -/* Ignore management session in session count value */ -if (session->session_id !=0 ) -atomic_inc (&l2tp_session_count); -return session; }
net/l2tp/l2tp_core.h +3 -0
@@ -257,6 +257,9 @@ struct l2tp_session *l2tp_session_createstruct l2tp_tunnel *tunnel, u32 session_id, u32 peer_session_id, struct l2tp_session_cfg *cfg); +int l2tp_session_register (struct l2tp_session *session, +struct l2tp_tunnel *tunnel); +void __l2tp_session_unhash (struct l2tp_session *session);int l2tp_session_delete (struct l2tp_session *session);void l2tp_session_free (struct l2tp_session *session);
net/l2tp/l2tp_eth.c +9 -0
@@ -271,6 +271,13 @@ static int l2tp_eth_create(struct net *n goto out; } +l2tp_session_inc_refcount (session); + rc =l2tp_session_register (session, tunnel); +if (rc <0 ) { +kfree (session); + goto out; + } + dev =alloc_netdev (sizeof (*priv), name, name_assign_type, l2tp_eth_dev_setup);if (!dev) {
@@ -304,6 +311,7 @@ static int l2tp_eth_create(struct net *n__module_get (THIS_MODULE );/* Must be done after register_netdev() */ strlcpy (session->ifname, dev->name,IFNAMSIZ ); +l2tp_session_dec_refcount (session);dev_hold (dev);
@@ -314,6 +322,7 @@ out_del_dev: spriv->dev =NULL ; out_del_session:l2tp_session_delete (session); +l2tp_session_dec_refcount (session); out:return rc; }
net/l2tp/l2tp_ppp.c +19 -8
@@ -725,6 +725,14 @@ static int pppol2tp_connect(struct socke error =PTR_ERR (session); goto end; } + +l2tp_session_inc_refcount (session); + error =l2tp_session_register (session, tunnel); +if (error <0 ) { +kfree (session); + goto end; + } + drop_refcnt = true; }/* Associate session with its PPPoL2TP socket */
@@ -812,7 +820,7 @@ static int pppol2tp_session_create(struc/* Error if tunnel socket is not prepped */ if (!tunnel->sock) { error = -ENOENT ; - goto out; + goto err; }/* Default MTU values. */
@@ -827,18 +835,21 @@ static int pppol2tp_session_create(struc peer_session_id, cfg);if (IS_ERR (session)) { error =PTR_ERR (session); - goto out; + goto err; } ps =l2tp_session_priv (session); ps->tunnel_sock = tunnel->sock; -l2tp_info (session,L2TP_MSG_CONTROL ,"%s: created\n" , - session->name); - - error =0 ; - -out: + error =l2tp_session_register (session, tunnel); +if (error <0 ) + goto err_sess; + +return 0 ; + +err_sess: +kfree (session); +err:return error; }
Greg Kroah-Hartman
maintainerPATCH 32/59 l2tp: initialise l2tp_eth sessions before registering them
In reply to Greg Kroah-HartmanFrom: Guillaume Nault <[email protected]>
commit ee28de6bbd78c2e18111a0aef43ea746f28d2073 upstream.
Sessions must be initialised before being made externally visible by l2tp_session_register(). Otherwise the session may be concurrently deleted before being initialised, which can confuse the deletion path and eventually lead to kernel oops.
Therefore, we need to move l2tp_session_register() down in l2tp_eth_create(), but also handle the intermediate step where only the session or the netdevice has been registered.
We can't just call l2tp_session_register() in ->ndo_init() because we'd have no way to properly undo this operation in ->ndo_uninit(). Instead, let's register the session and the netdevice in two different steps and protect the session's device pointer with RCU.
And now that we allow the session's .dev field to be NULL, we don't need to prevent the netdevice from being removed anymore. So we can drop the dev_hold() and dev_put() calls in l2tp_eth_create() and l2tp_eth_dev_uninit().
--- net/l2tp/l2tp_eth.c | 106 ++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 75 insertions(+), 31 deletions(-)
net/l2tp/l2tp_eth.c +75 -31
@@ -54,7 +54,7 @@ struct l2tp_eth {/* via l2tp_session_priv() */ struct l2tp_eth_sess { -struct net_device *dev; +struct net_device __rcu *dev; };
@@ -72,7 +72,14 @@ static int l2tp_eth_dev_init(struct net_static void l2tp_eth_dev_uninit (struct net_device *dev) { -dev_put (dev); +struct l2tp_eth *priv =netdev_priv (dev); +struct l2tp_eth_sess *spriv; + + spriv =l2tp_session_priv (priv->session); +RCU_INIT_POINTER (spriv->dev,NULL ); +/* No need for synchronize_net() here. We're called by +* unregister_netdev*(), which does the synchronisation for us. +*/ }static int l2tp_eth_dev_xmit (struct sk_buff *skb,struct net_device *dev)
@@ -130,8 +137,8 @@ static void l2tp_eth_dev_setup(struct nestatic void l2tp_eth_dev_recv (struct l2tp_session *session,struct sk_buff *skb,int data_len) {struct l2tp_eth_sess *spriv =l2tp_session_priv (session); -struct net_device *dev = spriv->dev; -struct l2tp_eth *priv =netdev_priv (dev); +struct net_device *dev; +struct l2tp_eth *priv;if (session->debug &L2TP_MSG_DATA ) {unsigned int length;
@@ -155,16 +162,25 @@ static void l2tp_eth_dev_recv(struct l2tskb_dst_drop (skb);nf_reset (skb); +rcu_read_lock (); + dev =rcu_dereference (spriv->dev); +if (!dev) + goto error_rcu; + + priv =netdev_priv (dev);if (dev_forward_skb (dev, skb) ==NET_RX_SUCCESS ) {atomic_long_inc (&priv->rx_packets);atomic_long_add (data_len, &priv->rx_bytes); }else {atomic_long_inc (&priv->rx_errors); } +rcu_read_unlock (); +return ; +error_rcu: +rcu_read_unlock (); error: -atomic_long_inc (&priv->rx_errors);kfree_skb (skb); }
@@ -175,11 +191,15 @@ static void l2tp_eth_delete(struct l2tp_if (session) { spriv =l2tp_session_priv (session); - dev = spriv->dev; + +rtnl_lock (); + dev =rtnl_dereference (spriv->dev);if (dev) { -unregister_netdev (dev); - spriv->dev =NULL ; +unregister_netdevice (dev); +rtnl_unlock ();module_put (THIS_MODULE ); + }else { +rtnl_unlock (); } } }
@@ -189,9 +209,20 @@ static void l2tp_eth_show(struct seq_fil {struct l2tp_session *session = arg;struct l2tp_eth_sess *spriv =l2tp_session_priv (session); -struct net_device *dev = spriv->dev; +struct net_device *dev; + +rcu_read_lock (); + dev =rcu_dereference (spriv->dev); +if (!dev) { +rcu_read_unlock (); +return ; + } +dev_hold (dev); +rcu_read_unlock ();seq_printf (m," interface %s\n" , dev->name); + +dev_put (dev); }#endif
@@ -268,21 +299,14 @@ static int l2tp_eth_create(struct net *n peer_session_id, cfg);if (IS_ERR (session)) { rc =PTR_ERR (session); - goto out; - } - -l2tp_session_inc_refcount (session); - rc =l2tp_session_register (session, tunnel); -if (rc <0 ) { -kfree (session); - goto out; + goto err; } dev =alloc_netdev (sizeof (*priv), name, name_assign_type, l2tp_eth_dev_setup);if (!dev) { rc = -ENOMEM ; - goto out_del_session; + goto err_sess; }dev_net_set (dev, net);
@@ -302,28 +326,48 @@ static int l2tp_eth_create(struct net *n#endif spriv =l2tp_session_priv (session); - spriv->dev = dev; - rc =register_netdev (dev); -if (rc <0 ) - goto out_del_dev; +l2tp_session_inc_refcount (session); + +rtnl_lock (); + +/* Register both device and session while holding the rtnl lock. This +* ensures that l2tp_eth_delete() will see that there's a device to +* unregister, even if it happened to run before we assign spriv->dev. +*/ + rc =l2tp_session_register (session, tunnel); +if (rc <0 ) { +rtnl_unlock (); + goto err_sess_dev; + } + + rc =register_netdevice (dev); +if (rc <0 ) { +rtnl_unlock (); +l2tp_session_delete (session); +l2tp_session_dec_refcount (session); +free_netdev (dev); + +return rc; + } -__module_get (THIS_MODULE ); -/* Must be done after register_netdev() */ strlcpy (session->ifname, dev->name,IFNAMSIZ ); +rcu_assign_pointer (spriv->dev, dev); + +rtnl_unlock (); +l2tp_session_dec_refcount (session); -dev_hold (dev); +__module_get (THIS_MODULE );return 0 ; -out_del_dev: -free_netdev (dev); - spriv->dev =NULL ; -out_del_session: -l2tp_session_delete (session); +err_sess_dev:l2tp_session_dec_refcount (session); -out: +free_netdev (dev); +err_sess: +kfree (session); +err:return rc; }
Greg Kroah-Hartman
maintainerPATCH 33/59 l2tp: protect sock pointer of struct pppol2tp_session with RCU
In reply to Greg Kroah-HartmanFrom: Guillaume Nault <[email protected]>
commit ee40fb2e1eb5bc0ddd3f2f83c6e39a454ef5a741 upstream.
pppol2tp_session_create() registers sessions that can't have their corresponding socket initialised. This socket has to be created by userspace, then connected to the session by pppol2tp_connect(). Therefore, we need to protect the pppol2tp socket pointer of L2TP sessions, so that it can safely be updated when userspace is connecting or closing the socket. This will eventually allow pppol2tp_connect() to avoid generating transient states while initialising its parts of the session.
To this end, this patch protects the pppol2tp socket pointer using RCU.
The pppol2tp socket pointer is still set in pppol2tp_connect(), but only once we know the function isn't going to fail. It's eventually reset by pppol2tp_release(), which now has to wait for a grace period to elapse before it can drop the last reference on the socket. This ensures that pppol2tp_session_get_sock() can safely grab a reference on the socket, even after ps->sk is reset to NULL but before this operation actually gets visible from pppol2tp_session_get_sock().
The rest is standard RCU conversion: pppol2tp_recv(), which already runs in atomic context, is simply enclosed by rcu_read_lock() and rcu_read_unlock(), while other functions are converted to use pppol2tp_session_get_sock() followed by sock_put(). pppol2tp_session_setsockopt() is a special case. It used to retrieve the pppol2tp socket from the L2TP session, which itself was retrieved from the pppol2tp socket. Therefore we can just avoid dereferencing ps->sk and directly use the original socket pointer instead.
With all users of ps->sk now handling NULL and concurrent updates, the L2TP ->ref() and ->deref() callbacks aren't needed anymore. Therefore, rather than converting pppol2tp_session_sock_hold() and pppol2tp_session_sock_put(), we can just drop them.
--- net/l2tp/l2tp_ppp.c | 154 ++++++++++++++++++++++++++++++++++------------------ 1 file changed, 101 insertions(+), 53 deletions(-)
net/l2tp/l2tp_ppp.c +101 -53
@@ -122,8 +122,11 @@struct pppol2tp_session {int owner;/* pid that opened the socket */ -struct sock *sock;/* Pointer to the session +struct mutex sk_lock;/* Protects .sk */ +struct sock __rcu *sk;/* Pointer to the session * PPPoX socket */ +struct sock *__sk;/* Copy of .sk, for cleanup */ +struct rcu_head rcu;/* For asynchronous release */ struct sock *tunnel_sock;/* Pointer to the tunnel UDP * socket */ int flags;/* accessed by PPPIOCGFLAGS.
@@ -138,6 +141,24 @@ static const struct ppp_channel_ops pppostatic const struct proto_ops pppol2tp_ops; +/* Retrieves the pppol2tp socket associated to a session. +* A reference is held on the returned socket, so this function must be paired +* with sock_put(). +*/ +static struct sock *pppol2tp_session_get_sock (struct l2tp_session *session) +{ +struct pppol2tp_session *ps =l2tp_session_priv (session); +struct sock *sk; + +rcu_read_lock (); + sk =rcu_dereference (ps->sk); +if (sk) +sock_hold (sk); +rcu_read_unlock (); + +return sk; +} +/* Helpers to obtain tunnel/session contexts from sockets. */ static inline struct l2tp_session *pppol2tp_sock_to_session (struct sock *sk)
@@ -224,7 +245,8 @@ static void pppol2tp_recv(struct l2tp_se/* If the socket is bound, send it in to PPP's input queue. Otherwise * queue it on the session socket. */ - sk = ps->sock; +rcu_read_lock (); + sk =rcu_dereference (ps->sk);if (sk ==NULL ) goto no_sock;
@@ -247,30 +269,16 @@ static void pppol2tp_recv(struct l2tp_sekfree_skb (skb); } } +rcu_read_unlock ();return ; no_sock: +rcu_read_unlock ();l2tp_info (session,L2TP_MSG_DATA ,"%s: no socket\n" , session->name);kfree_skb (skb); } -static void pppol2tp_session_sock_hold (struct l2tp_session *session) -{ -struct pppol2tp_session *ps =l2tp_session_priv (session); - -if (ps->sock) -sock_hold (ps->sock); -} - -static void pppol2tp_session_sock_put (struct l2tp_session *session) -{ -struct pppol2tp_session *ps =l2tp_session_priv (session); - -if (ps->sock) -sock_put (ps->sock); -} -/************************************************************************ * Transmit handling ***********************************************************************/
@@ -431,14 +439,16 @@ abort:*/ static void pppol2tp_session_close (struct l2tp_session *session) { -struct pppol2tp_session *ps =l2tp_session_priv (session); -struct sock *sk = ps->sock; -struct socket *sock = sk->sk_socket; +struct sock *sk;BUG_ON (session->magic !=L2TP_SESSION_MAGIC ); -if (sock) -inet_shutdown (sock,SEND_SHUTDOWN ); + sk =pppol2tp_session_get_sock (session); +if (sk) { +if (sk->sk_socket) +inet_shutdown (sk->sk_socket,SEND_SHUTDOWN ); +sock_put (sk); + }/* Don't let the session go away before our socket does */ l2tp_session_inc_refcount (session);
@@ -461,6 +471,14 @@ static void pppol2tp_session_destruct(st } } +static void pppol2tp_put_sk (struct rcu_head *head) +{ +struct pppol2tp_session *ps; + + ps =container_of (head,typeof (*ps), rcu); +sock_put (ps->__sk); +} +/* Called when the PPPoX socket (session) is closed. */ static int pppol2tp_release (struct socket *sock)
@@ -486,11 +504,24 @@ static int pppol2tp_release(struct socke session =pppol2tp_sock_to_session (sk); -/* Purge any queued data */ if (session !=NULL ) { +struct pppol2tp_session *ps; +__l2tp_session_unhash (session);l2tp_session_queue_purge (session); -sock_put (sk); + + ps =l2tp_session_priv (session); +mutex_lock (&ps->sk_lock); + ps->__sk =rcu_dereference_protected (ps->sk, +lockdep_is_held (&ps->sk_lock)); +RCU_INIT_POINTER (ps->sk,NULL ); +mutex_unlock (&ps->sk_lock); +call_rcu (&ps->rcu, pppol2tp_put_sk); + +/* Rely on the sock_put() call at the end of the function for +* dropping the reference held by pppol2tp_sock_to_session(). +* The last reference will be dropped by pppol2tp_put_sk(). +*/ }release_sock (sk);
@@ -557,12 +588,14 @@ out:static void pppol2tp_show (struct seq_file *m,void *arg) {struct l2tp_session *session = arg; -struct pppol2tp_session *ps =l2tp_session_priv (session); +struct sock *sk; + + sk =pppol2tp_session_get_sock (session); +if (sk) { +struct pppox_sock *po =pppox_sk (sk); -if (ps) { -struct pppox_sock *po =pppox_sk (ps->sock); -if (po) -seq_printf (m," interface %s\n" ,ppp_dev_name (&po->chan)); +seq_printf (m," interface %s\n" ,ppp_dev_name (&po->chan)); +sock_put (sk); } }#endif
@@ -703,13 +736,17 @@ static int pppol2tp_connect(struct socke/* Using a pre-existing session is fine as long as it hasn't * been connected yet. */ -if (ps->sock) { +mutex_lock (&ps->sk_lock); +if (rcu_dereference_protected (ps->sk, +lockdep_is_held (&ps->sk_lock))) { +mutex_unlock (&ps->sk_lock); error = -EEXIST ; goto end; }/* consistency checks */ if (ps->tunnel_sock != tunnel->sock) { +mutex_unlock (&ps->sk_lock); error = -EEXIST ; goto end; }
@@ -726,19 +763,21 @@ static int pppol2tp_connect(struct socke goto end; } + ps =l2tp_session_priv (session); +mutex_init (&ps->sk_lock);l2tp_session_inc_refcount (session); + +mutex_lock (&ps->sk_lock); error =l2tp_session_register (session, tunnel);if (error <0 ) { +mutex_unlock (&ps->sk_lock);kfree (session); goto end; } drop_refcnt = true; } -/* Associate session with its PPPoL2TP socket */ - ps =l2tp_session_priv (session); ps->owner = current->pid; - ps->sock = sk; ps->tunnel_sock = tunnel->sock; session->recv_skb = pppol2tp_recv;
@@ -747,12 +786,6 @@ static int pppol2tp_connect(struct socke session->show = pppol2tp_show;#endif -/* We need to know each time a skb is dropped from the reorder -* queue. -*/ - session->ref = pppol2tp_session_sock_hold; - session->deref = pppol2tp_session_sock_put; -/* If PMTU discovery was enabled, use the MTU that was discovered */ dst =sk_dst_get (tunnel->sock);if (dst !=NULL ) {
@@ -786,12 +819,17 @@ static int pppol2tp_connect(struct socke po->chan.mtu = session->mtu; error =ppp_register_net_channel (sock_net (sk), &po->chan); -if (error) +if (error) { +mutex_unlock (&ps->sk_lock); goto end; + } out_no_ppp:/* This is how we get the session context from the socket. */ sk->sk_user_data = session; +rcu_assign_pointer (ps->sk, sk); +mutex_unlock (&ps->sk_lock); + sk->sk_state =PPPOX_CONNECTED ;l2tp_info (session,L2TP_MSG_CONTROL ,"%s: created\n" , session->name);
@@ -839,6 +877,7 @@ static int pppol2tp_session_create(struc } ps =l2tp_session_priv (session); +mutex_init (&ps->sk_lock); ps->tunnel_sock = tunnel->sock; error =l2tp_session_register (session, tunnel);
@@ -1010,12 +1049,10 @@ static int pppol2tp_session_ioctl(struct"%s: pppol2tp_session_ioctl(cmd=%#x, arg=%#lx)\n" , session->name, cmd, arg); - sk = ps->sock; + sk =pppol2tp_session_get_sock (session);if (!sk)return -EBADR ; -sock_hold (sk); -switch (cmd) {case SIOCGIFMTU : err = -ENXIO ;
@@ -1291,7 +1328,6 @@ static int pppol2tp_session_setsockopt(s int optname, int val) {int err =0 ; -struct pppol2tp_session *ps =l2tp_session_priv (session);switch (optname) {case PPPOL2TP_SO_RECVSEQ :
@@ -1312,8 +1348,8 @@ static int pppol2tp_session_setsockopt(s } session->send_seq = !!val; { -struct sock *ssk = ps->sock; -struct pppox_sock *po =pppox_sk (ssk); +struct pppox_sock *po =pppox_sk (sk); + po->chan.hdrlen = val ?PPPOL2TP_L2TP_HDR_SIZE_SEQ :PPPOL2TP_L2TP_HDR_SIZE_NOSEQ ; }
@@ -1652,8 +1688,9 @@ static void pppol2tp_seq_session_show(st {struct l2tp_session *session = v;struct l2tp_tunnel *tunnel = session->tunnel; -struct pppol2tp_session *ps =l2tp_session_priv (session); -struct pppox_sock *po =pppox_sk (ps->sock); +unsigned char state; +char user_data_ok; +struct sock *sk;u32 ip =0 ;u16 port =0 ;
@@ -1663,6 +1700,15 @@ static void pppol2tp_seq_session_show(st port =ntohs (inet->inet_sport); } + sk =pppol2tp_session_get_sock (session); +if (sk) { + state = sk->sk_state; + user_data_ok = (session == sk->sk_user_data) ?'Y' :'N' ; + }else { + state =0 ; + user_data_ok ='N' ; + } + seq_printf(m, " SESSION '%s' %08X/%d %04X/%04X -> " "%04X/%04X %d %c\n", session->name, ip, port,
@@ -1670,9 +1716,7 @@ static void pppol2tp_seq_session_show(st session->session_id, tunnel->peer_tunnel_id, session->peer_session_id, - ps->sock->sk_state, - (session == ps->sock->sk_user_data) ? - 'Y' : 'N'); + state, user_data_ok); seq_printf(m, " %d/%d/%c/%c/%s %08x %u\n", session->mtu, session->mru, session->recv_seq ? 'R' : '-',
@@ -1689,8 +1733,12 @@ static void pppol2tp_seq_session_show(statomic_long_read (&session->stats.rx_bytes), atomic_long_read(&session->stats.rx_errors)); -if (po) +if (sk) { +struct pppox_sock *po =pppox_sk (sk); +seq_printf (m," interface %s\n" ,ppp_dev_name (&po->chan)); +sock_put (sk); + } }static int pppol2tp_seq_show (struct seq_file *m,void *v)
Greg Kroah-Hartman
maintainerPATCH 34/59 l2tp: initialise PPP sessions before registering them
In reply to Greg Kroah-HartmanFrom: Guillaume Nault <[email protected]>
commit f98be6c6359e7e4a61aaefb9964c1db31cb9ec0c upstream.
pppol2tp_connect() initialises L2TP sessions after they've been exposed to the rest of the system by l2tp_session_register(). This puts sessions into transient states that are the source of several races, in particular with session's deletion path.
This patch centralises the initialisation code into pppol2tp_session_init(), which is called before the registration phase. The only field that can't be set before session registration is the pppol2tp socket pointer, which has already been converted to RCU. So pppol2tp_connect() should now be race-free.
The session's .session_close() callback is now set before registration. Therefore, it's always called when l2tp_core deletes the session, even if it was created by pppol2tp_session_create() and hasn't been plugged to a pppol2tp socket yet. That'd prevent session free because the extra reference taken by pppol2tp_session_close() wouldn't be dropped by the socket's ->sk_destruct() callback (pppol2tp_session_destruct()). We could set .session_close() only while connecting a session to its pppol2tp socket, or teach pppol2tp_session_close() to avoid grabbing a reference when the session isn't connected, but that'd require adding some form of synchronisation to be race free.
Instead of that, we can just let the pppol2tp socket hold a reference on the session as soon as it starts depending on it (that is, in pppol2tp_connect()). Then we don't need to utilise pppol2tp_session_close() to hold a reference at the last moment to prevent l2tp_core from dropping it.
When releasing the socket, pppol2tp_release() now deletes the session using the standard l2tp_session_delete() function, instead of merely removing it from hash tables. l2tp_session_delete() drops the reference the sessions holds on itself, but also makes sure it doesn't remove a session twice. So it can safely be called, even if l2tp_core already tried, or is concurrently trying, to remove the session. Finally, pppol2tp_session_destruct() drops the reference held by the socket.
--- net/l2tp/l2tp_ppp.c | 69 ++++++++++++++++++++++++++++------------------------ 1 file changed, 38 insertions(+), 31 deletions(-)
net/l2tp/l2tp_ppp.c +38 -31
@@ -449,9 +449,6 @@ static void pppol2tp_session_close(strucinet_shutdown (sk->sk_socket,SEND_SHUTDOWN );sock_put (sk); } - -/* Don't let the session go away before our socket does */ -l2tp_session_inc_refcount (session); }/* Really kill the session socket. (Called from sock_put() if
@@ -507,8 +504,7 @@ static int pppol2tp_release(struct sockeif (session !=NULL ) {struct pppol2tp_session *ps; -__l2tp_session_unhash (session); -l2tp_session_queue_purge (session); +l2tp_session_delete (session); ps =l2tp_session_priv (session);mutex_lock (&ps->sk_lock);
@@ -600,6 +596,35 @@ static void pppol2tp_show(struct seq_fil }#endif +static void pppol2tp_session_init (struct l2tp_session *session) +{ +struct pppol2tp_session *ps; +struct dst_entry *dst; + + session->recv_skb = pppol2tp_recv; + session->session_close = pppol2tp_session_close; +#if IS_ENABLED (CONFIG_L2TP_DEBUGFS ) + session->show = pppol2tp_show; +#endif + + ps =l2tp_session_priv (session); +mutex_init (&ps->sk_lock); + ps->tunnel_sock = session->tunnel->sock; + ps->owner = current->pid; + +/* If PMTU discovery was enabled, use the MTU that was discovered */ + dst =sk_dst_get (session->tunnel->sock); +if (dst) { +u32 pmtu =dst_mtu (dst); + +if (pmtu) { + session->mtu = pmtu -PPPOL2TP_HEADER_OVERHEAD ; + session->mru = pmtu -PPPOL2TP_HEADER_OVERHEAD ; + } +dst_release (dst); + } +} +/* connect() handler. Attach a PPPoX socket to a tunnel UDP socket */ static int pppol2tp_connect(struct socket *sock, struct sockaddr *uservaddr,
@@ -611,7 +636,6 @@ static int pppol2tp_connect(struct sockestruct l2tp_session *session =NULL ;struct l2tp_tunnel *tunnel;struct pppol2tp_session *ps; -struct dst_entry *dst;struct l2tp_session_cfg cfg = {0 , };int error =0 ;u32 tunnel_id, peer_tunnel_id;
@@ -763,8 +787,8 @@ static int pppol2tp_connect(struct socke goto end; } +pppol2tp_session_init (session); ps =l2tp_session_priv (session); -mutex_init (&ps->sk_lock);l2tp_session_inc_refcount (session);mutex_lock (&ps->sk_lock);
@@ -777,26 +801,6 @@ static int pppol2tp_connect(struct socke drop_refcnt = true; } - ps->owner = current->pid; - ps->tunnel_sock = tunnel->sock; - - session->recv_skb = pppol2tp_recv; - session->session_close = pppol2tp_session_close; -#if IS_ENABLED (CONFIG_L2TP_DEBUGFS ) - session->show = pppol2tp_show; -#endif - -/* If PMTU discovery was enabled, use the MTU that was discovered */ - dst =sk_dst_get (tunnel->sock); -if (dst !=NULL ) { -u32 pmtu =dst_mtu (dst); - -if (pmtu !=0 ) - session->mtu = session->mru = pmtu - -PPPOL2TP_HEADER_OVERHEAD ; -dst_release (dst); - } -/* Special case: if source & dest session_id == 0x0000, this * socket is being created to manage the tunnel. Just set up * the internal context for use by ioctl() and sockopt()
@@ -830,6 +834,12 @@ out_no_ppp:rcu_assign_pointer (ps->sk, sk);mutex_unlock (&ps->sk_lock); +/* Keep the reference we've grabbed on the session: sk doesn't expect +* the session to disappear. pppol2tp_session_destruct() is responsible +* for dropping it. +*/ + drop_refcnt = false; + sk->sk_state =PPPOX_CONNECTED ;l2tp_info (session,L2TP_MSG_CONTROL ,"%s: created\n" , session->name);
@@ -853,7 +863,6 @@ static int pppol2tp_session_create(struc {int error;struct l2tp_session *session; -struct pppol2tp_session *ps;/* Error if tunnel socket is not prepped */ if (!tunnel->sock) {
@@ -876,9 +885,7 @@ static int pppol2tp_session_create(struc goto err; } - ps =l2tp_session_priv (session); -mutex_init (&ps->sk_lock); - ps->tunnel_sock = tunnel->sock; +pppol2tp_session_init (session); error =l2tp_session_register (session, tunnel);if (error <0 )
Greg Kroah-Hartman
maintainerPATCH 35/59 ALSA: iec1712: Initialize STDSP24 properly when using the model=staudio option
In reply to Greg Kroah-HartmanFrom: Scott Bahling <[email protected]>
commit b0cb099062b0c18246c3a20caaab4c0afc303255 upstream.
The ST Audio ADCIII is an STDSP24 card plus extension box. With commit e8a91ae18bdc ("ALSA: ice1712: Add support for STAudio ADCIII") we enabled the ADCIII ports using the model=staudio option but forgot this part to ensure the STDSP24 card is initialized properly.
--- sound/pci/ice1712/ice1712.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/pci/ice1712/ice1712.c +2 -1
@@ -2377,7 +2377,8 @@ static int snd_ice1712_chip_init(structpci_write_config_byte (ice->pci,0x61 , ice->eeprom.data[ICE_EEP1_ACLINK ]);pci_write_config_byte (ice->pci,0x62 , ice->eeprom.data[ICE_EEP1_I2SID ]);pci_write_config_byte (ice->pci,0x63 , ice->eeprom.data[ICE_EEP1_SPDIF ]); -if (ice->eeprom.subvendor !=ICE1712_SUBDEVICE_STDSP24 ) { +if (ice->eeprom.subvendor !=ICE1712_SUBDEVICE_STDSP24 && + ice->eeprom.subvendor !=ICE1712_SUBDEVICE_STAUDIO_ADCIII ) { ice->gpio.write_mask = ice->eeprom.gpiomask; ice->gpio.direction = ice->eeprom.gpiodir; snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK,
Greg Kroah-Hartman
maintainerPATCH 36/59 ALSA: pcm: fix incorrect hw_base increase
In reply to Greg Kroah-HartmanFrom: Brent Lu <[email protected]>
commit e7513c5786f8b33f0c107b3759e433bc6cbb2efa upstream.
There is a corner case that ALSA keeps increasing the hw_ptr but DMA already stop working/updating the position for a long time.
In following log we can see the position returned from DMA driver does not move at all but the hw_ptr got increased at some point of time so snd_pcm_avail() will return a large number which seems to be a buffer underrun event from user space program point of view. The program thinks there is space in the buffer and fill more data.
[ 418.510086] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 4096 avail 12368 [ 418.510149] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 6910 avail 9554 ... [ 418.681052] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 15102 avail 1362 [ 418.681130] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 16464 avail 0 [ 418.726515] sound pcmC0D5p: pos 96 hw_ptr 16464 appl_ptr 16464 avail 16368
This is because the hw_base will be increased by runtime->buffer_size frames unconditionally if the hw_ptr is not updated for over half of buffer time. As the hw_base increases, so does the hw_ptr increased by the same number.
The avail value returned from snd_pcm_avail() could exceed the limit (buffer_size) easily becase the hw_ptr itself got increased by same buffer_size samples when the corner case happens. In following log, the buffer_size is 16368 samples but the avail is 21810 samples so CRAS server complains about it.
[ 418.851755] sound pcmC0D5p: pos 96 hw_ptr 16464 appl_ptr 27390 avail 5442 [ 418.926491] sound pcmC0D5p: pos 96 hw_ptr 32832 appl_ptr 27390 avail 21810
cras_server[1907]: pcm_avail returned frames larger than buf_size:
sof-glkda7219max: :0,5: 21810 > 16368
By updating runtime->hw_ptr_jiffies each time the HWSYNC is called, the hw_base will keep the same when buffer stall happens at long as the interval between each HWSYNC call is shorter than half of buffer time.
Following is a log captured by a patched kernel. The hw_base/hw_ptr value is fixed in this corner case and user space program should be aware of the buffer stall and handle it.
[ 293.525543] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 4096 avail 12368 [ 293.525606] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 6880 avail 9584 [ 293.525975] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 10976 avail 5488 [ 293.611178] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 15072 avail 1392 [ 293.696429] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 16464 avail 0 ... [ 381.139517] sound pcmC0D5p: pos 96 hw_ptr 96 appl_ptr 16464 avail 0
--- sound/core/pcm_lib.c | 1 + 1 file changed, 1 insertion(+)
sound/core/pcm_lib.c +1 -0
@@ -440,6 +440,7 @@ static int snd_pcm_update_hw_ptr0(struct no_delta_check:if (runtime->status->hw_ptr == new_hw_ptr) { + runtime->hw_ptr_jiffies = curr_jiffies;update_audio_tstamp (substream, &curr_tstamp, &audio_tstamp);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 37/59 apparmor: Fix aa_label refcnt leak in policy_update
In reply to Greg Kroah-HartmanFrom: Xiyu Yang <[email protected]>
commit c6b39f070722ea9963ffe756bfe94e89218c5e63 upstream.
policy_update() invokes begin_current_label_crit_section(), which returns a reference of the updated aa_label object to "label" with increased refcount.
When policy_update() returns, "label" becomes invalid, so the refcount should be decreased to keep refcount balanced.
The reference counting issue happens in one exception handling path of policy_update(). When aa_may_manage_policy() returns not NULL, the refcnt increased by begin_current_label_crit_section() is not decreased, causing a refcnt leak.
Fix this issue by jumping to "end_section" label when aa_may_manage_policy() returns not NULL.
--- security/apparmor/apparmorfs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
security/apparmor/apparmorfs.c +2 -1
@@ -426,7 +426,7 @@ static ssize_t policy_update(u32 mask, c*/ error =aa_may_manage_policy (label, ns, mask);if (error) -return error; + goto end_section; data =aa_simple_write_to_buffer (buf, size, size, pos); error =PTR_ERR (data);
@@ -434,6 +434,7 @@ static ssize_t policy_update(u32 mask, c error =aa_replace_profiles (ns, label, mask, data);aa_put_loaddata (data); } +end_section:end_current_label_crit_section (label);return error;
Greg Kroah-Hartman
maintainerPATCH 38/59 dmaengine: tegra210-adma: Fix an error handling path in tegra_adma_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
commit 3a5fd0dbd87853f8bd2ea275a5b3b41d6686e761 upstream.
Commit b53611fb1ce9 ("dmaengine: tegra210-adma: Fix crash during probe") has moved some code in the probe function and reordered the error handling path accordingly.
However, a goto has been missed.
Fix it and goto the right label if 'dma_async_device_register()' fails, so that all resources are released.
--- drivers/dma/tegra210-adma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/tegra210-adma.c +1 -1
@@ -793,7 +793,7 @@ static int tegra_adma_probe(struct platf ret =dma_async_device_register (&tdma->dma_dev);if (ret <0 ) {dev_err (&pdev->dev,"ADMA registration failed: %d\n" , ret); - goto irq_dispose; + goto rpm_put; } ret = of_dma_controller_register(pdev->dev.of_node,
Greg Kroah-Hartman
maintainerPATCH 39/59 powerpc: restore alphabetic order in Kconfig
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 4ec591e51a4b0aedb6c7f1a8cd722aa58d7f61ba ]
This patch restores the alphabetic order which was broken by commit 1e0fc9d1eb2b0 ("powerpc/Kconfig: Enable STRICT_KERNEL_RWX for some configs")
--- arch/powerpc/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/Kconfig +2 -2
@@ -141,12 +141,14 @@ config PPC select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE select ARCH_HAS_SG_CHAIN + select ARCH_HAS_STRICT_KERNEL_RWX if ((PPC_BOOK3S_64 || PPC32) && !RELOCATABLE && !HIBERNATION) select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAS_UBSAN_SANITIZE_ALL select ARCH_HAS_ZONE_DEVICE if PPC_BOOK3S_64 select ARCH_HAVE_NMI_SAFE_CMPXCHG select ARCH_MIGHT_HAVE_PC_PARPORT select ARCH_MIGHT_HAVE_PC_SERIO + select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX select ARCH_SUPPORTS_ATOMIC_RMW select ARCH_SUPPORTS_DEFERRED_STRUCT_PAGE_INIT select ARCH_USE_BUILTIN_BSWAP
@@ -178,8 +180,6 @@ config PPC select HAVE_ARCH_MMAP_RND_COMPAT_BITS if COMPAT select HAVE_ARCH_SECCOMP_FILTER select HAVE_ARCH_TRACEHOOK - select ARCH_HAS_STRICT_KERNEL_RWX if ((PPC_BOOK3S_64 || PPC32) && !RELOCATABLE && !HIBERNATION) - select ARCH_OPTIONAL_KERNEL_RWX if ARCH_HAS_STRICT_KERNEL_RWX select HAVE_CBPF_JIT if !PPC64 select HAVE_CONTEXT_TRACKING if PPC64 select HAVE_DEBUG_KMEMLEAK
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 40/59 powerpc: Remove STRICT_KERNEL_RWX incompatibility with RELOCATABLE
In reply to Greg Kroah-HartmanFrom: Russell Currey <[email protected]>
[ Upstream commit c55d7b5e64265fdca45c85b639013e770bde2d0e ]
I have tested this with the Radix MMU and everything seems to work, and the previous patch for Hash seems to fix everything too. STRICT_KERNEL_RWX should still be disabled by default for now.
Please test STRICT_KERNEL_RWX + RELOCATABLE!
--- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/Kconfig +1 -1
@@ -141,7 +141,7 @@ config PPC select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE select ARCH_HAS_SG_CHAIN - select ARCH_HAS_STRICT_KERNEL_RWX if ((PPC_BOOK3S_64 || PPC32) && !RELOCATABLE && !HIBERNATION) + select ARCH_HAS_STRICT_KERNEL_RWX if ((PPC_BOOK3S_64 || PPC32) && !HIBERNATION) select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAS_UBSAN_SANITIZE_ALL select ARCH_HAS_ZONE_DEVICE if PPC_BOOK3S_64
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 41/59 powerpc/64s: Disable STRICT_KERNEL_RWX
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit 8659a0e0efdd975c73355dbc033f79ba3b31e82c ]
Several strange crashes have been eventually traced back to STRICT_KERNEL_RWX and its interaction with code patching.
Various paths in our ftrace, kprobes and other patching code need to be hardened against patching failures, otherwise we can end up running with partially/incorrectly patched ftrace paths, kprobes or jump labels, which can then cause strange crashes.
Although fixes for those are in development, they're not -rc material.
There also seem to be problems with the underlying strict RWX logic, which needs further debugging.
So for now disable STRICT_KERNEL_RWX on 64-bit to prevent people from enabling the option and tripping over the bugs.
--- arch/powerpc/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/Kconfig +1 -1
@@ -141,7 +141,7 @@ config PPC select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_SCALED_CPUTIME if VIRT_CPU_ACCOUNTING_NATIVE select ARCH_HAS_SG_CHAIN - select ARCH_HAS_STRICT_KERNEL_RWX if ((PPC_BOOK3S_64 || PPC32) && !HIBERNATION) + select ARCH_HAS_STRICT_KERNEL_RWX if (PPC32 && !HIBERNATION) select ARCH_HAS_TICK_BROADCAST if GENERIC_CLOCKEVENTS_BROADCAST select ARCH_HAS_UBSAN_SANITIZE_ALL select ARCH_HAS_ZONE_DEVICE if PPC_BOOK3S_64
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 42/59 x86/uaccess, ubsan: Fix UBSAN vs. SMAP
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
commit d08965a27e84ca090b504844d50c24fc98587b11 upstream.
UBSAN can insert extra code in random locations; including AC=1 sections. Typically this code is not safe and needs wrapping.
So far, only __ubsan_handle_type_mismatch* have been observed in AC=1 sections and therefore only those are annotated.
[stable backport: only take the lib/Makefile change to resolve gcc-10
build issues]
--- lib/Makefile | 1 + 1 file changed, 1 insertion(+)
lib/Makefile +1 -0
@@ -256,6 +256,7 @@ obj-$(CONFIG_UCS2_STRING) += ucs2_string obj-$(CONFIG_UBSAN) += ubsan.o UBSAN_SANITIZE_ubsan.o := n +CFLAGS_ubsan.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) obj-$(CONFIG_SBITMAP) += sbitmap.o
Greg Kroah-Hartman
maintainerPATCH 43/59 ubsan: build ubsan.c more conservatively
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
commit af700eaed0564d5d3963a7a51cb0843629d7fe3d upstream.
objtool points out several conditions that it does not like, depending on the combination with other configuration options and compiler variants:
stack protector:
lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch()+0xbf: call to __stack_chk_fail() with UACCESS enabled lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch_v1()+0xbe: call to __stack_chk_fail() with UACCESS enabled
stackleak plugin:
lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch()+0x4a: call to stackleak_track_stack() with UACCESS enabled lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch_v1()+0x4a: call to stackleak_track_stack() with UACCESS enabled
kasan:
lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch()+0x25: call to memcpy() with UACCESS enabled lib/ubsan.o: warning: objtool: __ubsan_handle_type_mismatch_v1()+0x25: call to memcpy() with UACCESS enabled
The stackleak and kasan options just need to be disabled for this file as we do for other files already. For the stack protector, we already attempt to disable it, but this fails on clang because the check is mixed with the gcc specific -fno-conserve-stack option. According to Andrey Ryabinin, that option is not even needed, dropping it here fixes the stackprotector issue.
--- lib/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
lib/Makefile +2 -1
@@ -256,7 +256,8 @@ obj-$(CONFIG_UCS2_STRING) += ucs2_string obj-$(CONFIG_UBSAN) += ubsan.o UBSAN_SANITIZE_ubsan.o := n -CFLAGS_ubsan.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) +KASAN_SANITIZE_ubsan.o := n +CFLAGS_ubsan.o := $(call cc-option, -fno-stack-protector) $(DISABLE_STACKLEAK_PLUGIN) obj-$(CONFIG_SBITMAP) += sbitmap.o
Greg Kroah-Hartman
maintainerPATCH 44/59 libnvdimm/btt: Remove unnecessary code in btt_freelist_init
In reply to Greg Kroah-HartmanFrom: Vishal Verma <[email protected]>
[ Upstream commit 2f8c9011151337d0bc106693f272f9bddbccfab2 ]
We call btt_log_read() twice, once to get the 'old' log entry, and again to get the 'new' entry. However, we have no use for the 'old' entry, so remove it.
--- drivers/nvdimm/btt.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/nvdimm/btt.c +2 -6
@@ -540,9 +540,9 @@ static int arena_clear_freelist_error(struct arena_info *arena, u32 lane)static int btt_freelist_init (struct arena_info *arena) { -int old, new, ret; +int new, ret;u32 i, map_entry; -struct log_entry log_new, log_old; +struct log_entry log_new; arena->freelist =kcalloc (arena->nfree,sizeof (struct free_entry ),GFP_KERNEL );
@@ -550,10 +550,6 @@ static int btt_freelist_init(struct arena_info *arena)return -ENOMEM ;for (i =0 ; i < arena->nfree; i++) { - old =btt_log_read (arena, i, &log_old,LOG_OLD_ENT ); -if (old <0 ) -return old; - new =btt_log_read (arena, i, &log_new,LOG_NEW_ENT );if (new <0 )return new;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 45/59 libnvdimm/btt: Fix LBA masking during free list population
In reply to Greg Kroah-HartmanFrom: Vishal Verma <[email protected]>
[ Upstream commit 9dedc73a4658ebcc0c9b58c3cb84e9ac80122213 ]
The Linux BTT implementation assumes that log entries will never have the 'zero' flag set, and indeed it never sets that flag for log entries itself.
However, the UEFI spec is ambiguous on the exact format of the LBA field of a log entry, specifically as to whether it should include the additional flag bits or not. While a zero bit doesn't make sense in the context of a log entry, other BTT implementations might still have it set.
If an implementation does happen to have it set, we would happily read it in as the next block to write to for writes. Since a high bit is set, it pushes the block number out of the range of an 'arena', and we fail such a write with an EIO.
Follow the robustness principle, and tolerate such implementations by stripping out the zero flag when populating the free list during initialization. Additionally, use the same stripped out entries for detection of incomplete writes and map restoration that happens at this stage.
Add a sysfs file 'log_zero_flags' that indicates the ability to accept such a layout to userspace applications. This enables 'ndctl check-namespace' to recognize whether the kernel is able to handle zero flags, or whether it should attempt a fix-up under the --repair option.
--- drivers/nvdimm/btt.c | 25 +++++++++++++++++++------ drivers/nvdimm/btt.h | 2 ++ drivers/nvdimm/btt_devs.c | 8 ++++++++ 3 files changed, 29 insertions(+), 6 deletions(-)
drivers/nvdimm/btt.c +19 -6
@@ -541,8 +541,8 @@ static int arena_clear_freelist_error(struct arena_info *arena, u32 lane)static int btt_freelist_init (struct arena_info *arena) {int new, ret; -u32 i, map_entry;struct log_entry log_new; +u32 i, map_entry, log_oldmap, log_newmap; arena->freelist =kcalloc (arena->nfree,sizeof (struct free_entry ),GFP_KERNEL );
@@ -554,16 +554,22 @@ static int btt_freelist_init(struct arena_info *arena)if (new <0 )return new; +/* old and new map entries with any flags stripped out */ + log_oldmap =ent_lba (le32_to_cpu (log_new.old_map)); + log_newmap =ent_lba (le32_to_cpu (log_new.new_map)); +/* sub points to the next one to be overwritten */ arena->freelist[i].sub =1 - new; arena->freelist[i].seq =nd_inc_seq (le32_to_cpu (log_new.seq)); - arena->freelist[i].block =le32_to_cpu (log_new.old_map); + arena->freelist[i].block = log_oldmap;/* * FIXME: if error clearing fails during init, we want to make * the BTT read-only */ -if (ent_e_flag (log_new.old_map)) { +if (ent_e_flag (log_new.old_map) && + !ent_normal (log_new.old_map)) { + arena->freelist[i].has_err =1 ; ret =arena_clear_freelist_error (arena, i);if (ret) dev_err_ratelimited(to_dev(arena),
@@ -571,7 +577,7 @@ static int btt_freelist_init(struct arena_info *arena) }/* This implies a newly created or untouched flog entry */ -if (log_new.old_map == log_new.new_map) +if (log_oldmap == log_newmap)continue ;/* Check if map recovery is needed */
@@ -579,8 +585,15 @@ static int btt_freelist_init(struct arena_info *arena) NULL, NULL, 0);if (ret)return ret; -if ((le32_to_cpu (log_new.new_map) != map_entry) && - (le32_to_cpu (log_new.old_map) == map_entry)) { + +/* +* The map_entry from btt_read_map is stripped of any flag bits, +* so use the stripped out versions from the log as well for +* testing whether recovery is needed. For restoration, use the +* 'raw' version of the log entries as that captured what we +* were going to write originally. +*/ +if ((log_newmap != map_entry) && (log_oldmap == map_entry)) {/* * Last transaction wrote the flog, but wasn't able * to complete the map write. So fix up the map.
drivers/nvdimm/btt.h +2 -0
@@ -44,6 +44,8 @@#define ent_e_flag (ent) (!!(ent & MAP_ERR_MASK))#define ent_z_flag (ent) (!!(ent & MAP_TRIM_MASK))#define set_e_flag (ent) (ent |= MAP_ERR_MASK) +/* 'normal' is both e and z flags set */ +#define ent_normal (ent) (ent_e_flag(ent) && ent_z_flag(ent))enum btt_init_state {INIT_UNCHECKED =0 ,
drivers/nvdimm/btt_devs.c +8 -0
@@ -159,11 +159,19 @@ static ssize_t size_show(struct device *dev, }static DEVICE_ATTR_RO (size); +static ssize_t log_zero_flags_show (struct device *dev, +struct device_attribute *attr,char *buf) +{ +return sprintf (buf,"Y\n" ); +} +static DEVICE_ATTR_RO (log_zero_flags); +static struct attribute *nd_btt_attributes[] = { &dev_attr_sector_size.attr, &dev_attr_namespace.attr, &dev_attr_uuid.attr, &dev_attr_size.attr, + &dev_attr_log_zero_flags.attr,NULL , };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 46/59 media: fdp1: Fix R-Car M3-N naming in debug message
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit c05b9d7b9f3ece2831e4e4829f10e904df296df8 ]
The official name is "R-Car M3-N", not "R-Car M3N".
--- drivers/media/platform/rcar_fdp1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/platform/rcar_fdp1.c +1 -1
@@ -2372,7 +2372,7 @@ static int fdp1_probe(struct platform_device *pdev)dprintk (fdp1,"FDP1 Version R-Car H3\n" );break ;case FD1_IP_M3N : -dprintk (fdp1,"FDP1 Version R-Car M3N\n" ); +dprintk (fdp1,"FDP1 Version R-Car M3-N\n" );break ;case FD1_IP_E3 :dprintk (fdp1,"FDP1 Version R-Car E3\n" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 47/59 cxgb4: free mac_hlist properly
In reply to Greg Kroah-HartmanFrom: Arjun Vynipadath <[email protected]>
[ Upstream commit 2a8d84bf513823ba398f4b2dec41b8decf4041af ]
The locally maintained list for tracking hash mac table was not freed during driver remove.
--- drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 8 ++++++++ 1 file changed, 8 insertions(+)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +8 -0
@@ -2256,6 +2256,8 @@ static int cxgb_up(struct adapter *adap)static void cxgb_down (struct adapter *adapter) { +struct hash_mac_addr *entry, *tmp; +cancel_work_sync (&adapter->tid_release_task);cancel_work_sync (&adapter->db_full_task);cancel_work_sync (&adapter->db_drop_task);
@@ -2264,6 +2266,12 @@ static void cxgb_down(struct adapter *adapter)t4_sge_stop (adapter);t4_free_sge_resources (adapter); + +list_for_each_entry_safe (entry, tmp, &adapter->mac_hlist, list) { +list_del (&entry->list); +kfree (entry); + } + adapter->flags &= ~FULL_INIT_DONE ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 48/59 cxgb4/cxgb4vf: Fix mac_hlist initialization and free
In reply to Greg Kroah-HartmanFrom: Arjun Vynipadath <[email protected]>
[ Upstream commit b539ea60f5043b9acd7562f04fa2117f18776cbb ]
Null pointer dereference seen when cxgb4vf driver is unloaded without bringing up any interfaces, moving mac_hlist initialization to driver probe and free the mac_hlist in remove to fix the issue.
--- .../net/ethernet/chelsio/cxgb4/cxgb4_main.c | 19 ++++++++++--------- .../ethernet/chelsio/cxgb4vf/cxgb4vf_main.c | 6 +++--- 2 files changed, 13 insertions(+), 12 deletions(-)
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c +10 -9
@@ -2241,8 +2241,6 @@ static int cxgb_up(struct adapter *adap)#if IS_ENABLED (CONFIG_IPV6 )update_clip (adap);#endif -/* Initialize hash mac addr list*/ -INIT_LIST_HEAD (&adap->mac_hlist);return err; irq_err:
@@ -2256,8 +2254,6 @@ static int cxgb_up(struct adapter *adap)static void cxgb_down (struct adapter *adapter) { -struct hash_mac_addr *entry, *tmp; -cancel_work_sync (&adapter->tid_release_task);cancel_work_sync (&adapter->db_full_task);cancel_work_sync (&adapter->db_drop_task);
@@ -2267,11 +2263,6 @@ static void cxgb_down(struct adapter *adapter)t4_sge_stop (adapter);t4_free_sge_resources (adapter); -list_for_each_entry_safe (entry, tmp, &adapter->mac_hlist, list) { -list_del (&entry->list); -kfree (entry); - } - adapter->flags &= ~FULL_INIT_DONE ; }
@@ -4970,6 +4961,9 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent) (is_t5 (adapter->params.chip) ?STATMODE_V (0 ) : T6_STATMODE_V(0))); +/* Initialize hash mac addr list */ +INIT_LIST_HEAD (&adapter->mac_hlist); +for_each_port (adapter, i) { netdev =alloc_etherdev_mq (sizeof (struct port_info ),MAX_ETH_QSETS );
@@ -5260,6 +5254,7 @@ static int init_one(struct pci_dev *pdev, const struct pci_device_id *ent)static void remove_one (struct pci_dev *pdev) {struct adapter *adapter =pci_get_drvdata (pdev); +struct hash_mac_addr *entry, *tmp;if (!adapter) {pci_release_regions (pdev);
@@ -5303,6 +5298,12 @@ static void remove_one(struct pci_dev *pdev)if (adapter->num_uld || adapter->num_ofld_uld)t4_uld_mem_free (adapter);free_some_resources (adapter); +list_for_each_entry_safe (entry, tmp, &adapter->mac_hlist, + list) { +list_del (&entry->list); +kfree (entry); + } +#if IS_ENABLED (CONFIG_IPV6 )t4_cleanup_clip_tbl (adapter);#endif
drivers/net/ethernet/chelsio/cxgb4vf/cxgb4vf_main.c +3 -3
@@ -715,9 +715,6 @@ static int adapter_up(struct adapter *adapter)if (adapter->flags &USING_MSIX )name_msix_vecs (adapter); -/* Initialize hash mac addr list*/ -INIT_LIST_HEAD (&adapter->mac_hlist); - adapter->flags |=FULL_INIT_DONE ; }
@@ -2936,6 +2933,9 @@ static int cxgb4vf_pci_probe(struct pci_dev *pdev,if (err) goto err_unmap_bar; +/* Initialize hash mac addr list */ +INIT_LIST_HEAD (&adapter->mac_hlist); +/* * Allocate our "adapter ports" and stitch everything together. */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 49/59 Revert "gfs2: Dont demote a glock until its revokes are written"
In reply to Greg Kroah-HartmanFrom: Bob Peterson <[email protected]>
[ Upstream commit b14c94908b1b884276a6608dea3d0b1b510338b7 ]
This reverts commit df5db5f9ee112e76b5202fbc331f990a0fc316d6.
This patch fixes a regression: patch df5db5f9ee112 allowed function run_queue() to bypass its call to do_xmote() if revokes were queued for the glock. That's wrong because its call to do_xmote() is what is responsible for calling the go_sync() glops functions to sync both the ail list and any revokes queued for it. By bypassing the call, gfs2 could get into a stand-off where the glock could not be demoted until its revokes are written back, but the revokes would not be written back because do_xmote() was never called.
It "sort of" works, however, because there are other mechanisms like the log flush daemon (logd) that can sync the ail items and revokes, if it deems it necessary. The problem is: without file system pressure, it might never deem it necessary.
--- fs/gfs2/glock.c | 3 --- 1 file changed, 3 deletions(-)
fs/gfs2/glock.c +0 -3
@@ -636,9 +636,6 @@ __acquires(&gl->gl_lockref.lock) goto out_unlock;if (nonblock) goto out_sched; -smp_mb (); -if (atomic_read (&gl->gl_revokes) !=0 ) - goto out_sched;set_bit (GLF_DEMOTE_IN_PROGRESS , &gl->gl_flags);GLOCK_BUG_ON (gl, gl->gl_demote_state ==LM_ST_EXCLUSIVE ); gl->gl_target = gl->gl_demote_state;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 50/59 staging: iio: ad2s1210: Fix SPI reading
In reply to Greg Kroah-HartmanFrom: Dragos Bogdan <[email protected]>
commit 5e4f99a6b788047b0b8a7496c2e0c8f372f6edf2 upstream.
If the serial interface is used, the 8-bit address should be latched using the rising edge of the WR/FSYNC signal.
This basically means that a CS change is required between the first byte sent, and the second one.
This change splits the single-transfer transfer of 2 bytes into 2 transfers with a single byte, and CS change in-between.
Note fixes tag is not accurate, but reflects a point beyond which there are too many refactors to make backporting straight forward.
--- drivers/staging/iio/resolver/ad2s1210.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/staging/iio/resolver/ad2s1210.c +12 -5
@@ -126,17 +126,24 @@ static int ad2s1210_config_write(structstatic int ad2s1210_config_read (struct ad2s1210_state *st,unsigned char address) { -struct spi_transfer xfer = { - .len =2 , - .rx_buf = st->rx, - .tx_buf = st->tx, +struct spi_transfer xfers[] = { + { + .len =1 , + .rx_buf = &st->rx[0 ], + .tx_buf = &st->tx[0 ], + .cs_change =1 , + }, { + .len =1 , + .rx_buf = &st->rx[1 ], + .tx_buf = &st->tx[1 ], + }, };int ret =0 ;ad2s1210_set_mode (MOD_CONFIG , st); st->tx[0 ] = address |AD2S1210_MSB_IS_HIGH ; st->tx[1 ] =AD2S1210_REG_FAULT ; - ret =spi_sync_transfer (st->sdev, &xfer,1 ); + ret =spi_sync_transfer (st->sdev, xfers,2 );if (ret <0 )return ret; st->old_data = true;
Greg Kroah-Hartman
maintainerPATCH 51/59 staging: greybus: Fix uninitialized scalar variable
In reply to Greg Kroah-HartmanFrom: Oscar Carter <[email protected]>
commit 34625c1931f8204c234c532b446b9f53c69f4b68 upstream.
In the "gb_tty_set_termios" function the "newline" variable is declared but not initialized. So the "flow_control" member is not initialized and the OR / AND operations with itself results in an undefined value in this member.
The purpose of the code is to set the flow control type, so remove the OR / AND self operator and set the value directly.
Addresses-Coverity-ID: 1374016 ("Uninitialized scalar variable")
--- drivers/staging/greybus/uart.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/greybus/uart.c +2 -2
@@ -538,9 +538,9 @@ static void gb_tty_set_termios(struct tt }if (C_CRTSCTS (tty) &&C_BAUD (tty) !=B0 ) - newline.flow_control |=GB_SERIAL_AUTO_RTSCTS_EN ; + newline.flow_control =GB_SERIAL_AUTO_RTSCTS_EN ;else - newline.flow_control &= ~GB_SERIAL_AUTO_RTSCTS_EN ; + newline.flow_control =0 ;if (memcmp (&gb_tty->line_coding, &newline,sizeof (newline))) {memcpy (&gb_tty->line_coding, &newline,sizeof (newline));
Greg Kroah-Hartman
maintainerPATCH 52/59 iio: sca3000: Remove an erroneous get_device()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
commit 928edefbc18cd8433f7df235c6e09a9306e7d580 upstream.
This looks really unusual to have a 'get_device()' hidden in a 'dev_err()' call.
Remove it.
While at it add a missing \n at the end of the message.
--- drivers/iio/accel/sca3000.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/accel/sca3000.c +1 -1
@@ -982,7 +982,7 @@ static int sca3000_read_data(struct sca3 st->tx[0 ] =SCA3000_READ_REG (reg_address_high); ret =spi_sync_transfer (st->us, xfer,ARRAY_SIZE (xfer));if (ret) { -dev_err (get_device (&st->us->dev),"problem reading register" ); +dev_err (&st->us->dev,"problem reading register\n" );return ret; }
Greg Kroah-Hartman
maintainerPATCH 53/59 iio: dac: vf610: Fix an error handling path in vf610_dac_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
commit aad4742fbf0a560c25827adb58695a4497ffc204 upstream.
A call to 'vf610_dac_exit()' is missing in an error handling path.
--- drivers/iio/dac/vf610_dac.c | 1 + 1 file changed, 1 insertion(+)
drivers/iio/dac/vf610_dac.c +1 -0
@@ -235,6 +235,7 @@ static int vf610_dac_probe(struct platforeturn 0 ; error_iio_device_register: +vf610_dac_exit (info);clk_disable_unprepare (info->clk);return ret;
Greg Kroah-Hartman
maintainerPATCH 54/59 mei: release me_cl object reference
In reply to Greg Kroah-HartmanFrom: Alexander Usyskin <[email protected]>
commit fc9c03ce30f79b71807961bfcb42be191af79873 upstream.
Allow me_cl object to be freed by releasing the reference that was acquired by one of the search functions:__mei_me_cl_by_uuid_id() or __mei_me_cl_by_uuid()
--- drivers/misc/mei/client.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/misc/mei/client.c +2 -0
@@ -276,6 +276,7 @@ void mei_me_cl_rm_by_uuid(struct mei_devdown_write (&dev->me_clients_rwsem); me_cl =__mei_me_cl_by_uuid (dev, uuid);__mei_me_cl_del (dev, me_cl); +mei_me_cl_put (me_cl);up_write (&dev->me_clients_rwsem); }
@@ -297,6 +298,7 @@ void mei_me_cl_rm_by_uuid_id(struct mei_down_write (&dev->me_clients_rwsem); me_cl =__mei_me_cl_by_uuid_id (dev, uuid, id);__mei_me_cl_del (dev, me_cl); +mei_me_cl_put (me_cl);up_write (&dev->me_clients_rwsem); }
Greg Kroah-Hartman
maintainerPATCH 55/59 rapidio: fix an error in get_user_pages_fast() error handling
In reply to Greg Kroah-HartmanFrom: John Hubbard <[email protected]>
commit ffca476a0a8d26de767cc41d62b8ca7f540ecfdd upstream.
In the case of get_user_pages_fast() returning fewer pages than requested, rio_dma_transfer() does not quite do the right thing. It attempts to release all the pages that were requested, rather than just the pages that were pinned.
Fix the error handling so that only the pages that were successfully pinned are released.
--- drivers/rapidio/devices/rio_mport_cdev.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/rapidio/devices/rio_mport_cdev.c +5 -0
@@ -904,6 +904,11 @@ rio_dma_transfer(struct file *filp, u32rmcd_error ("pinned %ld out of %ld pages" , pinned, nr_pages); ret = -EFAULT ; +/* +* Set nr_pages up to mean "how many pages to unpin, in +* the error handler: +*/ + nr_pages = pinned; goto err_pg; }
Greg Kroah-Hartman
maintainerPATCH 56/59 rxrpc: Fix a memory leak in rxkad_verify_response()
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
commit f45d01f4f30b53c3a0a1c6c1c154acb7ff74ab9f upstream.
A ticket was not released after a call of the function "rxkad_decrypt_ticket" failed. Thus replace the jump target "temporary_error_free_resp" by "temporary_error_free_ticket".
--- net/rxrpc/rxkad.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/rxrpc/rxkad.c +1 -2
@@ -1111,7 +1111,7 @@ static int rxkad_verify_response(struct ret =rxkad_decrypt_ticket (conn, skb, ticket, ticket_len, &session_key, &expiry, _abort_code);if (ret <0 ) - goto temporary_error_free_resp; + goto temporary_error_free_ticket;/* use the session key from inside the ticket to decrypt the * response */
@@ -1193,7 +1193,6 @@ protocol_error: temporary_error_free_ticket:kfree (ticket); -temporary_error_free_resp:kfree (response); temporary_error:/* Ignore the response packet if we got a temporary error such as
Greg Kroah-Hartman
maintainerPATCH 57/59 x86/unwind/orc: Fix unwind_get_return_address_ptr() for inactive tasks
In reply to Greg Kroah-HartmanFrom: Josh Poimboeuf <[email protected]>
commit 187b96db5ca79423618dfa29a05c438c34f9e1f0 upstream.
Normally, show_trace_log_lvl() scans the stack, looking for text addresses to print. In parallel, it unwinds the stack with unwind_next_frame(). If the stack address matches the pointer returned by unwind_get_return_address_ptr() for the current frame, the text address is printed normally without a question mark. Otherwise it's considered a breadcrumb (potentially from a previous call path) and it's printed with a question mark to indicate that the address is unreliable and typically can be ignored.
Since the following commit:
f1d9a2abff66 ("x86/unwind/orc: Don't skip the first frame for inactive tasks")
... for inactive tasks, show_trace_log_lvl() prints *only* unreliable addresses (prepended with '?').
That happens because, for the first frame of an inactive task, unwind_get_return_address_ptr() returns the wrong return address
pointer: one word *below* the task stack pointer. show_trace_log_lvl() starts scanning at the stack pointer itself, so it never finds the first 'reliable' address, causing only guesses to being printed.
The first frame of an inactive task isn't a normal stack frame. It's actually just an instance of 'struct inactive_task_frame' which is left behind by __switch_to_asm(). Now that this inactive frame is actually exposed to callers, fix unwind_get_return_address_ptr() to interpret it properly.
--- arch/x86/kernel/unwind_orc.c | 7 +++++++ 1 file changed, 7 insertions(+)
arch/x86/kernel/unwind_orc.c +7 -0
@@ -255,12 +255,19 @@ EXPORT_SYMBOL_GPL(unwind_get_return_addrunsigned long *unwind_get_return_address_ptr (struct unwind_state *state) { +struct task_struct *task = state->task; +if (unwind_done (state))return NULL ;if (state->regs)return &state->regs->ip; +if (task != current && state->sp == task->thread.sp) { +struct inactive_task_frame *frame = (void *)task->thread.sp; +return &frame->ret_addr; + } +if (state->sp)return (unsigned long *)state->sp -1 ;
Greg Kroah-Hartman
maintainerPATCH 58/59 iio: adc: stm32-adc: Use dma_request_chan() instead dma_request_slave_channel()
In reply to Greg Kroah-HartmanFrom: Peter Ujfalusi <[email protected]>
[ Upstream commit 735404b846dffcb320264f62b76e6f70012214dd ]
dma_request_slave_channel() is a wrapper on top of dma_request_chan() eating up the error code.
By using dma_request_chan() directly the driver can support deferred probing against DMA.
--- drivers/iio/adc/stm32-adc.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/iio/adc/stm32-adc.c +14 -2
@@ -1633,9 +1633,21 @@ static int stm32_adc_dma_request(struct iio_dev *indio_dev)struct dma_slave_config config;int ret; - adc->dma_chan =dma_request_slave_channel (&indio_dev->dev,"rx" ); -if (!adc->dma_chan) + adc->dma_chan =dma_request_chan (&indio_dev->dev,"rx" ); +if (IS_ERR (adc->dma_chan)) { + ret =PTR_ERR (adc->dma_chan); +if (ret != -ENODEV ) { +if (ret != -EPROBE_DEFER ) +dev_err (&indio_dev->dev, +"DMA channel request failed with %d\n" , + ret); +return ret; + } + +/* DMA is optional: fall back to IRQ mode */ + adc->dma_chan =NULL ;return 0 ; + } adc->rx_buf = dma_alloc_coherent(adc->dma_chan->device->dev, STM32_DMA_BUFFER_SIZE,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 59/59 iio: adc: stm32-adc: fix device used to request dma
In reply to Greg Kroah-HartmanFrom: Fabrice Gasnier <[email protected]>
[ Upstream commit 52cd91c27f3908b88e8b25aed4a4d20660abcc45 ]
DMA channel request should use device struct from platform device struct. Currently it's using iio device struct. But at this stage when probing, device struct isn't yet registered (e.g. device_register is done in iio_device_register). Since commit 71723a96b8b1 ("dmaengine: Create symlinks between DMA channels and slaves"), a warning message is printed as the links in sysfs can't be created, due to device isn't yet registered:
- Cannot create DMA slave symlink
- Cannot create DMA dma:rx symlink
Fix this by using device struct from platform device to request dma chan.
--- drivers/iio/adc/stm32-adc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iio/adc/stm32-adc.c +4 -4
@@ -1627,18 +1627,18 @@ static int stm32_adc_chan_of_init(struct iio_dev *indio_dev)return 0 ; } -static int stm32_adc_dma_request (struct iio_dev *indio_dev) +static int stm32_adc_dma_request (struct device *dev,struct iio_dev *indio_dev) {struct stm32_adc *adc =iio_priv (indio_dev);struct dma_slave_config config;int ret; - adc->dma_chan =dma_request_chan (&indio_dev->dev,"rx" ); + adc->dma_chan =dma_request_chan (dev,"rx" );if (IS_ERR (adc->dma_chan)) { ret =PTR_ERR (adc->dma_chan);if (ret != -ENODEV ) {if (ret != -EPROBE_DEFER ) -dev_err (&indio_dev->dev, +dev_err (dev,"DMA channel request failed with %d\n" , ret);return ret;
@@ -1761,7 +1761,7 @@ static int stm32_adc_probe(struct platform_device *pdev)if (ret <0 ) goto err_clk_disable; - ret =stm32_adc_dma_request (indio_dev); + ret =stm32_adc_dma_request (dev, indio_dev);if (ret <0 ) goto err_clk_disable;
Signature · 1 line
2.25.1
Jon Hunter
maintainerQuoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.182 release. There are 59 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 28 May 2020 18:36:22 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.182-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
All tests are passing for Tegra ...
Test results for stable-v4.14:
8 builds: 8 pass, 0 fail
16 boots: 16 pass, 0 fail
24 tests: 24 pass, 0 failLinux version: 4.14.182-rc1-g2c9e54b6ad6a
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04
Cheers
Jon
Signature · 1 line
nvpublic
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.182 release. There are 59 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 28 May 2020 18:36:22 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.182-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 4.14.182-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.14.y
git commit: ce8b534d70e21cb589da3731a1f61fabda583756
git describe: v4.14.181-60-gce8b534d70e2
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.14-oe/build/v4.14.181-60-gce8b534d70e2
No regressions (compared to build v4.14.181)
No fixes (compared to build v4.14.181)
Ran 25832 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- juno-r2-compat
- juno-r2-kasan
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64
- x86-kasan
Test Suites
-----------
* build
* install-android-platform-tools-r2800
* linux-log-parser
* ltp-containers-tests
* ltp-fs-tests
* ltp-commands-tests
* ltp-math-tests
* ltp-syscalls-tests
* kselftest
* kselftest/drivers
* kselftest/filesystems
* kselftest/net
* kselftest/networking
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-cpuhotplug-tests
* ltp-crypto-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-open-posix-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* network-basic-tests
* perf
* v4l2-compliance
* kvm-unit-tests
* install-android-platform-tools-r2600
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-native/drivers
* kselftest-vsyscall-mode-native/filesystems
* kselftest-vsyscall-mode-native/net
* kselftest-vsyscall-mode-native/networking
* kselftest-vsyscall-mode-none
* kselftest-vsyscall-mode-none/drivers
* kselftest-vsyscall-mode-none/filesystems
* kselftest-vsyscall-mode-none/net
* kselftest-vsyscall-mode-none/networking
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.182 release. There are 59 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 28 May 2020 18:36:22 +0000. Anything received after that time might be too late.
Build results:
total: 171 pass: 171 fail: 0 Qemu test results: total: 408 pass: 408 fail: 0
Guenter
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.182 release. There are 59 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu, 28 May 2020 18:36:22 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.182-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah