5.7.6-rc1 review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 469/477 netfilter: nft_set_rbtree: Dont account for expired elements on insertion
In reply to Greg Kroah-HartmanFrom: Stefano Brivio <[email protected]>
commit 33d077996a87175b155fe88030e8fec7ca76327e upstream.
While checking the validity of insertion in __nft_rbtree_insert(), we currently ignore conflicting elements and intervals only if they are not active within the next generation.
However, if we consider expired elements and intervals as potentially conflicting and overlapping, we'll return error for entries that should be added instead. This is particularly visible with garbage collection intervals that are comparable with the element timeout itself, as reported by Mike Dillinger.
Other than the simple issue of denying insertion of valid entries, this might also result in insertion of a single element (opening or closing) out of a given interval. With single entries (that are inserted as intervals of size 1), this leads in turn to the creation of new intervals. For example:
# nft add element t s { 192.0.2.1 }
# nft list ruleset
[...]
elements = { 192.0.2.1-255.255.255.255 }Always ignore expired elements active in the next generation, while checking for conflicts.
It might be more convenient to introduce a new macro that covers both inactive and expired items, as this type of check also appears quite frequently in other set back-ends. This is however beyond the scope of this fix and can be deferred to a separate patch.
Other than the overlap detection cases introduced by commit 7c84d41416d8 ("netfilter: nft_set_rbtree: Detect partial overlaps on insertion"), we also have to cover the original conflict check dealing with conflicts between two intervals of size 1, which was introduced before support for timeout was introduced. This won't return an error to the user as -EEXIST is masked by nft if NLM_F_EXCL is not given, but would result in a silent failure adding the entry.
--- net/netfilter/nft_set_rbtree.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
net/netfilter/nft_set_rbtree.c +14 -7
@@ -271,12 +271,14 @@ static int __nft_rbtree_insert(const strif (nft_rbtree_interval_start (new)) {if (nft_rbtree_interval_end (rbe) && -nft_set_elem_active (&rbe->ext, genmask)) +nft_set_elem_active (&rbe->ext, genmask) && + !nft_set_elem_expired (&rbe->ext)) overlap = false; }else { overlap =nft_rbtree_interval_end (rbe) &&nft_set_elem_active (&rbe->ext, - genmask); + genmask) && + !nft_set_elem_expired (&rbe->ext); } }else if (d >0 ) { p = &parent->rb_right;
@@ -284,9 +286,11 @@ static int __nft_rbtree_insert(const strif (nft_rbtree_interval_end (new)) { overlap =nft_rbtree_interval_end (rbe) &&nft_set_elem_active (&rbe->ext, - genmask); + genmask) && + !nft_set_elem_expired (&rbe->ext); }else if (nft_rbtree_interval_end (rbe) && -nft_set_elem_active (&rbe->ext, genmask)) { +nft_set_elem_active (&rbe->ext, genmask) && + !nft_set_elem_expired (&rbe->ext)) { overlap = true; } }else {
@@ -294,15 +298,18 @@ static int __nft_rbtree_insert(const str nft_rbtree_interval_start(new)) { p = &parent->rb_left; -if (nft_set_elem_active (&rbe->ext, genmask)) +if (nft_set_elem_active (&rbe->ext, genmask) && + !nft_set_elem_expired (&rbe->ext)) overlap = false; } else if (nft_rbtree_interval_start(rbe) &&nft_rbtree_interval_end (new )) { p = &parent->rb_right; -if (nft_set_elem_active (&rbe->ext, genmask)) +if (nft_set_elem_active (&rbe->ext, genmask) && + !nft_set_elem_expired (&rbe->ext)) overlap = false; - } else if (nft_set_elem_active(&rbe->ext, genmask)) { + } else if (nft_set_elem_active(&rbe->ext, genmask) && + !nft_set_elem_expired(&rbe->ext)) { *ext = &rbe->ext;return -EEXIST ; } else {
Greg Kroah-Hartman
maintainerPATCH 442/477 drm/i915: Fix AUX power domain toggling across TypeC mode resets
In reply to Greg Kroah-HartmanFrom: Imre Deak <[email protected]>
commit d96536f0fe699729a0974eb5b65eb0d87cc747e1 upstream.
Make sure to select the port's AUX power domain while holding the TC port lock. The domain depends on the port's current TC mode, which may get changed under us if we're not holding the lock.
This was left out from
commit 8c10e2262663 ("drm/i915: Keep the TypeC port mode fixed for detect/AUX transfers")
--- drivers/gpu/drm/i915/display/intel_dp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_dp.c +3 -2
@@ -1343,8 +1343,7 @@ intel_dp_aux_xfer(struct intel_dp *intelbool is_tc_port =intel_phy_is_tc (i915, phy);i915_reg_t ch_ctl, ch_data[5 ];u32 aux_clock_divider; -enum intel_display_power_domain aux_domain = -intel_aux_power_domain (intel_dig_port); +enum intel_display_power_domain aux_domain;intel_wakeref_t aux_wakeref;intel_wakeref_t pps_wakeref;int i, ret, recv_bytes;
@@ -1359,6 +1358,8 @@ intel_dp_aux_xfer(struct intel_dp *intelif (is_tc_port)intel_tc_port_lock (intel_dig_port); + aux_domain =intel_aux_power_domain (intel_dig_port); + aux_wakeref =intel_display_power_get (i915, aux_domain); pps_wakeref =pps_lock (intel_dp);
Greg Kroah-Hartman
maintainerPATCH 441/477 s390: fix syscall_get_error for compat processes
In reply to Greg Kroah-HartmanFrom: Dmitry V. Levin <[email protected]>
commit b3583fca5fb654af2cfc1c08259abb9728272538 upstream.
If both the tracer and the tracee are compat processes, and gprs[2] is assigned a value by __poke_user_compat, then the higher 32 bits of gprs[2] are cleared, IS_ERR_VALUE() always returns false, and syscall_get_error() always returns 0.
Fix the implementation by sign-extending the value for compat processes the same way as x86 implementation does.
The bug was exposed to user space by commit 201766a20e30f ("ptrace: add PTRACE_GET_SYSCALL_INFO request") and detected by strace test suite.
This change fixes strace syscall tampering on s390.
arch/s390/include/asm/syscall.h +11 -1
@@ -33,7 +33,17 @@ static inline void syscall_rollback(struct task_struct *task,static inline long syscall_get_error (struct task_struct *task,struct pt_regs *regs) { -return IS_ERR_VALUE (regs->gprs[2 ]) ? regs->gprs[2 ] :0 ; +unsigned long error = regs->gprs[2 ]; +#ifdef CONFIG_COMPAT +if (test_tsk_thread_flag (task,TIF_31BIT )) { +/* +* Sign-extend the value so (int)-EFOO becomes (long)-EFOO +* and will match correctly in comparisons. +*/ + error = (long )(int )error; + } +#endif +return IS_ERR_VALUE (error) ? error :0 ; } static inline long syscall_get_return_value(struct task_struct *task,
Greg Kroah-Hartman
maintainerPATCH 438/477 net/mlx5: DR, Fix freeing in dr_create_rc_qp()
In reply to Greg Kroah-HartmanFrom: Denis Efremov <[email protected]>
[ Upstream commit 47a357de2b6b706af3c9471d5042f9ba8907031e ]
Variable "in" in dr_create_rc_qp() is allocated with kvzalloc() and should be freed with kvfree().
--- drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/mellanox/mlx5/core/steering/dr_send.c +1 -1
@@ -181,7 +181,7 @@ static struct mlx5dr_qp *dr_create_rc_qp(struct mlx5_core_dev *mdev, in, pas)); err =mlx5_core_create_qp (mdev, &dr_qp->mqp, in, inlen); -kfree (in); +kvfree (in);if (err) {mlx5_core_warn (mdev," Can't create QP\n" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 465/477 tools/bootconfig: Fix to use correct quotes for value
In reply to Greg Kroah-HartmanFrom: Masami Hiramatsu <[email protected]>
commit 272da3279df191f028fd63d1683e5ecd56fcb13b upstream.
Fix bootconfig tool to select double or single quotes correctly according to the value.
If a bootconfig value includes a double quote character, we must use single-quotes to quote that value.
--- tools/bootconfig/main.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
tools/bootconfig/main.c +8 -6
@@ -14,13 +14,18 @@#include <linux/kernel.h> #include <linux/bootconfig.h> -static int xbc_show_array (struct xbc_node *node) +static int xbc_show_value (struct xbc_node *node) {const char *val; +char q;int i =0 ;xbc_array_for_each_value (node, val) { -printf ("\"%s\"%s" , val, node->next ?", " :";\n" ); +if (strchr (val,'"' )) + q ='\'' ; +else + q ='"' ; +printf ("%c%s%c%s" , q, val, q, node->next ?", " :";\n" ); i++; }return i;
@@ -48,10 +53,7 @@ static void xbc_show_compact_tree(void)continue ; }else if (cnode &&xbc_node_is_value (cnode)) {printf ("%s = " ,xbc_node_get_data (node)); -if (cnode->next) -xbc_show_array (cnode); -else -printf ("\"%s\";\n" ,xbc_node_get_data (cnode)); +xbc_show_value (cnode); }else {printf ("%s;\n" ,xbc_node_get_data (node)); }
Greg Kroah-Hartman
maintainerPATCH 459/477 drm/i915/tgl: Make Wa_14010229206 permanent
In reply to Greg Kroah-HartmanFrom: Swathi Dhanavanthri <[email protected]>
commit 63d0f3ea8ebb67160eca281320d255c72b0cb51a upstream.
This workaround now applies to all steppings, not just A0. Wa_1409085225 is a temporary A0-only W/A however it is identical to Wa_14010229206 and hence the combined workaround is made permanent.
Bspec: 52890
--- drivers/gpu/drm/i915/gt/intel_workarounds.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/gt/intel_workarounds.c +6 -6
@@ -1620,12 +1620,6 @@ rcs_engine_wa_init(struct intel_engine_cGEN7_FF_THREAD_MODE , GEN12_FF_TESSELATION_DOP_GATE_DISABLE); -/* -* Wa_1409085225:tgl -* Wa_14010229206:tgl -*/ -wa_masked_en (wal,GEN9_ROW_CHICKEN4 ,GEN12_DISABLE_TDL_PUSH ); -/* Wa_1408615072:tgl */ wa_write_or (wal,UNSLICE_UNIT_LEVEL_CLKGATE2 ,VSUNIT_CLKGATE_DIS_TGL );
@@ -1643,6 +1637,12 @@ rcs_engine_wa_init(struct intel_engine_cwa_masked_en (wal,GEN9_CS_DEBUG_MODE1 ,FF_DOP_CLOCK_GATE_DISABLE ); + +/* +* Wa_1409085225:tgl +* Wa_14010229206:tgl +*/ +wa_masked_en (wal,GEN9_ROW_CHICKEN4 ,GEN12_DISABLE_TDL_PUSH ); }if (IS_GEN (i915,11 )) {
Greg Kroah-Hartman
maintainerPATCH 455/477 drm/i915/gt: Move ilk GT workarounds from init_clock_gating to workarounds
In reply to Greg Kroah-HartmanFrom: Chris Wilson <[email protected]>
commit eacf21040aa97fd1b3c6bb201bfd43820e1c49be upstream.
Rescue the GT workarounds from being buried inside init_clock_gating so that we remember to apply them after a GT reset, and that they are included in our verification that the workarounds are applied.
--- drivers/gpu/drm/i915/gt/intel_workarounds.c | 14 ++++++++++++++ drivers/gpu/drm/i915/intel_pm.c | 10 ---------- 2 files changed, 14 insertions(+), 10 deletions(-)
drivers/gpu/drm/i915/gt/intel_workarounds.c +14 -0
@@ -704,6 +704,18 @@ int intel_engine_emit_ctx_wa(struct i915 }static void +ilk_gt_workarounds_init (struct drm_i915_private *i915,struct i915_wa_list *wal) +{ +wa_masked_en (wal, _3D_CHICKEN2, _3D_CHICKEN2_WM_READ_PIPELINED); + +/* WaDisableRenderCachePipelinedFlush:ilk */ +wa_masked_en (wal,CACHE_MODE_0 ,CM0_PIPELINED_RENDER_FLUSH_DISABLE ); + +/* WaDisable_RenderCache_OperationalFlush:ilk */ +wa_masked_dis (wal,CACHE_MODE_0 ,RC_OP_FLUSH_ENABLE ); +} + +static void snb_gt_workarounds_init (struct drm_i915_private *i915,struct i915_wa_list *wal) {/* WaDisableHiZPlanesWhenMSAAEnabled:snb */
@@ -1125,6 +1137,8 @@ gt_init_workarounds(struct drm_i915_privivb_gt_workarounds_init (i915, wal); else if (IS_GEN(i915, 6)) snb_gt_workarounds_init(i915, wal); + else if (IS_GEN(i915, 5)) + ilk_gt_workarounds_init(i915, wal); else if (INTEL_GEN(i915) <= 8) return; else
drivers/gpu/drm/i915/intel_pm.c +0 -10
@@ -6593,16 +6593,6 @@ static void ilk_init_clock_gating(structI915_WRITE (ILK_DISPLAY_CHICKEN2 ,I915_READ (ILK_DISPLAY_CHICKEN2 ) |ILK_ELPIN_409_SELECT ); -I915_WRITE (_3D_CHICKEN2, - _3D_CHICKEN2_WM_READ_PIPELINED <<16 | - _3D_CHICKEN2_WM_READ_PIPELINED); - -/* WaDisableRenderCachePipelinedFlush:ilk */ -I915_WRITE (CACHE_MODE_0 , -_MASKED_BIT_ENABLE (CM0_PIPELINED_RENDER_FLUSH_DISABLE )); - -/* WaDisable_RenderCache_OperationalFlush:ilk */ -I915_WRITE (CACHE_MODE_0 ,_MASKED_BIT_DISABLE (RC_OP_FLUSH_ENABLE ));g4x_disable_trickle_feed (dev_priv);
Greg Kroah-Hartman
maintainerPATCH 456/477 drm/i915/gt: Move vlv GT workarounds from init_clock_gating to workarounds
In reply to Greg Kroah-HartmanFrom: Chris Wilson <[email protected]>
commit 695a2b11649e99bbf15d278042247042c42b8728 upstream.
Rescue the GT workarounds from being buried inside init_clock_gating so that we remember to apply them after a GT reset, and that they are included in our verification that the workarounds are applied.
--- drivers/gpu/drm/i915/gt/intel_workarounds.c | 59 +++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_pm.c | 61 ---------------------------- 2 files changed, 59 insertions(+), 61 deletions(-)
drivers/gpu/drm/i915/gt/intel_workarounds.c +59 -0
@@ -815,6 +815,63 @@ ivb_gt_workarounds_init(struct drm_i915_ }static void +vlv_gt_workarounds_init (struct drm_i915_private *i915,struct i915_wa_list *wal) +{ +/* WaDisableEarlyCull:vlv */ +wa_masked_en (wal, _3D_CHICKEN3, _3D_CHICKEN_SF_DISABLE_OBJEND_CULL); + +/* WaPsdDispatchEnable:vlv */ +/* WaDisablePSDDualDispatchEnable:vlv */ +wa_masked_en (wal, +GEN7_HALF_SLICE_CHICKEN1 , +GEN7_MAX_PS_THREAD_DEP | +GEN7_PSD_SINGLE_PORT_DISPATCH_ENABLE ); + +/* WaDisable_RenderCache_OperationalFlush:vlv */ +wa_masked_dis (wal,CACHE_MODE_0_GEN7 ,RC_OP_FLUSH_ENABLE ); + +/* WaForceL3Serialization:vlv */ +wa_write_clr (wal,GEN7_L3SQCREG4 ,L3SQ_URB_READ_CAM_MATCH_DISABLE ); + +/* +* WaVSThreadDispatchOverride:ivb,vlv +* +* This actually overrides the dispatch +* mode for all thread types. +*/ +wa_write_masked_or (wal, +GEN7_FF_THREAD_MODE , +GEN7_FF_SCHED_MASK , +GEN7_FF_TS_SCHED_HW | +GEN7_FF_VS_SCHED_HW | +GEN7_FF_DS_SCHED_HW ); + +/* +* BSpec says this must be set, even though +* WaDisable4x2SubspanOptimization isn't listed for VLV. +*/ +wa_masked_en (wal,CACHE_MODE_1 ,PIXEL_SUBSPAN_COLLECT_OPT_DISABLE ); + +/* +* BSpec recommends 8x4 when MSAA is used, +* however in practice 16x4 seems fastest. +* +* Note that PS/WM thread counts depend on the WIZ hashing +* disable bit, which we don't touch here, but it's good +* to keep in mind (see 3DSTATE_PS and 3DSTATE_WM). +*/ +wa_add (wal,GEN7_GT_MODE ,0 , +_MASKED_FIELD (GEN6_WIZ_HASHING_MASK , GEN6_WIZ_HASHING_16x4), + GEN6_WIZ_HASHING_16x4); + +/* +* WaIncreaseL3CreditsForVLVB0:vlv +* This is the hardware default actually. +*/ +wa_write (wal,GEN7_L3SQCREG1 ,VLV_B0_WA_L3SQCREG1_VALUE ); +} + +static void hsw_gt_workarounds_init (struct drm_i915_private *i915,struct i915_wa_list *wal) {/* L3 caching of data atomics doesn't work -- disable it. */
@@ -1133,6 +1190,8 @@ gt_init_workarounds(struct drm_i915_privskl_gt_workarounds_init (i915, wal); else if (IS_HASWELL(i915)) hsw_gt_workarounds_init(i915, wal); + else if (IS_VALLEYVIEW(i915)) + vlv_gt_workarounds_init(i915, wal); else if (IS_IVYBRIDGE(i915)) ivb_gt_workarounds_init(i915, wal); else if (IS_GEN(i915, 6))
drivers/gpu/drm/i915/intel_pm.c +0 -61
90 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 447/477 drm/amdkfd: Use correct major in devcgroup check
In reply to Greg Kroah-HartmanFrom: Lorenz Brun <[email protected]>
commit 99c7b309472787026ce52fd2bc5d00630567a872 upstream.
The existing code used the major version number of the DRM driver instead of the device major number of the DRM subsystem for validating access for a devices cgroup.
This meant that accesses allowed by the devices cgroup weren't permitted and certain accesses denied by the devices cgroup were permitted (if they matched the wrong major device number).
--- drivers/gpu/drm/amd/amdkfd/kfd_priv.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdkfd/kfd_priv.h +2 -1
@@ -40,6 +40,7 @@#include <drm/drm_file.h> #include <drm/drm_drv.h> #include <drm/drm_device.h> +#include <drm/drm_ioctl.h> #include <kgd_kfd_interface.h> #include <linux/swap.h>
@@ -1053,7 +1054,7 @@ static inline int kfd_devcgroup_check_pe#if defined(CONFIG_CGROUP_DEVICE ) || defined(CONFIG_CGROUP_BPF )struct drm_device *ddev = kfd->ddev; -return devcgroup_check_permission (DEVCG_DEV_CHAR , ddev->driver->major, +return devcgroup_check_permission (DEVCG_DEV_CHAR ,DRM_MAJOR , ddev->render->index,DEVCG_ACC_WRITE |DEVCG_ACC_READ );#else
Greg Kroah-Hartman
maintainerPATCH 444/477 drm/i915/gem: Avoid iterating an empty list
In reply to Greg Kroah-HartmanFrom: Chris Wilson <[email protected]>
commit 757a9395f33c51c4e6eff2c7c0fbd50226a58224 upstream.
Our __sgt_iter assumes that the scattergather list has at least one element. But during construction we may fail in allocating the first page, and so mark the first element as the terminator. This is unexpected!
[22555.524752] RIP: 0010:shmem_get_pages+0x506/0x710 [i915] [22555.524759] Code: 49 8b 2c 24 31 c0 66 89 44 24 40 48 85 ed 0f 84 62 01 00 00 4c 8b 75 00 8b 5d 08 44 8b 7d 0c 48 8b 0d 7e 34 07 e2 49 83 e6 fc <49> 8b 16 41 01 df 48 89 cf 48 89 d0 48 c1 e8 2d 48 85 c9 0f 84 c8 [22555.524765] RSP: 0018:ffffc9000053f9d0 EFLAGS: 00010246 [22555.524770] RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffff8881ffffa000 [22555.524774] RDX: fffffffffffffff4 RSI: ffffffffffffffff RDI: ffffffff821efe00 [22555.524778] RBP: ffff8881b099ab00 R08: 0000000000000000 R09: 00000000fffffff4 [22555.524782] R10: 0000000000000002 R11: 00000000ffec0a02 R12: ffff8881cd3c8d60 [22555.524786] R13: 00000000fffffff4 R14: 0000000000000000 R15: 0000000000000000 [22555.524790] FS: 00007f4fbeb9b9c0(0000) GS:ffff8881f8580000(0000) knlGS:0000000000000000 [22555.524795] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [22555.524799] CR2: 0000000000000000 CR3: 00000001ec7f0004 CR4: 00000000001606e0 [22555.524803] Call Trace: [22555.524919] __i915_gem_object_get_pages+0x4f/0x60 [i915]
--- drivers/gpu/drm/i915/gem/i915_gem_shmem.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/gem/i915_gem_shmem.c +9 -6
@@ -39,7 +39,6 @@ static int shmem_get_pages(struct drm_i9unsigned long last_pfn =0 ;/* suppress gcc warning */ unsigned int max_segment =i915_sg_segment_size ();unsigned int sg_page_sizes; -struct pagevec pvec;gfp_t noreclaim;int ret;
@@ -192,13 +191,17 @@ err_sg:sg_mark_end (sg); err_pages:mapping_clear_unevictable (mapping); -pagevec_init (&pvec); -for_each_sgt_page (page, sgt_iter, st) { -if (!pagevec_add (&pvec, page)) +if (sg != st->sgl) { +struct pagevec pvec; + +pagevec_init (&pvec); +for_each_sgt_page (page, sgt_iter, st) { +if (!pagevec_add (&pvec, page)) +check_release_pagevec (&pvec); + } +if (pagevec_count (&pvec))check_release_pagevec (&pvec); } -if (pagevec_count (&pvec)) -check_release_pagevec (&pvec);sg_free_table (st);kfree (st);
Greg Kroah-Hartman
maintainerPATCH 400/477 bnxt_en: Re-enable SRIOV during resume.
In reply to Greg Kroah-HartmanFrom: Michael Chan <[email protected]>
[ Upstream commit 59ae210173ff86256fa0cdba4ea4d608c61e123d ]
If VFs are enabled, we need to re-configure them during resume because firmware has been reset while resuming. Otherwise, the VFs won't work after resume.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +2 -0
@@ -12115,6 +12115,8 @@ static int bnxt_resume(struct device *device) resume_exit:bnxt_ulp_start (bp, rc); +if (!rc) +bnxt_reenable_sriov (bp);rtnl_unlock ();return rc; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 406/477 block: Fix use-after-free in blkdev_get()
In reply to Greg Kroah-HartmanFrom: Jason Yan <[email protected]>
[ Upstream commit 2d3a8e2deddea6c89961c422ec0c5b851e648c14 ]
In blkdev_get() we call __blkdev_get() to do some internal jobs and if there is some errors in __blkdev_get(), the bdput() is called which means we have released the refcount of the bdev (actually the refcount of the bdev inode). This means we cannot access bdev after that point. But acctually bdev is still accessed in blkdev_get() after calling __blkdev_get(). This results in use-after-free if the refcount is the last one we released in __blkdev_get(). Let's take a look at the following scenerio:
CPU0 CPU1 CPU2blkdev_open blkdev_open Remove disk
bd_acquire
blkdev_get
__blkdev_get del_gendisk
bdev_unhash_inode
bd_acquire bdev_get_gendisk
bd_forget failed because of unhashed
bdput
bdput (the last one)
bdev_evict_inode
access bdev => use after free
[ 459.350216] BUG: KASAN: use-after-free in __lock_acquire+0x24c1/0x31b0
[ 459.351190] Read of size 8 at addr ffff88806c815a80 by task syz-executor.0/20132
[ 459.352347]
[ 459.352594] CPU: 0 PID: 20132 Comm: syz-executor.0 Not tainted 4.19.90 #2
[ 459.353628] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-1ubuntu1 04/01/2014
[ 459.354947] Call Trace:
[ 459.355337] dump_stack+0x111/0x19e
[ 459.355879] ? __lock_acquire+0x24c1/0x31b0
[ 459.356523] print_address_description+0x60/0x223
[ 459.357248] ? __lock_acquire+0x24c1/0x31b0
[ 459.357887] kasan_report.cold+0xae/0x2d8
[ 459.358503] __lock_acquire+0x24c1/0x31b0
[ 459.359120] ? _raw_spin_unlock_irq+0x24/0x40
[ 459.359784] ? lockdep_hardirqs_on+0x37b/0x580
[ 459.360465] ? _raw_spin_unlock_irq+0x24/0x40
[ 459.361123] ? finish_task_switch+0x125/0x600
[ 459.361812] ? finish_task_switch+0xee/0x600
[ 459.362471] ? mark_held_locks+0xf0/0xf0
[ 459.363108] ? __schedule+0x96f/0x21d0
[ 459.363716] lock_acquire+0x111/0x320
[ 459.364285] ? blkdev_get+0xce/0xbe0
[ 459.364846] ? blkdev_get+0xce/0xbe0
[ 459.365390] __mutex_lock+0xf9/0x12a0
[ 459.365948] ? blkdev_get+0xce/0xbe0
[ 459.366493] ? bdev_evict_inode+0x1f0/0x1f0
[ 459.367130] ? blkdev_get+0xce/0xbe0
[ 459.367678] ? destroy_inode+0xbc/0x110
[ 459.368261] ? mutex_trylock+0x1a0/0x1a0
[ 459.368867] ? __blkdev_get+0x3e6/0x1280
[ 459.369463] ? bdev_disk_changed+0x1d0/0x1d0
[ 459.370114] ? blkdev_get+0xce/0xbe0
[ 459.370656] blkdev_get+0xce/0xbe0
[ 459.371178] ? find_held_lock+0x2c/0x110
[ 459.371774] ? __blkdev_get+0x1280/0x1280
[ 459.372383] ? lock_downgrade+0x680/0x680
[ 459.373002] ? lock_acquire+0x111/0x320
[ 459.373587] ? bd_acquire+0x21/0x2c0
[ 459.374134] ? do_raw_spin_unlock+0x4f/0x250
[ 459.374780] blkdev_open+0x202/0x290
[ 459.375325] do_dentry_open+0x49e/0x1050
[ 459.375924] ? blkdev_get_by_dev+0x70/0x70
[ 459.376543] ? __x64_sys_fchdir+0x1f0/0x1f0
[ 459.377192] ? inode_permission+0xbe/0x3a0
[ 459.377818] path_openat+0x148c/0x3f50
[ 459.378392] ? kmem_cache_alloc+0xd5/0x280
[ 459.379016] ? entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 459.379802] ? path_lookupat.isra.0+0x900/0x900
[ 459.380489] ? __lock_is_held+0xad/0x140
[ 459.381093] do_filp_open+0x1a1/0x280
[ 459.381654] ? may_open_dev+0xf0/0xf0
[ 459.382214] ? find_held_lock+0x2c/0x110
[ 459.382816] ? lock_downgrade+0x680/0x680
[ 459.383425] ? __lock_is_held+0xad/0x140
[ 459.384024] ? do_raw_spin_unlock+0x4f/0x250
[ 459.384668] ? _raw_spin_unlock+0x1f/0x30
[ 459.385280] ? __alloc_fd+0x448/0x560
[ 459.385841] do_sys_open+0x3c3/0x500
[ 459.386386] ? filp_open+0x70/0x70
[ 459.386911] ? trace_hardirqs_on_thunk+0x1a/0x1c
[ 459.387610] ? trace_hardirqs_off_caller+0x55/0x1c0
[ 459.388342] ? do_syscall_64+0x1a/0x520
[ 459.388930] do_syscall_64+0xc3/0x520
[ 459.389490] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 459.390248] RIP: 0033:0x416211
[ 459.390720] Code: 75 14 b8 02 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83
04 19 00 00 c3 48 83 ec 08 e8 0a fa ff ff 48 89 04 24 b8 02 00 00 00 0f
05 <48> 8b 3c 24 48 89 c2 e8 53 fa ff ff 48 89 d0 48 83 c4 08 48 3d
01
[ 459.393483] RSP: 002b:00007fe45dfe9a60 EFLAGS: 00000293 ORIG_RAX: 0000000000000002
[ 459.394610] RAX: ffffffffffffffda RBX: 00007fe45dfea6d4 RCX: 0000000000416211
[ 459.395678] RDX: 00007fe45dfe9b0a RSI: 0000000000000002 RDI: 00007fe45dfe9b00
[ 459.396758] RBP: 000000000076bf20 R08: 0000000000000000 R09: 000000000000000a
[ 459.397930] R10: 0000000000000075 R11: 0000000000000293 R12: 00000000ffffffff
[ 459.399022] R13: 0000000000000bd9 R14: 00000000004cdb80 R15: 000000000076bf2c
[ 459.400168]
[ 459.400430] Allocated by task 20132:
[ 459.401038] kasan_kmalloc+0xbf/0xe0
[ 459.401652] kmem_cache_alloc+0xd5/0x280
[ 459.402330] bdev_alloc_inode+0x18/0x40
[ 459.402970] alloc_inode+0x5f/0x180
[ 459.403510] iget5_locked+0x57/0xd0
[ 459.404095] bdget+0x94/0x4e0
[ 459.404607] bd_acquire+0xfa/0x2c0
[ 459.405113] blkdev_open+0x110/0x290
[ 459.405702] do_dentry_open+0x49e/0x1050
[ 459.406340] path_openat+0x148c/0x3f50
[ 459.406926] do_filp_open+0x1a1/0x280
[ 459.407471] do_sys_open+0x3c3/0x500
[ 459.408010] do_syscall_64+0xc3/0x520
[ 459.408572] entry_SYSCALL_64_after_hwframe+0x49/0xbe
[ 459.409415]
[ 459.409679] Freed by task 1262:
[ 459.410212] __kasan_slab_free+0x129/0x170
[ 459.410919] kmem_cache_free+0xb2/0x2a0
[ 459.411564] rcu_process_callbacks+0xbb2/0x2320
[ 459.412318] __do_softirq+0x225/0x8acFix this by delaying bdput() to the end of blkdev_get() which means we have finished accessing bdev.
--- fs/block_dev.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
fs/block_dev.c +7 -5
@@ -1583,10 +1583,8 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)*/ if (!for_part) { ret =devcgroup_inode_permission (bdev->bd_inode, perm); -if (ret !=0 ) { -bdput (bdev); +if (ret !=0 )return ret; - } } restart:
@@ -1655,8 +1653,10 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part) goto out_clear;BUG_ON (for_part); ret =__blkdev_get (whole, mode,1 ); -if (ret) +if (ret) { +bdput (whole); goto out_clear; + } bdev->bd_contains = whole; bdev->bd_part =disk_get_part (disk, partno); if (!(disk->flags & GENHD_FL_UP) ||
@@ -1706,7 +1706,6 @@ static int __blkdev_get(struct block_device *bdev, fmode_t mode, int for_part)disk_unblock_events (disk);put_disk_and_module (disk); out: -bdput (bdev);return ret; }
@@ -1773,6 +1772,9 @@ int blkdev_get(struct block_device *bdev, fmode_t mode, void *holder)bdput (whole); } +if (res) +bdput (bdev); +return res; }EXPORT_SYMBOL (blkdev_get);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 430/477 io_uring: fix io_kiocb.flags modification race in IOPOLL mode
In reply to Greg Kroah-HartmanFrom: Xiaoguang Wang <[email protected]>
[ Upstream commit 65a6543da386838f935d2f03f452c5c0acff2a68 ]
While testing io_uring in arm, we found sometimes io_sq_thread() keeps polling io requests even though there are not inflight io requests in block layer. After some investigations, found a possible race about io_kiocb.flags, see below race codes:
1) in the end of io_write() or io_read()
req->flags &= ~REQ_F_NEED_CLEANUP;
kfree(iovec);
return ret; 2) in io_complete_rw_iopoll()
if (res != -EAGAIN)
req->flags |= REQ_F_IOPOLL_COMPLETED;In IOPOLL mode, io requests still maybe completed by interrupt, then above codes are not safe, concurrent modifications to req->flags, which is not protected by lock or is not atomic modifications. I also had disassemble io_complete_rw_iopoll() in arm:
req->flags |= REQ_F_IOPOLL_COMPLETED;
0xffff000008387b18 <+76>: ldr w0, [x19,#104] 0xffff000008387b1c <+80>: orr w0, w0, #0x1000 0xffff000008387b20 <+84>: str w0, [x19,#104]
Seems that the "req->flags |= REQ_F_IOPOLL_COMPLETED;" is load and modification, two instructions, which obviously is not atomic.
To fix this issue, add a new iopoll_completed in io_kiocb to indicate whether io request is completed.
--- fs/io_uring.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
fs/io_uring.c +6 -6
@@ -513,7 +513,6 @@ enum {REQ_F_INFLIGHT_BIT ,REQ_F_CUR_POS_BIT ,REQ_F_NOWAIT_BIT , -REQ_F_IOPOLL_COMPLETED_BIT ,REQ_F_LINK_TIMEOUT_BIT ,REQ_F_TIMEOUT_BIT , REQ_F_ISREG_BIT,
@@ -556,8 +555,6 @@ enum {REQ_F_CUR_POS =BIT (REQ_F_CUR_POS_BIT ),/* must not punt to workers */ REQ_F_NOWAIT =BIT (REQ_F_NOWAIT_BIT ), -/* polled IO has completed */ -REQ_F_IOPOLL_COMPLETED =BIT (REQ_F_IOPOLL_COMPLETED_BIT ),/* has linked timeout */ REQ_F_LINK_TIMEOUT = BIT(REQ_F_LINK_TIMEOUT_BIT),/* timeout request */
@@ -618,6 +615,8 @@ struct io_kiocb {int cflags;bool needs_fixed_file;u8 opcode; +/* polled IO has completed */ +u8 iopoll_completed;u16 buf_index;
@@ -1760,7 +1759,7 @@ static int io_do_iopoll(struct io_ring_c* If we find a request that requires polling, break out * and complete those lists first, if we have entries there. */ -if (req->flags &REQ_F_IOPOLL_COMPLETED ) { +if (READ_ONCE (req->iopoll_completed)) {list_move_tail (&req->list, &done);continue ; }
@@ -1941,7 +1940,7 @@ static void io_complete_rw_iopoll(structreq_set_fail_links (req); req->result = res;if (res != -EAGAIN ) - req->flags |=REQ_F_IOPOLL_COMPLETED ; +WRITE_ONCE (req->iopoll_completed,1 ); }/*
@@ -1974,7 +1973,7 @@ static void io_iopoll_req_issued(struct* For fast devices, IO may have already completed. If it has, add * it to the front so we find it first. */ -if (req->flags &REQ_F_IOPOLL_COMPLETED ) +if (READ_ONCE (req->iopoll_completed))list_add (&req->list, &ctx->poll_list);else list_add_tail (&req->list, &ctx->poll_list);
@@ -2098,6 +2097,7 @@ static int io_prep_rw(struct io_kiocb *r kiocb->ki_flags |=IOCB_HIPRI ; kiocb->ki_complete = io_complete_rw_iopoll; req->result =0 ; + req->iopoll_completed =0 ; }else {if (kiocb->ki_flags &IOCB_HIPRI )return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 428/477 selinux: fix undefined return of cond_evaluate_expr
In reply to Greg Kroah-HartmanFrom: Tom Rix <[email protected]>
commit 8231b0b9c322c894594fb42eb0eb9f93544a6acc upstream.
clang static analysis reports an undefined return
security/selinux/ss/conditional.c:79:2: warning: Undefined or garbage value returned to caller [core.uninitialized.UndefReturn]
return s[0];
^~~~~~~~~~~static int cond_evaluate_expr( ...
{
u32 i;
int s[COND_EXPR_MAXDEPTH];
for (i = 0; i < expr->len; i++)
...
return s[0];When expr->len is 0, the loop which sets s[0] never runs.
So return -1 if the loop never runs.
--- security/selinux/ss/conditional.c | 3 +++ 1 file changed, 3 insertions(+)
security/selinux/ss/conditional.c +3 -0
@@ -27,6 +27,9 @@ static int cond_evaluate_expr(struct polint s[COND_EXPR_MAXDEPTH ];int sp =-1 ; +if (expr->len ==0 ) +return -1 ; +for (i =0 ; i < expr->len; i++) {struct cond_expr_node *node = &expr->nodes[i];
Greg Kroah-Hartman
maintainerPATCH 424/477 drm/amdgpu/display: use blanked rather than plane state for sync groups
In reply to Greg Kroah-HartmanFrom: Alex Deucher <[email protected]>
commit b7f839d292948142eaab77cedd031aad0bfec872 upstream.
We may end up with no planes set yet, depending on the ordering, but we should have the proper blanking state which is either handled by either DPG or TG depending on the hardware generation. Check both to determine the proper blanked state.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-)
drivers/gpu/drm/amd/display/dc/core/dc.c +20 -4
@@ -1011,9 +1011,17 @@ static void program_timing_sync( } } -/* set first pipe with plane as master */ +/* set first unblanked pipe as master */ for (j =0 ; j < group_size; j++) { -if (pipe_set[j]->plane_state) { +bool is_blanked; + +if (pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked) + is_blanked = + pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked (pipe_set[j]->stream_res.opp); +else + is_blanked = + pipe_set[j]->stream_res.tg->funcs->is_blanked (pipe_set[j]->stream_res.tg); +if (!is_blanked) {if (j ==0 )break ;
@@ -1034,9 +1042,17 @@ static void program_timing_sync( status->timing_sync_info.master = false; } -/* remove any other pipes with plane as they have already been synced */ +/* remove any other unblanked pipes as they have already been synced */ for (j = j +1 ; j < group_size; j++) { -if (pipe_set[j]->plane_state) { +bool is_blanked; + +if (pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked) + is_blanked = + pipe_set[j]->stream_res.opp->funcs->dpg_is_blanked (pipe_set[j]->stream_res.opp); +else + is_blanked = + pipe_set[j]->stream_res.tg->funcs->is_blanked (pipe_set[j]->stream_res.tg); +if (!is_blanked) { group_size--; pipe_set[j] = pipe_set[group_size]; j--;
Greg Kroah-Hartman
maintainerPATCH 423/477 drm/qxl: Use correct notify port address when creating cursor ring
In reply to Greg Kroah-HartmanFrom: Huacai Chen <[email protected]>
commit 80e5f89da3ab949fbbf1cae01dfaea29f5483a75 upstream.
The command ring and cursor ring use different notify port addresses
definition: QXL_IO_NOTIFY_CMD and QXL_IO_NOTIFY_CURSOR. However, in qxl_device_init() we use QXL_IO_NOTIFY_CMD to create both command ring and cursor ring. This doesn't cause any problems now, because QEMU's behaviors on QXL_IO_NOTIFY_CMD and QXL_IO_NOTIFY_CURSOR are the same. However, QEMU's behavior may be change in future, so let's fix it.
P.S.: In the X.org QXL driver, the notify port address of cursor ring
is correct.
--- drivers/gpu/drm/qxl/qxl_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/qxl/qxl_kms.c +1 -1
@@ -218,7 +218,7 @@ int qxl_device_init(struct qxl_device *q &(qdev->ram_header->cursor_ring_hdr),sizeof (struct qxl_command ),QXL_CURSOR_RING_SIZE , - qdev->io_base +QXL_IO_NOTIFY_CMD , + qdev->io_base +QXL_IO_NOTIFY_CURSOR , false, &qdev->cursor_event);
Greg Kroah-Hartman
maintainerPATCH 420/477 sh: Convert iounmap() macros to inline functions
In reply to Greg Kroah-HartmanFrom: Kuninori Morimoto <[email protected]>
commit 4580ba4ad2e6b8ddaada3db61d179d4dfac12047 upstream.
Macro iounmap() do nothing, but that results in
unused variable warnings all over the place.
This patch convert it to inline to avoid warning
We will get this warning without this patch
${LINUX}/drivers/thermal/broadcom/ns-thermal.c:78:21: \
warning: unused variable 'ns_thermal' [-Wunused-variable]
struct ns_thermal *ns_thermal = platform_get_drvdata(pdev);
^~~~~~~~~~--- arch/sh/include/asm/io.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sh/include/asm/io.h +1 -1
@@ -328,7 +328,7 @@ __ioremap_mode(phys_addr_t offset, unsig#else #define __ioremap (offset, size, prot) ((void __iomem *)(offset))#define __ioremap_mode (offset, size, prot) ((void __iomem *)(offset)) -#define iounmap (addr) do { } while (0) +static inline void iounmap (void __iomem *addr) {}#endif /* CONFIG_MMU */ static inline void __iomem *ioremap (phys_addr_t offset,unsigned long size)
Greg Kroah-Hartman
maintainerPATCH 402/477 bnxt_en: Return from timer if interface is not in open state.
In reply to Greg Kroah-HartmanFrom: Vasundhara Volam <[email protected]>
[ Upstream commit e000940473d1423a42ef9c823fb23ccffe3f07ea ]
This will avoid many uneccessary error logs when driver or firmware is in reset.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +1 -1
@@ -10014,7 +10014,7 @@ static void bnxt_timer(struct timer_list *t)struct bnxt *bp =from_timer (bp, t, timer);struct net_device *dev = bp->dev; -if (!netif_running (dev)) +if (!netif_running (dev) || !test_bit (BNXT_STATE_OPEN , &bp->state))return ;if (atomic_read (&bp->intr_sem) !=0 )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 415/477 ext4: fix partial cluster initialization when splitting extent
In reply to Greg Kroah-HartmanFrom: Jeffle Xu <[email protected]>
commit cfb3c85a600c6aa25a2581b3c1c4db3460f14e46 upstream.
Fix the bug when calculating the physical block number of the first block in the split extent.
This bug will cause xfstests shared/298 failure on ext4 with bigalloc enabled occasionally. Ext4 error messages indicate that previously freed blocks are being freed again, and the following fsck will fail due to the inconsistency of block bitmap and bg descriptor.
The following is an example case:
1. First, Initialize a ext4 filesystem with cluster size '16K', block size '4K', in which case, one cluster contains four blocks.
2. Create one file (e.g., xxx.img) on this ext4 filesystem. Now the extent tree of this file is like:
...
36864:[0]4:220160
36868:[0]14332:145408
51200:[0]2:231424
...
3. Then execute PUNCH_HOLE fallocate on this file. The hole range is like:
..ext4_ext_remove_space: dev 254,16 ino 12 since 49506 end 49506 depth 1ext4_ext_remove_space: dev 254,16 ino 12 since 49544 end 49546 depth 1ext4_ext_remove_space: dev 254,16 ino 12 since 49605 end 49607 depth 1
...
4. Then the extent tree of this file after punching is like
...
49507:[0]37:158047
49547:[0]58:158087
...
5. Detailed procedure of punching hole [49544, 49546]
5.1. The block address space:
``` lblk ~49505 49506 49507~49543 49544~49546 49547~ ---------+------+-------------+----------------+-------- extent | hole | extent | hole | extent ---------+------+-------------+----------------+-------- pblk ~158045 158046 158047~158083 158084~158086 158087~ ```
5.2. The detailed layout of cluster 39521:
``` cluster 39521 <-------------------------------> hole extent <----------------------><-------- lblk 49544 49545 49546 49547 +-------+-------+-------+-------+ | | | | | +-------+-------+-------+-------+ pblk 158084 1580845 158086 158087 ```
5.3. The ftrace output when punching hole [49544, 49546]:
- ext4_ext_remove_space (start 49544, end 49546)
- ext4_ext_rm_leaf (start 49544, end 49546, last_extent [49507(158047), 40], partial [pclu 39522 lblk 0 state 2])
- ext4_remove_blocks (extent [49507(158047), 40], from 49544 to 49546, partial [pclu 39522 lblk 0 state 2]
- ext4_free_blocks: (block 158084 count 4)
- ext4_mballoc_free (extent 1/6753/1)
5.4. Ext4 error message in dmesg:
EXT4-fs error (device vdb): mb_free_blocks:1457: group 1, block 158084:freeing already freed block (bit 6753); block bitmap corrupt. EXT4-fs error (device vdb): ext4_mb_generate_buddy:747: group 1, block bitmap and bg descriptor inconsistent: 19550 vs 19551 free clusters
In this case, the whole cluster 39521 is freed mistakenly when freeing pblock 158084~158086 (i.e., the first three blocks of this cluster), although pblock 158087 (the last remaining block of this cluster) has not been freed yet.
The root cause of this isuue is that, the pclu of the partial cluster is calculated mistakenly in ext4_ext_remove_space(). The correct partial_cluster.pclu (i.e., the cluster number of the first block in the next extent, that is, lblock 49597 (pblock 158086)) should be 39521 rather than 39522.
--- fs/ext4/extents.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ext4/extents.c +1 -1
@@ -2827,7 +2827,7 @@ again:* in use to avoid freeing it when removing blocks. */ if (sbi->s_cluster_ratio >1 ) { - pblk =ext4_ext_pblock (ex) + end - ee_block +2 ; + pblk =ext4_ext_pblock (ex) + end - ee_block +1 ; partial.pclu =EXT4_B2C (sbi, pblk); partial.state = nofree; }
Greg Kroah-Hartman
maintainerPATCH 416/477 ext4: avoid utf8_strncasecmp() with unstable name
In reply to Greg Kroah-HartmanFrom: Eric Biggers <[email protected]>
commit 2ce3ee931a097e9720310db3f09c01c825a4580c upstream.
If the dentry name passed to ->d_compare() fits in dentry::d_iname, then it may be concurrently modified by a rename. This can cause undefined behavior (possibly out-of-bounds memory accesses or crashes) in utf8_strncasecmp(), since fs/unicode/ isn't written to handle strings that may be concurrently modified.
Fix this by first copying the filename to a stack buffer if needed. This way we get a stable snapshot of the filename.
--- fs/ext4/dir.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
fs/ext4/dir.c +16 -0
@@ -675,6 +675,7 @@ static int ext4_d_compare(const struct dstruct qstr qstr = {.name = str, .len = len };const struct dentry *parent =READ_ONCE (dentry->d_parent);const struct inode *inode =READ_ONCE (parent->d_inode); +char strbuf[DNAME_INLINE_LEN ];if (!inode || !IS_CASEFOLDED (inode) || !EXT4_SB (inode->i_sb)->s_encoding) {
@@ -683,6 +684,21 @@ static int ext4_d_compare(const struct dreturn memcmp (str, name->name, len); } +/* +* If the dentry name is stored in-line, then it may be concurrently +* modified by a rename. If this happens, the VFS will eventually retry +* the lookup, so it doesn't matter what ->d_compare() returns. +* However, it's unsafe to call utf8_strncasecmp() with an unstable +* string. Therefore, we have to copy the name into a temporary buffer. +*/ +if (len <=DNAME_INLINE_LEN -1 ) { +memcpy (strbuf, str, len); + strbuf[len] =0 ; + qstr.name = strbuf; +/* prevent compiler from optimizing out the temporary buffer */ +barrier (); + } +return ext4_ci_compare (inode, name, &qstr, false); }
Greg Kroah-Hartman
maintainerPATCH 401/477 bnxt_en: Fix AER reset logic on 57500 chips.
In reply to Greg Kroah-HartmanFrom: Michael Chan <[email protected]>
[ Upstream commit 6e2f83884c099de0e87b15a820736e522755d074 ]
AER reset should follow the same steps as suspend/resume. We need to free context memory during AER reset and allocate new context memory during recovery by calling bnxt_hwrm_func_qcaps(). We also need to call bnxt_reenable_sriov() to restore the VFs.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +12 -5
@@ -12160,6 +12160,9 @@ static pci_ers_result_t bnxt_io_error_detected(struct pci_dev *pdev,bnxt_close (netdev);pci_disable_device (pdev); +bnxt_free_ctx_mem (bp); +kfree (bp->ctx); + bp->ctx =NULL ;rtnl_unlock ();/* Request a slot slot reset. */
@@ -12193,12 +12196,16 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)pci_set_master (pdev); err =bnxt_hwrm_func_reset (bp); -if (!err &&netif_running (netdev)) - err =bnxt_open (netdev); - -if (!err) - result =PCI_ERS_RESULT_RECOVERED ; +if (!err) { + err =bnxt_hwrm_func_qcaps (bp); +if (!err &&netif_running (netdev)) + err =bnxt_open (netdev); + }bnxt_ulp_start (bp, err); +if (!err) { +bnxt_reenable_sriov (bp); + result =PCI_ERS_RESULT_RECOVERED ; + } }if (result !=PCI_ERS_RESULT_RECOVERED ) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 375/477 iavf: fix speed reporting over virtchnl
In reply to Greg Kroah-HartmanFrom: Brett Creeley <[email protected]>
[ Upstream commit e0ef26fbe2b0c62f42ba7667076dc38b693b6fb8 ]
Link speeds are communicated over virtchnl using an enum virtchnl_link_speed. Currently, the highest link speed is 40Gbps which leaves us unable to reflect some speeds that an ice VF is capable of. This causes link speed to be misreported on the iavf driver.
Allow for communicating link speeds using Mbps so that the proper speed can be reported for an ice VF. Moving away from the enum allows us to communicate future speed changes without requiring a new enum to be added.
In order to support communicating link speeds over virtchnl in Mbps the following functionality was added:
- Added u32 link_speed_mbps in the iavf_adapter structure.
- Added the macro ADV_LINK_SUPPORT(_a) to determine if the VF driver supports communicating link speeds in Mbps.
- Added the function iavf_get_vpe_link_status() to fill the correct link_status in the event_data union based on the ADV_LINK_SUPPORT(_a) macro.
- Added the function iavf_set_adapter_link_speed_from_vpe() to determine whether or not to fill the u32 link_speed_mbps or enum virtchnl_link_speed link_speed field in the iavf_adapter structure based on the ADV_LINK_SUPPORT(_a) macro.
- Do not free vf_res in iavf_init_get_resources() as vf_res will be accessed in iavf_get_link_ksettings(); memset to 0 instead. This memory is subsequently freed in iavf_remove().
--- drivers/net/ethernet/intel/iavf/iavf.h | 14 +++ .../net/ethernet/intel/iavf/iavf_ethtool.c | 14 ++- drivers/net/ethernet/intel/iavf/iavf_main.c | 25 ++++-- .../net/ethernet/intel/iavf/iavf_virtchnl.c | 88 ++++++++++++++++--- 4 files changed, 120 insertions(+), 21 deletions(-)
drivers/net/ethernet/intel/iavf/iavf.h +14 -0
@@ -87,6 +87,10 @@ struct iavf_vsi {#define IAVF_HLUT_ARRAY_SIZE ((IAVF_VFQF_HLUT_MAX_INDEX + 1) * 4)#define IAVF_MBPS_DIVISOR 125000/* divisor to convert to Mbps */ +#define IAVF_VIRTCHNL_VF_RESOURCE_SIZE (sizeof(struct virtchnl_vf_resource) + \ + (IAVF_MAX_VF_VSI * \ + sizeof(struct virtchnl_vsi_resource))) +/* MAX_MSIX_Q_VECTORS of these are allocated, * but we only use one per queue-specific vector. */
@@ -306,6 +310,14 @@ struct iavf_adapter {bool netdev_registered;bool link_up;enum virtchnl_link_speed link_speed; +/* This is only populated if the VIRTCHNL_VF_CAP_ADV_LINK_SPEED is set +* in vf_res->vf_cap_flags. Use ADV_LINK_SUPPORT macro to determine if +* this field is valid. This field should be used going forward and the +* enum virtchnl_link_speed above should be considered the legacy way of +* storing/communicating link speeds. +*/ +u32 link_speed_mbps; +enum virtchnl_ops current_op;#define CLIENT_ALLOWED (_a) ((_a)->vf_res ? \ (_a)->vf_res->vf_cap_flags & \
@@ -322,6 +334,8 @@ struct iavf_adapter { VIRTCHNL_VF_OFFLOAD_RSS_PF)))#define VLAN_ALLOWED (_a) ((_a)->vf_res->vf_cap_flags & \ VIRTCHNL_VF_OFFLOAD_VLAN) +#define ADV_LINK_SUPPORT (_a) ((_a)->vf_res->vf_cap_flags & \ + VIRTCHNL_VF_CAP_ADV_LINK_SPEED)struct virtchnl_vf_resource *vf_res;/* incl. all VSIs */ struct virtchnl_vsi_resource *vsi_res;/* our LAN VSI */ struct virtchnl_version_info pf_version;
drivers/net/ethernet/intel/iavf/iavf_ethtool.c +12 -2
@@ -278,7 +278,18 @@ static int iavf_get_link_ksettings(struct net_device *netdev,ethtool_link_ksettings_zero_link_mode (cmd, supported); cmd->base.autoneg =AUTONEG_DISABLE ; cmd->base.port =PORT_NONE ; -/* Set speed and duplex */ + cmd->base.duplex =DUPLEX_FULL ; + +if (ADV_LINK_SUPPORT (adapter)) { +if (adapter->link_speed_mbps && + adapter->link_speed_mbps <U32_MAX ) + cmd->base.speed = adapter->link_speed_mbps; +else + cmd->base.speed =SPEED_UNKNOWN ; + +return 0 ; + } +switch (adapter->link_speed) {case IAVF_LINK_SPEED_40GB : cmd->base.speed =SPEED_40000 ;
@@ -306,7 +317,6 @@ static int iavf_get_link_ksettings(struct net_device *netdev,default :break ; } - cmd->base.duplex =DUPLEX_FULL ;return 0 ; }
drivers/net/ethernet/intel/iavf/iavf_main.c +18 -7
@@ -1756,17 +1756,17 @@ static int iavf_init_get_resources(struct iavf_adapter *adapter)struct net_device *netdev = adapter->netdev;struct pci_dev *pdev = adapter->pdev;struct iavf_hw *hw = &adapter->hw; -int err =0 , bufsz; +int err;WARN_ON (adapter->state != __IAVF_INIT_GET_RESOURCES);/* aq msg sent, awaiting reply */ if (!adapter->vf_res) { - bufsz =sizeof (struct virtchnl_vf_resource ) + - (IAVF_MAX_VF_VSI * -sizeof (struct virtchnl_vsi_resource )); - adapter->vf_res =kzalloc (bufsz,GFP_KERNEL ); -if (!adapter->vf_res) + adapter->vf_res =kzalloc (IAVF_VIRTCHNL_VF_RESOURCE_SIZE , +GFP_KERNEL ); +if (!adapter->vf_res) { + err = -ENOMEM ; goto err; + } } err =iavf_get_vf_config (adapter);if (err ==IAVF_ERR_ADMIN_QUEUE_NO_WORK ) {
@@ -2036,7 +2036,7 @@ static void iavf_disable_vf(struct iavf_adapter *adapter)iavf_reset_interrupt_capability (adapter);iavf_free_queues (adapter);iavf_free_q_vectors (adapter); -kfree (adapter->vf_res); +memset (adapter->vf_res,0 ,IAVF_VIRTCHNL_VF_RESOURCE_SIZE );iavf_shutdown_adminq (&adapter->hw); adapter->netdev->flags &= ~IFF_UP ;clear_bit (__IAVF_IN_CRITICAL_TASK, &adapter->crit_section);
@@ -2487,6 +2487,16 @@ static int iavf_validate_tx_bandwidth(struct iavf_adapter *adapter, {int speed =0 , ret =0 ; +if (ADV_LINK_SUPPORT (adapter)) { +if (adapter->link_speed_mbps <U32_MAX ) { + speed = adapter->link_speed_mbps; + goto validate_bw; + }else { +dev_err (&adapter->pdev->dev,"Unknown link speed\n" ); +return -EINVAL ; + } + } +switch (adapter->link_speed) {case IAVF_LINK_SPEED_40GB : speed =40000 ;
@@ -2510,6 +2520,7 @@ static int iavf_validate_tx_bandwidth(struct iavf_adapter *adapter,break ; } +validate_bw:if (max_tx_rate > speed) {dev_err (&adapter->pdev->dev,"Invalid tx rate specified\n" );
drivers/net/ethernet/intel/iavf/iavf_virtchnl.c +76 -12
138 lines not on this page · raw message
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 373/477 NFS: Fix direct WRITE throughput regression
In reply to Greg Kroah-HartmanFrom: Chuck Lever <[email protected]>
[ Upstream commit ba838a75e73f55a780f1ee896b8e3ecb032dba0f ]
I measured a 50% throughput regression for large direct writes.
The observed on-the-wire behavior is that the client sends every NFS WRITE twice: once as an UNSTABLE WRITE plus a COMMIT, and once as a FILE_SYNC WRITE.
This is because the nfs_write_match_verf() check in nfs_direct_commit_complete() fails for every WRITE.
Buffered writes use nfs_write_completion(), which sets req->wb_verf correctly. Direct writes use nfs_direct_write_completion(), which does not set req->wb_verf at all. This leaves req->wb_verf set to all zeroes for every direct WRITE, and thus nfs_direct_commit_completion() always sets NFS_ODIRECT_RESCHED_WRITES.
This fix appears to restore nearly all of the lost performance.
--- fs/nfs/direct.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nfs/direct.c +2 -0
@@ -731,6 +731,8 @@ static void nfs_direct_write_completion(struct nfs_pgio_header *hdr)nfs_list_remove_request (req);if (request_commit) {kref_get (&req->wb_kref); +memcpy (&req->wb_verf, &hdr->verf.verifier, +sizeof (req->wb_verf));nfs_mark_request_commit (req, hdr->lseg, &cinfo, hdr->ds_commit_idx); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 372/477 nfs: set invalid blocks after NFSv4 writes
In reply to Greg Kroah-HartmanFrom: Zheng Bin <[email protected]>
[ Upstream commit 3a39e778690500066b31fe982d18e2e394d3bce2 ]
Use the following command to test nfsv4(size of file1M is 1MB):
mount -t nfs -o vers=4.0,actimeo=60 127.0.0.1/dir1 /mnt cp file1M /mnt
du -h /mnt/file1M -->0 within 60s, then 1M
When write is done(cp file1M /mnt), will call this:nfs_writeback_done
nfs4_write_done
nfs4_write_done_cb
nfs_writeback_update_inode
nfs_post_op_update_inode_force_wcc_locked(change, ctime, mtimenfs_post_op_update_inode_force_wcc_locked
nfs_set_cache_invalid
nfs_refresh_inode_locked
nfs_update_inode
nfsd write response contains change, ctime, mtime, the flag will be clear after nfs_update_inode. Howerver, write response does not contain space_used, previous open response contains space_used whose value is 0, so inode->i_blocks is still 0.
nfs_getattr -->called by "du -h"
do_update |= force_sync || nfs_attribute_cache_expired -->false in 60s cache_validity = READ_ONCE(NFS_I(inode)->cache_validity)
do_update |= cache_validity & (NFS_INO_INVALID_ATTR -->false
if (do_update) {
__nfs_revalidate_inode
}
Within 60s, does not send getattr request to nfsd, thus "du -h /mnt/file1M" is 0.
Add a NFS_INO_INVALID_BLOCKS flag, set it when nfsv4 write is done.
--- fs/nfs/inode.c | 14 +++++++++++--- include/linux/nfs_fs.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-)
fs/nfs/inode.c +11 -3
@@ -833,6 +833,8 @@ int nfs_getattr(const struct path *path, struct kstat *stat, do_update |= cache_validity &NFS_INO_INVALID_ATIME ;if (request_mask & (STATX_CTIME |STATX_MTIME )) do_update |= cache_validity &NFS_INO_REVAL_PAGECACHE ; +if (request_mask &STATX_BLOCKS ) + do_update |= cache_validity &NFS_INO_INVALID_BLOCKS ;if (do_update) {/* Update the attribute cache */ if (!(server->flags &NFS_MOUNT_NOAC ))
@@ -1764,7 +1766,8 @@ out_noforce: status =nfs_post_op_update_inode_locked (inode, fattr,NFS_INO_INVALID_CHANGE |NFS_INO_INVALID_CTIME - |NFS_INO_INVALID_MTIME ); + |NFS_INO_INVALID_MTIME + |NFS_INO_INVALID_BLOCKS );return status; }
@@ -1871,7 +1874,8 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) nfsi->cache_validity &= ~(NFS_INO_INVALID_ATTR |NFS_INO_INVALID_ATIME |NFS_INO_REVAL_FORCED - |NFS_INO_REVAL_PAGECACHE ); + |NFS_INO_REVAL_PAGECACHE + |NFS_INO_INVALID_BLOCKS );/* Do atomic weak cache consistency updates */ nfs_wcc_update_inode (inode, fattr);
@@ -2033,8 +2037,12 @@ static int nfs_update_inode(struct inode *inode, struct nfs_fattr *fattr) inode->i_blocks =nfs_calc_block_size (fattr->du.nfs3.used); }else if (fattr->valid &NFS_ATTR_FATTR_BLOCKS_USED ) inode->i_blocks = fattr->du.nfs2.blocks; -else +else { + nfsi->cache_validity |= save_cache_validity & + (NFS_INO_INVALID_BLOCKS + |NFS_INO_REVAL_FORCED ); cache_revalidated = false; + }/* Update attrtimeo value if we're out of the unstable period */ if (attr_changed) {
include/linux/nfs_fs.h +1 -0
@@ -230,6 +230,7 @@ struct nfs4_copy_state {#define NFS_INO_INVALID_OTHER BIT(12)/* other attrs are invalid */ #define NFS_INO_DATA_INVAL_DEFER \ BIT(13)/* Deferred cache invalidation */ +#define NFS_INO_INVALID_BLOCKS BIT(14)/* cached blocks are invalid */ #define NFS_INO_INVALID_ATTR (NFS_INO_INVALID_CHANGE \ | NFS_INO_INVALID_CTIME \
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 396/477 afs: Set error flag rather than return error from file status decode
In reply to Greg Kroah-HartmanFrom: David Howells <[email protected]>
[ Upstream commit 38355eec6a7d2b8f2f313f9174736dc877744e59 ]
Set a flag in the call struct to indicate an unmarshalling error rather than return and handle an error from the decoding of file statuses. This flag is checked on a successful return from the delivery function.
--- fs/afs/fsclient.c | 88 +++++++++++++--------------------------------- fs/afs/internal.h | 1 + fs/afs/rxrpc.c | 4 +++ fs/afs/yfsclient.c | 85 +++++++++++++------------------------------- 4 files changed, 55 insertions(+), 123 deletions(-)
fs/afs/fsclient.c +25 -63
@@ -56,16 +56,15 @@ static void xdr_dump_bad(const __be32 *bp)/* * decode an AFSFetchStatus block */ -static int xdr_decode_AFSFetchStatus (const __be32 **_bp, -struct afs_call *call, -struct afs_status_cb *scb) +static void xdr_decode_AFSFetchStatus (const __be32 **_bp, +struct afs_call *call, +struct afs_status_cb *scb) {const struct afs_xdr_AFSFetchStatus *xdr = (const void *)*_bp;struct afs_file_status *status = &scb->status;bool inline_error = (call->operation_ID == afs_FS_InlineBulkStatus);u64 data_version, size;u32 type, abort_code; -int ret; abort_code =ntohl (xdr->abort_code);
@@ -79,7 +78,7 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp,*/ status->abort_code = abort_code; scb->have_error = true; - goto good; + goto advance; }pr_warn ("Unknown AFSFetchStatus version %u\n" ,ntohl (xdr->if_version));
@@ -89,7 +88,7 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp,if (abort_code !=0 && inline_error) { status->abort_code = abort_code; scb->have_error = true; - goto good; + goto advance; } type =ntohl (xdr->type);
@@ -125,15 +124,13 @@ static int xdr_decode_AFSFetchStatus(const __be32 **_bp, data_version |= (u64 )ntohl (xdr->data_version_hi) <<32 ; status->data_version = data_version; scb->have_status = true; -good: - ret =0 ; advance: *_bp = (const void *)*_bp +sizeof (*xdr); -return ret; +return ; bad:xdr_dump_bad (*_bp); - ret =afs_protocol_error (call, -EBADMSG , afs_eproto_bad_status); +afs_protocol_error (call, -EBADMSG , afs_eproto_bad_status); goto advance; }
@@ -254,9 +251,7 @@ static int afs_deliver_fs_fetch_status_vnode(struct afs_call *call)/* unmarshall the reply once we've received all of it */ bp = call->buffer; - ret =xdr_decode_AFSFetchStatus (&bp, call, call->out_scb); -if (ret <0 ) -return ret; +xdr_decode_AFSFetchStatus (&bp, call, call->out_scb);xdr_decode_AFSCallBack (&bp, call, call->out_scb);xdr_decode_AFSVolSync (&bp, call->out_volsync);
@@ -419,9 +414,7 @@ static int afs_deliver_fs_fetch_data(struct afs_call *call)return ret; bp = call->buffer; - ret =xdr_decode_AFSFetchStatus (&bp, call, call->out_scb); -if (ret <0 ) -return ret; +xdr_decode_AFSFetchStatus (&bp, call, call->out_scb);xdr_decode_AFSCallBack (&bp, call, call->out_scb);xdr_decode_AFSVolSync (&bp, call->out_volsync);
@@ -577,12 +570,8 @@ static int afs_deliver_fs_create_vnode(struct afs_call *call)/* unmarshall the reply once we've received all of it */ bp = call->buffer;xdr_decode_AFSFid (&bp, call->out_fid); - ret =xdr_decode_AFSFetchStatus (&bp, call, call->out_scb); -if (ret <0 ) -return ret; - ret =xdr_decode_AFSFetchStatus (&bp, call, call->out_dir_scb); -if (ret <0 ) -return ret; +xdr_decode_AFSFetchStatus (&bp, call, call->out_scb); +xdr_decode_AFSFetchStatus (&bp, call, call->out_dir_scb);xdr_decode_AFSCallBack (&bp, call, call->out_scb);xdr_decode_AFSVolSync (&bp, call->out_volsync);
@@ -691,9 +680,7 @@ static int afs_deliver_fs_dir_status_and_vol(struct afs_call *call)/* unmarshall the reply once we've received all of it */ bp = call->buffer; - ret =xdr_decode_AFSFetchStatus (&bp, call, call->out_dir_scb); -if (ret <0 ) -return ret; +xdr_decode_AFSFetchStatus (&bp, call, call->out_dir_scb);xdr_decode_AFSVolSync (&bp, call->out_volsync);_leave (" = 0 [done]" );
@@ -784,12 +771,8 @@ static int afs_deliver_fs_link(struct afs_call *call)/* unmarshall the reply once we've received all of it */ bp = call->buffer; - ret =xdr_decode_AFSFetchStatus (&bp, call, call->out_scb); -if (ret <0 ) -return ret; - ret =xdr_decode_AFSFetchStatus (&bp, call, call->out_dir_scb); -if (ret <0 ) -return ret; +xdr_decode_AFSFetchStatus (&bp, call, call->out_scb); +xdr_decode_AFSFetchStatus (&bp, call, call->out_dir_scb);xdr_decode_AFSVolSync (&bp, call->out_volsync);_leave (" = 0 [done]" );
@@ -878,12 +861,8 @@ static int afs_deliver_fs_symlink(struct afs_call *call)/* unmarshall the reply once we've received all of it */ bp = call->buffer;xdr_decode_AFSFid (&bp, call->out_fid); - ret =xdr_decode_AFSFetchStatus (&bp, call, call->out_scb); -if (ret <0 ) -return ret; - ret =xdr_decode_AFSFetchStatus (&bp, call, call->out_dir_scb); -if (ret <0 ) -return ret; +xdr_decode_AFSFetchStatus (&bp, call, call->out_scb); +xdr_decode_AFSFetchStatus (&bp, call, call->out_dir_scb);xdr_decode_AFSVolSync (&bp, call->out_volsync);_leave (" = 0 [done]" );
@@ -986,16 +965,12 @@ static int afs_deliver_fs_rename(struct afs_call *call)if (ret <0 )return ret; + bp = call->buffer;/* If the two dirs are the same, we have two copies of the same status * report, so we just decode it twice. */ - bp = call->buffer; - ret =xdr_decode_AFSFetchStatus (&bp, call, call->out_dir_scb); -if (ret <0 ) -return ret; - ret =xdr_decode_AFSFetchStatus (&bp, call, call->out_scb); -if (ret <0 ) -return ret; +xdr_decode_AFSFetchStatus (&bp, call, call->out_dir_scb); +xdr_decode_AFSFetchStatus (&bp, call, call->out_scb);xdr_decode_AFSVolSync (&bp, call->out_volsync);_leave (" = 0 [done]" );
@@ -1103,9 +1078,7 @@ static int afs_deliver_fs_store_data(struct afs_call *call)/* unmarshall the reply once we've received all of it */ bp = call->buffer; - ret =xdr_decode_AFSFetchStatus (&bp, call, call->out_scb); -if (ret <0 ) -return ret; +xdr_decode_AFSFetchStatus (&bp, call, call->out_scb);xdr_decode_AFSVolSync (&bp, call->out_volsync);_leave (" = 0 [done]" );
@@ -1283,9 +1256,7 @@ static int afs_deliver_fs_store_status(struct afs_call *call)/* unmarshall the reply once we've received all of it */ bp = call->buffer; - ret =xdr_decode_AFSFetchStatus (&bp, call, call->out_scb); -if (ret <0 ) -return ret; +xdr_decode_AFSFetchStatus (&bp, call, call->out_scb);xdr_decode_AFSVolSync (&bp, call->out_volsync);_leave (" = 0 [done]" );
@@ -1954,9 +1925,7 @@ static int afs_deliver_fs_fetch_status(struct afs_call *call)/* unmarshall the reply once we've received all of it */ bp = call->buffer; - ret =xdr_decode_AFSFetchStatus (&bp, call, call->out_scb); -if (ret <0 ) -return ret; +xdr_decode_AFSFetchStatus (&bp, call, call->out_scb);xdr_decode_AFSCallBack (&bp, call, call->out_scb);xdr_decode_AFSVolSync (&bp, call->out_volsync);
@@ -2062,10 +2031,7 @@ static int afs_deliver_fs_inline_bulk_status(struct afs_call *call) bp = call->buffer; scb = &call->out_scb[call->count]; - ret =xdr_decode_AFSFetchStatus (&bp, call, scb); -if (ret <0 ) -return ret; - +xdr_decode_AFSFetchStatus (&bp, call, scb); call->count++;if (call->count < call->count2) goto more_counts;
@@ -2243,9 +2209,7 @@ static int afs_deliver_fs_fetch_acl(struct afs_call *call)return ret; bp = call->buffer; - ret =xdr_decode_AFSFetchStatus (&bp, call, call->out_scb); -if (ret <0 ) -return ret; +xdr_decode_AFSFetchStatus (&bp, call, call->out_scb);xdr_decode_AFSVolSync (&bp, call->out_volsync); call->unmarshall++;
@@ -2326,9 +2290,7 @@ static int afs_deliver_fs_file_status_and_vol(struct afs_call *call)return ret; bp = call->buffer; - ret =xdr_decode_AFSFetchStatus (&bp, call, call->out_scb); -if (ret <0 ) -return ret; +xdr_decode_AFSFetchStatus (&bp, call, call->out_scb);xdr_decode_AFSVolSync (&bp, call->out_volsync);_leave (" = 0 [done]" );
fs/afs/internal.h +1 -0
@@ -161,6 +161,7 @@ struct afs_call {bool upgrade;/* T to request service upgrade */ bool have_reply_time;/* T if have got reply_time */ bool intr;/* T if interruptible */ +bool unmarshalling_error;/* T if an unmarshalling error occurred */ u16 service_id;/* Actual service ID (after upgrade) */ unsigned int debug_id;/* Trace ID */ u32 operation_ID;/* operation ID for an incoming call */
fs/afs/rxrpc.c +4 -0
@@ -540,6 +540,8 @@ static void afs_deliver_to_call(struct afs_call *call) ret = call->type->deliver (call); state =READ_ONCE (call->state); +if (ret ==0 && call->unmarshalling_error) + ret = -EBADMSG ;switch (ret) {case 0 :afs_queue_call_work (call);
@@ -963,5 +965,7 @@ noinline int afs_protocol_error(struct afs_call *call, int error, enum afs_eproto_cause cause) {trace_afs_protocol_error (call, error, cause); +if (call) + call->unmarshalling_error = true;return error; }
fs/afs/yfsclient.c +25 -60
179 lines not on this page · raw message
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 370/477 nvme-fc: dont call nvme_cleanup_cmd() for AENs
In reply to Greg Kroah-HartmanFrom: Daniel Wagner <[email protected]>
[ Upstream commit c9c12e51b82b2bd0c59ac4e27ee5427f382a503f ]
Asynchronous event notifications do not have an associated request. When fcp_io() fails we unconditionally call nvme_cleanup_cmd() which leads to a crash.
--- drivers/nvme/host/fc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/nvme/host/fc.c +3 -2
@@ -2300,10 +2300,11 @@ nvme_fc_start_fcp_op(struct nvme_fc_ctrl *ctrl, struct nvme_fc_queue *queue, opstate =atomic_xchg (&op->state,FCPOP_STATE_COMPLETE );__nvme_fc_fcpop_chk_teardowns (ctrl, op, opstate); -if (!(op->flags &FCOP_FLAGS_AEN )) +if (!(op->flags &FCOP_FLAGS_AEN )) {nvme_fc_unmap_data (ctrl, op->rq, op); +nvme_cleanup_cmd (op->rq); + } -nvme_cleanup_cmd (op->rq);nvme_fc_ctrl_put (ctrl); if (ctrl->rport->remoteport.port_state == FC_OBJSTATE_ONLINE &&
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 390/477 crypto: marvell/octeontx - Fix a potential NULL dereference
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 1f5b07f5dd1748a6f9363fb1a76d599c74af8231 ]
Smatch reports that:
drivers/crypto/marvell/octeontx/otx_cptvf_algs.c:132 otx_cpt_aead_callback()
warn: variable dereferenced before check 'cpt_info' (see line 121)
This function is called from process_pending_queue() as:
drivers/crypto/marvell/octeontx/otx_cptvf_reqmgr.c
599 /*
600 * Call callback after current pending entry has been 601 * processed, we don't do it if the callback pointer is 602 * invalid. 603 */
604 if (callback)
605 callback(res_code, areq, cpt_info);
It does appear to me that "cpt_info" can be NULL so this could lead to a NULL dereference.
--- drivers/crypto/marvell/octeontx/otx_cptvf_algs.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/crypto/marvell/octeontx/otx_cptvf_algs.c +7 -4
@@ -118,6 +118,9 @@ static void otx_cpt_aead_callback(int status, void *arg1, void *arg2)struct otx_cpt_req_info *cpt_req;struct pci_dev *pdev; +if (!cpt_info) + goto complete; + cpt_req = cpt_info->req;if (!status) {/*
@@ -129,10 +132,10 @@ static void otx_cpt_aead_callback(int status, void *arg1, void *arg2) !cpt_req->is_enc) status =validate_hmac_cipher_null (cpt_req); } -if (cpt_info) { - pdev = cpt_info->pdev; -do_request_cleanup (pdev, cpt_info); - } + pdev = cpt_info->pdev; +do_request_cleanup (pdev, cpt_info); + +complete:if (areq) areq->complete (areq, status); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 391/477 powerpc: Fix kernel crash in show_instructions() w/DEBUG_VIRTUAL
In reply to Greg Kroah-HartmanFrom: Aneesh Kumar K.V <[email protected]>
[ Upstream commit a6e2c226c3d51fd93636320e47cabc8a8f0824c5 ]
With CONFIG_DEBUG_VIRTUAL=y, we can hit a BUG() if we take a hard lockup watchdog interrupt when in OPAL mode.
This happens in show_instructions() if the kernel takes the watchdog NMI IPI, or any other interrupt, with MSR_IR == 0. show_instructions() updates the variable pc in the loop and the second iteration will result in BUG().
We hit the BUG_ON due the below check in __va()
#define __va(x)
({
VIRTUAL_BUG_ON((unsigned long)(x) >= PAGE_OFFSET);
(void *)(unsigned long)((phys_addr_t)(x) | PAGE_OFFSET);
})Fix it by moving the check out of the loop. Also update nip so that the nip == pc check still matches.
--- arch/powerpc/kernel/process.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
arch/powerpc/kernel/process.c +11 -9
@@ -1241,29 +1241,31 @@ struct task_struct *__switch_to(struct task_struct *prev,static void show_instructions (struct pt_regs *regs) {int i; +unsigned long nip = regs->nip;unsigned long pc = regs->nip - (NR_INSN_TO_PRINT *3 /4 *sizeof (int ));printk ("Instruction dump:" ); +/* +* If we were executing with the MMU off for instructions, adjust pc +* rather than printing XXXXXXXX. +*/ +if (!IS_ENABLED (CONFIG_BOOKE ) && !(regs->msr &MSR_IR )) { + pc = (unsigned long )phys_to_virt (pc); + nip = (unsigned long )phys_to_virt (regs->nip); + } +for (i =0 ; i <NR_INSN_TO_PRINT ; i++) {int instr;if (!(i %8 ))pr_cont ("\n" ); -#if !defined(CONFIG_BOOKE ) -/* If executing with the IMMU off, adjust pc rather -* than print XXXXXXXX. -*/ -if (!(regs->msr &MSR_IR )) - pc = (unsigned long )phys_to_virt (pc); -#endif -if (!__kernel_text_address (pc) ||probe_kernel_address ((const void *)pc, instr)) {pr_cont ("XXXXXXXX " ); }else { -if (regs->nip == pc) +if (nip == pc)pr_cont ("<%08x> " , instr);else pr_cont ("%08x " , instr);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 385/477 perf probe: Fix user attribute access in kprobes
In reply to Greg Kroah-HartmanFrom: Sumanth Korikkar <[email protected]>
[ Upstream commit 9256c3031eb9beafa3957c61093104c3c75a6148 ]
Issue:
# perf probe -a 'do_sched_setscheduler pid policy param->sched_priority@user'
did not work before.
Fix:
Make:
# perf probe -a 'do_sched_setscheduler pid policy param->sched_priority@user'
output equivalent to ftrace:
# echo 'p:probe/do_sched_setscheduler _text+517384 pid=%r2:s32 policy=%r3:s32 sched_priority=+u0(%r4):s32' > /sys/kernel/debug/tracing/kprobe_events
Other:
1. Right now, __match_glob() does not handle [u]<offset>. For now, use *u]<offset>.
2. @user attribute was introduced in commit 1e032f7cfa14 ("perf-probe:
Add user memory access attribute support")
Test:
1. perf probe -a 'do_sched_setscheduler pid policy param->sched_priority@user'
2 ./perf script
sched 305669 [000] 1614458.838675: perf_bpf_probe:func: (2904e508) pid=261614 policy=2 sched_priority=1
3. cat /sys/kernel/debug/tracing/trace <...>-309956 [006] .... 1616098.093957: 0: prio: 1
Committer testing:
Before:
# perf probe -a 'do_sched_setscheduler pid policy param->sched_priority@user'
param(type:sched_param) has no member sched_priority@user.
Error: Failed to add events.
# pahole sched_param
struct sched_param {
int sched_priority; /* 0 4 *//* size: 4, cachelines: 1, members: 1 */ /* last cacheline: 4 bytes */ }; #
After:
# perf probe -a 'do_sched_setscheduler pid policy param->sched_priority@user'
Added new event:
probe:do_sched_setscheduler (on do_sched_setscheduler with pid policy sched_priority=param->sched_priority)You can now use it in all perf tools, such as:
perf record -e probe:do_sched_setscheduler -aR sleep 1
# cat /sys/kernel/debug/tracing/kprobe_events p:probe/do_sched_setscheduler _text+1113792 pid=%di:s32 policy=%si:s32 sched_priority=+u0(%dx):s32 #
LPU-Reference: [email protected]
--- tools/perf/util/probe-event.c | 7 +++++-- tools/perf/util/probe-file.c | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-)
tools/perf/util/probe-event.c +5 -2
@@ -1575,7 +1575,7 @@ static int parse_perf_probe_arg(char *str, struct perf_probe_arg *arg) } tmp =strchr (str,'@' ); -if (tmp && tmp != str &&strcmp (tmp +1 ,"user" )) {/* user attr */ +if (tmp && tmp != str && !strcmp (tmp +1 ,"user" )) {/* user attr */ if (!user_access_is_supported ()) {semantic_error ("ftrace does not support user access\n" );return -EINVAL ;
@@ -1995,7 +1995,10 @@ static int __synthesize_probe_trace_arg_ref(struct probe_trace_arg_ref *ref,if (depth <0 )return depth; } - err =strbuf_addf (buf,"%+ld(" , ref->offset); +if (ref->user_access) + err =strbuf_addf (buf,"%s%ld(" ,"+u" , ref->offset); +else + err =strbuf_addf (buf,"%+ld(" , ref->offset);return (err <0 ) ? err : depth; }
tools/perf/util/probe-file.c +1 -1
@@ -1044,7 +1044,7 @@ static struct {DEFINE_TYPE (FTRACE_README_PROBE_TYPE_X ,"*type: * x8/16/32/64,*" ),DEFINE_TYPE (FTRACE_README_KRETPROBE_OFFSET ,"*place (kretprobe): *" ),DEFINE_TYPE (FTRACE_README_UPROBE_REF_CTR ,"*ref_ctr_offset*" ), -DEFINE_TYPE (FTRACE_README_USER_ACCESS ,"*[u]<offset>*" ), +DEFINE_TYPE (FTRACE_README_USER_ACCESS ,"*u]<offset>*" ),DEFINE_TYPE (FTRACE_README_MULTIPROBE_EVENT ,"*Create/append/*" ), DEFINE_TYPE(FTRACE_README_IMMEDIATE_VALUE, "*\\imm-value,*"), };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 380/477 bpf: Undo internal BPF_PROBE_MEM in BPF insns dump
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 29fcb05bbf1a7008900bb9bee347bdbfc7171036 ]
BPF_PROBE_MEM is kernel-internal implmementation details. When dumping BPF instructions to user-space, it needs to be replaced back with BPF_MEM mode.
--- kernel/bpf/syscall.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
kernel/bpf/syscall.c +12 -5
@@ -2924,6 +2924,7 @@ static struct bpf_insn *bpf_insn_prepare_dump(const struct bpf_prog *prog)struct bpf_insn *insns;u32 off, type;u64 imm; +u8 code;int i; insns = kmemdup(prog->insnsi, bpf_prog_insn_size(prog),
@@ -2932,21 +2933,27 @@ static struct bpf_insn *bpf_insn_prepare_dump(const struct bpf_prog *prog)return insns;for (i =0 ; i < prog->len; i++) { -if (insns[i].code == (BPF_JMP |BPF_TAIL_CALL )) { + code = insns[i].code; + +if (code == (BPF_JMP |BPF_TAIL_CALL )) { insns[i].code =BPF_JMP |BPF_CALL ; insns[i].imm = BPF_FUNC_tail_call;/* fall-through */ } -if (insns[i].code == (BPF_JMP |BPF_CALL ) || - insns[i].code == (BPF_JMP |BPF_CALL_ARGS )) { -if (insns[i].code == (BPF_JMP |BPF_CALL_ARGS )) +if (code == (BPF_JMP |BPF_CALL ) || + code == (BPF_JMP |BPF_CALL_ARGS )) { +if (code == (BPF_JMP |BPF_CALL_ARGS )) insns[i].code =BPF_JMP |BPF_CALL ;if (!bpf_dump_raw_ok ()) insns[i].imm =0 ;continue ; } +if (BPF_CLASS (code) ==BPF_LDX &&BPF_MODE (code) ==BPF_PROBE_MEM ) { + insns[i].code =BPF_LDX |BPF_SIZE (code) |BPF_MEM ; +continue ; + } -if (insns[i].code != (BPF_LD |BPF_IMM |BPF_DW )) +if (code != (BPF_LD |BPF_IMM |BPF_DW ))continue ; imm = ((u64 )insns[i +1 ].imm <<32 ) | (u32 )insns[i].imm;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 377/477 bpf: sockmap: Dont attach programs to UDP sockets
In reply to Greg Kroah-HartmanFrom: Lorenz Bauer <[email protected]>
[ Upstream commit f6fede8569689dd31e7b0ed15024b25e5ce2e2e5 ]
The stream parser infrastructure isn't set up to deal with UDP sockets, so we mustn't try to attach programs to them.
I remember making this change at some point, but I must have lost it while rebasing or something similar.
--- net/core/sock_map.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
net/core/sock_map.c +6 -4
@@ -417,10 +417,7 @@ static int sock_map_get_next_key(struct bpf_map *map, void *key, void *next)return 0 ; } -static bool sock_map_redirect_allowed (const struct sock *sk) -{ -return sk->sk_state !=TCP_LISTEN ; -} +static bool sock_map_redirect_allowed (const struct sock *sk);static int sock_map_update_common (struct bpf_map *map,u32 idx,struct sock *sk,u64 flags)
@@ -501,6 +498,11 @@ static bool sk_is_udp(const struct sock *sk) sk->sk_protocol ==IPPROTO_UDP ; } +static bool sock_map_redirect_allowed (const struct sock *sk) +{ +return sk_is_tcp (sk) && sk->sk_state !=TCP_LISTEN ; +} +static bool sock_map_sk_is_suitable (const struct sock *sk) {return sk_is_tcp (sk) ||sk_is_udp (sk);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 368/477 net/filter: Permit reading NET in load_bytes_relative when MAC not set
In reply to Greg Kroah-HartmanFrom: YiFei Zhu <[email protected]>
[ Upstream commit 0f5d82f187e1beda3fe7295dfc500af266a5bd80 ]
Added a check in the switch case on start_header that checks for the existence of the header, and in the case that MAC is not set and the caller requests for MAC, -EFAULT. If the caller requests for NET then MAC's existence is completely ignored.
There is no function to check NET header's existence and as far as cgroup_skb/egress is concerned it should always be set.
Removed for ptr >= the start of header, considering offset is bounded unsigned and should always be true. len <= end - mac is redundant to ptr + len <= end.
--- net/core/filter.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
net/core/filter.c +9 -7
@@ -1766,25 +1766,27 @@ BPF_CALL_5(bpf_skb_load_bytes_relative, const struct sk_buff *, skb, u32, offset, void *, to, u32, len, u32, start_header) {u8 *end =skb_tail_pointer (skb); -u8 *net =skb_network_header (skb); -u8 *mac =skb_mac_header (skb); -u8 *ptr; +u8 *start, *ptr; -if (unlikely (offset >0xffff || len > (end - mac))) +if (unlikely (offset >0xffff )) goto err_clear;switch (start_header) {case BPF_HDR_START_MAC : - ptr = mac + offset; +if (unlikely (!skb_mac_header_was_set (skb))) + goto err_clear; + start =skb_mac_header (skb);break ;case BPF_HDR_START_NET : - ptr = net + offset; + start =skb_network_header (skb);break ;default : goto err_clear; } -if (likely (ptr >= mac && ptr + len <= end)) { + ptr = start + offset; + +if (likely (ptr + len <= end)) {memcpy (to, ptr, len);return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 343/477 NTB: perf: Dont require one more memory window than number of peers
In reply to Greg Kroah-HartmanFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit a9c4211ac918ade1522aced6b5acfbe824722f7d ]
ntb_perf should not require more than one memory window per peer. This was probably an off-by-one error.
--- drivers/ntb/test/ntb_perf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/ntb/test/ntb_perf.c +1 -1
@@ -654,7 +654,7 @@ static int perf_init_service(struct perf_ctx *perf) {u64 mask; -if (ntb_peer_mw_count (perf->ntb) < perf->pcnt +1 ) { +if (ntb_peer_mw_count (perf->ntb) < perf->pcnt) {dev_err (&perf->ntb->dev,"Not enough memory windows\n" );return -EINVAL ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 342/477 NTB: Revert the change to use the NTB device dev for DMA allocations
In reply to Greg Kroah-HartmanFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit 40da7d9a93c8941737ef4a1208d32c13ce017fe1 ]
Commit 417cf39cfea9 ("NTB: Set dma mask and dma coherent mask to NTB devices") started using the NTB device for DMA allocations which was turns out was wrong. If the IOMMU is enabled, such alloctanions will always fail with messages such as:
DMAR: Allocating domain for 0000:02:00.1 failed
This is because the IOMMU has not setup the device for such use.
Change the tools back to using the PCI device for allocations seeing it doesn't make sense to add an IOMMU group for the non-physical NTB device. Also remove the code that sets the DMA mask as it no longer makes sense to do this.
--- drivers/ntb/core.c | 1 - 1 file changed, 1 deletion(-)
drivers/ntb/core.c +0 -1
@@ -311,4 +311,3 @@ static void __exit ntb_driver_exit(void)bus_unregister (&ntb_bus); }module_exit (ntb_driver_exit); -
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 362/477 drm/sun4i: hdmi ddc clk: Fix size of m divider
In reply to Greg Kroah-HartmanFrom: Jernej Skrabec <[email protected]>
[ Upstream commit 54e1e06bcf1cf6e7ac3f86daa5f7454add24b494 ]
m divider in DDC clock register is 4 bits wide. Fix that.
--- drivers/gpu/drm/sun4i/sun4i_hdmi.h | 2 +- drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/sun4i/sun4i_hdmi.h +1 -1
@@ -148,7 +148,7 @@#define SUN4I_HDMI_DDC_CMD_IMPLICIT_WRITE 3#define SUN4I_HDMI_DDC_CLK_REG 0x528 -#define SUN4I_HDMI_DDC_CLK_M (m) (((m) & 0x7) << 3) +#define SUN4I_HDMI_DDC_CLK_M (m) (((m) & 0xf) << 3)#define SUN4I_HDMI_DDC_CLK_N (n) ((n) & 0x7)#define SUN4I_HDMI_DDC_LINE_CTRL_REG 0x540
drivers/gpu/drm/sun4i/sun4i_hdmi_ddc_clk.c +1 -1
@@ -33,7 +33,7 @@ static unsigned long sun4i_ddc_calc_divider(unsigned long rate,unsigned long best_rate =0 ;u8 best_m =0 , best_n =0 , _m, _n; -for (_m =0 ; _m <8 ; _m++) { +for (_m =0 ; _m <16 ; _m++) {for (_n =0 ; _n <8 ; _n++) {unsigned long tmp_rate;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 363/477 libbpf: Handle GCC noreturn-turned-volatile quirk
In reply to Greg Kroah-HartmanFrom: Andrii Nakryiko <[email protected]>
[ Upstream commit 32022fd97ed34f6812802bf1288db27c313576f4 ]
Handle a GCC quirk of emitting extra volatile modifier in DWARF (and subsequently preserved in BTF by pahole) for function pointers marked as __attribute__((noreturn)). This was the way to mark such functions before GCC 2.5 added noreturn attribute. Drop such func_proto modifiers, similarly to how it's done for array (also to handle GCC quirk/bug).
Such volatile attribute is emitted by GCC only, so existing selftests can't express such test. Simple repro is like this (compiled with GCC + BTF generated by pahole):
struct my_struct {
void __attribute__((noreturn)) (*fn)(int);
};
struct my_struct a;Without this fix, output will be:
struct my_struct {
voidvolatile (*fn)(int);
};With the fix:
struct my_struct {
void (*fn)(int);
};--- tools/lib/bpf/btf_dump.c | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-)
tools/lib/bpf/btf_dump.c +24 -9
@@ -1137,6 +1137,20 @@ static void btf_dump_emit_mods(struct btf_dump *d, struct id_stack *decl_stack) } } +static void btf_dump_drop_mods (struct btf_dump *d,struct id_stack *decl_stack) +{ +const struct btf_type *t; +__u32 id; + +while (decl_stack->cnt) { + id = decl_stack->ids[decl_stack->cnt -1 ]; + t =btf__type_by_id (d->btf, id); +if (!btf_is_mod (t)) +return ; + decl_stack->cnt--; + } +} +static void btf_dump_emit_name (const struct btf_dump *d,const char *name,bool last_was_ptr) {
@@ -1235,14 +1249,7 @@ static void btf_dump_emit_type_chain(struct btf_dump *d,* a const/volatile modifier for array, so we are * going to silently skip them here. */ -while (decls->cnt) { - next_id = decls->ids[decls->cnt -1 ]; - next_t =btf__type_by_id (d->btf, next_id); -if (btf_is_mod (next_t)) - decls->cnt--; -else -break ; - } +btf_dump_drop_mods (d, decls);if (decls->cnt ==0 ) {btf_dump_emit_name (d, fname, last_was_ptr);
@@ -1270,7 +1277,15 @@ static void btf_dump_emit_type_chain(struct btf_dump *d,__u16 vlen =btf_vlen (t);int i; -btf_dump_emit_mods (d, decls); +/* +* GCC emits extra volatile qualifier for +* __attribute__((noreturn)) function pointers. Clang +* doesn't do it. It's a GCC quirk for backwards +* compatibility with code written for GCC <2.5. So, +* similarly to extra qualifiers for array, just drop +* them, instead of handling them. +*/ +btf_dump_drop_mods (d, decls);if (decls->cnt) {btf_dump_printf (d," (" );btf_dump_emit_type_chain (d, decls, fname, lvl);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 357/477 ASoC: Intel: bytcr_rt5640: Add quirk for Toshiba Encore WT10-A tablet
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 199a5e8fda54ab3c8c6f6bf980c004e97ebf5ccb ]
The Toshiba Encore WT10-A tablet almost fully works with the default settings for Bay Trail CR devices. The only issue is that it uses a digital mic. connected the the DMIC1 input instead of an analog mic.
Add a quirk for this model using the default settings with the input-map replaced with BYT_RT5640_DMIC1_MAP.
--- sound/soc/intel/boards/bytcr_rt5640.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/soc/intel/boards/bytcr_rt5640.c +12 -0
@@ -754,6 +754,18 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {BYT_RT5640_JD_NOT_INV | BYT_RT5640_MCLK_EN), }, + { /* Toshiba Encore WT10-A */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"TOSHIBA" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "TOSHIBA WT10-A-103"), + }, + .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | +BYT_RT5640_JD_SRC_JD1_IN4P | +BYT_RT5640_OVCD_TH_2000UA | +BYT_RT5640_OVCD_SF_0P75 | +BYT_RT5640_SSP0_AIF2 | + BYT_RT5640_MCLK_EN), + }, { /* Catch-all for generic Insyde tablets, must be last */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 355/477 ASoC: core: only convert non DPCM link to DPCM link
In reply to Greg Kroah-HartmanFrom: Bard Liao <[email protected]>
[ Upstream commit 607fa205a7e4dfad28b8a67ab1c985756ddbccb0 ]
Additional checks for valid DAIs expose a corner case, where existing BE dailinks get modified, e.g. HDMI links are tagged with dpcm_capture=1 even if the DAIs are for playback.
This patch makes those changes conditional and flags configuration issues when a BE dailink is has no_pcm=0 but dpcm_playback or dpcm_capture=1 (which makes no sense).
As discussed on the alsa-devel mailing list, there are redundant flags for dpcm_playback, dpcm_capture, playback_only, capture_only. This will have to be cleaned-up in a future update. For now only correct and flag problematic configurations.
--- sound/soc/soc-core.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-)
sound/soc/soc-core.c +19 -3
@@ -1720,9 +1720,25 @@ match: dai_link->platforms->name = component->name;/* convert non BE into BE */ - dai_link->no_pcm =1 ; - dai_link->dpcm_playback =1 ; - dai_link->dpcm_capture =1 ; +if (!dai_link->no_pcm) { + dai_link->no_pcm =1 ; + +if (dai_link->dpcm_playback) +dev_warn (card->dev, +"invalid configuration, dailink %s has flags no_pcm=0 and dpcm_playback=1\n" , + dai_link->name); +if (dai_link->dpcm_capture) +dev_warn (card->dev, +"invalid configuration, dailink %s has flags no_pcm=0 and dpcm_capture=1\n" , + dai_link->name); + +/* convert normal link into DPCM one */ +if (!(dai_link->dpcm_playback || + dai_link->dpcm_capture)) { + dai_link->dpcm_playback = !dai_link->capture_only; + dai_link->dpcm_capture = !dai_link->playback_only; + } + }/* override any BE fixups */ dai_link->be_hw_params_fixup =
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 356/477 ASoC: SOF: nocodec: conditionally set dpcm_capture/dpcm_playback flags
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit ba4e5abc6c4e173af7c941c03c067263b686665d ]
With additional checks on dailinks, we see errors such as
[ 3.000418] sof-nocodec sof-nocodec: CPU DAI DMIC01 Pin for rtd
NoCodec-6 does not support playback
It's not clear why we set the dpcm_playback and dpcm_capture flags unconditionally, add a check on number of channels for each direction to avoid invalid configurations.
--- sound/soc/sof/nocodec.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/soc/sof/nocodec.c +4 -2
@@ -52,8 +52,10 @@ static int sof_nocodec_bes_setup(struct device *dev, links[i].platforms->name =dev_name (dev); links[i].codecs->dai_name ="snd-soc-dummy-dai" ; links[i].codecs->name ="snd-soc-dummy" ; - links[i].dpcm_playback =1 ; - links[i].dpcm_capture =1 ; +if (ops->drv[i].playback.channels_min) + links[i].dpcm_playback =1 ; +if (ops->drv[i].capture.channels_min) + links[i].dpcm_capture =1 ; } card->dai_link = links;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 336/477 net: dp83867: Fix OF_MDIO config check
In reply to Greg Kroah-HartmanFrom: Dan Murphy <[email protected]>
[ Upstream commit 506de00677b84dfc6718cbbd3495b1d90df5d098 ]
When CONFIG_OF_MDIO is set to be a module the code block is not compiled. Use the IS_ENABLED macro that checks for both built in as well as module.
--- drivers/net/phy/dp83867.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/phy/dp83867.c +1 -1
@@ -488,7 +488,7 @@ static int dp83867_verify_rgmii_cfg(struct phy_device *phydev)return 0 ; } -#ifdef CONFIG_OF_MDIO +#if IS_ENABLED (CONFIG_OF_MDIO )static int dp83867_of_init (struct phy_device *phydev) {struct dp83867_private *dp83867 = phydev->priv;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 346/477 NTB: ntb_test: Fix bug when counting remote files
In reply to Greg Kroah-HartmanFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit 2130c0ba69d69bb21f5c52787f2587db00d13d8a ]
When remote files are counted in get_files_count, without using SSH, the code returns 0 because there is a colon prepended to $LOC. $VPATH should have been used instead of $LOC.
--- tools/testing/selftests/ntb/ntb_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/ntb/ntb_test.sh +1 -1
@@ -241,7 +241,7 @@ function get_files_count() split_remote $LOC if [[ "$REMOTE" == "" ]]; then - echo $(ls -1 "$LOC"/${NAME}* 2>/dev/null | wc -l) + echo $(ls -1 "$VPATH"/${NAME}* 2>/dev/null | wc -l) else echo $(ssh "$REMOTE" "ls -1 \"$VPATH\"/${NAME}* | \ wc -l" 2> /dev/null)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 345/477 NTB: perf: Fix race condition when run with ntb_test
In reply to Greg Kroah-HartmanFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit 34d8673a01b053b6231a995a4eec9341163d63be ]
When running ntb_test, the script tries to run the ntb_perf test immediately after probing the modules. Since adding multi-port support, this fails seeing the new initialization procedure in ntb_perf can not complete instantly.
To fix this we add a completion which is waited on when a test is started. In this way, run can be written any time after the module is loaded and it will wait for the initialization to complete instead of sending an error.
--- drivers/ntb/test/ntb_perf.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/ntb/test/ntb_perf.c +8 -2
@@ -159,6 +159,8 @@ struct perf_peer {/* NTB connection setup service */ struct work_struct service;unsigned long sts; + +struct completion init_comp; };#define to_peer_service (__work) \ container_of(__work, struct perf_peer, service)
@@ -547,6 +549,7 @@ static int perf_setup_outbuf(struct perf_peer *peer)/* Initialization is finally done */ set_bit (PERF_STS_DONE , &peer->sts); +complete_all (&peer->init_comp);return 0 ; }
@@ -638,6 +641,7 @@ static void perf_service_work(struct work_struct *work)perf_setup_outbuf (peer);if (test_and_clear_bit (PERF_CMD_CLEAR , &peer->sts)) { +init_completion (&peer->init_comp);clear_bit (PERF_STS_DONE , &peer->sts);if (test_bit (0 , &peer->perf->busy_flag) && peer == peer->perf->test_peer) {
@@ -1084,8 +1088,9 @@ static int perf_submit_test(struct perf_peer *peer)struct perf_thread *pthr;int tidx, ret; -if (!test_bit (PERF_STS_DONE , &peer->sts)) -return -ENOLINK ; + ret =wait_for_completion_interruptible (&peer->init_comp); +if (ret <0 ) +return ret;if (test_and_set_bit_lock (0 , &perf->busy_flag))return -EBUSY ;
@@ -1456,6 +1461,7 @@ static int perf_init_peers(struct perf_ctx *perf) peer->gidx = pidx; }INIT_WORK (&peer->service, perf_service_work); +init_completion (&peer->init_comp); }if (perf->gidx ==-1 ) perf->gidx = pidx;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 344/477 NTB: perf: Fix support for hardware that doesnt have port numbers
In reply to Greg Kroah-HartmanFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit b54369a248c2e033bfcf5d6917e08cf9d73d54a6 ]
Legacy drivers do not have port numbers (but is reliably only two ports) and was broken by the recent commit that added mult-port support to ntb_perf. This is especially important to support the cross link topology which is perfectly symmetric and cannot assign unique port numbers easily.
Hardware that returns zero for both the local port and the peer should just always use gidx=0 for the only peer.
--- drivers/ntb/test/ntb_perf.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/ntb/test/ntb_perf.c +10 -0
@@ -1460,6 +1460,16 @@ static int perf_init_peers(struct perf_ctx *perf)if (perf->gidx ==-1 ) perf->gidx = pidx; +/* +* Hardware with only two ports may not have unique port +* numbers. In this case, the gidxs should all be zero. +*/ +if (perf->pcnt ==1 &&ntb_port_number (perf->ntb) ==0 && +ntb_peer_port_number (perf->ntb,0 ) ==0 ) { + perf->gidx =0 ; + perf->peers[0 ].gidx =0 ; + } +for (pidx =0 ; pidx < perf->pcnt; pidx++) { ret =perf_setup_peer_mw (&perf->peers[pidx]);if (ret)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 308/477 ceph: dont return -ESTALE if theres still an open file
In reply to Greg Kroah-HartmanFrom: Luis Henriques <[email protected]>
[ Upstream commit 878dabb64117406abd40977b87544d05bb3031fc ]
Similarly to commit 03f219041fdb ("ceph: check i_nlink while converting a file handle to dentry"), this fixes another corner case with name_to_handle_at/open_by_handle_at. The issue has been detected by xfstest generic/467, when doing:
- name_to_handle_at("/cephfs/myfile")
- open("/cephfs/myfile")
- unlink("/cephfs/myfile")
- sync; sync;
- drop caches
- open_by_handle_at()
The call to open_by_handle_at should not fail because the file hasn't been deleted yet (only unlinked) and we do have a valid handle to it. -ESTALE shall be returned only if i_nlink is 0 *and* i_count is 1.
This patch also makes sure we have LINK caps before checking i_nlink.
--- fs/ceph/export.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
fs/ceph/export.c +8 -1
@@ -172,9 +172,16 @@ struct inode *ceph_lookup_inode(struct super_block *sb, u64 ino)static struct dentry *__fh_to_dentry (struct super_block *sb,u64 ino) {struct inode *inode =__lookup_inode (sb, ino); +int err; +if (IS_ERR (inode))return ERR_CAST (inode); -if (inode->i_nlink ==0 ) { +/* We need LINK caps to reliably check i_nlink */ + err =ceph_do_getattr (inode,CEPH_CAP_LINK_SHARED , false); +if (err) +return ERR_PTR (err); +/* -ESTALE if inode as been unlinked and no file is open */ +if ((inode->i_nlink ==0 ) && (atomic_read (&inode->i_count) ==1 )) {iput (inode);return ERR_PTR (-ESTALE ); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 307/477 drm/nouveau/disp/gm200-: fix NV_PDISP_SOR_HDMI2_CTRL(n) selection
In reply to Greg Kroah-HartmanFrom: Ben Skeggs <[email protected]>
[ Upstream commit a1ef8bad506e4ffa0c57ac5f8cb99ab5cbc3b1fc ]
This is a SOR register, and not indexed by the bound head.
Fixes display not coming up on high-bandwidth HDMI displays under a number of configurations.
--- drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nvkm/engine/disp/hdmigm200.c +2 -2
@@ -27,10 +27,10 @@ void gm200_hdmi_scdc(struct nvkm_ior *ior, int head, u8 scdc) { struct nvkm_device *device = ior->disp->engine.subdev.device; -const u32 hoff = head *0x800 ; +const u32 soff =nv50_ior_base (ior);const u32 ctrl = scdc &0x3 ; -nvkm_mask (device,0x61c5bc + hoff,0x00000003 , ctrl); +nvkm_mask (device,0x61c5bc + soff,0x00000003 , ctrl); ior->tmds.high_speed = !!(scdc &0x2 ); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 328/477 lib/zlib: remove outdated and incorrect pre-increment optimization
In reply to Greg Kroah-HartmanFrom: Jann Horn <[email protected]>
[ Upstream commit acaab7335bd6f0c0b54ce3a00bd7f18222ce0f5f ]
The zlib inflate code has an old micro-optimization based on the assumption that for pre-increment memory accesses, the compiler will generate code that fits better into the processor's pipeline than what would be generated for post-increment memory accesses.
This optimization was already removed in upstream zlib in 2016:
https://github.com/madler/zlib/commit/9aaec95e8211
This optimization causes UB according to C99, which says in section 6.5.6 "Additive operators": "If both the pointer operand and the result point to elements of the same array object, or one past the last element of the array object, the evaluation shall not produce an overflow; otherwise, the behavior is undefined".
This UB is not only a theoretical concern, but can also cause trouble for future work on compiler-based sanitizers.
According to the zlib commit, this optimization also is not optimal anymore with modern compilers.
Replace uses of OFF, PUP and UP_UNALIGNED with their definitions in the POSTINC case, and remove the macro definitions, just like in the upstream patch.
--- lib/zlib_inflate/inffast.c | 91 +++++++++++++++----------------------- 1 file changed, 35 insertions(+), 56 deletions(-)
lib/zlib_inflate/inffast.c +35 -56
@@ -10,17 +10,6 @@ #ifndef ASMINF -/* Allow machine dependent optimization for post-increment or pre-increment. - Based on testing to date, - Pre-increment preferred for: - - PowerPC G3 (Adler) - - MIPS R5000 (Randers-Pehrson) - Post-increment preferred for: - - none - No measurable difference: - - Pentium III (Anderson) - - M68060 (Nikl) - */ union uu { unsigned short us; unsigned char b[2];
@@ -38,16 +27,6 @@ get_unaligned16(const unsigned short *p)return mm.us; } -#ifdef POSTINC -# define OFF 0 -# define PUP (a) *(a)++ -# define UP_UNALIGNED (a) get_unaligned16((a)++) -#else -# define OFF 1 -# define PUP (a) *++(a) -# define UP_UNALIGNED (a) get_unaligned16(++(a)) -#endif -/* Decode literal, length, and distance codes and write out the resulting literal and match bytes until either not enough input or output is
@@ -115,9 +94,9 @@ void inflate_fast(z_streamp strm, unsigned start)/* copy state to local variables */ state = (struct inflate_state *)strm->state; - in = strm->next_in -OFF ; + in = strm->next_in; last = in + (strm->avail_in -5 ); - out = strm->next_out -OFF ; + out = strm->next_out; beg = out - (start - strm->avail_out); end = out + (strm->avail_out -257 );#ifdef INFLATE_STRICT
@@ -138,9 +117,9 @@ void inflate_fast(z_streamp strm, unsigned start)input data or output space */ do { if (bits < 15) { - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; - hold += (unsigned long)(PUP(in)) << bits; + hold += (unsigned long)(*in++) << bits; bits += 8; } this = lcode[hold & lmask];
@@ -150,14 +129,14 @@ void inflate_fast(z_streamp strm, unsigned start) bits -= op; op = (unsigned )(this.op);if (op ==0 ) {/* literal */ -PUP (out) = (unsigned char )(this.val); + *out++ = (unsigned char )(this.val); }else if (op &16 ) {/* length base */ len = (unsigned )(this.val); op &=15 ;/* number of extra bits */ if (op) {if (bits < op) { - hold += (unsigned long )(PUP (in)) << bits; + hold += (unsigned long )(*in++) << bits; bits +=8 ; } len += (unsigned )hold & ((1U << op) -1 );
@@ -165,9 +144,9 @@ void inflate_fast(z_streamp strm, unsigned start) bits -= op; }if (bits <15 ) { - hold += (unsigned long )(PUP (in)) << bits; + hold += (unsigned long )(*in++) << bits; bits +=8 ; - hold += (unsigned long )(PUP (in)) << bits; + hold += (unsigned long )(*in++) << bits; bits +=8 ; } this = dcode[hold & dmask];
@@ -180,10 +159,10 @@ void inflate_fast(z_streamp strm, unsigned start) dist = (unsigned )(this.val); op &=15 ;/* number of extra bits */ if (bits < op) { - hold += (unsigned long )(PUP (in)) << bits; + hold += (unsigned long )(*in++) << bits; bits +=8 ;if (bits < op) { - hold += (unsigned long )(PUP (in)) << bits; + hold += (unsigned long )(*in++) << bits; bits +=8 ; } }
@@ -205,13 +184,13 @@ void inflate_fast(z_streamp strm, unsigned start) state->mode =BAD ;break ; } - from = window -OFF ; + from = window;if (write ==0 ) {/* very common case */ from += wsize - op;if (op < len) {/* some from window */ len -= op;do { -PUP (out) =PUP (from); + *out++ = *from++; }while (--op); from = out - dist;/* rest from output */ }
@@ -222,14 +201,14 @@ void inflate_fast(z_streamp strm, unsigned start)if (op < len) {/* some from end of window */ len -= op;do { -PUP (out) =PUP (from); + *out++ = *from++; }while (--op); - from = window -OFF ; + from = window;if (write < len) {/* some from start of window */ op = write; len -= op;do { -PUP (out) =PUP (from); + *out++ = *from++; }while (--op); from = out - dist;/* rest from output */ }
@@ -240,21 +219,21 @@ void inflate_fast(z_streamp strm, unsigned start)if (op < len) {/* some from window */ len -= op;do { -PUP (out) =PUP (from); + *out++ = *from++; }while (--op); from = out - dist;/* rest from output */ } }while (len >2 ) { -PUP (out) =PUP (from); -PUP (out) =PUP (from); -PUP (out) =PUP (from); + *out++ = *from++; + *out++ = *from++; + *out++ = *from++; len -=3 ; }if (len) { -PUP (out) =PUP (from); + *out++ = *from++;if (len >1 ) -PUP (out) =PUP (from); + *out++ = *from++; } }else {
@@ -264,29 +243,29 @@ void inflate_fast(z_streamp strm, unsigned start) from = out - dist;/* copy direct from output */ /* minimum length is three */ /* Align out addr */ -if (!((long )(out -1 +OFF ) &1 )) { -PUP (out) =PUP (from); +if (!((long )(out -1 ) &1 )) { + *out++ = *from++; len--; } - sout = (unsigned short *)(out -OFF ); + sout = (unsigned short *)(out);if (dist >2 ) {unsigned short *sfrom; - sfrom = (unsigned short *)(from -OFF ); + sfrom = (unsigned short *)(from); loops = len >>1 ; do#ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS -PUP (sout) =PUP (sfrom); + *sout++ = *sfrom++;#else -PUP (sout) =UP_UNALIGNED (sfrom); + *sout++ =get_unaligned16 (sfrom++);#endif while (--loops); - out = (unsigned char *)sout +OFF ; - from = (unsigned char *)sfrom +OFF ; + out = (unsigned char *)sout; + from = (unsigned char *)sfrom; }else {/* dist == 1 or dist == 2 */ unsigned short pat16; - pat16 = *(sout-1 +OFF ); + pat16 = *(sout-1 );if (dist ==1 ) {union uu mm;/* copy one char pattern to both bytes */
@@ -296,12 +275,12 @@ void inflate_fast(z_streamp strm, unsigned start) } loops = len >>1 ;do -PUP (sout) = pat16; + *sout++ = pat16;while (--loops); - out = (unsigned char *)sout +OFF ; + out = (unsigned char *)sout; }if (len &1 ) -PUP (out) =PUP (from); + *out++ = *from++; } }else if ((op &64 ) ==0 ) {/* 2nd level distance code */
@@ -336,8 +315,8 @@ void inflate_fast(z_streamp strm, unsigned start) hold &= (1U << bits) -1 ;/* update state and return */ - strm->next_in = in +OFF ; - strm->next_out = out +OFF ; + strm->next_in = in; + strm->next_out = out; strm->avail_in = (unsigned )(in < last ?5 + (last - in) :5 - (in - last)); strm->avail_out = (unsigned )(out < end ?257 + (end - out) :257 - (out - end));
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 329/477 include/linux/bitops.h: avoid clang shift-count-overflow warnings
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit bd93f003b7462ae39a43c531abca37fe7073b866 ]
Clang normally does not warn about certain issues in inline functions when it only happens in an eliminated code path. However if something else goes wrong, it does tend to complain about the definition of hweight_long() on 32-bit targets:
include/linux/bitops.h:75:41: error: shift count >= width of type [-Werror,-Wshift-count-overflow]
return sizeof(w) == 4 ? hweight32(w) : hweight64(w);
^~~~~~~~~~~~
include/asm-generic/bitops/const_hweight.h:29:49: note: expanded from macro 'hweight64'
define hweight64(w) (__builtin_constant_p(w) ? __const_hweight64(w) : __arch_hweight64(w))
^~~~~~~~~~~~~~~~~~~~
include/asm-generic/bitops/const_hweight.h:21:76: note: expanded from macro '__const_hweight64'
define __const_hweight64(w) (__const_hweight32(w) + __const_hweight32((w) >> 32))
^ ~~
include/asm-generic/bitops/const_hweight.h:20:49: note: expanded from macro '__const_hweight32'
define __const_hweight32(w) (__const_hweight16(w) + __const_hweight16((w) >> 16))
^
include/asm-generic/bitops/const_hweight.h:19:72: note: expanded from macro '__const_hweight16'
define __const_hweight16(w) (__const_hweight8(w) + __const_hweight8((w) >> 8 ))
^
include/asm-generic/bitops/const_hweight.h:12:9: note: expanded from macro '__const_hweight8'
(!!((w) & (1ULL << 2))) + \Adding an explicit cast to __u64 avoids that warning and makes it easier to read other output.
--- include/linux/bitops.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/bitops.h +1 -1
@@ -72,7 +72,7 @@ static inline int get_bitmask_order(unsigned int count)static __always_inline unsigned long hweight_long (unsigned long w) { -return sizeof (w) ==4 ?hweight32 (w) :hweight64 (w); +return sizeof (w) ==4 ?hweight32 (w) :hweight64 ((__u64 )w); }/**
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 320/477 RDMA/cm: Spurious WARNING triggered in cm_destroy_id()
In reply to Greg Kroah-HartmanFrom: Ka-Cheong Poon <[email protected]>
[ Upstream commit fba97dc7fc76b2c9a909fa0b3786d30a9899f5cf ]
If the cm_id state is IB_CM_REP_SENT when cm_destroy_id() is called, it calls cm_send_rej_locked().
In cm_send_rej_locked(), it calls cm_enter_timewait() and the state is changed to IB_CM_TIMEWAIT.
Now back to cm_destroy_id(), it breaks from the switch statement, and the next call is WARN_ON(cm_id->state != IB_CM_IDLE).
This triggers a spurious warning. Instead, the code should goto retest after returning from cm_send_rej_locked() to move the state to IDLE.
--- drivers/infiniband/core/cm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/core/cm.c +3 -1
@@ -1076,7 +1076,9 @@ retest:case IB_CM_REP_SENT :case IB_CM_MRA_REP_RCVD :ib_cancel_mad (cm_id_priv->av.port->mad_agent, cm_id_priv->msg); -/* Fall through */ +cm_send_rej_locked (cm_id_priv,IB_CM_REJ_CONSUMER_DEFINED ,NULL , +0 ,NULL ,0 ); + goto retest;case IB_CM_MRA_REQ_SENT :case IB_CM_REP_RCVD :case IB_CM_MRA_REP_SENT :
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 318/477 pinctrl: freescale: imx: Use devm_of_iomap() to avoid a resource leak in case of error in imx_pinctrl_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit ba403242615c2c99e27af7984b1650771a2cc2c9 ]
Use 'devm_of_iomap()' instead 'of_iomap()' to avoid a resource leak in case of error.
Update the error handling code accordingly.
--- drivers/pinctrl/freescale/pinctrl-imx.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/pinctrl/freescale/pinctrl-imx.c +4 -3
@@ -824,12 +824,13 @@ int imx_pinctrl_probe(struct platform_device *pdev,return -EINVAL ; } - ipctl->input_sel_base =of_iomap (np,0 ); + ipctl->input_sel_base =devm_of_iomap (&pdev->dev, np, +0 ,NULL );of_node_put (np); -if (!ipctl->input_sel_base) { +if (IS_ERR (ipctl->input_sel_base)) {dev_err (&pdev->dev,"iomuxc input select base address not found\n" ); -return -ENOMEM ; +return PTR_ERR (ipctl->input_sel_base); } } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 316/477 pinctrl: sirf: add missing put_device() call in sirfsoc_gpio_probe()
In reply to Greg Kroah-HartmanFrom: yu kuai <[email protected]>
[ Upstream commit 66339f2fba3fa05b0507e1887e4c6abcfc6228a3 ]
A coccicheck run provided information like the following:
drivers/pinctrl/sirf/pinctrl-sirf.c:798:2-8: ERROR: missing put_device; call of_find_device_by_node on line 792, but without a corresponding object release within this function.
Generated by: scripts/coccinelle/free/put_device.cocci
Thus add a jump target to fix the exception handling for this function implementation.
--- drivers/pinctrl/sirf/pinctrl-sirf.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
drivers/pinctrl/sirf/pinctrl-sirf.c +14 -6
@@ -794,13 +794,17 @@ static int sirfsoc_gpio_probe(struct device_node *np)return -ENODEV ; sgpio =devm_kzalloc (&pdev->dev,sizeof (*sgpio),GFP_KERNEL ); -if (!sgpio) -return -ENOMEM ; +if (!sgpio) { + err = -ENOMEM ; + goto out_put_device; + }spin_lock_init (&sgpio->lock); regs =of_iomap (np,0 ); -if (!regs) -return -ENOMEM ; +if (!regs) { + err = -ENOMEM ; + goto out_put_device; + } sgpio->chip.gc.request = sirfsoc_gpio_request; sgpio->chip.gc.free = sirfsoc_gpio_free;
@@ -824,8 +828,10 @@ static int sirfsoc_gpio_probe(struct device_node *np) girq->parents =devm_kcalloc (&pdev->dev,SIRFSOC_GPIO_NO_OF_BANKS ,sizeof (*girq->parents),GFP_KERNEL ); -if (!girq->parents) -return -ENOMEM ; +if (!girq->parents) { + err = -ENOMEM ; + goto out_put_device; + }for (i =0 ; i <SIRFSOC_GPIO_NO_OF_BANKS ; i++) { bank = &sgpio->sgpio_bank[i];spin_lock_init (&bank->lock);
@@ -868,6 +874,8 @@ out_no_range:gpiochip_remove (&sgpio->chip.gc); out:iounmap (regs); +out_put_device: +put_device (&pdev->dev);return err; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 273/477 powerpc/32s: Dont warn when mapping RO data ROX.
In reply to Greg Kroah-HartmanFrom: Christophe Leroy <[email protected]>
[ Upstream commit 4b19f96a81bceaf0bcf44d79c0855c61158065ec ]
Mapping RO data as ROX is not an issue since that data cannot be modified to introduce an exploit.
PPC64 accepts to have RO data mapped ROX, as a trade off between kernel size and strictness of protection.
On PPC32, kernel size is even more critical as amount of memory is usually small.
Depending on the number of available IBATs, the last IBATs might overflow the end of text. Only warn if it crosses the end of RO data.
--- arch/powerpc/mm/book3s32/mmu.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/mm/book3s32/mmu.c +4 -2
@@ -187,6 +187,7 @@ void mmu_mark_initmem_nx(void)int i;unsigned long base = (unsigned long )_stext -PAGE_OFFSET ;unsigned long top = (unsigned long )_etext -PAGE_OFFSET ; +unsigned long border = (unsigned long )__init_begin -PAGE_OFFSET ;unsigned long size;if (IS_ENABLED (CONFIG_PPC_BOOK3S_601 ))
@@ -201,9 +202,10 @@ void mmu_mark_initmem_nx(void) size =block_size (base, top); size =max (size,128UL <<10 );if ((top - base) > size) { -if (strict_kernel_rwx_enabled ()) -pr_warn ("Kernel _etext not properly aligned\n" ); size <<=1 ; +if (strict_kernel_rwx_enabled () && base + size > border) +pr_warn ("Some RW data is getting mapped X. " +"Adjust CONFIG_DATA_SHIFT to avoid that.\n" ); }setibat (i++,PAGE_OFFSET + base, base, size,PAGE_KERNEL_TEXT ); base += size;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 267/477 RDMA/iw_cxgb4: cleanup device debugfs entries on ULD remove
In reply to Greg Kroah-HartmanFrom: Potnuri Bharat Teja <[email protected]>
[ Upstream commit 49ea0c036ede81f126f1a9389d377999fdf5c5a1 ]
Remove device specific debugfs entries immediately if LLD detaches a particular ULD device in case of fatal PCI errors.
--- drivers/infiniband/hw/cxgb4/device.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/cxgb4/device.c +1 -0
@@ -953,6 +953,7 @@ void c4iw_dealloc(struct uld_ctx *ctx)static void c4iw_remove (struct uld_ctx *ctx) {pr_debug ("c4iw_dev %p\n" , ctx->dev); +debugfs_remove_recursive (ctx->dev->debugfs_root);c4iw_unregister_device (ctx->dev);c4iw_dealloc (ctx); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 275/477 ASoC: fix incomplete error-handling in img_i2s_in_probe.
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit 25bf943e4e7b47282bd86ae7d39e039217ebb007 ]
Function "pm_runtime_get_sync()" is not handled by "pm_runtime_put()" if "PTR_ERR(rst) == -EPROBE_DEFER". Fix this issue by adding "pm_runtime_put()" into this error path.
--- sound/soc/img/img-i2s-in.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/img/img-i2s-in.c +1 -0
@@ -482,6 +482,7 @@ static int img_i2s_in_probe(struct platform_device *pdev)if (IS_ERR (rst)) {if (PTR_ERR (rst) == -EPROBE_DEFER ) { ret = -EPROBE_DEFER ; +pm_runtime_put (&pdev->dev); goto err_suspend; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 270/477 mfd: stmfx: Fix stmfx_irq_init error path
In reply to Greg Kroah-HartmanFrom: Amelie Delaunay <[email protected]>
[ Upstream commit 60c2c4bcb9202acad4cc26af20b44b6bd7874f7b ]
In case the interrupt signal can't be configured, IRQ domain needs to be removed.
--- drivers/mfd/stmfx.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/mfd/stmfx.c +7 -2
@@ -287,14 +287,19 @@ static int stmfx_irq_init(struct i2c_client *client) ret =regmap_write (stmfx->map,STMFX_REG_IRQ_OUT_PIN , irqoutpin);if (ret) -return ret; + goto irq_exit; ret =devm_request_threaded_irq (stmfx->dev, client->irq,NULL , stmfx_irq_handler, irqtrigger |IRQF_ONESHOT ,"stmfx" , stmfx);if (ret) -stmfx_irq_exit (client); + goto irq_exit; + +return 0 ; + +irq_exit: +stmfx_irq_exit (client);return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 297/477 extcon: adc-jack: Fix an error handling path in adc_jack_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit bc84cff2c92ae5ccb2c37da73756e7174b1b430f ]
In some error handling paths, a call to 'iio_channel_get()' is not balanced by a corresponding call to 'iio_channel_release()'.
This can be achieved easily by using the devm_ variant of 'iio_channel_get()'.
This has the extra benefit to simplify the remove function.
--- drivers/extcon/extcon-adc-jack.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/extcon/extcon-adc-jack.c +1 -2
@@ -124,7 +124,7 @@ static int adc_jack_probe(struct platform_device *pdev)for (i =0 ; data->adc_conditions[i].id !=EXTCON_NONE ; i++); data->num_conditions = i; - data->chan =iio_channel_get (&pdev->dev, pdata->consumer_channel); + data->chan =devm_iio_channel_get (&pdev->dev, pdata->consumer_channel);if (IS_ERR (data->chan))return PTR_ERR (data->chan);
@@ -164,7 +164,6 @@ static int adc_jack_remove(struct platform_device *pdev)free_irq (data->irq, data);cancel_work_sync (&data->handler.work); -iio_channel_release (data->chan);return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 324/477 crypto: omap-sham - add proper load balancing support for multicore
In reply to Greg Kroah-HartmanFrom: Tero Kristo <[email protected]>
[ Upstream commit 281c377872ff5d15d80df25fc4df02d2676c7cde ]
The current implementation of the multiple accelerator core support for OMAP SHA does not work properly. It always picks up the first probed accelerator core if this is available, and rest of the book keeping also gets confused if there are two cores available. Add proper load balancing support for SHA, and also fix any bugs related to the multicore support while doing it.
--- drivers/crypto/omap-sham.c | 64 ++++++++++++++++++-------------------- 1 file changed, 31 insertions(+), 33 deletions(-)
drivers/crypto/omap-sham.c +31 -33
@@ -169,8 +169,6 @@ struct omap_sham_hmac_ctx { };struct omap_sham_ctx { -struct omap_sham_dev *dd; -unsigned long flags;/* fallback stuff */
@@ -933,27 +931,35 @@ static int omap_sham_update_dma_stop(struct omap_sham_dev *dd)return 0 ; } +struct omap_sham_dev *omap_sham_find_dev (struct omap_sham_reqctx *ctx) +{ +struct omap_sham_dev *dd; + +if (ctx->dd) +return ctx->dd; + +spin_lock_bh (&sham.lock); + dd = list_first_entry(&sham.dev_list, struct omap_sham_dev, list); +list_move_tail (&dd->list, &sham.dev_list); + ctx->dd = dd; +spin_unlock_bh (&sham.lock); + +return dd; +} +static int omap_sham_init (struct ahash_request *req) {struct crypto_ahash *tfm =crypto_ahash_reqtfm (req);struct omap_sham_ctx *tctx =crypto_ahash_ctx (tfm);struct omap_sham_reqctx *ctx =ahash_request_ctx (req); -struct omap_sham_dev *dd =NULL , *tmp; +struct omap_sham_dev *dd;int bs =0 ; -spin_lock_bh (&sham.lock); -if (!tctx->dd) { -list_for_each_entry (tmp, &sham.dev_list, list) { - dd = tmp; -break ; - } - tctx->dd = dd; - }else { - dd = tctx->dd; - } -spin_unlock_bh (&sham.lock); + ctx->dd =NULL ; - ctx->dd = dd; + dd =omap_sham_find_dev (ctx); +if (!dd) +return -ENODEV ; ctx->flags =0 ;
@@ -1223,8 +1229,7 @@ err1:static int omap_sham_enqueue (struct ahash_request *req,unsigned int op) {struct omap_sham_reqctx *ctx =ahash_request_ctx (req); -struct omap_sham_ctx *tctx =crypto_tfm_ctx (req->base.tfm); -struct omap_sham_dev *dd = tctx->dd; +struct omap_sham_dev *dd = ctx->dd; ctx->op = op;
@@ -1234,7 +1239,7 @@ static int omap_sham_enqueue(struct ahash_request *req, unsigned int op)static int omap_sham_update (struct ahash_request *req) {struct omap_sham_reqctx *ctx =ahash_request_ctx (req); -struct omap_sham_dev *dd = ctx->dd; +struct omap_sham_dev *dd =omap_sham_find_dev (ctx);if (!req->nbytes)return 0 ;
@@ -1338,21 +1343,8 @@ static int omap_sham_setkey(struct crypto_ahash *tfm, const u8 *key,struct omap_sham_hmac_ctx *bctx = tctx->base;int bs =crypto_shash_blocksize (bctx->shash);int ds =crypto_shash_digestsize (bctx->shash); -struct omap_sham_dev *dd =NULL , *tmp;int err, i; -spin_lock_bh (&sham.lock); -if (!tctx->dd) { -list_for_each_entry (tmp, &sham.dev_list, list) { - dd = tmp; -break ; - } - tctx->dd = dd; - }else { - dd = tctx->dd; - } -spin_unlock_bh (&sham.lock); - err =crypto_shash_setkey (tctx->fallback, key, keylen);if (err)return err;
@@ -1370,7 +1362,7 @@ static int omap_sham_setkey(struct crypto_ahash *tfm, const u8 *key,memset (bctx->ipad + keylen,0 , bs - keylen); -if (!test_bit (FLAGS_AUTO_XOR , &dd->flags)) { +if (!test_bit (FLAGS_AUTO_XOR , &sham.flags)) {memcpy (bctx->opad, bctx->ipad, bs);for (i =0 ; i < bs; i++) {
@@ -2174,6 +2166,7 @@ static int omap_sham_probe(struct platform_device *pdev) } dd->flags |= dd->pdata->flags; + sham.flags |= dd->pdata->flags;pm_runtime_use_autosuspend (dev);pm_runtime_set_autosuspend_delay (dev,DEFAULT_AUTOSUSPEND_DELAY );
@@ -2201,6 +2194,9 @@ static int omap_sham_probe(struct platform_device *pdev)spin_unlock (&sham.lock);for (i =0 ; i < dd->pdata->algs_info_size; i++) { +if (dd->pdata->algs_info[i].registered) +break ; +for (j =0 ; j < dd->pdata->algs_info[i].size; j++) {struct ahash_alg *alg;
@@ -2252,9 +2248,11 @@ static int omap_sham_remove(struct platform_device *pdev)list_del (&dd->list);spin_unlock (&sham.lock);for (i = dd->pdata->algs_info_size -1 ; i >=0 ; i--) -for (j = dd->pdata->algs_info[i].registered -1 ; j >=0 ; j--) +for (j = dd->pdata->algs_info[i].registered -1 ; j >=0 ; j--) {crypto_unregister_ahash ( &dd->pdata->algs_info[i].algs_list[j]); + dd->pdata->algs_info[i].registered--; + }tasklet_kill (&dd->done_task);pm_runtime_disable (&pdev->dev);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 325/477 pwm: Add missing "CONFIG_" prefix
In reply to Greg Kroah-HartmanFrom: Kees Cook <[email protected]>
[ Upstream commit f5641d053d46a9a18fe13f2ecb4a7b4a66d9cdf7 ]
The IS_ENABLED() use was missing the CONFIG_ prefix which would have lead to skipping this code.
--- drivers/pwm/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pwm/core.c +1 -1
@@ -121,7 +121,7 @@ static int pwm_device_request(struct pwm_device *pwm, const char *label) pwm->chip->ops->get_state (pwm->chip, pwm, &pwm->state);trace_pwm_get (pwm, &pwm->state); -if (IS_ENABLED (PWM_DEBUG )) +if (IS_ENABLED (CONFIG_PWM_DEBUG )) pwm->last = pwm->state; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 321/477 drm/amd/display: Revalidate bandwidth before commiting DC updates
In reply to Greg Kroah-HartmanFrom: Nicholas Kazlauskas <[email protected]>
[ Upstream commit a24eaa5c51255b344d5a321f1eeb3205f2775498 ]
[Why]
Whenever we switch between tiled formats without also switching pixel formats or doing anything else that recreates the DC plane state we can run into underflow or hangs since we're not updating the DML parameters before committing to the hardware.
[How]
If the update type is FULL then call validate_bandwidth again to update the DML parmeters before committing the state.
This is basically just a workaround and protective measure against update types being added DC where we could run into this issue in the future.
We can only fully validate the state in advance before applying it to the hardware if we recreate all the plane and stream states since we can't modify what's currently in use.
The next step is to update DM to ensure that we're creating the plane and stream states for whatever could potentially be a full update in DC to pre-emptively recreate the state for DC global validation.
The workaround can stay until this has been fixed in DM.
--- drivers/gpu/drm/amd/display/dc/core/dc.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/amd/display/dc/core/dc.c +6 -0
@@ -2517,6 +2517,12 @@ void dc_commit_updates_for_stream(struct dc *dc,copy_stream_update_to_stream (dc, context, stream, stream_update); +if (!dc->res_pool->funcs->validate_bandwidth (dc, context, false)) { +DC_ERROR ("Mode validation failed for stream update!\n" ); +dc_release_state (context); +return ; + } + commit_planes_for_stream( dc, srf_updates,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 293/477 ARM: davinci: fix build failure without I2C
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 147922f91965e734664374a3f226adfeaa586d72 ]
The two supplies are referenced outside of #ifdef CONFIG_I2C but defined inside, which breaks the build if that is not built-in:
mach-davinci/board-dm644x-evm.c:861:21: error: use of undeclared identifier 'fixed_supplies_1_8v'
ARRAY_SIZE(fixed_supplies_1_8v), 1800000);
^mach-davinci/board-dm644x-evm.c:861:21: error: use of undeclared identifier 'fixed_supplies_1_8v' mach-davinci/board-dm644x-evm.c:861:21: error: use of undeclared identifier 'fixed_supplies_1_8v' mach-davinci/board-dm644x-evm.c:860:49: error: use of undeclared identifier 'fixed_supplies_1_8v'
regulator_register_always_on(0, "fixed-dummy", fixed_supplies_1_8v,
I don't know if the regulators are used anywhere without I2C, but always registering them seems to be the safe choice here.
On a related note, it might be best to also deal with CONFIG_I2C=m across the file, unless this is going to be moved to DT and removed really soon anyway.
--- arch/arm/mach-davinci/board-dm644x-evm.c | 26 ++++++++++++------------ 1 file changed, 13 insertions(+), 13 deletions(-)
arch/arm/mach-davinci/board-dm644x-evm.c +13 -13
@@ -655,19 +655,6 @@ static struct i2c_board_info __initdata i2c_info[] = { }, }; -/* Fixed regulator support */ -static struct regulator_consumer_supply fixed_supplies_3_3v[] = { -/* Baseboard 3.3V: 5V -> TPS54310PWP -> 3.3V */ -REGULATOR_SUPPLY ("AVDD" ,"1-001b" ), -REGULATOR_SUPPLY ("DRVDD" ,"1-001b" ), -}; - -static struct regulator_consumer_supply fixed_supplies_1_8v[] = { -/* Baseboard 1.8V: 5V -> TPS54310PWP -> 1.8V */ -REGULATOR_SUPPLY ("IOVDD" ,"1-001b" ), -REGULATOR_SUPPLY ("DVDD" ,"1-001b" ), -}; -#define DM644X_I2C_SDA_PIN GPIO_TO_PIN(2, 12)#define DM644X_I2C_SCL_PIN GPIO_TO_PIN(2, 11)
@@ -700,6 +687,19 @@ static void __init evm_init_i2c(void) }#endif +/* Fixed regulator support */ +static struct regulator_consumer_supply fixed_supplies_3_3v[] = { +/* Baseboard 3.3V: 5V -> TPS54310PWP -> 3.3V */ +REGULATOR_SUPPLY ("AVDD" ,"1-001b" ), +REGULATOR_SUPPLY ("DRVDD" ,"1-001b" ), +}; + +static struct regulator_consumer_supply fixed_supplies_1_8v[] = { +/* Baseboard 1.8V: 5V -> TPS54310PWP -> 1.8V */ +REGULATOR_SUPPLY ("IOVDD" ,"1-001b" ), +REGULATOR_SUPPLY ("DVDD" ,"1-001b" ), +}; +#define VENC_STD_ALL (V4L2_STD_NTSC | V4L2_STD_PAL)/* venc standard timings */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 295/477 powerpc/4xx: Dont unmap NULL mbase
In reply to Greg Kroah-HartmanFrom: huhai <[email protected]>
[ Upstream commit bcec081ecc940fc38730b29c743bbee661164161 ]
--- arch/powerpc/platforms/4xx/pci.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/powerpc/platforms/4xx/pci.c +1 -3
@@ -1242,7 +1242,7 @@ static void __init ppc460sx_pciex_check_link(struct ppc4xx_pciex_port *port)if (mbase ==NULL ) {printk (KERN_ERR "%pOF: Can't map internal config space !" , port->node); - goto done; +return ; } while (attempt && (0 == (in_le32(mbase + PECFG_460SX_DLLSTA)
@@ -1252,9 +1252,7 @@ static void __init ppc460sx_pciex_check_link(struct ppc4xx_pciex_port *port) }if (attempt) port->link =1 ; -done:iounmap (mbase); - }static struct ppc4xx_pciex_hwops ppc460sx_pcie_hwops__initdata = {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 292/477 of: Fix a refcounting bug in __of_attach_node_sysfs()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 8a325dd06f2358ea0888e4ff1c9ca4bc23bd53f3 ]
The problem in this code is that if kobject_add() fails, then it should call of_node_put(np) to drop the reference count. I've actually moved the of_node_get(np) later in the function to avoid needing to do clean up.
--- drivers/of/kobj.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/of/kobj.c +1 -2
@@ -134,8 +134,6 @@ int __of_attach_node_sysfs(struct device_node *np)if (!name)return -ENOMEM ; -of_node_get (np); - rc =kobject_add (&np->kobj, parent,"%s" , name);kfree (name);if (rc)
@@ -144,6 +142,7 @@ int __of_attach_node_sysfs(struct device_node *np)for_each_property_of_node (np, pp)__of_add_property_sysfs (np, pp); +of_node_get (np);return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 290/477 net: sunrpc: Fix off-by-one issues in rpc_ntop6
In reply to Greg Kroah-HartmanFrom: Fedor Tokarev <[email protected]>
[ Upstream commit 118917d696dc59fd3e1741012c2f9db2294bed6f ]
Fix off-by-one issues in 'rpc_ntop6':
- 'snprintf' returns the number of characters which would have been written if enough space had been available, excluding the terminating null byte. Thus, a return value of 'sizeof(scopebuf)' means that the last character was dropped.
- 'strcat' adds a terminating null byte to the string, thus if len == buflen, the null byte is written past the end of the buffer.
--- net/sunrpc/addr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sunrpc/addr.c +2 -2
@@ -82,11 +82,11 @@ static size_t rpc_ntop6(const struct sockaddr *sap, rc =snprintf (scopebuf,sizeof (scopebuf),"%c%u" ,IPV6_SCOPE_DELIMITER , sin6->sin6_scope_id); -if (unlikely ((size_t )rc >sizeof (scopebuf))) +if (unlikely ((size_t )rc >=sizeof (scopebuf)))return 0 ; len += rc; -if (unlikely (len > buflen)) +if (unlikely (len >= buflen))return 0 ;strcat (buf, scopebuf);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 279/477 clk: zynqmp: Fix divider2 calculation
In reply to Greg Kroah-HartmanFrom: Tejas Patel <[email protected]>
[ Upstream commit b8c1049c68d634a412ed5980ae666ed7c8839305 ]
zynqmp_get_divider2_val() calculates, divider value of type DIV2 clock, considering best possible combination of DIV1 and DIV2.
To find best possible values of DIV1 and DIV2, DIV1's parent rate should be consider and not DIV2's parent rate since it would rate of div1 clock. Consider a below topology,
out_clk->div2_clk->div1_clk->fixed_parent
where out_clk = (fixed_parent/div1_clk) / div2_clk, so parent clock of div1_clk (i.e. out_clk) should be divided by div1_clk and div2_clk.
Existing code divides parent rate of div2_clk's clock instead of div1_clk's parent rate, which is wrong.
Fix the same by considering div1's parent clock rate.
--- drivers/clk/zynqmp/divider.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-)
drivers/clk/zynqmp/divider.c +12 -5
@@ -111,23 +111,30 @@ static unsigned long zynqmp_clk_divider_recalc_rate(struct clk_hw *hw,static void zynqmp_get_divider2_val (struct clk_hw *hw,unsigned long rate, -unsigned long parent_rate,struct zynqmp_clk_divider *divider,int *bestdiv) {int div1;int div2;long error =LONG_MAX ; -struct clk_hw *parent_hw =clk_hw_get_parent (hw); -struct zynqmp_clk_divider *pdivider =to_zynqmp_clk_divider (parent_hw); +unsigned long div1_prate; +struct clk_hw *div1_parent_hw; +struct clk_hw *div2_parent_hw =clk_hw_get_parent (hw); +struct zynqmp_clk_divider *pdivider = +to_zynqmp_clk_divider (div2_parent_hw);if (!pdivider)return ; + div1_parent_hw =clk_hw_get_parent (div2_parent_hw); +if (!div1_parent_hw) +return ; + + div1_prate =clk_hw_get_rate (div1_parent_hw); *bestdiv =1 ;for (div1 =1 ; div1 <= pdivider->max_div;) {for (div2 =1 ; div2 <= divider->max_div;) { -long new_error = ((parent_rate / div1) / div2) - rate; +long new_error = ((div1_prate / div1) / div2) - rate;if (abs (new_error) <abs (error)) { *bestdiv = div2;
@@ -192,7 +199,7 @@ static long zynqmp_clk_divider_round_rate(struct clk_hw *hw,*/ if (div_type ==TYPE_DIV2 && (clk_hw_get_flags (hw) &CLK_SET_RATE_PARENT )) { -zynqmp_get_divider2_val (hw, rate, *prate, divider, &bestdiv); +zynqmp_get_divider2_val (hw, rate, divider, &bestdiv); }if ((clk_hw_get_flags (hw) &CLK_SET_RATE_PARENT ) && divider->is_frac)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 269/477 mfd: stmfx: Reset chip on resume as supply was disabled
In reply to Greg Kroah-HartmanFrom: Amelie Delaunay <[email protected]>
[ Upstream commit e583649d87ec090444aa5347af0927cd6e8581ae ]
STMFX supply is disabled during suspend. To avoid a too early access to the STMFX firmware on resume, reset the chip and wait for its firmware to be loaded.
--- drivers/mfd/stmfx.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/mfd/stmfx.c +7 -0
@@ -501,6 +501,13 @@ static int stmfx_resume(struct device *dev) } } +/* Reset STMFX - supply has been stopped during suspend */ + ret =stmfx_chip_reset (stmfx); +if (ret) { +dev_err (stmfx->dev,"Failed to reset chip: %d\n" , ret); +return ret; + } + ret =regmap_raw_write (stmfx->map,STMFX_REG_SYS_CTRL , &stmfx->bkp_sysctrl,sizeof (stmfx->bkp_sysctrl));if (ret)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 286/477 clk: ast2600: Fix AHB clock divider for A1
In reply to Greg Kroah-HartmanFrom: Eddie James <[email protected]>
[ Upstream commit 2d491066ccd4286538450c227fc5094ceb04b494 ]
The latest specs for the AST2600 A1 chip include some different bit definitions for calculating the AHB clock divider. Implement these in order to get the correct AHB clock value in Linux.
--- drivers/clk/clk-ast2600.c | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-)
drivers/clk/clk-ast2600.c +25 -6
@@ -642,14 +642,22 @@ static const u32 ast2600_a0_axi_ahb_div_table[] = { 2, 2, 3, 5, }; -static const u32 ast2600_a1_axi_ahb_div_table[] = { -4 ,6 ,2 ,4 , +static const u32 ast2600_a1_axi_ahb_div0_tbl[] = { +3 ,2 ,3 ,4 , +}; + +static const u32 ast2600_a1_axi_ahb_div1_tbl[] = { +3 ,4 ,6 ,8 , +}; + +static const u32 ast2600_a1_axi_ahb200_tbl[] = { +3 ,4 ,3 ,4 ,2 ,2 ,2 ,2 , };static void __init aspeed_g6_cc (struct regmap *map) {struct clk_hw *hw; -u32 val, div, chip_id, axi_div, ahb_div; +u32 val, div, divbits, chip_id, axi_div, ahb_div;clk_hw_register_fixed_rate (NULL ,"clkin" ,NULL ,0 ,25000000 );
@@ -679,11 +687,22 @@ static void __init aspeed_g6_cc(struct regmap *map)else axi_div =2 ; + divbits = (val >>11 ) &0x3 ;regmap_read (map,ASPEED_G6_SILICON_REV , &chip_id); -if (chip_id &BIT (16 )) - ahb_div = ast2600_a1_axi_ahb_div_table[(val >>11 ) &0x3 ]; -else +if (chip_id &BIT (16 )) { +if (!divbits) { + ahb_div = ast2600_a1_axi_ahb200_tbl[(val >>8 ) &0x3 ]; +if (val &BIT (16 )) + ahb_div *=2 ; + }else { +if (val &BIT (16 )) + ahb_div = ast2600_a1_axi_ahb_div1_tbl[divbits]; +else + ahb_div = ast2600_a1_axi_ahb_div0_tbl[divbits]; + } + }else { ahb_div = ast2600_a0_axi_ahb_div_table[(val >>11 ) &0x3 ]; + } hw =clk_hw_register_fixed_factor (NULL ,"ahb" ,"hpll" ,0 ,1 , axi_div * ahb_div); aspeed_g6_clk_data->hws[ASPEED_CLK_AHB ] = hw;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 285/477 clk: sprd: return correct type of value for _sprd_pll_recalc_rate
In reply to Greg Kroah-HartmanFrom: Chunyan Zhang <[email protected]>
[ Upstream commit c2f30986d418f26abefc2eec90ebf06716c970d2 ]
The function _sprd_pll_recalc_rate() defines return value to unsigned long, but it would return a negative value when malloc fail, changing to return its parent_rate makes more sense, since if the callback .recalc_rate() is not set, the framework returns the parent_rate as well.
--- drivers/clk/sprd/pll.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/sprd/pll.c +1 -1
@@ -106,7 +106,7 @@ static unsigned long _sprd_pll_recalc_rate(const struct sprd_pll *pll, cfg =kcalloc (regs_num,sizeof (*cfg),GFP_KERNEL );if (!cfg) -return -ENOMEM ; +return parent_rate;for (i =0 ; i < regs_num; i++) cfg[i] =sprd_pll_read (pll, i);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 284/477 KVM: PPC: Book3S HV: Relax check on H_SVM_INIT_ABORT
In reply to Greg Kroah-HartmanFrom: Laurent Dufour <[email protected]>
[ Upstream commit e3326ae3d59e443a379367c6936941d6ab55d316 ]
The commit 8c47b6ff29e3 ("KVM: PPC: Book3S HV: Check caller of H_SVM_* Hcalls") added checks of secure bit of SRR1 to filter out the Hcall reserved to the Ultravisor.
However, the Hcall H_SVM_INIT_ABORT is made by the Ultravisor passing the context of the VM calling UV_ESM. This allows the Hypervisor to return to the guest without going through the Ultravisor. Thus the Secure bit of SRR1 is not set in that particular case.
In the case a regular VM is calling H_SVM_INIT_ABORT, this hcall will be filtered out in kvmppc_h_svm_init_abort() because kvm->arch.secure_guest is not set in that case.
--- arch/powerpc/kvm/book3s_hv.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
arch/powerpc/kvm/book3s_hv.c +8 -3
@@ -1099,9 +1099,14 @@ int kvmppc_pseries_do_hcall(struct kvm_vcpu *vcpu) ret =kvmppc_h_svm_init_done (vcpu->kvm);break ;case H_SVM_INIT_ABORT : - ret =H_UNSUPPORTED ; -if (kvmppc_get_srr1 (vcpu) &MSR_S ) - ret =kvmppc_h_svm_init_abort (vcpu->kvm); +/* +* Even if that call is made by the Ultravisor, the SSR1 value +* is the guest context one, with the secure bit clear as it has +* not yet been secured. So we can't check it here. +* Instead the kvm->arch.secure_guest flag is checked inside +* kvmppc_h_svm_init_abort(). +*/ + ret =kvmppc_h_svm_init_abort (vcpu->kvm);break ;default :
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 282/477 KVM: PPC: Book3S HV: Ignore kmemleak false positives
In reply to Greg Kroah-HartmanFrom: Qian Cai <[email protected]>
[ Upstream commit 0aca8a5575544bd21b3363058afb8f1e81505150 ]
kvmppc_pmd_alloc() and kvmppc_pte_alloc() allocate some memory but then pud_populate() and pmd_populate() will use __pa() to reference the newly allocated memory.
Since kmemleak is unable to track the physical memory resulting in false positives, silence those by using kmemleak_ignore().
unreferenced object 0xc000201c382a1000 (size 4096):
comm "qemu-kvm", pid 124828, jiffies 4295733767 (age 341.250s) hex dump (first 32 bytes):
c0 00 20 09 f4 60 03 87 c0 00 20 10 72 a0 03 87 .. ..`.... .r... c0 00 20 0e 13 a0 03 87 c0 00 20 1b dc c0 03 87 .. ....... .....
backtrace:
[<000000004cc2790f>] kvmppc_create_pte+0x838/0xd20 [kvm_hv] kvmppc_pmd_alloc at arch/powerpc/kvm/book3s_64_mmu_radix.c:366 (inlined by) kvmppc_create_pte at arch/powerpc/kvm/book3s_64_mmu_radix.c:590 [<00000000d123c49a>] kvmppc_book3s_instantiate_page+0x2e0/0x8c0 [kvm_hv] [<00000000bb549087>] kvmppc_book3s_radix_page_fault+0x1b4/0x2b0 [kvm_hv] [<0000000086dddc0e>] kvmppc_book3s_hv_page_fault+0x214/0x12a0 [kvm_hv] [<000000005ae9ccc2>] kvmppc_vcpu_run_hv+0xc5c/0x15f0 [kvm_hv] [<00000000d22162ff>] kvmppc_vcpu_run+0x34/0x48 [kvm] [<00000000d6953bc4>] kvm_arch_vcpu_ioctl_run+0x314/0x420 [kvm] [<000000002543dd54>] kvm_vcpu_ioctl+0x33c/0x950 [kvm] [<0000000048155cd6>] ksys_ioctl+0xd8/0x130 [<0000000041ffeaa7>] sys_ioctl+0x28/0x40 [<000000004afc4310>] system_call_exception+0x114/0x1e0 [<00000000fb70a873>] system_call_common+0xf0/0x278
unreferenced object 0xc0002001f0c03900 (size 256):
comm "qemu-kvm", pid 124830, jiffies 4295735235 (age 326.570s) hex dump (first 32 bytes):
c0 00 20 10 fa a0 03 87 c0 00 20 10 fa a1 03 87 .. ....... ..... c0 00 20 10 fa a2 03 87 c0 00 20 10 fa a3 03 87 .. ....... .....
backtrace:
[<0000000023f675b8>] kvmppc_create_pte+0x854/0xd20 [kvm_hv] kvmppc_pte_alloc at arch/powerpc/kvm/book3s_64_mmu_radix.c:356 (inlined by) kvmppc_create_pte at arch/powerpc/kvm/book3s_64_mmu_radix.c:593 [<00000000d123c49a>] kvmppc_book3s_instantiate_page+0x2e0/0x8c0 [kvm_hv] [<00000000bb549087>] kvmppc_book3s_radix_page_fault+0x1b4/0x2b0 [kvm_hv] [<0000000086dddc0e>] kvmppc_book3s_hv_page_fault+0x214/0x12a0 [kvm_hv] [<000000005ae9ccc2>] kvmppc_vcpu_run_hv+0xc5c/0x15f0 [kvm_hv] [<00000000d22162ff>] kvmppc_vcpu_run+0x34/0x48 [kvm] [<00000000d6953bc4>] kvm_arch_vcpu_ioctl_run+0x314/0x420 [kvm] [<000000002543dd54>] kvm_vcpu_ioctl+0x33c/0x950 [kvm] [<0000000048155cd6>] ksys_ioctl+0xd8/0x130 [<0000000041ffeaa7>] sys_ioctl+0x28/0x40 [<000000004afc4310>] system_call_exception+0x114/0x1e0 [<00000000fb70a873>] system_call_common+0xf0/0x278
--- arch/powerpc/kvm/book3s_64_mmu_radix.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
arch/powerpc/kvm/book3s_64_mmu_radix.c +14 -2
@@ -353,7 +353,13 @@ static struct kmem_cache *kvm_pmd_cache;static pte_t *kvmppc_pte_alloc (void ) { -return kmem_cache_alloc (kvm_pte_cache,GFP_KERNEL ); +pte_t *pte; + + pte =kmem_cache_alloc (kvm_pte_cache,GFP_KERNEL ); +/* pmd_populate() will only reference _pa(pte). */ +kmemleak_ignore (pte); + +return pte; }static void kvmppc_pte_free (pte_t *ptep)
@@ -363,7 +369,13 @@ static void kvmppc_pte_free(pte_t *ptep)static pmd_t *kvmppc_pmd_alloc (void ) { -return kmem_cache_alloc (kvm_pmd_cache,GFP_KERNEL ); +pmd_t *pmd; + + pmd =kmem_cache_alloc (kvm_pmd_cache,GFP_KERNEL ); +/* pud_populate() will only reference _pa(pmd). */ +kmemleak_ignore (pmd); + +return pmd; }static void kvmppc_pmd_free (pmd_t *pmdp)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 241/477 fuse: fix copy_file_range cache issues
In reply to Greg Kroah-HartmanFrom: Miklos Szeredi <[email protected]>
[ Upstream commit 2c4656dfd994538176db30ce09c02cc0dfc361ae ]
a) Dirty cache needs to be written back not just in the writeback_cache case, since the dirty pages may come from memory maps.
b) The fuse_writeback_range() helper takes an inclusive interval, so the end position needs to be pos+len-1 instead of pos+len.
--- fs/fuse/file.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
fs/fuse/file.c +8 -12
@@ -3280,13 +3280,11 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in,if (file_inode (file_in)->i_sb !=file_inode (file_out)->i_sb)return -EXDEV ; -if (fc->writeback_cache) { -inode_lock (inode_in); - err =fuse_writeback_range (inode_in, pos_in, pos_in + len); -inode_unlock (inode_in); -if (err) -return err; - } +inode_lock (inode_in); + err =fuse_writeback_range (inode_in, pos_in, pos_in + len -1 ); +inode_unlock (inode_in); +if (err) +return err;inode_lock (inode_out);
@@ -3294,11 +3292,9 @@ static ssize_t __fuse_copy_file_range(struct file *file_in, loff_t pos_in,if (err) goto out; -if (fc->writeback_cache) { - err =fuse_writeback_range (inode_out, pos_out, pos_out + len); -if (err) - goto out; - } + err =fuse_writeback_range (inode_out, pos_out, pos_out + len -1 ); +if (err) + goto out;if (is_unstable)set_bit (FUSE_I_SIZE_UNSTABLE , &fi_out->state);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 278/477 scsi: ufs-qcom: Fix scheduling while atomic issue
In reply to Greg Kroah-HartmanFrom: Jeffrey Hugo <[email protected]>
[ Upstream commit 3be60b564de49875e47974c37fabced893cd0931 ]
ufs_qcom_dump_dbg_regs() uses usleep_range, a sleeping function, but can be called from atomic context in the following flow:
ufshcd_intr -> ufshcd_sl_intr -> ufshcd_check_errors -> ufshcd_print_host_regs -> ufshcd_vops_dbg_register_dump -> ufs_qcom_dump_dbg_regs
This causes a boot crash on the Lenovo Miix 630 when the interrupt is handled on the idle thread.
Fix the issue by switching to udelay().
--- drivers/scsi/ufs/ufs-qcom.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/scsi/ufs/ufs-qcom.c +3 -3
@@ -1658,11 +1658,11 @@ static void ufs_qcom_dump_dbg_regs(struct ufs_hba *hba)/* sleep a bit intermittently as we are dumping too much data */ ufs_qcom_print_hw_debug_reg_all (hba,NULL , ufs_qcom_dump_regs_wrapper); -usleep_range (1000 ,1100 ); +udelay (1000 );ufs_qcom_testbus_read (hba); -usleep_range (1000 ,1100 ); +udelay (1000 );ufs_qcom_print_unipro_testbus (hba); -usleep_range (1000 ,1100 ); +udelay (1000 ); }/**
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 277/477 clk: bcm2835: Fix return type of bcm2835_register_gate
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit f376c43bec4f8ee8d1ba5c5c4cfbd6e84fb279cb ]
bcm2835_register_gate is used as a callback for the clk_register member of bcm2835_clk_desc, which expects a struct clk_hw * return type but bcm2835_register_gate returns a struct clk *.
This discrepancy is hidden by the fact that bcm2835_register_gate is cast to the typedef bcm2835_clk_register by the _REGISTER macro. This turns out to be a control flow integrity violation, which is how this was noticed.
Change the return type of bcm2835_register_gate to be struct clk_hw * and use clk_hw_register_gate to do so. This should be a non-functional change as clk_register_gate calls clk_hw_register_gate anyways but this is needed to avoid issues with further changes.
--- drivers/clk/bcm/clk-bcm2835.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/clk/bcm/clk-bcm2835.c +5 -5
@@ -1448,13 +1448,13 @@ static struct clk_hw *bcm2835_register_clock(struct bcm2835_cprman *cprman,return &clock->hw; } -static struct clk *bcm2835_register_gate (struct bcm2835_cprman *cprman, +static struct clk_hw *bcm2835_register_gate (struct bcm2835_cprman *cprman,const struct bcm2835_gate_data *data) { -return clk_register_gate (cprman->dev, data->name, data->parent, -CLK_IGNORE_UNUSED |CLK_SET_RATE_GATE , - cprman->regs + data->ctl_reg, -CM_GATE_BIT ,0 , &cprman->regs_lock); +return clk_hw_register_gate (cprman->dev, data->name, data->parent, +CLK_IGNORE_UNUSED |CLK_SET_RATE_GATE , + cprman->regs + data->ctl_reg, +CM_GATE_BIT ,0 , &cprman->regs_lock); } typedef struct clk_hw *(*bcm2835_clk_register)(struct bcm2835_cprman *cprman,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 261/477 USB: gadget: udc: s3c2410_udc: Remove pointless NULL check in s3c2410_udc_nuke
In reply to Greg Kroah-HartmanFrom: Nathan Chancellor <[email protected]>
[ Upstream commit 7a0fbcf7c308920bc6116b3a5fb21c8cc5fec128 ]
Clang warns:
drivers/usb/gadget/udc/s3c2410_udc.c:255:11: warning: comparison of address of 'ep->queue' equal to a null pointer is always false [-Wtautological-pointer-compare]
if (&ep->queue == NULL)
~~~~^~~~~ ~~~~1 warning generated.
It is not wrong, queue is not a pointer so if ep is not NULL, the address of queue cannot be NULL. No other driver does a check like this and this check has been around since the driver was first introduced, presumably with no issues so it does not seem like this check should be something else. Just remove it.
Commit afe956c577b2d ("kbuild: Enable -Wtautological-compare") exposed this but it is not the root cause of the warning.
--- drivers/usb/gadget/udc/s3c2410_udc.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/usb/gadget/udc/s3c2410_udc.c +0 -4
@@ -251,10 +251,6 @@ static void s3c2410_udc_done(struct s3c2410_ep *ep,static void s3c2410_udc_nuke (struct s3c2410_udc *udc,struct s3c2410_ep *ep,int status) { -/* Sanity check */ -if (&ep->queue ==NULL ) -return ; -while (!list_empty (&ep->queue)) {struct s3c2410_request *req; req = list_entry(ep->queue.next, struct s3c2410_request,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 260/477 usb: dwc2: gadget: move gadget resume after the core is in L0 state
In reply to Greg Kroah-HartmanFrom: Fabrice Gasnier <[email protected]>
[ Upstream commit 8c935deacebb8fac8f41378701eb79d12f3c2e2d ]
When the remote wakeup interrupt is triggered, lx_state is resumed from L2 to L0 state. But when the gadget resume is called, lx_state is still L2. This prevents the resume callback to queue any request. Any attempt to queue a request from resume callback will result in:
- "submit request only in active state" debug message to be issued
- dwc2_hsotg_ep_queue() returns -EAGAIN
Call the gadget resume routine after the core is in L0 state.
--- drivers/usb/dwc2/core_intr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/dwc2/core_intr.c +5 -2
@@ -416,10 +416,13 @@ static void dwc2_handle_wakeup_detected_intr(struct dwc2_hsotg *hsotg)if (ret && (ret != -ENOTSUPP ))dev_err (hsotg->dev,"exit power_down failed\n" ); +/* Change to L0 state */ + hsotg->lx_state =DWC2_L0 ;call_gadget (hsotg, resume); + }else { +/* Change to L0 state */ + hsotg->lx_state =DWC2_L0 ; } -/* Change to L0 state */ - hsotg->lx_state =DWC2_L0 ; }else {if (hsotg->params.power_down)return ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 259/477 watchdog: da9062: No need to ping manually before setting timeout
In reply to Greg Kroah-HartmanFrom: Stefan Riedmueller <[email protected]>
[ Upstream commit a0948ddba65f4f6d3cfb5e2b84685485d0452966 ]
There is actually no need to ping the watchdog before disabling it during timeout change. Disabling the watchdog already takes care of resetting the counter.
This fixes an issue during boot when the userspace watchdog handler takes over and the watchdog is already running. Opening the watchdog in this case leads to the first ping and directly after that without the required heartbeat delay a second ping issued by the set_timeout call. Due to the missing delay this resulted in a reset.
--- drivers/watchdog/da9062_wdt.c | 5 ----- 1 file changed, 5 deletions(-)
drivers/watchdog/da9062_wdt.c +0 -5
@@ -58,11 +58,6 @@ static int da9062_wdt_update_timeout_register(struct da9062_watchdog *wdt, unsigned int regval) {struct da9062 *chip = wdt->hw; -int ret; - - ret =da9062_reset_watchdog_timer (wdt); -if (ret) -return ret; regmap_update_bits(chip->regmap, DA9062AA_CONTROL_D,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 258/477 selftests/timens: handle a case when alarm clocks are not supported
In reply to Greg Kroah-HartmanFrom: Andrei Vagin <[email protected]>
[ Upstream commit 558ae0355a91c7d28fdf4c0011bee6ebb5118632 ]
This can happen if a testing node doesn't have RTC (real time clock) hardware or it doesn't support alarms.
--- tools/testing/selftests/timens/clock_nanosleep.c | 2 +- tools/testing/selftests/timens/timens.c | 2 +- tools/testing/selftests/timens/timens.h | 13 ++++++++++++- tools/testing/selftests/timens/timer.c | 5 +++++ tools/testing/selftests/timens/timerfd.c | 5 +++++ 5 files changed, 24 insertions(+), 3 deletions(-)
tools/testing/selftests/timens/clock_nanosleep.c +1 -1
@@ -119,7 +119,7 @@ int main(int argc, char *argv[])ksft_set_plan (4 ); -check_config_posix_timers (); +check_supported_timers ();if (unshare_timens ())return 1 ;
tools/testing/selftests/timens/timens.c +1 -1
@@ -155,7 +155,7 @@ int main(int argc, char *argv[])nscheck (); -check_config_posix_timers (); +check_supported_timers ();ksft_set_plan (ARRAY_SIZE (clocks) *2 );
tools/testing/selftests/timens/timens.h +12 -1
@@ -14,15 +14,26 @@#endif static int config_posix_timers = true; +static int config_alarm_timers = true; -static inline void check_config_posix_timers (void ) +static inline void check_supported_timers (void ) { +struct timespec ts; +if (timer_create (-1 ,0 ,0 ) ==-1 && errno ==ENOSYS ) config_posix_timers = false; + +if (clock_gettime (CLOCK_BOOTTIME_ALARM , &ts) ==-1 && errno ==EINVAL ) + config_alarm_timers = false; }static inline bool check_skip (int clockid) { +if (!config_alarm_timers && clockid ==CLOCK_BOOTTIME_ALARM ) { +ksft_test_result_skip ("CLOCK_BOOTTIME_ALARM isn't supported\n" ); +return true; + } +if (config_posix_timers)return false;
tools/testing/selftests/timens/timer.c +5 -0
@@ -22,6 +22,9 @@ int run_test(int clockid, struct timespec now)timer_t fd;int i; +if (check_skip (clockid)) +return 0 ; +for (i =0 ; i <2 ; i++) {struct sigevent sevp = {.sigev_notify =SIGEV_NONE };int flags =0 ;
@@ -74,6 +77,8 @@ int main(int argc, char *argv[])nscheck (); +check_supported_timers (); +ksft_set_plan (3 );clock_gettime (CLOCK_MONOTONIC , &mtime_now);
tools/testing/selftests/timens/timerfd.c +5 -0
@@ -28,6 +28,9 @@ int run_test(int clockid, struct timespec now)long long elapsed;int fd, i; +if (check_skip (clockid)) +return 0 ; +if (tclock_gettime (clockid, &now))return pr_perror ("clock_gettime(%d)" , clockid);
@@ -81,6 +84,8 @@ int main(int argc, char *argv[])nscheck (); +check_supported_timers (); +ksft_set_plan (3 );clock_gettime (CLOCK_MONOTONIC , &mtime_now);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 256/477 iio: light: gp2ap002: Take runtime PM reference on light read
In reply to Greg Kroah-HartmanFrom: Jonathan Bakker <[email protected]>
[ Upstream commit f6dbf83c17cb223ceabd7c42d441414f3e0e8a86 ]
The light sensor needs the regulators to be enabled which means the runtime PM needs to be on. This only happened when the proximity part of the chip was enabled.
As fallout from this change, only report changes to the prox state in the interrupt handler when it is explicitly enabled.
--- drivers/iio/light/gp2ap002.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-)
drivers/iio/light/gp2ap002.c +16 -3
@@ -158,6 +158,9 @@ static irqreturn_t gp2ap002_prox_irq(int irq, void *d)int val;int ret; +if (!gp2ap002->enabled) + goto err_retrig; + ret =regmap_read (gp2ap002->map,GP2AP002_PROX , &val);if (ret) {dev_err (gp2ap002->dev,"error reading proximity\n" );
@@ -247,6 +250,8 @@ static int gp2ap002_read_raw(struct iio_dev *indio_dev,struct gp2ap002 *gp2ap002 =iio_priv (indio_dev);int ret; +pm_runtime_get_sync (gp2ap002->dev); +switch (mask) {case IIO_CHAN_INFO_RAW :switch (chan->type) {
@@ -255,13 +260,21 @@ static int gp2ap002_read_raw(struct iio_dev *indio_dev,if (ret <0 )return ret; *val = ret; -return IIO_VAL_INT ; + ret =IIO_VAL_INT ; + goto out;default : -return -EINVAL ; + ret = -EINVAL ; + goto out; }default : -return -EINVAL ; + ret = -EINVAL ; } + +out: +pm_runtime_mark_last_busy (gp2ap002->dev); +pm_runtime_put_autosuspend (gp2ap002->dev); + +return ret; }static int gp2ap002_init (struct gp2ap002 *gp2ap002)
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 255/477 PCI: amlogic: meson: Dont use FAST_LINK_MODE to set up link
In reply to Greg Kroah-HartmanFrom: Marc Zyngier <[email protected]>
[ Upstream commit 87dccf09323fc363bd0d072fcc12b96622ab8c69 ]
The vim3l board does not work with a standard PCIe switch (ASM1184e), spitting all kind of errors - hinting at HW misconfiguration (no link, port enumeration issues, etc).
According to the the Synopsys DWC PCIe Reference Manual, in the section dedicated to the PLCR register, bit 7 is described (FAST_LINK_MODE) as:
"Sets all internal timers to fast mode for simulation purposes."
it is sound to set this bit from a simulation perspective, but on actual silicon, which expects timers to have a nominal value, it is not.
Make sure the FAST_LINK_MODE bit is cleared when configuring the RC to solve this problem.
--- drivers/pci/controller/dwc/pci-meson.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pci-meson.c +2 -2
@@ -289,11 +289,11 @@ static void meson_pcie_init_dw(struct meson_pcie *mp)meson_cfg_writel (mp, val,PCIE_CFG0 ); val =meson_elb_readl (mp,PCIE_PORT_LINK_CTRL_OFF ); - val &= ~LINK_CAPABLE_MASK ; + val &= ~(LINK_CAPABLE_MASK |FAST_LINK_MODE );meson_elb_writel (mp, val,PCIE_PORT_LINK_CTRL_OFF ); val =meson_elb_readl (mp,PCIE_PORT_LINK_CTRL_OFF ); - val |=LINK_CAPABLE_X1 |FAST_LINK_MODE ; + val |=LINK_CAPABLE_X1 ;meson_elb_writel (mp, val,PCIE_PORT_LINK_CTRL_OFF ); val =meson_elb_readl (mp,PCIE_GEN2_CTRL_OFF );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 236/477 RDMA/hns: Bugfix for querying qkey
In reply to Greg Kroah-HartmanFrom: Lijun Ou <[email protected]>
[ Upstream commit 349be276509455ac2f19fa4051ed773082c6a27e ]
The qkey queried through the query ud qp verb is a fixed value and it should be read from qp context.
--- drivers/infiniband/hw/hns/hns_roce_hw_v2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/hns/hns_roce_hw_v2.c +1 -1
@@ -4639,7 +4639,7 @@ static int hns_roce_v2_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, qp_attr->path_mig_state =IB_MIG_ARMED ; qp_attr->ah_attr.type =RDMA_AH_ATTR_TYPE_ROCE ;if (hr_qp->ibqp.qp_type ==IB_QPT_UD ) - qp_attr->qkey =V2_QKEY_VAL ; + qp_attr->qkey =le32_to_cpu (context.qkey_xrcd); qp_attr->rq_psn = roce_get_field(context.byte_108_rx_reqepsn, V2_QPC_BYTE_108_RX_REQ_EPSN_M,
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 251/477 PCI/PTM: Inherit Switch Downstream Port PTM settings from Upstream Port
In reply to Greg Kroah-HartmanFrom: Bjorn Helgaas <[email protected]>
[ Upstream commit 7b38fd9760f51cc83d80eed2cfbde8b5ead9e93a ]
Except for Endpoints, we enable PTM at enumeration-time. Previously we did not account for the fact that Switch Downstream Ports are not permitted to have a PTM capability; their PTM behavior is controlled by the Upstream Port (PCIe r5.0, sec 7.9.16). Since Downstream Ports don't have a PTM capability, we did not mark them as "ptm_enabled", which meant that pci_enable_ptm() on an Endpoint failed because there was no PTM path to it.
Mark Downstream Ports as "ptm_enabled" if their Upstream Port has PTM enabled.
--- drivers/pci/pcie/ptm.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
drivers/pci/pcie/ptm.c +17 -5
@@ -39,10 +39,6 @@ void pci_ptm_init(struct pci_dev *dev)if (!pci_is_pcie (dev))return ; - pos =pci_find_ext_capability (dev,PCI_EXT_CAP_ID_PTM ); -if (!pos) -return ; -/* * Enable PTM only on interior devices (root ports, switch ports, * etc.) on the assumption that it causes no link traffic until an
@@ -52,6 +48,23 @@ void pci_ptm_init(struct pci_dev *dev) pci_pcie_type(dev) == PCI_EXP_TYPE_RC_END))return ; +/* +* Switch Downstream Ports are not permitted to have a PTM +* capability; their PTM behavior is controlled by the Upstream +* Port (PCIe r5.0, sec 7.9.16). +*/ + ups =pci_upstream_bridge (dev); +if (pci_pcie_type (dev) ==PCI_EXP_TYPE_DOWNSTREAM && + ups && ups->ptm_enabled) { + dev->ptm_granularity = ups->ptm_granularity; + dev->ptm_enabled =1 ; +return ; + } + + pos =pci_find_ext_capability (dev,PCI_EXT_CAP_ID_PTM ); +if (!pos) +return ; +pci_read_config_dword (dev, pos +PCI_PTM_CAP , &cap); local_clock = (cap &PCI_PTM_GRANULARITY_MASK ) >>8 ;
@@ -61,7 +74,6 @@ void pci_ptm_init(struct pci_dev *dev)* the spec recommendation (PCIe r3.1, sec 7.32.3), select the * furthest upstream Time Source as the PTM Root. */ - ups =pci_upstream_bridge (dev);if (ups && ups->ptm_enabled) { ctrl =PCI_PTM_CTRL_ENABLE ;if (ups->ptm_granularity ==0 )
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 207/477 ALSA: usb-audio: Add duplex sound support for USB devices using implicit feedback
In reply to Greg Kroah-HartmanFrom: Erwin Burema <[email protected]>
[ Upstream commit 10ce77e4817fef99e1166be7e6685a80c63bf77f ]
For USB sound devices using implicit feedback the endpoint used for this feedback should be able to be opened twice, once for required feedback and second time for audio data. This way these devices can be put in duplex audio mode. Since this only works if the settings of the endpoint don't change a check is included for this.
This fixes bug 207023 ("MOTU M2 regression on duplex audio") and should also fix bug 103751 ("M-Audio Fast Track Ultra usb audio device will not operate full-duplex")
--- sound/usb/card.h | 1 + sound/usb/endpoint.c | 195 ++++++++++++++++++++++++++++++++++++++++++- sound/usb/pcm.c | 5 ++ 3 files changed, 197 insertions(+), 4 deletions(-)
sound/usb/card.h +1 -0
@@ -108,6 +108,7 @@ struct snd_usb_endpoint {int iface, altsetting;int skip_packets;/* quirks for devices to ignore the first n packets in a stream */ +bool is_implicit_feedback;/* This endpoint is used as implicit feedback */ spinlock_t lock;struct list_head list;
sound/usb/endpoint.c +191 -4
213 lines not on this page · raw message
sound/usb/pcm.c +5 -0
@@ -404,6 +404,8 @@ add_sync_ep:if (!subs->sync_endpoint)return -EINVAL ; + subs->sync_endpoint->is_implicit_feedback =1 ; + subs->data_endpoint->sync_master = subs->sync_endpoint;return 1 ;
@@ -502,12 +504,15 @@ static int set_sync_endpoint(struct snd_usb_substream *subs, implicit_fb ?SND_USB_ENDPOINT_TYPE_DATA : SND_USB_ENDPOINT_TYPE_SYNC); +if (!subs->sync_endpoint) {if (is_playback && attr ==USB_ENDPOINT_SYNC_NONE )return 0 ;return -EINVAL ; } + subs->sync_endpoint->is_implicit_feedback = implicit_fb; + subs->data_endpoint->sync_master = subs->sync_endpoint;return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 250/477 xen/cpuhotplug: Fix initial CPU offlining for PV(H) guests
In reply to Greg Kroah-HartmanFrom: Boris Ostrovsky <[email protected]>
[ Upstream commit c54b071c192dfe8061336f650ceaf358e6386e0b ]
Commit a926f81d2f6c ("xen/cpuhotplug: Replace cpu_up/down() with device_online/offline()") replaced cpu_down() with device_offline() call which requires that the CPU has been registered before. This registration, however, happens later from topology_init() which is called as subsys_initcall(). setup_vcpu_hotplug_event(), on the other hand, is invoked earlier, during arch_initcall().
As result, booting a PV(H) guest with vcpus < maxvcpus causes a crash.
Move setup_vcpu_hotplug_event() (and therefore setup_cpu_watcher()) to late_initcall(). In addition, instead of performing all offlining steps in setup_cpu_watcher() simply call disable_hotplug_cpu().
--- drivers/xen/cpu_hotplug.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/xen/cpu_hotplug.c +3 -5
@@ -93,10 +93,8 @@ static int setup_cpu_watcher(struct notifier_block *notifier, (void )register_xenbus_watch (&cpu_watch);for_each_possible_cpu (cpu) { -if (vcpu_online (cpu) ==0 ) { -device_offline (get_cpu_device (cpu)); -set_cpu_present (cpu, false); - } +if (vcpu_online (cpu) ==0 ) +disable_hotplug_cpu (cpu); }return NOTIFY_DONE ;
@@ -119,5 +117,5 @@ static int __init setup_vcpu_hotplug_event(void)return 0 ; } -arch_initcall (setup_vcpu_hotplug_event); +late_initcall (setup_vcpu_hotplug_event);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 248/477 dm zoned: return NULL if dmz_get_zone_for_reclaim() fails to find a zone
In reply to Greg Kroah-HartmanFrom: Hannes Reinecke <[email protected]>
[ Upstream commit 489dc0f06a5837f87482c0ce61d830d24e17082e ]
The only case where dmz_get_zone_for_reclaim() cannot return a zone is if the respective lists are empty. So we should just return a simple NULL value here as we really don't have an error code which would make sense.
--- drivers/md/dm-zoned-metadata.c | 4 ++-- drivers/md/dm-zoned-reclaim.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/md/dm-zoned-metadata.c +2 -2
@@ -1554,7 +1554,7 @@ static struct dm_zone *dmz_get_rnd_zone_for_reclaim(struct dmz_metadata *zmd)return dzone; } -return ERR_PTR (-EBUSY ); +return NULL ; }/*
@@ -1574,7 +1574,7 @@ static struct dm_zone *dmz_get_seq_zone_for_reclaim(struct dmz_metadata *zmd)return zone; } -return ERR_PTR (-EBUSY ); +return NULL ; }/*
drivers/md/dm-zoned-reclaim.c +2 -2
@@ -349,8 +349,8 @@ static int dmz_do_reclaim(struct dmz_reclaim *zrc)/* Get a data zone */ dzone =dmz_get_zone_for_reclaim (zmd); -if (IS_ERR (dzone)) -return PTR_ERR (dzone); +if (!dzone) +return -EBUSY ; start = jiffies;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 249/477 RDMA/efa: Fix setting of wrong bit in get/set_feature commands
In reply to Greg Kroah-HartmanFrom: Gal Pressman <[email protected]>
[ Upstream commit cc8a635e24acf2793605f243c913c51b8c3702ab ]
When using a control buffer the ctrl_data bit should be set in order to indicate the control buffer address is valid, not ctrl_data_indirect which is used when the control buffer itself is indirect.
--- drivers/infiniband/hw/efa/efa_com_cmd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/efa/efa_com_cmd.c +2 -2
@@ -388,7 +388,7 @@ static int efa_com_get_feature_ex(struct efa_com_dev *edev,if (control_buff_size)EFA_SET (&get_cmd.aq_common_descriptor.flags, -EFA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT ,1 ); +EFA_ADMIN_AQ_COMMON_DESC_CTRL_DATA ,1 ); efa_com_set_dma_addr(control_buf_dma_addr, &get_cmd.control_buffer.address.mem_addr_high,
@@ -540,7 +540,7 @@ static int efa_com_set_feature_ex(struct efa_com_dev *edev,if (control_buff_size) { set_cmd->aq_common_descriptor.flags =0 ;EFA_SET (&set_cmd->aq_common_descriptor.flags, -EFA_ADMIN_AQ_COMMON_DESC_CTRL_DATA_INDIRECT ,1 ); +EFA_ADMIN_AQ_COMMON_DESC_CTRL_DATA ,1 );efa_com_set_dma_addr (control_buf_dma_addr, &set_cmd->control_buffer.address.mem_addr_high, &set_cmd->control_buffer.address.mem_addr_low);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 245/477 powerpc/powernv: add NULL check after kzalloc
In reply to Greg Kroah-HartmanFrom: Chen Zhou <[email protected]>
[ Upstream commit ceffa63acce7165c442395b7d64a11ab8b5c5dca ]
Fixes coccicheck warning:
./arch/powerpc/platforms/powernv/opal.c:813:1-5:
alloc with no test, possible model on line 814
Add NULL check after kzalloc.
--- arch/powerpc/platforms/powernv/opal.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/platforms/powernv/opal.c +4 -0
@@ -811,6 +811,10 @@ static int opal_add_one_export(struct kobject *parent, const char *export_name, goto out; attr =kzalloc (sizeof (*attr),GFP_KERNEL ); +if (!attr) { + rc = -ENOMEM ; + goto out; + } name =kstrdup (export_name,GFP_KERNEL );if (!name) { rc = -ENOMEM ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 244/477 arm64: tegra: Fix flag for 64-bit resources in ranges property
In reply to Greg Kroah-HartmanFrom: Vidya Sagar <[email protected]>
[ Upstream commit 3482a7afb261e2de9269a7f9ad0f4a3a82a83a53 ]
Fix flag in PCIe controllers device-tree nodes 'ranges' property to correctly represent 64-bit resources.
--- arch/arm64/boot/dts/nvidia/tegra194.dtsi | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/arm64/boot/dts/nvidia/tegra194.dtsi +6 -6
@@ -1387,7 +1387,7 @@ bus-range = <0x0 0xff>; ranges = <0x81000000 0x0 0x30100000 0x0 0x30100000 0x0 0x00100000 /* downstream I/O (1MB) */ - 0xc2000000 0x12 0x00000000 0x12 0x00000000 0x0 0x30000000 /* prefetchable memory (768MB) */ + 0xc3000000 0x12 0x00000000 0x12 0x00000000 0x0 0x30000000 /* prefetchable memory (768MB) */ 0x82000000 0x0 0x40000000 0x12 0x30000000 0x0 0x10000000>; /* non-prefetchable memory (256MB) */ };
@@ -1432,7 +1432,7 @@ bus-range = <0x0 0xff>; ranges = <0x81000000 0x0 0x32100000 0x0 0x32100000 0x0 0x00100000 /* downstream I/O (1MB) */ - 0xc2000000 0x12 0x40000000 0x12 0x40000000 0x0 0x30000000 /* prefetchable memory (768MB) */ + 0xc3000000 0x12 0x40000000 0x12 0x40000000 0x0 0x30000000 /* prefetchable memory (768MB) */ 0x82000000 0x0 0x40000000 0x12 0x70000000 0x0 0x10000000>; /* non-prefetchable memory (256MB) */ };
@@ -1477,7 +1477,7 @@ bus-range = <0x0 0xff>; ranges = <0x81000000 0x0 0x34100000 0x0 0x34100000 0x0 0x00100000 /* downstream I/O (1MB) */ - 0xc2000000 0x12 0x80000000 0x12 0x80000000 0x0 0x30000000 /* prefetchable memory (768MB) */ + 0xc3000000 0x12 0x80000000 0x12 0x80000000 0x0 0x30000000 /* prefetchable memory (768MB) */ 0x82000000 0x0 0x40000000 0x12 0xb0000000 0x0 0x10000000>; /* non-prefetchable memory (256MB) */ };
@@ -1522,7 +1522,7 @@ bus-range = <0x0 0xff>; ranges = <0x81000000 0x0 0x36100000 0x0 0x36100000 0x0 0x00100000 /* downstream I/O (1MB) */ - 0xc2000000 0x14 0x00000000 0x14 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ + 0xc3000000 0x14 0x00000000 0x14 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ 0x82000000 0x0 0x40000000 0x17 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ };
@@ -1567,7 +1567,7 @@ bus-range = <0x0 0xff>; ranges = <0x81000000 0x0 0x38100000 0x0 0x38100000 0x0 0x00100000 /* downstream I/O (1MB) */ - 0xc2000000 0x18 0x00000000 0x18 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ + 0xc3000000 0x18 0x00000000 0x18 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ 0x82000000 0x0 0x40000000 0x1b 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ };
@@ -1616,7 +1616,7 @@ bus-range = <0x0 0xff>; ranges = <0x81000000 0x0 0x3a100000 0x0 0x3a100000 0x0 0x00100000 /* downstream I/O (1MB) */ - 0xc2000000 0x1c 0x00000000 0x1c 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ + 0xc3000000 0x1c 0x00000000 0x1c 0x00000000 0x3 0x40000000 /* prefetchable memory (13GB) */ 0x82000000 0x0 0x40000000 0x1f 0x40000000 0x0 0xc0000000>; /* non-prefetchable memory (3GB) */ };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 229/477 ASoC: Intel: bytcr_rt5640: Add quirk for Toshiba Encore WT8-A tablet
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit 0e0e10fde0e9808d1991268f5dca69fb36c025f7 ]
The Toshiba Encore WT8-A tablet almost fully works with the default settings for non-CR Bay Trail devices. The only problem is that its jack-detect switch is not inverted (it is active high instead of the normal active low).
Add a quirk for this model using the default settings + BYT_RT5640_JD_NOT_INV.
--- sound/soc/intel/boards/bytcr_rt5640.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/soc/intel/boards/bytcr_rt5640.c +12 -0
@@ -742,6 +742,18 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = {BYT_RT5640_SSP0_AIF1 | BYT_RT5640_MCLK_EN), }, + { /* Toshiba Encore WT8-A */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"TOSHIBA" ), + DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "TOSHIBA WT8-A"), + }, + .driver_data = (void *)(BYT_RT5640_DMIC1_MAP | +BYT_RT5640_JD_SRC_JD2_IN4N | +BYT_RT5640_OVCD_TH_2000UA | +BYT_RT5640_OVCD_SF_0P75 | +BYT_RT5640_JD_NOT_INV | + BYT_RT5640_MCLK_EN), + }, { /* Catch-all for generic Insyde tablets, must be last */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "Insyde"),
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 209/477 PCI/PM: Assume ports without DLL Link Active train links in 100 ms
In reply to Greg Kroah-HartmanFrom: Mika Westerberg <[email protected]>
[ Upstream commit ec411e02b7a2e785a4ed9ed283207cd14f48699d ]
Kai-Heng Feng reported that it takes a long time (> 1 s) to resume Thunderbolt-connected devices from both runtime suspend and system sleep (s2idle).
This was because some Downstream Ports that support > 5 GT/s do not also support Data Link Layer Link Active reporting. Per PCIe r5.0 sec 6.6.1:
With a Downstream Port that supports Link speeds greater than 5.0 GT/s, software must wait a minimum of 100 ms after Link training completes before sending a Configuration Request to the device immediately below that Port. Software can determine when Link training completes by polling the Data Link Layer Link Active bit or by setting up an associated interrupt (see Section 6.7.3.3).
Sec 7.5.3.6 requires such Ports to support DLL Link Active reporting, but at least the Intel JHL6240 Thunderbolt 3 Bridge [8086:15c0] and the Intel JHL7540 Thunderbolt 3 Bridge [8086:15ea] do not.
Previously we tried to wait for Link training to complete, but since there was no DLL Link Active reporting, all we could do was wait the worst-case 1000 ms, then another 100 ms.
Instead of using the supported speeds to determine whether to wait for Link training, check whether the port supports DLL Link Active reporting. The Ports in question do not, so we'll wait only the 100 ms required for Ports that support Link speeds <= 5 GT/s.
This of course assumes these Ports always train the Link within 100 ms even if they are operating at > 5 GT/s, which is not required by the spec.
--- drivers/pci/pci.c | 30 +++++++++++++++++++++--------- 1 file changed, 21 insertions(+), 9 deletions(-)
drivers/pci/pci.c +21 -9
@@ -4660,7 +4660,8 @@ static int pci_pm_reset(struct pci_dev *dev, int probe)* pcie_wait_for_link_delay - Wait until link is active or inactive * @pdev: Bridge device * @active: waiting for active or inactive? -* @delay: Delay to wait after link has become active (in ms) +* @delay: Delay to wait after link has become active (in ms). Specify %0 +* for no delay. * * Use this to wait till link becomes active or inactive. */
@@ -4701,7 +4702,7 @@ static bool pcie_wait_for_link_delay(struct pci_dev *pdev, bool active,msleep (10 ); timeout -=10 ; } -if (active && ret) +if (active && ret && delay)msleep (delay);else if (ret != active) pci_info(pdev, "Data Link Layer Link Active not %s in 1000 msec\n",
@@ -4822,17 +4823,28 @@ void pci_bridge_wait_for_secondary_bus(struct pci_dev *dev)if (!pcie_downstream_port (dev))return ; -if (pcie_get_speed_cap (dev) <=PCIE_SPEED_5_0GT ) { -pci_dbg (dev,"waiting %d ms for downstream link\n" , delay); -msleep (delay); - }else { -pci_dbg (dev,"waiting %d ms for downstream link, after activation\n" , - delay); -if (!pcie_wait_for_link_delay (dev, true, delay)) { +/* +* Per PCIe r5.0, sec 6.6.1, for downstream ports that support +* speeds > 5 GT/s, we must wait for link training to complete +* before the mandatory delay. +* +* We can only tell when link training completes via DLL Link +* Active, which is required for downstream ports that support +* speeds > 5 GT/s (sec 7.5.3.6). Unfortunately some common +* devices do not implement Link Active reporting even when it's +* required, so we'll check for that directly instead of checking +* the supported link speed. We assume devices without Link Active +* reporting can train in 100 ms regardless of speed. +*/ +if (dev->link_active_reporting) { +pci_dbg (dev,"waiting for link to train\n" ); +if (!pcie_wait_for_link_delay (dev, true,0 )) {/* Did not train, no need to wait any further */ return ; } } +pci_dbg (child,"waiting %d ms to become accessible\n" , delay); +msleep (delay);if (!pci_device_is_present (child)) {pci_dbg (child,"waiting additional %d ms to become accessible\n" , delay);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 208/477 HID: Add quirks for Trust Panora Graphic Tablet
In reply to Greg Kroah-HartmanFrom: Cristian Klein <[email protected]>
[ Upstream commit fb68ada81e65d593b51544fa43c284322107a742 ]
The Trust Panora Graphic Tablet has two interfaces. Interface zero reports pen movement, pen pressure and pen buttons. Interface one reports tablet buttons and tablet scroll. Both use the mouse protocol.
Without these quirks, libinput gets confused about what device it talks to.
For completeness, here is the usbhid-dump:
``` $ sudo usbhid-dump -d 145f:0212 003:013:001:DESCRIPTOR 1588949402.559961 05 0D 09 01 A1 01 85 07 A1 02 09 00 75 08 95 07 81 02 C0 C0 09 0E A1 01 85 05 09 23 A1 02 09 52 09 53 25 0A 75 08 95 02 B1 02 C0 C0 05 0C 09 36 A1 00 85 06 05 09 19 01 29 20 15 00 25 01 95 20 75 01 81 02 C0 003:013:000:DESCRIPTOR 1588949402.563942 05 01 09 02 A1 01 85 08 09 01 A1 00 05 09 19 01 29 03 15 00 25 01 95 03 75 01 81 02 95 05 81 01 05 01 09 30 09 31 09 38 09 00 15 81 25 7F 75 08 95 04 81 06 C0 C0 05 01 09 02 A1 01 85 09 09 01 A1 00 05 09 19 01 29 03 15 00 25 01 95 03 75 01 81 02 95 05 81 01 05 01 09 30 09 31 26 FF 7F 95 02 75 10 81 02 05 0D 09 30 26 FF 03 95 01 75 10 81 02 C0 C0 05 01 09 00 A1 01 85 04 A1 00 26 FF 00 09 00 75 08 95 07 B1 02 C0 C0 ```
--- drivers/hid/hid-ids.h | 3 +++ drivers/hid/hid-quirks.c | 1 + 2 files changed, 4 insertions(+)
drivers/hid/hid-ids.h +3 -0
@@ -1157,6 +1157,9 @@#define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882 0x8882#define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8883 0x8883 +#define USB_VENDOR_ID_TRUST 0x145f +#define USB_DEVICE_ID_TRUST_PANORA_TABLET 0x0212 +#define USB_VENDOR_ID_TURBOX 0x062a#define USB_DEVICE_ID_TURBOX_KEYBOARD 0x0201#define USB_DEVICE_ID_ASUS_MD_5110 0x5110
drivers/hid/hid-quirks.c +1 -0
@@ -168,6 +168,7 @@ static const struct hid_device_id hid_quirks[] = { { HID_USB_DEVICE(USB_VENDOR_ID_TOUCHPACK, USB_DEVICE_ID_TOUCHPACK_RTS), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8882), HID_QUIRK_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN_8883), HID_QUIRK_NOGET }, + { HID_USB_DEVICE(USB_VENDOR_ID_TRUST, USB_DEVICE_ID_TRUST_PANORA_TABLET), HID_QUIRK_MULTI_INPUT | HID_QUIRK_HIDINPUT_FORCE }, { HID_USB_DEVICE(USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD), HID_QUIRK_NOGET }, { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_KNA5), HID_QUIRK_MULTI_INPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_TWA60), HID_QUIRK_MULTI_INPUT },
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 215/477 powerpc/64s/exception: Fix machine check no-loss idle wakeup
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit 8a5054d8cbbe03c68dcb0957c291c942132e4101 ]
The architecture allows for machine check exceptions to cause idle wakeups which resume at the 0x200 address which has to return via the idle wakeup code, but the early machine check handler is run first.
The case of a no state-loss sleep is broken because the early handler uses non-volatile register r1 , which is needed for the wakeup protocol, but it is not restored.
Fix this by loading r1 from the MCE exception frame before returning to the idle wakeup code. Also update the comment which has become stale since the idle rewrite in C.
This crash was found and fix confirmed with a machine check injection test in qemu powernv model (which is not upstream in qemu yet).
--- arch/powerpc/kernel/exceptions-64s.S | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
arch/powerpc/kernel/exceptions-64s.S +8 -6
@@ -1225,17 +1225,19 @@ EXC_COMMON_BEGIN(machine_check_idle_common) bl machine_check_queue_event /* - * We have not used any non-volatile GPRs here, and as a rule - * most exception code including machine check does not. - * Therefore PACA_NAPSTATELOST does not need to be set. Idle - * wakeup will restore volatile registers. + * GPR-loss wakeups are relatively straightforward, because the + * idle sleep code has saved all non-volatile registers on its + * own stack, and r1 in PACAR1. * - * Load the original SRR1 into r3 for pnv_powersave_wakeup_mce. + * For no-loss wakeups the r1 and lr registers used by the + * early machine check handler have to be restored first. r2 is + * the kernel TOC, so no need to restore it. * * Then decrement MCE nesting after finishing with the stack. */ ld r3,_MSR(r1) ld r4,_LINK(r1) + ld r1,GPR1(r1) lhz r11,PACA_IN_MCE(r13) subi r11,r11,1
@@ -1244,7 +1246,7 @@ EXC_COMMON_BEGIN(machine_check_idle_common) mtlr r4 rlwinm r10,r3,47-31,30,31 cmpwi cr1,r10,2 - bltlr cr1 /* no state loss, return to idle caller */ + bltlr cr1 /* no state loss, return to idle caller with r3=SRR1 */ b idle_return_gpr_loss #endif
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 206/477 ALSA: usb-audio: fixing upper volume limit for RME Babyface Pro routing crosspoints
In reply to Greg Kroah-HartmanFrom: Thomas Ebeling <[email protected]>
[ Upstream commit 47b4f5f5b65680fbef7a7a9a4796b35f38a6e43e ]
In my initial patch, these were set too low.
--- sound/usb/mixer_quirks.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/usb/mixer_quirks.c +2 -2
@@ -2191,7 +2191,7 @@ static int snd_rme_controls_create(struct usb_mixer_interface *mixer)* These devices exposes a couple of DSP functions via request to EP0. * Switches are available via control registers, while routing is controlled * by controlling the volume on each possible crossing point. -* Volume control is linear, from -inf (dec. 0) to +6dB (dec. 46341) with +* Volume control is linear, from -inf (dec. 0) to +6dB (dec. 65536) with * 0dB being at dec. 32768. */ enum {
@@ -2220,7 +2220,7 @@ enum {#define SND_BBFPRO_MIXER_VAL_MASK 0x3ffff#define SND_BBFPRO_MIXER_VAL_SHIFT 9#define SND_BBFPRO_MIXER_VAL_MIN 0 // -inf -#define SND_BBFPRO_MIXER_VAL_MAX 46341 // +6dB +#define SND_BBFPRO_MIXER_VAL_MAX 65536 // +6dB#define SND_BBFPRO_USBREQ_CTL_REG1 0x10#define SND_BBFPRO_USBREQ_CTL_REG2 0x17
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 205/477 staging: wfx: fix value of scan timeout
In reply to Greg Kroah-HartmanFrom: Jérôme Pouiller <[email protected]>
[ Upstream commit 6598b12d6635e8e3060863b84c04e472546ee126 ]
Before to start the scan request, the firmware signals (with a null frame) to the AP it won't be able to receive data. This frame can be long to send: up to 512TU. The current calculus of the scan timeout does not take into account this delay.
--- drivers/staging/wfx/hif_tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wfx/hif_tx.c +1 -1
@@ -268,7 +268,7 @@ int hif_scan(struct wfx_vif *wvif, struct cfg80211_scan_request *req, tmo_chan_bg =le32_to_cpu (body->max_channel_time) *USEC_PER_TU ; tmo_chan_fg =512 *USEC_PER_TU + body->probe_delay; tmo_chan_fg *= body->num_of_probe_requests; - tmo = chan_num *max (tmo_chan_bg, tmo_chan_fg); + tmo = chan_num *max (tmo_chan_bg, tmo_chan_fg) +512 *USEC_PER_TU ;wfx_fill_header (hif, wvif->id,HIF_REQ_ID_START_SCAN , buf_len); ret =wfx_cmd_send (wvif->wdev, hif,NULL ,0 , false);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 232/477 coresight: Fix support for sparsely populated ports
In reply to Greg Kroah-HartmanFrom: Suzuki K Poulose <[email protected]>
[ Upstream commit d375b356e687f2eefb51ddc3f1f2414cfa498f86 ]
On some systems the firmware may not describe all the ports connected to a component (e.g, for security reasons). This could be especially problematic for "funnels" where we could end up in modifying memory beyond the allocated space for refcounts.
e.g, for a funnel with input ports listed 0, 3, 5, nr_inport = 3. However the we could access refcnts[5] while checking for references, like :
[ 526.110401] ================================================================== [ 526.117988] BUG: KASAN: slab-out-of-bounds in funnel_enable+0x54/0x1b0 [ 526.124706] Read of size 4 at addr ffffff8135f9549c by task bash/1114 [ 526.131324] [ 526.132886] CPU: 3 PID: 1114 Comm: bash Tainted: G S 5.4.25 #232 [ 526.140397] Hardware name: Qualcomm Technologies, Inc. SC7180 IDP (DT) [ 526.147113] Call trace: [ 526.149653] dump_backtrace+0x0/0x188 [ 526.153431] show_stack+0x20/0x2c [ 526.156852] dump_stack+0xdc/0x144 [ 526.160370] print_address_description+0x3c/0x494 [ 526.165211] __kasan_report+0x144/0x168 [ 526.169170] kasan_report+0x10/0x18 [ 526.172769] check_memory_region+0x1a4/0x1b4 [ 526.177164] __kasan_check_read+0x18/0x24 [ 526.181292] funnel_enable+0x54/0x1b0 [ 526.185072] coresight_enable_path+0x104/0x198 [ 526.189649] coresight_enable+0x118/0x26c
...
[ 526.237782] Allocated by task 280: [ 526.241298] __kasan_kmalloc+0xf0/0x1ac [ 526.245249] kasan_kmalloc+0xc/0x14 [ 526.248849] __kmalloc+0x28c/0x3b4 [ 526.252361] coresight_register+0x88/0x250 [ 526.256587] funnel_probe+0x15c/0x228 [ 526.260365] dynamic_funnel_probe+0x20/0x2c [ 526.264679] amba_probe+0xbc/0x158 [ 526.268193] really_probe+0x144/0x408 [ 526.271970] driver_probe_device+0x70/0x140
...
[ 526.316810] [ 526.318364] Freed by task 0: [ 526.321344] (stack is not available) [ 526.325024] [ 526.326580] The buggy address belongs to the object at ffffff8135f95480 [ 526.326580] which belongs to the cache kmalloc-128 of size 128 [ 526.339439] The buggy address is located 28 bytes inside of [ 526.339439] 128-byte region [ffffff8135f95480, ffffff8135f95500) [ 526.351399] The buggy address belongs to the page: [ 526.356342] page:ffffffff04b7e500 refcount:1 mapcount:0 mapping:ffffff814b00c380 index:0x0 compound_mapcount: 0 [ 526.366711] flags: 0x4000000000010200(slab|head) [ 526.371475] raw: 4000000000010200 ffffffff05034008 ffffffff0501eb08 ffffff814b00c380 [ 526.379435] raw: 0000000000000000 0000000000190019 00000001ffffffff 0000000000000000 [ 526.387393] page dumped because: kasan: bad access detected [ 526.393128] [ 526.394681] Memory state around the buggy address: [ 526.399619] ffffff8135f95380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 526.407046] ffffff8135f95400: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 526.414473] >ffffff8135f95480: 04 fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 526.421900] ^ [ 526.426029] ffffff8135f95500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 526.433456] ffffff8135f95580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 526.440883] ==================================================================
To keep the code simple, we now track the maximum number of possible input/output connections to/from this component @ nr_inport and nr_outport in platform_data, respectively. Thus the output connections could be sparse and code is adjusted to skip the unspecified connections.
--- .../hwtracing/coresight/coresight-platform.c | 85 +++++++++++++------ drivers/hwtracing/coresight/coresight.c | 7 +- include/linux/coresight.h | 10 ++- 3 files changed, 72 insertions(+), 30 deletions(-)
drivers/hwtracing/coresight/coresight-platform.c +60 -25
@@ -87,6 +87,7 @@ static void of_coresight_get_ports_legacy(const struct device_node *node, int *nr_inport, int *nr_outport) { struct device_node *ep = NULL; +struct of_endpoint endpoint;int in =0 , out =0 ; do {
@@ -94,10 +95,16 @@ static void of_coresight_get_ports_legacy(const struct device_node *node,if (!ep)break ; -if (of_coresight_legacy_ep_is_input (ep)) - in++; -else - out++; +if (of_graph_parse_endpoint (ep, &endpoint)) +continue ; + +if (of_coresight_legacy_ep_is_input (ep)) { + in = (endpoint.port +1 > in) ? + endpoint.port +1 : in; + }else { + out = (endpoint.port +1 ) > out ? + endpoint.port +1 : out; + } }while (ep);
@@ -137,9 +144,16 @@ of_coresight_count_ports(struct device_node *port_parent) {int i =0 ;struct device_node *ep =NULL ; +struct of_endpoint endpoint; + +while ((ep =of_graph_get_next_endpoint (port_parent, ep))) { +/* Defer error handling to parsing */ +if (of_graph_parse_endpoint (ep, &endpoint)) +continue ; +if (endpoint.port +1 > i) + i = endpoint.port +1 ; + } -while ((ep =of_graph_get_next_endpoint (port_parent, ep))) - i++;return i; }
@@ -191,14 +205,12 @@ static int of_coresight_get_cpu(struct device *dev)* Parses the local port, remote device name and the remote port. * * Returns : -* 1 - If the parsing is successful and a connection record -* was created for an output connection. * 0 - If the parsing completed without any fatal errors. * -Errno - Fatal error, abort the scanning. */ static int of_coresight_parse_endpoint (struct device *dev,struct device_node *ep, -struct coresight_connection *conn) +struct coresight_platform_data *pdata) {int ret =0 ;struct of_endpoint endpoint, rendpoint;
@@ -206,6 +218,7 @@ static int of_coresight_parse_endpoint(struct device *dev,struct device_node *rep =NULL ;struct device *rdev =NULL ;struct fwnode_handle *rdev_fwnode; +struct coresight_connection *conn; do { /* Parse the local port details */
@@ -232,6 +245,13 @@ static int of_coresight_parse_endpoint(struct device *dev,break ; } + conn = &pdata->conns[endpoint.port]; +if (conn->child_fwnode) { +dev_warn (dev,"Duplicate output port %d\n" , + endpoint.port); + ret = -EINVAL ; +break ; + } conn->outport = endpoint.port;/* * Hold the refcount to the target device. This could be
@@ -244,7 +264,6 @@ static int of_coresight_parse_endpoint(struct device *dev, conn->child_fwnode =fwnode_handle_get (rdev_fwnode); conn->child_port = rendpoint.port;/* Connection record updated */ - ret =1 ; }while (0 );of_node_put (rparent);
@@ -258,7 +277,6 @@ static int of_get_coresight_platform_data(struct device *dev, struct coresight_platform_data *pdata) {int ret =0 ; -struct coresight_connection *conn;struct device_node *ep =NULL ;const struct device_node *parent =NULL ;bool legacy_binding = false;
@@ -287,8 +305,6 @@ static int of_get_coresight_platform_data(struct device *dev,dev_warn_once (dev,"Uses obsolete Coresight DT bindings\n" ); } - conn = pdata->conns; -/* Iterate through each output port to discover topology */ while ((ep =of_graph_get_next_endpoint (parent, ep))) {/*
@@ -300,15 +316,9 @@ static int of_get_coresight_platform_data(struct device *dev,if (legacy_binding &&of_coresight_legacy_ep_is_input (ep))continue ; - ret =of_coresight_parse_endpoint (dev, ep, conn); -switch (ret) { -case 1 : - conn++;/* Fall through */ -case 0 : -break ; -default : + ret =of_coresight_parse_endpoint (dev, ep, pdata); +if (ret)return ret; - } }return 0 ;
@@ -647,6 +657,16 @@ static int acpi_coresight_parse_link(struct acpi_device *adev,* coresight_remove_match(). */ conn->child_fwnode =fwnode_handle_get (&r_adev->fwnode); + }else if (dir ==ACPI_CORESIGHT_LINK_SLAVE ) { +/* +* We are only interested in the port number +* for the input ports at this component. +* Store the port number in child_port. +*/ + conn->child_port = fields[0 ].integer.value; + }else { +/* Invalid direction */ +return -EINVAL ; }return dir;
@@ -692,10 +712,20 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev,return dir;if (dir ==ACPI_CORESIGHT_LINK_MASTER ) { - pdata->nr_outport++; +if (ptr->outport > pdata->nr_outport) + pdata->nr_outport = ptr->outport; ptr++; }else { - pdata->nr_inport++; +WARN_ON (pdata->nr_inport == ptr->child_port); +/* +* We do not track input port connections for a device. +* However we need the highest port number described, +* which can be recorded now and reuse this connection +* record for an output connection. Hence, do not move +* the ptr for input connections +*/ +if (ptr->child_port > pdata->nr_inport) + pdata->nr_inport = ptr->child_port; } }
@@ -704,8 +734,13 @@ static int acpi_coresight_parse_graph(struct acpi_device *adev,return rc;/* Copy the connection information to the final location */ -for (i =0 ; i < pdata->nr_outport; i++) - pdata->conns[i] = conns[i]; +for (i =0 ; conns + i < ptr; i++) { +int port = conns[i].outport; + +/* Duplicate output port */ +WARN_ON (pdata->conns[port].child_fwnode); + pdata->conns[port] = conns[i]; + }devm_kfree (&adev->dev, conns);return 0 ;
drivers/hwtracing/coresight/coresight.c +6 -1
@@ -1053,6 +1053,9 @@ static int coresight_orphan_match(struct device *dev, void *data)for (i =0 ; i < i_csdev->pdata->nr_outport; i++) { conn = &i_csdev->pdata->conns[i]; +/* Skip the port if FW doesn't describe it */ +if (!conn->child_fwnode) +continue ;/* We have found at least one orphan connection */ if (conn->child_dev ==NULL ) {/* Does it match this newly added device? */
@@ -1091,6 +1094,8 @@ static void coresight_fixup_device_conns(struct coresight_device *csdev)for (i =0 ; i < csdev->pdata->nr_outport; i++) {struct coresight_connection *conn = &csdev->pdata->conns[i]; +if (!conn->child_fwnode) +continue ; conn->child_dev =coresight_find_csdev_by_fwnode (conn->child_fwnode);if (!conn->child_dev)
@@ -1118,7 +1123,7 @@ static int coresight_remove_match(struct device *dev, void *data)for (i =0 ; i < iterator->pdata->nr_outport; i++) { conn = &iterator->pdata->conns[i]; -if (conn->child_dev ==NULL ) +if (conn->child_dev ==NULL || conn->child_fwnode ==NULL )continue ;if (csdev->dev.fwnode == conn->child_fwnode) {
include/linux/coresight.h +6 -4
@@ -100,10 +100,12 @@ union coresight_dev_subtype { };/** -* struct coresight_platform_data - data harvested from the DT specification -* @nr_inport: number of input ports for this component. -* @nr_outport: number of output ports for this component. -* @conns: Array of nr_outport connections from this component +* struct coresight_platform_data - data harvested from the firmware +* specification. +* +* @nr_inport: Number of elements for the input connections. +* @nr_outport: Number of elements for the output connections. +* @conns: Sparse array of nr_outport connections from this component. */ struct coresight_platform_data {int nr_inport;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 233/477 coresight: etm4x: Fix use-after-free of per-cpu etm drvdata
In reply to Greg Kroah-HartmanFrom: Suzuki K Poulose <[email protected]>
[ Upstream commit 3f4943d422c5febbb3c764670011a00eb2a86238 ]
etm probe could be deferred due to the dependency in the trace path chain and may be retried. We need to clear the per-cpu etmdrvdata entry for the etm in case of a failure to avoid use-after-free cases as reported below:
KASAN use-after-free bug in etm4_cpu_pm_notify():
[ 8.574566] coresight etm0: CPU0: ETM v4.2 initialized [ 8.581920] BUG: KASAN: use-after-free in etm4_cpu_pm_notify+0x580/0x2024 [ 8.581925] Read of size 8 at addr ffffff813304f8c8 by task swapper/3/0 [ 8.581927] [ 8.581934] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G S W 5.4.28 #314 [ 8.587775] coresight etm1: CPU1: ETM v4.2 initialized [ 8.594195] Call trace: [ 8.594205] dump_backtrace+0x0/0x188 [ 8.594209] show_stack+0x20/0x2c [ 8.594216] dump_stack+0xdc/0x144 [ 8.594227] print_address_description+0x3c/0x494 [ 8.594232] __kasan_report+0x144/0x168 [ 8.601598] coresight etm2: CPU2: ETM v4.2 initialized [ 8.602563] kasan_report+0x10/0x18 [ 8.602568] check_memory_region+0x1a4/0x1b4 [ 8.602572] __kasan_check_read+0x18/0x24 [ 8.602577] etm4_cpu_pm_notify+0x580/0x2024 [ 8.665945] notifier_call_chain+0x5c/0x90 [ 8.670166] __atomic_notifier_call_chain+0x90/0xf8 [ 8.675182] cpu_pm_notify+0x40/0x6c [ 8.678858] cpu_pm_enter+0x38/0x80 [ 8.682451] psci_enter_idle_state+0x34/0x70 [ 8.686844] cpuidle_enter_state+0xb8/0x20c [ 8.691143] cpuidle_enter+0x38/0x4c [ 8.694820] call_cpuidle+0x3c/0x68 [ 8.698408] do_idle+0x1a0/0x280 [ 8.701729] cpu_startup_entry+0x24/0x28 [ 8.705768] secondary_start_kernel+0x15c/0x170 [ 8.710423] [ 8.711972] Allocated by task 242: [ 8.715473] __kasan_kmalloc+0xf0/0x1ac [ 8.719426] kasan_slab_alloc+0x14/0x1c [ 8.723375] __kmalloc_track_caller+0x23c/0x388 [ 8.728040] devm_kmalloc+0x38/0x94 [ 8.731632] etm4_probe+0x48/0x3c8 [ 8.735140] amba_probe+0xbc/0x158 [ 8.738645] really_probe+0x144/0x408 [ 8.742412] driver_probe_device+0x70/0x140 [ 8.746716] __device_attach_driver+0x9c/0x110 [ 8.751287] bus_for_each_drv+0x90/0xd8 [ 8.755236] __device_attach+0xb4/0x164 [ 8.759188] device_initial_probe+0x20/0x2c [ 8.763490] bus_probe_device+0x34/0x94 [ 8.767436] device_add+0x34c/0x3e0 [ 8.771029] amba_device_try_add+0x68/0x440 [ 8.775332] amba_deferred_retry_func+0x48/0xc8 [ 8.779997] process_one_work+0x344/0x648 [ 8.784127] worker_thread+0x2ac/0x47c [ 8.787987] kthread+0x128/0x138 [ 8.791313] ret_from_fork+0x10/0x18 [ 8.794993] [ 8.796532] Freed by task 242: [ 8.799684] __kasan_slab_free+0x15c/0x22c [ 8.803897] kasan_slab_free+0x10/0x1c [ 8.807761] kfree+0x25c/0x4bc [ 8.810913] release_nodes+0x240/0x2b0 [ 8.814767] devres_release_all+0x3c/0x54 [ 8.818887] really_probe+0x178/0x408 [ 8.822661] driver_probe_device+0x70/0x140 [ 8.826963] __device_attach_driver+0x9c/0x110 [ 8.831539] bus_for_each_drv+0x90/0xd8 [ 8.835487] __device_attach+0xb4/0x164 [ 8.839431] device_initial_probe+0x20/0x2c [ 8.843732] bus_probe_device+0x34/0x94 [ 8.847678] device_add+0x34c/0x3e0 [ 8.851274] amba_device_try_add+0x68/0x440 [ 8.855576] amba_deferred_retry_func+0x48/0xc8 [ 8.860240] process_one_work+0x344/0x648 [ 8.864366] worker_thread+0x2ac/0x47c [ 8.868228] kthread+0x128/0x138 [ 8.871557] ret_from_fork+0x10/0x18 [ 8.875231] [ 8.876782] The buggy address belongs to the object at ffffff813304f800 [ 8.876782] which belongs to the cache kmalloc-1k of size 1024 [ 8.889632] The buggy address is located 200 bytes inside of [ 8.889632] 1024-byte region [ffffff813304f800, ffffff813304fc00) [ 8.901761] The buggy address belongs to the page: [ 8.906695] page:ffffffff04ac1200 refcount:1 mapcount:0 mapping:ffffff8146c03800 index:0x0 compound_mapcount: 0 [ 8.917047] flags: 0x4000000000010200(slab|head) [ 8.921799] raw: 4000000000010200 dead000000000100 dead000000000122 ffffff8146c03800 [ 8.929753] raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 [ 8.937703] page dumped because: kasan: bad access detected [ 8.943433] [ 8.944974] Memory state around the buggy address: [ 8.949903] ffffff813304f780: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc [ 8.957320] ffffff813304f800: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 8.964742] >ffffff813304f880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 8.972157] ^ [ 8.977886] ffffff813304f900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 8.985298] ffffff813304f980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb [ 8.992713] ==================================================================
--- drivers/hwtracing/coresight/coresight-etm4x.c | 1 + 1 file changed, 1 insertion(+)
drivers/hwtracing/coresight/coresight-etm4x.c +1 -0
@@ -1527,6 +1527,7 @@ static int etm4_probe(struct amba_device *adev, const struct amba_id *id)return 0 ; err_arch_supported: + etmdrvdata[drvdata->cpu] =NULL ;if (--etm4_count ==0 ) {etm4_cpu_pm_unregister ();
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 203/477 tty: n_gsm: Fix SOF skipping
In reply to Greg Kroah-HartmanFrom: Gregory CLEMENT <[email protected]>
[ Upstream commit 84d6f81c1fb58b56eba81ff0a36cf31946064b40 ]
For at least some modems like the TELIT LE910, skipping SOF makes transfers blocking indefinitely after a short amount of data transferred.
Given the small improvement provided by skipping the SOF (just one byte on about 100 bytes), it seems better to completely remove this "feature" than make it optional.
--- drivers/tty/n_gsm.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-)
drivers/tty/n_gsm.c +1 -7
@@ -677,7 +677,6 @@ static void gsm_data_kick(struct gsm_mux *gsm) {struct gsm_msg *msg, *nmsg;int len; -int skip_sof =0 ;list_for_each_entry_safe (msg, nmsg, &gsm->tx_list, list) {if (gsm->constipated && msg->addr)
@@ -699,15 +698,10 @@ static void gsm_data_kick(struct gsm_mux *gsm)print_hex_dump_bytes ("gsm_data_kick: " ,DUMP_PREFIX_OFFSET , gsm->txframe, len); - -if (gsm->output (gsm, gsm->txframe + skip_sof, - len - skip_sof) <0 ) +if (gsm->output (gsm, gsm->txframe, len) <0 )break ;/* FIXME: Can eliminate one SOF in many more cases */ gsm->tx_bytes -= msg->len; -/* For a burst of frames skip the extra SOF within the -burst */ - skip_sof =1 ;list_del (&msg->list);kfree (msg);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 227/477 drm/msm: Fix undefined "rd_full" link error
In reply to Greg Kroah-HartmanFrom: Bjorn Andersson <[email protected]>
[ Upstream commit 20aebe83698feb107d5a66b6cfd1d54459ccdfcf ]
rd_full should be defined outside the CONFIG_DEBUG_FS region, in order to be able to link the msm driver even when CONFIG_DEBUG_FS is disabled.
--- drivers/gpu/drm/msm/msm_rd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/msm/msm_rd.c +2 -2
@@ -29,8 +29,6 @@* or shader programs (if not emitted inline in cmdstream). */ -#ifdef CONFIG_DEBUG_FS -#include <linux/circ_buf.h> #include <linux/debugfs.h> #include <linux/kfifo.h>
@@ -47,6 +45,8 @@ bool rd_full = false;MODULE_PARM_DESC (rd_full,"If true, $debugfs/.../rd will snapshot all buffer contents" );module_param_named (rd_full, rd_full, bool,0600 ); +#ifdef CONFIG_DEBUG_FS +enum rd_sect_type {RD_NONE , RD_TEST, /* ascii text */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 228/477 drm/msm/mdp5: Fix mdp5_init error path for failed mdp5_kms allocation
In reply to Greg Kroah-HartmanFrom: Roy Spliet <[email protected]>
[ Upstream commit e4337877c5d578722c0716f131fb774522013cf5 ]
When allocation for mdp5_kms fails, calling mdp5_destroy() leads to undefined behaviour, likely a nullptr exception or use-after-free troubles.
--- drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/msm/disp/mdp5/mdp5_kms.c +2 -1
@@ -943,7 +943,8 @@ static int mdp5_init(struct platform_device *pdev, struct drm_device *dev)return 0 ; fail: -mdp5_destroy (pdev); +if (mdp5_kms) +mdp5_destroy (pdev);return ret; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 224/477 iommu/arm-smmu-v3: Dont reserve implementation defined register space
In reply to Greg Kroah-HartmanFrom: Jean-Philippe Brucker <[email protected]>
[ Upstream commit 52f3fab0067d6fa9e99c1b7f63265dd48ca76046 ]
Some SMMUv3 implementation embed the Perf Monitor Group Registers (PMCG) inside the first 64kB region of the SMMU. Since PMCG are managed by a separate driver, this layout causes resource reservation conflicts during boot.
To avoid this conflict, don't reserve the MMIO regions that are implementation defined. Although devm_ioremap_resource() still works on full pages under the hood, this way we benefit from resource conflict checks.
--- drivers/iommu/arm-smmu-v3.c | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-)
drivers/iommu/arm-smmu-v3.c +31 -4
@@ -171,6 +171,8 @@#define ARM_SMMU_PRIQ_IRQ_CFG1 0xd8#define ARM_SMMU_PRIQ_IRQ_CFG2 0xdc +#define ARM_SMMU_REG_SZ 0xe00 +/* Common MSI config fields */ #define MSI_CFG0_ADDR_MASK GENMASK_ULL(51, 2)#define MSI_CFG2_SH GENMASK(5, 4)
@@ -628,6 +630,7 @@ struct arm_smmu_strtab_cfg {struct arm_smmu_device {struct device *dev;void __iomem *base; +void __iomem *page1;#define ARM_SMMU_FEAT_2_LVL_STRTAB (1 << 0)#define ARM_SMMU_FEAT_2_LVL_CDTAB (1 << 1)
@@ -733,9 +736,8 @@ static struct arm_smmu_option_prop arm_smmu_options[] = {static inline void __iomem *arm_smmu_page1_fixup (unsigned long offset,struct arm_smmu_device *smmu) { -if ((offset >SZ_64K ) && - (smmu->options &ARM_SMMU_OPT_PAGE0_REGS_ONLY )) - offset -=SZ_64K ; +if (offset >SZ_64K ) +return smmu->page1 + offset -SZ_64K ;return smmu->base + offset; }
@@ -4021,6 +4023,18 @@ err_reset_pci_ops: __maybe_unused;return err; } +static void __iomem *arm_smmu_ioremap (struct device *dev,resource_size_t start, +resource_size_t size) +{ +struct resource res = { + .flags =IORESOURCE_MEM , + .start = start, + .end = start + size -1 , + }; + +return devm_ioremap_resource (dev, &res); +} +static int arm_smmu_device_probe (struct platform_device *pdev) {int irq, ret;
@@ -4056,10 +4070,23 @@ static int arm_smmu_device_probe(struct platform_device *pdev) } ioaddr = res->start; - smmu->base =devm_ioremap_resource (dev, res); +/* +* Don't map the IMPLEMENTATION DEFINED regions, since they may contain +* the PMCG registers which are reserved by the PMU driver. +*/ + smmu->base =arm_smmu_ioremap (dev, ioaddr,ARM_SMMU_REG_SZ );if (IS_ERR (smmu->base))return PTR_ERR (smmu->base); +if (arm_smmu_resource_size (smmu) >SZ_64K ) { + smmu->page1 =arm_smmu_ioremap (dev, ioaddr +SZ_64K , +ARM_SMMU_REG_SZ ); +if (IS_ERR (smmu->page1)) +return PTR_ERR (smmu->page1); + }else { + smmu->page1 = smmu->base; + } +/* Interrupt lines */ irq =platform_get_irq_byname_optional (pdev,"combined" );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 223/477 powerpc/ps3: Fix kexec shutdown hang
In reply to Greg Kroah-HartmanFrom: Geoff Levand <[email protected]>
[ Upstream commit 126554465d93b10662742128918a5fc338cda4aa ]
The ps3_mm_region_destroy() and ps3_mm_vas_destroy() routines are called very late in the shutdown via kexec's mmu_cleanup_all routine. By the time mmu_cleanup_all runs it is too late to use udbg_printf, and calling it will cause PS3 systems to hang.
Remove all debugging statements from ps3_mm_region_destroy() and ps3_mm_vas_destroy() and replace any error reporting with calls to lv1_panic.
With this change builds with 'DEBUG' defined will not cause kexec reboots to hang, and builds with 'DEBUG' defined or not will end in lv1_panic if an error is encountered.
--- arch/powerpc/platforms/ps3/mm.c | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-)
arch/powerpc/platforms/ps3/mm.c +12 -10
@@ -200,13 +200,14 @@ void ps3_mm_vas_destroy(void) {int result; -DBG ("%s:%d: map.vas_id = %llu\n" , __func__, __LINE__, map.vas_id); -if (map.vas_id) { result =lv1_select_virtual_address_space (0 ); -BUG_ON (result); - result =lv1_destruct_virtual_address_space (map.vas_id); -BUG_ON (result); + result +=lv1_destruct_virtual_address_space (map.vas_id); + +if (result) { +lv1_panic (0 ); + } + map.vas_id =0 ; } }
@@ -304,19 +305,20 @@ static void ps3_mm_region_destroy(struct mem_region *r)int result;if (!r->destroy) { -pr_info ("%s:%d: Not destroying high region: %llxh %llxh\n" , - __func__, __LINE__, r->base, r->size);return ; } -DBG ("%s:%d: r->base = %llxh\n" , __func__, __LINE__, r->base); -if (r->base) { result =lv1_release_memory (r->base); -BUG_ON (result); + +if (result) { +lv1_panic (0 ); + } + r->size = r->base = r->offset =0 ; map.total = map.rm.size; } +ps3_mm_set_repository_highmem (NULL ); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 222/477 phy: cadence: sierra: Fix for USB3 U1/U2 state
In reply to Greg Kroah-HartmanFrom: Sanket Parmar <[email protected]>
[ Upstream commit 2bcf14ca1a2f3202954f812f380c7fa8127fbd7f ]
Updated values of USB3 related Sierra PHY registers. This change fixes USB3 device disconnect issue observed while enternig U1/U2 state.
--- drivers/phy/cadence/phy-cadence-sierra.c | 27 ++++++++++++------------ 1 file changed, 14 insertions(+), 13 deletions(-)
drivers/phy/cadence/phy-cadence-sierra.c +14 -13
@@ -685,10 +685,10 @@ static struct cdns_reg_pairs cdns_usb_cmn_regs_ext_ssc[] = {static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { {0xFE0A ,SIERRA_DET_STANDEC_A_PREG }, {0x000F ,SIERRA_DET_STANDEC_B_PREG }, - {0x00A5 ,SIERRA_DET_STANDEC_C_PREG }, + {0x55A5 ,SIERRA_DET_STANDEC_C_PREG }, {0x69ad ,SIERRA_DET_STANDEC_D_PREG }, {0x0241 ,SIERRA_DET_STANDEC_E_PREG }, - {0x0010 ,SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG }, + {0x0110 ,SIERRA_PSM_LANECAL_DLY_A1_RESETS_PREG }, {0x0014 ,SIERRA_PSM_A0IN_TMR_PREG }, {0xCF00 ,SIERRA_PSM_DIAG_PREG }, {0x001F ,SIERRA_PSC_TX_A0_PREG },
@@ -696,7 +696,7 @@ static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { {0x0003, SIERRA_PSC_TX_A2_PREG}, {0x0003, SIERRA_PSC_TX_A3_PREG}, {0x0FFF, SIERRA_PSC_RX_A0_PREG}, - {0x0619, SIERRA_PSC_RX_A1_PREG}, + {0x0003, SIERRA_PSC_RX_A1_PREG}, {0x0003, SIERRA_PSC_RX_A2_PREG}, {0x0001, SIERRA_PSC_RX_A3_PREG}, {0x0001, SIERRA_PLLCTRL_SUBRATE_PREG},
@@ -705,19 +705,19 @@ static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { {0x00CA, SIERRA_CLKPATH_BIASTRIM_PREG}, {0x2512, SIERRA_DFE_BIASTRIM_PREG}, {0x0000, SIERRA_DRVCTRL_ATTEN_PREG}, - {0x873E, SIERRA_CLKPATHCTRL_TMR_PREG}, - {0x03CF, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, - {0x01CE, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, + {0x823E, SIERRA_CLKPATHCTRL_TMR_PREG}, + {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE1_PREG}, + {0x078F, SIERRA_RX_CREQ_FLTR_A_MODE0_PREG}, {0x7B3C, SIERRA_CREQ_CCLKDET_MODE01_PREG}, - {0x033F, SIERRA_RX_CTLE_MAINTENANCE_PREG}, + {0x023C, SIERRA_RX_CTLE_MAINTENANCE_PREG}, {0x3232, SIERRA_CREQ_FSMCLK_SEL_PREG}, {0x0000, SIERRA_CREQ_EQ_CTRL_PREG}, - {0x8000, SIERRA_CREQ_SPARE_PREG}, + {0x0000, SIERRA_CREQ_SPARE_PREG}, {0xCC44, SIERRA_CREQ_EQ_OPEN_EYE_THRESH_PREG}, - {0x8453, SIERRA_CTLELUT_CTRL_PREG}, - {0x4110, SIERRA_DFE_ECMP_RATESEL_PREG}, - {0x4110, SIERRA_DFE_SMP_RATESEL_PREG}, - {0x0002, SIERRA_DEQ_PHALIGN_CTRL}, + {0x8452, SIERRA_CTLELUT_CTRL_PREG}, + {0x4121, SIERRA_DFE_ECMP_RATESEL_PREG}, + {0x4121, SIERRA_DFE_SMP_RATESEL_PREG}, + {0x0003, SIERRA_DEQ_PHALIGN_CTRL}, {0x3200, SIERRA_DEQ_CONCUR_CTRL1_PREG}, {0x5064, SIERRA_DEQ_CONCUR_CTRL2_PREG}, {0x0030, SIERRA_DEQ_EPIPWR_CTRL2_PREG},
@@ -725,7 +725,7 @@ static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { {0x5A5A, SIERRA_DEQ_ERRCMP_CTRL_PREG}, {0x02F5, SIERRA_DEQ_OFFSET_CTRL_PREG}, {0x02F5, SIERRA_DEQ_GAIN_CTRL_PREG}, - {0x9A8A, SIERRA_DEQ_VGATUNE_CTRL_PREG}, + {0x9999, SIERRA_DEQ_VGATUNE_CTRL_PREG}, {0x0014, SIERRA_DEQ_GLUT0}, {0x0014, SIERRA_DEQ_GLUT1}, {0x0014, SIERRA_DEQ_GLUT2},
@@ -772,6 +772,7 @@ static struct cdns_reg_pairs cdns_usb_ln_regs_ext_ssc[] = { {0x000F, SIERRA_LFPSFILT_NS_PREG}, {0x0009, SIERRA_LFPSFILT_RD_PREG}, {0x0001, SIERRA_LFPSFILT_MP_PREG}, + {0x6013, SIERRA_SIGDET_SUPPORT_PREG}, {0x8013, SIERRA_SDFILT_H2L_A_PREG}, {0x8009, SIERRA_SDFILT_L2H_PREG}, {0x0024, SIERRA_RXBUFFER_CTLECTRL_PREG},
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 221/477 drivers: phy: sr-usb: do not use internal fsm for USB2 phy init
In reply to Greg Kroah-HartmanFrom: Bharat Gooty <[email protected]>
[ Upstream commit 6f0577d1411337a0d97d545abe4a784e9e611516 ]
During different reboot cycles, USB PHY PLL may not always lock during initialization and therefore can cause USB to be not usable.
Hence do not use internal FSM programming sequence for the USB PHY initialization.
--- drivers/phy/broadcom/phy-bcm-sr-usb.c | 55 +-------------------------- 1 file changed, 2 insertions(+), 53 deletions(-)
drivers/phy/broadcom/phy-bcm-sr-usb.c +2 -53
@@ -16,8 +16,6 @@ enum bcm_usb_phy_version { };enum bcm_usb_phy_reg { -PLL_NDIV_FRAC , -PLL_NDIV_INT ,PLL_CTRL ,PHY_CTRL ,PHY_PLL_CTRL ,
@@ -31,18 +29,11 @@ static const u8 bcm_usb_combo_phy_ss[] = { };static const u8 bcm_usb_combo_phy_hs[] = { - [PLL_NDIV_FRAC ] =0x04 , - [PLL_NDIV_INT ] =0x08 , [PLL_CTRL ] =0x0c , [PHY_CTRL ] =0x10 , }; -#define HSPLL_NDIV_INT_VAL 0x13 -#define HSPLL_NDIV_FRAC_VAL 0x1005 -static const u8 bcm_usb_hs_phy[] = { - [PLL_NDIV_FRAC ] =0x0 , - [PLL_NDIV_INT ] =0x4 , [PLL_CTRL ] =0x8 , [PHY_CTRL ] =0xc , };
@@ -52,7 +43,6 @@ enum pll_ctrl_bits {SSPLL_SUSPEND_EN ,PLL_SEQ_START , PLL_LOCK, - PLL_PDIV, }; static const u8 u3pll_ctrl[] = {
@@ -66,29 +56,17 @@ static const u8 u3pll_ctrl[] = {#define HSPLL_PDIV_VAL 0x1static const u8 u2pll_ctrl[] = { - [PLL_PDIV ] =1 , [PLL_RESETB ] =5 , [PLL_LOCK ] =6 , };enum bcm_usb_phy_ctrl_bits {CORERDY , -AFE_LDO_PWRDWNB , -AFE_PLL_PWRDWNB , -AFE_BG_PWRDWNB , -PHY_ISO ,PHY_RESETB ,PHY_PCTL , };#define PHY_PCTL_MASK 0xffff -/* -* 0x0806 of PCTL_VAL has below bits set -* BIT-8 : refclk divider 1 -* BIT-3:2: device mode; mode is not effect -* BIT-1: soft reset active low -*/ -#define HSPHY_PCTL_VAL 0x0806#define SSPHY_PCTL_VAL 0x0006static const u8 u3phy_ctrl[] = {
@@ -98,10 +76,6 @@ static const u8 u3phy_ctrl[] = {static const u8 u2phy_ctrl[] = { [CORERDY ] =0 , - [AFE_LDO_PWRDWNB ] =1 , - [AFE_PLL_PWRDWNB ] =2 , - [AFE_BG_PWRDWNB ] =3 , - [PHY_ISO ] =4 , [PHY_RESETB ] =5 , [PHY_PCTL ] =6 , };
@@ -186,38 +160,13 @@ static int bcm_usb_hs_phy_init(struct bcm_usb_phy_cfg *phy_cfg)int ret =0 ;void __iomem *regs = phy_cfg->regs;const u8 *offset; -u32 rd_data; offset = phy_cfg->offset; -writel (HSPLL_NDIV_INT_VAL , regs + offset[PLL_NDIV_INT ]); -writel (HSPLL_NDIV_FRAC_VAL , regs + offset[PLL_NDIV_FRAC ]); - - rd_data =readl (regs + offset[PLL_CTRL ]); - rd_data &= ~(HSPLL_PDIV_MASK << u2pll_ctrl[PLL_PDIV ]); - rd_data |= (HSPLL_PDIV_VAL << u2pll_ctrl[PLL_PDIV ]); -writel (rd_data, regs + offset[PLL_CTRL ]); - -/* Set Core Ready high */ -bcm_usb_reg32_setbits (regs + offset[PHY_CTRL ], -BIT (u2phy_ctrl[CORERDY ])); - -/* Maximum timeout for Core Ready done */ -msleep (30 ); - +bcm_usb_reg32_clrbits (regs + offset[PLL_CTRL ], +BIT (u2pll_ctrl[PLL_RESETB ]));bcm_usb_reg32_setbits (regs + offset[PLL_CTRL ],BIT (u2pll_ctrl[PLL_RESETB ])); -bcm_usb_reg32_setbits (regs + offset[PHY_CTRL ], -BIT (u2phy_ctrl[PHY_RESETB ])); - - - rd_data =readl (regs + offset[PHY_CTRL ]); - rd_data &= ~(PHY_PCTL_MASK << u2phy_ctrl[PHY_PCTL ]); - rd_data |= (HSPHY_PCTL_VAL << u2phy_ctrl[PHY_PCTL ]); -writel (rd_data, regs + offset[PHY_CTRL ]); - -/* Maximum timeout for PLL reset done */ -msleep (30 ); ret =bcm_usb_pll_lock_check (regs + offset[PLL_CTRL ],BIT (u2pll_ctrl[PLL_LOCK ]));
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 220/477 PCI: aardvark: Issue PERST via GPIO
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 5169a9851daaa2782a7bd2bb83d5b1bd224b2879 ]
Add support for issuing PERST via GPIO specified in 'reset-gpios' property (as described in PCI device tree bindings).
Some buggy cards (e.g. Compex WLE900VX or WLE1216) are not detected after reboot when PERST is not issued during driver initialization.
If bootloader already enabled link training then issuing PERST has no effect for some buggy cards (e.g. Compex WLE900VX) and these cards are not detected. We therefore clear the LINK_TRAINING_EN register before.
It was observed that Compex WLE900VX card needs to be in PERST reset for at least 10ms if bootloader enabled link training.
Tested on Turris MOX.
--- drivers/pci/controller/pci-aardvark.c | 43 ++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-)
drivers/pci/controller/pci-aardvark.c +42 -1
@@ -9,6 +9,7 @@*/ #include <linux/delay.h> +#include <linux/gpio.h> #include <linux/interrupt.h> #include <linux/irq.h> #include <linux/irqdomain.h>
@@ -18,6 +19,7 @@#include <linux/platform_device.h> #include <linux/msi.h> #include <linux/of_address.h> +#include <linux/of_gpio.h> #include <linux/of_pci.h> #include "../pci.h"
@@ -204,6 +206,7 @@ struct advk_pcie {int root_bus_nr;int link_gen;struct pci_bridge_emul bridge; +struct gpio_desc *reset_gpio; };static inline void advk_writel (struct advk_pcie *pcie,u32 val,u64 reg)
@@ -330,10 +333,31 @@ err:dev_err (dev,"link never came up\n" ); } +static void advk_pcie_issue_perst (struct advk_pcie *pcie) +{ +u32 reg; + +if (!pcie->reset_gpio) +return ; + +/* PERST does not work for some cards when link training is enabled */ + reg =advk_readl (pcie,PCIE_CORE_CTRL0_REG ); + reg &= ~LINK_TRAINING_EN ; +advk_writel (pcie, reg,PCIE_CORE_CTRL0_REG ); + +/* 10ms delay is needed for some cards */ +dev_info (&pcie->pdev->dev,"issuing PERST via reset GPIO for 10ms\n" ); +gpiod_set_value_cansleep (pcie->reset_gpio,1 ); +usleep_range (10000 ,11000 ); +gpiod_set_value_cansleep (pcie->reset_gpio,0 ); +} +static void advk_pcie_setup_hw (struct advk_pcie *pcie) {u32 reg; +advk_pcie_issue_perst (pcie); +/* Set to Direct mode */ reg =advk_readl (pcie,CTRL_CONFIG_REG ); reg &= ~(CTRL_MODE_MASK <<CTRL_MODE_SHIFT );
@@ -406,7 +430,8 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie)/* * PERST# signal could have been asserted by pinctrl subsystem before -* probe() callback has been called, making the endpoint going into +* probe() callback has been called or issued explicitly by reset gpio +* function advk_pcie_issue_perst(), making the endpoint going into * fundamental reset. As required by PCI Express spec a delay for at * least 100ms after such a reset before link training is needed. */
@@ -1046,6 +1071,22 @@ static int advk_pcie_probe(struct platform_device *pdev) } pcie->root_bus_nr = bus->start; + pcie->reset_gpio =devm_gpiod_get_from_of_node (dev, dev->of_node, +"reset-gpios" ,0 , +GPIOD_OUT_LOW , +"pcie1-reset" ); + ret =PTR_ERR_OR_ZERO (pcie->reset_gpio); +if (ret) { +if (ret == -ENOENT ) { + pcie->reset_gpio =NULL ; + }else { +if (ret != -EPROBE_DEFER ) +dev_err (dev,"Failed to get reset-gpio: %i\n" , + ret); +return ret; + } + } + ret =of_pci_get_max_link_speed (dev->of_node);if (ret <=0 || ret >3 ) pcie->link_gen =3 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 219/477 PCI: aardvark: Improve link training
In reply to Greg Kroah-HartmanFrom: Marek Behún <[email protected]>
[ Upstream commit 43fc679ced18006b12d918d7a8a4af392b7fbfe7 ]
Currently the aardvark driver trains link in PCIe gen2 mode. This may cause some buggy gen1 cards (such as Compex WLE900VX) to be unstable or even not detected. Moreover when ASPM code tries to retrain link second time, these cards may stop responding and link goes down. If gen1 is used this does not happen.
Unconditionally forcing gen1 is not a good solution since it may have performance impact on gen2 cards.
To overcome this, read 'max-link-speed' property (as defined in PCI device tree bindings) and use this as max gen mode. Then iteratively try link training at this mode or lower until successful. After successful link training choose final controller gen based on Negotiated Link Speed from Link Status register, which should match card speed.
--- drivers/pci/controller/pci-aardvark.c | 114 ++++++++++++++++++++------ 1 file changed, 89 insertions(+), 25 deletions(-)
drivers/pci/controller/pci-aardvark.c +89 -25
@@ -40,6 +40,7 @@#define PCIE_CORE_LINK_CTRL_STAT_REG 0xd0#define PCIE_CORE_LINK_L0S_ENTRY BIT(0)#define PCIE_CORE_LINK_TRAINING BIT(5) +#define PCIE_CORE_LINK_SPEED_SHIFT 16#define PCIE_CORE_LINK_WIDTH_SHIFT 20#define PCIE_CORE_ERR_CAPCTL_REG 0x118#define PCIE_CORE_ERR_CAPCTL_ECRC_CHK_TX BIT(5)
@@ -201,6 +202,7 @@ struct advk_pcie {struct mutex msi_used_lock;u16 msi_msg;int root_bus_nr; +int link_gen;struct pci_bridge_emul bridge; };
@@ -225,20 +227,16 @@ static int advk_pcie_link_up(struct advk_pcie *pcie)static int advk_pcie_wait_for_link (struct advk_pcie *pcie) { -struct device *dev = &pcie->pdev->dev;int retries;/* check if the link is up or not */ for (retries =0 ; retries <LINK_WAIT_MAX_RETRIES ; retries++) { -if (advk_pcie_link_up (pcie)) { -dev_info (dev,"link up\n" ); +if (advk_pcie_link_up (pcie))return 0 ; - }usleep_range (LINK_WAIT_USLEEP_MIN ,LINK_WAIT_USLEEP_MAX ); } -dev_err (dev,"link never came up\n" );return -ETIMEDOUT ; }
@@ -253,6 +251,85 @@ static void advk_pcie_wait_for_retrain(struct advk_pcie *pcie) } } +static int advk_pcie_train_at_gen (struct advk_pcie *pcie,int gen) +{ +int ret, neg_gen; +u32 reg; + +/* Setup link speed */ + reg =advk_readl (pcie,PCIE_CORE_CTRL0_REG ); + reg &= ~PCIE_GEN_SEL_MSK ; +if (gen ==3 ) + reg |=SPEED_GEN_3 ; +else if (gen ==2 ) + reg |=SPEED_GEN_2 ; +else + reg |=SPEED_GEN_1 ; +advk_writel (pcie, reg,PCIE_CORE_CTRL0_REG ); + +/* +* Enable link training. This is not needed in every call to this +* function, just once suffices, but it does not break anything either. +*/ + reg =advk_readl (pcie,PCIE_CORE_CTRL0_REG ); + reg |=LINK_TRAINING_EN ; +advk_writel (pcie, reg,PCIE_CORE_CTRL0_REG ); + +/* +* Start link training immediately after enabling it. +* This solves problems for some buggy cards. +*/ + reg =advk_readl (pcie,PCIE_CORE_LINK_CTRL_STAT_REG ); + reg |=PCIE_CORE_LINK_TRAINING ; +advk_writel (pcie, reg,PCIE_CORE_LINK_CTRL_STAT_REG ); + + ret =advk_pcie_wait_for_link (pcie); +if (ret) +return ret; + + reg =advk_readl (pcie,PCIE_CORE_LINK_CTRL_STAT_REG ); + neg_gen = (reg >>PCIE_CORE_LINK_SPEED_SHIFT ) &0xf ; + +return neg_gen; +} + +static void advk_pcie_train_link (struct advk_pcie *pcie) +{ +struct device *dev = &pcie->pdev->dev; +int neg_gen =-1 , gen; + +/* +* Try link training at link gen specified by device tree property +* 'max-link-speed'. If this fails, iteratively train at lower gen. +*/ +for (gen = pcie->link_gen; gen >0 ; --gen) { + neg_gen =advk_pcie_train_at_gen (pcie, gen); +if (neg_gen >0 ) +break ; + } + +if (neg_gen <0 ) + goto err; + +/* +* After successful training if negotiated gen is lower than requested, +* train again on negotiated gen. This solves some stability issues for +* some buggy gen1 cards. +*/ +if (neg_gen < gen) { + gen = neg_gen; + neg_gen =advk_pcie_train_at_gen (pcie, gen); + } + +if (neg_gen == gen) { +dev_info (dev,"link up at gen %i\n" , gen); +return ; + } + +err: +dev_err (dev,"link never came up\n" ); +} +static void advk_pcie_setup_hw (struct advk_pcie *pcie) {u32 reg;
@@ -288,12 +365,6 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie)PCIE_CORE_CTRL2_TD_ENABLE ;advk_writel (pcie, reg,PCIE_CORE_CTRL2_REG ); -/* Set GEN2 */ - reg =advk_readl (pcie,PCIE_CORE_CTRL0_REG ); - reg &= ~PCIE_GEN_SEL_MSK ; - reg |=SPEED_GEN_2 ; -advk_writel (pcie, reg,PCIE_CORE_CTRL0_REG ); -/* Set lane X1 */ reg =advk_readl (pcie,PCIE_CORE_CTRL0_REG ); reg &= ~LANE_CNT_MSK ;
@@ -341,20 +412,7 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie)*/ msleep (PCI_PM_D3COLD_WAIT ); -/* Enable link training */ - reg =advk_readl (pcie,PCIE_CORE_CTRL0_REG ); - reg |=LINK_TRAINING_EN ; -advk_writel (pcie, reg,PCIE_CORE_CTRL0_REG ); - -/* -* Start link training immediately after enabling it. -* This solves problems for some buggy cards. -*/ - reg =advk_readl (pcie,PCIE_CORE_LINK_CTRL_STAT_REG ); - reg |=PCIE_CORE_LINK_TRAINING ; -advk_writel (pcie, reg,PCIE_CORE_LINK_CTRL_STAT_REG ); - -advk_pcie_wait_for_link (pcie); +advk_pcie_train_link (pcie); reg =advk_readl (pcie,PCIE_CORE_CMD_STATUS_REG ); reg |= PCIE_CORE_CMD_MEM_ACCESS_EN |
@@ -988,6 +1046,12 @@ static int advk_pcie_probe(struct platform_device *pdev) } pcie->root_bus_nr = bus->start; + ret =of_pci_get_max_link_speed (dev->of_node); +if (ret <=0 || ret >3 ) + pcie->link_gen =3 ; +else + pcie->link_gen = ret; +advk_pcie_setup_hw (pcie);advk_sw_pci_bridge_init (pcie);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 216/477 powerpc/64s/exceptions: Machine check reconcile irq state
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit f0fd9dd3c213c947dfb5bc2cad3ef5e30d3258ec ]
pseries fwnmi machine check code pops the soft-irq checks in rtas_call (after the next patch to remove rtas_token from this call path). Rather than play whack a mole with these and forever having fragile code, it seems better to have the early machine check handler perform the same kind of reconcile as the other NMI interrupts.
WARNING: CPU: 0 PID: 493 at arch/powerpc/kernel/irq.c:343
CPU: 0 PID: 493 Comm: a Tainted: G W
NIP: c00000000001ed2c LR: c000000000042c40 CTR: 0000000000000000
REGS: c0000001fffd38b0 TRAP: 0700 Tainted: G W
MSR: 8000000000021003 <SF,ME,RI,LE> CR: 28000488 XER: 00000000
CFAR: c00000000001ec90 IRQMASK: 0
GPR00: c000000000043820 c0000001fffd3b40 c0000000012ba300 0000000000000000
GPR04: 0000000048000488 0000000000000000 0000000000000000 00000000deadbeef
GPR08: 0000000000000080 0000000000000000 0000000000000000 0000000000001001
GPR12: 0000000000000000 c0000000014a0000 0000000000000000 0000000000000000
GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR24: 0000000000000000 0000000000000000 0000000000000000 0000000000000000
GPR28: 0000000000000000 0000000000000001 c000000001360810 0000000000000000
NIP [c00000000001ed2c] arch_local_irq_restore.part.0+0xac/0x100
LR [c000000000042c40] unlock_rtas+0x30/0x90
Call Trace:
[c0000001fffd3b40] [c000000001360810] 0xc000000001360810 (unreliable)
[c0000001fffd3b60] [c000000000043820] rtas_call+0x1c0/0x280
[c0000001fffd3bb0] [c0000000000dc328] fwnmi_release_errinfo+0x38/0x70
[c0000001fffd3c10] [c0000000000dcd8c] pseries_machine_check_realmode+0x1dc/0x540
[c0000001fffd3cd0] [c00000000003fe04] machine_check_early+0x54/0x70
[c0000001fffd3d00] [c000000000008384] machine_check_early_common+0x134/0x1f0
--- interrupt: 200 at 0x13f1307c8
LR = 0x7fff888b8528
Instruction dump:
60000000 7d2000a6 71298000 41820068 39200002 7d210164 4bffff9c 60000000
60000000 7d2000a6 71298000 4c820020 <0fe00000> 4e800020 60000000 60000000--- arch/powerpc/kernel/exceptions-64s.S | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
arch/powerpc/kernel/exceptions-64s.S +19 -0
@@ -1117,11 +1117,30 @@ END_FTR_SECTION_IFSET(CPU_FTR_HVMODE) li r10,MSR_RI mtmsrd r10,1 + /* + * Set IRQS_ALL_DISABLED and save PACAIRQHAPPENED (see + * system_reset_common) + */ + li r10,IRQS_ALL_DISABLED + stb r10,PACAIRQSOFTMASK(r13) + lbz r10,PACAIRQHAPPENED(r13) + std r10,RESULT(r1) + ori r10,r10,PACA_IRQ_HARD_DIS + stb r10,PACAIRQHAPPENED(r13) + addi r3,r1,STACK_FRAME_OVERHEAD bl machine_check_early std r3,RESULT(r1) /* Save result */ ld r12,_MSR(r1) + /* + * Restore soft mask settings. + */ + ld r10,RESULT(r1) + stb r10,PACAIRQHAPPENED(r13) + ld r10,SOFTE(r1) + stb r10,PACAIRQSOFTMASK(r13) + #ifdef CONFIG_PPC_P7_NAP /* * Check if thread was in power saving mode. We come here when any
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 218/477 PCI: aardvark: Train link immediately after enabling training
In reply to Greg Kroah-HartmanFrom: Pali Rohár <[email protected]>
[ Upstream commit 6964494582f56a3882c2c53b0edbfe99eb32b2e1 ]
Adding even 100ms (PCI_PM_D3COLD_WAIT) delay between enabling link training and starting link training causes detection issues with some buggy cards (such as Compex WLE900VX).
Move the code which enables link training immediately before the one which starts link traning.
This fixes detection issues of Compex WLE900VX card on Turris MOX after cold boot.
--- drivers/pci/controller/pci-aardvark.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/pci/controller/pci-aardvark.c +9 -6
@@ -300,11 +300,6 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie) reg |=LANE_COUNT_1 ;advk_writel (pcie, reg,PCIE_CORE_CTRL0_REG ); -/* Enable link training */ - reg =advk_readl (pcie,PCIE_CORE_CTRL0_REG ); - reg |=LINK_TRAINING_EN ; -advk_writel (pcie, reg,PCIE_CORE_CTRL0_REG ); -/* Enable MSI */ reg =advk_readl (pcie,PCIE_CORE_CTRL2_REG ); reg |=PCIE_CORE_CTRL2_MSI_ENABLE ;
@@ -346,7 +341,15 @@ static void advk_pcie_setup_hw(struct advk_pcie *pcie)*/ msleep (PCI_PM_D3COLD_WAIT ); -/* Start link training */ +/* Enable link training */ + reg =advk_readl (pcie,PCIE_CORE_CTRL0_REG ); + reg |=LINK_TRAINING_EN ; +advk_writel (pcie, reg,PCIE_CORE_CTRL0_REG ); + +/* +* Start link training immediately after enabling it. +* This solves problems for some buggy cards. +*/ reg =advk_readl (pcie,PCIE_CORE_LINK_CTRL_STAT_REG ); reg |=PCIE_CORE_LINK_TRAINING ;advk_writel (pcie, reg,PCIE_CORE_LINK_CTRL_STAT_REG );
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 217/477 powerpc/pseries/ras: Fix FWNMI_VALID off by one
In reply to Greg Kroah-HartmanFrom: Nicholas Piggin <[email protected]>
[ Upstream commit deb70f7a35a22dffa55b2c3aac71bc6fb0f486ce ]
This was discovered developing qemu fwnmi sreset support. This off-by-one bug means the last 16 bytes of the rtas area can not be used for a 16 byte save area.
It's not a serious bug, and QEMU implementation has to retain a workaround for old kernels, but it's good to tighten it.
--- arch/powerpc/platforms/pseries/ras.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/ras.c +3 -2
@@ -395,10 +395,11 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id)/* * Some versions of FWNMI place the buffer inside the 4kB page starting at * 0x7000. Other versions place it inside the rtas buffer. We check both. +* Minimum size of the buffer is 16 bytes. */ #define VALID_FWNMI_BUFFER (A ) \ - ((((A) >= 0x7000) && ((A) < 0x7ff0)) || \ - (((A) >= rtas.base) && ((A) < (rtas.base + rtas.size - 16)))) + ((((A) >= 0x7000) && ((A) <= 0x8000 - 16)) || \ + (((A) >= rtas.base) && ((A) <= (rtas.base + rtas.size - 16))))static inline struct rtas_error_log *fwnmi_get_errlog (void ) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 210/477 habanalabs: increase timeout during reset
In reply to Greg Kroah-HartmanFrom: Oded Gabbay <[email protected]>
[ Upstream commit 7a65ee046b2238e053f6ebb610e1a082cfc49490 ]
When doing training, the DL framework (e.g. tensorflow) performs hundreds of thousands of memory allocations and mappings. In case the driver needs to perform hard-reset during training, the driver kills the application and unmaps all those memory allocations. Unfortunately, because of that large amount of mappings, the driver isn't able to do that in the current timeout (5 seconds). Therefore, increase the timeout significantly to 30 seconds to avoid situation where the driver resets the device with active mappings, which sometime can cause a kernel bug.
BTW, it doesn't mean we will spend all the 30 seconds because the reset thread checks every one second if the unmap operation is done.
--- drivers/misc/habanalabs/habanalabs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/misc/habanalabs/habanalabs.h +1 -1
@@ -23,7 +23,7 @@#define HL_MMAP_CB_MASK (0x8000000000000000ull >> PAGE_SHIFT) -#define HL_PENDING_RESET_PER_SEC 5 +#define HL_PENDING_RESET_PER_SEC 30#define HL_DEVICE_TIMEOUT_USEC 1000000/* 1 s */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 176/477 ALSA: firewire-lib: fix invalid assignment to union data for directional parameter
In reply to Greg Kroah-HartmanFrom: Takashi Sakamoto <[email protected]>
[ Upstream commit 8304cf77c92038cd1c50c27b69d30be695cc8003 ]
Although the value of FDF is used just for outgoing stream, the assignment to union member is done for both directions of stream. At present this causes no issue because the value of same position is reassigned later for opposite stream. However, it's better to add if statement.
--- sound/firewire/amdtp-am824.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/firewire/amdtp-am824.c +2 -1
@@ -82,7 +82,8 @@ int amdtp_am824_set_parameters(struct amdtp_stream *s, unsigned int rate,if (err <0 )return err; - s->ctx_data.rx.fdf =AMDTP_FDF_AM824 | s->sfc; +if (s->direction ==AMDTP_OUT_STREAM ) + s->ctx_data.rx.fdf =AMDTP_FDF_AM824 | s->sfc; p->pcm_channels = pcm_channels; p->midi_ports = midi_ports;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 174/477 PCI/ASPM: Allow ASPM on links to PCIe-to-PCI/PCI-X Bridges
In reply to Greg Kroah-HartmanFrom: Kai-Heng Feng <[email protected]>
[ Upstream commit 66ff14e59e8a30690755b08bc3042359703fb07a ]
7d715a6c1ae5 ("PCI: add PCI Express ASPM support") added the ability for Linux to enable ASPM, but for some undocumented reason, it didn't enable ASPM on links where the downstream component is a PCIe-to-PCI/PCI-X Bridge.
Remove this exclusion so we can enable ASPM on these links.
The Dell OptiPlex 7080 mentioned in the bugzilla has a TI XIO2001 PCIe-to-PCI Bridge. Enabling ASPM on the link leading to it allows the Intel SoC to enter deeper Package C-states, which is a significant power savings.
[bhelgaas: commit log]
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=207571
--- drivers/pci/pcie/aspm.c | 10 ---------- 1 file changed, 10 deletions(-)
drivers/pci/pcie/aspm.c +0 -10
@@ -628,16 +628,6 @@ static void pcie_aspm_cap_init(struct pcie_link_state *link, int blacklist)/* Setup initial capable state. Will be updated later */ link->aspm_capable = link->aspm_support; -/* -* If the downstream component has pci bridge function, don't -* do ASPM for now. -*/ -list_for_each_entry (child, &linkbus->devices, bus_list) { -if (pci_pcie_type (child) ==PCI_EXP_TYPE_PCI_BRIDGE ) { - link->aspm_disable =ASPM_STATE_ALL ; -break ; - } - }/* Get and check endpoint acceptable latencies */ list_for_each_entry (child, &linkbus->devices, bus_list) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 171/477 i2c: pxa: fix i2c_pxa_scream_blue_murder() debug output
In reply to Greg Kroah-HartmanFrom: Russell King <[email protected]>
[ Upstream commit 88b73ee7ca4c90baf136ed5a8377fc5a9b73ac08 ]
The IRQ log output is supposed to appear on a single line. However, commit 3a2dc1677b60 ("i2c: pxa: Update debug function to dump more info on error") resulted in it being printed one-entry-per-line, which is excessively long.
Fixing this is not a trivial matter; using pr_cont() doesn't work as the previous dev_dbg() may not have been compiled in, or may be dynamic.
Since the rest of this function output is at error level, and is also debug output, promote this to error level as well to avoid this problem.
Reduce the number of always zero prefix digits to save screen real- estate.
--- drivers/i2c/busses/i2c-pxa.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/i2c/busses/i2c-pxa.c +3 -4
@@ -311,11 +311,10 @@ static void i2c_pxa_scream_blue_murder(struct pxa_i2c *i2c, const char *why)dev_err (dev,"IBMR: %08x IDBR: %08x ICR: %08x ISR: %08x\n" ,readl (_IBMR (i2c)),readl (_IDBR (i2c)),readl (_ICR (i2c)),readl (_ISR (i2c))); -dev_dbg (dev,"log: " ); +dev_err (dev,"log:" );for (i =0 ; i < i2c->irqlogidx; i++) -pr_debug ("[%08x:%08x] " , i2c->isrlog[i], i2c->icrlog[i]); - - pr_debug("\n"); +pr_cont (" [%03x:%05x]" , i2c->isrlog[i], i2c->icrlog[i]); + pr_cont("\n"); }#else /* ifdef DEBUG */
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 199/477 arm64: dts: qcom: c630: Add WiFi node
In reply to Greg Kroah-HartmanFrom: Bjorn Andersson <[email protected]>
[ Upstream commit 3fb298d0b2f2a1d47d53806d4ddf8f4ae83353cc ]
Specify regulators and enable the &wifi node. The firmware uses the 8 bit version of the host capability message, so specify this quirk.
--- arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/arm64/boot/dts/qcom/sdm850-lenovo-yoga-c630.dts +11 -0
@@ -577,3 +577,14 @@ }; }; }; + +&wifi { + status = "okay"; + + vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>; + vdd-1.8-xo-supply = <&vreg_l7a_1p8>; + vdd-1.3-rfa-supply = <&vreg_l17a_1p3>; + vdd-3.3-ch0-supply = <&vreg_l25a_3p3>; + + qcom,snoc-host-cap-8bit-quirk; +};
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 170/477 PCI: v3-semi: Fix a memory leak in v3_pci_probe() error handling paths
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit bca718988b9008d0d5f504e2d318178fc84958c1 ]
If we fails somewhere in 'v3_pci_probe()', we need to free 'host'.
Use the managed version of 'pci_alloc_host_bridge()' to do that easily. The use of managed resources is already widely used in this driver.
--- drivers/pci/controller/pci-v3-semi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/pci-v3-semi.c +1 -1
@@ -720,7 +720,7 @@ static int v3_pci_probe(struct platform_device *pdev)int irq;int ret; - host =pci_alloc_host_bridge (sizeof (*v3)); + host =devm_pci_alloc_host_bridge (dev,sizeof (*v3));if (!host)return -ENOMEM ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 194/477 remoteproc: qcom_q6v5_mss: Drop accesses to MPSS PERPH register space
In reply to Greg Kroah-HartmanFrom: Sibi Sankar <[email protected]>
[ Upstream commit a9fdc79d488623d36341f0f3d08f5aa1bedb9d53 ]
7C retail devices using MSA based boot will result in a fuse combination which will prevent accesses to MSS PERPH register space where the mpss clocks and halt-nav reside. So drop all accesses to the MPSS PERPH register space. Issuing HALT NAV request and turning on the mss clocks as part of SSR will no longer be required since the modem firmware will have the necessary fixes to ensure that there are no pending NAV DMA transactions.
--- drivers/remoteproc/qcom_q6v5_mss.c | 102 +++++------------------------ 1 file changed, 18 insertions(+), 84 deletions(-)
drivers/remoteproc/qcom_q6v5_mss.c +18 -84
@@ -69,13 +69,9 @@#define AXI_HALTREQ_REG 0x0#define AXI_HALTACK_REG 0x4#define AXI_IDLE_REG 0x8 -#define NAV_AXI_HALTREQ_BIT BIT(0) -#define NAV_AXI_HALTACK_BIT BIT(1) -#define NAV_AXI_IDLE_BIT BIT(2)#define AXI_GATING_VALID_OVERRIDE BIT(0)#define HALT_ACK_TIMEOUT_US 100000 -#define NAV_HALT_ACK_TIMEOUT_US 200/* QDSP6SS_RESET */ #define Q6SS_STOP_CORE BIT(0)
@@ -143,7 +139,7 @@ struct rproc_hexagon_res {int version;bool need_mem_protection;bool has_alt_reset; -bool has_halt_nav; +bool has_spare_reg; };struct q6v5 {
@@ -154,13 +150,11 @@ struct q6v5 {void __iomem *rmb_base;struct regmap *halt_map; -struct regmap *halt_nav_map;struct regmap *conn_map;u32 halt_q6;u32 halt_modem;u32 halt_nc; -u32 halt_nav;u32 conn_box;struct reset_control *mss_restart;
@@ -206,7 +200,7 @@ struct q6v5 {struct qcom_sysmon *sysmon;bool need_mem_protection;bool has_alt_reset; -bool has_halt_nav; +bool has_spare_reg;int mpss_perm;int mba_perm;const char *hexagon_mdt_image;
@@ -427,21 +421,19 @@ static int q6v5_reset_assert(struct q6v5 *qproc)reset_control_assert (qproc->pdc_reset); ret =reset_control_reset (qproc->mss_restart);reset_control_deassert (qproc->pdc_reset); - }else if (qproc->has_halt_nav) { + }else if (qproc->has_spare_reg) {/* * When the AXI pipeline is being reset with the Q6 modem partly * operational there is possibility of AXI valid signal to * glitch, leading to spurious transactions and Q6 hangs. A work * around is employed by asserting the AXI_GATING_VALID_OVERRIDE -* BIT before triggering Q6 MSS reset. Both the HALTREQ and -* AXI_GATING_VALID_OVERRIDE are withdrawn post MSS assert -* followed by a MSS deassert, while holding the PDC reset. +* BIT before triggering Q6 MSS reset. AXI_GATING_VALID_OVERRIDE +* is withdrawn post MSS assert followed by a MSS deassert, +* while holding the PDC reset. */ reset_control_assert (qproc->pdc_reset);regmap_update_bits (qproc->conn_map, qproc->conn_box,AXI_GATING_VALID_OVERRIDE ,1 ); -regmap_update_bits (qproc->halt_nav_map, qproc->halt_nav, -NAV_AXI_HALTREQ_BIT ,0 );reset_control_assert (qproc->mss_restart);reset_control_deassert (qproc->pdc_reset); regmap_update_bits(qproc->conn_map, qproc->conn_box,
@@ -464,7 +456,7 @@ static int q6v5_reset_deassert(struct q6v5 *qproc) ret =reset_control_reset (qproc->mss_restart);writel (0 , qproc->rmb_base +RMB_MBA_ALT_RESET );reset_control_deassert (qproc->pdc_reset); - }else if (qproc->has_halt_nav) { + }else if (qproc->has_spare_reg) { ret =reset_control_reset (qproc->mss_restart); }else { ret =reset_control_deassert (qproc->mss_restart);
@@ -761,32 +753,6 @@ static void q6v5proc_halt_axi_port(struct q6v5 *qproc,regmap_write (halt_map, offset +AXI_HALTREQ_REG ,0 ); } -static void q6v5proc_halt_nav_axi_port (struct q6v5 *qproc, -struct regmap *halt_map, -u32 offset) -{ -unsigned int val; -int ret; - -/* Check if we're already idle */ - ret =regmap_read (halt_map, offset, &val); -if (!ret && (val &NAV_AXI_IDLE_BIT )) -return ; - -/* Assert halt request */ -regmap_update_bits (halt_map, offset,NAV_AXI_HALTREQ_BIT , -NAV_AXI_HALTREQ_BIT ); - -/* Wait for halt ack*/ -regmap_read_poll_timeout (halt_map, offset, val, - (val &NAV_AXI_HALTACK_BIT ), -5 ,NAV_HALT_ACK_TIMEOUT_US ); - - ret =regmap_read (halt_map, offset, &val); -if (ret || !(val &NAV_AXI_IDLE_BIT )) -dev_err (qproc->dev,"port failed halt\n" ); -} -static int q6v5_mpss_init_image (struct q6v5 *qproc,const struct firmware *fw) {unsigned long dma_attrs =DMA_ATTR_FORCE_CONTIGUOUS ;
@@ -951,9 +917,6 @@ static int q6v5_mba_load(struct q6v5 *qproc) halt_axi_ports:q6v5proc_halt_axi_port (qproc, qproc->halt_map, qproc->halt_q6);q6v5proc_halt_axi_port (qproc, qproc->halt_map, qproc->halt_modem); -if (qproc->has_halt_nav) -q6v5proc_halt_nav_axi_port (qproc, qproc->halt_nav_map, - qproc->halt_nav);q6v5proc_halt_axi_port (qproc, qproc->halt_map, qproc->halt_nc); reclaim_mba:
@@ -1001,9 +964,6 @@ static void q6v5_mba_reclaim(struct q6v5 *qproc)q6v5proc_halt_axi_port (qproc, qproc->halt_map, qproc->halt_q6);q6v5proc_halt_axi_port (qproc, qproc->halt_map, qproc->halt_modem); -if (qproc->has_halt_nav) -q6v5proc_halt_nav_axi_port (qproc, qproc->halt_nav_map, - qproc->halt_nav);q6v5proc_halt_axi_port (qproc, qproc->halt_map, qproc->halt_nc);if (qproc->version ==MSS_MSM8996 ) {/*
@@ -1447,36 +1407,12 @@ static int q6v5_init_mem(struct q6v5 *qproc, struct platform_device *pdev) qproc->halt_modem = args.args[1 ]; qproc->halt_nc = args.args[2 ]; -if (qproc->has_halt_nav) { -struct platform_device *nav_pdev; - +if (qproc->has_spare_reg) { ret =of_parse_phandle_with_fixed_args (pdev->dev.of_node, -"qcom,halt-nav-regs" , +"qcom,spare-regs" ,1 ,0 , &args);if (ret <0 ) { -dev_err (&pdev->dev,"failed to parse halt-nav-regs\n" ); -return -EINVAL ; - } - - nav_pdev =of_find_device_by_node (args.np); -of_node_put (args.np); -if (!nav_pdev) { -dev_err (&pdev->dev,"failed to get mss clock device\n" ); -return -EPROBE_DEFER ; - } - - qproc->halt_nav_map =dev_get_regmap (&nav_pdev->dev,NULL ); -if (!qproc->halt_nav_map) { -dev_err (&pdev->dev,"failed to get map from device\n" ); -return -EINVAL ; - } - qproc->halt_nav = args.args[0 ]; - - ret =of_parse_phandle_with_fixed_args (pdev->dev.of_node, -"qcom,halt-nav-regs" , -1 ,1 , &args); -if (ret <0 ) { -dev_err (&pdev->dev,"failed to parse halt-nav-regs\n" ); +dev_err (&pdev->dev,"failed to parse spare-regs\n" );return -EINVAL ; }
@@ -1562,7 +1498,7 @@ static int q6v5_init_reset(struct q6v5 *qproc)return PTR_ERR (qproc->mss_restart); } -if (qproc->has_alt_reset || qproc->has_halt_nav) { +if (qproc->has_alt_reset || qproc->has_spare_reg) { qproc->pdc_reset =devm_reset_control_get_exclusive (qproc->dev,"pdc_reset" );if (IS_ERR (qproc->pdc_reset)) {
@@ -1688,7 +1624,7 @@ static int q6v5_probe(struct platform_device *pdev)platform_set_drvdata (pdev, qproc); - qproc->has_halt_nav = desc->has_halt_nav; + qproc->has_spare_reg = desc->has_spare_reg; ret =q6v5_init_mem (qproc, pdev);if (ret) goto free_rproc;
@@ -1837,8 +1773,6 @@ static const struct rproc_hexagon_res sc7180_mss = { .active_clk_names = (char*[]){"mnoc_axi" ,"nav" , -"mss_nav" , -"mss_crypto" ,NULL }, .active_pd_names = (char *[]){
@@ -1853,7 +1787,7 @@ static const struct rproc_hexagon_res sc7180_mss = { }, .need_mem_protection = true, .has_alt_reset = false, - .has_halt_nav = true, + .has_spare_reg = true, .version = MSS_SC7180, };
@@ -1888,7 +1822,7 @@ static const struct rproc_hexagon_res sdm845_mss = { }, .need_mem_protection = true, .has_alt_reset = true, - .has_halt_nav = false, + .has_spare_reg = false, .version = MSS_SDM845, };
@@ -1915,7 +1849,7 @@ static const struct rproc_hexagon_res msm8998_mss = { }, .need_mem_protection = true, .has_alt_reset = false, - .has_halt_nav = false, + .has_spare_reg = false, .version = MSS_MSM8998, };
@@ -1945,7 +1879,7 @@ static const struct rproc_hexagon_res msm8996_mss = { }, .need_mem_protection = true, .has_alt_reset = false, - .has_halt_nav = false, + .has_spare_reg = false, .version = MSS_MSM8996, };
@@ -1978,7 +1912,7 @@ static const struct rproc_hexagon_res msm8916_mss = { }, .need_mem_protection = false, .has_alt_reset = false, - .has_halt_nav = false, + .has_spare_reg = false, .version = MSS_MSM8916, };
@@ -2019,7 +1953,7 @@ static const struct rproc_hexagon_res msm8974_mss = { }, .need_mem_protection = false, .has_alt_reset = false, - .has_halt_nav = false, + .has_spare_reg = false, .version = MSS_MSM8974, };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 190/477 SoC: rsnd: add interrupt support for SSI BUSIF buffer
In reply to Greg Kroah-HartmanFrom: Yongbo Zhang <[email protected]>
[ Upstream commit 66c705d07d784fb6b4622c6e47b6acae357472db ]
SSI BUSIF buffer is possible to overflow or underflow, especially in a hypervisor environment. If there is no interrupt support, it will eventually lead to errors in pcm data.
This patch adds overflow and underflow interrupt support for SSI BUSIF buffer.
--- sound/soc/sh/rcar/gen.c | 8 +++ sound/soc/sh/rcar/rsnd.h | 9 +++ sound/soc/sh/rcar/ssi.c | 145 +++++++++++++++++++++++++++++++++++++++ 3 files changed, 162 insertions(+)
sound/soc/sh/rcar/gen.c +8 -0
@@ -224,6 +224,14 @@ static int rsnd_gen2_probe(struct rsnd_priv *priv)RSND_GEN_S_REG (SSI_SYS_STATUS5 ,0x884 ),RSND_GEN_S_REG (SSI_SYS_STATUS6 ,0x888 ),RSND_GEN_S_REG (SSI_SYS_STATUS7 ,0x88c ), +RSND_GEN_S_REG (SSI_SYS_INT_ENABLE0 ,0x850 ), +RSND_GEN_S_REG (SSI_SYS_INT_ENABLE1 ,0x854 ), +RSND_GEN_S_REG (SSI_SYS_INT_ENABLE2 ,0x858 ), +RSND_GEN_S_REG (SSI_SYS_INT_ENABLE3 ,0x85c ), +RSND_GEN_S_REG (SSI_SYS_INT_ENABLE4 ,0x890 ), +RSND_GEN_S_REG (SSI_SYS_INT_ENABLE5 ,0x894 ), +RSND_GEN_S_REG (SSI_SYS_INT_ENABLE6 ,0x898 ), +RSND_GEN_S_REG (SSI_SYS_INT_ENABLE7 ,0x89c ),RSND_GEN_S_REG (HDMI0_SEL ,0x9e0 ), RSND_GEN_S_REG(HDMI1_SEL, 0x9e4),
sound/soc/sh/rcar/rsnd.h +9 -0
@@ -189,6 +189,14 @@ enum rsnd_reg {SSI_SYS_STATUS5 ,SSI_SYS_STATUS6 ,SSI_SYS_STATUS7 , +SSI_SYS_INT_ENABLE0 , +SSI_SYS_INT_ENABLE1 , +SSI_SYS_INT_ENABLE2 , +SSI_SYS_INT_ENABLE3 , +SSI_SYS_INT_ENABLE4 , +SSI_SYS_INT_ENABLE5 , +SSI_SYS_INT_ENABLE6 , +SSI_SYS_INT_ENABLE7 ,HDMI0_SEL ,HDMI1_SEL , SSI9_BUSIF0_MODE,
@@ -237,6 +245,7 @@ enum rsnd_reg {#define SSI9_BUSIF_ADINR (i) (SSI9_BUSIF0_ADINR + (i))#define SSI9_BUSIF_DALIGN (i) (SSI9_BUSIF0_DALIGN + (i))#define SSI_SYS_STATUS (i) (SSI_SYS_STATUS0 + (i)) +#define SSI_SYS_INT_ENABLE (i) (SSI_SYS_INT_ENABLE0 + (i))struct rsnd_priv ;
sound/soc/sh/rcar/ssi.c +145 -0
193 lines not on this page · raw message
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 191/477 ASoC: ux500: mop500: Fix some refcounted resources issues
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 4e8748fcaeec073e3ba794871ce86c545e4f961f ]
There are 2 issues here:
- if one of the 'of_parse_phandle' fails, calling 'mop500_of_node_put()' is a no-op because the 'mop500_dai_links' structure has not been initialized yet, so the referenced are not decremented
- The reference stored in 'mop500_dai_links[i].codecs' is refcounted only once in the probe and must be decremented only once.
--- sound/soc/ux500/mop500.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
sound/soc/ux500/mop500.c +7 -4
@@ -63,10 +63,11 @@ static void mop500_of_node_put(void) {int i; -for (i =0 ; i <2 ; i++) { +for (i =0 ; i <2 ; i++)of_node_put (mop500_dai_links[i].cpus->of_node); -of_node_put (mop500_dai_links[i].codecs->of_node); - } + +/* Both links use the same codec, which is refcounted only once */ +of_node_put (mop500_dai_links[0 ].codecs->of_node); } static int mop500_of_probe(struct platform_device *pdev,
@@ -81,7 +82,9 @@ static int mop500_of_probe(struct platform_device *pdev,if (!(msp_np[0 ] && msp_np[1 ] && codec_np)) {dev_err (&pdev->dev,"Phandle missing or invalid\n" ); -mop500_of_node_put (); +for (i =0 ; i <2 ; i++) +of_node_put (msp_np[i]); +of_node_put (codec_np);return -EINVAL ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 188/477 um: do not evaluate compilers library path when cleaning
In reply to Greg Kroah-HartmanFrom: Masahiro Yamada <[email protected]>
[ Upstream commit 7e49afc03212010d0ee27532a75cfeb0125bd868 ]
Since commit a83e4ca26af8 ("kbuild: remove cc-option switch from -Wframe-larger-than="), 'make ARCH=um clean' emits an error message as follows:
$ make ARCH=um clean gcc: error: missing argument to '-Wframe-larger-than='
We do not care compiler flags when cleaning.
Use the '=' operator for lazy expansion because we do not use LDFLAGS_pcap.o or LDFLAGS_vde.o when cleaning.
While I was here, I removed the redundant -r option because it already exists in the recipe.
--- arch/um/drivers/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/um/drivers/Makefile +2 -2
@@ -18,9 +18,9 @@ ubd-objs := ubd_kern.o ubd_user.o port-objs := port_kern.o port_user.o harddog-objs := harddog_kern.o harddog_user.o -LDFLAGS_pcap.o := -r $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libpcap.a) +LDFLAGS_pcap.o = $(shell $(CC) $(KBUILD_CFLAGS) -print-file-name=libpcap.a) -LDFLAGS_vde.o := -r $(shell $(CC) $(CFLAGS) -print-file-name=libvdeplug.a) +LDFLAGS_vde.o = $(shell $(CC) $(CFLAGS) -print-file-name=libvdeplug.a) targets := pcap_kern.o pcap_user.o vde_kern.o vde_user.o
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 169/477 staging: wfx: avoid compiler warning on empty array
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 2eeefd3787fdc6319124945d453774be95b97897 ]
When CONFIG_OF is disabled, gcc-9 produces a warning about the wfx_sdio_of_match[] array having a declaration without a dimension:
drivers/staging/wfx/bus_sdio.c:159:34: error: array 'wfx_sdio_of_match' assumed to have one element [-Werror]
159 | static const struct of_device_id wfx_sdio_of_match[];
| ^~~~~~~~~~~~~~~~~Move the proper declaration up and out of the #ifdef instead.
--- drivers/staging/wfx/bus_sdio.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
drivers/staging/wfx/bus_sdio.c +8 -11
@@ -156,7 +156,13 @@ static const struct hwbus_ops wfx_sdio_hwbus_ops = { .align_size = wfx_sdio_align_size, }; -static const struct of_device_id wfx_sdio_of_match[]; +static const struct of_device_id wfx_sdio_of_match[] = { + { .compatible ="silabs,wfx-sdio" }, + { .compatible ="silabs,wf200" }, + { }, +}; +MODULE_DEVICE_TABLE (of, wfx_sdio_of_match); +static int wfx_sdio_probe (struct sdio_func *func,const struct sdio_device_id *id) {
@@ -248,15 +254,6 @@ static const struct sdio_device_id wfx_sdio_ids[] = { };MODULE_DEVICE_TABLE (sdio, wfx_sdio_ids); -#ifdef CONFIG_OF -static const struct of_device_id wfx_sdio_of_match[] = { - { .compatible ="silabs,wfx-sdio" }, - { .compatible ="silabs,wf200" }, - { }, -}; -MODULE_DEVICE_TABLE (of, wfx_sdio_of_match); -#endif -struct sdio_driver wfx_sdio_driver = { .name ="wfx-sdio" , .id_table = wfx_sdio_ids,
@@ -264,6 +261,6 @@ struct sdio_driver wfx_sdio_driver = { .remove = wfx_sdio_remove, .drv = { .owner = THIS_MODULE, - .of_match_table = of_match_ptr(wfx_sdio_of_match), + .of_match_table = wfx_sdio_of_match, } };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 186/477 f2fs: fix potential use-after-free issue
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit f3494345ce9999624b36109252a4bf5f00e51a46 ]
In error path of f2fs_read_multi_pages(), it should let last referrer release decompress io context memory, otherwise, other referrer will cause use-after-free issue.
--- fs/f2fs/data.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
fs/f2fs/data.c +4 -4
@@ -2130,16 +2130,16 @@ submit_and_realloc: page->index, for_write);if (IS_ERR (bio)) { ret =PTR_ERR (bio); - bio =NULL ; dic->failed = true;if (refcount_sub_and_test (dic->nr_cpages - i, - &dic->ref)) + &dic->ref)) {f2fs_decompress_end_io (dic->rpages, cc->cluster_size, true, false); -f2fs_free_dic (dic); +f2fs_free_dic (dic); + }f2fs_put_dnode (&dn); - *bio_ret = bio; + *bio_ret =NULL ;return ret; } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 185/477 f2fs: Fix wrong stub helper update_sit_info
In reply to Greg Kroah-HartmanFrom: YueHaibing <[email protected]>
[ Upstream commit 48abe91ac1ad27cd5a5709f983dcf58f2b9a6b70 ]
update_sit_info should be f2fs_update_sit_info, otherwise build fails while no CONFIG_F2FS_STAT_FS.
--- fs/f2fs/f2fs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/f2fs/f2fs.h +1 -1
@@ -3656,7 +3656,7 @@ static inline int f2fs_build_stats(struct f2fs_sb_info *sbi) { return 0; }static inline void f2fs_destroy_stats (struct f2fs_sb_info *sbi) { }static inline void __init f2fs_create_root_stats (void ) { }static inline void f2fs_destroy_root_stats (void ) { } -static inline void update_sit_info (struct f2fs_sb_info *sbi) {} +static inline void f2fs_update_sit_info (struct f2fs_sb_info *sbi) {}#endif extern const struct file_operations f2fs_dir_operations;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 184/477 scsi: mpt3sas: Fix double free warnings
In reply to Greg Kroah-HartmanFrom: Suganath Prabu S <[email protected]>
[ Upstream commit cbbfdb2a2416c9f0cde913cf09670097ac281282 ]
Fix following warning from Smatch static analyser:
drivers/scsi/mpt3sas/mpt3sas_base.c:5256 _base_allocate_memory_pools()
warn: 'ioc->hpr_lookup' double freed
drivers/scsi/mpt3sas/mpt3sas_base.c:5256 _base_allocate_memory_pools()
warn: 'ioc->internal_lookup' double freed
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/scsi/mpt3sas/mpt3sas_base.c +2 -0
@@ -4915,7 +4915,9 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc) }kfree (ioc->hpr_lookup); + ioc->hpr_lookup =NULL ;kfree (ioc->internal_lookup); + ioc->internal_lookup =NULL ;if (ioc->chain_lookup) {for (i =0 ; i < ioc->scsiio_depth; i++) { for (j = ioc->chains_per_prp_buffer;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 180/477 ASoC: SOF: core: fix error return code in sof_probe_continue()
In reply to Greg Kroah-HartmanFrom: Wei Yongjun <[email protected]>
[ Upstream commit 7d8785bc7adbb4dc5ba8ee06994107637848ded8 ]
Fix to return negative error code -ENOMEM from the IPC init error handling case instead of 0, as done elsewhere in this function.
--- sound/soc/sof/core.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/sof/core.c +1 -0
@@ -176,6 +176,7 @@ static int sof_probe_continue(struct snd_sof_dev *sdev)/* init the IPC */ sdev->ipc =snd_sof_ipc_init (sdev);if (!sdev->ipc) { + ret = -ENOMEM ;dev_err (sdev->dev,"error: failed to init DSP IPC %d\n" , ret); goto ipc_err; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 177/477 power: supply: lp8788: Fix an error handling path in lp8788_charger_probe()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 934ed3847a4ebc75b655659c4d2349ba4337941c ]
In the probe function, in case of error, resources allocated in 'lp8788_setup_adc_channel()' must be released.
This can be achieved easily by using the devm_ variant of 'iio_channel_get()'.
This has the extra benefit to simplify the remove function and to axe the 'lp8788_release_adc_channel()' function which is now useless.
--- drivers/power/supply/lp8788-charger.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-)
drivers/power/supply/lp8788-charger.c +2 -16
@@ -572,27 +572,14 @@ static void lp8788_setup_adc_channel(struct device *dev,return ;/* ADC channel for battery voltage */ - chan =iio_channel_get (dev, pdata->adc_vbatt); + chan =devm_iio_channel_get (dev, pdata->adc_vbatt); pchg->chan[LP8788_VBATT ] =IS_ERR (chan) ?NULL : chan;/* ADC channel for battery temperature */ - chan =iio_channel_get (dev, pdata->adc_batt_temp); + chan =devm_iio_channel_get (dev, pdata->adc_batt_temp); pchg->chan[LP8788_BATT_TEMP ] =IS_ERR (chan) ?NULL : chan; } -static void lp8788_release_adc_channel (struct lp8788_charger *pchg) -{ -int i; - -for (i =0 ; i <LP8788_NUM_CHG_ADC ; i++) { -if (!pchg->chan[i]) -continue ; - -iio_channel_release (pchg->chan[i]); - pchg->chan[i] =NULL ; - } -} -static ssize_t lp8788_show_charger_status (struct device *dev,struct device_attribute *attr,char *buf) {
@@ -735,7 +722,6 @@ static int lp8788_charger_remove(struct platform_device *pdev)flush_work (&pchg->charger_work);lp8788_irq_unregister (pdev, pchg);lp8788_psy_unregister (pchg); -lp8788_release_adc_channel (pchg);return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 137/477 Input: mms114 - add extra compatible for mms345l
In reply to Greg Kroah-HartmanFrom: Stephan Gerhold <[email protected]>
[ Upstream commit 7842087b0196d674ed877d768de8f2a34d7fdc53 ]
MMS345L is another first generation touch screen from Melfas, which uses mostly the same registers as MMS152.
However, there is some garbage printed during initialization. Apparently MMS345L does not have the MMS152_COMPAT_GROUP register that is read+printed during initialization.
TSP FW Rev: bootloader 0x6 / core 0x26 / config 0x26, Compat group: \x06
On earlier kernel versions the compat group was actually printed as an ASCII control character, seems like it gets escaped now.
But we probably shouldn't print something from a random register.
Add a separate "melfas,mms345l" compatible that avoids reading from the MMS152_COMPAT_GROUP register. This might also help in case there is some other device-specific quirk in the future.
--- drivers/input/touchscreen/mms114.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
drivers/input/touchscreen/mms114.c +15 -2
@@ -54,6 +54,7 @@enum mms_type {TYPE_MMS114 =114 ,TYPE_MMS152 =152 , +TYPE_MMS345L =345 , };struct mms114_data {
@@ -250,6 +251,15 @@ static int mms114_get_version(struct mms114_data *data)int error;switch (data->type) { +case TYPE_MMS345L : + error =__mms114_read_reg (data,MMS152_FW_REV ,3 , buf); +if (error) +return error; + +dev_info (dev,"TSP FW Rev: bootloader 0x%x / core 0x%x / config 0x%x\n" , + buf[0 ], buf[1 ], buf[2 ]); +break ; +case TYPE_MMS152 : error =__mms114_read_reg (data,MMS152_FW_REV ,3 , buf);if (error)
@@ -287,8 +297,8 @@ static int mms114_setup_regs(struct mms114_data *data)if (error <0 )return error; -/* MMS152 has no configuration or power on registers */ -if (data->type ==TYPE_MMS152 ) +/* Only MMS114 has configuration and power on registers */ +if (data->type !=TYPE_MMS114 )return 0 ; error =mms114_set_active (data, true);
@@ -597,6 +607,9 @@ static const struct of_device_id mms114_dt_match[] = { }, { .compatible = "melfas,mms152", .data = (void *)TYPE_MMS152, + }, { + .compatible = "melfas,mms345l", + .data = (void *)TYPE_MMS345L, }, { } };
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 159/477 ASoC: max98373: reorder max98373_reset() in resume
In reply to Greg Kroah-HartmanFrom: Yong Zhi <[email protected]>
[ Upstream commit 1a446873d7dd3a450f685928ce7f1907bde4583d ]
During S3 test, the following error was observed:
[ 726.174237] i2c_designware i2c_designware.0: platform_pm_resume+0x0/0x3d returned 0 after 0 usecs [ 726.184187] max98373 i2c-MX98373:00: calling max98373_resume+0x0/0x30 [snd_soc_max98373] @ 12698, parent: i2c-11 [ 726.195589] max98373 i2c-MX98373:00: Reset command failed. (ret:-16)
When calling regmap_update_bits(), since map->reg_update_bits is NULL, _regmap_read() is entered with the following logic:
if (!map->cache_bypass) {
ret = regcache_read(map, reg, val);
if (ret == 0)
return 0;
}
if (map->cache_only)
return -EBUSY;regcache_read() hits -EINVAL because MAX98373_R2000_SW_RESET is volatile, as map->cache_only is set by codec suspend, thus -EBUSY is returned. Fix by moving max98373_reset() after cache_only set to false in max98373_resume().
--- sound/soc/codecs/max98373.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/max98373.c +1 -1
@@ -850,8 +850,8 @@ static int max98373_resume(struct device *dev) {struct max98373_priv *max98373 =dev_get_drvdata (dev); -max98373_reset (max98373, dev);regcache_cache_only (max98373->regmap, false); +max98373_reset (max98373, dev);regcache_sync (max98373->regmap);return 0 ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 163/477 HID: intel-ish-hid: avoid bogus uninitialized-variable warning
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit 0b66fb3e6b7a53688f8e20945ac78cd3d832c65f ]
Older compilers like gcc-4.8 don't see that the variable is initialized when it is used:
In file included from include/linux/compiler_types.h:68:0,
from <command-line>:0:
drivers/hid/intel-ish-hid/ishtp-fw-loader.c: In function 'load_fw_from_host':
include/linux/compiler-gcc.h:75:45: warning: 'fw_info.ldr_capability.max_dma_buf_size' may be used uninitialized in this function [-Wmaybe-uninitialized]
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
^
drivers/hid/intel-ish-hid/ishtp-fw-loader.c:770:22: note: 'fw_info.ldr_capability.max_dma_buf_size' was declared here
struct shim_fw_info fw_info;
^Make sure to initialize it before returning an error from ish_query_loader_prop().
--- drivers/hid/intel-ish-hid/ishtp-fw-loader.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/hid/intel-ish-hid/ishtp-fw-loader.c +2 -0
@@ -480,6 +480,7 @@ static int ish_query_loader_prop(struct ishtp_cl_data *client_data, sizeof(ldr_xfer_query_resp));if (rv <0 ) { client_data->flag_retry = true; + *fw_info = (struct shim_fw_info ){};return rv; }
@@ -489,6 +490,7 @@ static int ish_query_loader_prop(struct ishtp_cl_data *client_data,"data size %d is not equal to size of loader_xfer_query_response %zu\n" , rv, sizeof(struct loader_xfer_query_response)); client_data->flag_retry = true; + *fw_info = (struct shim_fw_info ){};return -EMSGSIZE ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 161/477 ARM: dts: aspeed: ast2600: Set arch timer always-on
In reply to Greg Kroah-HartmanFrom: Eddie James <[email protected]>
[ Upstream commit c998f40f2ae6a48e93206e2c1ea0691479989611 ]
According to ASPEED, FTTMR010 is not intended to be used in the AST2600. The arch timer should be used, but Linux doesn't enable high-res timers without being assured that the arch timer is always on, so set that property in the devicetree.
The FTTMR010 device is described by set to disabled.
This fixes highres timer support for AST2600.
--- arch/arm/boot/dts/aspeed-g6.dtsi | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/boot/dts/aspeed-g6.dtsi +2 -0
@@ -65,6 +65,7 @@ <GIC_PPI 10 (GIC_CPU_MASK_SIMPLE(2) | IRQ_TYPE_LEVEL_LOW)>; clocks = <&syscon ASPEED_CLK_HPLL>; arm,cpu-registers-not-fw-configured; + always-on; }; ahb {
@@ -368,6 +369,7 @@ <&gic GIC_SPI 23 IRQ_TYPE_LEVEL_HIGH>; clocks = <&syscon ASPEED_CLK_APB1>; clock-names = "PCLK"; + status = "disabled"; }; uart1: serial@1e783000 {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 160/477 soundwire: slave: dont init debugfs on device registration error
In reply to Greg Kroah-HartmanFrom: Pierre-Louis Bossart <[email protected]>
[ Upstream commit 8893ab5e8ee5d7c12e0fc1dca4a309475064473d ]
The error handling flow seems incorrect, there is no reason to try and add debugfs support if the device registration did not succeed. Return on error.
--- drivers/soundwire/slave.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/soundwire/slave.c +2 -0
@@ -68,6 +68,8 @@ static int sdw_slave_add(struct sdw_bus *bus,list_del (&slave->node);mutex_unlock (&bus->bus_lock);put_device (&slave->dev); + +return ret; }sdw_slave_debugfs_init (slave);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 156/477 arm64: dts: meson: fix leds subnodes name
In reply to Greg Kroah-HartmanFrom: Neil Armstrong <[email protected]>
[ Upstream commit 08dc0e5dd9aabd52cff9e94febe6b282d29deca4 ]
Fix the leds subnode names to match (^led-[0-9a-f]$|led)
It fixes:meson-g12b-a311d-khadas-vim3.dt.yaml: leds: 'red', 'white' do not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' meson-g12b-s922x-khadas-vim3.dt.yaml: leds: 'red', 'white' do not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' meson-g12b-odroid-n2.dt.yaml: leds: 'blue' does not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' meson-gxbb-nanopi-k2.dt.yaml: leds: 'stat' does not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' meson-gxbb-nexbox-a95x.dt.yaml: leds: 'blue' does not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' meson-gxbb-odroidc2.dt.yaml: leds: 'blue' does not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' meson-gxbb-vega-s95-pro.dt.yaml: leds: 'blue' does not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' meson-gxbb-vega-s95-meta.dt.yaml: leds: 'blue' does not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' meson-gxbb-vega-s95-telos.dt.yaml: leds: 'blue' does not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' meson-gxbb-wetek-hub.dt.yaml: leds: 'system' does not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' meson-gxbb-wetek-play2.dt.yaml: leds: 'ethernet', 'system', 'wifi' do not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' meson-gxl-s905x-libretech-cc.dt.yaml: leds: 'blue', 'system' do not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' meson-gxl-s905d-libretech-pc.dt.yaml: leds: 'blue', 'green' do not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' meson-gxm-rbox-pro.dt.yaml: leds: 'blue', 'red' do not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' meson-gxm-s912-libretech-pc.dt.yaml: leds: 'blue', 'green' do not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' meson-sm1-sei610.dt.yaml: leds: 'bluetooth' does not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+' meson-sm1-khadas-vim3l.dt.yaml: leds: 'red', 'white' do not match any of the regexes: '(^led-[0-9a-f]$|led)', 'pinctrl-[0-9]+'
--- arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi | 4 ++-- arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts | 2 +- arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts | 2 +- arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts | 2 +- arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi | 2 +- arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts | 4 ++-- arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi | 2 +- arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts | 4 ++-- arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts | 4 ++-- arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi | 4 ++-- arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts | 2 +- 11 files changed, 16 insertions(+), 16 deletions(-)
arch/arm64/boot/dts/amlogic/meson-gx-libretech-pc.dtsi +2 -2
@@ -96,14 +96,14 @@ leds { compatible = "gpio-leds"; - green { + led-green { color = <LED_COLOR_ID_GREEN>; function = LED_FUNCTION_DISK_ACTIVITY; gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>; linux,default-trigger = "disk-activity"; }; - blue { + led-blue { color = <LED_COLOR_ID_BLUE>; function = LED_FUNCTION_STATUS; gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>;
arch/arm64/boot/dts/amlogic/meson-gxbb-nanopi-k2.dts +1 -1
@@ -29,7 +29,7 @@ leds { compatible = "gpio-leds"; - stat { + led-stat { label = "nanopi-k2:blue:stat"; gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>; default-state = "on";
arch/arm64/boot/dts/amlogic/meson-gxbb-nexbox-a95x.dts +1 -1
@@ -31,7 +31,7 @@ leds { compatible = "gpio-leds"; - blue { + led-blue { label = "a95x:system-status"; gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>; linux,default-trigger = "heartbeat";
arch/arm64/boot/dts/amlogic/meson-gxbb-odroidc2.dts +1 -1
@@ -49,7 +49,7 @@ leds { compatible = "gpio-leds"; - blue { + led-blue { label = "c2:blue:alive"; gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_LOW>; linux,default-trigger = "heartbeat";
arch/arm64/boot/dts/amlogic/meson-gxbb-vega-s95.dtsi +1 -1
@@ -20,7 +20,7 @@ leds { compatible = "gpio-leds"; - blue { + led-blue { label = "vega-s95:blue:on"; gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>; default-state = "on";
arch/arm64/boot/dts/amlogic/meson-gxbb-wetek-play2.dts +2 -2
@@ -14,13 +14,13 @@ model = "WeTek Play 2"; leds { - wifi { + led-wifi { label = "wetek-play:wifi-status"; gpios = <&gpio GPIODV_26 GPIO_ACTIVE_HIGH>; default-state = "off"; }; - ethernet { + led-ethernet { label = "wetek-play:ethernet-status"; gpios = <&gpio GPIODV_27 GPIO_ACTIVE_HIGH>; default-state = "off";
arch/arm64/boot/dts/amlogic/meson-gxbb-wetek.dtsi +1 -1
@@ -25,7 +25,7 @@ leds { compatible = "gpio-leds"; - system { + led-system { label = "wetek-play:system-status"; gpios = <&gpio_ao GPIOAO_13 GPIO_ACTIVE_HIGH>; default-state = "on";
arch/arm64/boot/dts/amlogic/meson-gxl-s905x-libretech-cc.dts +2 -2
@@ -54,14 +54,14 @@ leds { compatible = "gpio-leds"; - system { + led-system { label = "librecomputer:system-status"; gpios = <&gpio GPIODV_24 GPIO_ACTIVE_HIGH>; default-state = "on"; panic-indicator; }; - blue { + led-blue { label = "librecomputer:blue"; gpios = <&gpio_ao GPIOAO_2 GPIO_ACTIVE_HIGH>; linux,default-trigger = "heartbeat";
arch/arm64/boot/dts/amlogic/meson-gxm-rbox-pro.dts +2 -2
@@ -36,13 +36,13 @@ leds { compatible = "gpio-leds"; - blue { + led-blue { label = "rbox-pro:blue:on"; gpios = <&gpio_ao GPIOAO_9 GPIO_ACTIVE_HIGH>; default-state = "on"; }; - red { + led-red { label = "rbox-pro:red:standby"; gpios = <&gpio GPIODV_28 GPIO_ACTIVE_HIGH>; default-state = "off";
arch/arm64/boot/dts/amlogic/meson-khadas-vim3.dtsi +2 -2
@@ -39,13 +39,13 @@ leds { compatible = "gpio-leds"; - white { + led-white { label = "vim3:white:sys"; gpios = <&gpio_ao GPIOAO_4 GPIO_ACTIVE_LOW>; linux,default-trigger = "heartbeat"; }; - red { + led-red { label = "vim3:red"; gpios = <&gpio_expander 5 GPIO_ACTIVE_LOW>; };
arch/arm64/boot/dts/amlogic/meson-sm1-sei610.dts +1 -1
@@ -104,7 +104,7 @@ leds { compatible = "gpio-leds"; - bluetooth { + led-bluetooth { label = "sei610:blue:bt"; gpios = <&gpio GPIOC_7 (GPIO_ACTIVE_LOW | GPIO_OPEN_DRAIN)>; default-state = "off";
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 154/477 ASoC: rt5682: fix I2C/Soundwire dependencies
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit fd443a20c2f0950f3c31765a08f7dd49b3bc69cb ]
If one of the two is a loadable module, the combined driver must not be built-in:
aarch64-linux-ld: sound/soc/codecs/rt5682.o: in function `rt5682_sdw_hw_free':
rt5682.c:(.text+0xb34): undefined reference to `sdw_stream_remove_slave'
aarch64-linux-ld: sound/soc/codecs/rt5682.o: in function `rt5682_sdw_hw_params':
rt5682.c:(.text+0xe78): undefined reference to `sdw_stream_add_slave'
In particular, the soundwire driver must not be built-in if CONFIG_I2C=m.
--- sound/soc/codecs/Kconfig | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/codecs/Kconfig +3 -0
@@ -1136,10 +1136,13 @@ config SND_SOC_RT5677_SPI config SND_SOC_RT5682 tristate depends on I2C || SOUNDWIRE + depends on SOUNDWIRE || !SOUNDWIRE + depends on I2C || !I2C config SND_SOC_RT5682_SDW tristate "Realtek RT5682 Codec - SDW" depends on SOUNDWIRE + depends on I2C || !I2C select SND_SOC_RT5682 select REGMAP_SOUNDWIRE
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 152/477 ASoC: component: suppress uninitialized-variable warning
In reply to Greg Kroah-HartmanFrom: Arnd Bergmann <[email protected]>
[ Upstream commit be16a0f0dc8fab8e25d9cdbeb4f8f28afc9186d2 ]
Old versions of gcc (tested on gcc-4.8) produce a warning for correct code:
sound/soc/soc-compress.c: In function 'soc_compr_open':sound/soc/soc-compress.c:75:28: error: 'component' is used uninitialized in this function [-Werror=uninitialized]
struct snd_soc_component *component, *save = NULL;
Change the for_each_rtd_components() macro to ensure 'component' gets initialized to a value the compiler does not complain about.
--- include/sound/soc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/sound/soc.h +1 -1
@@ -1177,7 +1177,7 @@ struct snd_soc_pcm_runtime {#define asoc_rtd_to_codec (rtd, n) (rtd)->dais[n + (rtd)->num_cpus]#define for_each_rtd_components (rtd, i, component) \ - for ((i) = 0; \ + for ((i) = 0, component = NULL; \ ((i) < rtd->num_components) && ((component) = rtd->components[i]);\ (i)++)#define for_each_rtd_cpu_dais (rtd, i, dai) \
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 151/477 gpio: pca953x: fix handling of automatic address incrementing
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit bcf41dc480b179bfb669a232080a2e26dc7294b4 ]
Some of the chips supported by the pca953x driver need the most significant bit in the address word set to automatically increment the address pointer on subsequent reads and writes (example: PCA9505). With this bit unset the same register is read multiple times on a multi-byte read sequence. Other chips must not have this bit set and autoincrement always (example: PCA9555).
Up to now this AI bit was interpreted to be part of the address, which resulted in inconsistent regmap caching when a register was written with AI set and then read without it. This happened for the PCA9505 in pca953x_gpio_set_multiple() where pca953x_read_regs() bulk read from the cache for registers 0x8-0xc and then wrote to registers 0x88-0x8c. (Side
note: reading 5 values from offset 0x8 yiels OP0 5 times because AI must be set to get OP0-OP4, which is another bug that is resolved here as a by-product.) The same problem happens when calls to gpio_set_value() and gpio_set_array_value() were mixed.
With this patch the AI bit is always set for chips that support it. This works as there are no code locations that make use of the behaviour with AI unset (for the chips that support it).
Note that the call to pca953x_setup_gpio() had to be done a bit earlier to make the NBANK macro work.
The history of this bug is a bit complicated. Commit b32cecb46bdc ("gpio: pca953x: Extract the register address mangling to single function") changed which chips and functions are affected. Commit 3b00691cc46a ("gpio: pca953x: hack to fix 24 bit gpio expanders") used some duct tape to make the driver at least appear to work. Commit 49427232764d ("gpio: pca953x: Perform basic regmap conversion") introduced the caching. Commit b4818afeacbd ("gpio: pca953x: Add set_multiple to allow multiple bits to be set in one write.") introduced the .set_multiple() callback which didn't work for chips that need the AI bit which was fixed later for some chips in 8958262af3fb ("gpio:
pca953x: Repair multi-byte IO address increment on PCA9575"). So I'm sorry, I don't know which commit I should pick for a Fixes: line.
--- drivers/gpio/gpio-pca953x.c | 44 +++++++++++++++++++++++-------------- 1 file changed, 28 insertions(+), 16 deletions(-)
drivers/gpio/gpio-pca953x.c +28 -16
@@ -307,8 +307,22 @@ static const struct regmap_config pca953x_i2c_regmap = { .volatile_reg = pca953x_volatile_register, .cache_type = REGCACHE_RBTREE, -/* REVISIT: should be 0x7f but some 24 bit chips use REG_ADDR_AI */ - .max_register = 0xff, + .max_register = 0x7f, +}; + +static const struct regmap_config pca953x_ai_i2c_regmap = { + .reg_bits =8 , + .val_bits =8 , + + .read_flag_mask =REG_ADDR_AI , + .write_flag_mask =REG_ADDR_AI , + + .readable_reg = pca953x_readable_register, + .writeable_reg = pca953x_writeable_register, + .volatile_reg = pca953x_volatile_register, + + .cache_type =REGCACHE_RBTREE , + .max_register =0x7f , }; static u8 pca953x_recalc_addr(struct pca953x_chip *chip, int reg, int off,
@@ -319,18 +333,6 @@ static u8 pca953x_recalc_addr(struct pca953x_chip *chip, int reg, int off,int pinctrl = (reg &PCAL_PINCTRL_MASK ) <<1 ;u8 regaddr = pinctrl | addr | (off /BANK_SZ ); -/* Single byte read doesn't need AI bit set. */ -if (!addrinc) -return regaddr; - -/* Chips with 24 and more GPIOs always support Auto Increment */ -if (write &&NBANK (chip) >2 ) - regaddr |=REG_ADDR_AI ; - -/* PCA9575 needs address-increment on multi-byte writes */ -if (PCA_CHIP_TYPE (chip->driver_data) ==PCA957X_TYPE ) - regaddr |=REG_ADDR_AI ; -return regaddr; }
@@ -863,6 +865,7 @@ static int pca953x_probe(struct i2c_client *client,int ret;u32 invert =0 ;struct regulator *reg; +const struct regmap_config *regmap_config; chip =devm_kzalloc (&client->dev,sizeof (*chip),GFP_KERNEL );if (chip ==NULL )
@@ -925,7 +928,17 @@ static int pca953x_probe(struct i2c_client *client,i2c_set_clientdata (client, chip); - chip->regmap =devm_regmap_init_i2c (client, &pca953x_i2c_regmap); +pca953x_setup_gpio (chip, chip->driver_data &PCA_GPIO_MASK ); + +if (NBANK (chip) >2 ||PCA_CHIP_TYPE (chip->driver_data) ==PCA957X_TYPE ) { +dev_info (&client->dev,"using AI\n" ); + regmap_config = &pca953x_ai_i2c_regmap; + }else { +dev_info (&client->dev,"using no AI\n" ); + regmap_config = &pca953x_i2c_regmap; + } + + chip->regmap =devm_regmap_init_i2c (client, regmap_config);if (IS_ERR (chip->regmap)) { ret =PTR_ERR (chip->regmap); goto err_exit;
@@ -956,7 +969,6 @@ static int pca953x_probe(struct i2c_client *client,/* initialize cached registers from their original values. * we can't share this chip with another i2c master. */ -pca953x_setup_gpio (chip, chip->driver_data &PCA_GPIO_MASK );if (PCA_CHIP_TYPE (chip->driver_data) ==PCA953X_TYPE ) { chip->regs = &pca953x_regs;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 147/477 of: property: Do not link to disabled devices
In reply to Greg Kroah-HartmanFrom: Nicolas Saenz Julienne <[email protected]>
[ Upstream commit 7456427af9def0fec5508dd8b861556038ee96a8 ]
When creating a consumer/supplier relationship between two devices, make sure the supplier node is actually active. Otherwise this will create a link relationship that will never be fulfilled. This, in the worst case scenario, will hang the system during boot.
Note that, in practice, the fact that a device-tree represented consumer/supplier relationship isn't fulfilled will not prevent devices from successfully probing.
--- drivers/of/property.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/of/property.c +13 -1
@@ -1045,8 +1045,20 @@ static int of_link_to_phandle(struct device *dev, struct device_node *sup_np,* Find the device node that contains the supplier phandle. It may be * @sup_np or it may be an ancestor of @sup_np. */ -while (sup_np && !of_find_property (sup_np,"compatible" ,NULL )) +while (sup_np) { + +/* Don't allow linking to a disabled supplier */ +if (!of_device_is_available (sup_np)) { +of_node_put (sup_np); + sup_np =NULL ; + } + +if (of_find_property (sup_np,"compatible" ,NULL )) +break ; + sup_np =of_get_next_parent (sup_np); + } +if (!sup_np) {dev_dbg (dev,"Not linking to %pOFP - No device\n" , tmp_np);return -ENODEV ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 143/477 tty: hvc: Fix data abort due to race in hvc_open
In reply to Greg Kroah-HartmanFrom: Raghavendra Rao Ananta <[email protected]>
[ Upstream commit e2bd1dcbe1aa34ff5570b3427c530e4332ecf0fe ]
Potentially, hvc_open() can be called in parallel when two tasks calls open() on /dev/hvcX. In such a scenario, if the hp->ops->notifier_add() callback in the function fails, where it sets the tty->driver_data to NULL, the parallel hvc_open() can see this NULL and cause a memory abort. Hence, serialize hvc_open and check if tty->private_data is NULL before proceeding ahead.
The issue can be easily reproduced by launching two tasks simultaneously that does nothing but open() and close() on /dev/hvcX.
For example:
$ ./simple_open_close /dev/hvc0 & ./simple_open_close /dev/hvc0 &
--- drivers/tty/hvc/hvc_console.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
drivers/tty/hvc/hvc_console.c +14 -2
@@ -75,6 +75,8 @@ static LIST_HEAD(hvc_structs);*/ static DEFINE_MUTEX (hvc_structs_mutex); +/* Mutex to serialize hvc_open */ +static DEFINE_MUTEX (hvc_open_mutex);/* * This value is used to assign a tty->index value to a hvc_struct based * upon order of exposure via hvc_probe(), when we can not match it to
@@ -346,16 +348,24 @@ static int hvc_install(struct tty_driver *driver, struct tty_struct *tty)*/ static int hvc_open (struct tty_struct *tty,struct file * filp) { -struct hvc_struct *hp = tty->driver_data; +struct hvc_struct *hp;unsigned long flags;int rc =0 ; +mutex_lock (&hvc_open_mutex); + + hp = tty->driver_data; +if (!hp) { + rc = -EIO ; + goto out; + } +spin_lock_irqsave (&hp->port.lock, flags);/* Check and then increment for fast path open. */ if (hp->port.count++ >0 ) {spin_unlock_irqrestore (&hp->port.lock, flags);hvc_kick (); -return 0 ; + goto out; }/* else count == 0 */ spin_unlock_irqrestore (&hp->port.lock, flags);
@@ -383,6 +393,8 @@ static int hvc_open(struct tty_struct *tty, struct file * filp)/* Force wakeup of the polling thread */ hvc_kick (); +out: +mutex_unlock (&hvc_open_mutex);return rc; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 100/477 f2fs: handle readonly filesystem in f2fs_ioc_shutdown()
In reply to Greg Kroah-HartmanFrom: Chao Yu <[email protected]>
[ Upstream commit 8626441f05dc45a2f4693ee6863d02456ce39e60 ]
If mountpoint is readonly, we should allow shutdowning filesystem successfully, this fixes issue found by generic/599 testcase of xfstest.
--- fs/f2fs/file.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
fs/f2fs/file.c +8 -1
@@ -2219,8 +2219,15 @@ static int f2fs_ioc_shutdown(struct file *filp, unsigned long arg)if (in !=F2FS_GOING_DOWN_FULLSYNC ) { ret =mnt_want_write_file (filp); -if (ret) +if (ret) { +if (ret == -EROFS ) { + ret =0 ; +f2fs_stop_checkpoint (sbi, false); +set_sbi_flag (sbi,SBI_IS_SHUTDOWN ); +trace_f2fs_shutdown (sbi, in, ret); + }return ret; + } }switch (in) {
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 108/477 media: v4l2-ctrls: Unset correct HEVC loop filter flag
In reply to Greg Kroah-HartmanFrom: Jonas Karlman <[email protected]>
[ Upstream commit 88441917dc6cd995cb993df603e264f5b88be50c ]
Wrong loop filter flag is unset when tiles enabled flag is not set, this cause HEVC decoding issues with Rockchip Video Decoder.
Fix this by unsetting the loop filter across tiles enabled flag instead of the pps loop filter across slices enabled flag when tiles are disabled.
--- drivers/media/v4l2-core/v4l2-ctrls.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/v4l2-core/v4l2-ctrls.c +1 -1
@@ -1825,7 +1825,7 @@ static int std_validate_compound(const struct v4l2_ctrl *ctrl, u32 idx, sizeof(p_hevc_pps->row_height_minus1)); p_hevc_pps->flags &= - ~V4L2_HEVC_PPS_FLAG_PPS_LOOP_FILTER_ACROSS_SLICES_ENABLED ; + ~V4L2_HEVC_PPS_FLAG_LOOP_FILTER_ACROSS_TILES_ENABLED ; } if (p_hevc_pps->flags &
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 107/477 media: s5p-mfc: Properly handle dma_parms for the allocated devices
In reply to Greg Kroah-HartmanFrom: Marek Szyprowski <[email protected]>
[ Upstream commit cc8c0363ddce6308168d8223378ca884c213f280 ]
Commit 9495b7e92f71 ("driver core: platform: Initialize dma_parms for platform devices") in v5.7-rc5 added allocation of dma_parms structure to all platform devices. Then vb2_dma_contig_set_max_seg_size() have been changed not to allocate dma_parms structure and rely on the one allocated by the device core. Lets allocate the needed structure also for the devices created for the 2 MFC device memory ports.
--- drivers/media/platform/s5p-mfc/s5p_mfc.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/media/platform/s5p-mfc/s5p_mfc.c +5 -1
@@ -1089,6 +1089,10 @@ static struct device *s5p_mfc_alloc_memdev(struct device *dev, child->coherent_dma_mask = dev->coherent_dma_mask; child->dma_mask = dev->dma_mask; child->release = s5p_mfc_memdev_release; + child->dma_parms =devm_kzalloc (dev,sizeof (*child->dma_parms), +GFP_KERNEL ); +if (!child->dma_parms) + goto err;/* * The memdevs are not proper OF platform devices, so in order for them
@@ -1104,7 +1108,7 @@ static struct device *s5p_mfc_alloc_memdev(struct device *dev,return child;device_del (child); } - +err:put_device (child);return NULL ; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 131/477 firmware: qcom_scm: fix bogous abuse of dma-direct internals
In reply to Greg Kroah-HartmanFrom: Christoph Hellwig <[email protected]>
[ Upstream commit 459b1f86f1cba7de813fbc335df476c111feec22 ]
As far as the device is concerned the dma address is the physical address. There is no need to convert it to a physical address, especially not using dma-direct internals that are not available to drivers and which will interact badly with IOMMUs. Last but not least the commit introducing it claimed to just fix a type issue, but actually changed behavior.
--- drivers/firmware/qcom_scm.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)
drivers/firmware/qcom_scm.c +3 -6
@@ -6,7 +6,6 @@#include <linux/init.h> #include <linux/cpumask.h> #include <linux/export.h> -#include <linux/dma-direct.h> #include <linux/dma-mapping.h> #include <linux/module.h> #include <linux/types.h>
@@ -806,8 +805,7 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz,struct qcom_scm_mem_map_info *mem_to_map;phys_addr_t mem_to_map_phys;phys_addr_t dest_phys; -phys_addr_t ptr_phys; -dma_addr_t ptr_dma; +dma_addr_t ptr_phys;size_t mem_to_map_sz;size_t dest_sz;size_t src_sz;
@@ -824,10 +822,9 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, ptr_sz =ALIGN (src_sz,SZ_64 ) +ALIGN (mem_to_map_sz,SZ_64 ) +ALIGN (dest_sz,SZ_64 ); - ptr =dma_alloc_coherent (__scm->dev, ptr_sz, &ptr_dma,GFP_KERNEL ); + ptr =dma_alloc_coherent (__scm->dev, ptr_sz, &ptr_phys,GFP_KERNEL );if (!ptr)return -ENOMEM ; - ptr_phys =dma_to_phys (__scm->dev, ptr_dma);/* Fill source vmid detail */ src = ptr;
@@ -855,7 +852,7 @@ int qcom_scm_assign_mem(phys_addr_t mem_addr, size_t mem_sz, ret =__qcom_scm_assign_mem (__scm->dev, mem_to_map_phys, mem_to_map_sz, ptr_phys, src_sz, dest_phys, dest_sz); -dma_free_coherent (__scm->dev, ptr_sz, ptr, ptr_dma); +dma_free_coherent (__scm->dev, ptr_sz, ptr, ptr_phys);if (ret) {dev_err (__scm->dev,"Assign memory protection call failed %d\n" , ret);
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 103/477 bpf, sockhash: Fix memory leak when unlinking sockets in sock_hash_free
In reply to Greg Kroah-HartmanFrom: Jakub Sitnicki <[email protected]>
[ Upstream commit 33a7c831565c43a7ee2f38c7df4c4a40e1dfdfed ]
When sockhash gets destroyed while sockets are still linked to it, we will walk the bucket lists and delete the links. However, we are not freeing the list elements after processing them, leaking the memory.
The leak can be triggered by close()'ing a sockhash map when it still contains sockets, and observed with kmemleak:
unreferenced object 0xffff888116e86f00 (size 64):
comm "race_sock_unlin", pid 223, jiffies 4294731063 (age 217.404s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
81 de e8 41 00 00 00 00 c0 69 2f 15 81 88 ff ff ...A.....i/.....
backtrace:
[<00000000dd089ebb>] sock_hash_update_common+0x4ca/0x760
[<00000000b8219bd5>] sock_hash_update_elem+0x1d2/0x200
[<000000005e2c23de>] __do_sys_bpf+0x2046/0x2990
[<00000000d0084618>] do_syscall_64+0xad/0x9a0
[<000000000d96f263>] entry_SYSCALL_64_after_hwframe+0x49/0xb3Fix it by freeing the list element when we're done with it.
--- net/core/sock_map.c | 1 + 1 file changed, 1 insertion(+)
net/core/sock_map.c +1 -0
@@ -1024,6 +1024,7 @@ static void sock_hash_free(struct bpf_map *map)sock_map_unref (elem->sk, elem);rcu_read_unlock ();release_sock (elem->sk); +sock_hash_free_elem (htab, elem); } }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 129/477 fuse: BUG_ON correction in fuse_dev_splice_write()
In reply to Greg Kroah-HartmanFrom: Vasily Averin <[email protected]>
[ Upstream commit 0e9fb6f17ad5b386b75451328975a07d7d953c6d ]
commit 963545357202 ("fuse: reduce allocation size for splice_write") changed size of bufs array, so BUG_ON which checks the index of the array shold also be fixed.
[SzM: turn BUG_ON into WARN_ON]
--- fs/fuse/dev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/fuse/dev.c +3 -2
@@ -1977,8 +1977,9 @@ static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe,struct pipe_buffer *ibuf;struct pipe_buffer *obuf; -BUG_ON (nbuf >= pipe->ring_size); -BUG_ON (tail == head); +if (WARN_ON (nbuf >= count || tail == head)) + goto out_free; + ibuf = &pipe->bufs[tail & mask]; obuf = &bufs[nbuf];
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 119/477 scsi: qedi: Do not flush offload work if ARP not resolved
In reply to Greg Kroah-HartmanFrom: Nilesh Javali <[email protected]>
[ Upstream commit 927527aea0e2a9c1d336c7d33f77f1911481d008 ]
For an unreachable target, offload_work is not initialized and the endpoint state is set to OFLDCONN_NONE. This results in a WARN_ON due to the check of the work function field being set to zero.
------------[ cut here ]------------
WARNING: CPU: 24 PID: 18587 at ../kernel/workqueue.c:3037 __flush_work+0x1c1/0x1d0
:
Hardware name: HPE ProLiant DL380 Gen10/ProLiant DL380 Gen10, BIOS U30 02/01/2020
RIP: 0010:__flush_work+0x1c1/0x1d0
Code: ba 6d 00 03 80 c9 f0 eb b6 48 c7 c7 20 ee 6c a4 e8 52 d3 04 00 0f 0b 31 c0 e9 d1 fe ff
ff 48 c7 c7 20 ee 6c a4 e8 3d d3 04 00 <0f> 0b 31 c0 e9 bc fe ff ff e8 11 f3 f
00 31 f6
RSP: 0018:ffffac5a8cd47a80 EFLAGS: 00010282
RAX: 0000000000000024 RBX: ffff98d68c1fcaf0 RCX: 0000000000000000
RDX: 0000000000000000 RSI: ffff98ce9fd99898 RDI: ffff98ce9fd99898
RBP: ffff98d68c1fcbc0 R08: 00000000000006fa R09: 0000000000000001
R10: ffffac5a8cd47b50 R11: 0000000000000001 R12: 0000000000000000
R13: 000000000000489b R14: ffff98d68c1fc800 R15: ffff98d692132c00
FS: 00007f65f7f62280(0000) GS:ffff98ce9fd80000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffd2435e880 CR3: 0000000809334003 CR4: 00000000007606e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
? class_create_release+0x40/0x40
? klist_put+0x2c/0x80
qedi_ep_disconnect+0xdd/0x400 [qedi]
iscsi_if_ep_disconnect.isra.20+0x59/0x70 [scsi_transport_iscsi]
iscsi_if_rx+0x129b/0x1670 [scsi_transport_iscsi]
? __netlink_lookup+0xe7/0x160
netlink_unicast+0x21d/0x300
netlink_sendmsg+0x30f/0x430
sock_sendmsg+0x5b/0x60
____sys_sendmsg+0x1e2/0x240
? copy_msghdr_from_user+0xd9/0x160
___sys_sendmsg+0x88/0xd0
? ___sys_recvmsg+0xa2/0xe0
? hrtimer_try_to_cancel+0x25/0x100
? do_nanosleep+0x9c/0x170
? __sys_sendmsg+0x5e/0xa0
__sys_sendmsg+0x5e/0xa0
do_syscall_64+0x60/0x1f0
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7f65f6f16107
Code: 64 89 02 48 c7 c0 ff ff ff ff eb b9 0f 1f 80 00 00 00 00 8b 05 aa d2 2b 00 48 63 d2 48
63 ff 85 c0 75 18 b8 2e 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 59 f3 c3 0f 1f 8
0 00 00 00 00 53 48 89 f3 48
RSP: 002b:00007ffd24367ca8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 000055a7aeaaf110 RCX: 00007f65f6f16107
RDX: 0000000000000000 RSI: 00007ffd24367cc0 RDI: 0000000000000003
RBP: 0000000000000070 R08: 0000000000000000 R09: 0000000000000000
R10: 000000000000075c R11: 0000000000000246 R12: 00007ffd24367cc0
R13: 000055a7ae560008 R14: 00007ffd24367db0 R15: 0000000000000000
---[ end trace 54f499c05d41f8bb ]---Only flush if the connection endpoint state if different from OFLDCONN_NONE.
[mkp: clarified commit desc]
--- drivers/scsi/qedi/qedi_iscsi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/scsi/qedi/qedi_iscsi.c +2 -1
@@ -1001,7 +1001,8 @@ static void qedi_ep_disconnect(struct iscsi_endpoint *ep)if (qedi_ep->state ==EP_STATE_OFLDCONN_START ) goto ep_exit_recover; -flush_work (&qedi_ep->offload_work); +if (qedi_ep->state !=EP_STATE_OFLDCONN_NONE ) +flush_work (&qedi_ep->offload_work);if (qedi_ep->conn) { qedi_conn = qedi_ep->conn;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 120/477 arm64: dts: qcom: msm8916: remove unit name for thermal trip points
In reply to Greg Kroah-HartmanFrom: Amit Kucheria <[email protected]>
[ Upstream commit fe2aff0c574d206f34f1864d5a0b093694c27142 ]
The thermal trip points have unit name but no reg property, so we can remove them. It also fixes the following warnings from 'make dtbs_check' after adding the thermal yaml bindings.
arch/arm64/boot/dts/qcom/apq8016-sbc.dt.yaml: thermal-zones:
gpu-thermal:trips: 'trip-point@0' does not match any of the regexes:
'^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$', 'pinctrl-[0-9]+' arch/arm64/boot/dts/qcom/apq8016-sbc.dt.yaml: thermal-zones:
camera-thermal:trips: 'trip-point@0' does not match any of the regexes:
'^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$', 'pinctrl-[0-9]+' arch/arm64/boot/dts/qcom/apq8016-sbc.dt.yaml: thermal-zones:
modem-thermal:trips: 'trip-point@0' does not match any of the regexes:
'^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$', 'pinctrl-[0-9]+'
arch/arm64/boot/dts/qcom/msm8916-mtp.dt.yaml: thermal-zones:
gpu-thermal:trips: 'trip-point@0' does not match any of the regexes:
'^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$', 'pinctrl-[0-9]+' arch/arm64/boot/dts/qcom/msm8916-mtp.dt.yaml: thermal-zones:
camera-thermal:trips: 'trip-point@0' does not match any of the regexes:
'^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$', 'pinctrl-[0-9]+' arch/arm64/boot/dts/qcom/msm8916-mtp.dt.yaml: thermal-zones:
modem-thermal:trips: 'trip-point@0' does not match any of the regexes:
'^[a-zA-Z][a-zA-Z0-9\\-_]{0,63}$', 'pinctrl-[0-9]+'
--- arch/arm64/boot/dts/qcom/msm8916.dtsi | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/arm64/boot/dts/qcom/msm8916.dtsi +4 -4
@@ -261,7 +261,7 @@ thermal-sensors = <&tsens 4>; trips { - cpu2_3_alert0: trip-point@0 { + cpu2_3_alert0: trip-point0 { temperature = <75000>; hysteresis = <2000>; type = "passive";
@@ -291,7 +291,7 @@ thermal-sensors = <&tsens 2>; trips { - gpu_alert0: trip-point@0 { + gpu_alert0: trip-point0 { temperature = <75000>; hysteresis = <2000>; type = "passive";
@@ -311,7 +311,7 @@ thermal-sensors = <&tsens 1>; trips { - cam_alert0: trip-point@0 { + cam_alert0: trip-point0 { temperature = <75000>; hysteresis = <2000>; type = "hot";
@@ -326,7 +326,7 @@ thermal-sensors = <&tsens 0>; trips { - modem_alert0: trip-point@0 { + modem_alert0: trip-point0 { temperature = <85000>; hysteresis = <2000>; type = "hot";
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 117/477 staging: mt7621-pci: fix PCIe interrupt mapping
In reply to Greg Kroah-HartmanFrom: Sergio Paracuellos <[email protected]>
[ Upstream commit fab6710e4c51f4eb622f95a08322ab5fdbe3f295 ]
MT7621 has three assigned interrupts for the pcie. This interrupts should properly being mapped taking into account which devices are finally connected in which bus according to link status. So the irq mappings should be as follows according to link status (three bits indicating which devices are link up):
* For PCIe Bus 1 slot 0:
- status = 0x2 || status = 0x6 => IRQ = pcie1_irq (24).
- status = 0x4 => IRQ = pcie2_irq (25).
- default => IRQ = pcie0_irq (23).
* For PCIe Bus 2 slot 0:
- status = 0x5 || status = 0x6 => IRQ = pcie2_irq (25).
- default => IRQ = pcie1_irq (24).
* For PCIe Bus 2 slot 1:
- status = 0x5 || status = 0x6 => IRQ = pcie2_irq (25).
- default => IRQ = pcie1_irq (24).
* For PCIe Bus 3 any slot:
- default => IRQ = pcie2_irq (25).
Because of this, the function 'of_irq_parse_and_map_pci' cannot be used and we need to change device tree information from using the 'interrupt-map' and 'interrupt-map-mask' properties into an 'interrupts' property to be able to get irq information from the ports using the 'platform_get_irq' and storing an 'irq-map' into the pcie driver data node to properly map correct irq using a new 'mt7621_map_irq' function where this map will be read and the correct irq returned.
--- drivers/staging/mt7621-dts/mt7621.dtsi | 9 +++---- drivers/staging/mt7621-pci/pci-mt7621.c | 36 +++++++++++++++++++++++-- 2 files changed, 38 insertions(+), 7 deletions(-)
drivers/staging/mt7621-dts/mt7621.dtsi +4 -5
@@ -523,11 +523,10 @@ 0x01000000 0 0x00000000 0x1e160000 0 0x00010000 /* io space */ >; - #interrupt-cells = <1>; - interrupt-map-mask = <0xF0000 0 0 1>; - interrupt-map = <0x10000 0 0 1 &gic GIC_SHARED 4 IRQ_TYPE_LEVEL_HIGH>, - <0x20000 0 0 1 &gic GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH>, - <0x30000 0 0 1 &gic GIC_SHARED 25 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&gic>; + interrupts = <GIC_SHARED 4 IRQ_TYPE_LEVEL_HIGH + GIC_SHARED 24 IRQ_TYPE_LEVEL_HIGH + GIC_SHARED 25 IRQ_TYPE_LEVEL_HIGH>; status = "disabled";
drivers/staging/mt7621-pci/pci-mt7621.c +34 -2
@@ -97,6 +97,7 @@* @pcie_rst: pointer to port reset control * @gpio_rst: gpio reset * @slot: port slot +* @irq: GIC irq * @enabled: indicates if port is enabled */ struct mt7621_pcie_port {
@@ -107,6 +108,7 @@ struct mt7621_pcie_port {struct reset_control *pcie_rst;struct gpio_desc *gpio_rst;u32 slot; +int irq;bool enabled; };
@@ -120,6 +122,7 @@ struct mt7621_pcie_port {* @dev: Pointer to PCIe device * @io_map_base: virtual memory base address for io * @ports: pointer to PCIe port information +* @irq_map: irq mapping info according pcie link status * @resets_inverted: depends on chip revision * reset lines are inverted. */
@@ -135,6 +138,7 @@ struct mt7621_pcie { } offset;unsigned long io_map_base;struct list_head ports; +int irq_map[PCIE_P2P_MAX ];bool resets_inverted; };
@@ -279,6 +283,16 @@ static void setup_cm_memory_region(struct mt7621_pcie *pcie) } } +static int mt7621_map_irq (const struct pci_dev *pdev,u8 slot,u8 pin) +{ +struct mt7621_pcie *pcie = pdev->bus->sysdata; +struct device *dev = pcie->dev; +int irq = pcie->irq_map[slot]; + +dev_info (dev,"bus=%d slot=%d irq=%d\n" , pdev->bus->number, slot, irq); +return irq; +} +static int mt7621_pci_parse_request_of_pci_ranges (struct mt7621_pcie *pcie) {struct device *dev = pcie->dev;
@@ -330,6 +344,7 @@ static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie, {struct mt7621_pcie_port *port;struct device *dev = pcie->dev; +struct platform_device *pdev =to_platform_device (dev);struct device_node *pnode = dev->of_node;struct resource regs;char name[10 ];
@@ -371,6 +386,12 @@ static int mt7621_pcie_parse_port(struct mt7621_pcie *pcie, port->slot = slot; port->pcie = pcie; + port->irq =platform_get_irq (pdev, slot); +if (port->irq <0 ) { +dev_err (dev,"Failed to get IRQ for PCIe%d\n" , slot); +return -ENXIO ; + } +INIT_LIST_HEAD (&port->list);list_add_tail (&port->list, &pcie->ports);
@@ -585,13 +606,15 @@ static int mt7621_pcie_init_virtual_bridges(struct mt7621_pcie *pcie) {u32 pcie_link_status =0 ;u32 n; -int i; +int i =0 ;u32 p2p_br_devnum[PCIE_P2P_MAX ]; +int irqs[PCIE_P2P_MAX ];struct mt7621_pcie_port *port;list_for_each_entry (port, &pcie->ports, list) {u32 slot = port->slot; + irqs[i++] = port->irq;if (port->enabled) pcie_link_status |=BIT (slot); }
@@ -614,6 +637,15 @@ static int mt7621_pcie_init_virtual_bridges(struct mt7621_pcie *pcie) (p2p_br_devnum[1 ] <<PCIE_P2P_BR_DEVNUM1_SHIFT ) | (p2p_br_devnum[2] << PCIE_P2P_BR_DEVNUM2_SHIFT)); +/* Assign IRQs */ + n =0 ; +for (i =0 ; i <PCIE_P2P_MAX ; i++) +if (pcie_link_status &BIT (i)) + pcie->irq_map[n++] = irqs[i]; + +for (i = n; i <PCIE_P2P_MAX ; i++) + pcie->irq_map[i] =-1 ; +return 0 ; }
@@ -638,7 +670,7 @@ static int mt7621_pcie_register_host(struct pci_host_bridge *host, host->busnr = pcie->busn.start; host->dev.parent = pcie->dev; host->ops = &mt7621_pci_ops; - host->map_irq = of_irq_parse_and_map_pci; + host->map_irq = mt7621_map_irq; host->swizzle_irq = pci_common_swizzle; host->sysdata = pcie;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 111/477 apparmor: fix nnp subset test for unconfined
In reply to Greg Kroah-HartmanFrom: John Johansen <[email protected]>
[ Upstream commit 3ed4aaa94fc07db3cd0c91be95e3e1b9782a2710 ]
The subset test is not taking into account the unconfined exception which will cause profile transitions in the stacked confinement case to fail when no_new_privs is applied.
This fixes a regression introduced in the fix for
https://bugs.launchpad.net/bugs/1839037
--- security/apparmor/domain.c | 9 +++++---- security/apparmor/include/label.h | 1 + security/apparmor/label.c | 33 +++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+), 4 deletions(-)
security/apparmor/domain.c +5 -4
@@ -929,7 +929,8 @@ int apparmor_bprm_set_creds(struct linux_binprm *bprm)* aways results in a further reduction of permissions. */ if ((bprm->unsafe &LSM_UNSAFE_NO_NEW_PRIVS ) && - !unconfined (label) && !aa_label_is_subset (new, ctx->nnp)) { + !unconfined (label) && + !aa_label_is_unconfined_subset (new, ctx->nnp)) { error = -EPERM ; info ="no new privs" ; goto audit;
@@ -1207,7 +1208,7 @@ int aa_change_hat(const char *hats[], int count, u64 token, int flags)* reduce restrictions. */ if (task_no_new_privs (current) && !unconfined (label) && - !aa_label_is_subset (new, ctx->nnp)) { + !aa_label_is_unconfined_subset (new, ctx->nnp)) {/* not an apparmor denial per se, so don't log it */ AA_DEBUG ("no_new_privs - change_hat denied" ); error = -EPERM ;
@@ -1228,7 +1229,7 @@ int aa_change_hat(const char *hats[], int count, u64 token, int flags)* reduce restrictions. */ if (task_no_new_privs (current) && !unconfined (label) && - !aa_label_is_subset (previous, ctx->nnp)) { + !aa_label_is_unconfined_subset (previous, ctx->nnp)) {/* not an apparmor denial per se, so don't log it */ AA_DEBUG ("no_new_privs - change_hat denied" ); error = -EPERM ;
@@ -1423,7 +1424,7 @@ check:* reduce restrictions. */ if (task_no_new_privs (current) && !unconfined (label) && - !aa_label_is_subset (new, ctx->nnp)) { + !aa_label_is_unconfined_subset (new, ctx->nnp)) {/* not an apparmor denial per se, so don't log it */ AA_DEBUG ("no_new_privs - change_hat denied" ); error = -EPERM ;
security/apparmor/include/label.h +1 -0
@@ -281,6 +281,7 @@ bool aa_label_init(struct aa_label *label, int size, gfp_t gfp);struct aa_label *aa_label_alloc (int size,struct aa_proxy *proxy,gfp_t gfp);bool aa_label_is_subset (struct aa_label *set,struct aa_label *sub); +bool aa_label_is_unconfined_subset (struct aa_label *set,struct aa_label *sub);struct aa_profile *__aa_label_next_not_in_set (struct label_it *I ,struct aa_label *set,struct aa_label *sub);
security/apparmor/label.c +33 -0
@@ -550,6 +550,39 @@ bool aa_label_is_subset(struct aa_label *set, struct aa_label *sub)return __aa_label_next_not_in_set (&i, set, sub) ==NULL ; } +/** +* aa_label_is_unconfined_subset - test if @sub is a subset of @set +* @set: label to test against +* @sub: label to test if is subset of @set +* +* This checks for subset but taking into account unconfined. IF +* @sub contains an unconfined profile that does not have a matching +* unconfined in @set then this will not cause the test to fail. +* Conversely we don't care about an unconfined in @set that is not in +* @sub +* +* Returns: true if @sub is special_subset of @set +* else false +*/ +bool aa_label_is_unconfined_subset (struct aa_label *set,struct aa_label *sub) +{ +struct label_it i = { }; +struct aa_profile *p; + +AA_BUG (!set); +AA_BUG (!sub); + +if (sub == set) +return true; + +do { + p =__aa_label_next_not_in_set (&i, set, sub); +if (p && !profile_unconfined (p)) +break ; + }while (p); + +return p ==NULL ; +}/**
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 113/477 ARM: dts: bcm283x: Use firmware PM driver for V3D
In reply to Greg Kroah-HartmanFrom: Nicolas Saenz Julienne <[email protected]>
[ Upstream commit 3ac395a5b3f3b678663fbb58381fdae2b1b57588 ]
The register based driver turned out to be unstable, specially on RPi3a+ but not limited to it. While a fix is being worked on, we roll back to using firmware based scheme.
--- arch/arm/boot/dts/bcm2835-common.dtsi | 1 - arch/arm/boot/dts/bcm2835-rpi-common.dtsi | 12 ++++++++++++ arch/arm/boot/dts/bcm2835.dtsi | 1 + arch/arm/boot/dts/bcm2836.dtsi | 1 + arch/arm/boot/dts/bcm2837.dtsi | 1 + 5 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 arch/arm/boot/dts/bcm2835-rpi-common.dtsi
arch/arm/boot/dts/bcm2835-common.dtsi +0 -1
@@ -130,7 +130,6 @@ compatible = "brcm,bcm2835-v3d"; reg = <0x7ec00000 0x1000>; interrupts = <1 10>; - power-domains = <&pm BCM2835_POWER_DOMAIN_GRAFX_V3D>; }; vc4: gpu {
arch/arm/boot/dts/bcm2835-rpi-common.dtsi new file +12 -0
@@ -0,0 +1,12 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * This include file covers the common peripherals and configuration between + * bcm2835, bcm2836 and bcm2837 implementations that interact with RPi's + * firmware interface. + */ + +#include <dt-bindings/power/raspberrypi-power.h> + +&v3d { + power-domains = <&power RPI_POWER_DOMAIN_V3D>; +};
arch/arm/boot/dts/bcm2835.dtsi +1 -0
@@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include "bcm283x.dtsi" #include "bcm2835-common.dtsi" +#include "bcm2835-rpi-common.dtsi" / { compatible = "brcm,bcm2835";
arch/arm/boot/dts/bcm2836.dtsi +1 -0
@@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include "bcm283x.dtsi" #include "bcm2835-common.dtsi" +#include "bcm2835-rpi-common.dtsi" / { compatible = "brcm,bcm2836";
arch/arm/boot/dts/bcm2837.dtsi +1 -0
@@ -1,5 +1,6 @@ #include "bcm283x.dtsi" #include "bcm2835-common.dtsi" +#include "bcm2835-rpi-common.dtsi" / { compatible = "brcm,bcm2837";
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 110/477 bpf: tcp: Recv() should return 0 when the peer socket is closed
In reply to Greg Kroah-HartmanFrom: Sabrina Dubroca <[email protected]>
[ Upstream commit 2c7269b231194aae23fb90ab65842573a91acbc9 ]
If the peer is closed, we will never get more data, so tcp_bpf_wait_data will get stuck forever. In case we passed MSG_DONTWAIT to recv(), we get EAGAIN but we should actually get 0.
Quoted 1 line
From man 2 recv:
RETURN VALUE
When a stream socket peer has performed an orderly shutdown, the return value will be 0 (the traditional "end-of-file" return).
This patch makes tcp_bpf_wait_data always return 1 when the peer socket has been shutdown. Either we have data available, and it would have returned 1 anyway, or there isn't, in which case we'll call tcp_recvmsg which does the right thing in this situation.
--- net/ipv4/tcp_bpf.c | 3 +++ 1 file changed, 3 insertions(+)
net/ipv4/tcp_bpf.c +3 -0
@@ -242,6 +242,9 @@ static int tcp_bpf_wait_data(struct sock *sk, struct sk_psock *psock,DEFINE_WAIT_FUNC (wait, woken_wake_function);int ret =0 ; +if (sk->sk_shutdown &RCV_SHUTDOWN ) +return 1 ; +if (!timeo)return ret;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 74/477 clk: zynqmp: fix memory leak in zynqmp_register_clocks
In reply to Greg Kroah-HartmanFrom: Quanyang Wang <[email protected]>
[ Upstream commit 58b0fb86260063f86afecaebf4056c876fff2a19 ]
This is detected by kmemleak running on zcu102 board:
unreferenced object 0xffffffc877e48180 (size 128):
comm "swapper/0", pid 1, jiffies 4294892909 (age 315.436s) hex dump (first 32 bytes):
64 70 5f 76 69 64 65 6f 5f 72 65 66 5f 64 69 76 dp_video_ref_div 31 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1............... backtrace:
[<00000000c9be883b>] __kmalloc_track_caller+0x200/0x380 [<00000000f02c3809>] kvasprintf+0x7c/0x100 [<00000000e51dde4d>] kasprintf+0x60/0x80 [<0000000092298b05>] zynqmp_register_clocks+0x29c/0x398 [<00000000faaff182>] zynqmp_clock_probe+0x3cc/0x4c0 [<000000005f5986f0>] platform_drv_probe+0x58/0xa8 [<00000000d5810136>] really_probe+0xd8/0x2a8 [<00000000f5b671be>] driver_probe_device+0x5c/0x100 [<0000000038f91fcf>] __device_attach_driver+0x98/0xb8 [<000000008a3f2ac2>] bus_for_each_drv+0x74/0xd8 [<000000001cb2783d>] __device_attach+0xe0/0x140 [<00000000c268031b>] device_initial_probe+0x24/0x30 [<000000006998de4b>] bus_probe_device+0x9c/0xa8 [<00000000647ae6ff>] device_add+0x3c0/0x610 [<0000000071c14bb8>] of_device_add+0x40/0x50 [<000000004bb5d132>] of_platform_device_create_pdata+0xbc/0x138
This is because that when num_nodes is larger than 1, clk_out is allocated using kasprintf for these nodes but only the last node's clk_out is freed.
--- drivers/clk/zynqmp/clkc.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
drivers/clk/zynqmp/clkc.c +9 -6
@@ -558,7 +558,7 @@ static struct clk_hw *zynqmp_register_clk_topology(int clk_id, char *clk_name, {int j;u32 num_nodes, clk_dev_id; -char *clk_out =NULL ; +char *clk_out[MAX_NODES ];struct clock_topology *nodes;struct clk_hw *hw =NULL ;
@@ -572,16 +572,16 @@ static struct clk_hw *zynqmp_register_clk_topology(int clk_id, char *clk_name,* Intermediate clock names are postfixed with type of clock. */ if (j != (num_nodes -1 )) { - clk_out =kasprintf (GFP_KERNEL ,"%s%s" , clk_name, + clk_out[j] =kasprintf (GFP_KERNEL ,"%s%s" , clk_name, clk_type_postfix[nodes[j].type]); }else { - clk_out =kasprintf (GFP_KERNEL ,"%s" , clk_name); + clk_out[j] =kasprintf (GFP_KERNEL ,"%s" , clk_name); }if (!clk_topology[nodes[j].type])continue ; - hw = (*clk_topology[nodes[j].type])(clk_out, clk_dev_id, + hw = (*clk_topology[nodes[j].type])(clk_out[j], clk_dev_id, parent_names, num_parents, &nodes[j]);
@@ -590,9 +590,12 @@ static struct clk_hw *zynqmp_register_clk_topology(int clk_id, char *clk_name, __func__, clk_dev_id, clk_name, PTR_ERR(hw)); - parent_names[0 ] = clk_out; + parent_names[0 ] = clk_out[j]; } -kfree (clk_out); + +for (j =0 ; j < num_nodes; j++) +kfree (clk_out[j]); +return hw; }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 99/477 apparmor: check/put label on apparmor_sk_clone_security()
In reply to Greg Kroah-HartmanFrom: Mauricio Faria de Oliveira <[email protected]>
[ Upstream commit 3b646abc5bc6c0df649daea4c2c976bd4d47e4c8 ]
Currently apparmor_sk_clone_security() does not check for existing label/peer in the 'new' struct sock; it just overwrites it, if any (with another reference to the label of the source sock.)
static void apparmor_sk_clone_security(const struct sock *sk,
struct sock *newsk)
{
struct aa_sk_ctx *ctx = SK_CTX(sk);
struct aa_sk_ctx *new = SK_CTX(newsk);
new->label = aa_get_label(ctx->label);
new->peer = aa_get_label(ctx->peer);
}This might leak label references, which might overflow under load. Thus, check for and put labels, to prevent such errors.
Note this is similarly done on:
static int apparmor_socket_post_create(struct socket *sock, ...)
...
if (sock->sk) {
struct aa_sk_ctx *ctx = SK_CTX(sock->sk);
aa_put_label(ctx->label);
ctx->label = aa_get_label(label);
}
...Context:
-------
The label reference count leak is observed if apparmor_sock_graft() is called previously: this sets the 'ctx->label' field by getting a reference to the current label (later overwritten, without put.)
static void apparmor_sock_graft(struct sock *sk, ...)
{
struct aa_sk_ctx *ctx = SK_CTX(sk);
if (!ctx->label)
ctx->label = aa_get_current_label();
}And that is the case on crypto/af_alg.c:af_alg_accept():
int af_alg_accept(struct sock *sk, struct socket *newsock, ...)
...
struct sock *sk2;
...
sk2 = sk_alloc(...);
...
security_sock_graft(sk2, newsock);
security_sk_clone(sk, sk2);
...Apparently both calls are done on their own right, especially for other LSMs, being introduced in 2010/2014, before apparmor socket mediation in 2017 (see commits [1,2,3,4]).
So, it looks OK there! Let's fix the reference leak in apparmor.
Test-case:
---------
Exercise that code path enough to overflow label reference count.
$ cat aa-refcnt-af_alg.c
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/socket.h>
#include <linux/if_alg.h> int main() {
int sockfd;
struct sockaddr_alg sa;
/* Setup the crypto API socket */
sockfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
if (sockfd < 0) {
perror("socket");
return 1;
}
memset(&sa, 0, sizeof(sa));
sa.salg_family = AF_ALG;
strcpy((char *) sa.salg_type, "rng");
strcpy((char *) sa.salg_name, "stdrng");
if (bind(sockfd, (struct sockaddr *) &sa, sizeof(sa)) < 0) {
perror("bind");
return 1;
}
/* Accept a "connection" and close it; repeat. */
while (!close(accept(sockfd, NULL, 0)));
return 0;
}
$ gcc -o aa-refcnt-af_alg aa-refcnt-af_alg.c
$ ./aa-refcnt-af_alg
<a few hours later>
[ 9928.475953] refcount_t overflow at apparmor_sk_clone_security+0x37/0x70 in aa-refcnt-af_alg[1322], uid/euid: 1000/1000
...
[ 9928.507443] RIP: 0010:apparmor_sk_clone_security+0x37/0x70
...
[ 9928.514286] security_sk_clone+0x33/0x50
[ 9928.514807] af_alg_accept+0x81/0x1c0 [af_alg]
[ 9928.516091] alg_accept+0x15/0x20 [af_alg]
[ 9928.516682] SYSC_accept4+0xff/0x210
[ 9928.519609] SyS_accept+0x10/0x20
[ 9928.520190] do_syscall_64+0x73/0x130
[ 9928.520808] entry_SYSCALL_64_after_hwframe+0x3d/0xa2Note that other messages may be seen, not just overflow, depending on the value being incremented by kref_get(); on another run:
[ 7273.182666] refcount_t: saturated; leaking memory.
...
[ 7273.185789] refcount_t: underflow; use-after-free.Kprobes:
-------
Using kprobe events to monitor sk -> sk_security -> label -> count (kref):
Original v5.7 (one reference leak every iteration)
... (af_alg_accept+0x0/0x1c0) label=0xffff8a0f36c25eb0 label_refcnt=0x11fd2 ... (af_alg_release_parent+0x0/0xd0) label=0xffff8a0f36c25eb0 label_refcnt=0x11fd4 ... (af_alg_accept+0x0/0x1c0) label=0xffff8a0f36c25eb0 label_refcnt=0x11fd3 ... (af_alg_release_parent+0x0/0xd0) label=0xffff8a0f36c25eb0 label_refcnt=0x11fd5 ... (af_alg_accept+0x0/0x1c0) label=0xffff8a0f36c25eb0 label_refcnt=0x11fd4 ... (af_alg_release_parent+0x0/0xd0) label=0xffff8a0f36c25eb0 label_refcnt=0x11fd6
Patched v5.7 (zero reference leak per iteration)
... (af_alg_accept+0x0/0x1c0) label=0xffff9ff376c25eb0 label_refcnt=0x593 ... (af_alg_release_parent+0x0/0xd0) label=0xffff9ff376c25eb0 label_refcnt=0x594 ... (af_alg_accept+0x0/0x1c0) label=0xffff9ff376c25eb0 label_refcnt=0x593 ... (af_alg_release_parent+0x0/0xd0) label=0xffff9ff376c25eb0 label_refcnt=0x594 ... (af_alg_accept+0x0/0x1c0) label=0xffff9ff376c25eb0 label_refcnt=0x593 ... (af_alg_release_parent+0x0/0xd0) label=0xffff9ff376c25eb0 label_refcnt=0x594
Commits:
-------
[1] commit 507cad355fc9 ("crypto: af_alg - Make sure sk_security is initialized on accept()ed sockets")
[2] commit 4c63f83c2c2e ("crypto: af_alg - properly label AF_ALG socket")
[3] commit 2acce6aa9f65 ("Networking") a.k.a ("crypto: af_alg - Avoid sock_graft call warning)
[4] commit 56974a6fcfef ("apparmor: add base infastructure for socket mediation")
--- security/apparmor/lsm.c | 5 +++++ 1 file changed, 5 insertions(+)
security/apparmor/lsm.c +5 -0
@@ -804,7 +804,12 @@ static void apparmor_sk_clone_security(const struct sock *sk,struct aa_sk_ctx *ctx =SK_CTX (sk);struct aa_sk_ctx *new =SK_CTX (newsk); +if (new->label) +aa_put_label (new->label); new->label =aa_get_label (ctx->label); + +if (new->peer) +aa_put_label (new->peer); new->peer =aa_get_label (ctx->peer); }
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 69/477 gpio: dwapb: Call acpi_gpiochip_free_interrupts() on GPIO chip de-registration
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 494a94e38dcf62543a32a4424d646ff80b4b28bd ]
Add missed acpi_gpiochip_free_interrupts() call when unregistering ports.
While at it, drop extra check to call acpi_gpiochip_request_interrupts(). There is no need to have an additional check to call acpi_gpiochip_request_interrupts(). Even without any interrupts available the registered ACPI Event handlers can be useful for debugging purposes.
--- drivers/gpio/gpio-dwapb.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-)
drivers/gpio/gpio-dwapb.c +16 -9
@@ -533,26 +533,33 @@ static int dwapb_gpio_add_port(struct dwapb_gpio *gpio,dwapb_configure_irqs (gpio, port, pp); err =gpiochip_add_data (&port->gc, port); -if (err) +if (err) {dev_err (gpio->dev,"failed to register gpiochip for port%d\n" , port->idx); -else - port->is_registered = true; +return err; + }/* Add GPIO-signaled ACPI event support */ -if (pp->has_irq) -acpi_gpiochip_request_interrupts (&port->gc); +acpi_gpiochip_request_interrupts (&port->gc); -return err; + port->is_registered = true; + +return 0 ; }static void dwapb_gpio_unregister (struct dwapb_gpio *gpio) {unsigned int m; -for (m =0 ; m < gpio->nr_ports; ++m) -if (gpio->ports[m].is_registered) -gpiochip_remove (&gpio->ports[m].gc); +for (m =0 ; m < gpio->nr_ports; ++m) { +struct dwapb_gpio_port *port = &gpio->ports[m]; + +if (!port->is_registered) +continue ; + +acpi_gpiochip_free_interrupts (&port->gc); +gpiochip_remove (&port->gc); + } } static struct dwapb_platform_data *
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 94/477 NTB: ntb_pingpong: Choose doorbells based on port number
In reply to Greg Kroah-HartmanFrom: Logan Gunthorpe <[email protected]>
[ Upstream commit ca93c45755da98302c93abdd788fc09113baf9e0 ]
This commit fixes pingpong support for existing drivers that do not implement ntb_default_port_number() and ntb_default_peer_port_number(). This is required for hardware (like the crosslink topology of switchtec) which cannot assign reasonable port numbers to each port due to its perfect symmetry.
Instead of picking the doorbell to use based on the the index of the peer, we use the peer's port number. This is a bit clearer and easier to understand.
--- drivers/ntb/test/ntb_pingpong.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-)
drivers/ntb/test/ntb_pingpong.c +6 -8
@@ -121,15 +121,14 @@ static int pp_find_next_peer(struct pp_ctx *pp) link =ntb_link_is_up (pp->ntb,NULL ,NULL );/* Find next available peer */ -if (link & pp->nmask) { +if (link & pp->nmask) pidx =__ffs64 (link & pp->nmask); - out_db =BIT_ULL (pidx +1 ); - }else if (link & pp->pmask) { +else if (link & pp->pmask) pidx =__ffs64 (link & pp->pmask); - out_db =BIT_ULL (pidx); - }else { +else return -ENODEV ; - } + + out_db =BIT_ULL (ntb_peer_port_number (pp->ntb, pidx));spin_lock (&pp->lock); pp->out_pidx = pidx;
@@ -303,7 +302,7 @@ static void pp_init_flds(struct pp_ctx *pp)break ; } - pp->in_db =BIT_ULL (pidx); + pp->in_db =BIT_ULL (lport); pp->pmask =GENMASK_ULL (pidx,0 ) >>1 ; pp->nmask =GENMASK_ULL (pcnt -1 , pidx);
@@ -432,4 +431,3 @@ static void __exit pp_exit(void)debugfs_remove_recursive (pp_dbgfs_topdir); }module_exit (pp_exit); -
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 91/477 yam: fix possible memory leak in yam_init_driver
In reply to Greg Kroah-HartmanFrom: Wang Hai <[email protected]>
[ Upstream commit 98749b7188affbf2900c2aab704a8853901d1139 ]
If register_netdev(dev) fails, free_netdev(dev) needs to be called, otherwise a memory leak will occur.
--- drivers/net/hamradio/yam.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/hamradio/yam.c +1 -0
@@ -1133,6 +1133,7 @@ static int __init yam_init_driver(void) err =register_netdev (dev);if (err) {printk (KERN_WARNING "yam: cannot register net device %s\n" , dev->name); +free_netdev (dev); goto error; } yam_devs[i] = dev;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 82/477 RDMA/core: Fix several reference count leaks.
In reply to Greg Kroah-HartmanFrom: Qiushi Wu <[email protected]>
[ Upstream commit 0b8e125e213204508e1b3c4bdfe69713280b7abd ]
kobject_init_and_add() takes reference even when it fails. If this function returns an error, kobject_put() must be called to properly clean up the memory associated with the object. Previous
commit b8eb718348b8 ("net-sysfs: Fix reference count leak in rx|netdev_queue_add_kobject") fixed a similar problem.
--- drivers/infiniband/core/sysfs.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/infiniband/core/sysfs.c +5 -5
@@ -1058,8 +1058,7 @@ static int add_port(struct ib_core_device *coredev, int port_num) coredev->ports_kobj, "%d", port_num);if (ret) { -kfree (p); -return ret; + goto err_put; } p->gid_attr_group =kzalloc (sizeof (*p->gid_attr_group),GFP_KERNEL );
@@ -1072,8 +1071,7 @@ static int add_port(struct ib_core_device *coredev, int port_num) ret =kobject_init_and_add (&p->gid_attr_group->kobj, &gid_attr_type, &p->kobj,"gid_attrs" );if (ret) { -kfree (p->gid_attr_group); - goto err_put; + goto err_put_gid_attrs; }if (device->ops.process_mad && is_full_dev) {
@@ -1404,8 +1402,10 @@ int ib_port_register_module_stat(struct ib_device *device, u8 port_num, ret =kobject_init_and_add (kobj, ktype, &port->kobj,"%s" , name); -if (ret) +if (ret) { +kobject_put (kobj);return ret; + } }return 0 ;
Signature · 1 line
2.25.1
Greg Kroah-Hartman
maintainerPATCH 85/477 powerpc/crashkernel: Take "mem=" option into account
In reply to Greg Kroah-HartmanFrom: Pingfan Liu <[email protected]>
[ Upstream commit be5470e0c285a68dc3afdea965032f5ddc8269d7 ]
'mem=" option is an easy way to put high pressure on memory during some test. Hence after applying the memory limit, instead of total mem, the actual usable memory should be considered when reserving mem for crashkernel. Otherwise the boot up may experience OOM issue.
E.g. it would reserve 4G prior to the change and 512M afterward, if passing crashkernel="2G-4G:384M,4G-16G:512M,16G-64G:1G,64G-128G:2G,128G-:4G", and mem=5G on a 256G machine.
This issue is powerpc specific because it puts higher priority on fadump and kdump reservation than on "mem=". Referring the following code:
if (fadump_reserve_mem() == 0)
reserve_crashkernel();
...
/* Ensure that total memory size is page-aligned. */
limit = ALIGN(memory_limit ?: memblock_phys_mem_size(), PAGE_SIZE);
memblock_enforce_memory_limit(limit);While on other arches, the effect of "mem=" takes a higher priority and pass through memblock_phys_mem_size() before calling reserve_crashkernel().
--- arch/powerpc/kexec/core.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
arch/powerpc/kexec/core.c +5 -3
@@ -115,11 +115,12 @@ void machine_kexec(struct kimage *image)void __init reserve_crashkernel (void ) { -unsigned long long crash_size, crash_base; +unsigned long long crash_size, crash_base, total_mem_sz;int ret; + total_mem_sz = memory_limit ? memory_limit :memblock_phys_mem_size ();/* use common parsing */ - ret =parse_crashkernel (boot_command_line,memblock_phys_mem_size (), + ret =parse_crashkernel (boot_command_line, total_mem_sz, &crash_size, &crash_base);if (ret ==0 && crash_size >0 ) { crashk_res.start = crash_base;
@@ -178,6 +179,7 @@ void __init reserve_crashkernel(void)/* Crash kernel trumps memory limit */ if (memory_limit && memory_limit <= crashk_res.end) { memory_limit = crashk_res.end +1 ; + total_mem_sz = memory_limit;printk ("Adjusted memory limit for crashkernel, now 0x%llx\n" , memory_limit); }
@@ -186,7 +188,7 @@ void __init reserve_crashkernel(void)"for crashkernel (System RAM: %ldMB)\n" , (unsigned long )(crash_size >>20 ), (unsigned long )(crashk_res.start >>20 ), - (unsigned long)(memblock_phys_mem_size() >> 20)); + (unsigned long)(total_mem_sz >> 20));if (!memblock_is_region_memory (crashk_res.start, crash_size) ||memblock_reserve (crashk_res.start, crash_size)) {
Signature · 1 line
2.25.1