4.19.291-rc1 review
Subsystems (8)
Greg Kroah-Hartman
maintainerPATCH 279/323 s390/dasd: fix hanging device after quiesce/resume
In reply to Greg Kroah-HartmanFrom: Stefan Haberland <[email protected]>
commit 05f1d8ed03f547054efbc4d29bb7991c958ede95 upstream.
Quiesce and resume are functions that tell the DASD driver to stop/resume issuing I/Os to a specific DASD.
On resume dasd_schedule_block_bh() is called to kick handling of IO requests again. This does unfortunately not cover internal requests which are used for path verification for example.
This could lead to a hanging device when a path event or anything else that triggers internal requests occurs on a quiesced device.
Fix by also calling dasd_schedule_device_bh() which triggers handling of internal requests on resume.
--- drivers/s390/block/dasd_ioctl.c | 1 + 1 file changed, 1 insertion(+)
drivers/s390/block/dasd_ioctl.c +1 -0
@@ -137,6 +137,7 @@ static int dasd_ioctl_resume(struct dasdspin_unlock_irqrestore (get_ccwdev_lock (base->cdev), flags);dasd_schedule_block_bh (block); +dasd_schedule_device_bh (base);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 280/323 ASoC: wm8904: Fill the cache for WM8904_ADC_TEST_0 register
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
commit f061e2be8689057cb4ec0dbffa9f03e1a23cdcb2 upstream.
The WM8904_ADC_TEST_0 register is modified as part of updating the OSR controls but does not have a cache default, leading to errors when we try to modify these controls in cache only mode with no prior read:
wm8904 3-001a: ASoC: error at snd_soc_component_update_bits on wm8904.3-001a for register: [0x000000c6] -16
Add a read of the register to probe() to fill the cache and avoid both the error messages and the misconfiguration of the chip which will result.
--- sound/soc/codecs/wm8904.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/codecs/wm8904.c +3 -0
@@ -2264,6 +2264,9 @@ static int wm8904_i2c_probe(struct i2c_cregmap_update_bits (wm8904->regmap,WM8904_BIAS_CONTROL_0 ,WM8904_POBCTRL ,0 ); +/* Fill the cache for the ADC test register */ +regmap_read (wm8904->regmap,WM8904_ADC_TEST_0 , &val); +/* Can leave the device powered off until we need it */ regcache_cache_only (wm8904->regmap, true);regulator_bulk_disable (ARRAY_SIZE (wm8904->supplies), wm8904->supplies);
Greg Kroah-Hartman
maintainerPATCH 281/323 dm cache policy smq: ensure IO doesnt prevent cleaner policy progress
In reply to Greg Kroah-HartmanFrom: Joe Thornber <[email protected]>
commit 1e4ab7b4c881cf26c1c72b3f56519e03475486fb upstream.
When using the cleaner policy to decommission the cache, there is never any writeback started from the cache as it is constantly delayed due to normal I/O keeping the device busy. Meaning @idle=false was always being passed to clean_target_met()
Fix this by adding a specific 'cleaner' flag that is set when the cleaner policy is configured. This flag serves to always allow the cleaner's writeback work to be queued until the cache is decommissioned (even if the cache isn't idle).
--- drivers/md/dm-cache-policy-smq.c | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-)
drivers/md/dm-cache-policy-smq.c +18 -10
@@ -854,7 +854,13 @@ struct smq_policy {struct background_tracker *bg_work; -bool migrations_allowed; + bool migrations_allowed:1; + +/* +* If this is set the policy will try and clean the whole cache +* even if the device is not idle. +*/ + bool cleaner:1; };/*----------------------------------------------------------------*/
@@ -1133,7 +1139,7 @@ static bool clean_target_met(struct smq_* Cache entries may not be populated. So we cannot rely on the * size of the clean queue. */ -if (idle) { +if (idle || mq->cleaner) {/* * We'd like to clean everything. */
@@ -1716,11 +1722,9 @@ static void calc_hotspot_params(sector_t *hotspot_block_size /=2u ; } -static struct dm_cache_policy *__smq_create (dm_cblock_t cache_size, -sector_t origin_size, -sector_t cache_block_size, -bool mimic_mq, -bool migrations_allowed) +static struct dm_cache_policy * +__smq_create (dm_cblock_t cache_size,sector_t origin_size,sector_t cache_block_size, +bool mimic_mq,bool migrations_allowed,bool cleaner) {unsigned i;unsigned nr_sentinels_per_queue =2u *NR_CACHE_LEVELS ;
@@ -1807,6 +1811,7 @@ static struct dm_cache_policy *__smq_cre goto bad_btracker; mq->migrations_allowed = migrations_allowed; + mq->cleaner = cleaner;return &mq->policy;
@@ -1830,21 +1835,24 @@ static struct dm_cache_policy *smq_creatsector_t origin_size, sector_t cache_block_size) { - return __smq_create(cache_size, origin_size, cache_block_size, false, true); + return __smq_create(cache_size, origin_size, cache_block_size, +false ,true ,false ); }static struct dm_cache_policy *mq_create (dm_cblock_t cache_size,sector_t origin_size,sector_t cache_block_size) { -return __smq_create (cache_size, origin_size, cache_block_size, true, true); +return __smq_create (cache_size, origin_size, cache_block_size, + true, true, false); }static struct dm_cache_policy *cleaner_create (dm_cblock_t cache_size,sector_t origin_size,sector_t cache_block_size) { -return __smq_create (cache_size, origin_size, cache_block_size, false, false); +return __smq_create (cache_size, origin_size, cache_block_size, + false, false, true); }/*----------------------------------------------------------------*/
Greg Kroah-Hartman
maintainerPATCH 282/323 drm/client: Fix memory leak in drm_client_target_cloned
In reply to Greg Kroah-HartmanFrom: Jocelyn Falempe <[email protected]>
commit c2a88e8bdf5f6239948d75283d0ae7e0c7945b03 upstream.
dmt_mode is allocated and never freed in this function.
It was found with the ast driver, but most drivers using generic fbdev setup are probably affected.
This fixes the following kmemleak report:
backtrace:
[<00000000b391296d>] drm_mode_duplicate+0x45/0x220 [drm]
[<00000000e45bb5b3>] drm_client_target_cloned.constprop.0+0x27b/0x480 [drm]
[<00000000ed2d3a37>] drm_client_modeset_probe+0x6bd/0xf50 [drm]
[<0000000010e5cc9d>] __drm_fb_helper_initial_config_and_unlock+0xb4/0x2c0 [drm_kms_helper]
[<00000000909f82ca>] drm_fbdev_client_hotplug+0x2bc/0x4d0 [drm_kms_helper]
[<00000000063a69aa>] drm_client_register+0x169/0x240 [drm]
[<00000000a8c61525>] ast_pci_probe+0x142/0x190 [ast]
[<00000000987f19bb>] local_pci_probe+0xdc/0x180
[<000000004fca231b>] work_for_cpu_fn+0x4e/0xa0
[<0000000000b85301>] process_one_work+0x8b7/0x1540
[<000000003375b17c>] worker_thread+0x70a/0xed0
[<00000000b0d43cd9>] kthread+0x29f/0x340
[<000000008d770833>] ret_from_fork+0x1f/0x30unreferenced object 0xff11000333089a00 (size 128):
--- drivers/gpu/drm/drm_fb_helper.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/drm_fb_helper.c +5 -0
@@ -2233,6 +2233,9 @@ static bool drm_target_cloned(struct drm can_clone = true; dmt_mode =drm_mode_find_dmt (fb_helper->dev,1024 ,768 ,60 , false); +if (!dmt_mode) + goto fail; +drm_fb_helper_for_each_connector (fb_helper, i) {if (!enabled[i])continue ;
@@ -2249,11 +2252,13 @@ static bool drm_target_cloned(struct drmif (!modes[i]) can_clone = false; } +kfree (dmt_mode);if (can_clone) {DRM_DEBUG_KMS ("can clone using 1024x768\n" );return true; } +fail:DRM_INFO ("kms: can't enable cloning when we probably wanted to.\n" );return false; }
Greg Kroah-Hartman
maintainerPATCH 283/323 net/sched: cls_fw: Fix improper refcount update leads to use-after-free
In reply to Greg Kroah-HartmanFrom: M A Ramdhan <[email protected]>
commit 0323bce598eea038714f941ce2b22541c46d488f upstream.
In the event of a failure in tcf_change_indev(), fw_set_parms() will immediately return an error after incrementing or decrementing reference counter in tcf_bind_filter(). If attacker can control reference counter to zero and make reference freed, leading to use after free.
In order to prevent this, move the point of possible failure above the point where the TC_FW_CLASSID is handled.
Message-ID: <[email protected]>
--- net/sched/cls_fw.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
net/sched/cls_fw.c +5 -5
@@ -221,11 +221,6 @@ static int fw_set_parms(struct net *net,if (err <0 )return err; -if (tb[TCA_FW_CLASSID ]) { - f->res.classid =nla_get_u32 (tb[TCA_FW_CLASSID ]); -tcf_bind_filter (tp, &f->res, base); - } -#ifdef CONFIG_NET_CLS_IND if (tb[TCA_FW_INDEV ]) {int ret;
@@ -244,6 +239,11 @@ static int fw_set_parms(struct net *net, }else if (head->mask !=0xFFFFFFFF )return err; +if (tb[TCA_FW_CLASSID ]) { + f->res.classid =nla_get_u32 (tb[TCA_FW_CLASSID ]); +tcf_bind_filter (tp, &f->res, base); + } +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 284/323 net/sched: sch_qfq: account for stab overhead in qfq_enqueue
In reply to Greg Kroah-HartmanFrom: Pedro Tammela <[email protected]>
commit 3e337087c3b5805fe0b8a46ba622a962880b5d64 upstream.
Lion says:
-------
In the QFQ scheduler a similar issue to CVE-2023-31436 persists.
Consider the following code in net/sched/sch_qfq.c:
static int qfq_enqueue(struct sk_buff *skb, struct Qdisc *sch,
struct sk_buff **to_free)
{
unsigned int len = qdisc_pkt_len(skb), gso_segs;
// ...
if (unlikely(cl->agg->lmax < len)) {
pr_debug("qfq: increasing maxpkt from %u to %u for class %u",
cl->agg->lmax, len, cl->common.classid);
err = qfq_change_agg(sch, cl, cl->agg->class_weight, len);
if (err) {
cl->qstats.drops++;
return qdisc_drop(skb, sch, to_free);
}
// ...
}Similarly to CVE-2023-31436, "lmax" is increased without any bounds checks according to the packet length "len". Usually this would not impose a problem because packet sizes are naturally limited.
This is however not the actual packet length, rather the "qdisc_pkt_len(skb)" which might apply size transformations according to "struct qdisc_size_table" as created by "qdisc_get_stab()" in net/sched/sch_api.c if the TCA_STAB option was set when modifying the qdisc.
A user may choose virtually any size using such a table.
As a result the same issue as in CVE-2023-31436 can occur, allowing heap out-of-bounds read / writes in the kmalloc-8192 cache.
-------
We can create the issue with the following commands:
tc qdisc add dev $DEV root handle 1: stab mtu 2048 tsize 512 mpu 0 \
overhead 999999999 linklayer ethernet qfq
tc class add dev $DEV parent 1: classid 1:1 htb rate 6mbit burst 15k tc filter add dev $DEV parent 1: matchall classid 1:1 ping -I $DEV 1.1.1.2
This is caused by incorrectly assuming that qdisc_pkt_len() returns a length within the QFQ_MIN_LMAX < len < QFQ_MAX_LMAX.
--- net/sched/sch_qfq.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/sched/sch_qfq.c +6 -1
@@ -387,8 +387,13 @@ static int qfq_change_agg(struct Qdisc * u32 lmax) {struct qfq_sched *q =qdisc_priv (sch); -struct qfq_aggregate *new_agg =qfq_find_agg (q, lmax, weight); +struct qfq_aggregate *new_agg; +/* 'lmax' can range from [QFQ_MIN_LMAX, pktlen + stab overhead] */ +if (lmax > (1UL <<QFQ_MTU_SHIFT )) +return -EINVAL ; + + new_agg =qfq_find_agg (q, lmax, weight);if (new_agg ==NULL ) {/* create new aggregate */ new_agg =kzalloc (sizeof (*new_agg),GFP_ATOMIC );if (new_agg ==NULL )
Greg Kroah-Hartman
maintainerPATCH 285/323 ASoC: cs42l51: fix driver to properly autoload with automatic module loading
In reply to Greg Kroah-HartmanFrom: Thomas Petazzoni <[email protected]>
commit e51df4f81b02bcdd828a04de7c1eb6a92988b61e upstream.
In commit 2cb1e0259f50 ("ASoC: cs42l51: re-hook of_match_table pointer"), 9 years ago, some random guy fixed the cs42l51 after it was split into a core part and an I2C part to properly match based on a Device Tree compatible string.
However, the fix in this commit is wrong: the MODULE_DEVICE_TABLE(of, ....) is in the core part of the driver, not the I2C part. Therefore, automatic module loading based on module.alias, based on matching with the DT compatible string, loads the core part of the driver, but not the I2C part. And threfore, the i2c_driver is not registered, and the codec is not known to the system, nor matched with a DT node with the corresponding compatible string.
In order to fix that, we move the MODULE_DEVICE_TABLE(of, ...) into the I2C part of the driver. The cs42l51_of_match[] array is also moved as well, as it is not possible to have this definition in one file, and the MODULE_DEVICE_TABLE(of, ...) invocation in another file, due to how MODULE_DEVICE_TABLE works.
Thanks to this commit, the I2C part of the driver now properly autoloads, and thanks to its dependency on the core part, the core part gets autoloaded as well, resulting in a functional sound card without having to manually load kernel modules.
--- sound/soc/codecs/cs42l51-i2c.c | 6 ++++++ sound/soc/codecs/cs42l51.c | 7 ------- sound/soc/codecs/cs42l51.h | 1 - 3 files changed, 6 insertions(+), 8 deletions(-)
sound/soc/codecs/cs42l51-i2c.c +6 -0
@@ -23,6 +23,12 @@ static struct i2c_device_id cs42l51_i2c_ };MODULE_DEVICE_TABLE (i2c, cs42l51_i2c_id); +const struct of_device_id cs42l51_of_match[] = { + { .compatible ="cirrus,cs42l51" , }, + { } +}; +MODULE_DEVICE_TABLE (of, cs42l51_of_match); +static int cs42l51_i2c_probe (struct i2c_client *i2c,const struct i2c_device_id *id) {
sound/soc/codecs/cs42l51.c +0 -7
@@ -563,13 +563,6 @@ error: }EXPORT_SYMBOL_GPL (cs42l51_probe); -const struct of_device_id cs42l51_of_match[] = { - { .compatible ="cirrus,cs42l51" , }, - { } -}; -MODULE_DEVICE_TABLE (of, cs42l51_of_match); -EXPORT_SYMBOL_GPL (cs42l51_of_match); -MODULE_AUTHOR ("Arnaud Patard <[email protected]>" );MODULE_DESCRIPTION ("Cirrus Logic CS42L51 ALSA SoC Codec Driver" );MODULE_LICENSE ("GPL" );
sound/soc/codecs/cs42l51.h +0 -1
@@ -22,7 +22,6 @@ struct device;extern const struct regmap_config cs42l51_regmap;int cs42l51_probe (struct device *dev,struct regmap *regmap); -extern const struct of_device_id cs42l51_of_match[];#define CS42L51_CHIP_ID 0x1B#define CS42L51_CHIP_REV_A 0x00
Greg Kroah-Hartman
maintainerPATCH 286/323 net/sched: cls_u32: Fix reference counter leak leading to overflow
In reply to Greg Kroah-HartmanFrom: Lee Jones <[email protected]>
commit 04c55383fa5689357bcdd2c8036725a55ed632bc upstream.
In the event of a failure in tcf_change_indev(), u32_set_parms() will immediately return without decrementing the recently incremented reference counter. If this happens enough times, the counter will rollover and the reference freed, leading to a double free which can be used to do 'bad things'.
In order to prevent this, move the point of possible failure above the point where the reference counter is incremented. Also save any meaningful return values to be applied to the return data at the appropriate point in time.
This issue was caught with KASAN.
--- net/sched/cls_u32.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
net/sched/cls_u32.c +13 -7
@@ -778,11 +778,22 @@ static int u32_set_parms(struct net *net struct netlink_ext_ack *extack) {int err; +#ifdef CONFIG_NET_CLS_IND +int ifindex =-1 ; +#endif err =tcf_exts_validate (net, tp, tb, est, &n->exts, ovr, extack);if (err <0 )return err; +#ifdef CONFIG_NET_CLS_IND +if (tb[TCA_U32_INDEV ]) { + ifindex =tcf_change_indev (net, tb[TCA_U32_INDEV ], extack); +if (ifindex <0 ) +return -EINVAL ; + } +#endif +if (tb[TCA_U32_LINK ]) {u32 handle =nla_get_u32 (tb[TCA_U32_LINK ]);struct tc_u_hnode *ht_down =NULL , *ht_old;
@@ -814,13 +825,8 @@ static int u32_set_parms(struct net *net }#ifdef CONFIG_NET_CLS_IND -if (tb[TCA_U32_INDEV ]) { -int ret; - ret =tcf_change_indev (net, tb[TCA_U32_INDEV ], extack); -if (ret <0 ) -return -EINVAL ; - n->ifindex = ret; - } +if (ifindex >=0 ) + n->ifindex = ifindex;#endif return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 287/323 perf: Fix function pointer case
In reply to Greg Kroah-HartmanFrom: Peter Zijlstra <[email protected]>
commit 1af6239d1d3e61d33fd2f0ba53d3d1a67cc50574 upstream.
With the advent of CFI it is no longer acceptible to cast function pointers.
The robot complains thusly:
kernel-events-core.c:warning:cast-from-int-(-)(struct-perf_cpu_pmu_context-)-to-remote_function_f-(aka-int-(-)(void-)-)-converts-to-incompatible-function-type
--- kernel/events/core.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
kernel/events/core.c +6 -2
@@ -1133,6 +1133,11 @@ static int perf_mux_hrtimer_restart(strureturn 0 ; } +static int perf_mux_hrtimer_restart_ipi (void *arg) +{ +return perf_mux_hrtimer_restart (arg); +} +void perf_pmu_disable (struct pmu *pmu) {int *count =this_cpu_ptr (pmu->pmu_disable_count);
@@ -9644,8 +9649,7 @@ perf_event_mux_interval_ms_store(struct cpuctx =per_cpu_ptr (pmu->pmu_cpu_context, cpu); cpuctx->hrtimer_interval =ns_to_ktime (NSEC_PER_MSEC * timer); -cpu_function_call (cpu, - (remote_function_f )perf_mux_hrtimer_restart, cpuctx); +cpu_function_call (cpu, perf_mux_hrtimer_restart_ipi, cpuctx); }cpus_read_unlock ();mutex_unlock (&mux_interval_mutex);
Greg Kroah-Hartman
maintainerPATCH 288/323 loop: Select I/O scheduler none from inside add_disk()
In reply to Greg Kroah-HartmanFrom: Bart Van Assche <[email protected]>
commit 2112f5c1330a671fa852051d85cb9eadc05d7eb7 upstream.
We noticed that the user interface of Android devices becomes very slow under memory pressure. This is because Android uses the zram driver on top of the loop driver for swapping, because under memory pressure the swap code alternates reads and writes quickly, because mq-deadline is the default scheduler for loop devices and because mq-deadline delays writes by five seconds for such a workload with default settings. Fix this by making the kernel select I/O scheduler 'none' from inside add_disk() for loop devices. This default can be overridden at any time from user space, e.g. via a udev rule. This approach has an advantage compared to changing the I/O scheduler from userspace from 'mq-deadline' into 'none', namely that synchronize_rcu() does not get called.
This patch changes the default I/O scheduler for loop devices from 'mq-deadline' into 'none'.
Additionally, this patch reduces the Android boot time on my test setup with 0.5 seconds compared to configuring the loop I/O scheduler from user space.
--- drivers/block/loop.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/block/loop.c +2 -1
@@ -1991,7 +1991,8 @@ static int loop_add(struct loop_device * lo->tag_set.queue_depth =128 ; lo->tag_set.numa_node =NUMA_NO_NODE ; lo->tag_set.cmd_size =sizeof (struct loop_cmd ); - lo->tag_set.flags =BLK_MQ_F_SHOULD_MERGE |BLK_MQ_F_SG_MERGE ; + lo->tag_set.flags =BLK_MQ_F_SHOULD_MERGE |BLK_MQ_F_SG_MERGE | +BLK_MQ_F_NO_SCHED ; lo->tag_set.driver_data = lo; err =blk_mq_alloc_tag_set (&lo->tag_set);
Greg Kroah-Hartman
maintainerPATCH 289/323 word-at-a-time: use the same return type for has_zero regardless of endianness
In reply to Greg Kroah-HartmanFrom: [email protected] <[email protected]>
[ Upstream commit 79e8328e5acbe691bbde029a52c89d70dcbc22f3 ]
Compiling big-endian targets with Clang produces the diagnostic:
fs/namei.c:2173:13: warning: use of bitwise '|' with boolean operands [-Wbitwise-instead-of-logical]
} while (!(has_zero(a, &adata, &constants) | has_zero(b, &bdata, &constants)));
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|| fs/namei.c:2173:13: note: cast one or both operands to int to silence this warning
It appears that when has_zero was introduced, two definitions were produced with different signatures (in particular different return types).
Looking at the usage in hash_name() in fs/namei.c, I suspect that has_zero() is meant to be invoked twice per while loop iteration; using logical-or would not update bdata when a did not have zeros. So I think it's preferred to always return an unsigned long rather than a bool than update the while loop in hash_name() to use a logical-or rather than bitwise-or.
[ Also changed powerpc version to do the same - Linus ]
--- arch/powerpc/include/asm/word-at-a-time.h | 2 +- include/asm-generic/word-at-a-time.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/word-at-a-time.h +1 -1
@@ -34,7 +34,7 @@ static inline long find_zero(unsigned long mask)return leading_zero_bits >>3 ; } -static inline bool has_zero (unsigned long val,unsigned long *data,const struct word_at_a_time *c) +static inline unsigned long has_zero (unsigned long val,unsigned long *data,const struct word_at_a_time *c) {unsigned long rhs = val | c->low_bits; *data = rhs;
include/asm-generic/word-at-a-time.h +1 -1
@@ -38,7 +38,7 @@ static inline long find_zero(unsigned long mask)return (mask >>8 ) ? byte : byte +1 ; } -static inline bool has_zero (unsigned long val,unsigned long *data,const struct word_at_a_time *c) +static inline unsigned long has_zero (unsigned long val,unsigned long *data,const struct word_at_a_time *c) {unsigned long rhs = val | c->low_bits; *data = rhs;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 290/323 KVM: s390: fix sthyi error handling
In reply to Greg Kroah-HartmanFrom: Heiko Carstens <[email protected]>
[ Upstream commit 0c02cc576eac161601927b41634f80bfd55bfa9e ]
Commit 9fb6c9b3fea1 ("s390/sthyi: add cache to store hypervisor info") added cache handling for store hypervisor info. This also changed the possible return code for sthyi_fill().
Instead of only returning a condition code like the sthyi instruction would do, it can now also return a negative error value (-ENOMEM). handle_styhi() was not changed accordingly. In case of an error, the negative error value would incorrectly injected into the guest PSW.
Add proper error handling to prevent this, and update the comment which describes the possible return values of sthyi_fill().
--- arch/s390/kernel/sthyi.c | 6 +++--- arch/s390/kvm/intercept.c | 9 ++++++--- 2 files changed, 9 insertions(+), 6 deletions(-)
arch/s390/kernel/sthyi.c +3 -3
@@ -460,9 +460,9 @@ static int sthyi_update_cache(u64 *rc)* * Fills the destination with system information returned by the STHYI * instruction. The data is generated by emulation or execution of STHYI, -* if available. The return value is the condition code that would be -* returned, the rc parameter is the return code which is passed in -* register R2 + 1. +* if available. The return value is either a negative error value or +* the condition code that would be returned, the rc parameter is the +* return code which is passed in register R2 + 1. */ int sthyi_fill (void *dst,u64 *rc) {
arch/s390/kvm/intercept.c +6 -3
@@ -360,8 +360,8 @@ static int handle_partial_execution(struct kvm_vcpu *vcpu)*/ int handle_sthyi (struct kvm_vcpu *vcpu) { -int reg1, reg2, r =0 ; -u64 code, addr, cc =0 , rc =0 ; +int reg1, reg2, cc =0 , r =0 ; +u64 code, addr, rc =0 ;struct sthyi_sctns *sctns =NULL ;if (!test_kvm_facility (vcpu->kvm,74 ))
@@ -392,7 +392,10 @@ int handle_sthyi(struct kvm_vcpu *vcpu)return -ENOMEM ; cc =sthyi_fill (sctns, &rc); - +if (cc <0 ) { +free_page ((unsigned long )sctns); +return cc; + } out:if (!cc) { r =write_guest (vcpu, addr, reg2, sctns,PAGE_SIZE );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 291/323 net/mlx5e: fix return value check in mlx5e_ipsec_remove_trailer()
In reply to Greg Kroah-HartmanFrom: Yuanjun Gong <[email protected]>
[ Upstream commit e5bcb7564d3bd0c88613c76963c5349be9c511c5 ]
mlx5e_ipsec_remove_trailer() should return an error code if function pskb_trim() returns an unexpected value.
--- drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/en_accel/ipsec_rxtx.c +3 -1
@@ -121,7 +121,9 @@ static int mlx5e_ipsec_remove_trailer(struct sk_buff *skb, struct xfrm_state *x) trailer_len = alen + plen +2 ; -pskb_trim (skb, skb->len - trailer_len); + ret =pskb_trim (skb, skb->len - trailer_len); +if (unlikely (ret)) +return ret;if (skb->protocol ==htons (ETH_P_IP )) { ipv4hdr->tot_len =htons (ntohs (ipv4hdr->tot_len) - trailer_len);ip_send_check (ipv4hdr);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 292/323 perf test uprobe_from_different_cu: Skip if there is no gcc
In reply to Greg Kroah-HartmanFrom: Georg Müller <[email protected]>
[ Upstream commit 98ce8e4a9dcfb448b30a2d7a16190f4a00382377 ]
Without gcc, the test will fail.
On cleanup, ignore probe removal errors. Otherwise, in case of an error adding the probe, the temporary directory is not removed.
--- tools/perf/tests/shell/test_uprobe_from_different_cu.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
tools/perf/tests/shell/test_uprobe_from_different_cu.sh +7 -1
@@ -4,6 +4,12 @@ set -e +# skip if there's no gcc +if ! [ -x "$(command -v gcc)" ]; then + echo "failed: no gcc compiler" + exit 2 +fi + temp_dir=$(mktemp -d /tmp/perf-uprobe-different-cu-sh.XXXXXXXXXX) cleanup()
@@ -11,7 +17,7 @@ cleanup() trap - EXIT TERM INT if [[ "${temp_dir}" =~ ^/tmp/perf-uprobe-different-cu-sh.*$ ]]; then echo "--- Cleaning up ---" - perf probe -x ${temp_dir}/testfile -d foo + perf probe -x ${temp_dir}/testfile -d foo || true rm -f "${temp_dir}/"* rmdir "${temp_dir}" fi
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 293/323 net: sched: cls_u32: Fix match key mis-addressing
In reply to Greg Kroah-HartmanFrom: Jamal Hadi Salim <[email protected]>
[ Upstream commit e68409db995380d1badacba41ff24996bd396171 ]
A match entry is uniquely identified with an "address" or "path" in the form of: hashtable ID(12b):bucketid(8b):nodeid(12b).
When creating table match entries all of hash table id, bucket id and node (match entry id) are needed to be either specified by the user or reasonable in-kernel defaults are used. The in-kernel default for a table id is 0x800(omnipresent root table); for bucketid it is 0x0. Prior to this fix there was none for a nodeid i.e. the code assumed that the user passed the correct nodeid and if the user passes a nodeid of 0 (as Mingi Cho did) then that is what was used. But nodeid of 0 is reserved for identifying the table. This is not a problem until we dump. The dump code notices that the nodeid is zero and assumes it is referencing a table and therefore references table struct tc_u_hnode instead of what was created i.e match entry struct tc_u_knode.
Ming does an equivalent of:
tc filter add dev dummy0 parent 10: prio 1 handle 0x1000 \
protocol ip u32 match ip src 10.0.0.1/32 classid 10:1 action ok
Essentially specifying a table id 0, bucketid 1 and nodeid of zero Tableid 0 is remapped to the default of 0x800.
Bucketid 1 is ignored and defaults to 0x00.
Nodeid was assumed to be what Ming passed - 0x000
dumping before fix shows:
~$ tc filter ls dev dummy0 parent 10:
filter protocol ip pref 1 u32 chain 0
filter protocol ip pref 1 u32 chain 0 fh 800: ht divisor 1 filter protocol ip pref 1 u32 chain 0 fh 800: ht divisor -30591
Note that the last line reports a table instead of a match entry (you can tell this because it says "ht divisor...").
As a result of reporting the wrong data type (misinterpretting of struct tc_u_knode as being struct tc_u_hnode) the divisor is reported with value of -30591. Ming identified this as part of the heap address (physmap_base is 0xffff8880 (-30591 - 1)).
The fix is to ensure that when table entry matches are added and no nodeid is specified (i.e nodeid == 0) then we get the next available nodeid from the table's pool.
After the fix, this is what the dump shows:
$ tc filter ls dev dummy0 parent 10: filter protocol ip pref 1 u32 chain 0 filter protocol ip pref 1 u32 chain 0 fh 800: ht divisor 1 filter protocol ip pref 1 u32 chain 0 fh 800::800 order 2048 key ht 800 bkt 0 flowid 10:1 not_in_hw match 0a000001/ffffffff at 12 action order 1: gact action pass random type none pass val 0 index 1 ref 1 bind 1
--- net/sched/cls_u32.c | 56 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 6 deletions(-)
net/sched/cls_u32.c +50 -6
@@ -1067,18 +1067,62 @@ static int u32_change(struct net *net, struct sk_buff *in_skb,return -EINVAL ; } +/* At this point, we need to derive the new handle that will be used to +* uniquely map the identity of this table match entry. The +* identity of the entry that we need to construct is 32 bits made of: +* htid(12b):bucketid(8b):node/entryid(12b) +* +* At this point _we have the table(ht)_ in which we will insert this +* entry. We carry the table's id in variable "htid". +* Note that earlier code picked the ht selection either by a) the user +* providing the htid specified via TCA_U32_HASH attribute or b) when +* no such attribute is passed then the root ht, is default to at ID +* 0x[800][00][000]. Rule: the root table has a single bucket with ID 0. +* If OTOH the user passed us the htid, they may also pass a bucketid of +* choice. 0 is fine. For example a user htid is 0x[600][01][000] it is +* indicating hash bucketid of 1. Rule: the entry/node ID _cannot_ be +* passed via the htid, so even if it was non-zero it will be ignored. +* +* We may also have a handle, if the user passed one. The handle also +* carries the same addressing of htid(12b):bucketid(8b):node/entryid(12b). +* Rule: the bucketid on the handle is ignored even if one was passed; +* rather the value on "htid" is always assumed to be the bucketid. +*/ if (handle) { +/* Rule: The htid from handle and tableid from htid must match */ if (TC_U32_HTID (handle) &&TC_U32_HTID (handle ^ htid)) {NL_SET_ERR_MSG_MOD (extack,"Handle specified hash table address mismatch" );return -EINVAL ; } - handle = htid |TC_U32_NODE (handle); - err =idr_alloc_u32 (&ht->handle_idr,NULL , &handle, handle, -GFP_KERNEL ); -if (err) -return err; - }else +/* Ok, so far we have a valid htid(12b):bucketid(8b) but we +* need to finalize the table entry identification with the last +* part - the node/entryid(12b)). Rule: Nodeid _cannot be 0_ for +* entries. Rule: nodeid of 0 is reserved only for tables(see +* earlier code which processes TC_U32_DIVISOR attribute). +* Rule: The nodeid can only be derived from the handle (and not +* htid). +* Rule: if the handle specified zero for the node id example +* 0x60000000, then pick a new nodeid from the pool of IDs +* this hash table has been allocating from. +* If OTOH it is specified (i.e for example the user passed a +* handle such as 0x60000123), then we use it generate our final +* handle which is used to uniquely identify the match entry. +*/ +if (!TC_U32_NODE (handle)) { + handle =gen_new_kid (ht, htid); + }else { + handle = htid |TC_U32_NODE (handle); + err =idr_alloc_u32 (&ht->handle_idr,NULL , &handle, + handle,GFP_KERNEL ); +if (err) +return err; + } + }else { +/* The user did not give us a handle; lets just generate one +* from the table's pool of nodeids. +*/ handle =gen_new_kid (ht, htid); + }if (tb[TCA_U32_SEL ] ==NULL ) {NL_SET_ERR_MSG_MOD (extack,"Selector not specified" );
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 294/323 net: add missing data-race annotations around sk->sk_peek_off
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 11695c6e966b0ec7ed1d16777d294cef865a5c91 ]
sk_getsockopt() runs locklessly, thus we need to annotate the read of sk->sk_peek_off.
While we are at it, add corresponding annotations to sk_set_peek_off() and unix_set_peek_off().
--- net/core/sock.c | 4 ++-- net/unix/af_unix.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
net/core/sock.c +2 -2
@@ -1319,7 +1319,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,if (!sock->ops->set_peek_off)return -EOPNOTSUPP ; - v.val = sk->sk_peek_off; + v.val =READ_ONCE (sk->sk_peek_off);break ;case SO_NOFCS : v.val =sock_flag (sk,SOCK_NOFCS );
@@ -2559,7 +2559,7 @@ EXPORT_SYMBOL(__sk_mem_reclaim);int sk_set_peek_off (struct sock *sk,int val) { - sk->sk_peek_off = val; +WRITE_ONCE (sk->sk_peek_off, val);return 0 ; }EXPORT_SYMBOL_GPL (sk_set_peek_off);
net/unix/af_unix.c +1 -1
@@ -706,7 +706,7 @@ static int unix_set_peek_off(struct sock *sk, int val)if (mutex_lock_interruptible (&u->iolock))return -EINTR ; - sk->sk_peek_off = val; +WRITE_ONCE (sk->sk_peek_off, val);mutex_unlock (&u->iolock);return 0 ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 295/323 net: add missing data-race annotation for sk_ll_usec
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit e5f0d2dd3c2faa671711dac6d3ff3cef307bcfe3 ]
In a prior commit I forgot that sk_getsockopt() reads sk->sk_ll_usec without holding a lock.
--- net/core/sock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/sock.c +1 -1
@@ -1349,7 +1349,7 @@ int sock_getsockopt(struct socket *sock, int level, int optname,#ifdef CONFIG_NET_RX_BUSY_POLL case SO_BUSY_POLL : - v.val = sk->sk_ll_usec; + v.val =READ_ONCE (sk->sk_ll_usec);break ;#endif
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 296/323 net/sched: cls_u32: No longer copy tcf_result on update to avoid use-after-free
In reply to Greg Kroah-HartmanFrom: valis <[email protected]>
[ Upstream commit 3044b16e7c6fe5d24b1cdbcf1bd0a9d92d1ebd81 ]
When u32_change() is called on an existing filter, the whole tcf_result struct is always copied into the new instance of the filter.
This causes a problem when updating a filter bound to a class, as tcf_unbind_filter() is always called on the old instance in the success path, decreasing filter_cnt of the still referenced class and allowing it to be deleted, leading to a use-after-free.
Fix this by no longer copying the tcf_result struct from the old filter.
--- net/sched/cls_u32.c | 1 - 1 file changed, 1 deletion(-)
net/sched/cls_u32.c +0 -1
@@ -879,7 +879,6 @@ static struct tc_u_knode *u32_init_knode(struct tcf_proto *tp, new->ifindex = n->ifindex;#endif new->fshift = n->fshift; - new->res = n->res; new->flags = n->flags;RCU_INIT_POINTER (new->ht_down, ht);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 297/323 net/sched: cls_route: No longer copy tcf_result on update to avoid use-after-free
In reply to Greg Kroah-HartmanFrom: valis <[email protected]>
[ Upstream commit b80b829e9e2c1b3f7aae34855e04d8f6ecaf13c8 ]
When route4_change() is called on an existing filter, the whole tcf_result struct is always copied into the new instance of the filter.
This causes a problem when updating a filter bound to a class, as tcf_unbind_filter() is always called on the old instance in the success path, decreasing filter_cnt of the still referenced class and allowing it to be deleted, leading to a use-after-free.
Fix this by no longer copying the tcf_result struct from the old filter.
--- net/sched/cls_route.c | 1 - 1 file changed, 1 deletion(-)
net/sched/cls_route.c +0 -1
@@ -513,7 +513,6 @@ static int route4_change(struct net *net, struct sk_buff *in_skb,if (fold) { f->id = fold->id; f->iif = fold->iif; - f->res = fold->res; f->handle = fold->handle; f->tp = fold->tp;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 298/323 ip6mr: Fix skb_under_panic in ip6mr_cache_report()
In reply to Greg Kroah-HartmanFrom: Yue Haibing <[email protected]>
[ Upstream commit 30e0191b16e8a58e4620fa3e2839ddc7b9d4281c ]
skbuff: skb_under_panic: text:ffffffff88771f69 len:56 put:-4
head:ffff88805f86a800 data:ffff887f5f86a850 tail:0x88 end:0x2c0 dev:pim6reg
------------[ cut here ]------------ kernel BUG at net/core/skbuff.c:192! invalid opcode: 0000 [#1] PREEMPT SMP KASAN CPU: 2 PID: 22968 Comm: kworker/2:11 Not tainted 6.5.0-rc3-00044-g0a8db05b571a #236 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Workqueue: ipv6_addrconf addrconf_dad_work RIP: 0010:skb_panic+0x152/0x1d0 Call Trace: <TASK> skb_push+0xc4/0xe0 ip6mr_cache_report+0xd69/0x19b0 reg_vif_xmit+0x406/0x690 dev_hard_start_xmit+0x17e/0x6e0 __dev_queue_xmit+0x2d6a/0x3d20 vlan_dev_hard_start_xmit+0x3ab/0x5c0 dev_hard_start_xmit+0x17e/0x6e0 __dev_queue_xmit+0x2d6a/0x3d20 neigh_connected_output+0x3ed/0x570 ip6_finish_output2+0x5b5/0x1950 ip6_finish_output+0x693/0x11c0 ip6_output+0x24b/0x880 NF_HOOK.constprop.0+0xfd/0x530 ndisc_send_skb+0x9db/0x1400 ndisc_send_rs+0x12a/0x6c0 addrconf_dad_completed+0x3c9/0xea0 addrconf_dad_work+0x849/0x1420 process_one_work+0xa22/0x16e0 worker_thread+0x679/0x10c0 ret_from_fork+0x28/0x60 ret_from_fork_asm+0x11/0x20
When setup a vlan device on dev pim6reg, DAD ns packet may sent on reg_vif_xmit(). reg_vif_xmit()
ip6mr_cache_report()
skb_push(skb, -skb_network_offset(pkt));//skb_network_offset(pkt) is 4
And skb_push declared as:
void *skb_push(struct sk_buff *skb, unsigned int len); skb->data -= len; //0xffff88805f86a84c - 0xfffffffc = 0xffff887f5f86a850
skb->data is set to 0xffff887f5f86a850, which is invalid mem addr, lead to skb_push() fails.
--- net/ipv6/ip6mr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv6/ip6mr.c +1 -1
@@ -1064,7 +1064,7 @@ static int ip6mr_cache_report(struct mr_table *mrt, struct sk_buff *pkt,And all this only to mangle msg->im6_msgtype and to set msg->im6_mbz to "mbz" :-) */ -skb_push (skb, -skb_network_offset (pkt)); +__skb_pull (skb,skb_network_offset (pkt));skb_push (skb,sizeof (*msg));skb_reset_transport_header (skb);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 299/323 tcp_metrics: fix addr_same() helper
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit e6638094d7af6c7b9dcca05ad009e79e31b4f670 ]
Because v4 and v6 families use separate inetpeer trees (respectively net->ipv4.peers and net->ipv6.peers), inetpeer_addr_cmp(a, b) assumes a & b share the same family.
tcp_metrics use a common hash table, where entries can have different families.
We must therefore make sure to not call inetpeer_addr_cmp() if the families do not match.
--- net/ipv4/tcp_metrics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/tcp_metrics.c +1 -1
@@ -78,7 +78,7 @@ static void tcp_metric_set(struct tcp_metrics_block *tm,static bool addr_same (const struct inetpeer_addr *a,const struct inetpeer_addr *b) { -return inetpeer_addr_cmp (a, b) ==0 ; +return (a->family == b->family) && !inetpeer_addr_cmp (a, b); }struct tcpm_hash_bucket {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 300/323 tcp_metrics: annotate data-races around tm->tcpm_stamp
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 949ad62a5d5311d36fce2e14fe5fed3f936da51c ]
tm->tcpm_stamp can be read or written locklessly.
Add needed READ_ONCE()/WRITE_ONCE() to document this.
Also constify tcpm_check_stamp() dst argument.
--- net/ipv4/tcp_metrics.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
net/ipv4/tcp_metrics.c +13 -6
@@ -97,7 +97,7 @@ static void tcpm_suck_dst(struct tcp_metrics_block *tm,u32 msval;u32 val; - tm->tcpm_stamp = jiffies; +WRITE_ONCE (tm->tcpm_stamp, jiffies); val =0 ;if (dst_metric_locked (dst,RTAX_RTT ))
@@ -131,9 +131,15 @@ static void tcpm_suck_dst(struct tcp_metrics_block *tm,#define TCP_METRICS_TIMEOUT (60 * 60 * HZ) -static void tcpm_check_stamp (struct tcp_metrics_block *tm,struct dst_entry *dst) +static void tcpm_check_stamp (struct tcp_metrics_block *tm, +const struct dst_entry *dst) { -if (tm &&unlikely (time_after (jiffies, tm->tcpm_stamp +TCP_METRICS_TIMEOUT ))) +unsigned long limit; + +if (!tm) +return ; + limit =READ_ONCE (tm->tcpm_stamp) +TCP_METRICS_TIMEOUT ; +if (unlikely (time_after (jiffies, limit)))tcpm_suck_dst (tm, dst, false); }
@@ -174,7 +180,8 @@ static struct tcp_metrics_block *tcpm_new(struct dst_entry *dst, oldest =deref_locked (tcp_metrics_hash[hash].chain);for (tm =deref_locked (oldest->tcpm_next); tm; tm =deref_locked (tm->tcpm_next)) { -if (time_before (tm->tcpm_stamp, oldest->tcpm_stamp)) +if (time_before (READ_ONCE (tm->tcpm_stamp), +READ_ONCE (oldest->tcpm_stamp))) oldest = tm; } tm = oldest;
@@ -431,7 +438,7 @@ void tcp_update_metrics(struct sock *sk) tp->reordering); } } - tm->tcpm_stamp = jiffies; +WRITE_ONCE (tm->tcpm_stamp, jiffies); out_unlock:rcu_read_unlock (); }
@@ -652,7 +659,7 @@ static int tcp_metrics_fill_info(struct sk_buff *msg, }if (nla_put_msecs (msg,TCP_METRICS_ATTR_AGE , - jiffies - tm->tcpm_stamp, + jiffies -READ_ONCE (tm->tcpm_stamp),TCP_METRICS_ATTR_PAD ) <0 ) goto nla_put_failure;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 301/323 tcp_metrics: annotate data-races around tm->tcpm_lock
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 285ce119a3c6c4502585936650143e54c8692788 ]
tm->tcpm_lock can be read or written locklessly.
Add needed READ_ONCE()/WRITE_ONCE() to document this.
--- net/ipv4/tcp_metrics.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/ipv4/tcp_metrics.c +4 -2
@@ -59,7 +59,8 @@ static inline struct net *tm_net(struct tcp_metrics_block *tm)static bool tcp_metric_locked (struct tcp_metrics_block *tm,enum tcp_metric_index idx) { -return tm->tcpm_lock & (1 << idx); +/* Paired with WRITE_ONCE() in tcpm_suck_dst() */ +return READ_ONCE (tm->tcpm_lock) & (1 << idx); } static u32 tcp_metric_get(struct tcp_metrics_block *tm,
@@ -110,7 +111,8 @@ static void tcpm_suck_dst(struct tcp_metrics_block *tm, val |=1 <<TCP_METRIC_CWND ;if (dst_metric_locked (dst,RTAX_REORDERING )) val |=1 <<TCP_METRIC_REORDERING ; - tm->tcpm_lock = val; +/* Paired with READ_ONCE() in tcp_metric_locked() */ +WRITE_ONCE (tm->tcpm_lock, val); msval =dst_metric_raw (dst,RTAX_RTT ); tm->tcpm_vals[TCP_METRIC_RTT ] = msval *USEC_PER_MSEC ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 302/323 tcp_metrics: annotate data-races around tm->tcpm_vals[]
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit 8c4d04f6b443869d25e59822f7cec88d647028a9 ]
tm->tcpm_vals[] values can be read or written locklessly.
Add needed READ_ONCE()/WRITE_ONCE() to document this, and force use of tcp_metric_get() and tcp_metric_set()
--- net/ipv4/tcp_metrics.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-)
net/ipv4/tcp_metrics.c +14 -9
@@ -63,17 +63,19 @@ static bool tcp_metric_locked(struct tcp_metrics_block *tm,return READ_ONCE (tm->tcpm_lock) & (1 << idx); } -static u32 tcp_metric_get (struct tcp_metrics_block *tm, +static u32 tcp_metric_get (const struct tcp_metrics_block *tm,enum tcp_metric_index idx) { -return tm->tcpm_vals[idx]; +/* Paired with WRITE_ONCE() in tcp_metric_set() */ +return READ_ONCE (tm->tcpm_vals[idx]); }static void tcp_metric_set (struct tcp_metrics_block *tm,enum tcp_metric_index idx,u32 val) { - tm->tcpm_vals[idx] = val; +/* Paired with READ_ONCE() in tcp_metric_get() */ +WRITE_ONCE (tm->tcpm_vals[idx], val); } static bool addr_same(const struct inetpeer_addr *a,
@@ -115,13 +117,16 @@ static void tcpm_suck_dst(struct tcp_metrics_block *tm,WRITE_ONCE (tm->tcpm_lock, val); msval =dst_metric_raw (dst,RTAX_RTT ); - tm->tcpm_vals[TCP_METRIC_RTT ] = msval *USEC_PER_MSEC ; +tcp_metric_set (tm,TCP_METRIC_RTT , msval *USEC_PER_MSEC ); msval =dst_metric_raw (dst,RTAX_RTTVAR ); - tm->tcpm_vals[TCP_METRIC_RTTVAR ] = msval *USEC_PER_MSEC ; - tm->tcpm_vals[TCP_METRIC_SSTHRESH ] =dst_metric_raw (dst,RTAX_SSTHRESH ); - tm->tcpm_vals[TCP_METRIC_CWND ] =dst_metric_raw (dst,RTAX_CWND ); - tm->tcpm_vals[TCP_METRIC_REORDERING ] =dst_metric_raw (dst,RTAX_REORDERING ); +tcp_metric_set (tm,TCP_METRIC_RTTVAR , msval *USEC_PER_MSEC ); +tcp_metric_set (tm,TCP_METRIC_SSTHRESH , +dst_metric_raw (dst,RTAX_SSTHRESH )); +tcp_metric_set (tm,TCP_METRIC_CWND , +dst_metric_raw (dst,RTAX_CWND )); +tcp_metric_set (tm,TCP_METRIC_REORDERING , +dst_metric_raw (dst,RTAX_REORDERING ));if (fastopen_clear) { tm->tcpm_fastopen.mss =0 ; tm->tcpm_fastopen.syn_loss =0 ;
@@ -672,7 +677,7 @@ static int tcp_metrics_fill_info(struct sk_buff *msg,if (!nest) goto nla_put_failure;for (i =0 ; i <TCP_METRIC_MAX_KERNEL +1 ; i++) { -u32 val = tm->tcpm_vals[i]; +u32 val =tcp_metric_get (tm, i);if (!val)continue ;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 303/323 tcp_metrics: annotate data-races around tm->tcpm_net
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit d5d986ce42c71a7562d32c4e21e026b0f87befec ]
tm->tcpm_net can be read or written locklessly.
Instead of changing write_pnet() and read_pnet() and potentially hurt performance, add the needed READ_ONCE()/WRITE_ONCE() in tm_net() and tcpm_new().
--- net/ipv4/tcp_metrics.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
net/ipv4/tcp_metrics.c +7 -4
@@ -40,7 +40,7 @@ struct tcp_fastopen_metrics {struct tcp_metrics_block {struct tcp_metrics_block __rcu *tcpm_next; -possible_net_t tcpm_net; +struct net *tcpm_net;struct inetpeer_addr tcpm_saddr;struct inetpeer_addr tcpm_daddr;unsigned long tcpm_stamp;
@@ -51,9 +51,10 @@ struct tcp_metrics_block {struct rcu_head rcu_head; }; -static inline struct net *tm_net (struct tcp_metrics_block *tm) +static inline struct net *tm_net (const struct tcp_metrics_block *tm) { -return read_pnet (&tm->tcpm_net); +/* Paired with the WRITE_ONCE() in tcpm_new() */ +return READ_ONCE (tm->tcpm_net); } static bool tcp_metric_locked(struct tcp_metrics_block *tm,
@@ -197,7 +198,9 @@ static struct tcp_metrics_block *tcpm_new(struct dst_entry *dst,if (!tm) goto out_unlock; } -write_pnet (&tm->tcpm_net, net); +/* Paired with the READ_ONCE() in tm_net() */ +WRITE_ONCE (tm->tcpm_net, net); + tm->tcpm_saddr = *saddr; tm->tcpm_daddr = *daddr;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 304/323 tcp_metrics: fix data-race in tcpm_suck_dst() vs fastopen
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
[ Upstream commit ddf251fa2bc1d3699eec0bae6ed0bc373b8fda79 ]
Whenever tcpm_new() reclaims an old entry, tcpm_suck_dst() would overwrite data that could be read from tcp_fastopen_cache_get() or tcp_metrics_fill_info().
We need to acquire fastopen_seqlock to maintain consistency.
For newly allocated objects, tcpm_new() can switch to kzalloc() to avoid an extra fastopen_seqlock acquisition.
--- net/ipv4/tcp_metrics.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
net/ipv4/tcp_metrics.c +5 -4
@@ -93,6 +93,7 @@ static struct tcpm_hash_bucket *tcp_metrics_hash __read_mostly;static unsigned int tcp_metrics_hash_log__read_mostly ;static DEFINE_SPINLOCK (tcp_metrics_lock); +static DEFINE_SEQLOCK (fastopen_seqlock); static void tcpm_suck_dst(struct tcp_metrics_block *tm, const struct dst_entry *dst,
@@ -129,11 +130,13 @@ static void tcpm_suck_dst(struct tcp_metrics_block *tm,tcp_metric_set (tm,TCP_METRIC_REORDERING ,dst_metric_raw (dst,RTAX_REORDERING ));if (fastopen_clear) { +write_seqlock (&fastopen_seqlock); tm->tcpm_fastopen.mss =0 ; tm->tcpm_fastopen.syn_loss =0 ; tm->tcpm_fastopen.try_exp =0 ; tm->tcpm_fastopen.cookie.exp = false; tm->tcpm_fastopen.cookie.len =0 ; +write_sequnlock (&fastopen_seqlock); } }
@@ -194,7 +197,7 @@ static struct tcp_metrics_block *tcpm_new(struct dst_entry *dst, } tm = oldest; }else { - tm =kmalloc (sizeof (*tm),GFP_ATOMIC ); + tm =kzalloc (sizeof (*tm),GFP_ATOMIC );if (!tm) goto out_unlock; }
@@ -204,7 +207,7 @@ static struct tcp_metrics_block *tcpm_new(struct dst_entry *dst, tm->tcpm_saddr = *saddr; tm->tcpm_daddr = *daddr; -tcpm_suck_dst (tm, dst, true); +tcpm_suck_dst (tm, dst, reclaim);if (likely (!reclaim)) { tm->tcpm_next = tcp_metrics_hash[hash].chain;
@@ -561,8 +564,6 @@ bool tcp_peer_is_proven(struct request_sock *req, struct dst_entry *dst)return ret; } -static DEFINE_SEQLOCK (fastopen_seqlock); -void tcp_fastopen_cache_get (struct sock *sk,u16 *mss,struct tcp_fastopen_cookie *cookie) {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 305/323 scsi: zfcp: Defer fc_rport blocking until after ADISC response
In reply to Greg Kroah-HartmanFrom: Steffen Maier <[email protected]>
commit e65851989001c0c9ba9177564b13b38201c0854c upstream.
Storage devices are free to send RSCNs, e.g. for internal state changes. If this happens on all connected paths, zfcp risks temporarily losing all paths at the same time. This has strong requirements on multipath configuration such as "no_path_retry queue".
Avoid such situations by deferring fc_rport blocking until after the ADISC response, when any actual state change of the remote port became clear. The already existing port recovery triggers explicitly block the fc_rport. The triggers are: on ADISC reject or timeout (typical cable pull case), and on ADISC indicating that the remote port has changed its WWPN or the port is meanwhile no longer open.
As a side effect, this also removes a confusing direct function call to another work item function zfcp_scsi_rport_work() instead of scheduling that other work item. It was probably done that way to have the rport block side effect immediate and synchronous to the caller.
--- drivers/s390/scsi/zfcp_fc.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/s390/scsi/zfcp_fc.c +1 -5
@@ -534,8 +534,7 @@ static void zfcp_fc_adisc_handler(void */* re-init to undo drop from zfcp_fc_adisc() */ port->d_id =ntoh24 (adisc_resp->adisc_port_id); -/* port is good, unblock rport without going through erp */ -zfcp_scsi_schedule_rport_register (port); +/* port is still good, nothing to do */ out:atomic_andnot (ZFCP_STATUS_PORT_LINK_TEST , &port->status);put_device (&port->dev);
@@ -595,9 +594,6 @@ void zfcp_fc_link_test_work(struct work_int retval;set_worker_desc ("zadisc%16llx" , port->wwpn);/* < WORKER_DESC_LEN=24 */ -get_device (&port->dev); - port->rport_task =RPORT_DEL ; -zfcp_scsi_rport_work (&port->rport_work);/* only issue one test command at one time per port */ if (atomic_read (&port->status) &ZFCP_STATUS_PORT_LINK_TEST )
Greg Kroah-Hartman
maintainerPATCH 306/323 libceph: fix potential hang in ceph_osdc_notify()
In reply to Greg Kroah-HartmanFrom: Ilya Dryomov <[email protected]>
commit e6e2843230799230fc5deb8279728a7218b0d63c upstream.
If the cluster becomes unavailable, ceph_osdc_notify() may hang even with osd_request_timeout option set because linger_notify_finish_wait() waits for MWatchNotify NOTIFY_COMPLETE message with no associated OSD request in flight -- it's completely asynchronous.
Introduce an additional timeout, derived from the specified notify timeout. While at it, switch both waits to killable which is more correct.
--- net/ceph/osd_client.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
net/ceph/osd_client.c +14 -6
@@ -3137,17 +3137,24 @@ static int linger_reg_commit_wait(structint ret;dout ("%s lreq %p linger_id %llu\n" , __func__, lreq, lreq->linger_id); - ret =wait_for_completion_interruptible (&lreq->reg_commit_wait); + ret =wait_for_completion_killable (&lreq->reg_commit_wait);return ret ?: lreq->reg_commit_error; } -static int linger_notify_finish_wait (struct ceph_osd_linger_request *lreq) +static int linger_notify_finish_wait (struct ceph_osd_linger_request *lreq, +unsigned long timeout) { -int ret; +long left;dout ("%s lreq %p linger_id %llu\n" , __func__, lreq, lreq->linger_id); - ret =wait_for_completion_interruptible (&lreq->notify_finish_wait); -return ret ?: lreq->notify_finish_error; + left =wait_for_completion_killable_timeout (&lreq->notify_finish_wait, +ceph_timeout_jiffies (timeout)); +if (left <=0 ) + left = left ?: -ETIMEDOUT ; +else + left = lreq->notify_finish_error;/* completed */ + +return left; }/*
@@ -4760,7 +4767,8 @@ int ceph_osdc_notify(struct ceph_osd_cli ret =linger_reg_commit_wait (lreq);if (!ret) - ret =linger_notify_finish_wait (lreq); + ret =linger_notify_finish_wait (lreq, +msecs_to_jiffies (2 * timeout *MSEC_PER_SEC ));else dout ("lreq %p failed to initiate notify %d\n" , lreq, ret);
Greg Kroah-Hartman
maintainerPATCH 307/323 USB: zaurus: Add ID for A-300/B-500/C-700
In reply to Greg Kroah-HartmanFrom: Ross Maynard <[email protected]>
commit b99225b4fe297d07400f9e2332ecd7347b224f8d upstream.
The SL-A300, B500/5600, and C700 devices no longer auto-load because of "usbnet: Remove over-broad module alias from zaurus."
This patch adds IDs for those 3 devices.
--- drivers/net/usb/cdc_ether.c | 21 +++++++++++++++++++++ drivers/net/usb/zaurus.c | 21 +++++++++++++++++++++ 2 files changed, 42 insertions(+)
drivers/net/usb/cdc_ether.c +21 -0
@@ -618,6 +618,13 @@ static const struct usb_device_id produc .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | USB_DEVICE_ID_MATCH_DEVICE, .idVendor = 0x04DD, + .idProduct =0x8005 ,/* A-300 */ +ZAURUS_FAKE_INTERFACE , + .driver_info = 0, +}, { + .match_flags =USB_DEVICE_ID_MATCH_INT_INFO + |USB_DEVICE_ID_MATCH_DEVICE , + .idVendor = 0x04DD, .idProduct = 0x8006, /* B-500/SL-5600 */ZAURUS_MASTER_INTERFACE , .driver_info = 0,
@@ -625,11 +632,25 @@ static const struct usb_device_id produc .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | USB_DEVICE_ID_MATCH_DEVICE, .idVendor = 0x04DD, + .idProduct =0x8006 ,/* B-500/SL-5600 */ +ZAURUS_FAKE_INTERFACE , + .driver_info = 0, +}, { + .match_flags =USB_DEVICE_ID_MATCH_INT_INFO + |USB_DEVICE_ID_MATCH_DEVICE , + .idVendor = 0x04DD, .idProduct = 0x8007, /* C-700 */ZAURUS_MASTER_INTERFACE , .driver_info = 0, }, { .match_flags =USB_DEVICE_ID_MATCH_INT_INFO + |USB_DEVICE_ID_MATCH_DEVICE , + .idVendor = 0x04DD, + .idProduct = 0x8007, /* C-700 */ +ZAURUS_FAKE_INTERFACE , + .driver_info = 0, +}, { + .match_flags =USB_DEVICE_ID_MATCH_INT_INFO |USB_DEVICE_ID_MATCH_DEVICE , .idVendor = 0x04DD, .idProduct = 0x9031, /* C-750 C-760 */
drivers/net/usb/zaurus.c +21 -0
@@ -301,11 +301,25 @@ static const struct usb_device_id produc .match_flags = USB_DEVICE_ID_MATCH_INT_INFO | USB_DEVICE_ID_MATCH_DEVICE, .idVendor = 0x04DD, + .idProduct =0x8005 ,/* A-300 */ +ZAURUS_FAKE_INTERFACE , + .driver_info = (unsigned long)&bogus_mdlm_info, +}, { + .match_flags =USB_DEVICE_ID_MATCH_INT_INFO + |USB_DEVICE_ID_MATCH_DEVICE , + .idVendor = 0x04DD, .idProduct = 0x8006, /* B-500/SL-5600 */ZAURUS_MASTER_INTERFACE , .driver_info = ZAURUS_PXA_INFO, }, { .match_flags =USB_DEVICE_ID_MATCH_INT_INFO + |USB_DEVICE_ID_MATCH_DEVICE , + .idVendor = 0x04DD, + .idProduct = 0x8006, /* B-500/SL-5600 */ +ZAURUS_FAKE_INTERFACE , + .driver_info = (unsigned long)&bogus_mdlm_info, +}, { + .match_flags =USB_DEVICE_ID_MATCH_INT_INFO |USB_DEVICE_ID_MATCH_DEVICE , .idVendor = 0x04DD, .idProduct = 0x8007, /* C-700 */
@@ -313,6 +327,13 @@ static const struct usb_device_id produc .driver_info = ZAURUS_PXA_INFO, }, { .match_flags = USB_DEVICE_ID_MATCH_INT_INFO + | USB_DEVICE_ID_MATCH_DEVICE, + .idVendor = 0x04DD, + .idProduct =0x8007 ,/* C-700 */ +ZAURUS_FAKE_INTERFACE , + .driver_info = (unsigned long)&bogus_mdlm_info, +}, { + .match_flags =USB_DEVICE_ID_MATCH_INT_INFO |USB_DEVICE_ID_MATCH_DEVICE , .idVendor = 0x04DD, .idProduct = 0x9031, /* C-750 C-760 */
Greg Kroah-Hartman
maintainerPATCH 308/323 fs/sysv: Null check to prevent null-ptr-deref bug
In reply to Greg Kroah-HartmanFrom: Prince Kumar Maurya <[email protected]>
commit ea2b62f305893992156a798f665847e0663c9f41 upstream.
sb_getblk(inode->i_sb, parent) return a null ptr and taking lock on that leads to the null-ptr-deref bug.
Message-Id: <[email protected]>
--- fs/sysv/itree.c | 4 ++++ 1 file changed, 4 insertions(+)
fs/sysv/itree.c +4 -0
@@ -145,6 +145,10 @@ static int alloc_branch(struct inode *in*/ parent =block_to_cpu (SYSV_SB (inode->i_sb), branch[n-1 ].key); bh =sb_getblk (inode->i_sb, parent); +if (!bh) { +sysv_free_block (inode->i_sb, branch[n].key); +break ; + }lock_buffer (bh);memset (bh->b_data,0 , blocksize); branch[n].bh = bh;
Greg Kroah-Hartman
maintainerPATCH 309/323 Bluetooth: L2CAP: Fix use-after-free in l2cap_sock_ready_cb
In reply to Greg Kroah-HartmanFrom: Sungwoo Kim <[email protected]>
commit 1728137b33c00d5a2b5110ed7aafb42e7c32e4a1 upstream.
l2cap_sock_release(sk) frees sk. However, sk's children are still alive and point to the already free'd sk's address.
To fix this, l2cap_sock_release(sk) also cleans sk's children.
==================================================================
BUG: KASAN: use-after-free in l2cap_sock_ready_cb+0xb7/0x100 net/bluetooth/l2cap_sock.c:1650 Read of size 8 at addr ffff888104617aa8 by task kworker/u3:0/276 CPU: 0 PID: 276 Comm: kworker/u3:0 Not tainted 6.2.0-00001-gef397bd4d5fb-dirty #59 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.15.0-1 04/01/2014 Workqueue: hci2 hci_rx_work Call Trace: <TASK> __dump_stack lib/dump_stack.c:88 [inline] dump_stack_lvl+0x72/0x95 lib/dump_stack.c:106 print_address_description mm/kasan/report.c:306 [inline] print_report+0x175/0x478 mm/kasan/report.c:417 kasan_report+0xb1/0x130 mm/kasan/report.c:517 l2cap_sock_ready_cb+0xb7/0x100 net/bluetooth/l2cap_sock.c:1650 l2cap_chan_ready+0x10e/0x1e0 net/bluetooth/l2cap_core.c:1386 l2cap_config_req+0x753/0x9f0 net/bluetooth/l2cap_core.c:4480 l2cap_bredr_sig_cmd net/bluetooth/l2cap_core.c:5739 [inline] l2cap_sig_channel net/bluetooth/l2cap_core.c:6509 [inline] l2cap_recv_frame+0xe2e/0x43c0 net/bluetooth/l2cap_core.c:7788 l2cap_recv_acldata+0x6ed/0x7e0 net/bluetooth/l2cap_core.c:8506 hci_acldata_packet net/bluetooth/hci_core.c:3813 [inline] hci_rx_work+0x66e/0xbc0 net/bluetooth/hci_core.c:4048 process_one_work+0x4ea/0x8e0 kernel/workqueue.c:2289 worker_thread+0x364/0x8e0 kernel/workqueue.c:2436 kthread+0x1b9/0x200 kernel/kthread.c:376 ret_from_fork+0x2c/0x50 arch/x86/entry/entry_64.S:308 </TASK> Allocated by task 288: kasan_save_stack+0x22/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 ____kasan_kmalloc mm/kasan/common.c:374 [inline] __kasan_kmalloc+0x82/0x90 mm/kasan/common.c:383 kasan_kmalloc include/linux/kasan.h:211 [inline] __do_kmalloc_node mm/slab_common.c:968 [inline] __kmalloc+0x5a/0x140 mm/slab_common.c:981 kmalloc include/linux/slab.h:584 [inline] sk_prot_alloc+0x113/0x1f0 net/core/sock.c:2040 sk_alloc+0x36/0x3c0 net/core/sock.c:2093 l2cap_sock_alloc.constprop.0+0x39/0x1c0 net/bluetooth/l2cap_sock.c:1852 l2cap_sock_create+0x10d/0x220 net/bluetooth/l2cap_sock.c:1898 bt_sock_create+0x183/0x290 net/bluetooth/af_bluetooth.c:132 __sock_create+0x226/0x380 net/socket.c:1518 sock_create net/socket.c:1569 [inline] __sys_socket_create net/socket.c:1606 [inline] __sys_socket_create net/socket.c:1591 [inline] __sys_socket+0x112/0x200 net/socket.c:1639 __do_sys_socket net/socket.c:1652 [inline] __se_sys_socket net/socket.c:1650 [inline] __x64_sys_socket+0x40/0x50 net/socket.c:1650 do_syscall_x64 arch/x86/entry/common.c:50 [inline] do_syscall_64+0x3f/0x90 arch/x86/entry/common.c:80 entry_SYSCALL_64_after_hwframe+0x72/0xdc Freed by task 288: kasan_save_stack+0x22/0x50 mm/kasan/common.c:45 kasan_set_track+0x25/0x30 mm/kasan/common.c:52 kasan_save_free_info+0x2e/0x50 mm/kasan/generic.c:523 ____kasan_slab_free mm/kasan/common.c:236 [inline] ____kasan_slab_free mm/kasan/common.c:200 [inline] __kasan_slab_free+0x10a/0x190 mm/kasan/common.c:244 kasan_slab_free include/linux/kasan.h:177 [inline] slab_free_hook mm/slub.c:1781 [inline] slab_free_freelist_hook mm/slub.c:1807 [inline] slab_free mm/slub.c:3787 [inline] __kmem_cache_free+0x88/0x1f0 mm/slub.c:3800 sk_prot_free net/core/sock.c:2076 [inline] __sk_destruct+0x347/0x430 net/core/sock.c:2168 sk_destruct+0x9c/0xb0 net/core/sock.c:2183 __sk_free+0x82/0x220 net/core/sock.c:2194 sk_free+0x7c/0xa0 net/core/sock.c:2205 sock_put include/net/sock.h:1991 [inline] l2cap_sock_kill+0x256/0x2b0 net/bluetooth/l2cap_sock.c:1257 l2cap_sock_release+0x1a7/0x220 net/bluetooth/l2cap_sock.c:1428 __sock_release+0x80/0x150 net/socket.c:650 sock_close+0x19/0x30 net/socket.c:1368 __fput+0x17a/0x5c0 fs/file_table.c:320 task_work_run+0x132/0x1c0 kernel/task_work.c:179 resume_user_mode_work include/linux/resume_user_mode.h:49 [inline] exit_to_user_mode_loop kernel/entry/common.c:171 [inline] exit_to_user_mode_prepare+0x113/0x120 kernel/entry/common.c:203 __syscall_exit_to_user_mode_work kernel/entry/common.c:285 [inline] syscall_exit_to_user_mode+0x21/0x50 kernel/entry/common.c:296 do_syscall_64+0x4c/0x90 arch/x86/entry/common.c:86 entry_SYSCALL_64_after_hwframe+0x72/0xdc The buggy address belongs to the object at ffff888104617800 which belongs to the cache kmalloc-1k of size 1024
The buggy address is located 680 bytes inside of
1024-byte region [ffff888104617800, ffff888104617c00)
The buggy address belongs to the physical page:
page:00000000dbca6a80 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888104614000 pfn:0x104614
head:00000000dbca6a80 order:2 compound_mapcount:0 subpages_mapcount:0 compound_pincount:0
flags: 0x200000000010200(slab|head|node=0|zone=2)
raw: 0200000000010200 ffff888100041dc0 ffffea0004212c10 ffffea0004234b10
raw: ffff888104614000 0000000000080002 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff888104617980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888104617a00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888104617a80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888104617b00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888104617b80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================Ack: This bug is found by FuzzBT with a modified Syzkaller. Other contributors are Ruoyu Wu and Hui Peng.
--- net/bluetooth/l2cap_sock.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/l2cap_sock.c +2 -0
@@ -45,6 +45,7 @@ static const struct proto_ops l2cap_sockstatic void l2cap_sock_init (struct sock *sk,struct sock *parent);static struct sock *l2cap_sock_alloc (struct net *net,struct socket *sock,int proto,gfp_t prio,int kern); +static void l2cap_sock_cleanup_listen (struct sock *parent);bool l2cap_is_socket (struct socket *sock) {
@@ -1205,6 +1206,7 @@ static int l2cap_sock_release(struct socif (!sk)return 0 ; +l2cap_sock_cleanup_listen (sk);bt_sock_unlink (&l2cap_sk_list, sk); err =l2cap_sock_shutdown (sock,2 );
Greg Kroah-Hartman
maintainerPATCH 310/323 net: usbnet: Fix WARNING in usbnet_start_xmit/usb_submit_urb
In reply to Greg Kroah-HartmanFrom: Alan Stern <[email protected]>
commit 5e1627cb43ddf1b24b92eb26f8d958a3f5676ccb upstream.
The syzbot fuzzer identified a problem in the usbnet driver:
usb 1-1: BOGUS urb xfer, pipe 3 != type 1
WARNING: CPU: 0 PID: 754 at drivers/usb/core/urb.c:504 usb_submit_urb+0xed6/0x1880 drivers/usb/core/urb.c:504 Modules linked in: CPU: 0 PID: 754 Comm: kworker/0:2 Not tainted 6.4.0-rc7-syzkaller-00014-g692b7dc87ca6 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023 Workqueue: mld mld_ifc_work RIP: 0010:usb_submit_urb+0xed6/0x1880 drivers/usb/core/urb.c:504 Code: 7c 24 18 e8 2c b4 5b fb 48 8b 7c 24 18 e8 42 07 f0 fe 41 89 d8 44 89 e1 4c 89 ea 48 89 c6 48 c7 c7 a0 c9 fc 8a e8 5a 6f 23 fb <0f> 0b e9 58 f8 ff ff e8 fe b3 5b fb 48 81 c5 c0 05 00 00 e9 84 f7 RSP: 0018:ffffc9000463f568 EFLAGS: 00010086 RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000000 RDX: ffff88801eb28000 RSI: ffffffff814c03b7 RDI: 0000000000000001 RBP: ffff8881443b7190 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000001 R12: 0000000000000003 R13: ffff88802a77cb18 R14: 0000000000000003 R15: ffff888018262500 FS: 0000000000000000(0000) GS:ffff8880b9800000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000556a99c15a18 CR3: 0000000028c71000 CR4: 0000000000350ef0 Call Trace: <TASK> usbnet_start_xmit+0xfe5/0x2190 drivers/net/usb/usbnet.c:1453 __netdev_start_xmit include/linux/netdevice.h:4918 [inline] netdev_start_xmit include/linux/netdevice.h:4932 [inline] xmit_one net/core/dev.c:3578 [inline] dev_hard_start_xmit+0x187/0x700 net/core/dev.c:3594
...
This bug is caused by the fact that usbnet trusts the bulk endpoint addresses its probe routine receives in the driver_info structure, and it does not check to see that these endpoints actually exist and have the expected type and directions.
The fix is simply to add such a check.
--- drivers/net/usb/usbnet.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/usb/usbnet.c +6 -0
@@ -1767,6 +1767,10 @@ usbnet_probe (struct usb_interface *udev }else if (!info->in || !info->out) status =usbnet_get_endpoints (dev, udev);else { +u8 ep_addrs[3 ] = { + info->in +USB_DIR_IN , info->out +USB_DIR_OUT ,0 + }; + dev->in =usb_rcvbulkpipe (xdev, info->in); dev->out =usb_sndbulkpipe (xdev, info->out);if (!(info->flags &FLAG_NO_SETINT ))
@@ -1776,6 +1780,8 @@ usbnet_probe (struct usb_interface *udevelse status =0 ; +if (status ==0 && !usb_check_bulk_endpoints (udev, ep_addrs)) + status = -EINVAL ; }if (status >=0 && dev->status) status =init_status (dev, udev);
Greg Kroah-Hartman
maintainerPATCH 311/323 ext2: Drop fragment support
In reply to Greg Kroah-HartmanFrom: Jan Kara <[email protected]>
commit 404615d7f1dcd4cca200e9a7a9df3a1dcae1dd62 upstream.
Ext2 has fields in superblock reserved for subblock allocation support. However that never landed. Drop the many years dead code.
--- fs/ext2/ext2.h | 12 ------------ fs/ext2/super.c | 23 ++++------------------- 2 files changed, 4 insertions(+), 31 deletions(-)
fs/ext2/ext2.h +0 -12
@@ -68,10 +68,7 @@ struct mb_cache;* second extended-fs super-block data in memory */ struct ext2_sb_info { -unsigned long s_frag_size;/* Size of a fragment in bytes */ -unsigned long s_frags_per_block;/* Number of fragments per block */ unsigned long s_inodes_per_block;/* Number of inodes per block */ -unsigned long s_frags_per_group;/* Number of fragments in a group */ unsigned long s_blocks_per_group;/* Number of blocks in a group */ unsigned long s_inodes_per_group;/* Number of inodes in a group */ unsigned long s_itb_per_group;/* Number of inode table blocks per group */
@@ -186,15 +183,6 @@ static inline struct ext2_sb_info *EXT2_#define EXT2_FIRST_INO (s) (EXT2_SB(s)->s_first_ino)/* -* Macro-instructions used to manage fragments -*/ -#define EXT2_MIN_FRAG_SIZE 1024 -#define EXT2_MAX_FRAG_SIZE 4096 -#define EXT2_MIN_FRAG_LOG_SIZE 10 -#define EXT2_FRAG_SIZE (s) (EXT2_SB(s)->s_frag_size) -#define EXT2_FRAGS_PER_BLOCK (s) (EXT2_SB(s)->s_frags_per_block) - -/* * Structure of a blocks group descriptor */ struct ext2_group_desc
fs/ext2/super.c +4 -19
@@ -691,10 +691,9 @@ static int ext2_setup_super (struct supe es->s_max_mnt_count =cpu_to_le16 (EXT2_DFL_MAX_MNT_COUNT );le16_add_cpu (&es->s_mnt_count,1 );if (test_opt (sb,DEBUG )) - ext2_msg(sb, KERN_INFO, "%s, %s, bs=%lu, fs=%lu, gc=%lu, " + ext2_msg(sb, KERN_INFO, "%s, %s, bs=%lu, gc=%lu, " "bpg=%lu, ipg=%lu, mo=%04lx]", EXT2FS_VERSION, EXT2FS_DATE, sb->s_blocksize, - sbi->s_frag_size, sbi->s_groups_count, EXT2_BLOCKS_PER_GROUP(sb), EXT2_INODES_PER_GROUP(sb),
@@ -1040,14 +1039,7 @@ static int ext2_fill_super(struct super_ } } - sbi->s_frag_size =EXT2_MIN_FRAG_SIZE << -le32_to_cpu (es->s_log_frag_size); -if (sbi->s_frag_size ==0 ) - goto cantfind_ext2; - sbi->s_frags_per_block = sb->s_blocksize / sbi->s_frag_size; - sbi->s_blocks_per_group =le32_to_cpu (es->s_blocks_per_group); - sbi->s_frags_per_group =le32_to_cpu (es->s_frags_per_group); sbi->s_inodes_per_group =le32_to_cpu (es->s_inodes_per_group);if (EXT2_INODE_SIZE (sb) ==0 )
@@ -1075,11 +1067,10 @@ static int ext2_fill_super(struct super_ goto failed_mount; } -if (sb->s_blocksize != sbi->s_frag_size) { +if (es->s_log_frag_size != es->s_log_block_size) {ext2_msg (sb,KERN_ERR , -"error: fragsize %lu != blocksize %lu" -"(not supported yet)" , - sbi->s_frag_size, sb->s_blocksize); +"error: fragsize log %u != blocksize log %u" , +le32_to_cpu (es->s_log_frag_size), sb->s_blocksize_bits); goto failed_mount; }
@@ -1089,12 +1080,6 @@ static int ext2_fill_super(struct super_ sbi->s_blocks_per_group); goto failed_mount; } -if (sbi->s_frags_per_group > sb->s_blocksize *8 ) { -ext2_msg (sb,KERN_ERR , -"error: #fragments per group too big: %lu" , - sbi->s_frags_per_group); - goto failed_mount; - }if (sbi->s_inodes_per_group < sbi->s_inodes_per_block || sbi->s_inodes_per_group > sb->s_blocksize *8 ) { ext2_msg(sb, KERN_ERR,
Greg Kroah-Hartman
maintainerPATCH 312/323 test_firmware: fix a memory leak with reqs buffer
In reply to Greg Kroah-HartmanFrom: Mirsad Goran Todorovac <[email protected]>
commit be37bed754ed90b2655382f93f9724b3c1aae847 upstream.
Dan Carpenter spotted that test_fw_config->reqs will be leaked if trigger_batched_requests_store() is called two or more times. The same appears with trigger_batched_requests_async_store().
This bug wasn't trigger by the tests, but observed by Dan's visual inspection of the code.
The recommended workaround was to return -EBUSY if test_fw_config->reqs is already allocated.
--- lib/test_firmware.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
lib/test_firmware.c +10 -0
@@ -618,6 +618,11 @@ static ssize_t trigger_batched_requests_mutex_lock (&test_fw_mutex); +if (test_fw_config->reqs) { + rc = -EBUSY ; + goto out_bail; + } + test_fw_config->reqs =vzalloc (array3_size (sizeof (struct test_batched_req ), test_fw_config->num_requests,2 ));
@@ -721,6 +726,11 @@ ssize_t trigger_batched_requests_async_smutex_lock (&test_fw_mutex); +if (test_fw_config->reqs) { + rc = -EBUSY ; + goto out_bail; + } + test_fw_config->reqs =vzalloc (array3_size (sizeof (struct test_batched_req ), test_fw_config->num_requests,2 ));
Greg Kroah-Hartman
maintainerPATCH 313/323 test_firmware: return ENOMEM instead of ENOSPC on failed memory allocation
In reply to Greg Kroah-HartmanFrom: Mirsad Goran Todorovac <[email protected]>
commit 7dae593cd226a0bca61201cf85ceb9335cf63682 upstream.
In a couple of situations like
name = kstrndup(buf, count, GFP_KERNEL); if (!name) return -ENOSPC;
the error is not actually "No space left on device", but "Out of memory".
It is semantically correct to return -ENOMEM in all failed kstrndup() and kzalloc() cases in this driver, as it is not a problem with disk space, but with kernel memory allocator failing allocation.
The semantically correct should be:
name = kstrndup(buf, count, GFP_KERNEL);
if (!name)
return -ENOMEM;Message-ID: <[email protected]>
--- lib/test_firmware.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
lib/test_firmware.c +4 -4
@@ -160,7 +160,7 @@ static int __kstrncpy(char **dst, const { *dst =kstrndup (name, count, gfp);if (!*dst) -return -ENOSPC ; +return -ENOMEM ;return count; }
@@ -456,7 +456,7 @@ static ssize_t trigger_request_store(str name =kstrndup (buf, count,GFP_KERNEL );if (!name) -return -ENOSPC ; +return -ENOMEM ;pr_info ("loading '%s'\n" , name);
@@ -497,7 +497,7 @@ static ssize_t trigger_async_request_sto name =kstrndup (buf, count,GFP_KERNEL );if (!name) -return -ENOSPC ; +return -ENOMEM ;pr_info ("loading '%s'\n" , name);
@@ -540,7 +540,7 @@ static ssize_t trigger_custom_fallback_s name =kstrndup (buf, count,GFP_KERNEL );if (!name) -return -ENOSPC ; +return -ENOMEM ;pr_info ("loading '%s' using custom fallback mechanism\n" , name);
Greg Kroah-Hartman
maintainerPATCH 314/323 mtd: rawnand: omap_elm: Fix incorrect type in assignment
In reply to Greg Kroah-HartmanFrom: Roger Quadros <[email protected]>
[ Upstream commit d8403b9eeee66d5dd81ecb9445800b108c267ce3 ]
Once the ECC word endianness is converted to BE32, we force cast it to u32 so we can use elm_write_reg() which in turn uses writel().
Fixes below sparse warnings:
drivers/mtd/nand/raw/omap_elm.c:180:37: sparse: expected unsigned int [usertype] val drivers/mtd/nand/raw/omap_elm.c:180:37: sparse: got restricted __be32 [usertype] drivers/mtd/nand/raw/omap_elm.c:185:37: sparse: expected unsigned int [usertype] val drivers/mtd/nand/raw/omap_elm.c:185:37: sparse: got restricted __be32 [usertype] drivers/mtd/nand/raw/omap_elm.c:190:37: sparse: expected unsigned int [usertype] val drivers/mtd/nand/raw/omap_elm.c:190:37: sparse: got restricted __be32 [usertype]
Quoted 1 line
Quoted 1 line
drivers/mtd/nand/raw/omap_elm.c:200:40: sparse: sparse: restricted__be32degrades to integer
drivers/mtd/nand/raw/omap_elm.c:206:39: sparse: sparse: restricted __be32 degrades to integer
drivers/mtd/nand/raw/omap_elm.c:210:37: sparse: expected unsigned int [assigned] [usertype] val drivers/mtd/nand/raw/omap_elm.c:210:37: sparse: got restricted __be32 [usertype] drivers/mtd/nand/raw/omap_elm.c:213:37: sparse: expected unsigned int [assigned] [usertype] val drivers/mtd/nand/raw/omap_elm.c:213:37: sparse: got restricted __be32 [usertype] drivers/mtd/nand/raw/omap_elm.c:216:37: sparse: expected unsigned int [assigned] [usertype] val drivers/mtd/nand/raw/omap_elm.c:216:37: sparse: got restricted __be32 [usertype] drivers/mtd/nand/raw/omap_elm.c:219:37: sparse: expected unsigned int [assigned] [usertype] val drivers/mtd/nand/raw/omap_elm.c:219:37: sparse: got restricted __be32 [usertype] drivers/mtd/nand/raw/omap_elm.c:222:37: sparse: expected unsigned int [assigned] [usertype] val drivers/mtd/nand/raw/omap_elm.c:222:37: sparse: got restricted __be32 [usertype] drivers/mtd/nand/raw/omap_elm.c:225:37: sparse: expected unsigned int [assigned] [usertype] val drivers/mtd/nand/raw/omap_elm.c:225:37: sparse: got restricted __be32 [usertype]
drivers/mtd/nand/raw/omap_elm.c:228:39: sparse: sparse: restricted __be32 degrades to integer
--- drivers/mtd/nand/raw/omap_elm.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/mtd/nand/raw/omap_elm.c +12 -12
@@ -184,17 +184,17 @@ static void elm_load_syndrome(struct elm_info *info,switch (info->bch_type) {case BCH8_ECC :/* syndrome fragment 0 = ecc[9-12B] */ - val =cpu_to_be32 (*(u32 *) &ecc[9 ]); + val = (__force u32 )cpu_to_be32 (*(u32 *)&ecc[9 ]);elm_write_reg (info, offset, val);/* syndrome fragment 1 = ecc[5-8B] */ offset +=4 ; - val =cpu_to_be32 (*(u32 *) &ecc[5 ]); + val = (__force u32 )cpu_to_be32 (*(u32 *)&ecc[5 ]);elm_write_reg (info, offset, val);/* syndrome fragment 2 = ecc[1-4B] */ offset +=4 ; - val =cpu_to_be32 (*(u32 *) &ecc[1 ]); + val = (__force u32 )cpu_to_be32 (*(u32 *)&ecc[1 ]);elm_write_reg (info, offset, val);/* syndrome fragment 3 = ecc[0B] */
@@ -204,35 +204,35 @@ static void elm_load_syndrome(struct elm_info *info,break ;case BCH4_ECC :/* syndrome fragment 0 = ecc[20-52b] bits */ - val = (cpu_to_be32 (*(u32 *) &ecc[3 ]) >>4 ) | + val = ((__force u32 )cpu_to_be32 (*(u32 *)&ecc[3 ]) >>4 ) | ((ecc[2 ] &0xf ) <<28 );elm_write_reg (info, offset, val);/* syndrome fragment 1 = ecc[0-20b] bits */ offset +=4 ; - val =cpu_to_be32 (*(u32 *) &ecc[0 ]) >>12 ; + val = (__force u32 )cpu_to_be32 (*(u32 *)&ecc[0 ]) >>12 ;elm_write_reg (info, offset, val);break ;case BCH16_ECC : - val =cpu_to_be32 (*(u32 *) &ecc[22 ]); + val = (__force u32 )cpu_to_be32 (*(u32 *)&ecc[22 ]);elm_write_reg (info, offset, val); offset +=4 ; - val =cpu_to_be32 (*(u32 *) &ecc[18 ]); + val = (__force u32 )cpu_to_be32 (*(u32 *)&ecc[18 ]);elm_write_reg (info, offset, val); offset +=4 ; - val =cpu_to_be32 (*(u32 *) &ecc[14 ]); + val = (__force u32 )cpu_to_be32 (*(u32 *)&ecc[14 ]);elm_write_reg (info, offset, val); offset +=4 ; - val =cpu_to_be32 (*(u32 *) &ecc[10 ]); + val = (__force u32 )cpu_to_be32 (*(u32 *)&ecc[10 ]);elm_write_reg (info, offset, val); offset +=4 ; - val =cpu_to_be32 (*(u32 *) &ecc[6 ]); + val = (__force u32 )cpu_to_be32 (*(u32 *)&ecc[6 ]);elm_write_reg (info, offset, val); offset +=4 ; - val =cpu_to_be32 (*(u32 *) &ecc[2 ]); + val = (__force u32 )cpu_to_be32 (*(u32 *)&ecc[2 ]);elm_write_reg (info, offset, val); offset +=4 ; - val =cpu_to_be32 (*(u32 *) &ecc[0 ]) >>16 ; + val = (__force u32 )cpu_to_be32 (*(u32 *)&ecc[0 ]) >>16 ;elm_write_reg (info, offset, val);break ;default :
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 315/323 powerpc/mm/altmap: Fix altmap boundary check
In reply to Greg Kroah-HartmanFrom: Aneesh Kumar K.V <[email protected]>
[ Upstream commit 6722b25712054c0f903b839b8f5088438dd04df3 ]
altmap->free includes the entire free space from which altmap blocks can be allocated. So when checking whether the kernel is doing altmap block free, compute the boundary correctly, otherwise memory hotunplug can fail.
--- arch/powerpc/mm/init_64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/powerpc/mm/init_64.c +1 -2
@@ -266,8 +266,7 @@ void __ref vmemmap_free(unsigned long start, unsigned long end, start =_ALIGN_DOWN (start, page_size);if (altmap) { alt_start = altmap->base_pfn; - alt_end = altmap->base_pfn + altmap->reserve + - altmap->free + altmap->alloc + altmap->align; + alt_end = altmap->base_pfn + altmap->reserve + altmap->free; }pr_debug ("vmemmap_free %lx...%lx\n" , start, end);
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 316/323 PM / wakeirq: support enabling wake-up irq after runtime_suspend called
In reply to Greg Kroah-HartmanFrom: Chunfeng Yun <[email protected]>
[ Upstream commit 259714100d98b50bf04d36a21bf50ca8b829fc11 ]
When the dedicated wake IRQ is level trigger, and it uses the device's low-power status as the wakeup source, that means if the device is not in low-power state, the wake IRQ will be triggered if enabled; For this case, need enable the wake IRQ after running the device's ->runtime_suspend() which make it enter low-power state.
e.g.
Assume the wake IRQ is a low level trigger type, and the wakeup signal comes from the low-power status of the device.
The wakeup signal is low level at running time (0), and becomes high level when the device enters low-power state (runtime_suspend
(1) is called), a wakeup event at (2) make the device exit low-power state, then the wakeup signal also becomes low level.
------------------
| ^ ^|
---------------- | | --------------
|<---(0)--->|<--(1)--| (3) (2) (4)
if enable the wake IRQ before running runtime_suspend during (0), a wake IRQ will arise, it causes resume immediately;
it works if enable wake IRQ ( e.g. at (3) or (4)) after running ->runtime_suspend().
This patch introduces a new status WAKE_IRQ_DEDICATED_REVERSE to optionally support enabling wake IRQ after running ->runtime_suspend().
Stable-dep-of: 8527beb12087 ("PM: sleep: wakeirq: fix wake irq arming")
--- drivers/base/power/power.h | 7 ++- drivers/base/power/runtime.c | 6 ++- drivers/base/power/wakeirq.c | 101 +++++++++++++++++++++++++++-------- include/linux/pm_wakeirq.h | 9 +++- 4 files changed, 96 insertions(+), 27 deletions(-)
drivers/base/power/power.h +5 -2
@@ -24,8 +24,10 @@ extern void pm_runtime_remove(struct device *dev);#define WAKE_IRQ_DEDICATED_ALLOCATED BIT(0)#define WAKE_IRQ_DEDICATED_MANAGED BIT(1) +#define WAKE_IRQ_DEDICATED_REVERSE BIT(2)#define WAKE_IRQ_DEDICATED_MASK (WAKE_IRQ_DEDICATED_ALLOCATED | \ - WAKE_IRQ_DEDICATED_MANAGED) + WAKE_IRQ_DEDICATED_MANAGED | \ + WAKE_IRQ_DEDICATED_REVERSE)struct wake_irq {struct device *dev;
@@ -38,7 +40,8 @@ extern void dev_pm_arm_wake_irq(struct wake_irq *wirq);extern void dev_pm_disarm_wake_irq (struct wake_irq *wirq);extern void dev_pm_enable_wake_irq_check (struct device *dev,bool can_change_status); -extern void dev_pm_disable_wake_irq_check (struct device *dev); +extern void dev_pm_disable_wake_irq_check (struct device *dev,bool cond_disable); +extern void dev_pm_enable_wake_irq_complete (struct device *dev);#ifdef CONFIG_PM_SLEEP
drivers/base/power/runtime.c +4 -2
@@ -606,6 +606,8 @@ static int rpm_suspend(struct device *dev, int rpmflags)if (retval) goto fail; +dev_pm_enable_wake_irq_complete (dev); + no_callback:__update_runtime_status (dev,RPM_SUSPENDED );pm_runtime_deactivate_timer (dev);
@@ -640,7 +642,7 @@ static int rpm_suspend(struct device *dev, int rpmflags)return retval; fail: -dev_pm_disable_wake_irq_check (dev); +dev_pm_disable_wake_irq_check (dev, true);__update_runtime_status (dev,RPM_ACTIVE ); dev->power.deferred_resume = false;wake_up_all (&dev->power.wait_queue);
@@ -823,7 +825,7 @@ static int rpm_resume(struct device *dev, int rpmflags) callback =RPM_GET_CALLBACK (dev, runtime_resume); -dev_pm_disable_wake_irq_check (dev); +dev_pm_disable_wake_irq_check (dev, false); retval =rpm_callback (callback, dev);if (retval) {__update_runtime_status (dev,RPM_SUSPENDED );
drivers/base/power/wakeirq.c +80 -21
146 lines not on this page · raw message
include/linux/pm_wakeirq.h +7 -2
@@ -17,8 +17,8 @@#ifdef CONFIG_PM extern int dev_pm_set_wake_irq (struct device *dev,int irq); -extern int dev_pm_set_dedicated_wake_irq (struct device *dev, -int irq); +extern int dev_pm_set_dedicated_wake_irq (struct device *dev,int irq); +extern int dev_pm_set_dedicated_wake_irq_reverse (struct device *dev,int irq);extern void dev_pm_clear_wake_irq (struct device *dev);extern void dev_pm_enable_wake_irq (struct device *dev);extern void dev_pm_disable_wake_irq (struct device *dev);
@@ -35,6 +35,11 @@ static inline int dev_pm_set_dedicated_wake_irq(struct device *dev, int irq)return 0 ; } +static inline int dev_pm_set_dedicated_wake_irq_reverse (struct device *dev,int irq) +{ +return 0 ; +} +static inline void dev_pm_clear_wake_irq (struct device *dev) { }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 317/323 PM: sleep: wakeirq: fix wake irq arming
In reply to Greg Kroah-HartmanFrom: Johan Hovold <[email protected]>
[ Upstream commit 8527beb12087238d4387607597b4020bc393c4b4 ]
The decision whether to enable a wake irq during suspend can not be done based on the runtime PM state directly as a driver may use wake irqs without implementing runtime PM. Such drivers specifically leave the state set to the default 'suspended' and the wake irq is thus never enabled at suspend.
Add a new wake irq flag to track whether a dedicated wake irq has been enabled at runtime suspend and therefore must not be enabled at system suspend.
Note that pm_runtime_enabled() can not be used as runtime PM is always disabled during late suspend.
--- drivers/base/power/power.h | 1 + drivers/base/power/wakeirq.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-)
drivers/base/power/power.h +1 -0
@@ -28,6 +28,7 @@ extern void pm_runtime_remove(struct device *dev);#define WAKE_IRQ_DEDICATED_MASK (WAKE_IRQ_DEDICATED_ALLOCATED | \ WAKE_IRQ_DEDICATED_MANAGED | \ WAKE_IRQ_DEDICATED_REVERSE) +#define WAKE_IRQ_DEDICATED_ENABLED BIT(3)struct wake_irq {struct device *dev;
drivers/base/power/wakeirq.c +8 -4
@@ -328,8 +328,10 @@ void dev_pm_enable_wake_irq_check(struct device *dev,return ; enable: -if (!can_change_status || !(wirq->status &WAKE_IRQ_DEDICATED_REVERSE )) +if (!can_change_status || !(wirq->status &WAKE_IRQ_DEDICATED_REVERSE )) {enable_irq (wirq->irq); + wirq->status |=WAKE_IRQ_DEDICATED_ENABLED ; + } }/**
@@ -350,8 +352,10 @@ void dev_pm_disable_wake_irq_check(struct device *dev, bool cond_disable)if (cond_disable && (wirq->status &WAKE_IRQ_DEDICATED_REVERSE ))return ; -if (wirq->status &WAKE_IRQ_DEDICATED_MANAGED ) +if (wirq->status &WAKE_IRQ_DEDICATED_MANAGED ) { + wirq->status &= ~WAKE_IRQ_DEDICATED_ENABLED ;disable_irq_nosync (wirq->irq); + } }/**
@@ -390,7 +394,7 @@ void dev_pm_arm_wake_irq(struct wake_irq *wirq)if (device_may_wakeup (wirq->dev)) {if (wirq->status &WAKE_IRQ_DEDICATED_ALLOCATED && - !pm_runtime_status_suspended (wirq->dev)) + !(wirq->status &WAKE_IRQ_DEDICATED_ENABLED ))enable_irq (wirq->irq);enable_irq_wake (wirq->irq);
@@ -413,7 +417,7 @@ void dev_pm_disarm_wake_irq(struct wake_irq *wirq)disable_irq_wake (wirq->irq);if (wirq->status &WAKE_IRQ_DEDICATED_ALLOCATED && - !pm_runtime_status_suspended (wirq->dev)) + !(wirq->status &WAKE_IRQ_DEDICATED_ENABLED ))disable_irq_nosync (wirq->irq); } }
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 318/323 ARM: dts: imx6sll: Make ssi node name same as other platforms
In reply to Greg Kroah-HartmanFrom: Shengjiu Wang <[email protected]>
[ Upstream commit 5da1b522cf7dc51f7fde2cca8d90406b0291c503 ]
In imx6sll.dtsi, the ssi node name is different with other platforms (imx6qdl, imx6sl, imx6sx), but the sound/soc/fsl/fsl-asoc-card.c machine driver needs to check ssi node name for audmux configuration, then different ssi node name causes issue on imx6sll platform.
So we change ssi node name to make all platforms have same name.
Stable-dep-of: ee70b908f77a ("ARM: dts: nxp/imx6sll: fix wrong property name in usbphy node")
--- arch/arm/boot/dts/imx6sll.dtsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/arm/boot/dts/imx6sll.dtsi +3 -3
@@ -271,7 +271,7 @@ uart2: serial@2024000 { status = "disabled"; }; - ssi1: ssi-controller@2028000 { + ssi1: ssi@2028000 { compatible = "fsl,imx6sl-ssi", "fsl,imx51-ssi"; reg = <0x02028000 0x4000>; interrupts = <GIC_SPI 46 IRQ_TYPE_LEVEL_HIGH>;
@@ -284,7 +284,7 @@ ssi1: ssi-controller@2028000 { status = "disabled"; }; - ssi2: ssi-controller@202c000 { + ssi2: ssi@202c000 { compatible = "fsl,imx6sl-ssi", "fsl,imx51-ssi"; reg = <0x0202c000 0x4000>; interrupts = <GIC_SPI 47 IRQ_TYPE_LEVEL_HIGH>;
@@ -297,7 +297,7 @@ ssi2: ssi-controller@202c000 { status = "disabled"; }; - ssi3: ssi-controller@2030000 { + ssi3: ssi@2030000 { compatible = "fsl,imx6sl-ssi", "fsl,imx51-ssi"; reg = <0x02030000 0x4000>; interrupts = <GIC_SPI 48 IRQ_TYPE_LEVEL_HIGH>;
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 319/323 ARM: dts: imx: add usb alias
In reply to Greg Kroah-HartmanFrom: Peng Fan <[email protected]>
[ Upstream commit 5c8b3b8a182cbc1ccdfcdeea9b25dd2c12a8148f ]
Add usb alias for bootloader searching the controller in correct order.
Stable-dep-of: ee70b908f77a ("ARM: dts: nxp/imx6sll: fix wrong property name in usbphy node")
--- arch/arm/boot/dts/imx6qdl.dtsi | 4 ++++ arch/arm/boot/dts/imx6sl.dtsi | 3 +++ arch/arm/boot/dts/imx6sll.dtsi | 2 ++ arch/arm/boot/dts/imx6sx.dtsi | 3 +++ arch/arm/boot/dts/imx6ul.dtsi | 2 ++ arch/arm/boot/dts/imx7d.dtsi | 6 ++++++ arch/arm/boot/dts/imx7s.dtsi | 2 ++ 7 files changed, 22 insertions(+)
arch/arm/boot/dts/imx6qdl.dtsi +4 -0
@@ -46,6 +46,10 @@ aliases { spi1 = &ecspi2; spi2 = &ecspi3; spi3 = &ecspi4; + usb0 = &usbotg; + usb1 = &usbh1; + usb2 = &usbh2; + usb3 = &usbh3; usbphy0 = &usbphy1; usbphy1 = &usbphy2; };
arch/arm/boot/dts/imx6sl.dtsi +3 -0
@@ -32,6 +32,9 @@ aliases { spi1 = &ecspi2; spi2 = &ecspi3; spi3 = &ecspi4; + usb0 = &usbotg1; + usb1 = &usbotg2; + usb2 = &usbh; usbphy0 = &usbphy1; usbphy1 = &usbphy2; };
arch/arm/boot/dts/imx6sll.dtsi +2 -0
@@ -36,6 +36,8 @@ aliases { spi1 = &ecspi2; spi3 = &ecspi3; spi4 = &ecspi4; + usb0 = &usbotg1; + usb1 = &usbotg2; usbphy0 = &usbphy1; usbphy1 = &usbphy2; };
arch/arm/boot/dts/imx6sx.dtsi +3 -0
@@ -49,6 +49,9 @@ aliases { spi2 = &ecspi3; spi3 = &ecspi4; spi4 = &ecspi5; + usb0 = &usbotg1; + usb1 = &usbotg2; + usb2 = &usbh; usbphy0 = &usbphy1; usbphy1 = &usbphy2; };
arch/arm/boot/dts/imx6ul.dtsi +2 -0
@@ -47,6 +47,8 @@ aliases { spi1 = &ecspi2; spi2 = &ecspi3; spi3 = &ecspi4; + usb0 = &usbotg1; + usb1 = &usbotg2; usbphy0 = &usbphy1; usbphy1 = &usbphy2; };
arch/arm/boot/dts/imx7d.dtsi +6 -0
@@ -7,6 +7,12 @@ #include <dt-bindings/reset/imx7-reset.h> / { + aliases { + usb0 = &usbotg1; + usb1 = &usbotg2; + usb2 = &usbh; + }; + cpus { cpu0: cpu@0 { clock-frequency = <996000000>;
arch/arm/boot/dts/imx7s.dtsi +2 -0
@@ -46,6 +46,8 @@ aliases { spi1 = &ecspi2; spi2 = &ecspi3; spi3 = &ecspi4; + usb0 = &usbotg1; + usb1 = &usbh; }; cpus {
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 320/323 ARM: dts: imx6sll: fixup of operating points
In reply to Greg Kroah-HartmanFrom: Andreas Kemnade <[email protected]>
[ Upstream commit 1875903019ea6e32e6e544c1631b119e4fd60b20 ]
Make operating point definitions comply with binding specifications.
Stable-dep-of: ee70b908f77a ("ARM: dts: nxp/imx6sll: fix wrong property name in usbphy node")
--- arch/arm/boot/dts/imx6sll.dtsi | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-)
arch/arm/boot/dts/imx6sll.dtsi +10 -12
@@ -51,20 +51,18 @@ cpu0: cpu@0 { device_type = "cpu"; reg = <0>; next-level-cache = <&L2>; - operating-points = < + operating-points = /* kHz uV */ - 996000 1275000 - 792000 1175000 - 396000 1075000 - 198000 975000 - >; - fsl,soc-operating-points = < + <996000 1275000>, + <792000 1175000>, + <396000 1075000>, + <198000 975000>; + fsl,soc-operating-points = /* ARM kHz SOC-PU uV */ - 996000 1175000 - 792000 1175000 - 396000 1175000 - 198000 1175000 - >; + <996000 1175000>, + <792000 1175000>, + <396000 1175000>, + <198000 1175000>; clock-latency = <61036>; /* two CLK32 periods */ clocks = <&clks IMX6SLL_CLK_ARM>, <&clks IMX6SLL_CLK_PLL2_PFD2>,
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 321/323 ARM: dts: nxp/imx6sll: fix wrong property name in usbphy node
In reply to Greg Kroah-HartmanFrom: Xu Yang <[email protected]>
[ Upstream commit ee70b908f77a9d8f689dea986f09e6d7dc481934 ]
Property name "phy-3p0-supply" is used instead of "phy-reg_3p0-supply".
--- arch/arm/boot/dts/imx6sll.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/imx6sll.dtsi +1 -1
@@ -518,7 +518,7 @@ usbphy2: usb-phy@20ca000 { reg = <0x020ca000 0x1000>; interrupts = <GIC_SPI 41 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clks IMX6SLL_CLK_USBPHY2>; - phy-reg_3p0-supply = <®_3p0>; + phy-3p0-supply = <®_3p0>; fsl,anatop = <&anatop>; };
Signature · 1 line
2.40.1
Greg Kroah-Hartman
maintainerPATCH 322/323 drivers core: Use sysfs_emit and sysfs_emit_at for show(device *...) functions
In reply to Greg Kroah-HartmanFrom: Joe Perches <[email protected]>
commit aa838896d87af561a33ecefea1caa4c15a68bc47 upstream.
Convert the various sprintf fmaily calls in sysfs device show functions to sysfs_emit and sysfs_emit_at for PAGE_SIZE buffer safety.
Done with:
$ spatch -sp-file sysfs_emit_dev.cocci --in-place --max-width=80 .
And cocci script:
$ cat sysfs_emit_dev.cocci @@ identifier d_show; identifier dev, attr, buf; @@
ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
{
<...
return
- sprintf(buf,
+ sysfs_emit(buf,
...);
...>
}@@
identifier d_show;
identifier dev, attr, buf;
@@
ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
{
<...
return
- snprintf(buf, PAGE_SIZE,
+ sysfs_emit(buf,
...);
...>
}@@
identifier d_show;
identifier dev, attr, buf;
@@
ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
{
<...
return
- scnprintf(buf, PAGE_SIZE,
+ sysfs_emit(buf,
...);
...>
}@@
identifier d_show;
identifier dev, attr, buf;
expression chr;
@@
ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
{
<...
return
- strcpy(buf, chr);
+ sysfs_emit(buf, chr);
...>
}@@
identifier d_show;
identifier dev, attr, buf;
identifier len;
@@
ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
{
<...
len =
- sprintf(buf,
+ sysfs_emit(buf,
...);
...>
return len;
}@@
identifier d_show;
identifier dev, attr, buf;
identifier len;
@@
ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
{
<...
len =
- snprintf(buf, PAGE_SIZE,
+ sysfs_emit(buf,
...);
...>
return len;
}@@
identifier d_show;
identifier dev, attr, buf;
identifier len;
@@
ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
{
<...
len =
- scnprintf(buf, PAGE_SIZE,
+ sysfs_emit(buf,
...);
...>
return len;
}@@
identifier d_show;
identifier dev, attr, buf;
identifier len;
@@
ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
{
<...
- len += scnprintf(buf + len, PAGE_SIZE - len,
+ len += sysfs_emit_at(buf, len,
...);
...>
return len;
}@@
identifier d_show;
identifier dev, attr, buf;
expression chr;
@@
ssize_t d_show(struct device *dev, struct device_attribute *attr, char *buf)
{
...- strcpy(buf, chr);
- return strlen(buf);
+ return sysfs_emit(buf, chr);
}
--- drivers/base/arch_topology.c | 2 - drivers/base/cacheinfo.c | 18 +++++------ drivers/base/core.c | 8 ++--- drivers/base/cpu.c | 34 ++++++++++----------- drivers/base/firmware_loader/fallback.c | 2 - drivers/base/memory.c | 24 +++++++-------- drivers/base/node.c | 34 ++++++++++----------- drivers/base/platform.c | 2 - drivers/base/power/sysfs.c | 50 ++++++++++++++++---------------- drivers/base/soc.c | 8 ++--- 10 files changed, 91 insertions(+), 91 deletions(-)
drivers/base/arch_topology.c +1 -1
@@ -44,7 +44,7 @@ static ssize_t cpu_capacity_show(struct { struct cpu *cpu = container_of(dev, struct cpu, dev); -return sprintf (buf,"%lu\n" ,topology_get_cpu_scale (NULL , cpu->dev.id)); +return sysfs_emit (buf,"%lu\n" ,topology_get_cpu_scale (NULL , cpu->dev.id)); } static ssize_t cpu_capacity_store(struct device *dev,
drivers/base/cacheinfo.c +9 -9
@@ -372,7 +372,7 @@ static ssize_t size_show(struct device * {struct cacheinfo *this_leaf =dev_get_drvdata (dev); -return sprintf (buf,"%uK\n" , this_leaf->size >>10 ); +return sysfs_emit (buf,"%uK\n" , this_leaf->size >>10 ); }static ssize_t shared_cpumap_show_func (struct device *dev,bool list,char *buf)
@@ -402,11 +402,11 @@ static ssize_t type_show(struct device *switch (this_leaf->type) {case CACHE_TYPE_DATA : -return sprintf (buf,"Data\n" ); +return sysfs_emit (buf,"Data\n" );case CACHE_TYPE_INST : -return sprintf (buf,"Instruction\n" ); +return sysfs_emit (buf,"Instruction\n" );case CACHE_TYPE_UNIFIED : -return sprintf (buf,"Unified\n" ); +return sysfs_emit (buf,"Unified\n" );default :return -EINVAL ; }
@@ -420,11 +420,11 @@ static ssize_t allocation_policy_show(stint n =0 ;if ((ci_attr &CACHE_READ_ALLOCATE ) && (ci_attr &CACHE_WRITE_ALLOCATE )) - n =sprintf (buf,"ReadWriteAllocate\n" ); + n =sysfs_emit (buf,"ReadWriteAllocate\n" );else if (ci_attr &CACHE_READ_ALLOCATE ) - n =sprintf (buf,"ReadAllocate\n" ); + n =sysfs_emit (buf,"ReadAllocate\n" );else if (ci_attr &CACHE_WRITE_ALLOCATE ) - n =sprintf (buf,"WriteAllocate\n" ); + n =sysfs_emit (buf,"WriteAllocate\n" );return n; }
@@ -436,9 +436,9 @@ static ssize_t write_policy_show(structint n =0 ;if (ci_attr &CACHE_WRITE_THROUGH ) - n =sprintf (buf,"WriteThrough\n" ); + n =sysfs_emit (buf,"WriteThrough\n" );else if (ci_attr &CACHE_WRITE_BACK ) - n =sprintf (buf,"WriteBack\n" ); + n =sysfs_emit (buf,"WriteBack\n" );return n; }
drivers/base/core.c +4 -4
@@ -994,7 +994,7 @@ ssize_t device_show_ulong(struct device char *buf) {struct dev_ext_attribute *ea =to_ext_attr (attr); -return snprintf (buf,PAGE_SIZE ,"%lx\n" , *(unsigned long *)(ea->var)); +return sysfs_emit (buf,"%lx\n" , *(unsigned long *)(ea->var)); }EXPORT_SYMBOL_GPL (device_show_ulong);
@@ -1019,7 +1019,7 @@ ssize_t device_show_int(struct device *d {struct dev_ext_attribute *ea =to_ext_attr (attr); -return snprintf (buf,PAGE_SIZE ,"%d\n" , *(int *)(ea->var)); +return sysfs_emit (buf,"%d\n" , *(int *)(ea->var)); }EXPORT_SYMBOL_GPL (device_show_int);
@@ -1040,7 +1040,7 @@ ssize_t device_show_bool(struct device * {struct dev_ext_attribute *ea =to_ext_attr (attr); -return snprintf (buf,PAGE_SIZE ,"%d\n" , *(bool *)(ea->var)); +return sysfs_emit (buf,"%d\n" , *(bool *)(ea->var)); }EXPORT_SYMBOL_GPL (device_show_bool);
@@ -1273,7 +1273,7 @@ static ssize_t online_show(struct devicedevice_lock (dev); val = !dev->offline;device_unlock (dev); -return sprintf (buf,"%u\n" , val); +return sysfs_emit (buf,"%u\n" , val); } static ssize_t online_store(struct device *dev, struct device_attribute *attr,
drivers/base/cpu.c +17 -17
@@ -156,7 +156,7 @@ static ssize_t show_crash_notes(struct d* operation should be safe. No locking required. */ addr =per_cpu_ptr_to_phys (per_cpu_ptr (crash_notes, cpunum)); - rc =sprintf (buf,"%Lx\n" , addr); + rc =sysfs_emit (buf,"%Lx\n" , addr);return rc; } static DEVICE_ATTR(crash_notes, 0400, show_crash_notes, NULL);
@@ -167,7 +167,7 @@ static ssize_t show_crash_notes_size(str {ssize_t rc; - rc =sprintf (buf,"%zu\n" ,sizeof (note_buf_t)); + rc =sysfs_emit (buf,"%zu\n" ,sizeof (note_buf_t));return rc; } static DEVICE_ATTR(crash_notes_size, 0400, show_crash_notes_size, NULL);
@@ -264,7 +264,7 @@ static ssize_t print_cpus_offline(struct nr_cpu_ids, total_cpus-1); } - n +=snprintf (&buf[n], len - n,"\n" ); + n +=sysfs_emit (&buf[n],"\n" );return n; } static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL);
@@ -272,7 +272,7 @@ static DEVICE_ATTR(offline, 0444, print_static ssize_t print_cpus_isolated (struct device *dev,struct device_attribute *attr,char *buf) { -int n =0 , len =PAGE_SIZE -2 ; +int n =0 ;cpumask_var_t isolated;if (!alloc_cpumask_var (&isolated,GFP_KERNEL ))
@@ -280,7 +280,7 @@ static ssize_t print_cpus_isolated(struccpumask_andnot (isolated, cpu_possible_mask,housekeeping_cpumask (HK_FLAG_DOMAIN )); - n =scnprintf (buf, len,"%*pbl\n" ,cpumask_pr_args (isolated)); + n =sysfs_emit (buf,"%*pbl\n" ,cpumask_pr_args (isolated));free_cpumask_var (isolated);
@@ -292,9 +292,9 @@ static DEVICE_ATTR(isolated, 0444, printstatic ssize_t print_cpus_nohz_full (struct device *dev,struct device_attribute *attr,char *buf) { -int n =0 , len =PAGE_SIZE -2 ; +int n =0 ; - n =scnprintf (buf, len,"%*pbl\n" ,cpumask_pr_args (tick_nohz_full_mask)); + n =sysfs_emit (buf,"%*pbl\n" ,cpumask_pr_args (tick_nohz_full_mask));return n; }
@@ -328,7 +328,7 @@ static ssize_t print_cpu_modalias(structssize_t n;u32 i; - n =sprintf (buf,"cpu:type:" CPU_FEATURE_TYPEFMT ":feature:" , + n =sysfs_emit (buf,"cpu:type:" CPU_FEATURE_TYPEFMT ":feature:" ,CPU_FEATURE_TYPEVAL );for (i =0 ; i <MAX_CPU_FEATURES ; i++)
@@ -520,56 +520,56 @@ static void __init cpu_dev_register_genessize_t __weak cpu_show_meltdown (struct device *dev,struct device_attribute *attr,char *buf) { -return sprintf (buf,"Not affected\n" ); +return sysfs_emit (buf,"Not affected\n" ); }ssize_t __weak cpu_show_spectre_v1 (struct device *dev,struct device_attribute *attr,char *buf) { -return sprintf (buf,"Not affected\n" ); +return sysfs_emit (buf,"Not affected\n" ); }ssize_t __weak cpu_show_spectre_v2 (struct device *dev,struct device_attribute *attr,char *buf) { -return sprintf (buf,"Not affected\n" ); +return sysfs_emit (buf,"Not affected\n" ); }ssize_t __weak cpu_show_spec_store_bypass (struct device *dev,struct device_attribute *attr,char *buf) { -return sprintf (buf,"Not affected\n" ); +return sysfs_emit (buf,"Not affected\n" ); }ssize_t __weak cpu_show_l1tf (struct device *dev,struct device_attribute *attr,char *buf) { -return sprintf (buf,"Not affected\n" ); +return sysfs_emit (buf,"Not affected\n" ); }ssize_t __weak cpu_show_mds (struct device *dev,struct device_attribute *attr,char *buf) { -return sprintf (buf,"Not affected\n" ); +return sysfs_emit (buf,"Not affected\n" ); }ssize_t __weak cpu_show_tsx_async_abort (struct device *dev,struct device_attribute *attr,char *buf) { -return sprintf (buf,"Not affected\n" ); +return sysfs_emit (buf,"Not affected\n" ); }ssize_t __weak cpu_show_itlb_multihit (struct device *dev,struct device_attribute *attr,char *buf) { -return sprintf (buf,"Not affected\n" ); +return sysfs_emit (buf,"Not affected\n" ); }ssize_t __weak cpu_show_srbds (struct device *dev,struct device_attribute *attr,char *buf) { -return sprintf (buf,"Not affected\n" ); +return sysfs_emit (buf,"Not affected\n" ); } ssize_t __weak cpu_show_mmio_stale_data(struct device *dev,
drivers/base/firmware_loader/fallback.c +1 -1
@@ -215,7 +215,7 @@ static ssize_t firmware_loading_show(str loading =fw_sysfs_loading (fw_sysfs->fw_priv);mutex_unlock (&fw_lock); -return sprintf (buf,"%d\n" , loading); +return sysfs_emit (buf,"%d\n" , loading); }/* one pages buffer should be mapped/unmapped only once */
drivers/base/memory.c +12 -12
@@ -121,7 +121,7 @@ static ssize_t show_mem_start_phys_indexunsigned long phys_index; phys_index = mem->start_section_nr / sections_per_block; -return sprintf (buf,"%08lx\n" , phys_index); +return sysfs_emit (buf,"%08lx\n" , phys_index); }/*
@@ -145,7 +145,7 @@ static ssize_t show_mem_removable(struct } out: -return sprintf (buf,"%d\n" , ret); +return sysfs_emit (buf,"%d\n" , ret); }/*
@@ -163,17 +163,17 @@ static ssize_t show_mem_state(struct dev*/ switch (mem->state) {case MEM_ONLINE : - len =sprintf (buf,"online\n" ); + len =sysfs_emit (buf,"online\n" );break ;case MEM_OFFLINE : - len =sprintf (buf,"offline\n" ); + len =sysfs_emit (buf,"offline\n" );break ;case MEM_GOING_OFFLINE : - len =sprintf (buf,"going-offline\n" ); + len =sysfs_emit (buf,"going-offline\n" );break ;default : - len =sprintf (buf,"ERROR-UNKNOWN-%ld\n" , - mem->state); + len =sysfs_emit (buf,"ERROR-UNKNOWN-%ld\n" , + mem->state);WARN_ON (1 );break ; }
@@ -384,7 +384,7 @@ static ssize_t show_phys_device(struct d struct device_attribute *attr, char *buf) { struct memory_block *mem = to_memory_block(dev); -return sprintf (buf,"%d\n" , mem->phys_device); +return sysfs_emit (buf,"%d\n" , mem->phys_device); }#ifdef CONFIG_MEMORY_HOTREMOVE
@@ -422,7 +422,7 @@ static ssize_t show_valid_zones(struct d*/ if (!test_pages_in_a_zone (start_pfn, start_pfn + nr_pages, &valid_start_pfn, &valid_end_pfn)) -return sprintf (buf,"none\n" ); +return sysfs_emit (buf,"none\n" ); start_pfn = valid_start_pfn;strcat (buf,page_zone (pfn_to_page (start_pfn))->name); goto out;
@@ -456,7 +456,7 @@ static ssize_t print_block_size(struct device *dev, struct device_attribute *attr, char *buf) { - return sprintf(buf, "%lx\n", get_memory_block_size()); + return sysfs_emit(buf, "%lx\n", get_memory_block_size()); } static DEVICE_ATTR(block_size_bytes, 0444, print_block_size, NULL);
@@ -470,9 +470,9 @@ show_auto_online_blocks(struct device *d char *buf) {if (memhp_auto_online) -return sprintf (buf,"online\n" ); +return sysfs_emit (buf,"online\n" );else -return sprintf (buf,"offline\n" ); +return sysfs_emit (buf,"offline\n" ); } static ssize_t
drivers/base/node.c +17 -17
@@ -69,7 +69,7 @@ static ssize_t node_read_meminfo(structstruct sysinfo i;si_meminfo_node (&i, nid); - n =sprintf (buf, + n =sysfs_emit (buf,"Node %d MemTotal: %8lu kB\n" "Node %d MemFree: %8lu kB\n" "Node %d MemUsed: %8lu kB\n"
@@ -96,7 +96,7 @@ static ssize_t node_read_meminfo(struct nid, K(sum_zone_node_page_state(nid, NR_MLOCK)));#ifdef CONFIG_HIGHMEM - n +=sprintf (buf + n, + n +=sysfs_emit (buf + n,"Node %d HighTotal: %8lu kB\n" "Node %d HighFree: %8lu kB\n" "Node %d LowTotal: %8lu kB\n"
@@ -106,7 +106,7 @@ static ssize_t node_read_meminfo(struct nid,K (i.totalram - i.totalhigh), nid, K(i.freeram - i.freehigh));#endif - n +=sprintf (buf + n, + n +=sysfs_emit (buf + n,"Node %d Dirty: %8lu kB\n" "Node %d Writeback: %8lu kB\n" "Node %d FilePages: %8lu kB\n"
@@ -162,19 +162,19 @@ static DEVICE_ATTR(meminfo, S_IRUGO, nodstatic ssize_t node_read_numastat (struct device *dev,struct device_attribute *attr,char *buf) { -return sprintf (buf, -"numa_hit %lu\n" -"numa_miss %lu\n" -"numa_foreign %lu\n" -"interleave_hit %lu\n" -"local_node %lu\n" -"other_node %lu\n" , -sum_zone_numa_state (dev->id,NUMA_HIT ), -sum_zone_numa_state (dev->id,NUMA_MISS ), -sum_zone_numa_state (dev->id,NUMA_FOREIGN ), -sum_zone_numa_state (dev->id,NUMA_INTERLEAVE_HIT ), -sum_zone_numa_state (dev->id,NUMA_LOCAL ), -sum_zone_numa_state (dev->id,NUMA_OTHER )); +return sysfs_emit (buf, +"numa_hit %lu\n" +"numa_miss %lu\n" +"numa_foreign %lu\n" +"interleave_hit %lu\n" +"local_node %lu\n" +"other_node %lu\n" , +sum_zone_numa_state (dev->id,NUMA_HIT ), +sum_zone_numa_state (dev->id,NUMA_MISS ), +sum_zone_numa_state (dev->id,NUMA_FOREIGN ), +sum_zone_numa_state (dev->id,NUMA_INTERLEAVE_HIT ), +sum_zone_numa_state (dev->id,NUMA_LOCAL ), +sum_zone_numa_state (dev->id,NUMA_OTHER )); } static DEVICE_ATTR(numastat, S_IRUGO, node_read_numastat, NULL);
@@ -612,7 +612,7 @@ static ssize_t print_nodes_state(enum no {int n; - n =scnprintf (buf,PAGE_SIZE -1 ,"%*pbl" , + n =sysfs_emit (buf,"%*pbl" ,nodemask_pr_args (&node_states[state])); buf[n++] ='\n' ; buf[n] ='\0' ;
drivers/base/platform.c +1 -1
@@ -927,7 +927,7 @@ static ssize_t driver_override_show(strussize_t len;device_lock (dev); - len =sprintf (buf,"%s\n" , pdev->driver_override); + len =sysfs_emit (buf,"%s\n" , pdev->driver_override);device_unlock (dev);return len; }
drivers/base/power/sysfs.c +25 -25
135 lines not on this page · raw message
drivers/base/soc.c +4 -4
@@ -72,13 +72,13 @@ static ssize_t soc_info_get(struct devic struct soc_device *soc_dev = container_of(dev, struct soc_device, dev);if (attr == &dev_attr_machine) -return sprintf (buf,"%s\n" , soc_dev->attr->machine); +return sysfs_emit (buf,"%s\n" , soc_dev->attr->machine);if (attr == &dev_attr_family) -return sprintf (buf,"%s\n" , soc_dev->attr->family); +return sysfs_emit (buf,"%s\n" , soc_dev->attr->family);if (attr == &dev_attr_revision) -return sprintf (buf,"%s\n" , soc_dev->attr->revision); +return sysfs_emit (buf,"%s\n" , soc_dev->attr->revision);if (attr == &dev_attr_soc_id) -return sprintf (buf,"%s\n" , soc_dev->attr->soc_id); +return sysfs_emit (buf,"%s\n" , soc_dev->attr->soc_id);return -EINVAL ;
Re: [PATCH 4.19 322/323] drivers core: Use sysfs_emit and sysfs_emit_at for show(device *...) functions
Quoted 6 lines · Greg Kroah-Hartman
From: Joe Perches <[email protected]>
commit
aa838896d87af561a33ecefea1caa4c15a68bc47upstream.Convert the various sprintf fmaily calls in sysfs device show functions to
sysfs_emitandsysfs_emit_atforPAGE_SIZEbuffer safety.
[...]
Quoted 3 lines
Signed-off-by Joe Perches <[email protected]>Link https://lore.kernel.org/r/3d033c33056d88bbe34d4ddb62afd05ee166ab9a.1600285923.git.joe@perches.com open here[ Brennan : Regenerated for 4.19 to fix CVE-2022-20166 ]
When I looked into the referenced security issue, it seemed to only be exploitable through wakelock names, and in the upstream kernel only after commit c8377adfa781 "PM / wakeup: Show wakeup sources stats in sysfs" (first included in 5.4). So I would be interested to know if and why a fix was needed for 4.19.
More importantly, this backported version uniformly converts to sysfs_emit(), but there are 3 places sysfs_emit_at() must be used instead:
[...]
Quoted 2 lines
drivers/base/cpu.c +0
-0
[...]
Quoted 9 lines
drivers/base/cpu.c +1
-1@@ -264,7 +264,7 @@ static ssize_t print_cpus_offline(struct nr_cpu_ids, total_cpus-1); } - n +=snprintf (&buf[n], len - n,"\n" ); + n +=sysfs_emit (&buf[n],"\n" );return n; } static DEVICE_ATTR(offline, 0444, print_cpus_offline, NULL);
[...]
Quoted 2 lines
drivers/base/node.c +0
-0
[...]
Quoted 10 lines
drivers/base/node.c +1
-1@@ -96,7 +96,7 @@ static ssize_t node_read_meminfo(struct nid, K(sum_zone_node_page_state(nid, NR_MLOCK)));#ifdef CONFIG_HIGHMEM - n +=sprintf (buf + n, + n +=sysfs_emit (buf + n,"Node %d HighTotal: %8lu kB\n" "Node %d HighFree: %8lu kB\n" "Node %d LowTotal: %8lu kB\n"
drivers/base/node.c static ssize_t node_read_meminfo(struct · line 112
Quoted 8 lines
drivers/base/node.c +1
-1@@ -106,7 +106,7 @@ static ssize_t node_read_meminfo(struct nid,K (i.totalram - i.totalhigh), nid, K(i.freeram - i.freehigh));#endif - n +=sprintf (buf + n, + n +=sysfs_emit (buf + n,"Node %d Dirty: %8lu kB\n" "Node %d Writeback: %8lu kB\n" "Node %d FilePages: %8lu kB\n"
[...]
Ben.
Signature · 3 lines
Ben Hutchings Kids! Bringing about Armageddon can be dangerous. Do not attempt it in your own home. - Terry Pratchett and Neil Gaiman, `Good Omens'
Greg Kroah-Hartman
maintainerRe: [PATCH 4.19 322/323] drivers core: Use sysfs_emit and sysfs_emit_at for show(device *...) functions
Quoted 13 lines · Ben Hutchings
Quoted 6 lines · Greg Kroah-Hartman
From: Joe Perches <[email protected]>
commit
aa838896d87af561a33ecefea1caa4c15a68bc47upstream.Convert the various sprintf fmaily calls in sysfs device show functions to
sysfs_emitandsysfs_emit_atforPAGE_SIZEbuffer safety.[...]
Quoted 3 lines
Signed-off-by Joe Perches <[email protected]>Link https://lore.kernel.org/r/3d033c33056d88bbe34d4ddb62afd05ee166ab9a.1600285923.git.joe@perches.com open here[ Brennan : Regenerated for 4.19 to fix CVE-2022-20166 ]
Quoted 5 lines
When I looked into the referenced security issue, it seemed to only be exploitable through wakelock names, and in the upstream kernel only after commit
c8377adfa781"PM / wakeup: Show wakeup sources stats in sysfs" (first included in 5.4). So I would be interested to know if and why a fix was needed for 4.19.
It should not be needed there.
Quoted 3 lines
More importantly, this backported version uniformly converts to
sysfs_emit(), but there are 3 placessysfs_emit_at()must be used instead:
Ick, ok, I'll go revert the commit, thanks.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 323/323 arm64: dts: stratix10: fix incorrect I2C property for SCL signal
In reply to Greg Kroah-HartmanFrom: Dinh Nguyen <[email protected]>
commit db66795f61354c373ecdadbdae1ed253a96c47cb upstream.
The correct dts property for the SCL falling time is "i2c-scl-falling-time-ns".
--- arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/boot/dts/altera/socfpga_stratix10_socdk.dts +1 -1
@@ -125,7 +125,7 @@ status = "okay"; clock-frequency = <100000>; i2c-sda-falling-time-ns = <890>; /* hcnt */ - i2c-sdl-falling-time-ns = <890>; /* lcnt */ + i2c-scl-falling-time-ns = <890>; /* lcnt */ adc@14 { compatible = "lltc,ltc2497";
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.291 release. There are 323 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 11 Aug 2023 10:36:10 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.291-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v4.19:
11 builds: 11 pass, 0 fail
22 boots: 22 pass, 0 fail
40 tests: 40 pass, 0 failLinux version: 4.19.291-rc1-gde1cde99fbfb
Boards tested: tegra124-jetson-tk1, tegra186-p2771-0000,
tegra194-p2972-0000, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.291 release. There are 323 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 11 Aug 2023 10:36:10 +0000. Anything received after that time might be too late.
Building sparc64:allnoconfig ... failed
--------------
Error log:
<stdin>:1335:2: warning: #warning syscall rseq not implemented [-Wcpp] /opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: warning: arch/sparc/vdso/vdso-note.o: missing .note.GNU-stack section implies executable stack /opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker /opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: warning: arch/sparc/vdso/vdso32/vdso-note.o: missing .note.GNU-stack section implies executable stack /opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
sparc64-linux-ld: init/main.o: in function `start_kernel':
main.c:(.init.text+0x77c): undefined reference to `arch_cpu_finalize_init'
Building sparc64:tinyconfig ... failed
--------------
Error log:
<stdin>:1335:2: warning: #warning syscall rseq not implemented [-Wcpp] /opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: warning: arch/sparc/vdso/vdso-note.o: missing .note.GNU-stack section implies executable stack /opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker /opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: warning: arch/sparc/vdso/vdso32/vdso-note.o: missing .note.GNU-stack section implies executable stack /opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
sparc64-linux-ld: init/main.o: in function `start_kernel':
main.c:(.init.text+0x764): undefined reference to `arch_cpu_finalize_init'
Quoted 21 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.291 release. There are 323 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 11 Aug 2023 10:36:10 +0000. Anything received after that time might be too late.
Building sparc64:allnoconfig ... failed
--------------
Error log:
<stdin>:1335:2: warning: #warning syscall rseq not implemented [-Wcpp]/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: warning:arch/sparc/vdso/vdso-note.o: missing .note.GNU-stack section implies executable stack/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: warning:arch/sparc/vdso/vdso32/vdso-note.o: missing .note.GNU-stack section implies executable stack/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
sparc64-linux-ld:init/main.o: in function `start_kernel':
main.c:(.init.text+0x77c): undefined reference to `arch_cpu_finalize_init'
Quoted 10 lines
Building sparc64:tinyconfig ... failed
--------------
Error log:
<stdin>:1335:2: warning: #warning syscall rseq not implemented [-Wcpp]/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: warning:arch/sparc/vdso/vdso-note.o: missing .note.GNU-stack section implies executable stack/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: warning:arch/sparc/vdso/vdso32/vdso-note.o: missing .note.GNU-stack section implies executable stack/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
sparc64-linux-ld:init/main.o: in function `start_kernel':
main.c:(.init.text+0x764): undefined reference to `arch_cpu_finalize_init'
Introduced with v4.19.290.
Greg Kroah-Hartman
maintainerQuoted 33 lines · Guenter Roeck
Quoted 21 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.291 release. There are 323 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 11 Aug 2023 10:36:10 +0000. Anything received after that time might be too late.
Building sparc64:allnoconfig ... failed
--------------
Error log:
<stdin>:1335:2: warning: #warning syscall rseq not implemented [-Wcpp]/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: warning:arch/sparc/vdso/vdso-note.o: missing .note.GNU-stack section implies executable stack/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: warning:arch/sparc/vdso/vdso32/vdso-note.o: missing .note.GNU-stack section implies executable stack/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
sparc64-linux-ld:init/main.o: in function `start_kernel':
main.c:(.init.text+0x77c): undefined reference to `arch_cpu_finalize_init'Quoted 10 lines
Building sparc64:tinyconfig ... failed
--------------
Error log:
<stdin>:1335:2: warning: #warning syscall rseq not implemented [-Wcpp]/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: warning:arch/sparc/vdso/vdso-note.o: missing .note.GNU-stack section implies executable stack/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: warning:arch/sparc/vdso/vdso32/vdso-note.o: missing .note.GNU-stack section implies executable stack/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
sparc64-linux-ld:init/main.o: in function `start_kernel':
main.c:(.init.text+0x764): undefined reference to `arch_cpu_finalize_init'
Quoted 1 line
Introduced with v4.19.290.
Thanks for the report, I'll fix these up separately after this release.
greg k-h
Greg Kroah-Hartman
maintainerQuoted 34 lines · Greg Kroah-Hartman
Quoted 33 lines · Guenter Roeck
Quoted 31 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.291 release. There are 323 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 11 Aug 2023 10:36:10 +0000. Anything received after that time might be too late.
Building sparc64:allnoconfig ... failed
--------------
Error log:
<stdin>:1335:2: warning: #warning syscall rseq not implemented [-Wcpp]/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: warning:arch/sparc/vdso/vdso-note.o: missing .note.GNU-stack section implies executable stack/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: warning:arch/sparc/vdso/vdso32/vdso-note.o: missing .note.GNU-stack section implies executable stack/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
sparc64-linux-ld:init/main.o: in function `start_kernel':
main.c:(.init.text+0x77c): undefined reference to `arch_cpu_finalize_init'Building sparc64:tinyconfig ... failed
--------------
Error log:
<stdin>:1335:2: warning: #warning syscall rseq not implemented [-Wcpp]/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: warning:arch/sparc/vdso/vdso-note.o: missing .note.GNU-stack section implies executable stack/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: warning:arch/sparc/vdso/vdso32/vdso-note.o: missing .note.GNU-stack section implies executable stack/opt/kernel/gcc-11.4.0-2.40-nolibc/sparc64-linux/bin/../lib/gcc/sparc64-linux/11.4.0/../../../../sparc64-linux/bin/ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
sparc64-linux-ld:init/main.o: in function `start_kernel':
main.c:(.init.text+0x764): undefined reference to `arch_cpu_finalize_init'
Quoted 3 lines
Quoted 1 line
Introduced with v4.19.290.
Thanks for the report, I'll fix these up separately after this release.
Finally figured it out, I messed up on the backport for the sparc32 changes in the Kconfig file. I've queued up a fix for this now.
thanks,
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.291 release. There are 323 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 11 Aug 2023 10:36:10 +0000. Anything received after that time might be too late.
Build results:
total: 149 pass: 147 fail: 2
Failed builds:
sparc64:allnoconfig
sparc64:tinyconfig
Qemu test results:
total: 432 pass: 430 fail: 2 Failed tests: sparc64:sun4u:nodebug:nosmp:ata:net,e1000:hd sparc64:sun4v:nodebug:nosmp:ata:net,pcnet:hd
Errors as already reported for v4.14.y, here introduced with 4.19.290.
Guenter
Hello!
Quoted 23 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.19.291 release. There are 323 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri, 11 Aug 2023 10:36:10 +0000. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.19.291-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.19.y
and the diffstat can be found below.thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:Greg Kroah-Hartman <[email protected]>
Linux 4.19.291-rc1
[...]
Quoted 2 lines
Lyude Paul <[email protected]>
drm/edid: Fix uninitialized variable indrm_cvt_modes()
[...]
Two new warnings are introduced on x86_64 with GCC-8 (defconfig):
-----8<-----drivers/gpu/drm/drm_edid.o: warning: objtool:
drm_mode_std.isra.34()+0xbc: return with modified stack frame drivers/gpu/drm/drm_edid.o: warning: objtool:
drm_mode_std.isra.34()+0x0: stack state mismatch: cfa1=7+112 cfa2=7+8 ----->8-----
Bisection points to the quoted commit ("drm/edid: Fix uninitialized variable in drm_cvt_modes()"), 991fcb77f490 upstream. Reverting makes the warnings disappear.
Greetings!
Daniel Díaz
[email protected]
Quoted 10 lines · Daniel Díaz
Two new warnings are introduced on
x86_64with GCC-8 (defconfig):-----8<-----
drivers/gpu/drm/drm_edid.o: warning: objtool:
drm_mode_std.isra.34()+0xbc: return with modified stack framedrivers/gpu/drm/drm_edid.o: warning: objtool:
drm_mode_std.isra.34()+0x0: stack state mismatch: cfa1=7+112 cfa2=7+8 ----->8-----
Quoted 3 lines
Bisection points to the quoted commit ("drm/edid: Fix uninitialized variable in
drm_cvt_modes()"),991fcb77f490upstream. Reverting makes the warnings disappear.
Bah. Stable should pick up commit d652d5f1eeeb ("drm/edid: fix objtool warning in drm_cvt_modes()") from mainline too.
Sadly it didn't have a 'Fixes:' tag, so it didn't get picked up automatically. My bad.
Although it's not like the commits it fixes were actually ever marked for stable either. I guess commit 3f649ab728cd ("treewide: Remove uninitialized_var() usage") got picked up as some kind of "make it easier to apply other patches" thing.
Linus
Greg Kroah-Hartman
maintainerQuoted 18 lines · Linus Torvalds
Quoted 10 lines · Daniel Díaz
Two new warnings are introduced on
x86_64with GCC-8 (defconfig):-----8<-----
drivers/gpu/drm/drm_edid.o: warning: objtool:
drm_mode_std.isra.34()+0xbc: return with modified stack framedrivers/gpu/drm/drm_edid.o: warning: objtool:
drm_mode_std.isra.34()+0x0: stack state mismatch: cfa1=7+112 cfa2=7+8 ----->8-----Quoted 3 lines
Bisection points to the quoted commit ("drm/edid: Fix uninitialized variable in
drm_cvt_modes()"),991fcb77f490upstream. Reverting makes the warnings disappear.Bah. Stable should pick up commit
d652d5f1eeeb("drm/edid: fix objtool warning indrm_cvt_modes()") from mainline too.
Quoted 7 lines
Sadly it didn't have a 'Fixes:' tag, so it didn't get picked up automatically. My bad.
Although it's not like the commits it fixes were actually ever marked for stable either. I guess commit
3f649ab728cd("treewide: Removeuninitialized_var()usage") got picked up as some kind of "make it easier to apply other patches" thing.
I applied the uninitialized_var patch here because I was trying to attempt to reduce the number of build warnings I am getting using gcc-12 on 4.19.y It helped out a tiny bit, but we still have lots of warnings left.
I'll pick up d652d5f1eeeb as well now, thanks for pointing it out.
greg k-h