x86/uaccess, kcov: Disable stack protector
Subsystems (9)
Sasha Levin
maintainerPATCH 1/60 x86/uaccess, kcov: Disable stack protector
From: Peter Zijlstra <[email protected]>
[ Upstream commit 40ea97290b08be2e038b31cbb33097d1145e8169 ]
New tooling noticed this mishap:
kernel/kcov.o: warning: objtool: write_comp_data()+0x138: call to __stack_chk_fail() with UACCESS enabled kernel/kcov.o: warning: objtool: __sanitizer_cov_trace_pc()+0xd9: call to __stack_chk_fail() with UACCESS enabled
All the other instrumentation (KASAN,UBSAN) also have stack protector disabled.
--- kernel/Makefile | 1 + 1 file changed, 1 insertion(+)
kernel/Makefile +1 -0
@@ -30,6 +30,7 @@ KCOV_INSTRUMENT_extable.o := n # Don't self-instrument. KCOV_INSTRUMENT_kcov.o := n KASAN_SANITIZE_kcov.o := n +CFLAGS_kcov.o := $(call cc-option, -fno-conserve-stack -fno-stack-protector) # cond_syscall is currently not LTO compatible CFLAGS_sys_ni.o = $(DISABLE_LTO)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 2/60 ALSA: seq: Protect in-kernel ioctl calls with mutex
From: Takashi Iwai <[email protected]>
[ Upstream commit feb689025fbb6f0aa6297d3ddf97de945ea4ad32 ]
ALSA OSS sequencer calls the ioctl function indirectly via snd_seq_kernel_client_ctl(). While we already applied the protection against races between the normal ioctls and writes via the client's ioctl_mutex, this code path was left untouched. And this seems to be the cause of still remaining some rare UAF as spontaneously triggered by syzkaller.
For the sake of robustness, wrap the ioctl_mutex also for the call via snd_seq_kernel_client_ctl(), too.
--- sound/core/seq/seq_clientmgr.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
sound/core/seq/seq_clientmgr.c +7 -2
@@ -2343,14 +2343,19 @@ int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg) {const struct ioctl_handler *handler;struct snd_seq_client *client; +int err; client =clientptr (clientid);if (client ==NULL )return -ENXIO ;for (handler = ioctl_handlers; handler->cmd >0 ; ++handler) { -if (handler->cmd == cmd) -return handler->func (client, arg); +if (handler->cmd == cmd) { +mutex_lock (&client->ioctl_mutex); + err = handler->func (client, arg); +mutex_unlock (&client->ioctl_mutex); +return err; + } } pr_debug("ALSA: seq unknown ioctl() 0x%x (type='%c', number=0x%02x)\n",
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 3/60 ALSA: seq: Fix race of get-subscription call vs port-delete ioctls
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 2eabc5ec8ab4d4748a82050dfcb994119b983750 ]
The snd_seq_ioctl_get_subscription() retrieves the port subscriber information as a pointer, while the object isn't protected, hence it may be deleted before the actual reference. This race was spotted by syzkaller and may lead to a UAF.
The fix is simply copying the data in the lookup function that performs in the rwsem to protect against the deletion.
--- sound/core/seq/seq_clientmgr.c | 10 ++-------- sound/core/seq/seq_ports.c | 13 ++++++++----- sound/core/seq/seq_ports.h | 5 +++-- 3 files changed, 13 insertions(+), 15 deletions(-)
sound/core/seq/seq_clientmgr.c +2 -8
@@ -1900,20 +1900,14 @@ static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client,int result;struct snd_seq_client *sender =NULL ;struct snd_seq_client_port *sport =NULL ; -struct snd_seq_subscribers *p; result = -EINVAL ;if ((sender =snd_seq_client_use_ptr (subs->sender.client)) ==NULL ) goto __end;if ((sport =snd_seq_port_use_ptr (sender, subs->sender.port)) ==NULL ) goto __end; - p =snd_seq_port_get_subscription (&sport->c_src, &subs->dest); -if (p) { - result =0 ; - *subs = p->info; - }else - result = -ENOENT ; - + result =snd_seq_port_get_subscription (&sport->c_src, &subs->dest, + subs); __end:if (sport)snd_seq_port_unlock (sport);
sound/core/seq/seq_ports.c +8 -5
@@ -635,20 +635,23 @@ int snd_seq_port_disconnect(struct snd_seq_client *connector,/* get matched subscriber */ -struct snd_seq_subscribers *snd_seq_port_get_subscription (struct snd_seq_port_subs_info *src_grp, -struct snd_seq_addr *dest_addr) +int snd_seq_port_get_subscription (struct snd_seq_port_subs_info *src_grp, +struct snd_seq_addr *dest_addr, +struct snd_seq_port_subscribe *subs) { -struct snd_seq_subscribers *s, *found =NULL ; +struct snd_seq_subscribers *s; +int err = -ENOENT ;down_read (&src_grp->list_mutex);list_for_each_entry (s, &src_grp->list_head, src_list) {if (addr_match (dest_addr, &s->info.dest)) { - found = s; + *subs = s->info; + err =0 ;break ; } }up_read (&src_grp->list_mutex); -return found; +return err; }/*
sound/core/seq/seq_ports.h +3 -2
@@ -135,7 +135,8 @@ int snd_seq_port_subscribe(struct snd_seq_client_port *port, struct snd_seq_port_subscribe *info);/* get matched subscriber */ -struct snd_seq_subscribers *snd_seq_port_get_subscription (struct snd_seq_port_subs_info *src_grp, -struct snd_seq_addr *dest_addr); +int snd_seq_port_get_subscription (struct snd_seq_port_subs_info *src_grp, +struct snd_seq_addr *dest_addr, +struct snd_seq_port_subscribe *subs);#endif
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 4/60 Revert "ALSA: seq: Protect in-kernel ioctl calls with mutex"
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit f0654ba94e33699b295ce4f3dc73094db6209035 ]
This reverts commit feb689025fbb6f0aa6297d3ddf97de945ea4ad32.
The fix attempt was incorrect, leading to the mutex deadlock through the close of OSS sequencer client. The proper fix needs more consideration, so let's revert it now.
--- sound/core/seq/seq_clientmgr.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
sound/core/seq/seq_clientmgr.c +2 -7
@@ -2337,19 +2337,14 @@ int snd_seq_kernel_client_ctl(int clientid, unsigned int cmd, void *arg) {const struct ioctl_handler *handler;struct snd_seq_client *client; -int err; client =clientptr (clientid);if (client ==NULL )return -ENXIO ;for (handler = ioctl_handlers; handler->cmd >0 ; ++handler) { -if (handler->cmd == cmd) { -mutex_lock (&client->ioctl_mutex); - err = handler->func (client, arg); -mutex_unlock (&client->ioctl_mutex); -return err; - } +if (handler->cmd == cmd) +return handler->func (client, arg); } pr_debug("ALSA: seq unknown ioctl() 0x%x (type='%c', number=0x%02x)\n",
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 5/60 ALSA: seq: Cover unsubscribe_port() in list_mutex
In reply to Sasha LevinFrom: Takashi Iwai <[email protected]>
[ Upstream commit 7c32ae35fbf9cffb7aa3736f44dec10c944ca18e ]
The call of unsubscribe_port() which manages the group count and module refcount from delete_and_unsubscribe_port() looks racy; it's not covered by the group list lock, and it's likely a cause of the reported unbalance at port deletion. Let's move the call inside the group list_mutex to plug the hole.
--- sound/core/seq/seq_ports.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/seq/seq_ports.c +1 -1
@@ -550,10 +550,10 @@ static void delete_and_unsubscribe_port(struct snd_seq_client *client,list_del_init (list); grp->exclusive =0 ;write_unlock_irq (&grp->list_lock); -up_write (&grp->list_mutex);if (!empty)unsubscribe_port (client, port, grp, &subs->info, ack); +up_write (&grp->list_mutex); }/* connect two ports */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 6/60 driver core: platform: Fix the usage of platform device name(pdev->name)
In reply to Sasha LevinFrom: Venkata Narendra Kumar Gutta <[email protected]>
[ Upstream commit edb16da34b084c66763f29bee42b4e6bb33c3d66 ]
Platform core is using pdev->name as the platform device name to do the binding of the devices with the drivers. But, when the platform driver overrides the platform device name with dev_set_name(), the pdev->name is pointing to a location which is freed and becomes an invalid parameter to do the binding match.
use-after-free instance:
[ 33.325013] BUG: KASAN: use-after-free in strcmp+0x8c/0xb0 [ 33.330646] Read of size 1 at addr ffffffc10beae600 by task modprobe [ 33.339068] CPU: 5 PID: 518 Comm: modprobe Tainted: G S W O 4.19.30+ #3 [ 33.346835] Hardware name: MTP (DT) [ 33.350419] Call trace: [ 33.352941] dump_backtrace+0x0/0x3b8 [ 33.356713] show_stack+0x24/0x30 [ 33.360119] dump_stack+0x160/0x1d8 [ 33.363709] print_address_description+0x84/0x2e0 [ 33.368549] kasan_report+0x26c/0x2d0 [ 33.372322] __asan_report_load1_noabort+0x2c/0x38 [ 33.377248] strcmp+0x8c/0xb0 [ 33.380306] platform_match+0x70/0x1f8 [ 33.384168] __driver_attach+0x78/0x3a0 [ 33.388111] bus_for_each_dev+0x13c/0x1b8 [ 33.392237] driver_attach+0x4c/0x58 [ 33.395910] bus_add_driver+0x350/0x560 [ 33.399854] driver_register+0x23c/0x328 [ 33.403886] __platform_driver_register+0xd0/0xe0
So, use dev_name(&pdev->dev), which fetches the platform device name from the kobject(dev->kobj->name) of the device instead of the pdev->name.
--- drivers/base/platform.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/base/platform.c +4 -4
@@ -888,7 +888,7 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *a,if (len != -ENODEV )return len; - len =snprintf (buf,PAGE_SIZE ,"platform:%s\n" , pdev->name); + len =snprintf (buf,PAGE_SIZE ,"platform:%s\n" ,dev_name (&pdev->dev));return (len >=PAGE_SIZE ) ? (PAGE_SIZE -1 ) : len; }
@@ -964,7 +964,7 @@ static int platform_uevent(struct device *dev, struct kobj_uevent_env *env)return rc;add_uevent_var (env,"MODALIAS=%s%s" ,PLATFORM_MODULE_PREFIX , - pdev->name); +dev_name (&pdev->dev));return 0 ; }
@@ -973,7 +973,7 @@ static const struct platform_device_id *platform_match_id( struct platform_device *pdev) {while (id->name[0 ]) { -if (strcmp (pdev->name, id->name) ==0 ) { +if (strcmp (dev_name (&pdev->dev), id->name) ==0 ) { pdev->id_entry = id;return id; }
@@ -1017,7 +1017,7 @@ static int platform_match(struct device *dev, struct device_driver *drv)return platform_match_id (pdrv->id_table, pdev) !=NULL ;/* fall-back to driver name match */ -return (strcmp (pdev->name, drv->name) ==0 ); +return (strcmp (dev_name (&pdev->dev), drv->name) ==0 ); }#ifdef CONFIG_PM_SLEEP
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerRe: [PATCH AUTOSEL 5.1 06/60] driver core: platform: Fix the usage of platform device name(pdev->name)
Quoted 36 lines · Sasha Levin
From: Venkata Narendra Kumar Gutta <[email protected]>
[ Upstream commit
edb16da34b084c66763f29bee42b4e6bb33c3d66]Platform core is using
pdev->nameas the platform device name to do the binding of the devices with the drivers. But, when the platform driver overrides the platform device name withdev_set_name(), thepdev->nameis pointing to a location which is freed and becomes an invalid parameter to do the binding match.use-after-free instance:
[ 33.325013] BUG: KASAN: use-after-free in strcmp+0x8c/0xb0 [ 33.330646] Read of size 1 at addr ffffffc10beae600 by task modprobe [ 33.339068] CPU: 5 PID: 518 Comm: modprobe Tainted: G S W O 4.19.30+ #3 [ 33.346835] Hardware name: MTP (DT) [ 33.350419] Call trace: [ 33.352941] dump_backtrace+0x0/0x3b8 [ 33.356713] show_stack+0x24/0x30 [ 33.360119] dump_stack+0x160/0x1d8 [ 33.363709] print_address_description+0x84/0x2e0 [ 33.368549] kasan_report+0x26c/0x2d0 [ 33.372322] __asan_report_load1_noabort+0x2c/0x38 [ 33.377248] strcmp+0x8c/0xb0 [ 33.380306] platform_match+0x70/0x1f8 [ 33.384168] __driver_attach+0x78/0x3a0 [ 33.388111] bus_for_each_dev+0x13c/0x1b8 [ 33.392237] driver_attach+0x4c/0x58 [ 33.395910] bus_add_driver+0x350/0x560 [ 33.399854] driver_register+0x23c/0x328 [ 33.403886] __platform_driver_register+0xd0/0xe0So, use
dev_name(&pdev->dev), which fetches the platform device name from thekobject(dev->kobj->name)of the device instead of thepdev->name.
Quoted 6 lines
Signed-off-by Venkata Narendra Kumar Gutta <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/base/platform.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Please drop this from everywhere as it was reverted from Linus's tree because it causes big problems.
thanks,
greg k-h
Sasha Levin
maintainerRe: [PATCH AUTOSEL 5.1 06/60] driver core: platform: Fix the usage of platform device name(pdev->name)
Quoted 44 lines · Greg Kroah-Hartman
Quoted 36 lines · Sasha Levin
From: Venkata Narendra Kumar Gutta <[email protected]>
[ Upstream commit
edb16da34b084c66763f29bee42b4e6bb33c3d66]Platform core is using
pdev->nameas the platform device name to do the binding of the devices with the drivers. But, when the platform driver overrides the platform device name withdev_set_name(), thepdev->nameis pointing to a location which is freed and becomes an invalid parameter to do the binding match.use-after-free instance:
[ 33.325013] BUG: KASAN: use-after-free in strcmp+0x8c/0xb0 [ 33.330646] Read of size 1 at addr ffffffc10beae600 by task modprobe [ 33.339068] CPU: 5 PID: 518 Comm: modprobe Tainted: G S W O 4.19.30+ #3 [ 33.346835] Hardware name: MTP (DT) [ 33.350419] Call trace: [ 33.352941] dump_backtrace+0x0/0x3b8 [ 33.356713] show_stack+0x24/0x30 [ 33.360119] dump_stack+0x160/0x1d8 [ 33.363709] print_address_description+0x84/0x2e0 [ 33.368549] kasan_report+0x26c/0x2d0 [ 33.372322] __asan_report_load1_noabort+0x2c/0x38 [ 33.377248] strcmp+0x8c/0xb0 [ 33.380306] platform_match+0x70/0x1f8 [ 33.384168] __driver_attach+0x78/0x3a0 [ 33.388111] bus_for_each_dev+0x13c/0x1b8 [ 33.392237] driver_attach+0x4c/0x58 [ 33.395910] bus_add_driver+0x350/0x560 [ 33.399854] driver_register+0x23c/0x328 [ 33.403886] __platform_driver_register+0xd0/0xe0So, use
dev_name(&pdev->dev), which fetches the platform device name from thekobject(dev->kobj->name)of the device instead of thepdev->name.Quoted 6 lines
Signed-off-by Venkata Narendra Kumar Gutta <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- drivers/base/platform.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
Quoted 2 lines
Please drop this from everywhere as it was reverted from Linus's tree because it causes big problems.
Dropped from all branches, thanks!
--
Thanks,
Sasha
Sasha Levin
maintainerPATCH 7/60 Drivers: misc: fix out-of-bounds access in function param_set_kgdbts_var
In reply to Sasha LevinFrom: Young Xiao <[email protected]>
[ Upstream commit b281218ad4311a0342a40cb02fb17a363df08b48 ]
There is an out-of-bounds access to "config[len - 1]" array when the variable "len" is zero.
See commit dada6a43b040 ("kgdboc: fix KASAN global-out-of-bounds bug in param_set_kgdboc_var()") for details.
--- drivers/misc/kgdbts.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/misc/kgdbts.c +2 -2
@@ -1135,7 +1135,7 @@ static void kgdbts_put_char(u8 chr)static int param_set_kgdbts_var (const char *kmessage,const struct kernel_param *kp) { -int len =strlen (kmessage); +size_t len =strlen (kmessage);if (len >=MAX_CONFIG_LEN ) {printk (KERN_ERR "kgdbts: config string too long\n" );
@@ -1155,7 +1155,7 @@ static int param_set_kgdbts_var(const char *kmessage,strcpy (config, kmessage);/* Chop out \n char as a result of echo */ -if (config[len -1 ] =='\n' ) +if (len && config[len -1 ] =='\n' ) config[len -1 ] ='\0' ;/* Go and configure with the new params. */
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 8/60 configfs: fix possible use-after-free in configfs_register_group
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit 35399f87e271f7cf3048eab00a421a6519ac8441 ]
In configfs_register_group(), if create_default_group() failed, we forget to unlink the group. It will left a invalid item in the parent list, which may trigger the use-after-free issue seen below:
BUG: KASAN: use-after-free in __list_add_valid+0xd4/0xe0 lib/list_debug.c:26
Read of size 8 at addr ffff8881ef61ae20 by task syz-executor.0/5996
CPU: 1 PID: 5996 Comm: syz-executor.0 Tainted: G C 5.0.0+ #5
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0xa9/0x10e lib/dump_stack.c:113
print_address_description+0x65/0x270 mm/kasan/report.c:187
kasan_report+0x149/0x18d mm/kasan/report.c:317
__list_add_valid+0xd4/0xe0 lib/list_debug.c:26
__list_add include/linux/list.h:60 [inline]
list_add_tail include/linux/list.h:93 [inline]
link_obj+0xb0/0x190 fs/configfs/dir.c:759
link_group+0x1c/0x130 fs/configfs/dir.c:784
configfs_register_group+0x56/0x1e0 fs/configfs/dir.c:1751
configfs_register_default_group+0x72/0xc0 fs/configfs/dir.c:1834
? 0xffffffffc1be0000
iio_sw_trigger_init+0x23/0x1000 [industrialio_sw_trigger]
do_one_initcall+0xbc/0x47d init/main.c:887
do_init_module+0x1b5/0x547 kernel/module.c:3456
load_module+0x6405/0x8c10 kernel/module.c:3804
__do_sys_finit_module+0x162/0x190 kernel/module.c:3898
do_syscall_64+0x9f/0x450 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x462e99
Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f494ecbcc58 EFLAGS: 00000246 ORIG_RAX: 0000000000000139
RAX: ffffffffffffffda RBX: 000000000073bf00 RCX: 0000000000462e99
RDX: 0000000000000000 RSI: 0000000020000180 RDI: 0000000000000003
RBP: 00007f494ecbcc70 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f494ecbd6bc
R13: 00000000004bcefa R14: 00000000006f6fb0 R15: 0000000000000004
Allocated by task 5987:
set_track mm/kasan/common.c:87 [inline]
__kasan_kmalloc.constprop.3+0xa0/0xd0 mm/kasan/common.c:497
kmalloc include/linux/slab.h:545 [inline]
kzalloc include/linux/slab.h:740 [inline]
configfs_register_default_group+0x4c/0xc0 fs/configfs/dir.c:1829
0xffffffffc1bd0023
do_one_initcall+0xbc/0x47d init/main.c:887
do_init_module+0x1b5/0x547 kernel/module.c:3456
load_module+0x6405/0x8c10 kernel/module.c:3804
__do_sys_finit_module+0x162/0x190 kernel/module.c:3898
do_syscall_64+0x9f/0x450 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
Freed by task 5987:
set_track mm/kasan/common.c:87 [inline]
__kasan_slab_free+0x130/0x180 mm/kasan/common.c:459
slab_free_hook mm/slub.c:1429 [inline]
slab_free_freelist_hook mm/slub.c:1456 [inline]
slab_free mm/slub.c:3003 [inline]
kfree+0xe1/0x270 mm/slub.c:3955
configfs_register_default_group+0x9a/0xc0 fs/configfs/dir.c:1836
0xffffffffc1bd0023
do_one_initcall+0xbc/0x47d init/main.c:887
do_init_module+0x1b5/0x547 kernel/module.c:3456
load_module+0x6405/0x8c10 kernel/module.c:3804
__do_sys_finit_module+0x162/0x190 kernel/module.c:3898
do_syscall_64+0x9f/0x450 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
The buggy address belongs to the object at ffff8881ef61ae00
which belongs to the cache kmalloc-192 of size 192
The buggy address is located 32 bytes inside of
192-byte region [ffff8881ef61ae00, ffff8881ef61aec0)
The buggy address belongs to the page:
page:ffffea0007bd8680 count:1 mapcount:0 mapping:ffff8881f6c03000 index:0xffff8881ef61a700
flags: 0x2fffc0000000200(slab)
raw: 02fffc0000000200 ffffea0007ca4740 0000000500000005 ffff8881f6c03000
raw: ffff8881ef61a700 000000008010000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8881ef61ad00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8881ef61ad80: 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc fc
>ffff8881ef61ae00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881ef61ae80: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc
ffff8881ef61af00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb--- fs/configfs/dir.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
fs/configfs/dir.c +12 -5
@@ -1755,12 +1755,19 @@ int configfs_register_group(struct config_group *parent_group,inode_lock_nested (d_inode (parent),I_MUTEX_PARENT ); ret =create_default_group (parent_group, group); -if (!ret) { -spin_lock (&configfs_dirent_lock); -configfs_dir_set_ready (group->cg_item.ci_dentry->d_fsdata); -spin_unlock (&configfs_dirent_lock); - } +if (ret) + goto err_out; + +spin_lock (&configfs_dirent_lock); +configfs_dir_set_ready (group->cg_item.ci_dentry->d_fsdata); +spin_unlock (&configfs_dirent_lock); +inode_unlock (d_inode (parent)); +return 0 ; +err_out:inode_unlock (d_inode (parent)); +mutex_lock (&subsys->su_mutex); +unlink_group (group); +mutex_unlock (&subsys->su_mutex);return ret; }EXPORT_SYMBOL (configfs_register_group);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 9/60 f2fs: fix to avoid accessing xattr across the boundary
In reply to Sasha LevinFrom: Randall Huang <[email protected]>
[ Upstream commit 2777e654371dd4207a3a7f4fb5fa39550053a080 ]
When we traverse xattr entries via __find_xattr(),
if the raw filesystem content is faked or any hardware failure occurs, out-of-bound error can be detected by KASAN.
Fix the issue by introducing boundary check.
[ 38.402878] c7 1827 BUG: KASAN: slab-out-of-bounds in f2fs_getxattr+0x518/0x68c [ 38.402891] c7 1827 Read of size 4 at addr ffffffc0b6fb35dc by task [ 38.402935] c7 1827 Call trace: [ 38.402952] c7 1827 [<ffffff900809003c>] dump_backtrace+0x0/0x6bc [ 38.402966] c7 1827 [<ffffff9008090030>] show_stack+0x20/0x2c [ 38.402981] c7 1827 [<ffffff900871ab10>] dump_stack+0xfc/0x140 [ 38.402995] c7 1827 [<ffffff9008325c40>] print_address_description+0x80/0x2d8 [ 38.403009] c7 1827 [<ffffff900832629c>] kasan_report_error+0x198/0x1fc [ 38.403022] c7 1827 [<ffffff9008326104>] kasan_report_error+0x0/0x1fc [ 38.403037] c7 1827 [<ffffff9008325000>] __asan_load4+0x1b0/0x1b8 [ 38.403051] c7 1827 [<ffffff90085fcc44>] f2fs_getxattr+0x518/0x68c [ 38.403066] c7 1827 [<ffffff90085fc508>] f2fs_xattr_generic_get+0xb0/0xd0 [ 38.403080] c7 1827 [<ffffff9008395708>] __vfs_getxattr+0x1f4/0x1fc [ 38.403096] c7 1827 [<ffffff9008621bd0>] inode_doinit_with_dentry+0x360/0x938 [ 38.403109] c7 1827 [<ffffff900862d6cc>] selinux_d_instantiate+0x2c/0x38 [ 38.403123] c7 1827 [<ffffff900861b018>] security_d_instantiate+0x68/0x98 [ 38.403136] c7 1827 [<ffffff9008377db8>] d_splice_alias+0x58/0x348 [ 38.403149] c7 1827 [<ffffff900858d16c>] f2fs_lookup+0x608/0x774 [ 38.403163] c7 1827 [<ffffff900835eacc>] lookup_slow+0x1e0/0x2cc [ 38.403177] c7 1827 [<ffffff9008367fe0>] walk_component+0x160/0x520 [ 38.403190] c7 1827 [<ffffff9008369ef4>] path_lookupat+0x110/0x2b4 [ 38.403203] c7 1827 [<ffffff900835dd38>] filename_lookup+0x1d8/0x3a8 [ 38.403216] c7 1827 [<ffffff900835eeb0>] user_path_at_empty+0x54/0x68 [ 38.403229] c7 1827 [<ffffff9008395f44>] SyS_getxattr+0xb4/0x18c [ 38.403241] c7 1827 [<ffffff9008084200>] el0_svc_naked+0x34/0x38
--- fs/f2fs/xattr.c | 36 +++++++++++++++++++++++++++--------- fs/f2fs/xattr.h | 2 ++ 2 files changed, 29 insertions(+), 9 deletions(-)
fs/f2fs/xattr.c +27 -9
@@ -202,12 +202,17 @@ static inline const struct xattr_handler *f2fs_xattr_handler(int index)return handler; } -static struct f2fs_xattr_entry *__find_xattr (void *base_addr,int index, -size_t len,const char *name) +static struct f2fs_xattr_entry *__find_xattr (void *base_addr, +void *last_base_addr,int index, +size_t len,const char *name) {struct f2fs_xattr_entry *entry;list_for_each_xattr (entry, base_addr) { +if ((void *)(entry) +sizeof (__u32) > last_base_addr || + (void *)XATTR_NEXT_ENTRY (entry) > last_base_addr) +return NULL ; +if (entry->e_name_index != index)continue ;if (entry->e_name_len != len)
@@ -297,20 +302,22 @@ static int lookup_all_xattrs(struct inode *inode, struct page *ipage, const char *name, struct f2fs_xattr_entry **xe, void **base_addr, int *base_size) { - void *cur_addr, *txattr_addr, *last_addr = NULL; + void *cur_addr, *txattr_addr, *last_txattr_addr; +void *last_addr =NULL ;nid_t xnid =F2FS_I (inode)->i_xattr_nid; -unsigned int size = xnid ?VALID_XATTR_BLOCK_SIZE :0 ;unsigned int inline_size =inline_xattr_size (inode);int err =0 ; -if (!size && !inline_size) +if (!xnid && !inline_size)return -ENODATA ; - *base_size = inline_size + size +XATTR_PADDING_SIZE ; + *base_size =XATTR_SIZE (xnid, inode) +XATTR_PADDING_SIZE ; txattr_addr =f2fs_kzalloc (F2FS_I_SB (inode), *base_size,GFP_NOFS );if (!txattr_addr)return -ENOMEM ; + last_txattr_addr = (void *)txattr_addr +XATTR_SIZE (xnid, inode); +/* read from inline xattr */ if (inline_size) { err =read_inline_xattr (inode, ipage, txattr_addr);
@@ -337,7 +344,11 @@ static int lookup_all_xattrs(struct inode *inode, struct page *ipage,else cur_addr = txattr_addr; - *xe =__find_xattr (cur_addr, index, len, name); + *xe =__find_xattr (cur_addr, last_txattr_addr, index, len, name); +if (!*xe) { + err = -EFAULT ; + goto out; + } check:if (IS_XATTR_LAST_ENTRY (*xe)) { err = -ENODATA ;
@@ -581,7 +592,8 @@ static int __f2fs_setxattr(struct inode *inode, int index, struct page *ipage, int flags) {struct f2fs_xattr_entry *here, *last; -void *base_addr; +void *base_addr, *last_base_addr; +nid_t xnid =F2FS_I (inode)->i_xattr_nid;int found, newsize;size_t len;__u32 new_hsize;
@@ -605,8 +617,14 @@ static int __f2fs_setxattr(struct inode *inode, int index,if (error)return error; + last_base_addr = (void *)base_addr +XATTR_SIZE (xnid, inode); +/* find entry with wanted name. */ - here =__find_xattr (base_addr, index, len, name); + here =__find_xattr (base_addr, last_base_addr, index, len, name); +if (!here) { + error = -EFAULT ; + goto exit; + } found =IS_XATTR_LAST_ENTRY (here) ?0 :1 ;
fs/f2fs/xattr.h +2 -0
@@ -71,6 +71,8 @@ struct f2fs_xattr_entry { entry = XATTR_NEXT_ENTRY(entry))#define VALID_XATTR_BLOCK_SIZE (PAGE_SIZE - sizeof(struct node_footer))#define XATTR_PADDING_SIZE (sizeof(__u32)) +#define XATTR_SIZE (x,i) (((x) ? VALID_XATTR_BLOCK_SIZE : 0) + \ + (inline_xattr_size(i)))#define MIN_OFFSET (i) XATTR_ALIGN(inline_xattr_size(i) + \ VALID_XATTR_BLOCK_SIZE)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 10/60 ipc: prevent lockup on alloc_msg and free_msg
In reply to Sasha LevinFrom: Li Rongqing <[email protected]>
[ Upstream commit d6a2946a88f524a47cc9b79279667137899db807 ]
msgctl10 of ltp triggers the following lockup When CONFIG_KASAN is enabled on large memory SMP systems, the pages initialization can take a long time, if msgctl10 requests a huge block memory, and it will block rcu scheduler, so release cpu actively.
After adding schedule() in free_msg, free_msg can not be called when holding spinlock, so adding msg to a tmp list, and free it out of spinlock
rcu: INFO: rcu_preempt detected stalls on CPUs/tasks: rcu: Tasks blocked on level-1 rcu_node (CPUs 16-31): P32505 rcu: Tasks blocked on level-1 rcu_node (CPUs 48-63): P34978 rcu: (detected by 11, t=35024 jiffies, g=44237529, q=16542267) msgctl10 R running task 21608 32505 2794 0x00000082 Call Trace: preempt_schedule_irq+0x4c/0xb0 retint_kernel+0x1b/0x2d RIP: 0010:__is_insn_slot_addr+0xfb/0x250 Code: 82 1d 00 48 8b 9b 90 00 00 00 4c 89 f7 49 c1 ee 03 e8 59 83 1d 00 48 b8 00 00 00 00 00 fc ff df 4c 39 eb 48 89 9d 58 ff ff ff <41> c6 04 06 f8 74 66 4c 8d 75 98 4c 89 f1 48 c1 e9 03 48 01 c8 48 RSP: 0018:ffff88bce041f758 EFLAGS: 00000246 ORIG_RAX: ffffffffffffff13 RAX: dffffc0000000000 RBX: ffffffff8471bc50 RCX: ffffffff828a2a57 RDX: dffffc0000000000 RSI: dffffc0000000000 RDI: ffff88bce041f780 RBP: ffff88bce041f828 R08: ffffed15f3f4c5b3 R09: ffffed15f3f4c5b3 R10: 0000000000000001 R11: ffffed15f3f4c5b2 R12: 000000318aee9b73 R13: ffffffff8471bc50 R14: 1ffff1179c083ef0 R15: 1ffff1179c083eec kernel_text_address+0xc1/0x100 __kernel_text_address+0xe/0x30 unwind_get_return_address+0x2f/0x50 __save_stack_trace+0x92/0x100 create_object+0x380/0x650 __kmalloc+0x14c/0x2b0 load_msg+0x38/0x1a0 do_msgsnd+0x19e/0xcf0 do_syscall_64+0x117/0x400 entry_SYSCALL_64_after_hwframe+0x49/0xbe rcu: INFO: rcu_preempt detected stalls on CPUs/tasks: rcu: Tasks blocked on level-1 rcu_node (CPUs 0-15): P32170 rcu: (detected by 14, t=35016 jiffies, g=44237525, q=12423063) msgctl10 R running task 21608 32170 32155 0x00000082 Call Trace: preempt_schedule_irq+0x4c/0xb0 retint_kernel+0x1b/0x2d RIP: 0010:lock_acquire+0x4d/0x340 Code: 48 81 ec c0 00 00 00 45 89 c6 4d 89 cf 48 8d 6c 24 20 48 89 3c 24 48 8d bb e4 0c 00 00 89 74 24 0c 48 c7 44 24 20 b3 8a b5 41 <48> c1 ed 03 48 c7 44 24 28 b4 25 18 84 48 c7 44 24 30 d0 54 7a 82 RSP: 0018:ffff88af83417738 EFLAGS: 00000282 ORIG_RAX: ffffffffffffff13 RAX: dffffc0000000000 RBX: ffff88bd335f3080 RCX: 0000000000000002 RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88bd335f3d64 RBP: ffff88af83417758 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000001 R11: ffffed13f3f745b2 R12: 0000000000000000 R13: 0000000000000002 R14: 0000000000000000 R15: 0000000000000000 is_bpf_text_address+0x32/0xe0 kernel_text_address+0xec/0x100 __kernel_text_address+0xe/0x30 unwind_get_return_address+0x2f/0x50 __save_stack_trace+0x92/0x100 save_stack+0x32/0xb0 __kasan_slab_free+0x130/0x180 kfree+0xfa/0x2d0 free_msg+0x24/0x50 do_msgrcv+0x508/0xe60 do_syscall_64+0x117/0x400 entry_SYSCALL_64_after_hwframe+0x49/0xbe
Davidlohr said:
"So after releasing the lock, the msg rbtree/list is empty and new
calls will not see those in the newly populated tmp_msg list, and therefore they cannot access the delayed msg freeing pointers, which is good. Also the fact that the node_cache is now freed before the actual messages seems to be harmless as this is wanted for msg_insert() avoiding GFP_ATOMIC allocations, and after releasing the info->lock the thing is freed anyway so it should not change things"
--- ipc/mqueue.c | 10 ++++++++-- ipc/msgutil.c | 6 ++++++ 2 files changed, 14 insertions(+), 2 deletions(-)
ipc/mqueue.c +8 -2
@@ -436,7 +436,8 @@ static void mqueue_evict_inode(struct inode *inode)struct user_struct *user;unsigned long mq_bytes, mq_treesize;struct ipc_namespace *ipc_ns; -struct msg_msg *msg; +struct msg_msg *msg, *nmsg; +LIST_HEAD (tmp_msg);clear_inode (inode);
@@ -447,10 +448,15 @@ static void mqueue_evict_inode(struct inode *inode) info =MQUEUE_I (inode);spin_lock (&info->lock);while ((msg =msg_get (info)) !=NULL ) -free_msg (msg); +list_add_tail (&msg->m_list, &tmp_msg);kfree (info->node_cache);spin_unlock (&info->lock); +list_for_each_entry_safe (msg, nmsg, &tmp_msg, m_list) { +list_del (&msg->m_list); +free_msg (msg); + } +/* Total amount of bytes accounted for the mqueue */ mq_treesize = info->attr.mq_maxmsg *sizeof (struct msg_msg ) + min_t(unsigned int, info->attr.mq_maxmsg, MQ_PRIO_MAX) *
ipc/msgutil.c +6 -0
@@ -18,6 +18,7 @@#include <linux/utsname.h> #include <linux/proc_ns.h> #include <linux/uaccess.h> +#include <linux/sched.h> #include "util.h"
@@ -64,6 +65,9 @@ static struct msg_msg *alloc_msg(size_t len) pseg = &msg->next;while (len >0 ) {struct msg_msgseg *seg; + +cond_resched (); + alen =min (len,DATALEN_SEG ); seg =kmalloc (sizeof (*seg) + alen,GFP_KERNEL_ACCOUNT );if (seg ==NULL )
@@ -176,6 +180,8 @@ void free_msg(struct msg_msg *msg)kfree (msg);while (seg !=NULL ) {struct msg_msgseg *tmp = seg->next; + +cond_resched ();kfree (seg); seg = tmp; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 11/60 drivers/perf: arm_spe: Don't error on high-order pages for aux buf
In reply to Sasha LevinFrom: Will Deacon <[email protected]>
[ Upstream commit 14ae42a6f0b13130a97d94d23481128961de5d38 ]
Since commit 5768402fd9c6 ("perf/ring_buffer: Use high order allocations for AUX buffers optimistically"), the perf core tends to back aux buffer allocations with high-order pages with the order encoded in the PagePrivate data. The Arm SPE driver explicitly rejects such pages, causing the perf tool to fail with:
| failed to mmap with 12 (Cannot allocate memory)
In actual fact, we can simply treat these pages just like any other since the perf core takes care to populate the page array appropriately. In theory we could try to map with PMDs where possible, but for now, let's just get things working again.
--- drivers/perf/arm_spe_pmu.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-)
drivers/perf/arm_spe_pmu.c +1 -9
@@ -855,16 +855,8 @@ static void *arm_spe_pmu_setup_aux(struct perf_event *event, void **pages,if (!pglist) goto out_free_buf; -for (i =0 ; i < nr_pages; ++i) { -struct page *page =virt_to_page (pages[i]); - -if (PagePrivate (page)) { -pr_warn ("unexpected high-order page for auxbuf!" ); - goto out_free_pglist; - } - +for (i =0 ; i < nr_pages; ++i) pglist[i] =virt_to_page (pages[i]); - } buf->base =vmap (pglist, nr_pages,VM_MAP ,PAGE_KERNEL );if (!buf->base)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 12/60 bpf: sockmap, only stop/flush strp if it was enabled at some point
In reply to Sasha LevinFrom: John Fastabend <[email protected]>
[ Upstream commit 014894360ec95abe868e94416b3dd6569f6e2c0c ]
If we try to call strp_done on a parser that has never been initialized, because the sockmap user is only using TX side for example we get the following error.
[ 883.422081] WARNING: CPU: 1 PID: 208 at kernel/workqueue.c:3030 __flush_work+0x1ca/0x1e0 ... [ 883.422095] Workqueue: events sk_psock_destroy_deferred [ 883.422097] RIP: 0010:__flush_work+0x1ca/0x1e0
This had been wrapped in a 'if (psock->parser.enabled)' logic which was broken because the strp_done() was never actually being called because we do a strp_stop() earlier in the tear down logic will set parser.enabled to false. This could result in a use after free if work was still in the queue and was resolved by the patch here, 1d79895aef18f ("sk_msg: Always cancel strp work before freeing the psock"). However, calling strp_stop(), done by the patch marked in the fixes tag, only is useful if we never initialized a strp parser program and never initialized the strp to start with. Because if we had initialized a stream parser strp_stop() would have been called by sk_psock_drop() earlier in the tear down process. By forcing the strp to stop we get past the WARNING in strp_done that checks the stopped flag but calling cancel_work_sync on work that has never been initialized is also wrong and generates the warning above.
To fix check if the parser program exists. If the program exists then the strp work has been initialized and must be sync'd and cancelled before free'ing any structures. If no program exists we never initialized the stream parser in the first place so skip the sync/cancel logic implemented by strp_done.
Finally, remove the strp_done its not needed and in the case where we are using the stream parser has already been called.
--- net/core/skmsg.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/core/skmsg.c +4 -2
@@ -554,8 +554,10 @@ static void sk_psock_destroy_deferred(struct work_struct *gc) struct sk_psock *psock = container_of(gc, struct sk_psock, gc);/* No sk_callback_lock since already detached. */ -strp_stop (&psock->parser.strp); -strp_done (&psock->parser.strp); + +/* Parser has been stopped */ +if (psock->progs.skb_parser) +strp_done (&psock->parser.strp);cancel_work_sync (&psock->work);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 13/60 bpf: sockmap remove duplicate queue free
In reply to Sasha LevinFrom: John Fastabend <[email protected]>
[ Upstream commit c42253cc88206fd0e9868c8b2fd7f9e79f9e0e03 ]
In tcp bpf remove we free the cork list and purge the ingress msg list. However we do this before the ref count reaches zero so it could be possible some other access is in progress. In this case (tcp close and/or tcp_unhash) we happen to also hold the sock lock so no path exists but lets fix it otherwise it is extremely fragile and breaks the reference counting rules. Also we already check the cork list and ingress msg queue and free them once the ref count reaches zero so its wasteful to check twice.
--- net/ipv4/tcp_bpf.c | 2 -- 1 file changed, 2 deletions(-)
net/ipv4/tcp_bpf.c +0 -2
@@ -528,8 +528,6 @@ static void tcp_bpf_remove(struct sock *sk, struct sk_psock *psock) {struct sk_psock_link *link; -sk_psock_cork_free (psock); -__sk_psock_purge_ingress_msg (psock);while ((link =sk_psock_link_pop (psock))) {sk_psock_unlink (sk, link);sk_psock_free_link (link);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 14/60 bpf: sockmap fix msg->sg.size account on ingress skb
In reply to Sasha LevinFrom: John Fastabend <[email protected]>
[ Upstream commit cabede8b4f2b746232aa25730a0b752de1cb82ca ]
When converting a skb to msg->sg we forget to set the size after the latest ktls/tls code conversion. This patch can be reached by doing a redir into ingress path from BPF skb sock recv hook. Then trying to read the size fails.
Fix this by setting the size.
--- net/core/skmsg.c | 1 + 1 file changed, 1 insertion(+)
net/core/skmsg.c +1 -0
@@ -411,6 +411,7 @@ static int sk_psock_skb_ingress(struct sk_psock *psock, struct sk_buff *skb)sk_mem_charge (sk, skb->len); copied = skb->len; msg->sg.start =0 ; + msg->sg.size = copied; msg->sg.end = num_sge ==MAX_MSG_FRAGS ?0 : num_sge; msg->skb = skb;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 15/60 scsi: qla2xxx: Add cleanup for PCI EEH recovery
In reply to Sasha LevinFrom: Quinn Tran <[email protected]>
[ Upstream commit 5386a4e6c7fecd282d265a24d930a74ba3c5917b ]
During EEH error recovery testing it was discovered that driver's reset() callback partially frees resources used by driver, leaving some stale memory. After reset() is done and when resume() callback in driver uses old data which results into error leaving adapter disabled due to PCIe error.
This patch does cleanup for EEH recovery code path and prevents adapter from getting disabled.
--- drivers/scsi/qla2xxx/qla_os.c | 221 +++++++++++++--------------------- 1 file changed, 82 insertions(+), 139 deletions(-)
drivers/scsi/qla2xxx/qla_os.c +82 -139
@@ -6838,6 +6838,78 @@ qla2x00_release_firmware(void)mutex_unlock (&qla_fw_lock); } +static void qla_pci_error_cleanup (scsi_qla_host_t *vha) +{ +struct qla_hw_data *ha = vha->hw; +scsi_qla_host_t *base_vha =pci_get_drvdata (ha->pdev); +struct qla_qpair *qpair =NULL ; +struct scsi_qla_host *vp; +fc_port_t *fcport; +int i; +unsigned long flags; + + ha->chip_reset++; + + ha->base_qpair->chip_reset = ha->chip_reset; +for (i =0 ; i < ha->max_qpairs; i++) { +if (ha->queue_pair_map[i]) + ha->queue_pair_map[i]->chip_reset = + ha->base_qpair->chip_reset; + } + +/* purge MBox commands */ +if (atomic_read (&ha->num_pend_mbx_stage3)) { +clear_bit (MBX_INTR_WAIT , &ha->mbx_cmd_flags); +complete (&ha->mbx_intr_comp); + } + + i =0 ; + +while (atomic_read (&ha->num_pend_mbx_stage3) || +atomic_read (&ha->num_pend_mbx_stage2) || +atomic_read (&ha->num_pend_mbx_stage1)) { +msleep (20 ); + i++; +if (i >50 ) +break ; + } + + ha->flags.purge_mbox =0 ; + +mutex_lock (&ha->mq_lock); +list_for_each_entry (qpair, &base_vha->qp_list, qp_list_elem) + qpair->online =0 ; +mutex_unlock (&ha->mq_lock); + +qla2x00_mark_all_devices_lost (vha,0 ); + +spin_lock_irqsave (&ha->vport_slock, flags); +list_for_each_entry (vp, &ha->vp_list, list) { +atomic_inc (&vp->vref_count); +spin_unlock_irqrestore (&ha->vport_slock, flags); +qla2x00_mark_all_devices_lost (vp,0 ); +spin_lock_irqsave (&ha->vport_slock, flags); +atomic_dec (&vp->vref_count); + } +spin_unlock_irqrestore (&ha->vport_slock, flags); + +/* Clear all async request states across all VPs. */ +list_for_each_entry (fcport, &vha->vp_fcports, list) + fcport->flags &= ~(FCF_LOGIN_NEEDED |FCF_ASYNC_SENT ); + +spin_lock_irqsave (&ha->vport_slock, flags); +list_for_each_entry (vp, &ha->vp_list, list) { +atomic_inc (&vp->vref_count); +spin_unlock_irqrestore (&ha->vport_slock, flags); +list_for_each_entry (fcport, &vp->vp_fcports, list) + fcport->flags &= ~(FCF_LOGIN_NEEDED |FCF_ASYNC_SENT ); +spin_lock_irqsave (&ha->vport_slock, flags); +atomic_dec (&vp->vref_count); + } +spin_unlock_irqrestore (&ha->vport_slock, flags); +} + +static pci_ers_result_t qla2xxx_pci_error_detected (struct pci_dev *pdev,pci_channel_state_t state) {
@@ -6863,20 +6935,7 @@ qla2xxx_pci_error_detected(struct pci_dev *pdev, pci_channel_state_t state)return PCI_ERS_RESULT_CAN_RECOVER ;case pci_channel_io_frozen: ha->flags.eeh_busy =1 ; -/* For ISP82XX complete any pending mailbox cmd */ -if (IS_QLA82XX (ha)) { - ha->flags.isp82xx_fw_hung =1 ; -ql_dbg (ql_dbg_aer, vha,0x9001 ,"Pci channel io frozen\n" ); -qla82xx_clear_pending_mbx (vha); - } -qla2x00_free_irqs (vha); -pci_disable_device (pdev); -/* Return back all IOs */ -qla2x00_abort_all_cmds (vha,DID_RESET <<16 ); -if (ql2xmqsupport || ql2xnvmeenable) { -set_bit (QPAIR_ONLINE_CHECK_NEEDED , &vha->dpc_flags); -qla2xxx_wake_dpc (vha); - } +qla_pci_error_cleanup (vha);return PCI_ERS_RESULT_NEED_RESET ;case pci_channel_io_perm_failure: ha->flags.pci_channel_io_perm_failure =1 ;
@@ -6930,122 +6989,14 @@ qla2xxx_pci_mmio_enabled(struct pci_dev *pdev)return PCI_ERS_RESULT_RECOVERED ; } -static uint32_t -qla82xx_error_recovery (scsi_qla_host_t *base_vha) -{ -uint32_t rval =QLA_FUNCTION_FAILED ; -uint32_t drv_active =0 ; -struct qla_hw_data *ha = base_vha->hw; -int fn; -struct pci_dev *other_pdev =NULL ; - -ql_dbg (ql_dbg_aer, base_vha,0x9006 , -"Entered %s.\n" , __func__); - -set_bit (ABORT_ISP_ACTIVE , &base_vha->dpc_flags); - -if (base_vha->flags.online) { -/* Abort all outstanding commands, -* so as to be requeued later */ -qla2x00_abort_isp_cleanup (base_vha); - } - - - fn =PCI_FUNC (ha->pdev->devfn); -while (fn >0 ) { - fn--; -ql_dbg (ql_dbg_aer, base_vha,0x9007 , -"Finding pci device at function = 0x%x.\n" , fn); - other_pdev = -pci_get_domain_bus_and_slot (pci_domain_nr (ha->pdev->bus), - ha->pdev->bus->number,PCI_DEVFN (PCI_SLOT (ha->pdev->devfn), - fn)); - -if (!other_pdev) -continue ; -if (atomic_read (&other_pdev->enable_cnt)) { -ql_dbg (ql_dbg_aer, base_vha,0x9008 , -"Found PCI func available and enable at 0x%x.\n" , - fn); -pci_dev_put (other_pdev); -break ; - } -pci_dev_put (other_pdev); - } - -if (!fn) { -/* Reset owner */ -ql_dbg (ql_dbg_aer, base_vha,0x9009 , -"This devfn is reset owner = 0x%x.\n" , - ha->pdev->devfn); -qla82xx_idc_lock (ha); - -qla82xx_wr_32 (ha,QLA82XX_CRB_DEV_STATE , -QLA8XXX_DEV_INITIALIZING ); - -qla82xx_wr_32 (ha,QLA82XX_CRB_DRV_IDC_VERSION , -QLA82XX_IDC_VERSION ); - - drv_active =qla82xx_rd_32 (ha,QLA82XX_CRB_DRV_ACTIVE ); -ql_dbg (ql_dbg_aer, base_vha,0x900a , -"drv_active = 0x%x.\n" , drv_active); - -qla82xx_idc_unlock (ha); -/* Reset if device is not already reset -* drv_active would be 0 if a reset has already been done -*/ -if (drv_active) - rval =qla82xx_start_firmware (base_vha); -else - rval =QLA_SUCCESS ; -qla82xx_idc_lock (ha); - -if (rval !=QLA_SUCCESS ) { -ql_log (ql_log_info, base_vha,0x900b , -"HW State: FAILED.\n" ); -qla82xx_clear_drv_active (ha); -qla82xx_wr_32 (ha,QLA82XX_CRB_DEV_STATE , -QLA8XXX_DEV_FAILED ); - }else { -ql_log (ql_log_info, base_vha,0x900c , -"HW State: READY.\n" ); -qla82xx_wr_32 (ha,QLA82XX_CRB_DEV_STATE , -QLA8XXX_DEV_READY ); -qla82xx_idc_unlock (ha); - ha->flags.isp82xx_fw_hung =0 ; - rval =qla82xx_restart_isp (base_vha); -qla82xx_idc_lock (ha); -/* Clear driver state register */ -qla82xx_wr_32 (ha,QLA82XX_CRB_DRV_STATE ,0 ); -qla82xx_set_drv_active (base_vha); - } -qla82xx_idc_unlock (ha); - }else { -ql_dbg (ql_dbg_aer, base_vha,0x900d , -"This devfn is not reset owner = 0x%x.\n" , - ha->pdev->devfn); -if ((qla82xx_rd_32 (ha,QLA82XX_CRB_DEV_STATE ) == -QLA8XXX_DEV_READY )) { - ha->flags.isp82xx_fw_hung =0 ; - rval =qla82xx_restart_isp (base_vha); -qla82xx_idc_lock (ha); -qla82xx_set_drv_active (base_vha); -qla82xx_idc_unlock (ha); - } - } -clear_bit (ABORT_ISP_ACTIVE , &base_vha->dpc_flags); - -return rval; -} -static pci_ers_result_t qla2xxx_pci_slot_reset (struct pci_dev *pdev) {pci_ers_result_t ret =PCI_ERS_RESULT_DISCONNECT ;scsi_qla_host_t *base_vha =pci_get_drvdata (pdev);struct qla_hw_data *ha = base_vha->hw; -struct rsp_que *rsp; -int rc, retries =10 ; +int rc; +struct qla_qpair *qpair =NULL ;ql_dbg (ql_dbg_aer, base_vha,0x9004 ,"Slot Reset.\n" );
@@ -7074,24 +7025,16 @@ qla2xxx_pci_slot_reset(struct pci_dev *pdev) goto exit_slot_reset; } - rsp = ha->rsp_q_map[0 ]; -if (qla2x00_request_irqs (ha, rsp)) - goto exit_slot_reset;if (ha->isp_ops->pci_config (base_vha)) goto exit_slot_reset; -if (IS_QLA82XX (ha)) { -if (qla82xx_error_recovery (base_vha) ==QLA_SUCCESS ) { - ret =PCI_ERS_RESULT_RECOVERED ; - goto exit_slot_reset; - }else - goto exit_slot_reset; - } - -while (ha->flags.mbox_busy && retries--) -msleep (1000 ); +mutex_lock (&ha->mq_lock); +list_for_each_entry (qpair, &base_vha->qp_list, qp_list_elem) + qpair->online =1 ; +mutex_unlock (&ha->mq_lock); + base_vha->flags.online =1 ;set_bit (ABORT_ISP_ACTIVE , &base_vha->dpc_flags);if (ha->isp_ops->abort_isp (base_vha) ==QLA_SUCCESS ) ret =PCI_ERS_RESULT_RECOVERED ;
@@ -7115,13 +7058,13 @@ qla2xxx_pci_resume(struct pci_dev *pdev)ql_dbg (ql_dbg_aer, base_vha,0x900f ,"pci_resume.\n" ); + ha->flags.eeh_busy =0 ; + ret =qla2x00_wait_for_hba_online (base_vha);if (ret !=QLA_SUCCESS ) {ql_log (ql_log_fatal, base_vha,0x9002 ,"The device failed to resume I/O from slot/link_reset.\n" ); } - - ha->flags.eeh_busy =0 ; } static void
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 16/60 scsi: qedi: remove memset/memcpy to nfunc and use func instead
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit c09581a52765a85f19fc35340127396d5e3379cc ]
KASAN reports this:
BUG: KASAN: global-out-of-bounds in qedi_dbg_err+0xda/0x330 [qedi] Read of size 31 at addr ffffffffc12b0ae0 by task syz-executor.0/2429 CPU: 0 PID: 2429 Comm: syz-executor.0 Not tainted 5.0.0-rc7+ #45 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0xfa/0x1ce lib/dump_stack.c:113 print_address_description+0x1c4/0x270 mm/kasan/report.c:187 kasan_report+0x149/0x18d mm/kasan/report.c:317 memcpy+0x1f/0x50 mm/kasan/common.c:130 qedi_dbg_err+0xda/0x330 [qedi] ? 0xffffffffc12d0000 qedi_init+0x118/0x1000 [qedi] ? 0xffffffffc12d0000 ? 0xffffffffc12d0000 ? 0xffffffffc12d0000 do_one_initcall+0xfa/0x5ca init/main.c:887 do_init_module+0x204/0x5f6 kernel/module.c:3460 load_module+0x66b2/0x8570 kernel/module.c:3808 __do_sys_finit_module+0x238/0x2a0 kernel/module.c:3902 do_syscall_64+0x147/0x600 arch/x86/entry/common.c:290 entry_SYSCALL_64_after_hwframe+0x49/0xbe RIP: 0033:0x462e99 Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48 RSP: 002b:00007f2d57e55c58 EFLAGS: 00000246 ORIG_RAX: 0000000000000139 RAX: ffffffffffffffda RBX: 000000000073bfa0 RCX: 0000000000462e99 RDX: 0000000000000000 RSI: 00000000200003c0 RDI: 0000000000000003 RBP: 00007f2d57e55c70 R08: 0000000000000000 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000246 R12: 00007f2d57e566bc R13: 00000000004bcefb R14: 00000000006f7030 R15: 0000000000000004 The buggy address belongs to the variable: __func__.67584+0x0/0xffffffffffffd520 [qedi] Memory state around the buggy address: ffffffffc12b0980: fa fa fa fa 00 04 fa fa fa fa fa fa 00 00 05 fa ffffffffc12b0a00: fa fa fa fa 00 00 04 fa fa fa fa fa 00 05 fa fa
Quoted 1 line
ffffffffc12b0a80: fa fa fa fa 00 06 fa fa fa fa fa fa 00 02 fa fa
^
ffffffffc12b0b00: fa fa fa fa 00 00 04 fa fa fa fa fa 00 00 03 fa
ffffffffc12b0b80: fa fa fa fa 00 00 02 fa fa fa fa fa 00 00 04 fa
Currently the qedi_dbg_* family of functions can overrun the end of the source string if it is less than the destination buffer length because of the use of a fixed sized memcpy. Remove the memset/memcpy calls to nfunc and just use func instead as it is always a null terminated string.
--- drivers/scsi/qedi/qedi_dbg.c | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-)
drivers/scsi/qedi/qedi_dbg.c +8 -24
@@ -16,10 +16,6 @@ qedi_dbg_err(struct qedi_dbg_ctx *qedi, const char *func, u32 line, {va_list va;struct va_format vaf; -char nfunc[32 ]; - -memset (nfunc,0 ,sizeof (nfunc)); -memcpy (nfunc, func,sizeof (nfunc) -1 );va_start (va, fmt);
@@ -28,9 +24,9 @@ qedi_dbg_err(struct qedi_dbg_ctx *qedi, const char *func, u32 line,if (likely (qedi) &&likely (qedi->pdev))pr_err ("[%s]:[%s:%d]:%d: %pV" ,dev_name (&qedi->pdev->dev), - nfunc, line, qedi->host_no, &vaf); + func, line, qedi->host_no, &vaf);else -pr_err ("[0000:00:00.0]:[%s:%d]: %pV" , nfunc, line, &vaf); +pr_err ("[0000:00:00.0]:[%s:%d]: %pV" , func, line, &vaf);va_end (va); }
@@ -41,10 +37,6 @@ qedi_dbg_warn(struct qedi_dbg_ctx *qedi, const char *func, u32 line, {va_list va;struct va_format vaf; -char nfunc[32 ]; - -memset (nfunc,0 ,sizeof (nfunc)); -memcpy (nfunc, func,sizeof (nfunc) -1 );va_start (va, fmt);
@@ -56,9 +48,9 @@ qedi_dbg_warn(struct qedi_dbg_ctx *qedi, const char *func, u32 line,if (likely (qedi) &&likely (qedi->pdev))pr_warn ("[%s]:[%s:%d]:%d: %pV" ,dev_name (&qedi->pdev->dev), - nfunc, line, qedi->host_no, &vaf); + func, line, qedi->host_no, &vaf);else -pr_warn ("[0000:00:00.0]:[%s:%d]: %pV" , nfunc, line, &vaf); +pr_warn ("[0000:00:00.0]:[%s:%d]: %pV" , func, line, &vaf); ret:va_end (va);
@@ -70,10 +62,6 @@ qedi_dbg_notice(struct qedi_dbg_ctx *qedi, const char *func, u32 line, {va_list va;struct va_format vaf; -char nfunc[32 ]; - -memset (nfunc,0 ,sizeof (nfunc)); -memcpy (nfunc, func,sizeof (nfunc) -1 );va_start (va, fmt);
@@ -85,10 +73,10 @@ qedi_dbg_notice(struct qedi_dbg_ctx *qedi, const char *func, u32 line,if (likely (qedi) &&likely (qedi->pdev))pr_notice ("[%s]:[%s:%d]:%d: %pV" , -dev_name (&qedi->pdev->dev), nfunc, line, +dev_name (&qedi->pdev->dev), func, line, qedi->host_no, &vaf);else -pr_notice ("[0000:00:00.0]:[%s:%d]: %pV" , nfunc, line, &vaf); +pr_notice ("[0000:00:00.0]:[%s:%d]: %pV" , func, line, &vaf); ret:va_end (va);
@@ -100,10 +88,6 @@ qedi_dbg_info(struct qedi_dbg_ctx *qedi, const char *func, u32 line, {va_list va;struct va_format vaf; -char nfunc[32 ]; - -memset (nfunc,0 ,sizeof (nfunc)); -memcpy (nfunc, func,sizeof (nfunc) -1 );va_start (va, fmt);
@@ -115,9 +99,9 @@ qedi_dbg_info(struct qedi_dbg_ctx *qedi, const char *func, u32 line,if (likely (qedi) &&likely (qedi->pdev))pr_info ("[%s]:[%s:%d]:%d: %pV" ,dev_name (&qedi->pdev->dev), - nfunc, line, qedi->host_no, &vaf); + func, line, qedi->host_no, &vaf);else -pr_info ("[0000:00:00.0]:[%s:%d]: %pV" , nfunc, line, &vaf); +pr_info ("[0000:00:00.0]:[%s:%d]: %pV" , func, line, &vaf); ret:va_end (va);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 17/60 scsi: qedi: remove set but not used variables 'cdev' and 'udev'
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit d0adee5d12752256ff0c87ad7f002f21fe49d618 ]
Fixes gcc '-Wunused-but-set-variable' warning:
drivers/scsi/qedi/qedi_iscsi.c: In function 'qedi_ep_connect':drivers/scsi/qedi/qedi_iscsi.c:813:23: warning: variable 'udev' set but not used [-Wunused-but-set-variable] drivers/scsi/qedi/qedi_iscsi.c:812:18: warning: variable 'cdev' set but not used [-Wunused-but-set-variable]
These have never been used since introduction.
--- drivers/scsi/qedi/qedi_iscsi.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/scsi/qedi/qedi_iscsi.c +0 -4
@@ -809,8 +809,6 @@ qedi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr,struct qedi_endpoint *qedi_ep;struct sockaddr_in *addr;struct sockaddr_in6 *addr6; -struct qed_dev *cdev =NULL ; -struct qedi_uio_dev *udev =NULL ;struct iscsi_path path_req;u32 msg_type =ISCSI_KEVENT_IF_DOWN ;u32 iscsi_cid =QEDI_CID_RESERVED ;
@@ -830,8 +828,6 @@ qedi_ep_connect(struct Scsi_Host *shost, struct sockaddr *dst_addr, } qedi =iscsi_host_priv (shost); - cdev = qedi->cdev; - udev = qedi->udev;if (test_bit (QEDI_IN_OFFLINE , &qedi->flags) ||test_bit (QEDI_IN_RECOVERY , &qedi->flags)) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 18/60 scsi: lpfc: resolve lockdep warnings
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit e2a8be5696e706a2fce6edd11e5c74ce14cffec0 ]
There were a number of erroneous comments and incorrect older lockdep checks that were causing a number of warnings.
Resolve the following:
- Inconsistent lock state warnings in lpfc_nvme_info_show().
- Fixed comments and code on sequences where ring lock is now held instead of hbalock.
- Reworked calling sequences around lpfc_sli_iocbq_lookup(). Rather than locking prior to the routine and have routine guess on what lock, take the lock within the routine. The lockdep check becomes unnecessary.
- Fixed comments and removed erroneous hbalock checks.
--- drivers/scsi/lpfc/lpfc_attr.c | 5 ++- drivers/scsi/lpfc/lpfc_sli.c | 84 ++++++++++++++++++++++------------- 2 files changed, 56 insertions(+), 33 deletions(-)
drivers/scsi/lpfc/lpfc_attr.c +3 -2
@@ -159,6 +159,7 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,int i;int len =0 ;char tmp[LPFC_MAX_NVME_INFO_TMP_LEN ] = {0 }; +unsigned long iflags =0 ;if (!(vport->cfg_enable_fc4_type &LPFC_ENABLE_NVME )) { len =scnprintf (buf,PAGE_SIZE ,"NVME Disabled\n" );
@@ -357,11 +358,11 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) { nrport =NULL ; -spin_lock (&vport->phba->hbalock); +spin_lock_irqsave (&vport->phba->hbalock, iflags); rport =lpfc_ndlp_get_nrport (ndlp);if (rport) nrport = rport->remoteport; -spin_unlock (&vport->phba->hbalock); +spin_unlock_irqrestore (&vport->phba->hbalock, iflags);if (!nrport)continue ;
drivers/scsi/lpfc/lpfc_sli.c +53 -31
215 lines not on this page · raw message
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 19/60 scsi: lpfc: correct rcu unlock issue in lpfc_nvme_info_show
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit 79080d349f7f58a2e86c56043a3d04184d5f294a ]
Many of the exit cases were not releasing the rcu read lock. Corrected the exit paths.
--- drivers/scsi/lpfc/lpfc_attr.c | 32 +++++++++++++++++++------------- 1 file changed, 19 insertions(+), 13 deletions(-)
drivers/scsi/lpfc/lpfc_attr.c +19 -13
@@ -338,7 +338,7 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, phba->sli4_hba.io_xri_max, lpfc_sli4_get_els_iocb_cnt(phba));if (strlcat (buf, tmp,PAGE_SIZE ) >=PAGE_SIZE ) - goto buffer_done; + goto rcu_unlock_buf_done;/* Port state is only one of two values for now. */ if (localport->port_id)
@@ -354,7 +354,7 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,wwn_to_u64 (vport->fc_nodename.u.wwn), localport->port_id, statep);if (strlcat (buf, tmp,PAGE_SIZE ) >=PAGE_SIZE ) - goto buffer_done; + goto rcu_unlock_buf_done;list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) { nrport =NULL ;
@@ -381,39 +381,39 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,/* Tab in to show lport ownership. */ if (strlcat (buf,"NVME RPORT " ,PAGE_SIZE ) >=PAGE_SIZE ) - goto buffer_done; + goto rcu_unlock_buf_done;if (phba->brd_no >=10 ) {if (strlcat (buf," " ,PAGE_SIZE ) >=PAGE_SIZE ) - goto buffer_done; + goto rcu_unlock_buf_done; }scnprintf (tmp,sizeof (tmp),"WWPN x%llx " , nrport->port_name);if (strlcat (buf, tmp,PAGE_SIZE ) >=PAGE_SIZE ) - goto buffer_done; + goto rcu_unlock_buf_done;scnprintf (tmp,sizeof (tmp),"WWNN x%llx " , nrport->node_name);if (strlcat (buf, tmp,PAGE_SIZE ) >=PAGE_SIZE ) - goto buffer_done; + goto rcu_unlock_buf_done;scnprintf (tmp,sizeof (tmp),"DID x%06x " , nrport->port_id);if (strlcat (buf, tmp,PAGE_SIZE ) >=PAGE_SIZE ) - goto buffer_done; + goto rcu_unlock_buf_done;/* An NVME rport can have multiple roles. */ if (nrport->port_role &FC_PORT_ROLE_NVME_INITIATOR ) {if (strlcat (buf,"INITIATOR " ,PAGE_SIZE ) >=PAGE_SIZE ) - goto buffer_done; + goto rcu_unlock_buf_done; }if (nrport->port_role &FC_PORT_ROLE_NVME_TARGET ) {if (strlcat (buf,"TARGET " ,PAGE_SIZE ) >=PAGE_SIZE ) - goto buffer_done; + goto rcu_unlock_buf_done; }if (nrport->port_role &FC_PORT_ROLE_NVME_DISCOVERY ) {if (strlcat (buf,"DISCSRVC " ,PAGE_SIZE ) >=PAGE_SIZE ) - goto buffer_done; + goto rcu_unlock_buf_done; } if (nrport->port_role & ~(FC_PORT_ROLE_NVME_INITIATOR | FC_PORT_ROLE_NVME_TARGET |
@@ -421,12 +421,12 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr,scnprintf (tmp,sizeof (tmp),"UNKNOWN ROLE x%x" , nrport->port_role);if (strlcat (buf, tmp,PAGE_SIZE ) >=PAGE_SIZE ) - goto buffer_done; + goto rcu_unlock_buf_done; }scnprintf (tmp,sizeof (tmp),"%s\n" , statep);if (strlcat (buf, tmp,PAGE_SIZE ) >=PAGE_SIZE ) - goto buffer_done; + goto rcu_unlock_buf_done; }rcu_read_unlock ();
@@ -488,7 +488,13 @@ lpfc_nvme_info_show(struct device *dev, struct device_attribute *attr, atomic_read(&lport->cmpl_fcp_err));strlcat (buf, tmp,PAGE_SIZE ); -buffer_done: +/* RCU is already unlocked. */ + goto buffer_done; + + rcu_unlock_buf_done: +rcu_read_unlock (); + + buffer_done: len =strnlen (buf,PAGE_SIZE );if (unlikely (len >= (PAGE_SIZE -1 ))) {
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 20/60 scsi: lpfc: add check for loss of ndlp when sending RRQ
In reply to Sasha LevinFrom: James Smart <[email protected]>
[ Upstream commit c8cb261a072c88ca1aff0e804a30db4c7606521b ]
There was a missing qualification of a valid ndlp structure when calling to send an RRQ for an abort. Add the check.
--- drivers/scsi/lpfc/lpfc_els.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/lpfc/lpfc_els.c +4 -1
@@ -7338,7 +7338,10 @@ int lpfc_send_rrq(struct lpfc_hba *phba, struct lpfc_node_rrq *rrq) { struct lpfc_nodelist *ndlp = lpfc_findnode_did(rrq->vport, - rrq->nlp_DID); + rrq->nlp_DID); +if (!ndlp) +return 1 ; +if (lpfc_test_rrq_active (phba, ndlp, rrq->xritag))return lpfc_issue_els_rrq (rrq->vport, ndlp, rrq->nlp_DID, rrq);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 21/60 arm64: Print physical address of page table base in show_pte()
In reply to Sasha LevinFrom: Will Deacon <[email protected]>
[ Upstream commit 48caebf7e1313eb9f0a06fe59a07ac05b38a5806 ]
When dumping the page table in response to an unexpected kernel page fault, we print the virtual (hashed) address of the page table base, but display physical addresses for everything else.
Make the page table dumping code in show_pte() consistent, by printing the page table base pointer as a physical address.
--- arch/arm64/mm/fault.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/arm64/mm/fault.c +3 -2
@@ -171,9 +171,10 @@ void show_pte(unsigned long addr)return ; } -pr_alert ("%s pgtable: %luk pages, %u-bit VAs, pgdp = %p\n" , +pr_alert ("%s pgtable: %luk pages, %u-bit VAs, pgdp=%016lx\n" , mm == &init_mm ?"swapper" :"user" ,PAGE_SIZE /SZ_1K , - mm == &init_mm ?VA_BITS : (int ) vabits_user, mm->pgd); + mm == &init_mm ?VA_BITS : (int )vabits_user, + (unsigned long )virt_to_phys (mm->pgd)); pgdp =pgd_offset (mm, addr); pgd =READ_ONCE (*pgdp);pr_alert ("[%016lx] pgd=%016llx" , addr,pgd_val (pgd));
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 22/60 net: macb: fix error format in dev_err()
In reply to Sasha LevinFrom: Luca Ceresoli <[email protected]>
[ Upstream commit f413cbb332a0b5251a790f396d0eb4ebcade5dec ]
Errors are negative numbers. Using %u shows them as very large positive numbers such as 4294967277 that don't make sense. Use the %d format instead, and get a much nicer -19.
--- drivers/net/ethernet/cadence/macb_main.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/net/ethernet/cadence/macb_main.c +8 -8
@@ -3377,7 +3377,7 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk,if (!err) err = -ENODEV ; -dev_err (&pdev->dev,"failed to get macb_clk (%u)\n" , err); +dev_err (&pdev->dev,"failed to get macb_clk (%d)\n" , err);return err; }
@@ -3386,7 +3386,7 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk,if (!err) err = -ENODEV ; -dev_err (&pdev->dev,"failed to get hclk (%u)\n" , err); +dev_err (&pdev->dev,"failed to get hclk (%d)\n" , err);return err; }
@@ -3404,31 +3404,31 @@ static int macb_clk_init(struct platform_device *pdev, struct clk **pclk, err =clk_prepare_enable (*pclk);if (err) { -dev_err (&pdev->dev,"failed to enable pclk (%u)\n" , err); +dev_err (&pdev->dev,"failed to enable pclk (%d)\n" , err);return err; } err =clk_prepare_enable (*hclk);if (err) { -dev_err (&pdev->dev,"failed to enable hclk (%u)\n" , err); +dev_err (&pdev->dev,"failed to enable hclk (%d)\n" , err); goto err_disable_pclk; } err =clk_prepare_enable (*tx_clk);if (err) { -dev_err (&pdev->dev,"failed to enable tx_clk (%u)\n" , err); +dev_err (&pdev->dev,"failed to enable tx_clk (%d)\n" , err); goto err_disable_hclk; } err =clk_prepare_enable (*rx_clk);if (err) { -dev_err (&pdev->dev,"failed to enable rx_clk (%u)\n" , err); +dev_err (&pdev->dev,"failed to enable rx_clk (%d)\n" , err); goto err_disable_txclk; } err =clk_prepare_enable (*tsu_clk);if (err) { -dev_err (&pdev->dev,"failed to enable tsu_clk (%u)\n" , err); +dev_err (&pdev->dev,"failed to enable tsu_clk (%d)\n" , err); goto err_disable_rxclk; }
@@ -3902,7 +3902,7 @@ static int at91ether_clk_init(struct platform_device *pdev, struct clk **pclk, err =clk_prepare_enable (*pclk);if (err) { -dev_err (&pdev->dev,"failed to enable pclk (%u)\n" , err); +dev_err (&pdev->dev,"failed to enable pclk (%d)\n" , err);return err; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 23/60 enetc: Fix NULL dma address unmap for Tx BD extensions
In reply to Sasha LevinFrom: Claudiu Manoil <[email protected]>
[ Upstream commit f4a0be84d73ec648628bf8094600ceb73cb6073f ]
For the unlikely case of TxBD extensions (i.e. ptp) the driver tries to unmap the tx_swbd corresponding to the extension, which is bogus as it has no buffer attached.
--- drivers/net/ethernet/freescale/enetc/enetc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/freescale/enetc/enetc.c +3 -1
@@ -313,7 +313,9 @@ static bool enetc_clean_tx_ring(struct enetc_bdr *tx_ring, int napi_budget)while (bds_to_clean && tx_frm_cnt <ENETC_DEFAULT_TX_WORK ) {bool is_eof = !!tx_swbd->skb; -enetc_unmap_tx_buff (tx_ring, tx_swbd); +if (likely (tx_swbd->dma)) +enetc_unmap_tx_buff (tx_ring, tx_swbd); +if (is_eof) {napi_consume_skb (tx_swbd->skb, napi_budget); tx_swbd->skb =NULL ;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 24/60 bpf, tcp: correctly handle DONT_WAIT flags and timeo == 0
In reply to Sasha LevinFrom: John Fastabend <[email protected]>
[ Upstream commit 5fa2ca7c4a3fc176f31b495e1a704862d8188b53 ]
The tcp_bpf_wait_data() routine needs to check timeo != 0 before calling sk_wait_event() otherwise we may see unexpected stalls on receiver.
Arika did all the leg work here I just formatted, posted and ran a few tests.
--- net/ipv4/tcp_bpf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/ipv4/tcp_bpf.c +4 -1
@@ -27,7 +27,10 @@ static int tcp_bpf_wait_data(struct sock *sk, struct sk_psock *psock, int flags, long timeo, int *err) {DEFINE_WAIT_FUNC (wait ,woken_wake_function ); -int ret; +int ret =0 ; + +if (!timeo) +return ret;add_wait_queue (sk_sleep (sk), &wait);sk_set_bit (SOCKWQ_ASYNC_WAITDATA , sk);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 25/60 arm64/mm: Inhibit huge-vmap with ptdump
In reply to Sasha LevinFrom: Mark Rutland <[email protected]>
[ Upstream commit 7ba36eccb3f83983a651efd570b4f933ecad1b5c ]
The arm64 ptdump code can race with concurrent modification of the kernel page tables. At the time this was added, this was sound as:
* Modifications to leaf entries could result in stale information being logged, but would not result in a functional problem.
* Boot time modifications to non-leaf entries (e.g. freeing of initmem) were performed when the ptdump code cannot be invoked.
* At runtime, modifications to non-leaf entries only occurred in the vmalloc region, and these were strictly additive, as intermediate entries were never freed.
However, since commit:
commit 324420bf91f6 ("arm64: add support for ioremap() block mappings")
... it has been possible to create huge mappings in the vmalloc area at runtime, and as part of this existing intermediate levels of table my be removed and freed.
It's possible for the ptdump code to race with this, and continue to walk tables which have been freed (and potentially poisoned or reallocated). As a result of this, the ptdump code may dereference bogus addresses, which could be fatal.
Since huge-vmap is a TLB and memory optimization, we can disable it when the runtime ptdump code is in use to avoid this problem.
--- arch/arm64/mm/mmu.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
arch/arm64/mm/mmu.c +8 -3
@@ -936,13 +936,18 @@ void *__init fixmap_remap_fdt(phys_addr_t dt_phys)int __init arch_ioremap_pud_supported (void ) { -/* only 4k granule supports level 1 block mappings */ -return IS_ENABLED (CONFIG_ARM64_4K_PAGES ); +/* +* Only 4k granule supports level 1 block mappings. +* SW table walks can't handle removal of intermediate entries. +*/ +return IS_ENABLED (CONFIG_ARM64_4K_PAGES ) && + !IS_ENABLED (CONFIG_ARM64_PTDUMP_DEBUGFS ); }int __init arch_ioremap_pmd_supported (void ) { -return 1 ; +/* See arch_ioremap_pud_supported() */ +return !IS_ENABLED (CONFIG_ARM64_PTDUMP_DEBUGFS ); }int pud_set_huge (pud_t *pudp,phys_addr_t phys,pgprot_t prot)
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 26/60 tools/bpftool: move set_max_rlimit() before __bpf_object__open_xattr()
In reply to Sasha LevinFrom: Yonghong Song <[email protected]>
[ Upstream commit ac4e0e055fee5751c78bba1fc9ce508a6874d916 ]
For a host which has a lower rlimit for max locked memory (e.g., 64KB), the following error occurs in one of our production systems:
# /usr/sbin/bpftool prog load /paragon/pods/52877437/home/mark.o \
/sys/fs/bpf/paragon_mark_21 type cgroup/skb \
map idx 0 pinned /sys/fs/bpf/paragon_map_21
libbpf: Error in bpf_object__probe_name():Operation not permitted(1).
Couldn't load basic 'r0 = 0' BPF program.
Error: failed to open object fileThe reason is due to low locked memory during bpf_object__probe_name() which probes whether program name is supported in kernel or not during __bpf_object__open_xattr().
bpftool program load already tries to relax mlock rlimit before bpf_object__load(). Let us move set_max_rlimit() before __bpf_object__open_xattr(), which fixed the issue here.
--- tools/bpf/bpftool/prog.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/bpf/bpftool/prog.c +2 -2
@@ -873,6 +873,8 @@ static int load_with_options(int argc, char **argv, bool first_prog_only) } } +set_max_rlimit (); + obj =__bpf_object__open_xattr (&attr, bpf_flags);if (IS_ERR_OR_NULL (obj)) {p_err ("failed to open object file" );
@@ -952,8 +954,6 @@ static int load_with_options(int argc, char **argv, bool first_prog_only) goto err_close_obj; } -set_max_rlimit (); - err =bpf_object__load (obj);if (err) {p_err ("failed to load object file" );
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 27/60 selftests/bpf: fix bpf_get_current_task
In reply to Sasha LevinFrom: Alexei Starovoitov <[email protected]>
[ Upstream commit 7ed4b4e60bb1dd3df7a45dfbde3a96efce9df7eb ]
Fix bpf_get_current_task() declaration.
--- tools/testing/selftests/bpf/bpf_helpers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/bpf_helpers.h +1 -1
@@ -246,7 +246,7 @@ static int (*bpf_skb_change_type)(void *ctx, __u32 type) = (void *) BPF_FUNC_skb_change_type;static unsigned int (*bpf_get_hash_recalc)(void *ctx) = (void *) BPF_FUNC_get_hash_recalc; -static unsigned long long (*bpf_get_current_task)(void *ctx) = +static unsigned long long (*bpf_get_current_task)(void ) = (void *) BPF_FUNC_get_current_task;static int (*bpf_skb_change_tail)(void *ctx,__u32 len,__u64 flags) = (void *) BPF_FUNC_skb_change_tail;
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 28/60 nvme-pci: Fix controller freeze wait disabling
In reply to Sasha LevinFrom: Keith Busch <[email protected]>
[ Upstream commit e43269e6e5c49d7fec599e6bba71963935b0e4ba ]
If a controller disabling didn't start a freeze, don't wait for the operation to complete.
--- drivers/nvme/host/pci.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/nvme/host/pci.c +6 -6
@@ -2397,7 +2397,7 @@ static void nvme_pci_disable(struct nvme_dev *dev)static void nvme_dev_disable (struct nvme_dev *dev,bool shutdown) { -bool dead = true; +bool dead = true, freeze = false;struct pci_dev *pdev =to_pci_dev (dev->dev);mutex_lock (&dev->shutdown_lock);
@@ -2405,8 +2405,10 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)u32 csts =readl (dev->bar +NVME_REG_CSTS );if (dev->ctrl.state ==NVME_CTRL_LIVE || - dev->ctrl.state ==NVME_CTRL_RESETTING ) + dev->ctrl.state ==NVME_CTRL_RESETTING ) { + freeze = true;nvme_start_freeze (&dev->ctrl); + } dead = !!((csts &NVME_CSTS_CFS ) || !(csts &NVME_CSTS_RDY ) || pdev->error_state != pci_channel_io_normal); }
@@ -2415,10 +2417,8 @@ static void nvme_dev_disable(struct nvme_dev *dev, bool shutdown)* Give the controller a chance to complete all entered requests if * doing a safe shutdown. */ -if (!dead) { -if (shutdown) -nvme_wait_freeze_timeout (&dev->ctrl,NVME_IO_TIMEOUT ); - } +if (!dead && shutdown && freeze) +nvme_wait_freeze_timeout (&dev->ctrl,NVME_IO_TIMEOUT );nvme_stop_queues (&dev->ctrl);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 29/60 nvme: fix srcu locking on error return in nvme_get_ns_from_disk
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 100c815cbd56480b3e31518475b04719c363614a ]
If we can't get a namespace don't leak the SRCU lock. nvme_ioctl was working around this, but nvme_pr_command wasn't handling this properly. Just do what callers would usually expect.
--- drivers/nvme/host/core.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/nvme/host/core.c +9 -4
@@ -1362,9 +1362,14 @@ static struct nvme_ns *nvme_get_ns_from_disk(struct gendisk *disk, {#ifdef CONFIG_NVME_MULTIPATH if (disk->fops == &nvme_ns_head_ops) { +struct nvme_ns *ns; + *head = disk->private_data; *srcu_idx =srcu_read_lock (&(*head)->srcu); -return nvme_find_path (*head); + ns =nvme_find_path (*head); +if (!ns) +srcu_read_unlock (&(*head)->srcu, *srcu_idx); +return ns; }#endif *head =NULL ;
@@ -1411,9 +1416,9 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode, ns =nvme_get_ns_from_disk (bdev->bd_disk, &head, &srcu_idx);if (unlikely (!ns)) - ret = -EWOULDBLOCK ; -else - ret =nvme_ns_ioctl (ns, cmd, arg); +return -EWOULDBLOCK ; + + ret =nvme_ns_ioctl (ns, cmd, arg);nvme_put_ns_from_disk (head, srcu_idx);return ret; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 30/60 nvme: remove the ifdef around nvme_nvm_ioctl
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 3f98bcc58cd5f1e4668db289dcab771874cc0920 ]
We already have a proper stub if lightnvm is not enabled, so don't bother with the ifdef.
--- drivers/nvme/host/core.c | 2 -- 1 file changed, 2 deletions(-)
drivers/nvme/host/core.c +0 -2
@@ -1396,10 +1396,8 @@ static int nvme_ns_ioctl(struct nvme_ns *ns, unsigned cmd, unsigned long arg)case NVME_IOCTL_SUBMIT_IO :return nvme_submit_io (ns, (void __user *)arg);default : -#ifdef CONFIG_NVM if (ns->ndev)return nvme_nvm_ioctl (ns, cmd, arg); -#endif if (is_sed_ioctl (cmd))return sed_ioctl (ns->ctrl->opal_dev, cmd, (void __user *) arg);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 31/60 nvme: merge nvme_ns_ioctl into nvme_ioctl
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 90ec611adcf20b96d0c2b7166497d53e4301a57f ]
Merge the two functions to make future changes a little easier.
--- drivers/nvme/host/core.c | 47 ++++++++++++++++++++-------------------- 1 file changed, 24 insertions(+), 23 deletions(-)
drivers/nvme/host/core.c +24 -23
@@ -1383,32 +1383,11 @@ static void nvme_put_ns_from_disk(struct nvme_ns_head *head, int idx)srcu_read_unlock (&head->srcu, idx); } -static int nvme_ns_ioctl (struct nvme_ns *ns,unsigned cmd,unsigned long arg) -{ -switch (cmd) { -case NVME_IOCTL_ID : -force_successful_syscall_return (); -return ns->head->ns_id; -case NVME_IOCTL_ADMIN_CMD : -return nvme_user_cmd (ns->ctrl,NULL , (void __user *)arg); -case NVME_IOCTL_IO_CMD : -return nvme_user_cmd (ns->ctrl, ns, (void __user *)arg); -case NVME_IOCTL_SUBMIT_IO : -return nvme_submit_io (ns, (void __user *)arg); -default : -if (ns->ndev) -return nvme_nvm_ioctl (ns, cmd, arg); -if (is_sed_ioctl (cmd)) -return sed_ioctl (ns->ctrl->opal_dev, cmd, - (void __user *) arg); -return -ENOTTY ; - } -} -static int nvme_ioctl (struct block_device *bdev,fmode_t mode,unsigned int cmd,unsigned long arg) {struct nvme_ns_head *head =NULL ; +void __user *argp = (void __user *)arg;struct nvme_ns *ns;int srcu_idx, ret;
@@ -1416,7 +1395,29 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode,if (unlikely (!ns))return -EWOULDBLOCK ; - ret =nvme_ns_ioctl (ns, cmd, arg); +switch (cmd) { +case NVME_IOCTL_ID : +force_successful_syscall_return (); + ret = ns->head->ns_id; +break ; +case NVME_IOCTL_ADMIN_CMD : + ret =nvme_user_cmd (ns->ctrl,NULL , argp); +break ; +case NVME_IOCTL_IO_CMD : + ret =nvme_user_cmd (ns->ctrl, ns, argp); +break ; +case NVME_IOCTL_SUBMIT_IO : + ret =nvme_submit_io (ns, argp); +break ; +default : +if (ns->ndev) + ret =nvme_nvm_ioctl (ns, cmd, arg); +else if (is_sed_ioctl (cmd)) + ret =sed_ioctl (ns->ctrl->opal_dev, cmd, argp); +else + ret = -ENOTTY ; + } +nvme_put_ns_from_disk (head, srcu_idx);return ret; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 32/60 nvme: release namespace SRCU protection before performing controller ioctls
In reply to Sasha LevinFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 5fb4aac756acacf260b9ebd88747251effa3a2f2 ]
Holding the SRCU critical section protecting the namespace list can cause deadlocks when using the per-namespace admin passthrough ioctl to delete as namespace. Release it earlier when performing per-controller ioctls to avoid that.
--- drivers/nvme/host/core.c | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-)
drivers/nvme/host/core.c +20 -5
@@ -1395,14 +1395,31 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode,if (unlikely (!ns))return -EWOULDBLOCK ; +/* +* Handle ioctls that apply to the controller instead of the namespace +* seperately and drop the ns SRCU reference early. This avoids a +* deadlock when deleting namespaces using the passthrough interface. +*/ +if (cmd ==NVME_IOCTL_ADMIN_CMD ||is_sed_ioctl (cmd)) { +struct nvme_ctrl *ctrl = ns->ctrl; + +nvme_get_ctrl (ns->ctrl); +nvme_put_ns_from_disk (head, srcu_idx); + +if (cmd ==NVME_IOCTL_ADMIN_CMD ) + ret =nvme_user_cmd (ctrl,NULL , argp); +else + ret =sed_ioctl (ctrl->opal_dev, cmd, argp); + +nvme_put_ctrl (ctrl); +return ret; + } +switch (cmd) {case NVME_IOCTL_ID :force_successful_syscall_return (); ret = ns->head->ns_id;break ; -case NVME_IOCTL_ADMIN_CMD : - ret =nvme_user_cmd (ns->ctrl,NULL , argp); -break ;case NVME_IOCTL_IO_CMD : ret =nvme_user_cmd (ns->ctrl, ns, argp);break ;
@@ -1412,8 +1429,6 @@ static int nvme_ioctl(struct block_device *bdev, fmode_t mode,default :if (ns->ndev) ret =nvme_nvm_ioctl (ns, cmd, arg); -else if (is_sed_ioctl (cmd)) - ret =sed_ioctl (ns->ctrl->opal_dev, cmd, argp);else ret = -ENOTTY ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 33/60 nvme: fix memory leak for power latency tolerance
In reply to Sasha LevinFrom: Yufen Yu <[email protected]>
[ Upstream commit 510a405d945bc985abc513fafe45890cac34fafa ]
Unconditionally hide device pm latency tolerance when uninitializing the controller to ensure all qos resources are released so that we're not leaking this memory. This is safe to call if none were allocated in the first place, or were previously freed.
--- drivers/nvme/host/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/nvme/host/core.c +1 -0
@@ -3699,6 +3699,7 @@ EXPORT_SYMBOL_GPL(nvme_start_ctrl);void nvme_uninit_ctrl (struct nvme_ctrl *ctrl) { +dev_pm_qos_hide_latency_tolerance (ctrl->device);cdev_device_del (&ctrl->cdev, ctrl->device); }EXPORT_SYMBOL_GPL (nvme_uninit_ctrl);
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 34/60 platform/x86: pmc_atom: Add Lex 3I380D industrial PC to critclk_systems DMI table
In reply to Sasha LevinFrom: Hans de Goede <[email protected]>
[ Upstream commit 3d0818f5eba80fbe4c0addbfe6ddb2d19dc82cd4 ]
The Lex 3I380D industrial PC has 4 ethernet controllers on board which need pmc_plt_clk0 - 3 to function, add it to the critclk_systems DMI table, so that drivers/clk/x86/clk-pmc-atom.c will mark the clocks as CLK_CRITICAL and they will not get turned off.
--- drivers/platform/x86/pmc_atom.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/platform/x86/pmc_atom.c +9 -0
@@ -398,12 +398,21 @@ static int pmc_dbgfs_register(struct pmc_dev *pmc)*/ static const struct dmi_system_id critclk_systems[] = { { +/* pmc_plt_clk0 is used for an external HSIC USB HUB */ .ident ="MPL CEC1x" , .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"MPL AG" ),DMI_MATCH (DMI_PRODUCT_NAME ,"CEC10 Family" ), }, }, + { +/* pmc_plt_clk0 - 3 are used for the 4 ethernet controllers */ + .ident ="Lex 3I380D" , + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"Lex BayTrail" ), +DMI_MATCH (DMI_PRODUCT_NAME ,"3I380D" ), + }, + }, {/*sentinel*/ } };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 35/60 platform/x86: pmc_atom: Add several Beckhoff Automation boards to critclk_systems DMI table
In reply to Sasha LevinFrom: Steffen Dirkwinkel <[email protected]>
[ Upstream commit d6423bd03031c020121da26c41a26bd5cc6d0da3 ]
There are several Beckhoff Automation industrial PC boards which use pmc_plt_clk* clocks for ethernet controllers. This adds affected boards to critclk_systems DMI table so the clocks are marked as CLK_CRITICAL and not turned off.
--- drivers/platform/x86/pmc_atom.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/platform/x86/pmc_atom.c +24 -0
@@ -413,6 +413,30 @@ static const struct dmi_system_id critclk_systems[] = { DMI_MATCH(DMI_PRODUCT_NAME, "3I380D"), }, }, + { + /* pmc_plt_clk* - are used for ethernet controllers */ + .ident = "Beckhoff CB3163", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Beckhoff Automation"), + DMI_MATCH(DMI_BOARD_NAME, "CB3163"), + }, + }, + { + /* pmc_plt_clk* - are used for ethernet controllers */ + .ident = "Beckhoff CB6263", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Beckhoff Automation"), + DMI_MATCH(DMI_BOARD_NAME, "CB6263"), + }, + }, + { + /* pmc_plt_clk* - are used for ethernet controllers */ + .ident = "Beckhoff CB6363", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Beckhoff Automation"), + DMI_MATCH(DMI_BOARD_NAME, "CB6363"), + }, + }, { /*sentinel*/ } };
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 36/60 scsi: myrs: Fix uninitialized variable
In reply to Sasha LevinFrom: YueHaibing <[email protected]>
[ Upstream commit 41552199b5518fe26bee0829a28dd1880441b430 ]
drivers/scsi/myrs.c: In function 'myrs_log_event':drivers/scsi/myrs.c:821:24: warning: 'sshdr.sense_key' may be used uninitialized in this function [-Wmaybe-uninitialized]
struct scsi_sense_hdr sshdr;
If ev->ev_code is not 0x1C, sshdr.sense_key may be used uninitialized. Fix this by initializing variable 'sshdr' to 0.
--- drivers/scsi/myrs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/myrs.c +1 -1
@@ -818,7 +818,7 @@ static void myrs_log_event(struct myrs_hba *cs, struct myrs_event *ev)unsigned char ev_type, *ev_msg;struct Scsi_Host *shost = cs->host;struct scsi_device *sdev; -struct scsi_sense_hdr sshdr; +struct scsi_sense_hdr sshdr = {0 };unsigned char sense_info[4 ];unsigned char cmd_specific[4 ];
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 37/60 scsi: bnx2fc: fix incorrect cast to u64 on shift operation
In reply to Sasha LevinFrom: Colin Ian King <[email protected]>
[ Upstream commit d0c0d902339249c75da85fd9257a86cbb98dfaa5 ]
Currently an int is being shifted and the result is being cast to a u64 which leads to undefined behaviour if the shift is more than 31 bits. Fix this by casting the integer value 1 to u64 before the shift operation.
Addresses-Coverity: ("Bad shift operation")
--- drivers/scsi/bnx2fc/bnx2fc_hwi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/bnx2fc/bnx2fc_hwi.c +1 -1
@@ -830,7 +830,7 @@ static void bnx2fc_process_unsol_compl(struct bnx2fc_rport *tgt, u16 wqe) ((u64 )err_entry->data.err_warn_bitmap_hi <<32 ) | (u64 )err_entry->data.err_warn_bitmap_lo;for (i =0 ; i <BNX2FC_NUM_ERR_BITS ; i++) { -if (err_warn_bit_map & (u64) (1 << i)) { +if (err_warn_bit_map & ((u64 )1 << i)) { err_warn = i;break ; }
Signature · 1 line
2.20.1
Sasha Levin
maintainerPATCH 38/60 drm/amdgpu: keep stolen memory on picasso
In reply to Sasha LevinFrom: Flora Cui <[email protected]>
[ Upstream commit 379109351f4f6f2405cf54e7a296055f589c3ad1 ]
otherwise screen corrupts during modprobe.
--- drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/amd/amdgpu/gmc_v9_0.c +1 -0
@@ -715,6 +715,7 @@ static bool gmc_v9_0_keep_stolen_memory(struct amdgpu_device *adev)case CHIP_VEGA10 :return true;case CHIP_RAVEN : +return (adev->pdev->device ==0x15d8 );case CHIP_VEGA12 :case CHIP_VEGA20 :default :
Signature · 6 lines
2.20.1 _______________________________________________ amd-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/amd-gfx
Sasha Levin
maintainerPATCH 39/60 libnvdimm: Fix compilation warnings with W=1
In reply to Sasha LevinFrom: Qian Cai <[email protected]>
[ Upstream commit c01dafad77fea8d64c4fdca0a6031c980842ad65 ]
Several places (dimm_devs.c, core.c etc) include label.h but only label.c uses NSINDEX_SIGNATURE, so move its definition to label.c instead.
In file included from drivers/nvdimm/dimm_devs.c:23:drivers/nvdimm/label.h:41:19: warning: 'NSINDEX_SIGNATURE' defined but not used [-Wunused-const-variable=]
Also, some places abuse "/**" which is only reserved for the kernel-doc.
drivers/nvdimm/bus.c:648: warning: cannot understand function prototype:
'struct attribute_group nd_device_attribute_group = ' drivers/nvdimm/bus.c:677: warning: cannot understand function prototype:
'struct attribute_group nd_numa_attribute_group = '
Those are just some member assignments for the "struct attribute_group" instances and it can't be expressed in the kernel-doc.
--- drivers/nvdimm/bus.c | 4 ++-- drivers/nvdimm/label.c | 2 ++ drivers/nvdimm/label.h | 2 -- 3 files changed, 4 insertions(+), 4 deletions(-)
drivers/nvdimm/bus.c +2 -2
@@ -642,7 +642,7 @@ static struct attribute *nd_device_attributes[] = { NULL, }; -/** +/* * nd_device_attribute_group - generic attributes for all devices on an nd bus */ struct attribute_group nd_device_attribute_group = {
@@ -671,7 +671,7 @@ static umode_t nd_numa_attr_visible(struct kobject *kobj, struct attribute *a,return a->mode; } -/** +/* * nd_numa_attribute_group - NUMA attributes for all devices on an nd bus */ struct attribute_group nd_numa_attribute_group = {
drivers/nvdimm/label.c +2 -0
@@ -25,6 +25,8 @@ static guid_t nvdimm_btt2_guid;static guid_t nvdimm_pfn_guid;static guid_t nvdimm_dax_guid; +static const char NSINDEX_SIGNATURE [] ="NAMESPACE_INDEX\0" ; +static u32 best_seq (u32 a,u32 b) { a &=NSINDEX_SEQ_MASK ;
drivers/nvdimm/label.h +0 -2
@@ -38,8 +38,6 @@ enum { ND_NSINDEX_INIT = 0x1, }; -static const char NSINDEX_SIGNATURE [] ="NAMESPACE_INDEX\0" ; -/** * struct nd_namespace_index - label set superblock * @sig: NAMESPACE_INDEX\0
Signature · 6 lines
2.20.1 _______________________________________________ Linux-nvdimm mailing list [email protected] https://lists.01.org/mailman/listinfo/linux-nvdimm
Sasha Levin
maintainerPATCH 40/60 selftests: fib_rule_tests: fix local IPv4 address typo
In reply to Sasha LevinFrom: Hangbin Liu <[email protected]>
[ Upstream commit fc82d93e57e3d41f79eff19031588b262fc3d0b6 ]
The IPv4 testing address are all in 192.51.100.0 subnet. It doesn't make sense to set a 198.51.100.1 local address. Should be a typo.
--- tools/testing/selftests/net/fib_rule_tests.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/net/fib_rule_tests.sh +1 -1
@@ -55,7 +55,7 @@ setup() $IP link add dummy0 type dummy $IP link set dev dummy0 up - $IP address add 198.51.100.1/24 dev dummy0 + $IP address add 192.51.100.1/24 dev dummy0 $IP -6 address add 2001:db8:1::1/64 dev dummy0 set +e
Signature · 1 line
2.20.1