kconfig: merge_config: use an empty file as initfile
Subsystems (37)
Sasha Levin
maintainerPATCH 1/79 kconfig: merge_config: use an empty file as initfile
From: Daniel Gomez <[email protected]>
[ Upstream commit a26fe287eed112b4e21e854f173c8918a6a8596d ]
The scripts/kconfig/merge_config.sh script requires an existing $INITFILE (or the $1 argument) as a base file for merging Kconfig fragments. However, an empty $INITFILE can serve as an initial starting point, later referenced by the KCONFIG_ALLCONFIG Makefile variable if -m is not used. This variable can point to any configuration file containing preset config symbols (the merged output) as stated in Documentation/kbuild/kconfig.rst. When -m is used $INITFILE will contain just the merge output requiring the user to run make (i.e. KCONFIG_ALLCONFIG=<$INITFILE> make <allnoconfig/alldefconfig> or make olddefconfig).
Instead of failing when $INITFILE is missing, create an empty file and use it as the starting point for merges.
--- scripts/kconfig/merge_config.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
scripts/kconfig/merge_config.sh +2 -2
@@ -98,8 +98,8 @@ INITFILE=$1 shift; if [ ! -r "$INITFILE" ]; then - echo "The base file '$INITFILE' does not exist. Exit." >&2 - exit 1 + echo "The base file '$INITFILE' does not exist. Creating one..." >&2 + touch "$INITFILE" fi MERGE_LIST=$*
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 2/79 mailbox: use error ret code of of_parse_phandle_with_args()
From: Tudor Ambarus <[email protected]>
[ Upstream commit 24fdd5074b205cfb0ef4cd0751a2d03031455929 ]
In case of error, of_parse_phandle_with_args() returns -EINVAL when the passed index is negative, or -ENOENT when the index is for an empty phandle. The mailbox core overwrote the error return code with a less precise -ENODEV. Use the error returned code from of_parse_phandle_with_args().
--- drivers/mailbox/mailbox.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/mailbox/mailbox.c +4 -3
@@ -350,11 +350,12 @@ struct mbox_chan *mbox_request_channel(struct mbox_client *cl, int index)mutex_lock (&con_mutex); -if (of_parse_phandle_with_args (dev->of_node,"mboxes" , -"#mbox-cells" , index, &spec)) { + ret =of_parse_phandle_with_args (dev->of_node,"mboxes" ,"#mbox-cells" , + index, &spec); +if (ret) {dev_dbg (dev,"%s: can't parse \"mboxes\" property\n" , __func__);mutex_unlock (&con_mutex); -return ERR_PTR (-ENODEV ); +return ERR_PTR (ret); } chan =ERR_PTR (-EPROBE_DEFER );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 3/79 fbdev: fsl-diu-fb: add missing device_remove_file()
In reply to Sasha LevinFrom: Shixiong Ou <[email protected]>
[ Upstream commit 86d16cd12efa547ed43d16ba7a782c1251c80ea8 ]
Call device_remove_file() when driver remove.
--- drivers/video/fbdev/fsl-diu-fb.c | 1 + 1 file changed, 1 insertion(+)
drivers/video/fbdev/fsl-diu-fb.c +1 -0
@@ -1828,6 +1828,7 @@ static int fsl_diu_remove(struct platform_device *pdev)int i; data =dev_get_drvdata (&pdev->dev); +device_remove_file (&pdev->dev, &data->dev_attr);disable_lcdc (&data->fsl_diu_info[0 ]);free_irq (data->irq, data->diu_reg);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 4/79 fbdev: core: tileblit: Implement missing margin clearing for tileblit
In reply to Sasha LevinFrom: Zsolt Kajtar <[email protected]>
[ Upstream commit 76d3ca89981354e1f85a3e0ad9ac4217d351cc72 ]
I was wondering why there's garbage at the bottom of the screen when tile blitting is used with an odd mode like 1080, 600 or 200. Sure there's only space for half a tile but the same area is clean when the buffer is bitmap.
Then later I found that it's supposed to be cleaned but that's not implemented. So I took what's in bitblit and adapted it for tileblit.
This implementation was tested for both the horizontal and vertical case, and now does the same as what's done for bitmap buffers.
If anyone is interested to reproduce the problem then I could bet that'd be on a S3 or Ark. Just set up a mode with an odd line count and make sure that the virtual size covers the complete tile at the bottom. E.g. for 600 lines that's 608 virtual lines for a 16 tall tile. Then the bottom area should be cleaned.
For the right side it's more difficult as there the drivers won't let an odd size happen, unless the code is modified. But once it reports back a few pixel columns short then fbcon won't use the last column. With the patch that column is now clean.
Btw. the virtual size should be rounded up by the driver for both axes (not only the horizontal) so that it's dividable by the tile size. That's a driver bug but correcting it is not in scope for this patch.
Implement missing margin clearing for tileblit
--- drivers/video/fbdev/core/tileblit.c | 37 ++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-)
drivers/video/fbdev/core/tileblit.c +36 -1
@@ -77,7 +77,42 @@ static void tile_putcs(struct vc_data *vc, struct fb_info *info,static void tile_clear_margins (struct vc_data *vc,struct fb_info *info,int color,int bottom_only) { -return ; +unsigned int cw = vc->vc_font.width; +unsigned int ch = vc->vc_font.height; +unsigned int rw = info->var.xres - (vc->vc_cols*cw); +unsigned int bh = info->var.yres - (vc->vc_rows*ch); +unsigned int rs = info->var.xres - rw; +unsigned int bs = info->var.yres - bh; +unsigned int vwt = info->var.xres_virtual / cw; +unsigned int vht = info->var.yres_virtual / ch; +struct fb_tilerect rect; + + rect.index = vc->vc_video_erase_char & + ((vc->vc_hi_font_mask) ?0x1ff :0xff ); + rect.fg = color; + rect.bg = color; + +if ((int ) rw >0 && !bottom_only) { + rect.sx = (info->var.xoffset + rs + cw -1 ) / cw; + rect.sy =0 ; + rect.width = (rw + cw -1 ) / cw; + rect.height = vht; +if (rect.width + rect.sx > vwt) + rect.width = vwt - rect.sx; +if (rect.sx < vwt) + info->tileops->fb_tilefill (info, &rect); + } + +if ((int ) bh >0 ) { + rect.sx = info->var.xoffset / cw; + rect.sy = (info->var.yoffset + bs) / ch; + rect.width = rs / cw; + rect.height = (bh + ch -1 ) / ch; +if (rect.height + rect.sy > vht) + rect.height = vht - rect.sy; +if (rect.sy < vht) + info->tileops->fb_tilefill (info, &rect); + } } static void tile_cursor(struct vc_data *vc, struct fb_info *info, int mode,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 5/79 NFSv4: Treat ENETUNREACH errors as fatal for state recovery
In reply to Sasha LevinFrom: Trond Myklebust <[email protected]>
[ Upstream commit 0af5fb5ed3d2fd9e110c6112271f022b744a849a ]
If a containerised process is killed and causes an ENETUNREACH or ENETDOWN error to be propagated to the state manager, then mark the nfs_client as being dead so that we don't loop in functions that are expecting recovery to succeed.
--- fs/nfs/nfs4state.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
fs/nfs/nfs4state.c +9 -1
@@ -2655,7 +2655,15 @@ static void nfs4_state_manager(struct nfs_client *clp)pr_warn_ratelimited ("NFS: state manager%s%s failed on NFSv4 server %s" " with error %d\n" , section_sep, section, clp->cl_hostname, -status); -ssleep (1 ); +switch (status) { +case -ENETDOWN : +case -ENETUNREACH : +nfs_mark_client_ready (clp, -EIO ); +break ; +default : +ssleep (1 ); +break ; + } out_drain:memalloc_nofs_restore (memflags);nfs4_end_drain_session (clp);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 6/79 SUNRPC: rpc_clnt_set_transport() must not change the autobind setting
In reply to Sasha LevinFrom: Trond Myklebust <[email protected]>
[ Upstream commit bf9be373b830a3e48117da5d89bb6145a575f880 ]
The autobind setting was supposed to be determined in rpc_create(), since commit c2866763b402 ("SUNRPC: use sockaddr + size when creating remote transport endpoints").
--- net/sunrpc/clnt.c | 3 --- 1 file changed, 3 deletions(-)
net/sunrpc/clnt.c +0 -3
@@ -277,9 +277,6 @@ static struct rpc_xprt *rpc_clnt_set_transport(struct rpc_clnt *clnt, old =rcu_dereference_protected (clnt->cl_xprt,lockdep_is_held (&clnt->cl_lock)); -if (!xprt_bound (xprt)) - clnt->cl_autobind =1 ; - clnt->cl_timeout = timeout;rcu_assign_pointer (clnt->cl_xprt, xprt);spin_unlock (&clnt->cl_lock);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 7/79 exit: fix the usage of delay_group_leader->exit_code in do_notify_parent() and pidfs_exit()
In reply to Sasha LevinFrom: Oleg Nesterov <[email protected]>
[ Upstream commit 9133607de37a4887c6f89ed937176a0a0c1ebb17 ]
Consider a process with a group leader L and a sub-thread T. L does sys_exit(1), then T does sys_exit_group(2).
In this case wait_task_zombie(L) will notice SIGNAL_GROUP_EXIT and use L->signal->group_exit_code, this is correct.
But, before that, do_notify_parent(L) called by release_task(T) will use L->exit_code != L->signal->group_exit_code, and this is not consistent. We don't really care, I think that nobody relies on the info which comes with SIGCHLD, if nothing else SIGCHLD < SIGRTMIN can be queued only once.
But pidfs_exit() is more problematic, I think pidfs_exit_info->exit_code should report ->group_exit_code in this case, just like wait_task_zombie().
TODO: with this change we can hopefully cleanup (or may be even kill) the similar SIGNAL_GROUP_EXIT checks, at least in wait_task_zombie().
--- kernel/exit.c | 3 +++ 1 file changed, 3 insertions(+)
kernel/exit.c +3 -0
@@ -262,6 +262,9 @@ void release_task(struct task_struct *p) leader = p->group_leader;if (leader != p &&thread_group_empty (leader) && leader->exit_state ==EXIT_ZOMBIE ) { +/* for pidfs_exit() and do_notify_parent() */ +if (leader->signal->flags &SIGNAL_GROUP_EXIT ) + leader->exit_code = leader->signal->group_exit_code;/* * If we were the last child thread and the leader has * exited already, and the leader's parent ignores SIGCHLD,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 8/79 dql: Fix dql->limit value when reset.
In reply to Sasha LevinFrom: Jing Su <[email protected]>
[ Upstream commit 3a17f23f7c36bac3a3584aaf97d3e3e0b2790396 ]
Executing dql_reset after setting a non-zero value for limit_min can lead to an unreasonable situation where dql->limit is less than dql->limit_min.
For instance, after setting /sys/class/net/eth*/queues/tx-0/byte_queue_limits/limit_min, an ifconfig down/up operation might cause the ethernet driver to call netdev_tx_reset_queue, which in turn invokes dql_reset.
In this case, dql->limit is reset to 0 while dql->limit_min remains non-zero value, which is unexpected. The limit should always be greater than or equal to limit_min.
--- lib/dynamic_queue_limits.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/dynamic_queue_limits.c +1 -1
@@ -116,7 +116,7 @@ EXPORT_SYMBOL(dql_completed);void dql_reset (struct dql *dql) {/* Reset all dynamic values */ - dql->limit =0 ; + dql->limit = dql->min_limit; dql->num_queued =0 ; dql->num_completed =0 ; dql->last_obj_cnt =0 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 9/79 tools/build: Don't pass test log files to linker
In reply to Sasha LevinFrom: Ian Rogers <[email protected]>
[ Upstream commit 935e7cb5bb80106ff4f2fe39640f430134ef8cd8 ]
Separate test log files from object files. Depend on test log output but don't pass to the linker.
--- tools/build/Makefile.build | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
tools/build/Makefile.build +5 -1
@@ -130,6 +130,10 @@ objprefix := $(subst ./,,$(OUTPUT)$(dir)/) obj-y := $(addprefix $(objprefix),$(obj-y)) subdir-obj-y := $(addprefix $(objprefix),$(subdir-obj-y)) +# Separate out test log files from real build objects. +test-y := $(filter %_log, $(obj-y)) +obj-y := $(filter-out %_log, $(obj-y)) + # Final '$(obj)-in.o' object in-target := $(objprefix)$(obj)-in.o
@@ -140,7 +144,7 @@ $(subdir-y): $(sort $(subdir-obj-y)): $(subdir-y) ; -$(in-target): $(obj-y) FORCE +$(in-target): $(obj-y) $(test-y) FORCE $(call rule_mkdir) $(call if_changed,$(host)ld_multi)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 10/79 pNFS/flexfiles: Report ENETDOWN as a connection error
In reply to Sasha LevinFrom: Trond Myklebust <[email protected]>
[ Upstream commit aa42add73ce9b9e3714723d385c254b75814e335 ]
If the client should see an ENETDOWN when trying to connect to the data server, it might still be able to talk to the metadata server through another NIC. If so, report the error.
--- fs/nfs/flexfilelayout/flexfilelayout.c | 1 + 1 file changed, 1 insertion(+)
fs/nfs/flexfilelayout/flexfilelayout.c +1 -0
@@ -1285,6 +1285,7 @@ static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg,case -ECONNRESET :case -EHOSTDOWN :case -EHOSTUNREACH : +case -ENETDOWN :case -ENETUNREACH :case -EADDRINUSE :case -ENOBUFS :
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 11/79 libnvdimm/labels: Fix divide error in nd_label_data_init()
In reply to Sasha LevinFrom: Robert Richter <[email protected]>
[ Upstream commit ef1d3455bbc1922f94a91ed58d3d7db440652959 ]
If a faulty CXL memory device returns a broken zero LSA size in its memory device information (Identify Memory Device (Opcode 4000h), CXL spec. 3.1, 8.2.9.9.1.1), a divide error occurs in the libnvdimm driver:
Oops: divide error: 0000 [#1] PREEMPT SMP NOPTI RIP: 0010:nd_label_data_init+0x10e/0x800 [libnvdimm]
Code and flow:
1) CXL Command 4000h returns LSA size = 0
2) config_size is assigned to zero LSA size (CXL pmem driver):
drivers/cxl/pmem.c: .config_size = mds->lsa_size,
3) max_xfer is set to zero (nvdimm driver):
drivers/nvdimm/label.c: max_xfer = min_t(size_t, ndd->nsarea.max_xfer, config_size);
4) A subsequent DIV_ROUND_UP() causes a division by zero:
drivers/nvdimm/label.c: /* Make our initial read size a multiple of max_xfer size */ drivers/nvdimm/label.c: read_size = min(DIV_ROUND_UP(read_size, max_xfer) * max_xfer,drivers/nvdimm/label.c- config_size);
Fix this by checking the config size parameter by extending an existing check.
--- drivers/nvdimm/label.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/nvdimm/label.c +2 -1
@@ -421,7 +421,8 @@ int nd_label_data_init(struct nvdimm_drvdata *ndd)if (ndd->data)return 0 ; -if (ndd->nsarea.status || ndd->nsarea.max_xfer ==0 ) { +if (ndd->nsarea.status || ndd->nsarea.max_xfer ==0 || + ndd->nsarea.config_size ==0 ) {dev_dbg (ndd->dev,"failed to init config data area: (%u:%u)\n" , ndd->nsarea.max_xfer, ndd->nsarea.config_size);return -ENXIO ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 12/79 mmc: host: Wait for Vdd to settle on card power off
In reply to Sasha LevinFrom: Erick Shepherd <[email protected]>
[ Upstream commit 31e75ed964582257f59156ce6a42860e1ae4cc39 ]
The SD spec version 6.0 section 6.4.1.5 requires that Vdd must be lowered to less than 0.5V for a minimum of 1 ms when powering off a card. Increase wait to 15 ms so that voltage has time to drain down to 0.5V and cards can power off correctly. Issues with voltage drain time were only observed on Apollo Lake and Bay Trail host controllers so this fix is limited to those devices.
--- drivers/mmc/host/sdhci-pci-core.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci-pci-core.c +5 -1
@@ -669,8 +669,12 @@ static void sdhci_intel_set_power(struct sdhci_host *host, unsigned char mode,sdhci_set_power (host, mode, vdd); -if (mode ==MMC_POWER_OFF ) +if (mode ==MMC_POWER_OFF ) { +if (slot->chip->pdev->device ==PCI_DEVICE_ID_INTEL_APL_SD || + slot->chip->pdev->device ==PCI_DEVICE_ID_INTEL_BYT_SD ) +usleep_range (15000 ,17500 );return ; + }/* * Bus power might not enable after D3 -> D0 transition due to the
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 13/79 i2c: pxa: fix call balance of i2c->clk handling routines
In reply to Sasha LevinFrom: Vitalii Mordan <[email protected]>
[ Upstream commit be7113d2e2a6f20cbee99c98d261a1fd6fd7b549 ]
If the clock i2c->clk was not enabled in i2c_pxa_probe(), it should not be disabled in any path.
Found by Linux Verification Center (linuxtesting.org) with Klever.
--- drivers/i2c/busses/i2c-pxa.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-pxa.c +4 -1
@@ -1284,7 +1284,10 @@ static int i2c_pxa_probe(struct platform_device *dev) i2c->adap.name); } -clk_prepare_enable (i2c->clk); + ret =clk_prepare_enable (i2c->clk); +if (ret) +return dev_err_probe (&dev->dev, ret, +"failed to enable clock\n" );if (i2c->use_pio) { i2c->adap.algo = &i2c_pxa_pio_algorithm;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 14/79 btrfs: avoid linker error in btrfs_find_create_tree_block()
In reply to Sasha LevinFrom: Mark Harmstone <[email protected]>
[ Upstream commit 7ef3cbf17d2734ca66c4ed8573be45f4e461e7ee ]
The inline function btrfs_is_testing() is hardcoded to return 0 if CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set. Currently we're relying on the compiler optimizing out the call to alloc_test_extent_buffer() in btrfs_find_create_tree_block(), as it's not been defined (it's behind an
#ifdef).
Add a stub version of alloc_test_extent_buffer() to avoid linker errors on non-standard optimization levels. This problem was seen on GCC 14 with -O0 and is helps to see symbols that would be otherwise optimized out.
--- fs/btrfs/extent_io.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
fs/btrfs/extent_io.c +5 -2
@@ -5134,10 +5134,10 @@ struct extent_buffer *find_extent_buffer(struct btrfs_fs_info *fs_info,return NULL ; } -#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS struct extent_buffer *alloc_test_extent_buffer (struct btrfs_fs_info *fs_info,u64 start) { +#ifdef CONFIG_BTRFS_FS_RUN_SANITY_TESTS struct extent_buffer *eb, *exists =NULL ;int ret;
@@ -5173,8 +5173,11 @@ struct extent_buffer *alloc_test_extent_buffer(struct btrfs_fs_info *fs_info, free_eb:btrfs_release_extent_buffer (eb);return exists; -} +#else +/* Stub to avoid linker error when compiled with optimizations turned off. */ +return NULL ;#endif +}struct extent_buffer *alloc_extent_buffer (struct btrfs_fs_info *fs_info,u64 start)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 15/79 btrfs: send: return -ENAMETOOLONG when attempting a path that is too long
In reply to Sasha LevinFrom: Filipe Manana <[email protected]>
[ Upstream commit a77749b3e21813566cea050bbb3414ae74562eba ]
When attempting to build a too long path we are currently returning -ENOMEM, which is very odd and misleading. So update fs_path_ensure_buf() to return -ENAMETOOLONG instead. Also, while at it, move the WARN_ON() into the if statement's expression, as it makes it clear what is being tested and also has the effect of adding 'unlikely' to the statement, which allows the compiler to generate better code as this condition is never expected to happen.
--- fs/btrfs/send.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/btrfs/send.c +2 -4
@@ -397,10 +397,8 @@ static int fs_path_ensure_buf(struct fs_path *p, int len)if (p->buf_len >= len)return 0 ; -if (len >PATH_MAX ) { -WARN_ON (1 ); -return -ENOMEM ; - } +if (WARN_ON (len >PATH_MAX )) +return -ENAMETOOLONG ; path_len = p->end - p->start; old_buf_len = p->buf_len;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 16/79 um: Store full CSGSFS and SS register from mcontext
In reply to Sasha LevinFrom: Benjamin Berg <[email protected]>
[ Upstream commit cef721e0d53d2b64f2ba177c63a0dfdd7c0daf17 ]
Doing this allows using registers as retrieved from an mcontext to be pushed to a process using PTRACE_SETREGS.
It is not entirely clear to me why CSGSFS was masked. Doing so creates issues when using the mcontext as process state in seccomp and simply copying the register appears to work perfectly fine for ptrace.
--- arch/x86/um/os-Linux/mcontext.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/um/os-Linux/mcontext.c +1 -2
@@ -26,7 +26,6 @@ void get_regs_from_mc(struct uml_pt_regs *regs, mcontext_t *mc)COPY (RIP );COPY2 (EFLAGS ,EFL );COPY2 (CS ,CSGSFS ); - regs->gp[CS /sizeof (unsigned long )] &=0xffff ; - regs->gp[CS /sizeof (unsigned long )] |=3 ; + regs->gp[SS /sizeof (unsigned long )] = mc->gregs[REG_CSGSFS ] >>48 ;#endif }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 17/79 um: Update min_low_pfn to match changes in uml_reserved
In reply to Sasha LevinFrom: Tiwei Bie <[email protected]>
[ Upstream commit e82cf3051e6193f61e03898f8dba035199064d36 ]
When uml_reserved is updated, min_low_pfn must also be updated accordingly. Otherwise, min_low_pfn will not accurately reflect the lowest available PFN.
--- arch/um/kernel/mem.c | 1 + 1 file changed, 1 insertion(+)
arch/um/kernel/mem.c +1 -0
@@ -49,6 +49,7 @@ void __init mem_init(void)map_memory (brk_end,__pa (brk_end), uml_reserved - brk_end,1 ,1 ,0 );memblock_free (__pa (brk_end), uml_reserved - brk_end); uml_reserved = brk_end; + min_low_pfn =PFN_UP (__pa (uml_reserved));/* this will put all low memory onto the freelists */ memblock_free_all ();
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 18/79 ext4: reorder capability check last
In reply to Sasha LevinFrom: Christian Göttsche <[email protected]>
[ Upstream commit 1b419c889c0767a5b66d0a6c566cae491f1cb0f7 ]
capable() calls refer to enabled LSMs whether to permit or deny the request. This is relevant in connection with SELinux, where a capability check results in a policy decision and by default a denial message on insufficient permission is issued.
It can lead to three undesired cases:
1. A denial message is generated, even in case the operation was an unprivileged one and thus the syscall succeeded, creating noise.
2. To avoid the noise from 1. the policy writer adds a rule to ignore those denial messages, hiding future syscalls, where the task performs an actual privileged operation, leading to hidden limited functionality of that task.
3. To avoid the noise from 1. the policy writer adds a rule to permit the task the requested capability, while it does not need it, violating the principle of least privilege.
--- fs/ext4/balloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ext4/balloc.c +2 -2
@@ -609,8 +609,8 @@ static int ext4_has_free_clusters(struct ext4_sb_info *sbi,/* Hm, nope. Are (enough) root reserved clusters available? */ if (uid_eq (sbi->s_resuid,current_fsuid ()) || (!gid_eq (sbi->s_resgid,GLOBAL_ROOT_GID ) &&in_group_p (sbi->s_resgid)) || -capable (CAP_SYS_RESOURCE ) || - (flags &EXT4_MB_USE_ROOT_BLOCKS )) { + (flags &EXT4_MB_USE_ROOT_BLOCKS ) || +capable (CAP_SYS_RESOURCE )) {if (free_clusters >= (nclusters + dirty_clusters + resv_clusters))
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 19/79 scsi: st: Tighten the page format heuristics with MODE SELECT
In reply to Sasha LevinFrom: Kai Mäkisara <[email protected]>
[ Upstream commit 8db816c6f176321e42254badd5c1a8df8bfcfdb4 ]
In the days when SCSI-2 was emerging, some drives did claim SCSI-2 but did not correctly implement it. The st driver first tries MODE SELECT with the page format bit set to set the block descriptor. If not successful, the non-page format is tried.
The test only tests the sense code and this triggers also from illegal parameter in the parameter list. The test is limited to "old" devices and made more strict to remove false alarms.
--- drivers/scsi/st.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/scsi/st.c +3 -1
@@ -3076,7 +3076,9 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon cmd_in == MTSETDRVBUFFER || cmd_in == SET_DENS_AND_BLK) {if (cmdstatp->sense_hdr.sense_key ==ILLEGAL_REQUEST && - !(STp->use_pf &PF_TESTED )) { + cmdstatp->sense_hdr.asc ==0x24 && + (STp->device)->scsi_level <=SCSI_2 && + !(STp->use_pf &PF_TESTED )) {/* Try the other possible state of Page Format if not already tried */ STp->use_pf = (STp->use_pf ^USE_PF ) |PF_TESTED ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 20/79 scsi: st: ERASE does not change tape location
In reply to Sasha LevinFrom: Kai Mäkisara <[email protected]>
[ Upstream commit ad77cebf97bd42c93ab4e3bffd09f2b905c1959a ]
The SCSI ERASE command erases from the current position onwards. Don't clear the position variables.
--- drivers/scsi/st.c | 1 - 1 file changed, 1 deletion(-)
drivers/scsi/st.c +0 -1
@@ -2889,7 +2889,6 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lon timeout = STp->long_timeout *8 ;DEBC_printk (STp,"Erasing tape.\n" ); - fileno = blkno = at_sm =0 ;break ;case MTSETBLK :/* Set block length */ case MTSETDENSITY :/* Set tape density */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 21/79 kbuild: fix argument parsing in scripts/config
In reply to Sasha LevinFrom: Seyediman Seyedarab <[email protected]>
[ Upstream commit f757f6011c92b5a01db742c39149bed9e526478f ]
The script previously assumed --file was always the first argument, which caused issues when it appeared later. This patch updates the parsing logic to scan all arguments to find --file, sets the config file correctly, and resets the argument list with the remaining commands.
It also fixes --refresh to respect --file by passing KCONFIG_CONFIG=$FN to make oldconfig.
--- scripts/config | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-)
scripts/config +16 -10
@@ -32,6 +32,7 @@ commands: Disable option directly after other option --module-after|-M beforeopt option Turn option into module directly after other option + --refresh Refresh the config using old settings commands can be repeated multiple times
@@ -124,16 +125,22 @@ undef_var() { txt_delete "^# $name is not set" "$FN" } -if [ "$1" = "--file" ]; then - FN="$2" - if [ "$FN" = "" ] ; then - usage +FN=.config +CMDS=() +while [[ $# -gt 0 ]]; do + if [ "$1" = "--file" ]; then + if [ "$2" = "" ]; then + usage + fi + FN="$2" + shift 2 + else + CMDS+=("$1") + shift fi - shift 2 -else - FN=.config -fi +done +set -- "${CMDS[@]}" if [ "$1" = "" ] ; then usage fi
@@ -217,9 +224,8 @@ while [ "$1" != "" ] ; do set_var "${CONFIG_}$B" "${CONFIG_}$B=m" "${CONFIG_}$A" ;; - # undocumented because it ignores --file (fixme) --refresh) - yes "" | make oldconfig + yes "" | make oldconfig KCONFIG_CONFIG=$FN ;; *)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 22/79 dm: restrict dm device size to 2^63-512 bytes
In reply to Sasha LevinFrom: Mikulas Patocka <[email protected]>
[ Upstream commit 45fc728515c14f53f6205789de5bfd72a95af3b8 ]
The devices with size >= 2^63 bytes can't be used reliably by userspace because the type off_t is a signed 64-bit integer.
Therefore, we limit the maximum size of a device mapper device to 2^63-512 bytes.
--- drivers/md/dm-table.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/md/dm-table.c +4 -0
@@ -741,6 +741,10 @@ int dm_table_add_target(struct dm_table *t, const char *type,DMERR ("%s: zero-length target" ,dm_device_name (t->md));return -EINVAL ; } +if (start + len < start || start + len >LLONG_MAX >>SECTOR_SHIFT ) { +DMERR ("%s: too large device" ,dm_device_name (t->md)); +return -EINVAL ; + } tgt->type =dm_get_target_type (type);if (!tgt->type) {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 23/79 xen: Add support for XenServer 6.1 platform device
In reply to Sasha LevinFrom: Frediano Ziglio <[email protected]>
[ Upstream commit 2356f15caefc0cc63d9cc5122641754f76ef9b25 ]
On XenServer on Windows machine a platform device with ID 2 instead of 1 is used.
This device is mainly identical to device 1 but due to some Windows update behaviour it was decided to use a device with a different ID.
This causes compatibility issues with Linux which expects, if Xen is detected, to find a Xen platform device (5853:0001) otherwise code will crash due to some missing initialization (specifically grant tables). Specifically from dmesg
RIP: 0010:gnttab_expand+0x29/0x210
Code: 90 0f 1f 44 00 00 55 31 d2 48 89 e5 41 57 41 56 41 55 41 89 fd
41 54 53 48 83 ec 10 48 8b 05 7e 9a 49 02 44 8b 35 a7 9a 49 02
<8b> 48 04 8d 44 39 ff f7 f1 45 8d 24 06 89 c3 e8 43 fe ff ff
44 39
RSP: 0000:ffffba34c01fbc88 EFLAGS: 00010086
...The device 2 is presented by Xapi adding device specification to Qemu command line.
Message-ID: <[email protected]>
--- drivers/xen/platform-pci.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/xen/platform-pci.c +4 -0
@@ -26,6 +26,8 @@#define DRV_NAME "xen-platform-pci" +#define PCI_DEVICE_ID_XEN_PLATFORM_XS61 0x0002 +static unsigned long platform_mmio;static unsigned long platform_mmio_alloc;static unsigned long platform_mmiolen;
@@ -167,6 +169,8 @@ static int platform_pci_probe(struct pci_dev *pdev,static const struct pci_device_id platform_pci_tbl[] = { {PCI_VENDOR_ID_XEN ,PCI_DEVICE_ID_XEN_PLATFORM ,PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 }, + {PCI_VENDOR_ID_XEN ,PCI_DEVICE_ID_XEN_PLATFORM_XS61 , +PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0 }, {0 ,} };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 24/79 posix-timers: Add cond_resched() to posix_timer_add() search loop
In reply to Sasha LevinFrom: Eric Dumazet <[email protected]>
[ Upstream commit 5f2909c6cd13564a07ae692a95457f52295c4f22 ]
With a large number of POSIX timers the search for a valid ID might cause a soft lockup on PREEMPT_NONE/VOLUNTARY kernels.
Add cond_resched() to the loop to prevent that.
[ tglx: Split out from Eric's series ]
--- kernel/time/posix-timers.c | 1 + 1 file changed, 1 insertion(+)
kernel/time/posix-timers.c +1 -0
@@ -159,6 +159,7 @@ static int posix_timer_add(struct k_itimer *timer)return id; }spin_unlock (&hash_lock); +cond_resched (); }/* POSIX return code when no timer ID could be allocated */ return -EAGAIN ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 25/79 netfilter: conntrack: Bound nf_conntrack sysctl writes
In reply to Sasha LevinFrom: Nicolas Bouchinet <[email protected]>
[ Upstream commit 8b6861390ffee6b8ed78b9395e3776c16fec6579 ]
nf_conntrack_max and nf_conntrack_expect_max sysctls were authorized to be written any negative value, which would then be stored in the unsigned int variables nf_conntrack_max and nf_ct_expect_max variables.
While the do_proc_dointvec_conv function is supposed to limit writing handled by proc_dointvec proc_handler to INT_MAX. Such a negative value being written in an unsigned int leads to a very high value, exceeding this limit.
Moreover, the nf_conntrack_expect_max sysctl documentation specifies the minimum value is 1.
The proc_handlers have thus been updated to proc_dointvec_minmax in order to specify the following write bounds :
* Bound nf_conntrack_max sysctl writings between SYSCTL_ZERO and SYSCTL_INT_MAX.
* Bound nf_conntrack_expect_max sysctl writings between SYSCTL_ONE and SYSCTL_INT_MAX as defined in the sysctl documentation.
With this patch applied, sysctl writes outside the defined in the bound will thus lead to a write error :
``` sysctl -w net.netfilter.nf_conntrack_expect_max=-1 sysctl: setting key "net.netfilter.nf_conntrack_expect_max": Invalid argument ```
--- net/netfilter/nf_conntrack_standalone.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
net/netfilter/nf_conntrack_standalone.c +9 -3
@@ -608,7 +608,9 @@ static struct ctl_table nf_ct_sysctl_table[] = { .data = &nf_conntrack_max, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_INT_MAX, }, [NF_SYSCTL_CT_COUNT] = { .procname = "nf_conntrack_count",
@@ -647,7 +649,9 @@ static struct ctl_table nf_ct_sysctl_table[] = { .data = &nf_ct_expect_max, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ONE, + .extra2 = SYSCTL_INT_MAX, }, [NF_SYSCTL_CT_ACCT] = { .procname = "nf_conntrack_acct",
@@ -926,7 +930,9 @@ static struct ctl_table nf_ct_netfilter_table[] = { .data = &nf_conntrack_max, .maxlen = sizeof(int), .mode = 0644, - .proc_handler = proc_dointvec, + .proc_handler = proc_dointvec_minmax, + .extra1 = SYSCTL_ZERO, + .extra2 = SYSCTL_INT_MAX, }, { } };
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 26/79 mmc: sdhci: Disable SD card clock before changing parameters
In reply to Sasha LevinFrom: Erick Shepherd <[email protected]>
[ Upstream commit fb3bbc46c94f261b6156ee863c1b06c84cf157dc ]
Per the SD Host Controller Simplified Specification v4.20 §3.2.3, change the SD card clock parameters only after first disabling the external card clock. Doing this fixes a spurious clock pulse on Baytrail and Apollo Lake SD controllers which otherwise breaks voltage switching with a specific Swissbit SD card.
--- drivers/mmc/host/sdhci.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +7 -2
@@ -1708,10 +1708,15 @@ void sdhci_set_clock(struct sdhci_host *host, unsigned int clock) host->mmc->actual_clock =0 ; -sdhci_writew (host,0 ,SDHCI_CLOCK_CONTROL ); + clk =sdhci_readw (host,SDHCI_CLOCK_CONTROL ); +if (clk &SDHCI_CLOCK_CARD_EN ) +sdhci_writew (host, clk & ~SDHCI_CLOCK_CARD_EN , +SDHCI_CLOCK_CONTROL ); -if (clock ==0 ) +if (clock ==0 ) { +sdhci_writew (host,0 ,SDHCI_CLOCK_CONTROL );return ; + } clk =sdhci_calc_clk (host, clock, &host->mmc->actual_clock);sdhci_enable_clk (host, clk);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 27/79 powerpc/prom_init: Fixup missing #size-cells on PowerBook6,7
In reply to Sasha LevinFrom: Andreas Schwab <[email protected]>
[ Upstream commit 7e67ef889c9ab7246547db73d524459f47403a77 ]
Similar to the PowerMac3,1, the PowerBook6,7 is missing the #size-cells property on the i2s node.
Depends-on: commit 045b14ca5c36 ("of: WARN on deprecated #address-cells/#size-cells handling")
--- arch/powerpc/kernel/prom_init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/kernel/prom_init.c +2 -2
@@ -2906,11 +2906,11 @@ static void __init fixup_device_tree_pmac(void)char type[8 ];phandle node; -// Some pmacs are missing #size-cells on escc nodes +// Some pmacs are missing #size-cells on escc or i2s nodes for (node =0 ;prom_next_node (&node); ) { type[0 ] ='\0' ;prom_getprop (node,"device_type" , type,sizeof (type)); -if (prom_strcmp (type,"escc" )) +if (prom_strcmp (type,"escc" ) &&prom_strcmp (type,"i2s" ))continue ;if (prom_getproplen (node,"#size-cells" ) !=PROM_ERROR )
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 28/79 rtc: ds1307: stop disabling alarms on probe
In reply to Sasha LevinFrom: Alexandre Belloni <[email protected]>
[ Upstream commit dcec12617ee61beed928e889607bf37e145bf86b ]
It is a bad practice to disable alarms on probe or remove as this will prevent alarms across reboots.
--- drivers/rtc/rtc-ds1307.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/rtc/rtc-ds1307.c +1 -3
@@ -1680,10 +1680,8 @@ static int ds1307_probe(struct i2c_client *client,* For some variants, be sure alarms can trigger when we're * running on Vbackup (BBSQI/BBSQW) */ -if (want_irq || ds1307_can_wakeup_device) { +if (want_irq || ds1307_can_wakeup_device) regs[0 ] |=DS1337_BIT_INTCN | chip->bbsqi_bit; - regs[0 ] &= ~(DS1337_BIT_A2IE |DS1337_BIT_A1IE ); - }regmap_write (ds1307->regmap,DS1337_REG_CONTROL , regs[0 ]);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 29/79 ieee802154: ca8210: Use proper setters and getters for bitwise types
In reply to Sasha LevinFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 169b2262205836a5d1213ff44dca2962276bece1 ]
Sparse complains that the driver doesn't respect the bitwise types:
drivers/net/ieee802154/ca8210.c:1796:27: warning: incorrect type in assignment (different base types)drivers/net/ieee802154/ca8210.c:1796:27: expected restricted __le16 [addressable] [assigned] [usertype] pan_iddrivers/net/ieee802154/ca8210.c:1796:27: got unsigned short [usertype]drivers/net/ieee802154/ca8210.c:1801:25: warning: incorrect type in assignment (different base types)drivers/net/ieee802154/ca8210.c:1801:25: expected restricted __le16 [addressable] [assigned] [usertype] pan_iddrivers/net/ieee802154/ca8210.c:1801:25: got unsigned short [usertype]drivers/net/ieee802154/ca8210.c:1928:28: warning: incorrect type in argument 3 (different base types)drivers/net/ieee802154/ca8210.c:1928:28: expected unsigned short [usertype] dst_pan_iddrivers/net/ieee802154/ca8210.c:1928:28: got restricted __le16 [addressable] [usertype] pan_id
Use proper setters and getters for bitwise types.
Note, in accordance with [1] the protocol is little endian.
--- drivers/net/ieee802154/ca8210.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-)
drivers/net/ieee802154/ca8210.c +4 -5
@@ -1487,8 +1487,7 @@ static u8 mcps_data_request( command.pdata.data_req.src_addr_mode = src_addr_mode; command.pdata.data_req.dst.mode = dst_address_mode;if (dst_address_mode !=MAC_MODE_NO_ADDR ) { - command.pdata.data_req.dst.pan_id[0 ] =LS_BYTE (dst_pan_id); - command.pdata.data_req.dst.pan_id[1 ] =MS_BYTE (dst_pan_id); +put_unaligned_le16 (dst_pan_id, command.pdata.data_req.dst.pan_id);if (dst_address_mode ==MAC_MODE_SHORT_ADDR ) { command.pdata.data_req.dst.address[0 ] =LS_BYTE ( dst_addr->short_address
@@ -1837,12 +1836,12 @@ static int ca8210_skb_rx( } hdr.source.mode = data_ind[0 ];dev_dbg (&priv->spi->dev,"srcAddrMode: %#03x\n" , hdr.source.mode); - hdr.source.pan_id = *(u16 *)&data_ind[1 ]; + hdr.source.pan_id =cpu_to_le16 (get_unaligned_le16 (&data_ind[1 ]));dev_dbg (&priv->spi->dev,"srcPanId: %#06x\n" , hdr.source.pan_id);memcpy (&hdr.source.extended_addr, &data_ind[3 ],8 ); hdr.dest.mode = data_ind[11 ];dev_dbg (&priv->spi->dev,"dstAddrMode: %#03x\n" , hdr.dest.mode); - hdr.dest.pan_id = *(u16 *)&data_ind[12 ]; + hdr.dest.pan_id =cpu_to_le16 (get_unaligned_le16 (&data_ind[12 ]));dev_dbg (&priv->spi->dev,"dstPanId: %#06x\n" , hdr.dest.pan_id);memcpy (&hdr.dest.extended_addr, &data_ind[14 ],8 );
@@ -1969,7 +1968,7 @@ static int ca8210_skb_tx( status = mcps_data_request( header.source.mode, header.dest.mode, - header.dest.pan_id, + le16_to_cpu(header.dest.pan_id), (union macaddr *)&header.dest.extended_addr, skb->len - mac_len, &skb->data[mac_len],
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 30/79 ARM: tegra: Switch DSI-B clock parent to PLLD on Tegra114
In reply to Sasha LevinFrom: Svyatoslav Ryhel <[email protected]>
[ Upstream commit 2b3db788f2f614b875b257cdb079adadedc060f3 ]
PLLD is usually used as parent clock for internal video devices, like DSI for example, while PLLD2 is used as parent for HDMI.
--- arch/arm/boot/dts/tegra114.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/tegra114.dtsi +1 -1
@@ -123,7 +123,7 @@ dsi@54400000 { reg = <0x54400000 0x00040000>; clocks = <&tegra_car TEGRA114_CLK_DSIB>, <&tegra_car TEGRA114_CLK_DSIBLP>, - <&tegra_car TEGRA114_CLK_PLL_D2_OUT0>; + <&tegra_car TEGRA114_CLK_PLL_D_OUT0>; clock-names = "dsi", "lp", "parent"; resets = <&tegra_car 82>; reset-names = "dsi";
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 31/79 media: c8sectpfe: Call of_node_put(i2c_bus) only once in c8sectpfe_probe()
In reply to Sasha LevinFrom: Markus Elfring <[email protected]>
[ Upstream commit b773530a34df0687020520015057075f8b7b4ac4 ]
An of_node_put(i2c_bus) call was immediately used after a pointer check for an of_find_i2c_adapter_by_node() call in this function implementation. Thus call such a function only once instead directly before the check.
This issue was transformed by using the Coccinelle software.
--- drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c +1 -2
@@ -813,13 +813,12 @@ static int c8sectpfe_probe(struct platform_device *pdev) } tsin->i2c_adapter =of_find_i2c_adapter_by_node (i2c_bus); +of_node_put (i2c_bus);if (!tsin->i2c_adapter) {dev_err (&pdev->dev,"No i2c adapter found\n" ); -of_node_put (i2c_bus); ret = -ENODEV ; goto err_clk_disable; } -of_node_put (i2c_bus); tsin->rst_gpio =of_get_named_gpio (child,"reset-gpios" ,0 );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 32/79 dm cache: prevent BUG_ON by blocking retries on failed device resumes
In reply to Sasha LevinFrom: Ming-Hung Tsai <[email protected]>
[ Upstream commit 5da692e2262b8f81993baa9592f57d12c2703dea ]
A cache device failing to resume due to mapping errors should not be retried, as the failure leaves a partially initialized policy object. Repeating the resume operation risks triggering BUG_ON when reloading cache mappings into the incomplete policy object.
Reproduce steps:
1. create a cache metadata consisting of 512 or more cache blocks, with some mappings stored in the first array block of the mapping array. Here we use cache_restore v1.0 to build the metadata.
cat <<EOF >> cmeta.xml
<superblock uuid="" block_size="128" nr_cache_blocks="512" \
policy="smq" hint_width="4">
<mappings>
<mapping cache_block="0" origin_block="0" dirty="false"/>
</mappings>
</superblock>
EOF
dmsetup create cmeta --table "0 8192 linear /dev/sdc 0" cache_restore -i cmeta.xml -o /dev/mapper/cmeta --metadata-version=2 dmsetup remove cmeta
2. wipe the second array block of the mapping array to simulate data degradations.
mapping_root=$(dd if=/dev/sdc bs=1c count=8 skip=192 \
2>/dev/null | hexdump -e '1/8 "%u\n"')
ablock=$(dd if=/dev/sdc bs=1c count=8 skip=$((4096*mapping_root+2056)) \
2>/dev/null | hexdump -e '1/8 "%u\n"')
dd if=/dev/zero of=/dev/sdc bs=4k count=1 seek=$ablock
3. try bringing up the cache device. The resume is expected to fail due to the broken array block.
dmsetup create cmeta --table "0 8192 linear /dev/sdc 0" dmsetup create cdata --table "0 65536 linear /dev/sdc 8192" dmsetup create corig --table "0 524288 linear /dev/sdc 262144" dmsetup create cache --notable
dmsetup load cache --table "0 524288 cache /dev/mapper/cmeta \/dev/mapper/cdata /dev/mapper/corig 128 2 metadata2 writethrough smq 0" dmsetup resume cache
4. try resuming the cache again. An unexpected BUG_ON is triggered while loading cache mappings.
dmsetup resume cache
Kernel logs:
(snip)
------------[ cut here ]------------ kernel BUG at drivers/md/dm-cache-policy-smq.c:752! Oops: invalid opcode: 0000 [#1] PREEMPT SMP KASAN NOPTI CPU: 0 UID: 0 PID: 332 Comm: dmsetup Not tainted 6.13.4 #3 RIP: 0010:smq_load_mapping+0x3e5/0x570
Fix by disallowing resume operations for devices that failed the initial attempt.
--- drivers/md/dm-cache-target.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/md/dm-cache-target.c +24 -0
@@ -2996,6 +2996,27 @@ static dm_cblock_t get_cache_dev_size(struct cache *cache)return to_cblock (size); } +static bool can_resume (struct cache *cache) +{ +/* +* Disallow retrying the resume operation for devices that failed the +* first resume attempt, as the failure leaves the policy object partially +* initialized. Retrying could trigger BUG_ON when loading cache mappings +* into the incomplete policy object. +*/ +if (cache->sized && !cache->loaded_mappings) { +if (get_cache_mode (cache) !=CM_WRITE ) +DMERR ("%s: unable to resume a failed-loaded cache, please check metadata." , +cache_device_name (cache)); +else +DMERR ("%s: unable to resume cache due to missing proper cache table reload" , +cache_device_name (cache)); +return false; + } + +return true; +} +static bool can_resize (struct cache *cache,dm_cblock_t new_size) {if (from_cblock (new_size) >from_cblock (cache->cache_size)) {
@@ -3044,6 +3065,9 @@ static int cache_preresume(struct dm_target *ti)struct cache *cache = ti->private;dm_cblock_t csize =get_cache_dev_size (cache); +if (!can_resume (cache)) +return -EINVAL ; +/* * Check to see if the cache has resized. */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 33/79 orangefs: Do not truncate file size
In reply to Sasha LevinFrom: "Matthew Wilcox (Oracle)" <[email protected]>
[ Upstream commit 062e8093592fb866b8e016641a8b27feb6ac509d ]
'len' is used to store the result of i_size_read(), so making 'len' a size_t results in truncation to 4GiB on 32-bit systems.
--- fs/orangefs/inode.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/orangefs/inode.c +3 -4
@@ -22,9 +22,9 @@ static int orangefs_writepage_locked(struct page *page,struct orangefs_write_range *wr =NULL ;struct iov_iter iter;struct bio_vec bv; -size_t len, wlen; +size_t wlen;ssize_t ret; -loff_t off; +loff_t len, off;set_page_writeback (page);
@@ -98,8 +98,7 @@ static int orangefs_writepages_work(struct orangefs_writepages *ow,struct orangefs_write_range *wrp, wr;struct iov_iter iter;ssize_t ret; -size_t len; -loff_t off; +loff_t len, off;int i; len =i_size_read (inode);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 34/79 media: cx231xx: set device_caps for 417
In reply to Sasha LevinFrom: Hans Verkuil <[email protected]>
[ Upstream commit a79efc44b51432490538a55b9753a721f7d3ea42 ]
The video_device for the MPEG encoder did not set device_caps.
Add this, otherwise the video device can't be registered (you get a WARN_ON instead).
Not seen before since currently 417 support is disabled, but I found this while experimenting with it.
--- drivers/media/usb/cx231xx/cx231xx-417.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/usb/cx231xx/cx231xx-417.c +2 -0
@@ -1966,6 +1966,8 @@ static void cx231xx_video_dev_init( vfd->lock = &dev->lock; vfd->release = video_device_release_empty; vfd->ctrl_handler = &dev->mpeg_ctrl_handler.hdl; + vfd->device_caps =V4L2_CAP_READWRITE |V4L2_CAP_STREAMING | +V4L2_CAP_VIDEO_CAPTURE ;video_set_drvdata (vfd, dev);if (dev->tuner_type ==TUNER_ABSENT ) {v4l2_disable_ioctl (vfd,VIDIOC_G_FREQUENCY );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 35/79 pinctrl: bcm281xx: Use "unsigned int" instead of bare "unsigned"
In reply to Sasha LevinFrom: Artur Weber <[email protected]>
[ Upstream commit 07b5a2a13f4704c5eae3be7277ec54ffdba45f72 ]
Replace uses of bare "unsigned" with "unsigned int" to fix checkpatch warnings. No functional change.
--- drivers/pinctrl/bcm/pinctrl-bcm281xx.c | 44 +++++++++++++------------- 1 file changed, 22 insertions(+), 22 deletions(-)
drivers/pinctrl/bcm/pinctrl-bcm281xx.c +22 -22
@@ -79,7 +79,7 @@ static enum bcm281xx_pin_type hdmi_pin = BCM281XX_PIN_TYPE_HDMI;struct bcm281xx_pin_function {const char *name;const char *const *groups; -const unsigned ngroups; +const unsigned int ngroups; };/**
@@ -91,10 +91,10 @@ struct bcm281xx_pinctrl_data {/* List of all pins */ const struct pinctrl_pin_desc *pins; -const unsigned npins; +const unsigned int npins;const struct bcm281xx_pin_function *functions; -const unsigned nfunctions; +const unsigned int nfunctions;struct regmap *regmap; };
@@ -948,7 +948,7 @@ static struct bcm281xx_pinctrl_data bcm281xx_pinctrl = { };static inline enum bcm281xx_pin_type pin_type_get (struct pinctrl_dev *pctldev, -unsigned pin) +unsigned int pin) {struct bcm281xx_pinctrl_data *pdata =pinctrl_dev_get_drvdata (pctldev);
@@ -992,7 +992,7 @@ static int bcm281xx_pinctrl_get_groups_count(struct pinctrl_dev *pctldev) }static const char *bcm281xx_pinctrl_get_group_name (struct pinctrl_dev *pctldev, -unsigned group) +unsigned int group) {struct bcm281xx_pinctrl_data *pdata =pinctrl_dev_get_drvdata (pctldev);
@@ -1000,9 +1000,9 @@ static const char *bcm281xx_pinctrl_get_group_name(struct pinctrl_dev *pctldev, }static int bcm281xx_pinctrl_get_group_pins (struct pinctrl_dev *pctldev, -unsigned group, +unsigned int group,const unsigned **pins, -unsigned *num_pins) +unsigned int *num_pins) {struct bcm281xx_pinctrl_data *pdata =pinctrl_dev_get_drvdata (pctldev);
@@ -1014,7 +1014,7 @@ static int bcm281xx_pinctrl_get_group_pins(struct pinctrl_dev *pctldev,static void bcm281xx_pinctrl_pin_dbg_show (struct pinctrl_dev *pctldev,struct seq_file *s, -unsigned offset) +unsigned int offset) {seq_printf (s," %s" ,dev_name (pctldev->dev)); }
@@ -1036,7 +1036,7 @@ static int bcm281xx_pinctrl_get_fcns_count(struct pinctrl_dev *pctldev) }static const char *bcm281xx_pinctrl_get_fcn_name (struct pinctrl_dev *pctldev, -unsigned function) +unsigned int function) {struct bcm281xx_pinctrl_data *pdata =pinctrl_dev_get_drvdata (pctldev);
@@ -1044,9 +1044,9 @@ static const char *bcm281xx_pinctrl_get_fcn_name(struct pinctrl_dev *pctldev, }static int bcm281xx_pinctrl_get_fcn_groups (struct pinctrl_dev *pctldev, -unsigned function, +unsigned int function,const char *const **groups, -unsigned *const num_groups) +unsigned int *const num_groups) {struct bcm281xx_pinctrl_data *pdata =pinctrl_dev_get_drvdata (pctldev);
@@ -1057,8 +1057,8 @@ static int bcm281xx_pinctrl_get_fcn_groups(struct pinctrl_dev *pctldev, }static int bcm281xx_pinmux_set (struct pinctrl_dev *pctldev, -unsigned function, -unsigned group) +unsigned int function, +unsigned int group) {struct bcm281xx_pinctrl_data *pdata =pinctrl_dev_get_drvdata (pctldev);const struct bcm281xx_pin_function *f = &pdata->functions[function];
@@ -1089,7 +1089,7 @@ static const struct pinmux_ops bcm281xx_pinctrl_pinmux_ops = { };static int bcm281xx_pinctrl_pin_config_get (struct pinctrl_dev *pctldev, -unsigned pin, +unsigned int pin,unsigned long *config) {return -ENOTSUPP ;
@@ -1098,9 +1098,9 @@ static int bcm281xx_pinctrl_pin_config_get(struct pinctrl_dev *pctldev,/* Goes through the configs and update register val/mask */ static int bcm281xx_std_pin_update (struct pinctrl_dev *pctldev, -unsigned pin, +unsigned int pin,unsigned long *configs, -unsigned num_configs, +unsigned int num_configs,u32 *val,u32 *mask) {
@@ -1214,9 +1214,9 @@ static const u16 bcm281xx_pullup_map[] = {/* Goes through the configs and update register val/mask */ static int bcm281xx_i2c_pin_update (struct pinctrl_dev *pctldev, -unsigned pin, +unsigned int pin,unsigned long *configs, -unsigned num_configs, +unsigned int num_configs,u32 *val,u32 *mask) {
@@ -1284,9 +1284,9 @@ static int bcm281xx_i2c_pin_update(struct pinctrl_dev *pctldev,/* Goes through the configs and update register val/mask */ static int bcm281xx_hdmi_pin_update (struct pinctrl_dev *pctldev, -unsigned pin, +unsigned int pin,unsigned long *configs, -unsigned num_configs, +unsigned int num_configs,u32 *val,u32 *mask) {
@@ -1328,9 +1328,9 @@ static int bcm281xx_hdmi_pin_update(struct pinctrl_dev *pctldev, }static int bcm281xx_pinctrl_pin_config_set (struct pinctrl_dev *pctldev, -unsigned pin, +unsigned int pin,unsigned long *configs, -unsigned num_configs) +unsigned int num_configs) {struct bcm281xx_pinctrl_data *pdata =pinctrl_dev_get_drvdata (pctldev);enum bcm281xx_pin_type pin_type;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 36/79 net: pktgen: fix mpls maximum labels list parsing
In reply to Sasha LevinFrom: Peter Seiderer <[email protected]>
[ Upstream commit 2b15a0693f70d1e8119743ee89edbfb1271b3ea8 ]
Fix mpls maximum labels list parsing up to MAX_MPLS_LABELS entries (instead of up to MAX_MPLS_LABELS - 1).
Addresses the following:
$ echo "mpls 00000f00,00000f01,00000f02,00000f03,00000f04,00000f05,00000f06,00000f07,00000f08,00000f09,00000f0a,00000f0b,00000f0c,00000f0d,00000f0e,00000f0f" > /proc/net/pktgen/lo\@0 -bash: echo: write error: Argument list too long
--- net/core/pktgen.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/core/pktgen.c +4 -2
@@ -805,6 +805,10 @@ static ssize_t get_labels(const char __user *buffer, struct pktgen_dev *pkt_dev) pkt_dev->nr_labels =0 ; do { __u32 tmp; + + if (n >= MAX_MPLS_LABELS) + return -E2BIG; + len = hex32_arg(&buffer[i], 8, &tmp); if (len <= 0) return len;
@@ -816,8 +820,6 @@ static ssize_t get_labels(const char __user *buffer, struct pktgen_dev *pkt_dev)return -EFAULT ; i++; n++; -if (n >=MAX_MPLS_LABELS ) -return -E2BIG ; }while (c ==',' ); pkt_dev->nr_labels = n;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 37/79 x86/bugs: Make spectre user default depend on MITIGATION_SPECTRE_V2
In reply to Sasha LevinFrom: Breno Leitao <[email protected]>
[ Upstream commit 98fdaeb296f51ef08e727a7cc72e5b5c864c4f4d ]
Change the default value of spectre v2 in user mode to respect the CONFIG_MITIGATION_SPECTRE_V2 config option.
Currently, user mode spectre v2 is set to auto
(SPECTRE_V2_USER_CMD_AUTO) by default, even ifCONFIG_MITIGATION_SPECTRE_V2 is disabled.
Set the spectre_v2 value to auto (SPECTRE_V2_USER_CMD_AUTO) if the Spectre v2 config (CONFIG_MITIGATION_SPECTRE_V2) is enabled, otherwise set the value to none (SPECTRE_V2_USER_CMD_NONE).
Important to say the command line argument "spectre_v2_user" overwrites the default value in both cases.
When CONFIG_MITIGATION_SPECTRE_V2 is not set, users have the flexibility to opt-in for specific mitigations independently. In this scenario, setting spectre_v2= will not enable spectre_v2_user=, and command line options spectre_v2_user and spectre_v2 are independent when CONFIG_MITIGATION_SPECTRE_V2=n.
--- Documentation/admin-guide/kernel-parameters.txt | 2 ++ arch/x86/kernel/cpu/bugs.c | 10 +++++++--- 2 files changed, 9 insertions(+), 3 deletions(-)
Documentation/admin-guide/kernel-parameters.txt +2 -0
@@ -4600,6 +4600,8 @@ Selecting 'on' will also enable the mitigation against user space to user space task attacks. + Selecting specific mitigation does not force enable + user mitigations. Selecting 'off' will disable both the kernel and the user space protections.
arch/x86/kernel/cpu/bugs.c +7 -3
@@ -1050,9 +1050,13 @@ static __ro_after_init enum spectre_v2_mitigation_cmd spectre_v2_cmd;static enum spectre_v2_user_cmd __init spectre_v2_parse_user_cmdline (void ) { +enum spectre_v2_user_cmd mode;char arg[20 ];int ret, i; + mode =IS_ENABLED (CONFIG_MITIGATION_SPECTRE_V2 ) ? +SPECTRE_V2_USER_CMD_AUTO :SPECTRE_V2_USER_CMD_NONE ; +switch (spectre_v2_cmd) {case SPECTRE_V2_CMD_NONE :return SPECTRE_V2_USER_CMD_NONE ;
@@ -1065,7 +1069,7 @@ spectre_v2_parse_user_cmdline(void) ret =cmdline_find_option (boot_command_line,"spectre_v2_user" , arg,sizeof (arg));if (ret <0 ) -return SPECTRE_V2_USER_CMD_AUTO ; +return mode;for (i =0 ; i <ARRAY_SIZE (v2_user_options); i++) {if (match_option (arg, ret, v2_user_options[i].option)) {
@@ -1075,8 +1079,8 @@ spectre_v2_parse_user_cmdline(void) } } -pr_err ("Unknown user space protection option (%s). Switching to AUTO select\n" , arg); -return SPECTRE_V2_USER_CMD_AUTO ; +pr_err ("Unknown user space protection option (%s). Switching to default\n" , arg); +return mode; }static inline bool spectre_v2_in_eibrs_mode (enum spectre_v2_mitigation mode)
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 38/79 hwmon: (gpio-fan) Add missing mutex locks
In reply to Sasha LevinFrom: Alexander Stein <[email protected]>
[ Upstream commit 9fee7d19bab635f89223cc40dfd2c8797fdc4988 ]
set_fan_speed() is expected to be called with fan_data->lock being locked. Add locking for proper synchronization.
--- drivers/hwmon/gpio-fan.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
drivers/hwmon/gpio-fan.c +15 -1
@@ -394,7 +394,12 @@ static int gpio_fan_set_cur_state(struct thermal_cooling_device *cdev,if (state >= fan_data->num_speed)return -EINVAL ; +mutex_lock (&fan_data->lock); +set_fan_speed (fan_data, state); + +mutex_unlock (&fan_data->lock); +return 0 ; }
@@ -490,7 +495,11 @@ MODULE_DEVICE_TABLE(of, of_gpio_fan_match);static void gpio_fan_stop (void *data) { +struct gpio_fan_data *fan_data = data; + +mutex_lock (&fan_data->lock);set_fan_speed (data,0 ); +mutex_unlock (&fan_data->lock); }static int gpio_fan_probe (struct platform_device *pdev)
@@ -564,7 +573,9 @@ static int gpio_fan_suspend(struct device *dev)if (fan_data->gpios) { fan_data->resume_speed = fan_data->speed_index; +mutex_lock (&fan_data->lock);set_fan_speed (fan_data,0 ); +mutex_unlock (&fan_data->lock); }return 0 ;
@@ -574,8 +585,11 @@ static int gpio_fan_resume(struct device *dev) {struct gpio_fan_data *fan_data =dev_get_drvdata (dev); -if (fan_data->gpios) +if (fan_data->gpios) { +mutex_lock (&fan_data->lock);set_fan_speed (fan_data, fan_data->resume_speed); +mutex_unlock (&fan_data->lock); + }return 0 ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 39/79 drm/mediatek: mtk_dpi: Add checks for reg_h_fre_con existence
In reply to Sasha LevinFrom: AngeloGioacchino Del Regno <[email protected]>
[ Upstream commit 8c9da7cd0bbcc90ab444454fecf535320456a312 ]
In preparation for adding support for newer DPI instances which do support direct-pin but do not have any H_FRE_CON register, like the one found in MT8195 and MT8188, add a branch to check if the reg_h_fre_con variable was declared in the mtk_dpi_conf structure for the probed SoC DPI version.
As a note, this is useful specifically only for cases in which the support_direct_pin variable is true, so mt8195-dpintf is not affected by any issue.
--- drivers/gpu/drm/mediatek/mtk_dpi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/mediatek/mtk_dpi.c +3 -2
@@ -337,12 +337,13 @@ static void mtk_dpi_config_swap_input(struct mtk_dpi *dpi, bool enable)static void mtk_dpi_config_2n_h_fre (struct mtk_dpi *dpi) { -mtk_dpi_mask (dpi, dpi->conf->reg_h_fre_con,H_FRE_2N ,H_FRE_2N ); +if (dpi->conf->reg_h_fre_con) +mtk_dpi_mask (dpi, dpi->conf->reg_h_fre_con,H_FRE_2N ,H_FRE_2N ); }static void mtk_dpi_config_disable_edge (struct mtk_dpi *dpi) { -if (dpi->conf->edge_sel_en) +if (dpi->conf->edge_sel_en && dpi->conf->reg_h_fre_con)mtk_dpi_mask (dpi, dpi->conf->reg_h_fre_con,0 ,EDGE_SEL_EN ); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 40/79 fpga: altera-cvp: Increase credit timeout
In reply to Sasha LevinFrom: Kuhanh Murugasen Krishnan <[email protected]>
[ Upstream commit 0f05886a40fdc55016ba4d9ae0a9c41f8312f15b ]
Increase the timeout for SDM (Secure device manager) data credits from 20ms to 40ms. Internal stress tests running at 500 loops failed with the current timeout of 20ms. At the start of a FPGA configuration, the CVP host driver reads the transmit credits from SDM. It then sends bitstream FPGA data to SDM based on the total credits. Each credit allows the CVP host driver to send 4kBytes of data. There are situations whereby, the SDM did not respond in time during testing.
--- drivers/fpga/altera-cvp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/fpga/altera-cvp.c +1 -1
@@ -52,7 +52,7 @@/* V2 Defines */ #define VSE_CVP_TX_CREDITS 0x49/* 8bit */ -#define V2_CREDIT_TIMEOUT_US 20000 +#define V2_CREDIT_TIMEOUT_US 40000#define V2_CHECK_CREDIT_US 10#define V2_POLL_TIMEOUT_US 1000000#define V2_USER_TIMEOUT_US 500000
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 41/79 net/mlx5: Avoid report two health errors on same syndrome
In reply to Sasha LevinFrom: Moshe Shemesh <[email protected]>
[ Upstream commit b5d7b2f04ebcff740f44ef4d295b3401aeb029f4 ]
In case health counter has not increased for few polling intervals, miss counter will reach max misses threshold and health report will be triggered for FW health reporter. In case syndrome found on same health poll another health report will be triggered.
Avoid two health reports on same syndrome by marking this syndrome as already known.
--- drivers/net/ethernet/mellanox/mlx5/core/health.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/mellanox/mlx5/core/health.c +1 -0
@@ -736,6 +736,7 @@ static void poll_health(struct timer_list *t) health->prev = count;if (health->miss_counter ==MAX_MISSES ) {mlx5_core_err (dev,"device's health compromised - reached miss count\n" ); + health->synd =ioread8 (&h->synd);print_health_info (dev);queue_work (health->wq, &health->report_work); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 42/79 drm/amdkfd: KFD release_work possible circular locking
In reply to Sasha LevinFrom: Philip Yang <[email protected]>
[ Upstream commit 1b9366c601039d60546794c63fbb83ce8e53b978 ]
If waiting for gpu reset done in KFD release_work, thers is WARNING:
possible circular locking dependency detected
#2 kfd_create_process
kfd_process_mutex
flush kfd release work
#1 kfd release work
wait for amdgpu reset work
#0 amdgpu_device_gpu_reset
kgd2kfd_pre_reset
kfd_process_mutex
Possible unsafe locking scenario:
CPU0 CPU1
---- ----
lock((work_completion)(&p->release_work));
lock((wq_completion)kfd_process_wq);
lock((work_completion)(&p->release_work));lock((wq_completion)amdgpu-reset-dev);
To fix this, KFD create process move flush release work outside kfd_process_mutex.
--- drivers/gpu/drm/amd/amdkfd/kfd_process.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/amd/amdkfd/kfd_process.c +8 -8
@@ -277,6 +277,14 @@ struct kfd_process *kfd_create_process(struct file *filep)if (thread->group_leader->mm != thread->mm)return ERR_PTR (-EINVAL ); +/* If the process just called exec(3), it is possible that the +* cleanup of the kfd_process (following the release of the mm +* of the old process image) is still in the cleanup work queue. +* Make sure to drain any job before trying to recreate any +* resource for this process. +*/ +flush_workqueue (kfd_process_wq); +/* * take kfd processes mutex before starting of process creation * so there won't be a case where two threads of the same process
@@ -289,14 +297,6 @@ struct kfd_process *kfd_create_process(struct file *filep)if (process) {pr_debug ("Process already found\n" ); }else { -/* If the process just called exec(3), it is possible that the -* cleanup of the kfd_process (following the release of the mm -* of the old process image) is still in the cleanup work queue. -* Make sure to drain any job before trying to recreate any -* resource for this process. -*/ -flush_workqueue (kfd_process_wq); - process =create_process (thread);if (IS_ERR (process)) goto out;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 43/79 net: xgene-v2: remove incorrect ACPI_PTR annotation
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 01358e8fe922f716c05d7864ac2213b2440026e7 ]
Building with W=1 shows a warning about xge_acpi_match being unused when CONFIG_ACPI is disabled:
drivers/net/ethernet/apm/xgene-v2/main.c:723:36: error: unused variable 'xge_acpi_match' [-Werror,-Wunused-const-variable]
--- drivers/net/ethernet/apm/xgene-v2/main.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/net/ethernet/apm/xgene-v2/main.c +1 -3
@@ -9,8 +9,6 @@#include "main.h" -static const struct acpi_device_id xge_acpi_match[]; -static int xge_get_resources (struct xge_pdata *pdata) {struct platform_device *pdev;
@@ -733,7 +731,7 @@ MODULE_DEVICE_TABLE(acpi, xge_acpi_match);static struct platform_driver xge_driver = { .driver = { .name ="xgene-enet-v2" , - .acpi_match_table =ACPI_PTR (xge_acpi_match), + .acpi_match_table = xge_acpi_match, }, .probe = xge_probe, .remove = xge_remove,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 44/79 bonding: report duplicate MAC address in all situations
In reply to Sasha LevinFrom: Hangbin Liu <[email protected]>
[ Upstream commit 28d68d396a1cd21591e8c6d74afbde33a7ea107e ]
Normally, a bond uses the MAC address of the first added slave as the bond’s MAC address. And the bond will set active slave’s MAC address to bond’s address if fail_over_mac is set to none (0) or follow (2).
When the first slave is removed, the bond will still use the removed slave’s MAC address, which can lead to a duplicate MAC address and potentially cause issues with the switch. To avoid confusion, let's warn the user in all situations, including when fail_over_mac is set to 2 or not in active-backup mode.
--- drivers/net/bonding/bond_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/bonding/bond_main.c +1 -1
@@ -1954,7 +1954,7 @@ static int __bond_release_one(struct net_device *bond_dev,RCU_INIT_POINTER (bond->current_arp_slave,NULL ); -if (!all && (!bond->params.fail_over_mac || +if (!all && (bond->params.fail_over_mac !=BOND_FOM_ACTIVE ||BOND_MODE (bond) !=BOND_MODE_ACTIVEBACKUP )) {if (ether_addr_equal_64bits (bond_dev->dev_addr, slave->perm_hwaddr) &&bond_has_slaves (bond))
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 45/79 x86/nmi: Add an emergency handler in nmi_desc & use it in nmi_shootdown_cpus()
In reply to Sasha LevinFrom: Waiman Long <[email protected]>
[ Upstream commit fe37c699ae3eed6e02ee55fbf5cb9ceb7fcfd76c ]
Depending on the type of panics, it was found that the __register_nmi_handler() function can be called in NMI context from nmi_shootdown_cpus() leading to a lockdep splat:
WARNING: inconsistent lock state
inconsistent {INITIAL USE} -> {IN-NMI} usage.
lock(&nmi_desc[0].lock);
<Interrupt>
lock(&nmi_desc[0].lock); Call Trace:
_raw_spin_lock_irqsave
__register_nmi_handler
nmi_shootdown_cpus
kdump_nmi_shootdown_cpus
native_machine_crash_shutdown
__crash_kexecIn this particular case, the following panic message was printed before:
Kernel panic - not syncing: Fatal hardware error!
This message seemed to be given out from __ghes_panic() running in NMI context.
The __register_nmi_handler() function which takes the nmi_desc lock with irq disabled shouldn't be called from NMI context as this can lead to deadlock.
The nmi_shootdown_cpus() function can only be invoked once. After the first invocation, all other CPUs should be stuck in the newly added crash_nmi_callback() and cannot respond to a second NMI.
Fix it by adding a new emergency NMI handler to the nmi_desc structure and provide a new set_emergency_nmi_handler() helper to set crash_nmi_callback() in any context. The new emergency handler will preempt other handlers in the linked list. That will eliminate the need to take any lock and serve the panic in NMI use case.
--- arch/x86/include/asm/nmi.h | 2 ++ arch/x86/kernel/nmi.c | 42 ++++++++++++++++++++++++++++++++++++++ arch/x86/kernel/reboot.c | 10 +++------ 3 files changed, 47 insertions(+), 7 deletions(-)
arch/x86/include/asm/nmi.h +2 -0
@@ -59,6 +59,8 @@ int __register_nmi_handler(unsigned int, struct nmiaction *);void unregister_nmi_handler (unsigned int ,const char *); +void set_emergency_nmi_handler (unsigned int type,nmi_handler_t handler); +void stop_nmi (void );void restart_nmi (void );void local_touch_nmi (void );
arch/x86/kernel/nmi.c +42 -0
65 lines not on this page · raw message
arch/x86/kernel/reboot.c +3 -7
@@ -875,15 +875,11 @@ void nmi_shootdown_cpus(nmi_shootdown_cb callback) shootdown_callback = callback;atomic_set (&waiting_for_crash_ipi,num_online_cpus () -1 ); -/* Would it be better to replace the trap vector here? */ -if (register_nmi_handler (NMI_LOCAL , crash_nmi_callback, -NMI_FLAG_FIRST ,"crash" )) -return ;/* Return what? */ +/* -* Ensure the new callback function is set before sending -* out the NMI +* Set emergency handler to preempt other handlers. */ -wmb (); +set_emergency_nmi_handler (NMI_LOCAL , crash_nmi_callback);apic_send_IPI_allbutself (NMI_VECTOR );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 46/79 cpuidle: menu: Avoid discarding useful information
In reply to Sasha LevinFrom: "Rafael J. Wysocki" <[email protected]>
[ Upstream commit 85975daeaa4d6ec560bfcd354fc9c08ad7f38888 ]
When giving up on making a high-confidence prediction, get_typical_interval() always returns UINT_MAX which means that the next idle interval prediction will be based entirely on the time till the next timer. However, the information represented by the most recent intervals may not be completely useless in those cases.
Namely, the largest recent idle interval is an upper bound on the recently observed idle duration, so it is reasonable to assume that the next idle duration is unlikely to exceed it. Moreover, this is still true after eliminating the suspected outliers if the sample set still under consideration is at least as large as 50% of the maximum sample set size.
Accordingly, make get_typical_interval() return the current maximum recent interval value in that case instead of UINT_MAX.
--- drivers/cpuidle/governors/menu.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/cpuidle/governors/menu.c +12 -1
@@ -259,8 +259,19 @@ static unsigned int get_typical_interval(struct menu_device *data,* This can deal with workloads that have long pauses interspersed * with sporadic activity with a bunch of short pauses. */ -if ((divisor *4 ) <=INTERVALS *3 ) +if (divisor *4 <=INTERVALS *3 ) { +/* +* If there are sufficiently many data points still under +* consideration after the outliers have been eliminated, +* returning without a prediction would be a mistake because it +* is likely that the next interval will not exceed the current +* maximum, so return the latter in that case. +*/ +if (divisor >=INTERVALS /2 ) +return max; +return UINT_MAX ; + } thresh = max -1 ; goto again;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 47/79 MIPS: Use arch specific syscall name match function
In reply to Sasha LevinFrom: Bibo Mao <[email protected]>
[ Upstream commit 756276ce78d5624dc814f9d99f7d16c8fd51076e ]
On MIPS system, most of the syscall function name begin with prefix sys_. Some syscalls are special such as clone/fork, function name of these begin with __sys_. Since scratch registers need be saved in stack when these system calls happens.
With ftrace system call method, system call functions are declared with SYSCALL_DEFINEx, metadata of the system call symbol name begins with sys_. Here mips specific function arch_syscall_match_sym_name is used to compare function name between sys_call_table[] and metadata of syscall symbol.
--- arch/mips/include/asm/ftrace.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
arch/mips/include/asm/ftrace.h +16 -0
@@ -87,4 +87,20 @@ struct dyn_arch_ftrace {#endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* __ASSEMBLY__ */ #endif /* CONFIG_FUNCTION_TRACER */ + +#ifdef CONFIG_FTRACE_SYSCALLS +#ifndef __ASSEMBLY__ +/* +* Some syscall entry functions on mips start with "__sys_" (fork and clone, +* for instance). We should also match the sys_ variant with those. +*/ +#define ARCH_HAS_SYSCALL_MATCH_SYM_NAME +static inline bool arch_syscall_match_sym_name (const char *sym, +const char *name) +{ +return !strcmp (sym, name) || + (!strncmp (sym,"__sys_" ,6 ) && !strcmp (sym +6 , name +4 )); +} +#endif /* __ASSEMBLY__ */ +#endif /* CONFIG_FTRACE_SYSCALLS */ #endif /* _ASM_MIPS_FTRACE_H */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 48/79 MIPS: pm-cps: Use per-CPU variables as per-CPU, not per-core
In reply to Sasha LevinFrom: Paul Burton <[email protected]>
[ Upstream commit 00a134fc2bb4a5f8fada58cf7ff4259149691d64 ]
The pm-cps code has up until now used per-CPU variables indexed by core, rather than CPU number, in order to share data amongst sibling CPUs (ie. VPs/threads in a core). This works fine for single cluster systems, but with multi-cluster systems a core number is no longer unique in the system, leading to sharing between CPUs that are not actually siblings.
Avoid this issue by using per-CPU variables as they are more generally used - ie. access them using CPU numbers rather than core numbers. Sharing between siblings is then accomplished by:
- Assigning the same pointer to entries for each sibling CPU for the nc_asm_enter & ready_count variables, which allow this by virtue of being per-CPU pointers.
- Indexing by the first CPU set in a CPUs cpu_sibling_map in the case of pm_barrier, for which we can't use the previous approach because the per-CPU variable is not a pointer.
--- arch/mips/kernel/pm-cps.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-)
arch/mips/kernel/pm-cps.c +17 -13
@@ -56,10 +56,7 @@ static DEFINE_PER_CPU_ALIGNED(u32*, ready_count);/* Indicates online CPUs coupled with the current CPU */ static DEFINE_PER_CPU_ALIGNED(cpumask_t, online_coupled); -/* -* Used to synchronize entry to deep idle states. Actually per-core rather -* than per-CPU. -*/ +/* Used to synchronize entry to deep idle states */ static DEFINE_PER_CPU_ALIGNED(atomic_t, pm_barrier);/* Saved CPU state across the CPS_PM_POWER_GATED state */
@@ -118,9 +115,10 @@ int cps_pm_enter_state(enum cps_pm_state state)cps_nc_entry_fn entry;struct core_boot_config *core_cfg;struct vpe_boot_config *vpe_cfg; +atomic_t *barrier;/* Check that there is an entry function for this state */ - entry =per_cpu (nc_asm_enter, core)[state]; + entry =per_cpu (nc_asm_enter, cpu)[state];if (!entry)return -EINVAL ;
@@ -156,7 +154,7 @@ int cps_pm_enter_state(enum cps_pm_state state)smp_mb__after_atomic ();/* Create a non-coherent mapping of the core ready_count */ - core_ready_count =per_cpu (ready_count, core); + core_ready_count =per_cpu (ready_count, cpu); nc_addr =kmap_noncoherent (virt_to_page (core_ready_count), (unsigned long )core_ready_count); nc_addr += ((unsigned long )core_ready_count & ~PAGE_MASK );
@@ -164,7 +162,8 @@ int cps_pm_enter_state(enum cps_pm_state state)/* Ensure ready_count is zero-initialised before the assembly runs */ WRITE_ONCE (*nc_core_ready_count,0 ); -coupled_barrier (&per_cpu (pm_barrier, core), online); + barrier = &per_cpu (pm_barrier,cpumask_first (&cpu_sibling_map[cpu])); +coupled_barrier (barrier, online);/* Run the generated entry code */ left =entry (online, nc_core_ready_count);
@@ -635,12 +634,14 @@ static void *cps_gen_entry_code(unsigned cpu, enum cps_pm_state state)static int cps_pm_online_cpu (unsigned int cpu) { -enum cps_pm_state state; -unsigned core =cpu_core (&cpu_data[cpu]); +unsigned int sibling, core;void *entry_fn, *core_rc; +enum cps_pm_state state; + + core =cpu_core (&cpu_data[cpu]);for (state =CPS_PM_NC_WAIT ; state <CPS_PM_STATE_COUNT ; state++) { -if (per_cpu (nc_asm_enter, core)[state]) +if (per_cpu (nc_asm_enter, cpu)[state])continue ;if (!test_bit (state, state_support))continue ;
@@ -652,16 +653,19 @@ static int cps_pm_online_cpu(unsigned int cpu)clear_bit (state, state_support); } -per_cpu (nc_asm_enter, core)[state] = entry_fn; +for_each_cpu (sibling, &cpu_sibling_map[cpu]) +per_cpu (nc_asm_enter, sibling)[state] = entry_fn; } -if (!per_cpu (ready_count, core)) { +if (!per_cpu (ready_count, cpu)) { core_rc =kmalloc (sizeof (u32),GFP_KERNEL );if (!core_rc) {pr_err ("Failed allocate core %u ready_count\n" , core);return -ENOMEM ; } -per_cpu (ready_count, core) = core_rc; + +for_each_cpu (sibling, &cpu_sibling_map[cpu]) +per_cpu (ready_count, sibling) = core_rc; }return 0 ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 49/79 scsi: mpt3sas: Send a diag reset if target reset fails
In reply to Sasha LevinFrom: Shivasharan S <[email protected]>
[ Upstream commit 5612d6d51ed2634a033c95de2edec7449409cbb9 ]
When an IOCTL times out and driver issues a target reset, if firmware fails the task management elevate the recovery by issuing a diag reset to controller.
--- drivers/scsi/mpt3sas/mpt3sas_ctl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_ctl.c +10 -2
@@ -662,6 +662,7 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,size_t data_in_sz =0 ;long ret;u16 device_handle =MPT3SAS_INVALID_DEVICE_HANDLE ; +int tm_ret; issue_reset =0 ;
@@ -1094,16 +1095,23 @@ _ctl_do_mpt_command(struct MPT3SAS_ADAPTER *ioc, struct mpt3_ioctl_command karg,if (pcie_device && (!ioc->tm_custom_handling) && (!(mpt3sas_scsih_is_pcie_scsi_device ( pcie_device->device_info)))) -mpt3sas_scsih_issue_locked_tm (ioc, + tm_ret =mpt3sas_scsih_issue_locked_tm (ioc,le16_to_cpu (mpi_request->FunctionDependent1),0 ,MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET ,0 ,0 , pcie_device->reset_timeout,MPI26_SCSITASKMGMT_MSGFLAGS_PROTOCOL_LVL_RST_PCIE );else -mpt3sas_scsih_issue_locked_tm (ioc, + tm_ret =mpt3sas_scsih_issue_locked_tm (ioc,le16_to_cpu (mpi_request->FunctionDependent1),0 ,MPI2_SCSITASKMGMT_TASKTYPE_TARGET_RESET ,0 ,0 ,30 ,MPI2_SCSITASKMGMT_MSGFLAGS_LINK_RESET ); + +if (tm_ret !=SUCCESS ) { +ioc_info (ioc, +"target reset failed, issue hard reset: handle (0x%04x)\n" , +le16_to_cpu (mpi_request->FunctionDependent1)); +mpt3sas_base_hard_reset_handler (ioc,FORCE_BIG_HAMMER ); + } }else mpt3sas_base_hard_reset_handler (ioc,FORCE_BIG_HAMMER ); }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 50/79 wifi: rtw88: Fix rtw_init_ht_cap() for RTL8814AU
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit c7eea1ba05ca5b0dbf77a27cf2e1e6e2fb3c0043 ]
Set the RX mask and the highest RX rate according to the number of spatial streams the chip can receive. For RTL8814AU that is 3.
--- drivers/net/wireless/realtek/rtw88/main.c | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/net/wireless/realtek/rtw88/main.c +6 -11
@@ -766,6 +766,7 @@ static void rtw_init_ht_cap(struct rtw_dev *rtwdev, struct ieee80211_sta_ht_cap *ht_cap) {struct rtw_efuse *efuse = &rtwdev->efuse; +int i; ht_cap->ht_supported = true; ht_cap->cap =0 ;
@@ -780,17 +781,11 @@ static void rtw_init_ht_cap(struct rtw_dev *rtwdev, ht_cap->ampdu_factor =IEEE80211_HT_MAX_AMPDU_64K ; ht_cap->ampdu_density =IEEE80211_HT_MPDU_DENSITY_16 ; ht_cap->mcs.tx_params =IEEE80211_HT_MCS_TX_DEFINED ; -if (efuse->hw_cap.nss >1 ) { - ht_cap->mcs.rx_mask[0 ] =0xFF ; - ht_cap->mcs.rx_mask[1 ] =0xFF ; - ht_cap->mcs.rx_mask[4 ] =0x01 ; - ht_cap->mcs.rx_highest =cpu_to_le16 (300 ); - }else { - ht_cap->mcs.rx_mask[0 ] =0xFF ; - ht_cap->mcs.rx_mask[1 ] =0x00 ; - ht_cap->mcs.rx_mask[4 ] =0x01 ; - ht_cap->mcs.rx_highest =cpu_to_le16 (150 ); - } + +for (i =0 ; i < efuse->hw_cap.nss; i++) + ht_cap->mcs.rx_mask[i] =0xFF ; + ht_cap->mcs.rx_mask[4 ] =0x01 ; + ht_cap->mcs.rx_highest =cpu_to_le16 (150 * efuse->hw_cap.nss); } static void rtw_init_vht_cap(struct rtw_dev *rtwdev,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 51/79 net: pktgen: fix access outside of user given buffer in pktgen_thread_write()
In reply to Sasha LevinFrom: Peter Seiderer <[email protected]>
[ Upstream commit 425e64440ad0a2f03bdaf04be0ae53dededbaa77 ]
Honour the user given buffer size for the strn_len() calls (otherwise strn_len() will access memory outside of the user given buffer).
--- net/core/pktgen.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
net/core/pktgen.c +4 -3
@@ -1770,8 +1770,8 @@ static ssize_t pktgen_thread_write(struct file *file, i = len;/* Read variable name */ - - len =strn_len (&user_buffer[i],sizeof (name) -1 ); + max =min (sizeof (name) -1 , count - i); + len =strn_len (&user_buffer[i], max);if (len <0 )return len;
@@ -1801,7 +1801,8 @@ static ssize_t pktgen_thread_write(struct file *file,if (!strcmp (name,"add_device" )) {char f[32 ];memset (f,0 ,32 ); - len =strn_len (&user_buffer[i],sizeof (f) -1 ); + max =min (sizeof (f) -1 , count - i); + len =strn_len (&user_buffer[i], max);if (len <0 ) { ret = len; goto out;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 52/79 EDAC/ie31200: work around false positive build warning
In reply to Sasha LevinFrom: Arnd Bergmann <[email protected]>
[ Upstream commit c29dfd661fe2f8d1b48c7f00590929c04b25bf40 ]
gcc-14 produces a bogus warning in some configurations:
drivers/edac/ie31200_edac.c: In function 'ie31200_probe1.isra':drivers/edac/ie31200_edac.c:412:26: error: 'dimm_info' is used uninitialized [-Werror=uninitialized]
412 | struct dimm_data dimm_info[IE31200_CHANNELS][IE31200_DIMMS_PER_CHANNEL];
| ^~~~~~~~~
drivers/edac/ie31200_edac.c:412:26: note: 'dimm_info' declared here
412 | struct dimm_data dimm_info[IE31200_CHANNELS][IE31200_DIMMS_PER_CHANNEL];
| ^~~~~~~~~I don't see any way the unintialized access could really happen here, but I can see why the compiler gets confused by the two loops.
Instead, rework the two nested loops to only read the addr_decode registers and then keep only one instance of the dimm info structure.
[Tony: Qiuxu pointed out that the "populate DIMM info" comment was left behind in the refactor and suggested moving it. I deleted the comment as unnecessry in front os a call to populate_dimm_info(). That seems pretty self-describing.]
--- drivers/edac/ie31200_edac.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-)
drivers/edac/ie31200_edac.c +13 -15
@@ -398,10 +398,9 @@ static int ie31200_probe1(struct pci_dev *pdev, int dev_idx)int i, j, ret;struct mem_ctl_info *mci =NULL ;struct edac_mc_layer layers[2 ]; -struct dimm_data dimm_info[IE31200_CHANNELS ][IE31200_DIMMS_PER_CHANNEL ];void __iomem *window;struct ie31200_priv *priv; -u32 addr_decode, mad_offset; +u32 addr_decode[IE31200_CHANNELS ], mad_offset;/* * Kaby Lake, Coffee Lake seem to work like Skylake. Please re-visit
@@ -459,19 +458,10 @@ static int ie31200_probe1(struct pci_dev *pdev, int dev_idx) mad_offset =IE31200_MAD_DIMM_0_OFFSET ; } -/* populate DIMM info */ for (i =0 ; i <IE31200_CHANNELS ; i++) { - addr_decode =readl (window + mad_offset + + addr_decode[i] =readl (window + mad_offset + (i *4 )); -edac_dbg (0 ,"addr_decode: 0x%x\n" , addr_decode); -for (j =0 ; j <IE31200_DIMMS_PER_CHANNEL ; j++) { -populate_dimm_info (&dimm_info[i][j], addr_decode, j, - skl); -edac_dbg (0 ,"size: 0x%x, rank: %d, width: %d\n" , - dimm_info[i][j].size, - dimm_info[i][j].dual_rank, - dimm_info[i][j].x16_width); - } +edac_dbg (0 ,"addr_decode: 0x%x\n" , addr_decode[i]); }/*
@@ -482,14 +472,22 @@ static int ie31200_probe1(struct pci_dev *pdev, int dev_idx)*/ for (i =0 ; i <IE31200_DIMMS_PER_CHANNEL ; i++) {for (j =0 ; j <IE31200_CHANNELS ; j++) { +struct dimm_data dimm_info;struct dimm_info *dimm;unsigned long nr_pages; - nr_pages =IE31200_PAGES (dimm_info[j][i].size, skl); +populate_dimm_info (&dimm_info, addr_decode[j], i, + skl); +edac_dbg (0 ,"size: 0x%x, rank: %d, width: %d\n" , + dimm_info.size, + dimm_info.dual_rank, + dimm_info.x16_width); + + nr_pages =IE31200_PAGES (dimm_info.size, skl);if (nr_pages ==0 )continue ; -if (dimm_info[j][i].dual_rank) { +if (dimm_info.dual_rank) { nr_pages = nr_pages /2 ; dimm = EDAC_DIMM_PTR(mci->layers, mci->dimms, mci->n_layers, (i * 2) + 1,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 53/79 PCI: Fix old_size lower bound in calculate_iosize() too
In reply to Sasha LevinFrom: Ilpo Järvinen <[email protected]>
[ Upstream commit ff61f380de5652e723168341480cc7adf1dd6213 ]
Commit 903534fa7d30 ("PCI: Fix resource double counting on remove & rescan") fixed double counting of mem resources because of old_size being applied too early.
Fix a similar counting bug on the io resource side.
--- drivers/pci/setup-bus.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/pci/setup-bus.c +2 -4
@@ -800,11 +800,9 @@ static resource_size_t calculate_iosize(resource_size_t size, size = (size &0xff ) + ((size & ~0xffUL ) <<2 );#endif size = size + size1; -if (size < old_size) - size = old_size; - size =ALIGN (max (size, add_size) + children_add_size, align); -return size; + size =max (size, add_size) + children_add_size; +return ALIGN (max (size, old_size), align); } static resource_size_t calculate_memsize(resource_size_t size,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 54/79 ACPI: HED: Always initialize before evged
In reply to Sasha LevinFrom: Xiaofei Tan <[email protected]>
[ Upstream commit cccf6ee090c8c133072d5d5b52ae25f3bc907a16 ]
When the HED driver is built-in, it initializes after evged because they both are at the same initcall level, so the initialization ordering depends on the Makefile order. However, this prevents RAS records coming in between the evged driver initialization and the HED driver initialization from being handled.
If the number of such RAS records is above the APEI HEST error source number, the HEST resources may be exhausted, and that may affect subsequent RAS error reporting.
To fix this issue, change the initcall level of HED to subsys_initcall and prevent the driver from being built as a module by changing ACPI_HED in Kconfig from "tristate" to "bool".
--- drivers/acpi/Kconfig | 2 +- drivers/acpi/hed.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-)
drivers/acpi/Kconfig +1 -1
@@ -431,7 +431,7 @@ config ACPI_SBS the modules will be called sbs and sbshc. config ACPI_HED - tristate "Hardware Error Device" + bool "Hardware Error Device" help This driver supports the Hardware Error Device (PNP0C33), which is used to report some hardware errors notified via
drivers/acpi/hed.c +6 -1
@@ -72,7 +72,12 @@ static struct acpi_driver acpi_hed_driver = { .notify = acpi_hed_notify, }, }; -module_acpi_driver (acpi_hed_driver); + +static int __init acpi_hed_driver_init (void ) +{ +return acpi_bus_register_driver (&acpi_hed_driver); +} +subsys_initcall (acpi_hed_driver_init);ACPI_MODULE_NAME ("hed" );MODULE_AUTHOR ("Huang Ying" );
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 55/79 net/mlx5: Modify LSB bitmask in temperature event to include only the first bit
In reply to Sasha LevinFrom: Shahar Shitrit <[email protected]>
[ Upstream commit 633f16d7e07c129a36b882c05379e01ce5bdb542 ]
In the sensor_count field of the MTEWE register, bits 1-62 are supported only for unmanaged switches, not for NICs, and bit 63 is reserved for internal use.
To prevent confusing output that may include set bits that are not relevant to NIC sensors, we update the bitmask to retain only the first bit, which corresponds to the sensor ASIC.
--- drivers/net/ethernet/mellanox/mlx5/core/events.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/events.c +4 -0
@@ -156,6 +156,10 @@ static int temp_warn(struct notifier_block *nb, unsigned long type, void *data)u64 value_msb; value_lsb =be64_to_cpu (eqe->data.temp_warning.sensor_warning_lsb); +/* bit 1-63 are not supported for NICs, +* hence read only bit 0 (asic) from lsb. +*/ + value_lsb &=0x1 ; value_msb =be64_to_cpu (eqe->data.temp_warning.sensor_warning_msb); mlx5_core_warn(events->dev,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 56/79 net/mlx5: Apply rate-limiting to high temperature warning
In reply to Sasha LevinFrom: Shahar Shitrit <[email protected]>
[ Upstream commit 9dd3d5d258aceb37bdf09c8b91fa448f58ea81f0 ]
Wrap the high temperature warning in a temperature event with a call to net_ratelimit() to prevent flooding the kernel log with repeated warning messages when temperature exceeds the threshold multiple times within a short duration.
--- drivers/net/ethernet/mellanox/mlx5/core/events.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/events.c +4 -3
@@ -162,9 +162,10 @@ static int temp_warn(struct notifier_block *nb, unsigned long type, void *data) value_lsb &=0x1 ; value_msb =be64_to_cpu (eqe->data.temp_warning.sensor_warning_msb); -mlx5_core_warn (events->dev, -"High temperature on sensors with bit set %llx %llx" , - value_msb, value_lsb); +if (net_ratelimit ()) +mlx5_core_warn (events->dev, +"High temperature on sensors with bit set %llx %llx" , + value_msb, value_lsb);return NOTIFY_OK ; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 57/79 ASoC: ops: Enforce platform maximum on initial value
In reply to Sasha LevinFrom: Martin Povišer <[email protected]>
[ Upstream commit 783db6851c1821d8b983ffb12b99c279ff64f2ee ]
Lower the volume if it is violating the platform maximum at its initial value (i.e. at the time of the 'snd_soc_limit_volume' call).
--- sound/soc/soc-ops.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-)
sound/soc/soc-ops.c +28 -1
@@ -635,6 +635,33 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol, }EXPORT_SYMBOL_GPL (snd_soc_get_volsw_range); +static int snd_soc_clip_to_platform_max (struct snd_kcontrol *kctl) +{ +struct soc_mixer_control *mc = (struct soc_mixer_control *)kctl->private_value; +struct snd_ctl_elem_value uctl; +int ret; + +if (!mc->platform_max) +return 0 ; + + ret = kctl->get (kctl, &uctl); +if (ret <0 ) +return ret; + +if (uctl.value.integer.value[0 ] > mc->platform_max) + uctl.value.integer.value[0 ] = mc->platform_max; + +if (snd_soc_volsw_is_stereo (mc) && + uctl.value.integer.value[1 ] > mc->platform_max) + uctl.value.integer.value[1 ] = mc->platform_max; + + ret = kctl->put (kctl, &uctl); +if (ret <0 ) +return ret; + +return 0 ; +} +/** * snd_soc_limit_volume - Set new limit to an existing volume control. *
@@ -667,7 +694,7 @@ int snd_soc_limit_volume(struct snd_soc_card *card, mc = (struct soc_mixer_control *)kctl->private_value;if (max <= mc->max) { mc->platform_max = max; - ret =0 ; + ret =snd_soc_clip_to_platform_max (kctl); } }return ret;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 58/79 pinctrl: devicetree: do not goto err when probing hogs in pinctrl_dt_to_map
In reply to Sasha LevinFrom: Valentin Caron <[email protected]>
[ Upstream commit c98868e816209e568c9d72023ba0bc1e4d96e611 ]
Cross case in pinctrl framework make impossible to an hogged pin and another, not hogged, used within the same device-tree node. For example with this simplified device-tree :
&pinctrl {
pinctrl_pin_1: pinctrl-pin-1 {
pins = "dummy-pinctrl-pin";
};
};
&rtc {
pinctrl-names = "default"
pinctrl-0 = <&pinctrl_pin_1 &rtc_pin_1> rtc_pin_1: rtc-pin-1 {
pins = "dummy-rtc-pin";
};};
"pinctrl_pin_1" configuration is never set. This produces this path in the code:
really_probe()
pinctrl_bind_pins()
| devm_pinctrl_get()
| pinctrl_get()
| create_pinctrl()
| pinctrl_dt_to_map()
| // Hog pin create an abort for all pins of the node
| ret = dt_to_map_one_config()
| | /* Do not defer probing of hogs (circular loop) */
| | if (np_pctldev == p->dev->of_node)
| | return -ENODEV;
| if (ret)
| goto err
|
call_driver_probe()
stm32_rtc_probe()
pinctrl_enable()
pinctrl_claim_hogs()
create_pinctrl()
for_each_maps(maps_node, i, map)
// Not hog pin is skipped
if (pctldev && strcmp(dev_name(pctldev->dev),
map->ctrl_dev_name))
continue;At the first call of create_pinctrl() the hogged pin produces an abort to avoid a defer of hogged pins. All other pin configurations are trashed.
At the second call, create_pinctrl is now called with pctldev parameter to get hogs, but in this context only hogs are set. And other pins are skipped.
To handle this, do not produce an abort in the first call of create_pinctrl(). Classic pin configuration will be set in pinctrl_bind_pins() context. And the hogged pin configuration will be set in pinctrl_claim_hogs() context.
--- drivers/pinctrl/devicetree.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/pinctrl/devicetree.c +8 -2
@@ -141,10 +141,14 @@ static int dt_to_map_one_config(struct pinctrl *p, pctldev =get_pinctrl_dev_from_of_node (np_pctldev);if (pctldev)break ; -/* Do not defer probing of hogs (circular loop) */ +/* +* Do not defer probing of hogs (circular loop) +* +* Return 1 to let the caller catch the case. +*/ if (np_pctldev == p->dev->of_node) {of_node_put (np_pctldev); -return -ENODEV ; +return 1 ; } }of_node_put (np_pctldev);
@@ -268,6 +272,8 @@ int pinctrl_dt_to_map(struct pinctrl *p, struct pinctrl_dev *pctldev) ret =dt_to_map_one_config (p, pctldev, statename, np_config);of_node_put (np_config); +if (ret ==1 ) +continue ;if (ret <0 ) goto err; }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 59/79 smack: recognize ipv4 CIPSO w/o categories
In reply to Sasha LevinFrom: Konstantin Andreev <[email protected]>
[ Upstream commit a158a937d864d0034fea14913c1f09c6d5f574b8 ]
If SMACK label has CIPSO representation w/o categories, e.g.:
| # cat /smack/cipso2 | foo 10 | @ 250/2 | ...
then SMACK does not recognize such CIPSO in input ipv4 packets and substitues '*' label instead. Audit records may look like
| lsm=SMACK fn=smack_socket_sock_rcv_skb action=denied
| subject="*" object="_" requested=w pid=0 comm="swapper/1" ...
This happens in two steps:
1) security/smack/smackfs.c`smk_set_cipso does not clear NETLBL_SECATTR_MLS_CAT
from (struct smack_known *)skp->smk_netlabel.flags on assigning CIPSO w/o categories:
| rcu_assign_pointer(skp->smk_netlabel.attr.mls.cat, ncats.attr.mls.cat); | skp->smk_netlabel.attr.mls.lvl = ncats.attr.mls.lvl;
2) security/smack/smack_lsm.c`smack_from_secattr
can not match skp->smk_netlabel with input packet's struct netlbl_lsm_secattr *sap
because sap->flags have not NETLBL_SECATTR_MLS_CAT (what is correct) but skp->smk_netlabel.flags have (what is incorrect):
| if ((sap->flags & NETLBL_SECATTR_MLS_CAT) == 0) {
| if ((skp->smk_netlabel.flags &
| NETLBL_SECATTR_MLS_CAT) == 0)
| found = 1;
| break;
| }This commit sets/clears NETLBL_SECATTR_MLS_CAT in skp->smk_netlabel.flags according to the presense of CIPSO categories. The update of smk_netlabel is not atomic, so input packets processing still may be incorrect during short time while update proceeds.
--- security/smack/smackfs.c | 4 ++++ 1 file changed, 4 insertions(+)
security/smack/smackfs.c +4 -0
@@ -921,6 +921,10 @@ static ssize_t smk_set_cipso(struct file *file, const char __user *buf,if (rc >=0 ) { old_cat = skp->smk_netlabel.attr.mls.cat;rcu_assign_pointer (skp->smk_netlabel.attr.mls.cat, ncats.attr.mls.cat); +if (ncats.attr.mls.cat) + skp->smk_netlabel.flags |=NETLBL_SECATTR_MLS_CAT ; +else + skp->smk_netlabel.flags &= ~(u32 )NETLBL_SECATTR_MLS_CAT ; skp->smk_netlabel.attr.mls.lvl = ncats.attr.mls.lvl;synchronize_rcu ();netlbl_catmap_free (old_cat);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 60/79 net/mlx4_core: Avoid impossible mlx4_db_alloc() order value
In reply to Sasha LevinFrom: Kees Cook <[email protected]>
[ Upstream commit 4a6f18f28627e121bd1f74b5fcc9f945d6dbeb1e ]
GCC can see that the value range for "order" is capped, but this leads it to consider that it might be negative, leading to a false positive warning (with GCC 15 with -Warray-bounds -fdiagnostics-details):
../drivers/net/ethernet/mellanox/mlx4/alloc.c:691:47: error: array subscript -1 is below array bounds of 'long unsigned int *[2]' [-Werror=array-bounds=]
691 | i = find_first_bit(pgdir->bits[o], MLX4_DB_PER_PAGE >> o);
| ~~~~~~~~~~~^~~
'mlx4_alloc_db_from_pgdir': events 1-2
691 | i = find_first_bit(pgdir->bits[o], MLX4_DB_PER_PAGE >> o); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| | | | | (2) out of array bounds here
| (1) when the condition is evaluated to true In file included from ../drivers/net/ethernet/mellanox/mlx4/mlx4.h:53,
from ../drivers/net/ethernet/mellanox/mlx4/alloc.c:42:../include/linux/mlx4/device.h:664:33: note: while referencing 'bits'
664 | unsigned long *bits[2];
| ^~~~
Switch the argument to unsigned int, which removes the compiler needing to consider negative values.
--- drivers/net/ethernet/mellanox/mlx4/alloc.c | 6 +++--- include/linux/mlx4/device.h | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx4/alloc.c +3 -3
@@ -682,9 +682,9 @@ static struct mlx4_db_pgdir *mlx4_alloc_db_pgdir(struct device *dma_device) }static int mlx4_alloc_db_from_pgdir (struct mlx4_db_pgdir *pgdir, -struct mlx4_db *db,int order) +struct mlx4_db *db,unsigned int order) { -int o; +unsigned int o;int i;for (o = order; o <=1 ; ++o) {
@@ -712,7 +712,7 @@ static int mlx4_alloc_db_from_pgdir(struct mlx4_db_pgdir *pgdir,return 0 ; } -int mlx4_db_alloc (struct mlx4_dev *dev,struct mlx4_db *db,int order) +int mlx4_db_alloc (struct mlx4_dev *dev,struct mlx4_db *db,unsigned int order) {struct mlx4_priv *priv =mlx4_priv (dev);struct mlx4_db_pgdir *pgdir;
include/linux/mlx4/device.h +1 -1
@@ -1128,7 +1128,7 @@ int mlx4_write_mtt(struct mlx4_dev *dev, struct mlx4_mtt *mtt,int mlx4_buf_write_mtt (struct mlx4_dev *dev,struct mlx4_mtt *mtt,struct mlx4_buf *buf); -int mlx4_db_alloc (struct mlx4_dev *dev,struct mlx4_db *db,int order); +int mlx4_db_alloc (struct mlx4_dev *dev,struct mlx4_db *db,unsigned int order);void mlx4_db_free (struct mlx4_dev *dev,struct mlx4_db *db); int mlx4_alloc_hwq_res(struct mlx4_dev *dev, struct mlx4_hwq_resources *wqres,
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 61/79 phy: core: don't require set_mode() callback for phy_get_mode() to work
In reply to Sasha LevinFrom: Dmitry Baryshkov <[email protected]>
[ Upstream commit d58c04e305afbaa9dda7969151f06c4efe2c98b0 ]
As reported by Damon Ding, the phy_get_mode() call doesn't work as expected unless the PHY driver has a .set_mode() call. This prompts PHY drivers to have empty stubs for .set_mode() for the sake of being able to get the mode.
Make .set_mode() callback truly optional and update PHY's mode even if it there is none.
--- drivers/phy/phy-core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/phy/phy-core.c +4 -3
@@ -360,13 +360,14 @@ EXPORT_SYMBOL_GPL(phy_power_off);int phy_set_mode_ext (struct phy *phy,enum phy_mode mode,int submode) { -int ret; +int ret =0 ; -if (!phy || !phy->ops->set_mode) +if (!phy)return 0 ;mutex_lock (&phy->mutex); - ret = phy->ops->set_mode (phy, mode, submode); +if (phy->ops->set_mode) + ret = phy->ops->set_mode (phy, mode, submode);if (!ret) phy->attrs.mode = mode;mutex_unlock (&phy->mutex);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 62/79 net/mlx5: Extend Ethtool loopback selftest to support non-linear SKB
In reply to Sasha LevinFrom: Alexei Lazar <[email protected]>
[ Upstream commit 95b9606b15bb3ce1198d28d2393dd0e1f0a5f3e9 ]
Current loopback test validation ignores non-linear SKB case in the SKB access, which can lead to failures in scenarios such as when HW GRO is enabled.
Linearize the SKB so both cases will be handled.
--- drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_selftest.c +3 -0
@@ -189,6 +189,9 @@ mlx5e_test_loopback_validate(struct sk_buff *skb,struct udphdr *udph;struct iphdr *iph; +if (skb_linearize (skb)) + goto out; +/* We are only going to peek, no need to clone the SKB */ if (MLX5E_TEST_PKT_SIZE -ETH_HLEN >skb_headlen (skb)) goto out;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 63/79 net/mlx5e: set the tx_queue_len for pfifo_fast
In reply to Sasha LevinFrom: William Tu <[email protected]>
[ Upstream commit a38cc5706fb9f7dc4ee3a443f61de13ce1e410ed ]
By default, the mq netdev creates a pfifo_fast qdisc. On a system with 16 core, the pfifo_fast with 3 bands consumes 16 * 3 * 8 (size of pointer) * 1024 (default tx queue len) = 393KB. The patch sets the tx qlen to representor default value, 128 (1<<MLX5E_REP_PARAMS_DEF_LOG_SQ_SIZE), which consumes 16 * 3 * 8 * 128 = 49KB, saving 344KB for each representor at ECPF.
--- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +2 -0
@@ -1470,6 +1470,8 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev) } netdev->watchdog_timeo =15 *HZ ; +if (mlx5_core_is_ecpf (mdev)) + netdev->tx_queue_len =1 <<MLX5E_REP_PARAMS_DEF_LOG_SQ_SIZE ; netdev->features |=NETIF_F_NETNS_LOCAL ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 64/79 net/mlx5e: reduce rep rxq depth to 256 for ECPF
In reply to Sasha LevinFrom: William Tu <[email protected]>
[ Upstream commit b9cc8f9d700867aaa77aedddfea85e53d5e5d584 ]
By experiments, a single queue representor netdev consumes kernel memory around 2.8MB, and 1.8MB out of the 2.8MB is due to page pool for the RXQ. Scaling to a thousand representors consumes 2.8GB, which becomes a memory pressure issue for embedded devices such as BlueField-2 16GB / BlueField-3 32GB memory.
Since representor netdevs mostly handles miss traffic, and ideally, most of the traffic will be offloaded, reduce the default non-uplink rep netdev's RXQ default depth from 1024 to 256 if mdev is ecpf eswitch manager. This saves around 1MB of memory per regular RQ, (1024 - 256) * 2KB, allocated from page pool.
With rxq depth of 256, the netlink page pool tool reports $./tools/net/ynl/cli.py --spec Documentation/netlink/specs/netdev.yaml \
--dump page-pool-get
{'id': 277,
'ifindex': 9,
'inflight': 128,
'inflight-mem': 786432,
'napi-id': 775}]
This is due to mtu 1500 + headroom consumes half pages, so 256 rxq entries consumes around 128 pages (thus create a page pool with size 128), shown above at inflight.
Note that each netdev has multiple types of RQs, including Regular RQ, XSK, PTP, Drop, Trap RQ. Since non-uplink representor only supports regular rq, this patch only changes the regular RQ's default depth.
--- drivers/net/ethernet/mellanox/mlx5/core/en_rep.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/en_rep.c +3 -0
@@ -53,6 +53,7 @@#define MLX5E_REP_PARAMS_DEF_LOG_SQ_SIZE \ max(0x7, MLX5E_PARAMS_MINIMUM_LOG_SQ_SIZE)#define MLX5E_REP_PARAMS_DEF_NUM_CHANNELS 1 +#define MLX5E_REP_PARAMS_DEF_LOG_RQ_SIZE 0x8static const char mlx5e_rep_driver_name[] ="mlx5e_rep" ;
@@ -1430,6 +1431,8 @@ static void mlx5e_build_rep_params(struct net_device *netdev)/* RQ */ mlx5e_build_rq_params (mdev, params); +if (!mlx5e_is_uplink_rep (priv) &&mlx5_core_is_ecpf (mdev)) + params->log_rq_mtu_frames =MLX5E_REP_PARAMS_DEF_LOG_RQ_SIZE ;/* CQ moderation params */ params->rx_dim_enabled =MLX5_CAP_GEN (mdev, cq_moderation);
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 65/79 ip: fib_rules: Fetch net from fib_rule in fib[46]_rule_configure().
In reply to Sasha LevinFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit 5a1ccffd30a08f5a2428cd5fbb3ab03e8eb6c66d ]
The following patch will not set skb->sk from VRF path.
Let's fetch net from fib_rule->fr_net instead of sock_net(skb->sk) in fib[46]_rule_configure().
--- net/ipv4/fib_rules.c | 4 ++-- net/ipv6/fib6_rules.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
net/ipv4/fib_rules.c +2 -2
@@ -220,9 +220,9 @@ static int fib4_rule_configure(struct fib_rule *rule, struct sk_buff *skb,struct nlattr **tb, struct netlink_ext_ack *extack) { - struct net *net = sock_net(skb->sk); + struct fib4_rule *rule4 = (struct fib4_rule *)rule; +struct net *net = rule->fr_net;int err = -EINVAL ; -struct fib4_rule *rule4 = (struct fib4_rule *) rule;if (frh->tos & ~IPTOS_TOS_MASK ) {NL_SET_ERR_MSG (extack,"Invalid tos" );
net/ipv6/fib6_rules.c +2 -2
@@ -344,9 +344,9 @@ static int fib6_rule_configure(struct fib_rule *rule, struct sk_buff *skb,struct nlattr **tb, struct netlink_ext_ack *extack) { + struct fib6_rule *rule6 = (struct fib6_rule *)rule; +struct net *net = rule->fr_net;int err = -EINVAL ; -struct net *net =sock_net (skb->sk); -struct fib6_rule *rule6 = (struct fib6_rule *) rule;if (rule->action ==FR_ACT_TO_TBL && !rule->l3mdev) {if (rule->table ==RT6_TABLE_UNSPEC ) {
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 66/79 exit: change the release_task() paths to call flush_sigqueue() lockless
In reply to Sasha LevinFrom: Oleg Nesterov <[email protected]>
[ Upstream commit fb3bbcfe344e64a46574a638b051ffd78762c12d ]
A task can block a signal, accumulate up to RLIMIT_SIGPENDING sigqueues, and exit. In this case __exit_signal()->flush_sigqueue() called with irqs disabled can trigger a hard lockup, see
https://lore.kernel.org/all/[email protected]/
Fortunately, after the recent posixtimer changes sys_timer_delete() paths no longer try to clear SIGQUEUE_PREALLOC and/or free tmr->sigq, and after the exiting task passes __exit_signal() lock_task_sighand() can't succeed and pid_task(tmr->it_pid) will return NULL.
This means that after __exit_signal(tsk) nobody can play with tsk->pending or (if group_dead) with tsk->signal->shared_pending, so release_task() can safely call flush_sigqueue() after write_unlock_irq(&tasklist_lock).
TODO:
- we can probably shift posix_cpu_timers_exit() as well
- do_sigaction() can hit the similar problem
--- kernel/exit.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
kernel/exit.c +11 -8
@@ -204,20 +204,13 @@ static void __exit_signal(struct task_struct *tsk)__unhash_process (tsk, group_dead);write_sequnlock (&sig->stats_lock); -/* -* Do this under ->siglock, we can race with another thread -* doing sigqueue_free() if we have SIGQUEUE_PREALLOC signals. -*/ -flush_sigqueue (&tsk->pending); tsk->sighand =NULL ;spin_unlock (&sighand->siglock);__cleanup_sighand (sighand);clear_tsk_thread_flag (tsk,TIF_SIGPENDING ); -if (group_dead) { -flush_sigqueue (&sig->shared_pending); +if (group_dead)tty_kref_put (tty); - } }static void delayed_put_task_struct (struct rcu_head *rhp)
@@ -277,6 +270,16 @@ void release_task(struct task_struct *p)write_unlock_irq (&tasklist_lock);release_thread (p); +/* +* This task was already removed from the process/thread/pid lists +* and lock_task_sighand(p) can't succeed. Nobody else can touch +* ->pending or, if group dead, signal->shared_pending. We can call +* flush_sigqueue() lockless. +*/ +flush_sigqueue (&p->pending); +if (thread_group_leader (p)) +flush_sigqueue (&p->signal->shared_pending); +put_task_struct_rcu_user (p); p = leader;
Signature · 1 line
2.39.5
Re: [PATCH AUTOSEL 5.4 66/79] exit: change the release_task() paths to call flush_sigqueue() lockless
I'm on PTO until May 15, can't read the code.
Did you verify that 5.14 has all the necessary "recent" posixtimer changes?
Oleg.
Quoted 78 lines · Sasha Levin
From: Oleg Nesterov <[email protected]>
[ Upstream commit
fb3bbcfe344e64a46574a638b051ffd78762c12d]A task can block a signal, accumulate up to
RLIMIT_SIGPENDINGsigqueues, and exit. In this case __exit_signal()->flush_sigqueue() called with irqs disabled can trigger a hard lockup, see
https://lore.kernel.org/all/[email protected]/Fortunately, after the recent posixtimer changes
sys_timer_delete()paths no longer try to clearSIGQUEUE_PREALLOCand/or freetmr->sigq, and after the exiting task passes__exit_signal()lock_task_sighand()can't succeed andpid_task(tmr->it_pid)will return NULL.This means that after
__exit_signal(tsk)nobody can play withtsk->pendingor (ifgroup_dead) withtsk->signal->shared_pending, sorelease_task()can safely callflush_sigqueue()afterwrite_unlock_irq(&tasklist_lock).TODO:
- we can probably shiftposix_cpu_timers_exit()as well
-do_sigaction()can hit the similar problemSigned-off-by Oleg Nesterov <[email protected]>Reviewed-by Frederic Weisbecker <[email protected]>Signed-off-by Christian Brauner <[email protected]>Signed-off-by Sasha Levin <[email protected]>--- kernel/exit.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)kernel/exit.c +11
-8@@ -204,20 +204,13 @@ static void __exit_signal(struct task_struct *tsk)__unhash_process (tsk, group_dead);write_sequnlock (&sig->stats_lock); -/* -* Do this under ->siglock, we can race with another thread -* doing sigqueue_free() if we have SIGQUEUE_PREALLOC signals. -*/ -flush_sigqueue (&tsk->pending); tsk->sighand =NULL ;spin_unlock (&sighand->siglock);__cleanup_sighand (sighand);clear_tsk_thread_flag (tsk,TIF_SIGPENDING ); -if (group_dead) { -flush_sigqueue (&sig->shared_pending); +if (group_dead)tty_kref_put (tty); - } }static void delayed_put_task_struct (struct rcu_head *rhp)@@ -277,6 +270,16 @@ void release_task(struct task_struct *p)write_unlock_irq (&tasklist_lock);release_thread (p); +/* +* This task was already removed from the process/thread/pid lists +* and lock_task_sighand(p) can't succeed. Nobody else can touch +* ->pending or, if group dead, signal->shared_pending. We can call +* flush_sigqueue() lockless. +*/ +flush_sigqueue (&p->pending); +if (thread_group_leader (p)) +flush_sigqueue (&p->signal->shared_pending); +put_task_struct_rcu_user (p); p = leader;Signature · 1 line
2.39.5
Sasha Levin
maintainerRe: [PATCH AUTOSEL 5.4 66/79] exit: change the release_task() paths to call flush_sigqueue() lockless
Quoted 3 lines · Oleg Nesterov
I'm on PTO until May 15, can't read the code.
Did you verify that 5.14 has all the necessary "recent" posixtimer changes?
You're right, I'll drop it. Thanks!
Signature · 2 lines
Thanks, Sasha
Sasha Levin
maintainerPATCH 67/79 hwmon: (xgene-hwmon) use appropriate type for the latency value
In reply to Sasha LevinFrom: Andrey Vatoropin <[email protected]>
[ Upstream commit 8df0f002827e18632dcd986f7546c1abf1953a6f ]
The expression PCC_NUM_RETRIES * pcc_chan->latency is currently being evaluated using 32-bit arithmetic.
Since a value of type 'u64' is used to store the eventual result, and this result is later sent to the function usecs_to_jiffies with input parameter unsigned int, the current data type is too wide to store the value of ctx->usecs_lat.
Change the data type of "usecs_lat" to a more suitable (narrower) type.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
--- drivers/hwmon/xgene-hwmon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/xgene-hwmon.c +1 -1
@@ -110,7 +110,7 @@ struct xgene_hwmon_dev {phys_addr_t comm_base_addr;void *pcc_comm_addr; -u64 usecs_lat; +unsigned int usecs_lat; };/*
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 68/79 vxlan: Annotate FDB data races
In reply to Sasha LevinFrom: Ido Schimmel <[email protected]>
[ Upstream commit f6205f8215f12a96518ac9469ff76294ae7bd612 ]
The 'used' and 'updated' fields in the FDB entry structure can be accessed concurrently by multiple threads, leading to reports such as [1]. Can be reproduced using [2].
Suppress these reports by annotating these accesses using READ_ONCE() / WRITE_ONCE().
[1]
BUG: KCSAN: data-race in vxlan_xmit / vxlan_xmit
write to 0xffff942604d263a8 of 8 bytes by task 286 on cpu 0:
vxlan_xmit+0xb29/0x2380 dev_hard_start_xmit+0x84/0x2f0 __dev_queue_xmit+0x45a/0x1650 packet_xmit+0x100/0x150 packet_sendmsg+0x2114/0x2ac0 __sys_sendto+0x318/0x330 __x64_sys_sendto+0x76/0x90 x64_sys_call+0x14e8/0x1c00 do_syscall_64+0x9e/0x1a0 entry_SYSCALL_64_after_hwframe+0x77/0x7f
read to 0xffff942604d263a8 of 8 bytes by task 287 on cpu 2:
vxlan_xmit+0xadf/0x2380 dev_hard_start_xmit+0x84/0x2f0 __dev_queue_xmit+0x45a/0x1650 packet_xmit+0x100/0x150 packet_sendmsg+0x2114/0x2ac0 __sys_sendto+0x318/0x330 __x64_sys_sendto+0x76/0x90 x64_sys_call+0x14e8/0x1c00 do_syscall_64+0x9e/0x1a0 entry_SYSCALL_64_after_hwframe+0x77/0x7f
value changed: 0x00000000fffbac6e -> 0x00000000fffbac6f
Reported by Kernel Concurrency Sanitizer on:
CPU: 2 UID: 0 PID: 287 Comm: mausezahn Not tainted 6.13.0-rc7-01544-gb4b270f11a02 #5 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.16.3-3.fc41 04/01/2014
[2]
#!/bin/bash
set +H
echo whitelist > /sys/kernel/debug/kcsan
echo !vxlan_xmit > /sys/kernel/debug/kcsan
ip link add name vx0 up type vxlan id 10010 dstport 4789 local 192.0.2.1 bridge fdb add 00:11:22:33:44:55 dev vx0 self static dst 198.51.100.1 taskset -c 0 mausezahn vx0 -a own -b 00:11:22:33:44:55 -c 0 -q & taskset -c 2 mausezahn vx0 -a own -b 00:11:22:33:44:55 -c 0 -q &
--- drivers/net/vxlan.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/net/vxlan.c +9 -9
@@ -302,9 +302,9 @@ static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan, nla_put_u32(skb, NDA_IFINDEX, rdst->remote_ifindex)) goto nla_put_failure; - ci.ndm_used =jiffies_to_clock_t (now - fdb->used); + ci.ndm_used =jiffies_to_clock_t (now -READ_ONCE (fdb->used)); ci.ndm_confirmed =0 ; - ci.ndm_updated =jiffies_to_clock_t (now - fdb->updated); + ci.ndm_updated =jiffies_to_clock_t (now -READ_ONCE (fdb->updated)); ci.ndm_refcnt =0 ;if (nla_put (skb,NDA_CACHEINFO ,sizeof (ci), &ci))
@@ -510,8 +510,8 @@ static struct vxlan_fdb *vxlan_find_mac(struct vxlan_dev *vxlan,struct vxlan_fdb *f; f =__vxlan_find_mac (vxlan, mac, vni); -if (f && f->used != jiffies) - f->used = jiffies; +if (f &&READ_ONCE (f->used) != jiffies) +WRITE_ONCE (f->used, jiffies);return f; }
@@ -942,12 +942,12 @@ static int vxlan_fdb_update_existing(struct vxlan_dev *vxlan, !(f->flags & NTF_VXLAN_ADDED_BY_USER)) {if (f->state != state) { f->state = state; - f->updated = jiffies; +WRITE_ONCE (f->updated, jiffies); notify =1 ; }if (f->flags != fdb_flags) { f->flags = fdb_flags; - f->updated = jiffies; +WRITE_ONCE (f->updated, jiffies); notify =1 ; } }
@@ -974,7 +974,7 @@ static int vxlan_fdb_update_existing(struct vxlan_dev *vxlan, }if (ndm_flags &NTF_USE ) - f->used = jiffies; +WRITE_ONCE (f->used, jiffies);if (notify) {if (rd ==NULL )
@@ -1351,7 +1351,7 @@ static bool vxlan_snoop(struct net_device *dev, src_mac, &rdst->remote_ip.sa, &src_ip->sa); rdst->remote_ip = *src_ip; - f->updated = jiffies; +WRITE_ONCE (f->updated, jiffies);vxlan_fdb_notify (vxlan, f, rdst,RTM_NEWNEIGH , true,NULL ); }else {u32 hash_index =fdb_head_index (vxlan, src_mac, vni);
@@ -2748,7 +2748,7 @@ static void vxlan_cleanup(struct timer_list *t)if (f->flags &NTF_EXT_LEARNED )continue ; - timeout = f->used + vxlan->cfg.age_interval *HZ ; + timeout =READ_ONCE (f->used) + vxlan->cfg.age_interval *HZ ;if (time_before_eq (timeout, jiffies)) { netdev_dbg(vxlan->dev, "garbage collect %pM\n",
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 69/79 net-sysfs: prevent uncleared queues from being re-added
In reply to Sasha LevinFrom: Antoine Tenart <[email protected]>
[ Upstream commit 7e54f85c60828842be27e0149f3533357225090e ]
With the (upcoming) removal of the rtnl_trylock/restart_syscall logic and because of how Tx/Rx queues are implemented (and their requirements), it might happen that a queue is re-added before having the chance to be cleared. In such rare case, do not complete the queue addition operation.
--- net/core/net-sysfs.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
net/core/net-sysfs.c +32 -0
@@ -968,6 +968,22 @@ static int rx_queue_add_kobject(struct net_device *dev, int index)struct kobject *kobj = &queue->kobj;int error =0 ; +/* Rx queues are cleared in rx_queue_release to allow later +* re-registration. This is triggered when their kobj refcount is +* dropped. +* +* If a queue is removed while both a read (or write) operation and a +* the re-addition of the same queue are pending (waiting on rntl_lock) +* it might happen that the re-addition will execute before the read, +* making the initial removal to never happen (queue's kobj refcount +* won't drop enough because of the pending read). In such rare case, +* return to allow the removal operation to complete. +*/ +if (unlikely (kobj->state_initialized)) { +netdev_warn_once (dev,"Cannot re-add rx queues before their removal completed" ); +return -EAGAIN ; + } +/* Kobject_put later will trigger rx_queue_release call which * decreases dev refcount: Take that reference here */
@@ -1558,6 +1574,22 @@ static int netdev_queue_add_kobject(struct net_device *dev, int index)struct kobject *kobj = &queue->kobj;int error =0 ; +/* Tx queues are cleared in netdev_queue_release to allow later +* re-registration. This is triggered when their kobj refcount is +* dropped. +* +* If a queue is removed while both a read (or write) operation and a +* the re-addition of the same queue are pending (waiting on rntl_lock) +* it might happen that the re-addition will execute before the read, +* making the initial removal to never happen (queue's kobj refcount +* won't drop enough because of the pending read). In such rare case, +* return to allow the removal operation to complete. +*/ +if (unlikely (kobj->state_initialized)) { +netdev_warn_once (dev,"Cannot re-add tx queues before their removal completed" ); +return -EAGAIN ; + } +/* Kobject_put later will trigger netdev_queue_release call * which decreases dev refcount: Take that reference here */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 70/79 rcu: handle quiescent states for PREEMPT_RCU=n, PREEMPT_COUNT=y
In reply to Sasha LevinFrom: Ankur Arora <[email protected]>
[ Upstream commit 83b28cfe796464ebbde1cf7916c126da6d572685 ]
With PREEMPT_RCU=n, cond_resched() provides urgently needed quiescent states for read-side critical sections via rcu_all_qs(). One reason why this was needed: lacking preempt-count, the tick handler has no way of knowing whether it is executing in a read-side critical section or not.
With (PREEMPT_LAZY=y, PREEMPT_DYNAMIC=n), we get (PREEMPT_COUNT=y, PREEMPT_RCU=n). In this configuration cond_resched() is a stub and does not provide quiescent states via rcu_all_qs(). (PREEMPT_RCU=y provides this information via rcu_read_unlock() and its nesting counter.)
So, use the availability of preempt_count() to report quiescent states in rcu_flavor_sched_clock_irq().
--- kernel/rcu/tree_plugin.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
kernel/rcu/tree_plugin.h +7 -4
@@ -902,13 +902,16 @@ static void rcu_preempt_check_blocked_tasks(struct rcu_node *rnp)*/ static void rcu_flavor_sched_clock_irq (int user) { -if (user ||rcu_is_cpu_rrupt_from_idle ()) { +if (user ||rcu_is_cpu_rrupt_from_idle () || + (IS_ENABLED (CONFIG_PREEMPT_COUNT ) && + (preempt_count () ==HARDIRQ_OFFSET ))) {/* * Get here if this CPU took its interrupt from user -* mode or from the idle loop, and if this is not a -* nested interrupt. In this case, the CPU is in -* a quiescent state, so note it. +* mode, from the idle loop without this being a nested +* interrupt, or while not holding the task preempt count +* (with PREEMPT_COUNT=y). In this case, the CPU is in a +* quiescent state, so note it. * * No memory barrier is required here because rcu_qs() * references only CPU-local variables that other CPUs
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 71/79 rcu: fix header guard for rcu_all_qs()
In reply to Sasha LevinFrom: Ankur Arora <[email protected]>
[ Upstream commit ad6b5b73ff565e88aca7a7d1286788d80c97ba71 ]
rcu_all_qs() is defined for !CONFIG_PREEMPT_RCU but the declaration is conditioned on CONFIG_PREEMPTION.
With CONFIG_PREEMPT_LAZY, CONFIG_PREEMPTION=y does not imply CONFIG_PREEMPT_RCU=y.
Decouple the two.
--- include/linux/rcutree.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rcutree.h +1 -1
@@ -53,7 +53,7 @@ void rcu_scheduler_starting(void);extern int rcu_scheduler_active__read_mostly ;void rcu_end_inkernel_boot (void );bool rcu_is_watching (void ); -#ifndef CONFIG_PREEMPTION +#ifndef CONFIG_PREEMPT_RCU void rcu_all_qs (void );#endif
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 72/79 scsi: lpfc: Handle duplicate D_IDs in ndlp search-by D_ID routine
In reply to Sasha LevinFrom: Justin Tee <[email protected]>
[ Upstream commit 56c3d809b7b450379162d0b8a70bbe71ab8db706 ]
After a port swap between separate fabrics, there may be multiple nodes in the vport's fc_nodes list with the same fabric well known address. Duplication is temporary and eventually resolves itself after dev_loss_tmo expires, but nameserver queries may still occur before dev_loss_tmo. This possibly results in returning stale fabric ndlp objects. Fix by adding an nlp_state check to ensure the ndlp search routine returns the correct newer allocated ndlp fabric object.
--- drivers/scsi/lpfc/lpfc_hbadisc.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/scsi/lpfc/lpfc_hbadisc.c +12 -5
@@ -5357,6 +5357,7 @@ static struct lpfc_nodelist * __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did) {struct lpfc_nodelist *ndlp; +struct lpfc_nodelist *np =NULL ;uint32_t data1;list_for_each_entry (ndlp, &vport->fc_nodes, nlp_listp) {
@@ -5371,14 +5372,20 @@ __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did) ndlp, ndlp->nlp_DID, ndlp->nlp_flag, data1, ndlp->nlp_rpi, ndlp->active_rrqs_xri_bitmap); -return ndlp; + +/* Check for new or potentially stale node */ +if (ndlp->nlp_state !=NLP_STE_UNUSED_NODE ) +return ndlp; + np = ndlp; } } -/* FIND node did <did> NOT FOUND */ -lpfc_printf_vlog (vport,KERN_INFO ,LOG_NODE , -"0932 FIND node did x%x NOT FOUND.\n" , did); -return NULL ; +if (!np) +/* FIND node did <did> NOT FOUND */ +lpfc_printf_vlog (vport,KERN_INFO ,LOG_NODE , +"0932 FIND node did x%x NOT FOUND.\n" , did); + +return np; } struct lpfc_nodelist *
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 73/79 scsi: st: Restore some drive settings after reset
In reply to Sasha LevinFrom: Kai Mäkisara <[email protected]>
[ Upstream commit 7081dc75df79696d8322d01821c28e53416c932c ]
Some of the allowed operations put the tape into a known position to continue operation assuming only the tape position has changed. But reset sets partition, density and block size to drive default values. These should be restored to the values before reset.
Normally the current block size and density are stored by the drive. If the settings have been changed, the changed values have to be saved by the driver across reset.
--- drivers/scsi/st.c | 24 +++++++++++++++++++++--- drivers/scsi/st.h | 2 ++ 2 files changed, 23 insertions(+), 3 deletions(-)
drivers/scsi/st.c +21 -3
@@ -949,7 +949,6 @@ static void reset_state(struct scsi_tape *STp) STp->partition =find_partition (STp);if (STp->partition <0 ) STp->partition =0 ; - STp->new_partition = STp->partition; } }
@@ -2921,14 +2920,17 @@ static int st_int_ioctl(struct scsi_tape *STp, unsigned int cmd_in, unsigned lonif (cmd_in ==MTSETDENSITY ) { (STp->buffer)->b_data[4 ] = arg; STp->density_changed =1 ;/* At least we tried ;-) */ + STp->changed_density = arg; }else if (cmd_in ==SET_DENS_AND_BLK ) (STp->buffer)->b_data[4 ] = arg >>24 ;else (STp->buffer)->b_data[4 ] = STp->density;if (cmd_in ==MTSETBLK || cmd_in ==SET_DENS_AND_BLK ) { ltmp = arg &MT_ST_BLKSIZE_MASK ; -if (cmd_in ==MTSETBLK ) +if (cmd_in ==MTSETBLK ) { STp->blksize_changed =1 ;/* At least we tried ;-) */ + STp->changed_blksize = arg; + } }else ltmp = STp->block_size; (STp->buffer)->b_data[9 ] = (ltmp >>16 );
@@ -3629,9 +3631,25 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) retval = (-EIO ); goto out; } -reset_state (STp); +reset_state (STp);/* Clears pos_unknown */ /* remove this when the midlevel properly clears was_reset */ STp->device->was_reset =0 ; + +/* Fix the device settings after reset, ignore errors */ +if (mtc.mt_op ==MTREW || mtc.mt_op ==MTSEEK || + mtc.mt_op ==MTEOM ) { +if (STp->can_partitions) { +/* STp->new_partition contains the +* latest partition set +*/ + STp->partition =0 ; +switch_partition (STp); + } +if (STp->density_changed) +st_int_ioctl (STp,MTSETDENSITY , STp->changed_density); +if (STp->blksize_changed) +st_int_ioctl (STp,MTSETBLK , STp->changed_blksize); + } } if (mtc.mt_op != MTNOP && mtc.mt_op != MTSETBLK &&
drivers/scsi/st.h +2 -0
@@ -168,12 +168,14 @@ struct scsi_tape {unsigned char compression_changed;unsigned char drv_buffer;unsigned char density; +unsigned char changed_density;unsigned char door_locked;unsigned char autorew_dev;/* auto-rewind device */ unsigned char rew_at_close;/* rewind necessary at close */ unsigned char inited;unsigned char cleaning_req;/* cleaning requested? */ int block_size; +int changed_blksize;int min_block;int max_block;int recover_count;/* From tape opening */
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 74/79 HID: usbkbd: Fix the bit shift number for LED_KANA
In reply to Sasha LevinFrom: junan <[email protected]>
[ Upstream commit d73a4bfa2881a6859b384b75a414c33d4898b055 ]
Since "LED_KANA" was defined as "0x04", the shift number should be "4".
--- drivers/hid/usbhid/usbkbd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hid/usbhid/usbkbd.c +1 -1
@@ -160,7 +160,7 @@ static int usb_kbd_event(struct input_dev *dev, unsigned int type,return -1 ;spin_lock_irqsave (&kbd->leds_lock, flags); - kbd->newleds = (!!test_bit (LED_KANA , dev->led) <<3 ) | (!!test_bit (LED_COMPOSE , dev->led) <<3 ) | + kbd->newleds = (!!test_bit (LED_KANA , dev->led) <<4 ) | (!!test_bit (LED_COMPOSE , dev->led) <<3 ) | (!!test_bit (LED_SCROLLL , dev->led) <<2 ) | (!!test_bit (LED_CAPSL , dev->led) <<1 ) | (!!test_bit (LED_NUML , dev->led));
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 75/79 bpftool: Fix readlink usage in get_fd_type
In reply to Sasha LevinFrom: Viktor Malik <[email protected]>
[ Upstream commit 0053f7d39d491b6138d7c526876d13885cbb65f1 ]
The readlink(path, buf, sizeof(buf)) call reads at most sizeof(buf) bytes and *does not* append null-terminator to buf. With respect to that, fix two pieces in get_fd_type:
1. Change the truncation check to contain sizeof(buf) rather than sizeof(path).
2. Append null-terminator to buf.
Reported by Coverity.
--- tools/bpf/bpftool/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/bpf/bpftool/common.c +2 -1
@@ -283,10 +283,11 @@ int get_fd_type(int fd)p_err ("can't read link type: %s" ,strerror (errno));return -1 ; } -if (n ==sizeof (path)) { +if (n ==sizeof (buf)) {p_err ("can't read link type: path too long!" );return -1 ; } + buf[n] ='\0' ;if (strstr (buf,"bpf-map" ))return BPF_OBJ_MAP ;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 76/79 wifi: rtw88: Don't use static local variable in rtw8822b_set_tx_power_index_by_rate
In reply to Sasha LevinFrom: Bitterblue Smith <[email protected]>
[ Upstream commit 00451eb3bec763f708e7e58326468c1e575e5a66 ]
Some users want to plug two identical USB devices at the same time. This static variable could theoretically cause them to use incorrect TX power values.
Move the variable to the caller and pass a pointer to it to rtw8822b_set_tx_power_index_by_rate().
--- drivers/net/wireless/realtek/rtw88/rtw8822b.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/net/wireless/realtek/rtw88/rtw8822b.c +8 -6
@@ -864,11 +864,11 @@ static void rtw8822b_query_rx_desc(struct rtw_dev *rtwdev, u8 *rx_desc, }static void -rtw8822b_set_tx_power_index_by_rate (struct rtw_dev *rtwdev,u8 path,u8 rs) +rtw8822b_set_tx_power_index_by_rate (struct rtw_dev *rtwdev,u8 path, +u8 rs,u32 *phy_pwr_idx) {struct rtw_hal *hal = &rtwdev->hal;static const u32 offset_txagc[2 ] = {0x1d00 ,0x1d80 }; -static u32 phy_pwr_idx;u8 rate, rate_idx, pwr_index, shift;int j;
@@ -876,12 +876,12 @@ rtw8822b_set_tx_power_index_by_rate(struct rtw_dev *rtwdev, u8 path, u8 rs) rate = rtw_rate_section[rs][j]; pwr_index = hal->tx_pwr_tbl[path][rate]; shift = rate &0x3 ; - phy_pwr_idx |= ((u32 )pwr_index << (shift *8 )); + *phy_pwr_idx |= ((u32 )pwr_index << (shift *8 ));if (shift ==0x3 ) { rate_idx = rate &0xfc ;rtw_write32 (rtwdev, offset_txagc[path] + rate_idx, - phy_pwr_idx); - phy_pwr_idx =0 ; + *phy_pwr_idx); + *phy_pwr_idx =0 ; } } }
@@ -889,11 +889,13 @@ rtw8822b_set_tx_power_index_by_rate(struct rtw_dev *rtwdev, u8 path, u8 rs)static void rtw8822b_set_tx_power_index (struct rtw_dev *rtwdev) {struct rtw_hal *hal = &rtwdev->hal; +u32 phy_pwr_idx =0 ;int rs, path;for (path =0 ; path < hal->rf_path_num; path++) {for (rs =0 ; rs <RTW_RATE_SECTION_MAX ; rs++) -rtw8822b_set_tx_power_index_by_rate (rtwdev, path, rs); +rtw8822b_set_tx_power_index_by_rate (rtwdev, path, rs, + &phy_pwr_idx); } }
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 77/79 regulator: ad5398: Add device tree support
In reply to Sasha LevinFrom: Isaac Scott <[email protected]>
[ Upstream commit 5a6a461079decea452fdcae955bccecf92e07e97 ]
Previously, the ad5398 driver used only platform_data, which is deprecated in favour of device tree. This caused the AD5398 to fail to probe as it could not load its init_data. If the AD5398 has a device tree node, pull the init_data from there using of_get_regulator_init_data.
--- drivers/regulator/ad5398.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
drivers/regulator/ad5398.c +9 -3
@@ -14,6 +14,7 @@#include <linux/platform_device.h> #include <linux/regulator/driver.h> #include <linux/regulator/machine.h> +#include <linux/regulator/of_regulator.h> #define AD5398_CURRENT_EN_MASK 0x8000
@@ -221,15 +222,20 @@ static int ad5398_probe(struct i2c_client *client,const struct ad5398_current_data_format *df = (struct ad5398_current_data_format *)id->driver_data; -if (!init_data) -return -EINVAL ; - chip =devm_kzalloc (&client->dev,sizeof (*chip),GFP_KERNEL );if (!chip)return -ENOMEM ; config.dev = &client->dev; +if (client->dev.of_node) + init_data =of_get_regulator_init_data (&client->dev, + client->dev.of_node, + &ad5398_reg); +if (!init_data) +return -EINVAL ; + config.init_data = init_data; + config.of_node = client->dev.of_node; config.driver_data = chip; chip->client = client;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 78/79 drm/atomic: clarify the rules around drm_atomic_state->allow_modeset
In reply to Sasha LevinFrom: Simona Vetter <[email protected]>
[ Upstream commit c5e3306a424b52e38ad2c28c7f3399fcd03e383d ]
msm is automagically upgrading normal commits to full modesets, and that's a big no-no:
- for one this results in full on->off->on transitions on all these crtc, at least if you're using the usual helpers. Which seems to be the case, and is breaking uapi
- further even if the ctm change itself would not result in flicker, this can hide modesets for other reasons. Which again breaks the uapi
v2: I forgot the case of adding unrelated crtc state. Add that case and link to the existing kerneldoc explainers. This has come up in an irc discussion with Manasi and Ville about intel's bigjoiner mode. Also cc everyone involved in the msm irc discussion, more people joined after I sent out v1.
v3: Wording polish from Pekka and Thomas
--- include/drm/drm_atomic.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
include/drm/drm_atomic.h +21 -2
@@ -323,8 +323,27 @@ struct drm_atomic_state {* * Allow full modeset. This is used by the ATOMIC IOCTL handler to * implement the DRM_MODE_ATOMIC_ALLOW_MODESET flag. Drivers should -* never consult this flag, instead looking at the output of -* drm_atomic_crtc_needs_modeset(). +* generally not consult this flag, but instead look at the output of +* drm_atomic_crtc_needs_modeset(). The detailed rules are: +* +* - Drivers must not consult @allow_modeset in the atomic commit path. +* Use drm_atomic_crtc_needs_modeset() instead. +* +* - Drivers must consult @allow_modeset before adding unrelated struct +* drm_crtc_state to this commit by calling +* drm_atomic_get_crtc_state(). See also the warning in the +* documentation for that function. +* +* - Drivers must never change this flag, it is under the exclusive +* control of userspace. +* +* - Drivers may consult @allow_modeset in the atomic check path, if +* they have the choice between an optimal hardware configuration +* which requires a modeset, and a less optimal configuration which +* can be committed without a modeset. An example would be suboptimal +* scanout FIFO allocation resulting in increased idle power +* consumption. This allows userspace to avoid flickering and delays +* for the normal composition loop at reasonable cost. */ bool allow_modeset : 1; bool legacy_cursor_update : 1;
Signature · 1 line
2.39.5
Sasha Levin
maintainerPATCH 79/79 drm: Add valid clones check
In reply to Sasha LevinFrom: Jessica Zhang <[email protected]>
[ Upstream commit 41b4b11da02157c7474caf41d56baae0e941d01a ]
Check that all encoders attached to a given CRTC are valid possible_clones of each other.
--- drivers/gpu/drm/drm_atomic_helper.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
drivers/gpu/drm/drm_atomic_helper.c +28 -0
@@ -561,6 +561,30 @@ mode_valid(struct drm_atomic_state *state)return 0 ; } +static int drm_atomic_check_valid_clones (struct drm_atomic_state *state, +struct drm_crtc *crtc) +{ +struct drm_encoder *drm_enc; +struct drm_crtc_state *crtc_state =drm_atomic_get_new_crtc_state (state, + crtc); + +drm_for_each_encoder_mask (drm_enc, crtc->dev, crtc_state->encoder_mask) { +if (!drm_enc->possible_clones) { +DRM_DEBUG ("enc%d possible_clones is 0\n" , drm_enc->base.id); +continue ; + } + +if ((crtc_state->encoder_mask & drm_enc->possible_clones) != + crtc_state->encoder_mask) { +DRM_DEBUG ("crtc%d failed valid clone check for mask 0x%x\n" , + crtc->base.id, crtc_state->encoder_mask); +return -EINVAL ; + } + } + +return 0 ; +} +/** * drm_atomic_helper_check_modeset - validate state object for modeset changes * @dev: DRM device
@@ -724,6 +748,10 @@ drm_atomic_helper_check_modeset(struct drm_device *dev, ret =drm_atomic_add_affected_planes (state, crtc);if (ret !=0 )return ret; + + ret =drm_atomic_check_valid_clones (state, crtc); +if (ret !=0 ) +return ret; }/*
Signature · 1 line
2.39.5