5.16.19-rc1 review
Subsystems (11)
Greg Kroah-Hartman
maintainerPATCH 545/1017 TOMOYO: fix __setup handlers return values
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 39844b7e3084baecef52d1498b5fa81afa2cefa9 ]
__setup() handlers should return 1 if the parameter is handled. Returning 0 causes the entire string to be added to init's environment strings (limited to 32 strings), unnecessarily polluting it.
Using the documented strings "TOMOYO_loader=string1" and "TOMOYO_trigger=string2" causes an Unknown parameter message:
Unknown kernel command line parameters
"BOOT_IMAGE=/boot/bzImage-517rc5 TOMOYO_loader=string1 \
TOMOYO_trigger=string2", will be passed to user space.
and these strings are added to init's environment string space:
Run /sbin/init as init process
with arguments:
/sbin/init
with environment:
HOME=/
TERM=linux
BOOT_IMAGE=/boot/bzImage-517rc5
TOMOYO_loader=string1
TOMOYO_trigger=string2With this change, these __setup handlers act as expected, and init's environment is not polluted with these strings.
--- security/tomoyo/load_policy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
security/tomoyo/load_policy.c +2 -2
@@ -24,7 +24,7 @@ static const char *tomoyo_loader;static int __init tomoyo_loader_setup (char *str) { tomoyo_loader = str; -return 0 ; +return 1 ; }__setup ("TOMOYO_loader=" , tomoyo_loader_setup);
@@ -64,7 +64,7 @@ static const char *tomoyo_trigger;static int __init tomoyo_trigger_setup (char *str) { tomoyo_trigger = str; -return 0 ; +return 1 ; }__setup ("TOMOYO_trigger=" , tomoyo_trigger_setup);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 546/1017 power: supply: sbs-charger: Dont cancel work that is not initialized
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit de85193cff0d94d030a53656d8fcc41794807bef ]
This driver can use an interrupt or polling in order get the charger's status.
When using polling, a delayed work is used.
However, the remove() function unconditionally call cancel_delayed_work_sync(), even if the delayed work is not used and is not initialized.
In order to fix it, use devm_delayed_work_autocancel() and remove the now useless remove() function.
--- drivers/power/supply/sbs-charger.c | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
drivers/power/supply/sbs-charger.c +7 -11
@@ -18,6 +18,7 @@#include <linux/interrupt.h> #include <linux/regmap.h> #include <linux/bitops.h> +#include <linux/devm-helpers.h> #define SBS_CHARGER_REG_SPEC_INFO 0x11#define SBS_CHARGER_REG_STATUS 0x13
@@ -209,7 +210,12 @@ static int sbs_probe(struct i2c_client *client,if (ret)return dev_err_probe (&client->dev, ret,"Failed to request irq\n" ); }else { -INIT_DELAYED_WORK (&chip->work, sbs_delayed_work); + ret =devm_delayed_work_autocancel (&client->dev, &chip->work, + sbs_delayed_work); +if (ret) +return dev_err_probe (&client->dev, ret, +"Failed to init work for polling\n" ); +schedule_delayed_work (&chip->work,msecs_to_jiffies (SBS_CHARGER_POLL_TIME )); }
@@ -220,15 +226,6 @@ static int sbs_probe(struct i2c_client *client,return 0 ; } -static int sbs_remove (struct i2c_client *client) -{ -struct sbs_info *chip =i2c_get_clientdata (client); - -cancel_delayed_work_sync (&chip->work); - -return 0 ; -} -#ifdef CONFIG_OF static const struct of_device_id sbs_dt_ids[] = { { .compatible = "sbs,sbs-charger" },
@@ -245,7 +242,6 @@ MODULE_DEVICE_TABLE(i2c, sbs_id);static struct i2c_driver sbs_driver = { .probe = sbs_probe, - .remove = sbs_remove, .id_table = sbs_id, .driver = { .name ="sbs-charger" ,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 547/1017 mt76: mt7915: fix the muru tlv issue
In reply to Greg Kroah-HartmanFrom: MeiChia Chiu <[email protected]>
[ Upstream commit d98a72725bc96c98f68eac12e5a91ec349322c88 ]
The muru enable/disable are only set after the first station connection. Without this patch, the firmware couldn't enable muru
if the first connected station is non-HE type.
--- drivers/net/wireless/mediatek/mt76/mt7915/mcu.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7915/mcu.c +5 -7
@@ -1515,9 +1515,6 @@ mt7915_mcu_sta_muru_tlv(struct sk_buff *skb, struct ieee80211_sta *sta, vif->type != NL80211_IFTYPE_AP)return ; -if (!sta->vht_cap.vht_supported) -return ; - tlv =mt7915_mcu_add_tlv (skb,STA_REC_MURU ,sizeof (*muru)); muru = (struct sta_rec_muru *)tlv;
@@ -1525,9 +1522,12 @@ mt7915_mcu_sta_muru_tlv(struct sk_buff *skb, struct ieee80211_sta *sta, muru->cfg.mimo_dl_en = mvif->cap.he_mu_ebfer || mvif->cap.vht_mu_ebfer || mvif->cap.vht_mu_ebfee; + muru->cfg.mimo_ul_en = true; + muru->cfg.ofdma_dl_en = true; - muru->mimo_dl.vht_mu_bfee = - !!(sta->vht_cap.cap &IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE ); +if (sta->vht_cap.vht_supported) + muru->mimo_dl.vht_mu_bfee = + !!(sta->vht_cap.cap &IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE );if (!sta->he_cap.has_he)return ;
@@ -1535,13 +1535,11 @@ mt7915_mcu_sta_muru_tlv(struct sk_buff *skb, struct ieee80211_sta *sta, muru->mimo_dl.partial_bw_dl_mimo =HE_PHY (CAP6_PARTIAL_BANDWIDTH_DL_MUMIMO , elem->phy_cap_info[6 ]); - muru->cfg.mimo_ul_en = true; muru->mimo_ul.full_ul_mimo =HE_PHY (CAP2_UL_MU_FULL_MU_MIMO , elem->phy_cap_info[2 ]); muru->mimo_ul.partial_ul_mimo =HE_PHY (CAP2_UL_MU_PARTIAL_MU_MIMO , elem->phy_cap_info[2 ]); - muru->cfg.ofdma_dl_en = true; muru->ofdma_dl.punc_pream_rx =HE_PHY (CAP1_PREAMBLE_PUNC_RX_MASK , elem->phy_cap_info[1 ]); muru->ofdma_dl.he_20m_in_40m_2g =
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 548/1017 ext2: correct max file size computing
In reply to Greg Kroah-HartmanFrom: Zhang Yi <[email protected]>
[ Upstream commit 50b3a818991074177a56c87124c7a7bdf5fa4f67 ]
We need to calculate the max file size accurately if the total blocks that can address by block tree exceed the upper_limit. But this check is not correct now, it only compute the total data blocks but missing metadata blocks are needed. So in the case of "data blocks < upper_limit && total blocks > upper_limit", we will get wrong result. Fortunately, this case could not happen in reality, but it's confused and better to correct the computing.
bits data blocks metadatablocks upper_limit
10 16843020 66051 2147483647
11 134480396 263171 1073741823
12 1074791436 1050627 536870911 (*) 13 8594130956 4198403 268435455 (*) 14 68736258060 16785411 134217727 (*)
15 549822930956 67125251 67108863 (*)
16 4398314962956 268468227 33554431 (*)
[*] Need to calculate in depth.
--- fs/ext2/super.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/ext2/super.c +5 -1
@@ -753,8 +753,12 @@ static loff_t ext2_max_size(int bits) res +=1LL << (bits-2 ); res +=1LL << (2 *(bits-2 )); res +=1LL << (3 *(bits-2 )); +/* Compute how many metadata blocks are needed */ + meta_blocks =1 ; + meta_blocks +=1 + ppb; + meta_blocks +=1 + ppb + ppb * ppb;/* Does block tree limit file size? */ -if (res < upper_limit) +if (res + meta_blocks <= upper_limit) goto check_lfs; res = upper_limit;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 549/1017 drm/tegra: Fix reference leak in tegra_dsi_ganged_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 221e3638feb8bc42143833c9a704fa89b6c366bb ]
The reference taken by 'of_find_device_by_node()' must be released when not needed anymore. Add put_device() call to fix this.
--- drivers/gpu/drm/tegra/dsi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/tegra/dsi.c +3 -1
@@ -1538,8 +1538,10 @@ static int tegra_dsi_ganged_probe(struct tegra_dsi *dsi) dsi->slave =platform_get_drvdata (gangster);of_node_put (np); -if (!dsi->slave) +if (!dsi->slave) { +put_device (&gangster->dev);return -EPROBE_DEFER ; + } dsi->slave->master = dsi; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 550/1017 power: supply: bq24190_charger: Fix bq24190_vbus_is_enabled() wrong false return
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit f7731754fdce33dad19be746f647d6ac47c5d695 ]
The datasheet says that the BQ24190_REG_POC_CHG_CONFIG bits can have a value of either 10(0x2) or 11(0x3) for OTG (5V boost regulator) mode.
Sofar bq24190_vbus_is_enabled() was only checking for 10 but some BIOS-es uses 11 when enabling the regulator at boot.
Make bq24190_vbus_is_enabled() also check for 11 so that it does not wrongly returns false when the bits are set to 11.
--- drivers/power/supply/bq24190_charger.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/power/supply/bq24190_charger.c +6 -1
@@ -39,6 +39,7 @@#define BQ24190_REG_POC_CHG_CONFIG_DISABLE 0x0#define BQ24190_REG_POC_CHG_CONFIG_CHARGE 0x1#define BQ24190_REG_POC_CHG_CONFIG_OTG 0x2 +#define BQ24190_REG_POC_CHG_CONFIG_OTG_ALT 0x3#define BQ24190_REG_POC_SYS_MIN_MASK (BIT(3) | BIT(2) | BIT(1))#define BQ24190_REG_POC_SYS_MIN_SHIFT 1#define BQ24190_REG_POC_SYS_MIN_MIN 3000
@@ -550,7 +551,11 @@ static int bq24190_vbus_is_enabled(struct regulator_dev *dev)pm_runtime_mark_last_busy (bdi->dev);pm_runtime_put_autosuspend (bdi->dev); -return ret ? ret : val ==BQ24190_REG_POC_CHG_CONFIG_OTG ; +if (ret) +return ret; + +return (val ==BQ24190_REG_POC_CHG_CONFIG_OTG || + val ==BQ24190_REG_POC_CHG_CONFIG_OTG_ALT ); }static const struct regulator_ops bq24190_vbus_ops = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 551/1017 scsi: hisi_sas: Change permission of parameter prot_mask
In reply to Greg Kroah-HartmanFrom: Xiang Chen <[email protected]>
[ Upstream commit c4e070457a93705e56ed06b3910d9e5fe56d3be3 ]
Currently the permission of parameter prot_mask is 0x0, which means that the member does not appear in sysfs. Change it as other module parameters to 0444 for world-readable.
[mkp: s/v3/v2/]
--- drivers/scsi/hisi_sas/hisi_sas_v3_hw.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/hisi_sas/hisi_sas_v3_hw.c +1 -1
@@ -530,7 +530,7 @@ MODULE_PARM_DESC(intr_conv, "interrupt converge enable (0-1)");/* permit overriding the host protection capabilities mask (EEDP/T10 PI) */ static int prot_mask; -module_param (prot_mask, int,0 ); +module_param (prot_mask, int,0444 );MODULE_PARM_DESC (prot_mask," host protection capabilities mask, def=0x0 " );static void debugfs_work_handler_v3_hw (struct work_struct *work);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 552/1017 drm/bridge: cdns-dsi: Make sure to to create proper aliases for dt
In reply to Greg Kroah-HartmanFrom: Nishanth Menon <[email protected]>
[ Upstream commit ffb5c099aaa13ab7f73c29ea6ae26bce8d7575ae ]
Add MODULE_DEVICE_TABLE to the device tree table to create required aliases needed for module to be loaded with device tree based platform.
--- drivers/gpu/drm/bridge/cdns-dsi.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/bridge/cdns-dsi.c +1 -0
@@ -1284,6 +1284,7 @@ static const struct of_device_id cdns_dsi_of_match[] = { { .compatible = "cdns,dsi" }, { }, }; +MODULE_DEVICE_TABLE (of, cdns_dsi_of_match);static struct platform_driver cdns_dsi_platform_driver = { .probe = cdns_dsi_drm_probe,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 553/1017 bpf, arm64: Call build_prologue() first in first JIT pass
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
[ Upstream commit 68e4f238b0e9d3670a1612ad900a6e98b2b3f7dd ]
BPF line info needs ctx->offset to be the instruction offset in the whole JITed image instead of the body itself, so also call build_prologue() first in first JIT pass.
--- arch/arm64/net/bpf_jit_comp.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
arch/arm64/net/bpf_jit_comp.c +8 -5
@@ -1049,15 +1049,18 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) goto out_off; } -/* 1. Initial fake pass to compute ctx->idx. */ - -/* Fake pass to fill in ctx->offset. */ -if (build_body (&ctx, extra_pass)) { +/* +* 1. Initial fake pass to compute ctx->idx and ctx->offset. +* +* BPF line info needs ctx->offset[i] to be the offset of +* instruction[i] in jited image, so build prologue first. +*/ +if (build_prologue (&ctx, was_classic)) { prog = orig_prog; goto out_off; } -if (build_prologue (&ctx, was_classic)) { +if (build_body (&ctx, extra_pass)) { prog = orig_prog; goto out_off; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 554/1017 bpf, arm64: Feed byte-offset into bpf line info
In reply to Greg Kroah-HartmanFrom: Hou Tao <[email protected]>
[ Upstream commit dda7596c109fc382876118627e29db7607cde35d ]
insn_to_jit_off passed to bpf_prog_fill_jited_linfo() is calculated in instruction granularity instead of bytes granularity, but BPF line info requires byte offset.
bpf_prog_fill_jited_linfo() will be the last user of ctx.offset before it is freed, so convert the offset into byte-offset before calling into bpf_prog_fill_jited_linfo() in order to fix the line info dump on arm64.
--- arch/arm64/net/bpf_jit_comp.c | 5 +++++ 1 file changed, 5 insertions(+)
arch/arm64/net/bpf_jit_comp.c +5 -0
@@ -1133,6 +1133,11 @@ struct bpf_prog *bpf_int_jit_compile(struct bpf_prog *prog) prog->jited_len = prog_size;if (!prog->is_func || extra_pass) { +int i; + +/* offset[prog->len] is the size of program */ +for (i =0 ; i <= prog->len; i++) + ctx.offset[i] *=AARCH64_INSN_SIZE ;bpf_prog_fill_jited_linfo (prog, ctx.offset +1 ); out_off:kfree (ctx.offset);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 555/1017 xsk: Fix race at socket teardown
In reply to Greg Kroah-HartmanFrom: Magnus Karlsson <[email protected]>
[ Upstream commit 18b1ab7aa76bde181bdb1ab19a87fa9523c32f21 ]
Fix a race in the xsk socket teardown code that can lead to a NULL pointer dereference splat. The current xsk unbind code in xsk_unbind_dev() starts by setting xs->state to XSK_UNBOUND, sets xs->dev to NULL and then waits for any NAPI processing to terminate using synchronize_net(). After that, the release code starts to tear down the socket state and free allocated memory.
BUG: kernel NULL pointer dereference, address: 00000000000000c0 PGD 8000000932469067 P4D 8000000932469067 PUD 0 Oops: 0000 [#1] PREEMPT SMP PTI CPU: 25 PID: 69132 Comm: grpcpp_sync_ser Tainted: G I 5.16.0+ #2 Hardware name: Dell Inc. PowerEdge R730/0599V5, BIOS 1.2.10 03/09/2015 RIP: 0010:__xsk_sendmsg+0x2c/0x690 [...] RSP: 0018:ffffa2348bd13d50 EFLAGS: 00010246 RAX: 0000000000000000 RBX: 0000000000000040 RCX: ffff8d5fc632d258 RDX: 0000000000400000 RSI: ffffa2348bd13e10 RDI: ffff8d5fc5489800 RBP: ffffa2348bd13db0 R08: 0000000000000000 R09: 00007ffffffff000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff8d5fc5489800 R13: ffff8d5fcb0f5140 R14: ffff8d5fcb0f5140 R15: 0000000000000000 FS: 00007f991cff9400(0000) GS:ffff8d6f1f700000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000000000c0 CR3: 0000000114888005 CR4: 00000000001706e0 Call Trace: <TASK> ? aa_sk_perm+0x43/0x1b0 xsk_sendmsg+0xf0/0x110 sock_sendmsg+0x65/0x70 __sys_sendto+0x113/0x190 ? debug_smp_processor_id+0x17/0x20 ? fpregs_assert_state_consistent+0x23/0x50 ? exit_to_user_mode_prepare+0xa5/0x1d0 __x64_sys_sendto+0x29/0x30 do_syscall_64+0x3b/0xc0 entry_SYSCALL_64_after_hwframe+0x44/0xae
There are two problems with the current code. First, setting xs->dev to NULL before waiting for all users to stop using the socket is not correct. The entry to the data plane functions xsk_poll(), xsk_sendmsg(), and xsk_recvmsg() are all guarded by a test that xs->state is in the state XSK_BOUND and if not, it returns right away. But one process might have passed this test but still have not gotten to the point in which it uses xs->dev in the code. In this interim, a second process executing xsk_unbind_dev() might have set xs->dev to NULL which will lead to a crash for the first process. The solution here is just to get rid of this NULL assignment since it is not used anymore. Before commit 42fddcc7c64b ("xsk: use state member for socket synchronization"), xs->dev was the gatekeeper to admit processes into the data plane functions, but it was replaced with the state variable xs->state in the aforementioned commit.
The second problem is that synchronize_net() does not wait for any process in xsk_poll(), xsk_sendmsg(), or xsk_recvmsg() to complete, which means that the state they rely on might be cleaned up prematurely. This can happen when the notifier gets called (at driver unload for example) as it uses xsk_unbind_dev(). Solve this by extending the RCU critical region from just the ndo_xsk_wakeup to the whole functions mentioned above, so that both the test of xs->state == XSK_BOUND and the last use of any member of xs is covered by the RCU critical section. This will guarantee that when synchronize_net() completes, there will be no processes left executing xsk_poll(), xsk_sendmsg(), or xsk_recvmsg() and state can be cleaned up safely. Note that we need to drop the RCU lock for the skb xmit path as it uses functions that might sleep. Due to this, we have to retest the xs->state after we grab the mutex that protects the skb xmit code from, among a number of things, an xsk_unbind_dev() being executed from the notifier at the same time.
--- net/xdp/xsk.c | 69 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 50 insertions(+), 19 deletions(-)
net/xdp/xsk.c +50 -19
@@ -403,18 +403,8 @@ EXPORT_SYMBOL(xsk_tx_peek_release_desc_batch);static int xsk_wakeup (struct xdp_sock *xs,u8 flags) {struct net_device *dev = xs->dev; -int err; - -rcu_read_lock (); - err = dev->netdev_ops->ndo_xsk_wakeup (dev, xs->queue_id, flags); -rcu_read_unlock (); - -return err; -} -static int xsk_zc_xmit (struct xdp_sock *xs) -{ -return xsk_wakeup (xs,XDP_WAKEUP_TX ); +return dev->netdev_ops->ndo_xsk_wakeup (dev, xs->queue_id, flags); }static void xsk_destruct_skb (struct sk_buff *skb)
@@ -533,6 +523,12 @@ static int xsk_generic_xmit(struct sock *sk)mutex_lock (&xs->mutex); +/* Since we dropped the RCU read lock, the socket state might have changed. */ +if (unlikely (!xsk_is_bound (xs))) { + err = -ENXIO ; + goto out; + } +if (xs->queue_id >= xs->dev->real_num_tx_queues) goto out;
@@ -596,16 +592,26 @@ static int xsk_generic_xmit(struct sock *sk)return err; } -static int __xsk_sendmsg (struct sock *sk) +static int xsk_xmit (struct sock *sk) {struct xdp_sock *xs =xdp_sk (sk); +int ret;if (unlikely (!(xs->dev->flags &IFF_UP )))return -ENETDOWN ;if (unlikely (!xs->tx))return -ENOBUFS ; -return xs->zc ?xsk_zc_xmit (xs) :xsk_generic_xmit (sk); +if (xs->zc) +return xsk_wakeup (xs,XDP_WAKEUP_TX ); + +/* Drop the RCU lock since the SKB path might sleep. */ +rcu_read_unlock (); + ret =xsk_generic_xmit (sk); +/* Reaquire RCU lock before going into common code. */ +rcu_read_lock (); + +return ret; }static bool xsk_no_wakeup (struct sock *sk)
@@ -619,7 +625,7 @@ static bool xsk_no_wakeup(struct sock *sk)#endif } -static int xsk_sendmsg (struct socket *sock,struct msghdr *m,size_t total_len) +static int __xsk_sendmsg (struct socket *sock,struct msghdr *m,size_t total_len) {bool need_wait = !(m->msg_flags &MSG_DONTWAIT );struct sock *sk = sock->sk;
@@ -639,11 +645,22 @@ static int xsk_sendmsg(struct socket *sock, struct msghdr *m, size_t total_len) pool = xs->pool;if (pool->cached_need_wakeup &XDP_WAKEUP_TX ) -return __xsk_sendmsg (sk); +return xsk_xmit (sk);return 0 ; } -static int xsk_recvmsg (struct socket *sock,struct msghdr *m,size_t len,int flags) +static int xsk_sendmsg (struct socket *sock,struct msghdr *m,size_t total_len) +{ +int ret; + +rcu_read_lock (); + ret =__xsk_sendmsg (sock, m, total_len); +rcu_read_unlock (); + +return ret; +} + +static int __xsk_recvmsg (struct socket *sock,struct msghdr *m,size_t len,int flags) {bool need_wait = !(flags &MSG_DONTWAIT );struct sock *sk = sock->sk;
@@ -669,6 +686,17 @@ static int xsk_recvmsg(struct socket *sock, struct msghdr *m, size_t len, int flreturn 0 ; } +static int xsk_recvmsg (struct socket *sock,struct msghdr *m,size_t len,int flags) +{ +int ret; + +rcu_read_lock (); + ret =__xsk_recvmsg (sock, m, len, flags); +rcu_read_unlock (); + +return ret; +} +static __poll_t xsk_poll (struct file *file,struct socket *sock,struct poll_table_struct *wait) {
@@ -679,8 +707,11 @@ static __poll_t xsk_poll(struct file *file, struct socket *sock,sock_poll_wait (file, sock, wait); -if (unlikely (!xsk_is_bound (xs))) +rcu_read_lock (); +if (unlikely (!xsk_is_bound (xs))) { +rcu_read_unlock ();return mask; + } pool = xs->pool;
@@ -689,7 +720,7 @@ static __poll_t xsk_poll(struct file *file, struct socket *sock,xsk_wakeup (xs, pool->cached_need_wakeup); else/* Poll needs to drive Tx also in copy mode */ -__xsk_sendmsg (sk ); +xsk_xmit (sk ); }if (xs->rx && !xskq_prod_is_empty (xs->rx))
@@ -697,6 +728,7 @@ static __poll_t xsk_poll(struct file *file, struct socket *sock,if (xs->tx &&xsk_tx_writeable (xs)) mask |=EPOLLOUT |EPOLLWRNORM ; +rcu_read_unlock ();return mask; }
@@ -728,7 +760,6 @@ static void xsk_unbind_dev(struct xdp_sock *xs)/* Wait for driver to stop using the xdp socket. */ xp_del_xsk (xs->pool, xs); - xs->dev =NULL ;synchronize_net ();dev_put (dev); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 556/1017 RDMA/irdma: Fix netdev notifications for vlans
In reply to Greg Kroah-HartmanFrom: Mustafa Ismail <[email protected]>
[ Upstream commit 6702bc14744847842a87fed21a795b6e8bab6965 ]
Currently, events on vlan netdevs are being ignored. Fix this by finding the real netdev and processing the notifications for vlan netdevs.
--- drivers/infiniband/hw/irdma/utils.c | 48 ++++++++++++++++++----------- 1 file changed, 30 insertions(+), 18 deletions(-)
drivers/infiniband/hw/irdma/utils.c +30 -18
@@ -150,31 +150,35 @@ int irdma_inetaddr_event(struct notifier_block *notifier, unsigned long event, void *ptr) {struct in_ifaddr *ifa = ptr; -struct net_device *netdev = ifa->ifa_dev->dev; +struct net_device *real_dev, *netdev = ifa->ifa_dev->dev;struct irdma_device *iwdev;struct ib_device *ibdev;u32 local_ipaddr; - ibdev =ib_device_get_by_netdev (netdev,RDMA_DRIVER_IRDMA ); + real_dev =rdma_vlan_dev_real_dev (netdev); +if (!real_dev) + real_dev = netdev; + + ibdev =ib_device_get_by_netdev (real_dev,RDMA_DRIVER_IRDMA );if (!ibdev)return NOTIFY_DONE ; iwdev =to_iwdev (ibdev); local_ipaddr =ntohl (ifa->ifa_address);ibdev_dbg (&iwdev->ibdev, -"DEV: netdev %p event %lu local_ip=%pI4 MAC=%pM\n" , netdev, - event, &local_ipaddr, netdev->dev_addr); +"DEV: netdev %p event %lu local_ip=%pI4 MAC=%pM\n" , real_dev, + event, &local_ipaddr, real_dev->dev_addr);switch (event) {case NETDEV_DOWN : -irdma_manage_arp_cache (iwdev->rf, netdev->dev_addr, +irdma_manage_arp_cache (iwdev->rf, real_dev->dev_addr, &local_ipaddr, true,IRDMA_ARP_DELETE ); -irdma_if_notify (iwdev, netdev, &local_ipaddr, true, false); +irdma_if_notify (iwdev, real_dev, &local_ipaddr, true, false);irdma_gid_change_event (&iwdev->ibdev);break ;case NETDEV_UP :case NETDEV_CHANGEADDR : -irdma_add_arp (iwdev->rf, &local_ipaddr, true, netdev->dev_addr); -irdma_if_notify (iwdev, netdev, &local_ipaddr, true, true); +irdma_add_arp (iwdev->rf, &local_ipaddr, true, real_dev->dev_addr); +irdma_if_notify (iwdev, real_dev, &local_ipaddr, true, true);irdma_gid_change_event (&iwdev->ibdev);break ;default :
@@ -196,32 +200,36 @@ int irdma_inet6addr_event(struct notifier_block *notifier, unsigned long event, void *ptr) {struct inet6_ifaddr *ifa = ptr; -struct net_device *netdev = ifa->idev->dev; +struct net_device *real_dev, *netdev = ifa->idev->dev;struct irdma_device *iwdev;struct ib_device *ibdev;u32 local_ipaddr6[4 ]; - ibdev =ib_device_get_by_netdev (netdev,RDMA_DRIVER_IRDMA ); + real_dev =rdma_vlan_dev_real_dev (netdev); +if (!real_dev) + real_dev = netdev; + + ibdev =ib_device_get_by_netdev (real_dev,RDMA_DRIVER_IRDMA );if (!ibdev)return NOTIFY_DONE ; iwdev =to_iwdev (ibdev);irdma_copy_ip_ntohl (local_ipaddr6, ifa->addr.in6_u.u6_addr32);ibdev_dbg (&iwdev->ibdev, -"DEV: netdev %p event %lu local_ip=%pI6 MAC=%pM\n" , netdev, - event, local_ipaddr6, netdev->dev_addr); +"DEV: netdev %p event %lu local_ip=%pI6 MAC=%pM\n" , real_dev, + event, local_ipaddr6, real_dev->dev_addr);switch (event) {case NETDEV_DOWN : -irdma_manage_arp_cache (iwdev->rf, netdev->dev_addr, +irdma_manage_arp_cache (iwdev->rf, real_dev->dev_addr, local_ipaddr6, false,IRDMA_ARP_DELETE ); -irdma_if_notify (iwdev, netdev, local_ipaddr6, false, false); +irdma_if_notify (iwdev, real_dev, local_ipaddr6, false, false);irdma_gid_change_event (&iwdev->ibdev);break ;case NETDEV_UP :case NETDEV_CHANGEADDR :irdma_add_arp (iwdev->rf, local_ipaddr6, false, - netdev->dev_addr); -irdma_if_notify (iwdev, netdev, local_ipaddr6, false, true); + real_dev->dev_addr); +irdma_if_notify (iwdev, real_dev, local_ipaddr6, false, true);irdma_gid_change_event (&iwdev->ibdev);break ;default :
@@ -243,14 +251,18 @@ int irdma_net_event(struct notifier_block *notifier, unsigned long event, void *ptr) {struct neighbour *neigh = ptr; +struct net_device *real_dev, *netdev = (struct net_device *)neigh->dev;struct irdma_device *iwdev;struct ib_device *ibdev;__be32 *p;u32 local_ipaddr[4 ] = {};bool ipv4 = true; - ibdev =ib_device_get_by_netdev ((struct net_device *)neigh->dev, -RDMA_DRIVER_IRDMA ); + real_dev =rdma_vlan_dev_real_dev (netdev); +if (!real_dev) + real_dev = netdev; + + ibdev =ib_device_get_by_netdev (real_dev,RDMA_DRIVER_IRDMA );if (!ibdev)return NOTIFY_DONE ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 557/1017 RDMA/irdma: Fix Passthrough mode in VM
In reply to Greg Kroah-HartmanFrom: Mustafa Ismail <[email protected]>
[ Upstream commit b200189626b5cefbaf8be9cadd7a28215e065bb9 ]
Using PCI_FUNC macro in a VM, when the device is in passthrough mode does not provide the real function instance. This means that currently, devices will not probe unless the instance in the VM matches the instance in the host.
Fix this by getting the pf_id from the LAN during the probe.
--- drivers/infiniband/hw/irdma/hw.c | 2 +- drivers/infiniband/hw/irdma/i40iw_if.c | 1 + drivers/infiniband/hw/irdma/main.c | 1 + drivers/infiniband/hw/irdma/main.h | 1 + 4 files changed, 4 insertions(+), 1 deletion(-)
drivers/infiniband/hw/irdma/hw.c +1 -1
@@ -1608,7 +1608,7 @@ static enum irdma_status_code irdma_initialize_dev(struct irdma_pci_f *rf) info.fpm_commit_buf = mem.va; info.bar0 = rf->hw.hw_addr; - info.hmc_fn_id =PCI_FUNC (rf->pcidev->devfn); + info.hmc_fn_id = rf->pf_id; info.hw = &rf->hw; status =irdma_sc_dev_init (rf->rdma_ver, &rf->sc_dev, &info);if (status)
drivers/infiniband/hw/irdma/i40iw_if.c +1 -0
@@ -77,6 +77,7 @@ static void i40iw_fill_device_info(struct irdma_device *iwdev, struct i40e_info rf->rdma_ver =IRDMA_GEN_1 ; rf->gen_ops.request_reset = i40iw_request_reset; rf->pcidev = cdev_info->pcidev; + rf->pf_id = cdev_info->fid; rf->hw.hw_addr = cdev_info->hw_addr; rf->cdev = cdev_info; rf->msix_count = cdev_info->msix_count;
drivers/infiniband/hw/irdma/main.c +1 -0
@@ -226,6 +226,7 @@ static void irdma_fill_device_info(struct irdma_device *iwdev, struct ice_pf *pf rf->hw.hw_addr = pf->hw.hw_addr; rf->pcidev = pf->pdev; rf->msix_count = pf->num_rdma_msix; + rf->pf_id = pf->hw.pf_id; rf->msix_entries = &pf->msix_entries[pf->rdma_base_vector]; rf->default_vsi.vsi_idx = vsi->vsi_num; rf->protocol_used =IRDMA_ROCE_PROTOCOL_ONLY ;
drivers/infiniband/hw/irdma/main.h +1 -0
@@ -257,6 +257,7 @@ struct irdma_pci_f {u8 *mem_rsrc;u8 rdma_ver;u8 rst_to; +u8 pf_id;enum irdma_protocol_used protocol_used;u32 sd_type;u32 msix_count;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 558/1017 RDMA/irdma: Remove incorrect masking of PD
In reply to Greg Kroah-HartmanFrom: Mustafa Ismail <[email protected]>
[ Upstream commit 17850f2b0b4b806e47cc44df94186bfc2cdd490b ]
The PD id is masked with 0x7fff, while PD can be 18 bits for GEN2 HW. Remove the masking as it should not be needed and can cause incorrect PD id to be used.
--- drivers/infiniband/hw/irdma/verbs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/irdma/verbs.c +2 -2
@@ -2504,7 +2504,7 @@ static int irdma_dealloc_mw(struct ib_mw *ibmw) cqp_info = &cqp_request->info; info = &cqp_info->in.u.dealloc_stag.info;memset (info,0 ,sizeof (*info)); - info->pd_id = iwpd->sc_pd.pd_id &0x00007fff ; + info->pd_id = iwpd->sc_pd.pd_id; info->stag_idx = ibmw->rkey >>IRDMA_CQPSQ_STAG_IDX_S ; info->mr = false; cqp_info->cqp_cmd =IRDMA_OP_DEALLOC_STAG ;
@@ -3016,7 +3016,7 @@ static int irdma_dereg_mr(struct ib_mr *ib_mr, struct ib_udata *udata) cqp_info = &cqp_request->info; info = &cqp_info->in.u.dealloc_stag.info;memset (info,0 ,sizeof (*info)); - info->pd_id = iwpd->sc_pd.pd_id &0x00007fff ; + info->pd_id = iwpd->sc_pd.pd_id; info->stag_idx = ib_mr->rkey >>IRDMA_CQPSQ_STAG_IDX_S ; info->mr = true;if (iwpbl->pbl_allocated)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 559/1017 gpu: host1x: Fix a memory leak in host1x_remove()
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 025c6643a81564f066d8381b9e2f4603e0f8438f ]
Add a missing 'host1x_channel_list_free()' call in the remove function, as already done in the error handling path of the probe function.
--- drivers/gpu/host1x/dev.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/host1x/dev.c +1 -0
@@ -526,6 +526,7 @@ static int host1x_remove(struct platform_device *pdev)host1x_syncpt_deinit (host);reset_control_assert (host->rst);clk_disable_unprepare (host->clk); +host1x_channel_list_free (&host->channel_list);host1x_iommu_exit (host);return 0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 560/1017 libbpf: Skip forward declaration when counting duplicated type names
In reply to Greg Kroah-HartmanFrom: Xu Kuohai <[email protected]>
[ Upstream commit 4226961b0019b2e1612029e8950a9e911affc995 ]
Currently if a declaration appears in the BTF before the definition, the definition is dumped as a conflicting name, e.g.:
$ bpftool btf dump file vmlinux format raw | grep "'unix_sock'"
[81287] FWD 'unix_sock' fwd_kind=struct
[89336] STRUCT 'unix_sock' size=1024 vlen=14 $ bpftool btf dump file vmlinux format c | grep "struct unix_sock"
struct unix_sock;
struct unix_sock___2 { <--- conflict, the "___2" is unexpected
struct unix_sock___2 *unix_sk;This causes a compilation error if the dump output is used as a header file.
Fix it by skipping declaration when counting duplicated type names.
--- tools/lib/bpf/btf_dump.c | 5 +++++ 1 file changed, 5 insertions(+)
tools/lib/bpf/btf_dump.c +5 -0
@@ -1483,6 +1483,11 @@ static const char *btf_dump_resolve_name(struct btf_dump *d, __u32 id,if (s->name_resolved)return *cached_name ? *cached_name : orig_name; +if (btf_is_fwd (t) || (btf_is_enum (t) &&btf_vlen (t) ==0 )) { + s->name_resolved =1 ; +return orig_name; + } + dup_cnt =btf_dump_name_dups (d, name_map, orig_name);if (dup_cnt >1 ) {const size_t max_len =256 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 561/1017 powerpc/mm/numa: skip NUMA_NO_NODE onlining in parse_numa_properties()
In reply to Greg Kroah-HartmanFrom: Daniel Henrique Barboza <[email protected]>
[ Upstream commit 749ed4a20657bcea66a6e082ca3dc0d228cbec80 ]
Executing node_set_online() when nid = NUMA_NO_NODE results in an undefined behavior. node_set_online() will call node_set_state(), into __node_set(), into set_bit(), and since NUMA_NO_NODE is -1 we'll end up doing a negative shift operation inside arch/powerpc/include/asm/bitops.h. This potential UB was detected running a kernel with CONFIG_UBSAN.
The behavior was introduced by commit 10f78fd0dabb ("powerpc/numa: Fix a regression on memoryless node 0"), where the check for nid > 0 was removed to fix a problem that was happening with nid = 0, but the result is that now we're trying to online NUMA_NO_NODE nids as well.
Checking for nid >= 0 will allow node 0 to be onlined while avoiding this UB with NUMA_NO_NODE.
--- arch/powerpc/mm/numa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
arch/powerpc/mm/numa.c +3 -1
@@ -956,7 +956,9 @@ static int __init parse_numa_properties(void)of_node_put (cpu); } -node_set_online (nid); +/* node_set_online() is an UB if 'nid' is negative */ +if (likely (nid >=0 )) +node_set_online (nid); }get_n_mem_cells (&n_mem_addr_cells, &n_mem_size_cells);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 562/1017 powerpc/Makefile: Dont pass -mcpu=powerpc64 when building 32-bit
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit 2863dd2db23e0407f6c50b8ba5c0e55abef894f1 ]
When CONFIG_GENERIC_CPU=y (true for all our defconfigs) we pass -mcpu=powerpc64 to the compiler, even when we're building a 32-bit kernel.
This happens because we have an ifdef CONFIG_PPC_BOOK3S_64/else block in the Makefile that was written before 32-bit supported GENERIC_CPU. Prior to that the else block only applied to 64-bit Book3E.
The GCC man page says -mcpu=powerpc64 "[specifies] a pure ... 64-bit big endian PowerPC ... architecture machine [type], with an appropriate, generic processor model assumed for scheduling purposes."
It's unclear how that interacts with -m32, which we are also passing, although obviously -m32 is taking precedence in some sense, as the 32-bit kernel only contains 32-bit instructions.
This was noticed by inspection, not via any bug reports, but it does affect code generation. Comparing before/after code generation, there are some changes to instruction scheduling, and the after case (with -mcpu=powerpc64 removed) the compiler seems more keen to use r8.
Fix it by making the else case only apply to Book3E 64, which excludes 32-bit.
--- arch/powerpc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/Makefile +1 -1
@@ -171,7 +171,7 @@ else CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mtune=power7,$(call cc-option,-mtune=power5)) CFLAGS-$(CONFIG_GENERIC_CPU) += $(call cc-option,-mcpu=power5,-mcpu=power4) endif -else +else ifdef CONFIG_PPC_BOOK3E_64 CFLAGS-$(CONFIG_GENERIC_CPU) += -mcpu=powerpc64 endif
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 563/1017 KVM: x86: Fix emulation in writing cr8
In reply to Greg Kroah-HartmanFrom: Zhenzhong Duan <[email protected]>
[ Upstream commit f66af9f222f08d5b11ea41c1bd6c07a0f12daa07 ]
In emulation of writing to cr8, one of the lowest four bits in TPR[3:0] is kept.
According to Intel SDM 10.8.6.1(baremetal scenario):
"APIC.TPR[bits 7:4] = CR8[bits 3:0], APIC.TPR[bits 3:0] = 0";
and SDM 28.3(use TPR shadow):
"MOV to CR8. The instruction stores bits 3:0 of its source operand into bits 7:4 of VTPR; the remainder of VTPR (bits 3:0 and bits 31:8) are cleared.";
and AMD's APM 16.6.4:
"Task Priority Sub-class (TPS)-Bits 3 : 0. The TPS field indicates the current sub-priority to be used when arbitrating lowest-priority messages. This field is written with zero when TPR is written using the architectural CR8 register.";
so in KVM emulated scenario, clear TPR[3:0] to make a consistent behavior as in other scenarios.
This doesn't impact evaluation and delivery of pending virtual interrupts because processor does not use the processor-priority sub-class to determine which interrupts to delivery and which to inhibit.
Sub-class is used by hardware to arbitrate lowest priority interrupts, but KVM just does a round-robin style delivery.
Message-Id: <[email protected]>
--- arch/x86/kvm/lapic.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
arch/x86/kvm/lapic.c +1 -4
@@ -2242,10 +2242,7 @@ void kvm_set_lapic_tscdeadline_msr(struct kvm_vcpu *vcpu, u64 data)void kvm_lapic_set_tpr (struct kvm_vcpu *vcpu,unsigned long cr8) { -struct kvm_lapic *apic = vcpu->arch.apic; - -apic_set_tpr (apic, ((cr8 &0x0f ) <<4 ) - | (kvm_lapic_get_reg (apic,APIC_TASKPRI ) &4 )); +apic_set_tpr (vcpu->arch.apic, (cr8 &0x0f ) <<4 ); }u64 kvm_lapic_get_cr8 (struct kvm_vcpu *vcpu)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 564/1017 KVM: x86/emulator: Defer not-present segment check in __load_segment_descriptor()
In reply to Greg Kroah-HartmanFrom: Hou Wenlong <[email protected]>
[ Upstream commit ca85f002258fdac3762c57d12d5e6e401b6a41af ]
Per Intel's SDM on the "Instruction Set Reference", when loading segment descriptor, not-present segment check should be after all type and privilege checks. But the emulator checks it first, then #NP is triggered instead of #GP if privilege fails and segment is not present. Put not-present segment check after type and privilege checks in __load_segment_descriptor().
Message-Id: <52573c01d369f506cadcf7233812427cf7db81a7.1644292363.git.houwenlong.hwl@antgroup.com>
--- arch/x86/kvm/emulate.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-)
arch/x86/kvm/emulate.c +9 -5
@@ -1614,11 +1614,6 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt, goto exception; } -if (!seg_desc.p) { - err_vec = (seg ==VCPU_SREG_SS ) ?SS_VECTOR :NP_VECTOR ; - goto exception; - } - dpl = seg_desc.dpl;switch (seg) {
@@ -1658,6 +1653,10 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,case VCPU_SREG_TR :if (seg_desc.s || (seg_desc.type !=1 && seg_desc.type !=9 )) goto exception; +if (!seg_desc.p) { + err_vec =NP_VECTOR ; + goto exception; + } old_desc = seg_desc; seg_desc.type |=2 ;/* busy */ ret = ctxt->ops->cmpxchg_emulated(ctxt, desc_addr, &old_desc, &seg_desc,
@@ -1682,6 +1681,11 @@ static int __load_segment_descriptor(struct x86_emulate_ctxt *ctxt,break ; } +if (!seg_desc.p) { + err_vec = (seg ==VCPU_SREG_SS ) ?SS_VECTOR :NP_VECTOR ; + goto exception; + } +if (seg_desc.s) {/* mark segment as accessed */ if (!(seg_desc.type &1 )) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 565/1017 KVM: SVM: Exit to userspace on ENOMEM/EFAULT GHCB errors
In reply to Greg Kroah-HartmanFrom: Sean Christopherson <[email protected]>
[ Upstream commit aa9f58415a8e45598bf44befa90b9d5babe09601 ]
Exit to userspace if setup_vmgexit_scratch() fails due to OOM or because copying data from guest (userspace) memory failed/faulted. The OOM scenario is clearcut, it's userspace's decision as to whether it should terminate the guest, free memory, etc...
As for -EFAULT, arguably, any guest issue is a violation of the guest's contract with userspace, and thus userspace needs to decide how to proceed. E.g. userspace defines what is RAM vs. MMIO and communicates that directly to the guest, KVM is not involved in deciding what is/isn't RAM nor in communicating that information to the guest. If the scratch GPA doesn't resolve to a memslot, then the guest is not honoring the memory configuration as defined by userspace.
And if userspace unmaps an hva for whatever reason, then exiting to userspace with -EFAULT is absolutely the right thing to do. KVM's ABI currently sucks and doesn't provide enough information to act on the -EFAULT, but that will hopefully be remedied in the future as there are multiple use cases, e.g. uffd and virtiofs truncation, that shouldn't require any work in KVM beyond returning -EFAULT with a small amount of metadata.
KVM could define its ABI such that failure to access the scratch area is reflected into the guest, i.e. establish a contract with userspace, but that's undesirable as it limits KVM's options in the future, e.g. in the potential uffd case any failure on a uaccess needs to kick out to userspace. KVM does have several cases where it reflects these errors into the guest, e.g. kvm_pv_clock_pairing() and Hyper-V emulation, but KVM would preferably "fix" those instead of propagating the falsehood that any memory failure is the guest's fault.
Lastly, returning a boolean as an "error" for that a helper that isn't named accordingly never works out well.
Message-Id: <[email protected]>
--- arch/x86/kvm/svm/sev.c | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-)
arch/x86/kvm/svm/sev.c +21 -15
@@ -2352,7 +2352,7 @@ static void sev_es_sync_from_ghcb(struct vcpu_svm *svm)memset (ghcb->save.valid_bitmap,0 ,sizeof (ghcb->save.valid_bitmap)); } -static bool sev_es_validate_vmgexit (struct vcpu_svm *svm) +static int sev_es_validate_vmgexit (struct vcpu_svm *svm) {struct kvm_vcpu *vcpu;struct ghcb *ghcb;
@@ -2457,7 +2457,7 @@ static bool sev_es_validate_vmgexit(struct vcpu_svm *svm) goto vmgexit_err; } -return true; +return 0 ; vmgexit_err: vcpu = &svm->vcpu;
@@ -2480,7 +2480,8 @@ static bool sev_es_validate_vmgexit(struct vcpu_svm *svm)ghcb_set_sw_exit_info_1 (ghcb,2 );ghcb_set_sw_exit_info_2 (ghcb, reason); -return false; +/* Resume the guest to "return" the error code. */ +return 1 ; }void sev_es_unmap_ghcb (struct vcpu_svm *svm)
@@ -2539,7 +2540,7 @@ void pre_sev_run(struct vcpu_svm *svm, int cpu) }#define GHCB_SCRATCH_AREA_LIMIT (16ULL * PAGE_SIZE) -static bool setup_vmgexit_scratch (struct vcpu_svm *svm,bool sync,u64 len) +static int setup_vmgexit_scratch (struct vcpu_svm *svm,bool sync,u64 len) {struct vmcb_control_area *control = &svm->vmcb->control;struct ghcb *ghcb = svm->sev_es.ghcb;
@@ -2592,14 +2593,14 @@ static bool setup_vmgexit_scratch(struct vcpu_svm *svm, bool sync, u64 len) } scratch_va =kvzalloc (len,GFP_KERNEL_ACCOUNT );if (!scratch_va) - goto e_scratch; +return -ENOMEM ;if (kvm_read_guest (svm->vcpu.kvm, scratch_gpa_beg, scratch_va, len)) {/* Unable to copy scratch area from guest */ pr_err ("vmgexit: kvm_read_guest for scratch area failed\n" );kvfree (scratch_va); - goto e_scratch; +return -EFAULT ; }/*
@@ -2615,13 +2616,13 @@ static bool setup_vmgexit_scratch(struct vcpu_svm *svm, bool sync, u64 len) svm->sev_es.ghcb_sa = scratch_va; svm->sev_es.ghcb_sa_len = len; -return true; +return 0 ; e_scratch:ghcb_set_sw_exit_info_1 (ghcb,2 );ghcb_set_sw_exit_info_2 (ghcb,GHCB_ERR_INVALID_SCRATCH_AREA ); -return false; +return 1 ; } static void set_ghcb_msr_bits(struct vcpu_svm *svm, u64 value, u64 mask,
@@ -2759,17 +2760,18 @@ int sev_handle_vmgexit(struct kvm_vcpu *vcpu) exit_code =ghcb_get_sw_exit_code (ghcb); -if (!sev_es_validate_vmgexit (svm)) -return 1 ; + ret =sev_es_validate_vmgexit (svm); +if (ret) +return ret;sev_es_sync_from_ghcb (svm);ghcb_set_sw_exit_info_1 (ghcb,0 );ghcb_set_sw_exit_info_2 (ghcb,0 ); - ret =1 ;switch (exit_code) {case SVM_VMGEXIT_MMIO_READ : -if (!setup_vmgexit_scratch (svm, true, control->exit_info_2)) + ret =setup_vmgexit_scratch (svm, true, control->exit_info_2); +if (ret)break ; ret = kvm_sev_es_mmio_read(vcpu,
@@ -2778,7 +2780,8 @@ int sev_handle_vmgexit(struct kvm_vcpu *vcpu) svm->sev_es.ghcb_sa);break ;case SVM_VMGEXIT_MMIO_WRITE : -if (!setup_vmgexit_scratch (svm, false, control->exit_info_2)) + ret =setup_vmgexit_scratch (svm, false, control->exit_info_2); +if (ret)break ; ret = kvm_sev_es_mmio_write(vcpu,
@@ -2811,6 +2814,7 @@ int sev_handle_vmgexit(struct kvm_vcpu *vcpu)ghcb_set_sw_exit_info_2 (ghcb,GHCB_ERR_INVALID_INPUT ); } + ret =1 ;break ; }case SVM_VMGEXIT_UNSUPPORTED_EVENT :
@@ -2830,6 +2834,7 @@ int sev_es_string_io(struct vcpu_svm *svm, int size, unsigned int port, int in) {int count;int bytes; +int r;if (svm->vmcb->control.exit_info_2 >INT_MAX )return -EINVAL ;
@@ -2838,8 +2843,9 @@ int sev_es_string_io(struct vcpu_svm *svm, int size, unsigned int port, int in)if (unlikely (check_mul_overflow (count, size, &bytes)))return -EINVAL ; -if (!setup_vmgexit_scratch (svm, in, bytes)) -return 1 ; + r =setup_vmgexit_scratch (svm, in, bytes); +if (r) +return r;return kvm_sev_es_string_io (&svm->vcpu, size, port, svm->sev_es.ghcb_sa, count, in);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 566/1017 hv_balloon: rate-limit "Unhandled message" warning
In reply to Greg Kroah-HartmanFrom: Anssi Hannula <[email protected]>
[ Upstream commit 1d7286729aa616772be334eb908e11f527e1e291 ]
For a couple of times I have encountered a situation where
hv_balloon: Unhandled message: type: 12447
is being flooded over 1 million times per second with various values, filling the log and consuming cycles, making debugging difficult.
Add rate limiting to the message.
Most other Hyper-V drivers already have similar rate limiting in their message callbacks.
The cause of the floods in my case was probably fixed by 96d9d1fa5cd5 ("Drivers: hv: balloon: account for vmbus packet header in max_pkt_size").
--- drivers/hv/hv_balloon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hv/hv_balloon.c +1 -1
@@ -1563,7 +1563,7 @@ static void balloon_onchannelcallback(void *context)break ;default : -pr_warn ("Unhandled message: type: %d\n" , dm_hdr->type); +pr_warn_ratelimited ("Unhandled message: type: %d\n" , dm_hdr->type); } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 567/1017 KVM: arm64: Enable Cortex-A510 erratum 2077057 by default
In reply to Greg Kroah-HartmanFrom: Mark Brown <[email protected]>
[ Upstream commit 4c11113c1a3d10f5b617e5d2b9acd8d1d715450f ]
The recently added configuration option for Cortex A510 erratum 2077057 does not have a "default y" unlike other errata fixes. This appears to simply be an oversight since the help text suggests enabling the option if unsure and there's nothing in the commit log to suggest it is intentional.
--- arch/arm64/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/Kconfig +1 -0
@@ -683,6 +683,7 @@ config ARM64_ERRATUM_2051678 config ARM64_ERRATUM_2077057 bool "Cortex-A510: 2077057: workaround software-step corrupting SPSR_EL2" + default y help This option adds the workaround for ARM Cortex-A510 erratum 2077057. Affected Cortex-A510 may corrupt SPSR_EL2 when the a step exception is
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 568/1017 i2c: xiic: Make bus names unique
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 1d366c2f9df8279df2adbb60471f86fc40a1c39e ]
This driver is for an FPGA logic core, so there can be arbitrarily many instances of the bus on a given system. Previously all of the I2C bus names were "xiic-i2c" which caused issues with lm_sensors when trying to map human-readable names to sensor inputs because it could not properly distinguish the busses, for example. Append the platform device name to the I2C bus name so it is unique between different instances.
--- drivers/i2c/busses/i2c-xiic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-xiic.c +2 -1
@@ -734,7 +734,6 @@ static const struct i2c_adapter_quirks xiic_quirks = {static const struct i2c_adapter xiic_adapter = { .owner =THIS_MODULE , - .name =DRIVER_NAME , .class =I2C_CLASS_DEPRECATED , .algo = &xiic_algorithm, .quirks = &xiic_quirks,
@@ -771,6 +770,8 @@ static int xiic_i2c_probe(struct platform_device *pdev)i2c_set_adapdata (&i2c->adap, i2c); i2c->adap.dev.parent = &pdev->dev; i2c->adap.dev.of_node = pdev->dev.of_node; +snprintf (i2c->adap.name,sizeof (i2c->adap.name), +DRIVER_NAME " %s" , pdev->name);mutex_init (&i2c->lock);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 569/1017 net: phy: micrel: Fix concurrent register access
In reply to Greg Kroah-HartmanFrom: Divya Koppera <[email protected]>
[ Upstream commit 4488f6b6148045424459ef1d5b153c6895ee1dbb ]
Make Extended page register accessing atomic,
to overcome unexpected output from register
reads/writes.
--- drivers/net/phy/micrel.c | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-)
drivers/net/phy/micrel.c +17 -15
@@ -1575,11 +1575,13 @@ static int lanphy_read_page_reg(struct phy_device *phydev, int page, u32 addr) {u32 data; -phy_write (phydev,LAN_EXT_PAGE_ACCESS_CONTROL , page); -phy_write (phydev,LAN_EXT_PAGE_ACCESS_ADDRESS_DATA , addr); -phy_write (phydev,LAN_EXT_PAGE_ACCESS_CONTROL , - (page |LAN_EXT_PAGE_ACCESS_CTRL_EP_FUNC )); - data =phy_read (phydev,LAN_EXT_PAGE_ACCESS_ADDRESS_DATA ); +phy_lock_mdio_bus (phydev); +__phy_write (phydev,LAN_EXT_PAGE_ACCESS_CONTROL , page); +__phy_write (phydev,LAN_EXT_PAGE_ACCESS_ADDRESS_DATA , addr); +__phy_write (phydev,LAN_EXT_PAGE_ACCESS_CONTROL , + (page |LAN_EXT_PAGE_ACCESS_CTRL_EP_FUNC )); + data =__phy_read (phydev,LAN_EXT_PAGE_ACCESS_ADDRESS_DATA ); +phy_unlock_mdio_bus (phydev);return data; }
@@ -1587,18 +1589,18 @@ static int lanphy_read_page_reg(struct phy_device *phydev, int page, u32 addr)static int lanphy_write_page_reg (struct phy_device *phydev,int page,u16 addr,u16 val) { -phy_write (phydev,LAN_EXT_PAGE_ACCESS_CONTROL , page); -phy_write (phydev,LAN_EXT_PAGE_ACCESS_ADDRESS_DATA , addr); -phy_write (phydev,LAN_EXT_PAGE_ACCESS_CONTROL , - (page |LAN_EXT_PAGE_ACCESS_CTRL_EP_FUNC )); - - val =phy_write (phydev,LAN_EXT_PAGE_ACCESS_ADDRESS_DATA , val); -if (val) { +phy_lock_mdio_bus (phydev); +__phy_write (phydev,LAN_EXT_PAGE_ACCESS_CONTROL , page); +__phy_write (phydev,LAN_EXT_PAGE_ACCESS_ADDRESS_DATA , addr); +__phy_write (phydev,LAN_EXT_PAGE_ACCESS_CONTROL , + page |LAN_EXT_PAGE_ACCESS_CTRL_EP_FUNC ); + + val =__phy_write (phydev,LAN_EXT_PAGE_ACCESS_ADDRESS_DATA , val); +if (val !=0 )phydev_err (phydev,"Error: phy_write has returned error %d\n" , val); -return val; - } -return 0 ; +phy_unlock_mdio_bus (phydev); +return val; }static int lan8804_config_init (struct phy_device *phydev)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 570/1017 power: supply: wm8350-power: Handle error for wm8350_register_irq
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit b0b14b5ba11bec56fad344a4a0b2e16449cc8b94 ]
As the potential failure of the wm8350_register_irq(), it should be better to check it and return error if fails. Also, use 'free_' in order to avoid same code.
--- drivers/power/supply/wm8350_power.c | 96 ++++++++++++++++++++++++----- 1 file changed, 82 insertions(+), 14 deletions(-)
drivers/power/supply/wm8350_power.c +82 -14
@@ -408,44 +408,112 @@ static const struct power_supply_desc wm8350_usb_desc = {* Initialisation *********************************************************************/ -static void wm8350_init_charger (struct wm8350 *wm8350) +static int wm8350_init_charger (struct wm8350 *wm8350) { +int ret; +/* register our interest in charger events */ -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_HOT , + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_HOT , wm8350_charger_handler,0 ,"Battery hot" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_COLD , +if (ret) + goto err; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_COLD , wm8350_charger_handler,0 ,"Battery cold" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_FAIL , +if (ret) + goto free_chg_bat_hot; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_BAT_FAIL , wm8350_charger_handler,0 ,"Battery fail" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_TO , +if (ret) + goto free_chg_bat_cold; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_TO , wm8350_charger_handler,0 ,"Charger timeout" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_END , +if (ret) + goto free_chg_bat_fail; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_END , wm8350_charger_handler,0 ,"Charge end" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_START , +if (ret) + goto free_chg_to; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_START , wm8350_charger_handler,0 ,"Charge start" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_FAST_RDY , +if (ret) + goto free_chg_end; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_FAST_RDY , wm8350_charger_handler,0 ,"Fast charge ready" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P9 , +if (ret) + goto free_chg_start; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P9 , wm8350_charger_handler,0 ,"Battery <3.9V" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P1 , +if (ret) + goto free_chg_fast_rdy; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P1 , wm8350_charger_handler,0 ,"Battery <3.1V" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_2P85 , +if (ret) + goto free_chg_vbatt_lt_3p9; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_2P85 , wm8350_charger_handler,0 ,"Battery <2.85V" , wm8350); +if (ret) + goto free_chg_vbatt_lt_3p1;/* and supply change events */ -wm8350_register_irq (wm8350,WM8350_IRQ_EXT_USB_FB , + ret =wm8350_register_irq (wm8350,WM8350_IRQ_EXT_USB_FB , wm8350_charger_handler,0 ,"USB" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_EXT_WALL_FB , +if (ret) + goto free_chg_vbatt_lt_2p85; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_EXT_WALL_FB , wm8350_charger_handler,0 ,"Wall" , wm8350); -wm8350_register_irq (wm8350,WM8350_IRQ_EXT_BAT_FB , +if (ret) + goto free_ext_usb_fb; + + ret =wm8350_register_irq (wm8350,WM8350_IRQ_EXT_BAT_FB , wm8350_charger_handler,0 ,"Battery" , wm8350); +if (ret) + goto free_ext_wall_fb; + +return 0 ; + +free_ext_wall_fb: +wm8350_free_irq (wm8350,WM8350_IRQ_EXT_WALL_FB , wm8350); +free_ext_usb_fb: +wm8350_free_irq (wm8350,WM8350_IRQ_EXT_USB_FB , wm8350); +free_chg_vbatt_lt_2p85: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_2P85 , wm8350); +free_chg_vbatt_lt_3p1: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P1 , wm8350); +free_chg_vbatt_lt_3p9: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P9 , wm8350); +free_chg_fast_rdy: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_FAST_RDY , wm8350); +free_chg_start: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_START , wm8350); +free_chg_end: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_END , wm8350); +free_chg_to: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_TO , wm8350); +free_chg_bat_fail: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_BAT_FAIL , wm8350); +free_chg_bat_cold: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_BAT_COLD , wm8350); +free_chg_bat_hot: +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_BAT_HOT , wm8350); +err: +return ret; }static void free_charger_irq (struct wm8350 *wm8350)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 571/1017 power: supply: wm8350-power: Add missing free in free_charger_irq
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 6dee930f6f6776d1e5a7edf542c6863b47d9f078 ]
In free_charger_irq(), there is no free for 'WM8350_IRQ_CHG_FAST_RDY'. Therefore, it should be better to add it in order to avoid the memory leak.
--- drivers/power/supply/wm8350_power.c | 1 + 1 file changed, 1 insertion(+)
drivers/power/supply/wm8350_power.c +1 -0
@@ -524,6 +524,7 @@ static void free_charger_irq(struct wm8350 *wm8350)wm8350_free_irq (wm8350,WM8350_IRQ_CHG_TO , wm8350);wm8350_free_irq (wm8350,WM8350_IRQ_CHG_END , wm8350);wm8350_free_irq (wm8350,WM8350_IRQ_CHG_START , wm8350); +wm8350_free_irq (wm8350,WM8350_IRQ_CHG_FAST_RDY , wm8350);wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P9 , wm8350);wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_3P1 , wm8350);wm8350_free_irq (wm8350,WM8350_IRQ_CHG_VBATT_LT_2P85 , wm8350);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 572/1017 IB/hfi1: Allow larger MTU without AIP
In reply to Greg Kroah-HartmanFrom: Mike Marciniszyn <[email protected]>
[ Upstream commit b135e324d7a2e7fa0a7ef925076136e799b79f44 ]
The AIP code signals the phys_mtu in the following query_port() fragment:
props->phys_mtu = HFI1_CAP_IS_KSET(AIP) ? hfi1_max_mtu : ib_mtu_enum_to_int(props->max_mtu);
Using the largest MTU possible should not depend on AIP.
Fix by unconditionally using the hfi1_max_mtu value.
--- drivers/infiniband/hw/hfi1/verbs.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/infiniband/hw/hfi1/verbs.c +1 -2
@@ -1397,8 +1397,7 @@ static int query_port(struct rvt_dev_info *rdi, u32 port_num, 4096 : hfi1_max_mtu), IB_MTU_4096); props->active_mtu = !valid_ib_mtu (ppd->ibmtu) ? props->max_mtu :mtu_to_enum (ppd->ibmtu,IB_MTU_4096 ); - props->phys_mtu =HFI1_CAP_IS_KSET (AIP ) ? hfi1_max_mtu : -ib_mtu_enum_to_int (props->max_mtu); + props->phys_mtu = hfi1_max_mtu;return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 573/1017 RDMA/core: Fix ib_qp_usecnt_dec() called when error
In reply to Greg Kroah-HartmanFrom: Yajun Deng <[email protected]>
[ Upstream commit 7c4a539ec38f4ce400a0f3fcb5ff6c940fcd67bb ]
ib_destroy_qp() would called by ib_create_qp_user() if error, the former contains ib_qp_usecnt_dec(), but ib_qp_usecnt_inc() was not called before.
So move ib_qp_usecnt_inc() into create_qp().
--- drivers/infiniband/core/uverbs_cmd.c | 1 - drivers/infiniband/core/uverbs_std_types_qp.c | 1 - drivers/infiniband/core/verbs.c | 3 +-- 3 files changed, 1 insertion(+), 4 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +0 -1
@@ -1438,7 +1438,6 @@ static int create_qp(struct uverbs_attr_bundle *attrs, ret =PTR_ERR (qp); goto err_put; } -ib_qp_usecnt_inc (qp); obj->uevent.uobject.object = qp; obj->uevent.event_file =READ_ONCE (attrs->ufile->default_async_file);
drivers/infiniband/core/uverbs_std_types_qp.c +0 -1
@@ -254,7 +254,6 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE)( ret =PTR_ERR (qp); goto err_put; } -ib_qp_usecnt_inc (qp);if (attr.qp_type ==IB_QPT_XRC_TGT ) { obj->uxrcd = container_of(xrcd_uobj, struct ib_uxrcd_object,
drivers/infiniband/core/verbs.c +1 -2
@@ -1253,6 +1253,7 @@ static struct ib_qp *create_qp(struct ib_device *dev, struct ib_pd *pd,if (ret) goto err_security; +ib_qp_usecnt_inc (qp);rdma_restrack_add (&qp->res);return qp;
@@ -1353,8 +1354,6 @@ struct ib_qp *ib_create_qp_kernel(struct ib_pd *pd,if (IS_ERR (qp))return qp; -ib_qp_usecnt_inc (qp); -if (qp_init_attr->cap.max_rdma_ctxs) { ret =rdma_rw_init_mrs (qp, qp_init_attr);if (ret)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 574/1017 PCI: Reduce warnings on possible RW1C corruption
In reply to Greg Kroah-HartmanFrom: Mark Tomlinson <[email protected]>
[ Upstream commit 92c45b63ce22c8898aa41806e8d6692bcd577510 ]
For hardware that only supports 32-bit writes to PCI there is the possibility of clearing RW1C (write-one-to-clear) bits. A rate-limited messages was introduced by fb2659230120, but rate-limiting is not the best choice here. Some devices may not show the warnings they should if another device has just produced a bunch of warnings. Also, the number of messages can be a nuisance on devices which are otherwise working fine.
Change the ratelimit to a single warning per bus. This ensures no bus is 'starved' of emitting a warning and also that there isn't a continuous stream of warnings. It would be preferable to have a warning per device, but the pci_dev structure is not available here, and a lookup from devfn would be far too slow.
--- drivers/pci/access.c | 9 ++++++--- include/linux/pci.h | 1 + 2 files changed, 7 insertions(+), 3 deletions(-)
drivers/pci/access.c +6 -3
@@ -160,9 +160,12 @@ int pci_generic_config_write32(struct pci_bus *bus, unsigned int devfn,* write happen to have any RW1C (write-one-to-clear) bits set, we * just inadvertently cleared something we shouldn't have. */ -dev_warn_ratelimited (&bus->dev,"%d-byte config write to %04x:%02x:%02x.%d offset %#x may corrupt adjacent RW1C bits\n" , - size,pci_domain_nr (bus), bus->number, -PCI_SLOT (devfn),PCI_FUNC (devfn), where); +if (!bus->unsafe_warn) { +dev_warn (&bus->dev,"%d-byte config write to %04x:%02x:%02x.%d offset %#x may corrupt adjacent RW1C bits\n" , + size,pci_domain_nr (bus), bus->number, +PCI_SLOT (devfn),PCI_FUNC (devfn), where); + bus->unsafe_warn =1 ; + } mask = ~(((1 << (size *8 )) -1 ) << ((where &0x3 ) *8 )); tmp =readl (addr) & mask;
include/linux/pci.h +1 -0
@@ -656,6 +656,7 @@ struct pci_bus {struct bin_attribute *legacy_io;/* Legacy I/O for this bus */ struct bin_attribute *legacy_mem;/* Legacy mem */ unsigned int is_added:1; + unsigned int unsafe_warn:1; /* warned about RW1C config write */ };#define to_pci_bus (n) container_of(n, struct pci_bus, dev)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 575/1017 net: axienet: fix RX ring refill allocation failure handling
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit 7a7d340ba4d9351e4c8847b898a2b996727a922a ]
If a memory allocation error occurred during an attempt to refill a slot in the RX ring after the packet was received, the hardware tail pointer would still have been updated to point to or past the slot which remained marked as previously completed. This would likely result in the DMA engine raising an error when it eventually tried to use that slot again.
If a slot cannot be refilled, then just stop processing and do not move the tail pointer past it. On the next attempt, we should skip receiving the packet from the empty slot and just try to refill it again.
This failure mode has not actually been observed, but was found as part of other driver updates.
--- .../net/ethernet/xilinx/xilinx_axienet_main.c | 72 +++++++++++-------- 1 file changed, 42 insertions(+), 30 deletions(-)
drivers/net/ethernet/xilinx/xilinx_axienet_main.c +42 -30
@@ -857,46 +857,53 @@ static void axienet_recv(struct net_device *ndev)while ((cur_p->status &XAXIDMA_BD_STS_COMPLETE_MASK )) {dma_addr_t phys; - tail_p = lp->rx_bd_p +sizeof (*lp->rx_bd_v) * lp->rx_bd_ci; -/* Ensure we see complete descriptor update */ dma_rmb (); - phys =desc_get_phys_addr (lp, cur_p); -dma_unmap_single (ndev->dev.parent, phys, lp->max_frm_size, -DMA_FROM_DEVICE ); skb = cur_p->skb; cur_p->skb =NULL ; - length = cur_p->app4 &0x0000FFFF ; - -skb_put (skb, length); - skb->protocol =eth_type_trans (skb, ndev); -/*skb_checksum_none_assert(skb);*/ - skb->ip_summed =CHECKSUM_NONE ; - -/* if we're doing Rx csum offload, set it up */ -if (lp->features &XAE_FEATURE_FULL_RX_CSUM ) { - csumstatus = (cur_p->app2 & -XAE_FULL_CSUM_STATUS_MASK ) >>3 ; -if ((csumstatus ==XAE_IP_TCP_CSUM_VALIDATED ) || - (csumstatus ==XAE_IP_UDP_CSUM_VALIDATED )) { - skb->ip_summed =CHECKSUM_UNNECESSARY ; + +/* skb could be NULL if a previous pass already received the +* packet for this slot in the ring, but failed to refill it +* with a newly allocated buffer. In this case, don't try to +* receive it again. +*/ +if (likely (skb)) { + length = cur_p->app4 &0x0000FFFF ; + + phys =desc_get_phys_addr (lp, cur_p); +dma_unmap_single (ndev->dev.parent, phys, lp->max_frm_size, +DMA_FROM_DEVICE ); + +skb_put (skb, length); + skb->protocol =eth_type_trans (skb, ndev); +/*skb_checksum_none_assert(skb);*/ + skb->ip_summed =CHECKSUM_NONE ; + +/* if we're doing Rx csum offload, set it up */ +if (lp->features &XAE_FEATURE_FULL_RX_CSUM ) { + csumstatus = (cur_p->app2 & +XAE_FULL_CSUM_STATUS_MASK ) >>3 ; +if (csumstatus ==XAE_IP_TCP_CSUM_VALIDATED || + csumstatus ==XAE_IP_UDP_CSUM_VALIDATED ) { + skb->ip_summed =CHECKSUM_UNNECESSARY ; + } + }else if ((lp->features &XAE_FEATURE_PARTIAL_RX_CSUM ) !=0 && + skb->protocol ==htons (ETH_P_IP ) && + skb->len >64 ) { + skb->csum =be32_to_cpu (cur_p->app3 &0xFFFF ); + skb->ip_summed =CHECKSUM_COMPLETE ; } - }else if ((lp->features &XAE_FEATURE_PARTIAL_RX_CSUM ) !=0 && - skb->protocol ==htons (ETH_P_IP ) && - skb->len >64 ) { - skb->csum =be32_to_cpu (cur_p->app3 &0xFFFF ); - skb->ip_summed =CHECKSUM_COMPLETE ; - } -netif_rx (skb); +netif_rx (skb); - size += length; - packets++; + size += length; + packets++; + } new_skb =netdev_alloc_skb_ip_align (ndev, lp->max_frm_size);if (!new_skb) -return ; +break ; phys = dma_map_single(ndev->dev.parent, new_skb->data, lp->max_frm_size,
@@ -905,7 +912,7 @@ static void axienet_recv(struct net_device *ndev)if (net_ratelimit ())netdev_err (ndev,"RX DMA mapping error\n" );dev_kfree_skb (new_skb); -return ; +break ; }desc_set_phys_addr (lp, phys, cur_p);
@@ -913,6 +920,11 @@ static void axienet_recv(struct net_device *ndev) cur_p->status =0 ; cur_p->skb = new_skb; +/* Only update tail_p to mark this slot as usable after it has +* been successfully refilled. +*/ + tail_p = lp->rx_bd_p +sizeof (*lp->rx_bd_v) * lp->rx_bd_ci; +if (++lp->rx_bd_ci >= lp->rx_bd_num) lp->rx_bd_ci =0 ; cur_p = &lp->rx_bd_v[lp->rx_bd_ci];
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 576/1017 drm/msm/a6xx: Fix missing ARRAY_SIZE() check
In reply to Greg Kroah-HartmanFrom: Rob Clark <[email protected]>
[ Upstream commit cca96584b35765bf9eb5f38ca55a144ea2ba0de4 ]
--- drivers/gpu/drm/msm/adreno/a6xx_gpu.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
drivers/gpu/drm/msm/adreno/a6xx_gpu.c +8 -4
@@ -658,19 +658,23 @@ static void a6xx_set_cp_protect(struct msm_gpu *gpu) {struct adreno_gpu *adreno_gpu =to_adreno_gpu (gpu);const u32 *regs = a6xx_protect; -unsigned i, count =ARRAY_SIZE (a6xx_protect), count_max =32 ; - -BUILD_BUG_ON (ARRAY_SIZE (a6xx_protect) >32 ); -BUILD_BUG_ON (ARRAY_SIZE (a650_protect) >48 ); +unsigned i, count, count_max;if (adreno_is_a650 (adreno_gpu)) { regs = a650_protect; count =ARRAY_SIZE (a650_protect); count_max =48 ; +BUILD_BUG_ON (ARRAY_SIZE (a650_protect) >48 ); }else if (adreno_is_a660_family (adreno_gpu)) { regs = a660_protect; count =ARRAY_SIZE (a660_protect); count_max =48 ; +BUILD_BUG_ON (ARRAY_SIZE (a660_protect) >48 ); + }else { + regs = a6xx_protect; + count =ARRAY_SIZE (a6xx_protect); + count_max =32 ; +BUILD_BUG_ON (ARRAY_SIZE (a6xx_protect) >32 ); }/*
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 577/1017 mips: DEC: honor CONFIG_MIPS_FP_SUPPORT=n
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 97bf0395c226907e1a9b908511a35192bf1e09bb ]
Include the DECstation interrupt handler in opting out of FPU support.
Fixes a linker error:
mips-linux-ld: arch/mips/dec/int-handler.o: in function `fpu':
(.text+0x148): undefined reference to `handle_fpe_int'
--- arch/mips/dec/int-handler.S | 6 +++--- arch/mips/dec/setup.c | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-)
arch/mips/dec/int-handler.S +3 -3
@@ -131,7 +131,7 @@ */ mfc0 t0,CP0_CAUSE # get pending interrupts mfc0 t1,CP0_STATUS -#ifdef CONFIG_32BIT +#if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT) lw t2,cpu_fpu_mask #endif andi t0,ST0_IM # CAUSE.CE may be non-zero!
@@ -139,7 +139,7 @@ beqz t0,spurious -#ifdef CONFIG_32BIT +#if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT) and t2,t0 bnez t2,fpu # handle FPU immediately #endif
@@ -280,7 +280,7 @@ handle_it: j dec_irq_dispatch nop -#ifdef CONFIG_32BIT +#if defined(CONFIG_32BIT) && defined(CONFIG_MIPS_FP_SUPPORT) fpu: lw t0,fpu_kstat_irq nop
arch/mips/dec/setup.c +2 -1
@@ -746,7 +746,8 @@ void __init arch_init_irq(void) dec_interrupt[DEC_IRQ_HALT ] =-1 ;/* Register board interrupts: FPU and cascade. */ -if (dec_interrupt[DEC_IRQ_FPU ] >=0 && cpu_has_fpu) { +if (IS_ENABLED (CONFIG_MIPS_FP_SUPPORT ) && + dec_interrupt[DEC_IRQ_FPU ] >=0 && cpu_has_fpu) {struct irq_desc *desc_fpu;int irq_fpu;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 578/1017 MIPS: Sanitise Cavium switch cases in TLB handler synthesizers
In reply to Greg Kroah-HartmanFrom: Maciej W. Rozycki <[email protected]>
[ Upstream commit 6ddcba9d480b6bcced4223a729794dfa6becb7eb ]
It makes no sense to fall through to `break'. Therefore reorder the switch statements so as to have the Cavium cases first, followed by the default case, which improves readability and pacifies code analysis tools. No change in semantics, assembly produced is exactly the same.
--- arch/mips/mm/tlbex.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-)
arch/mips/mm/tlbex.c +10 -13
@@ -2160,16 +2160,14 @@ static void build_r4000_tlb_load_handler(void)uasm_i_tlbr (&p);switch (current_cpu_type ()) { -default : -if (cpu_has_mips_r2_exec_hazard) { -uasm_i_ehb (&p); - fallthrough; -case CPU_CAVIUM_OCTEON :case CPU_CAVIUM_OCTEON_PLUS :case CPU_CAVIUM_OCTEON2 : -break ; - } +break ; +default : +if (cpu_has_mips_r2_exec_hazard) +uasm_i_ehb (&p); +break ; }/* Examine entrylo 0 or 1 based on ptr. */
@@ -2236,15 +2234,14 @@ static void build_r4000_tlb_load_handler(void)uasm_i_tlbr (&p);switch (current_cpu_type ()) { -default : -if (cpu_has_mips_r2_exec_hazard) { -uasm_i_ehb (&p); -case CPU_CAVIUM_OCTEON :case CPU_CAVIUM_OCTEON_PLUS :case CPU_CAVIUM_OCTEON2 : -break ; - } +break ; +default : +if (cpu_has_mips_r2_exec_hazard) +uasm_i_ehb (&p); +break ; }/* Examine entrylo 0 or 1 based on ptr. */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 579/1017 powerpc/sysdev: fix incorrect use to determine if list is empty
In reply to Greg Kroah-HartmanFrom: Jakob Koschel <[email protected]>
[ Upstream commit fa1321b11bd01752f5be2415e74a0e1a7c378262 ]
'gtm' will *always* be set by list_for_each_entry().
It is incorrect to assume that the iterator value will be NULL if the list is empty.
Instead of checking the pointer it should be checked if the list is empty.
--- arch/powerpc/sysdev/fsl_gtm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/powerpc/sysdev/fsl_gtm.c +2 -2
@@ -86,7 +86,7 @@ static LIST_HEAD(gtms);*/ struct gtm_timer *gtm_get_timer16 (void ) { -struct gtm *gtm =NULL ; +struct gtm *gtm;int i;list_for_each_entry (gtm, >ms, list_node) {
@@ -103,7 +103,7 @@ struct gtm_timer *gtm_get_timer16(void)spin_unlock_irq (>m->lock); } -if (gtm) +if (!list_empty (>ms))return ERR_PTR (-EBUSY );return ERR_PTR (-ENODEV ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 580/1017 powerpc/64s: Dont use DSISR for SLB faults
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit d4679ac8ea2e5078704aa1c026db36580cc1bf9a ]
Since commit 46ddcb3950a2 ("powerpc/mm: Show if a bad page fault on data is read or write.") we use page_fault_is_write(regs->dsisr) in __bad_page_fault() to determine if the fault is for a read or write, and change the message printed accordingly.
But SLB faults, aka Data Segment Interrupts, don't set DSISR (Data Storage Interrupt Status Register) to a useful value. All ISA versions from v2.03 through v3.1 specify that the Data Segment Interrupt sets DSISR "to an undefined value". As far as I can see there's no mention of SLB faults setting DSISR in any BookIV content either.
This manifests as accesses that should be a read being incorrectly reported as writes, for example, using the xmon "dump" command:
0:mon> d 0x5deadbeef0000000
5deadbeef0000000
[359526.415354][ C6] BUG: Unable to handle kernel data access on write at 0x5deadbeef0000000
[359526.415611][ C6] Faulting instruction address: 0xc00000000010a300
cpu 0x6: Vector: 380 (Data SLB Access) at [c00000000ffbf400]
pc: c00000000010a300: mread+0x90/0x190If we disassemble the PC, we see a load instruction:
0:mon> di c00000000010a300
c00000000010a300 89490000 lbz r10,0(r9)
We can also see in exceptions-64s.S that the data_access_slb block doesn't set IDSISR=1, which means it doesn't load DSISR into pt_regs. So the value we're using to determine if the fault is a read/write is some stale value in pt_regs from a previous page fault.
Rework the printing logic to separate the SLB fault case out, and only print read/write in the cases where we can determine it.
The result looks like eg:
0:mon> d 0x5deadbeef0000000
5deadbeef0000000
[ 721.779525][ C6] BUG: Unable to handle kernel data access at 0x5deadbeef0000000 [ 721.779697][ C6] Faulting instruction address: 0xc00000000014cbe0 cpu 0x6: Vector: 380 (Data SLB Access) at [c00000000ffbf390]
0:mon> d 0
0000000000000000
[ 742.793242][ C6] BUG: Kernel NULL pointer dereference at 0x00000000 [ 742.793316][ C6] Faulting instruction address: 0xc00000000014cbe0 cpu 0x6: Vector: 380 (Data SLB Access) at [c00000000ffbf390]
--- arch/powerpc/mm/fault.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
arch/powerpc/mm/fault.c +10 -4
@@ -568,18 +568,24 @@ NOKPROBE_SYMBOL(hash__do_page_fault);static void __bad_page_fault (struct pt_regs *regs,int sig) {int is_write =page_fault_is_write (regs->dsisr); +const char *msg;/* kernel has accessed a bad area */ +if (regs->dar <PAGE_SIZE ) + msg ="Kernel NULL pointer dereference" ; +else + msg ="Unable to handle kernel data access" ; +switch (TRAP (regs)) {case INTERRUPT_DATA_STORAGE : -case INTERRUPT_DATA_SEGMENT :case INTERRUPT_H_DATA_STORAGE : -pr_alert ("BUG: %s on %s at 0x%08lx\n" , - regs->dar <PAGE_SIZE ?"Kernel NULL pointer dereference" : -"Unable to handle kernel data access" , +pr_alert ("BUG: %s on %s at 0x%08lx\n" , msg, is_write ?"write" :"read" , regs->dar);break ; +case INTERRUPT_DATA_SEGMENT : +pr_alert ("BUG: %s at 0x%08lx\n" , msg, regs->dar); +break ;case INTERRUPT_INST_STORAGE :case INTERRUPT_INST_SEGMENT : pr_alert("BUG: Unable to handle kernel instruction fetch%s",
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 581/1017 mfd: mc13xxx: Add check for mc13xxx_irq_request
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit e477e51a41cb5d6034f3c5ea85a71ad4613996b9 ]
As the potential failure of the devm_request_threaded_irq(), it should be better to check the return value of the mc13xxx_irq_request() and return error if fails.
--- drivers/mfd/mc13xxx-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mfd/mc13xxx-core.c +3 -1
@@ -323,8 +323,10 @@ int mc13xxx_adc_do_conversion(struct mc13xxx *mc13xxx, unsigned int mode, adc1 |=MC13783_ADC1_ATOX ;dev_dbg (mc13xxx->dev,"%s: request irq\n" , __func__); -mc13xxx_irq_request (mc13xxx,MC13XXX_IRQ_ADCDONE , + ret =mc13xxx_irq_request (mc13xxx,MC13XXX_IRQ_ADCDONE , mc13xxx_handler_adcdone, __func__, &adcdone_data); +if (ret) + goto out;mc13xxx_reg_write (mc13xxx,MC13XXX_ADC0 , adc0);mc13xxx_reg_write (mc13xxx,MC13XXX_ADC1 , adc1);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 582/1017 libbpf: Unmap rings when umem deleted
In reply to Greg Kroah-HartmanFrom: lic121 <[email protected]>
[ Upstream commit 9c6e6a80ee741adf6cb3cfd8eef7d1554f91fceb ]
xsk_umem__create() does mmap for fill/comp rings, but xsk_umem__delete() doesn't do the unmap. This works fine for regular cases, because xsk_socket__delete() does unmap for the rings. But for the case that xsk_socket__create_shared() fails, umem rings are not unmapped.
fill_save/comp_save are checked to determine if rings have already be unmapped by xsk. If fill_save and comp_save are NULL, it means that the rings have already been used by xsk. Then they are supposed to be unmapped by xsk_socket__delete(). Otherwise, xsk_umem__delete() does the unmap.
--- tools/lib/bpf/xsk.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
tools/lib/bpf/xsk.c +11 -0
@@ -1210,12 +1210,23 @@ int xsk_socket__create(struct xsk_socket **xsk_ptr, const char *ifname,int xsk_umem__delete (struct xsk_umem *umem) { +struct xdp_mmap_offsets off; +int err; +if (!umem)return 0 ;if (umem->refcount)return -EBUSY ; + err =xsk_get_mmap_offsets (umem->fd, &off); +if (!err && umem->fill_save && umem->comp_save) { +munmap (umem->fill_save->ring - off.fr.desc, + off.fr.desc + umem->config.fill_size *sizeof (__u64)); +munmap (umem->comp_save->ring - off.cr.desc, + off.cr.desc + umem->config.comp_size *sizeof (__u64)); + } +close (umem->fd);free (umem);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 583/1017 selftests/bpf: Make test_lwt_ip_encap more stable and faster
In reply to Greg Kroah-HartmanFrom: Felix Maurer <[email protected]>
[ Upstream commit d23a8720327d33616f584d76c80824bfa4699be6 ]
In test_lwt_ip_encap, the ingress IPv6 encap test failed from time to time. The failure occured when an IPv4 ping through the IPv6 GRE encapsulation did not receive a reply within the timeout. The IPv4 ping and the IPv6 ping in the test used different timeouts (1 sec for IPv4 and 6 sec for IPv6), probably taking into account that IPv6 might need longer to successfully complete. However, when IPv4 pings (with the short timeout) are encapsulated into the IPv6 tunnel, the delays of IPv6 apply.
The actual reason for the long delays with IPv6 was that the IPv6 neighbor discovery sometimes did not complete in time. This was caused by the outgoing interface only having a tentative link local address, i.e., not having completed DAD for that lladdr. The ND was successfully retried after 1 sec but that was too late for the ping timeout.
The IPv6 addresses for the test were already added with nodad. However, for the lladdrs, DAD was still performed. We now disable DAD in the test netns completely and just assume that the two lladdrs on each veth pair do not collide. This removes all the delays for IPv6 traffic in the test.
Without the delays, we can now also reduce the delay of the IPv6 ping to 1 sec. This makes the whole test complete faster because we don't need to wait for the excessive timeout for each IPv6 ping that is supposed to fail.
--- tools/testing/selftests/bpf/test_lwt_ip_encap.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/test_lwt_ip_encap.sh +9 -1
@@ -120,6 +120,14 @@ setup() ip netns exec ${NS2} sysctl -wq net.ipv4.conf.default.rp_filter=0 ip netns exec ${NS3} sysctl -wq net.ipv4.conf.default.rp_filter=0 + # disable IPv6 DAD because it sometimes takes too long and fails tests + ip netns exec ${NS1} sysctl -wq net.ipv6.conf.all.accept_dad=0 + ip netns exec ${NS2} sysctl -wq net.ipv6.conf.all.accept_dad=0 + ip netns exec ${NS3} sysctl -wq net.ipv6.conf.all.accept_dad=0 + ip netns exec ${NS1} sysctl -wq net.ipv6.conf.default.accept_dad=0 + ip netns exec ${NS2} sysctl -wq net.ipv6.conf.default.accept_dad=0 + ip netns exec ${NS3} sysctl -wq net.ipv6.conf.default.accept_dad=0 + ip link add veth1 type veth peer name veth2 ip link add veth3 type veth peer name veth4 ip link add veth5 type veth peer name veth6
@@ -289,7 +297,7 @@ test_ping() ip netns exec ${NS1} ping -c 1 -W 1 -I veth1 ${IPv4_DST} 2>&1 > /dev/null RET=$? elif [ "${PROTO}" == "IPv6" ] ; then - ip netns exec ${NS1} ping6 -c 1 -W 6 -I veth1 ${IPv6_DST} 2>&1 > /dev/null + ip netns exec ${NS1} ping6 -c 1 -W 1 -I veth1 ${IPv6_DST} 2>&1 > /dev/null RET=$? else echo " test_ping: unknown PROTO: ${PROTO}"
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 584/1017 platform/x86: huawei-wmi: check the return value of device_create_file()
In reply to Greg Kroah-HartmanFrom: Jia-Ju Bai <[email protected]>
[ Upstream commit c91a5b1c221a58d008485cf7d02ccce73108b119 ]
The function device_create_file() in huawei_wmi_battery_add() can fail, so its return value should be checked.
--- drivers/platform/x86/huawei-wmi.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
drivers/platform/x86/huawei-wmi.c +10 -3
@@ -470,10 +470,17 @@ static DEVICE_ATTR_RW(charge_control_thresholds);static int huawei_wmi_battery_add (struct power_supply *battery) { -device_create_file (&battery->dev, &dev_attr_charge_control_start_threshold); -device_create_file (&battery->dev, &dev_attr_charge_control_end_threshold); +int err =0 ; -return 0 ; + err =device_create_file (&battery->dev, &dev_attr_charge_control_start_threshold); +if (err) +return err; + + err =device_create_file (&battery->dev, &dev_attr_charge_control_end_threshold); +if (err) +device_remove_file (&battery->dev, &dev_attr_charge_control_start_threshold); + +return err; }static int huawei_wmi_battery_remove (struct power_supply *battery)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 585/1017 scsi: mpt3sas: Fix incorrect 4GB boundary check
In reply to Greg Kroah-HartmanFrom: Sreekanth Reddy <[email protected]>
[ Upstream commit 208cc9fe6f21112b5cc6cb87065fb8ab66e79316 ]
The driver must perform its 4GB boundary check using the pool's DMA address instead of using the virtual address.
--- drivers/scsi/mpt3sas/mpt3sas_base.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-)
drivers/scsi/mpt3sas/mpt3sas_base.c +12 -13
@@ -5737,14 +5737,13 @@ _base_release_memory_pools(struct MPT3SAS_ADAPTER *ioc)*/ static int -mpt3sas_check_same_4gb_region (long reply_pool_start_address,u32 pool_sz) +mpt3sas_check_same_4gb_region (dma_addr_t start_address,u32 pool_sz) { -long reply_pool_end_address; +dma_addr_t end_address; - reply_pool_end_address = reply_pool_start_address + pool_sz; + end_address = start_address + pool_sz -1 ; -if (upper_32_bits (reply_pool_start_address) == -upper_32_bits (reply_pool_end_address)) +if (upper_32_bits (start_address) ==upper_32_bits (end_address))return 1 ;else return 0 ;
@@ -5805,7 +5804,7 @@ _base_allocate_pcie_sgl_pool(struct MPT3SAS_ADAPTER *ioc, u32 sz) }if (!mpt3sas_check_same_4gb_region ( - (long )ioc->pcie_sg_lookup[i].pcie_sgl, sz)) { + ioc->pcie_sg_lookup[i].pcie_sgl_dma, sz)) { ioc_err(ioc, "PCIE SGLs are not in same 4G !! pcie sgl (0x%p) dma = (0x%llx)\n", ioc->pcie_sg_lookup[i].pcie_sgl, (unsigned long long)
@@ -5860,8 +5859,8 @@ _base_allocate_chain_dma_pool(struct MPT3SAS_ADAPTER *ioc, u32 sz) GFP_KERNEL, &ctr->chain_buffer_dma);if (!ctr->chain_buffer)return -EAGAIN ; -if (!mpt3sas_check_same_4gb_region ((long ) - ctr->chain_buffer, ioc->chain_segment_sz)) { +if (!mpt3sas_check_same_4gb_region ( + ctr->chain_buffer_dma, ioc->chain_segment_sz)) { ioc_err(ioc, "Chain buffers are not in same 4G !!! Chain buff (0x%p) dma = (0x%llx)\n", ctr->chain_buffer,
@@ -5897,7 +5896,7 @@ _base_allocate_sense_dma_pool(struct MPT3SAS_ADAPTER *ioc, u32 sz) GFP_KERNEL, &ioc->sense_dma);if (!ioc->sense)return -EAGAIN ; -if (!mpt3sas_check_same_4gb_region ((long )ioc->sense, sz)) { +if (!mpt3sas_check_same_4gb_region (ioc->sense_dma, sz)) {dinitprintk (ioc,pr_err ("Bad Sense Pool! sense (0x%p) sense_dma = (0x%llx)\n" , ioc->sense, (unsigned long long ) ioc->sense_dma));
@@ -5930,7 +5929,7 @@ _base_allocate_reply_pool(struct MPT3SAS_ADAPTER *ioc, u32 sz) &ioc->reply_dma);if (!ioc->reply)return -EAGAIN ; -if (!mpt3sas_check_same_4gb_region ((long )ioc->reply_free, sz)) { +if (!mpt3sas_check_same_4gb_region (ioc->reply_dma, sz)) {dinitprintk (ioc,pr_err ("Bad Reply Pool! Reply (0x%p) Reply dma = (0x%llx)\n" , ioc->reply, (unsigned long long ) ioc->reply_dma));
@@ -5965,7 +5964,7 @@ _base_allocate_reply_free_dma_pool(struct MPT3SAS_ADAPTER *ioc, u32 sz) GFP_KERNEL, &ioc->reply_free_dma);if (!ioc->reply_free)return -EAGAIN ; -if (!mpt3sas_check_same_4gb_region ((long )ioc->reply_free, sz)) { +if (!mpt3sas_check_same_4gb_region (ioc->reply_free_dma, sz)) {dinitprintk (ioc,pr_err ("Bad Reply Free Pool! Reply Free (0x%p) Reply Free dma = (0x%llx)\n" , ioc->reply_free, (unsigned long long ) ioc->reply_free_dma));
@@ -6004,7 +6003,7 @@ _base_allocate_reply_post_free_array(struct MPT3SAS_ADAPTER *ioc, GFP_KERNEL, &ioc->reply_post_free_array_dma);if (!ioc->reply_post_free_array)return -EAGAIN ; -if (!mpt3sas_check_same_4gb_region ((long )ioc->reply_post_free_array, +if (!mpt3sas_check_same_4gb_region (ioc->reply_post_free_array_dma, reply_post_free_array_sz)) { dinitprintk(ioc, pr_err( "Bad Reply Free Pool! Reply Free (0x%p) Reply Free dma = (0x%llx)\n",
@@ -6069,7 +6068,7 @@ base_alloc_rdpq_dma_pool(struct MPT3SAS_ADAPTER *ioc, int sz)* resources and set DMA mask to 32 and allocate. */ if (!mpt3sas_check_same_4gb_region ( - (long )ioc->reply_post[i].reply_post_free, sz)) { + ioc->reply_post[i].reply_post_free_dma, sz)) { dinitprintk(ioc, ioc_err(ioc, "bad Replypost free pool(0x%p)" "reply_post_free_dma = (0x%llx)\n",
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 586/1017 powerpc: 8xx: fix a return value error in mpc8xx_pic_init
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
[ Upstream commit 3fd46e551f67f4303c3276a0d6cd20baf2d192c4 ]
mpc8xx_pic_init() should return -ENOMEM instead of 0 when irq_domain_add_linear() return NULL. This cause mpc8xx_pics_init to continue executing even if mpc8xx_pic_host is NULL.
--- arch/powerpc/platforms/8xx/pic.c | 1 + 1 file changed, 1 insertion(+)
arch/powerpc/platforms/8xx/pic.c +1 -0
@@ -153,6 +153,7 @@ int __init mpc8xx_pic_init(void)if (mpc8xx_pic_host ==NULL ) {printk (KERN_ERR "MPC8xx PIC: failed to allocate irq host!\n" ); ret = -ENOMEM ; + goto out; } ret =0 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 587/1017 xtensa: add missing XCHAL_HAVE_WINDOWED check
In reply to Greg Kroah-HartmanFrom: Max Filippov <[email protected]>
[ Upstream commit 8c9ab55c0fbdc76cb876140c2dad75a610bb23ef ]
Add missing preprocessor conditions to secondary reset vector code.
--- arch/xtensa/kernel/mxhead.S | 2 ++ 1 file changed, 2 insertions(+)
arch/xtensa/kernel/mxhead.S +2 -0
@@ -37,11 +37,13 @@ _SetupOCD: * xt-gdb to single step via DEBUG exceptions received directly * by ocd. */ +#if XCHAL_HAVE_WINDOWED movi a1, 1 movi a0, 0 wsr a1, windowstart wsr a0, windowbase rsync +#endif movi a1, LOCKLEVEL wsr a1, ps
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 588/1017 iwlwifi: pcie: fix SW error MSI-X mapping
In reply to Greg Kroah-HartmanFrom: Johannes Berg <[email protected]>
[ Upstream commit 7b9f485091a5755f6e0a7dd3725f3b312768ecd0 ]
We need to also update the IVAR location, since we've shifted the bit.
--- drivers/net/wireless/intel/iwlwifi/pcie/trans.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/intel/iwlwifi/pcie/trans.c +1 -1
@@ -1084,7 +1084,7 @@ static const struct iwl_causes_list causes_list_pre_bz[] = { };static const struct iwl_causes_list causes_list_bz[] = { - {MSIX_HW_INT_CAUSES_REG_SW_ERR_BZ ,CSR_MSIX_HW_INT_MASK_AD ,0x29 }, + {MSIX_HW_INT_CAUSES_REG_SW_ERR_BZ ,CSR_MSIX_HW_INT_MASK_AD ,0x15 }, }; static void iwl_pcie_map_list(struct iwl_trans *trans,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 589/1017 vxcan: enable local echo for sent CAN frames
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
[ Upstream commit 259bdba27e32368b4404f69d613b1c1014c07cbf ]
The vxcan driver provides a pair of virtual CAN interfaces to exchange CAN traffic between different namespaces - analogue to veth.
In opposite to the vcan driver the local sent CAN traffic on this interface is not echo'ed back but only sent to the remote peer. This is unusual and can be easily fixed by removing IFF_ECHO from the netdevice flags that are set for vxcan interfaces by default at startup.
Without IFF_ECHO set on driver level, the local sent CAN frames are echo'ed in af_can.c in can_send(). This patch makes vxcan interfaces adopt the same local echo behavior and procedures as known from the vcan interfaces.
--- drivers/net/can/vxcan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/can/vxcan.c +1 -1
@@ -148,7 +148,7 @@ static void vxcan_setup(struct net_device *dev) dev->hard_header_len =0 ; dev->addr_len =0 ; dev->tx_queue_len =0 ; - dev->flags = (IFF_NOARP |IFF_ECHO ); + dev->flags =IFF_NOARP ; dev->netdev_ops = &vxcan_netdev_ops; dev->needs_free_netdev = true;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 590/1017 ath10k: Fix error handling in ath10k_setup_msa_resources
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 9747a78d5f758a5284751a10aee13c30d02bd5f1 ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done.
This function only calls of_node_put() in the regular path. And it will cause refcount leak in error path.
--- drivers/net/wireless/ath/ath10k/snoc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath10k/snoc.c +1 -1
@@ -1556,11 +1556,11 @@ static int ath10k_setup_msa_resources(struct ath10k *ar, u32 msa_size) node =of_parse_phandle (dev->of_node,"memory-region" ,0 );if (node) { ret =of_address_to_resource (node,0 , &r); +of_node_put (node);if (ret) {dev_err (dev,"failed to resolve msa fixed region\n" );return ret; } -of_node_put (node); ar->msa.paddr = r.start; ar->msa.mem_size =resource_size (&r);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 591/1017 mips: cdmm: Fix refcount leak in mips_cdmm_phys_base
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 4528668ca331f7ce5999b7746657b46db5b3b785 ]
The of_find_compatible_node() function returns a node pointer with refcount incremented, We should use of_node_put() on it when done Add the missing of_node_put() to release the refcount.
--- drivers/bus/mips_cdmm.c | 1 + 1 file changed, 1 insertion(+)
drivers/bus/mips_cdmm.c +1 -0
@@ -351,6 +351,7 @@ phys_addr_t __weak mips_cdmm_phys_base(void) np =of_find_compatible_node (NULL ,NULL ,"mti,mips-cdmm" );if (np) { err =of_address_to_resource (np,0 , &res); +of_node_put (np);if (!err)return res.start; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 592/1017 MIPS: RB532: fix return value of __setup handler
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 8755d57ba1ff910666572fab9e32890e8cc6ed3b ]
__setup() handlers should return 1 to obsolete_checksetup() in init/main.c to indicate that the boot option has been handled. A return of 0 causes the boot option/value to be listed as an Unknown kernel parameter and added to init's (limited) argument or environment strings. Also, error return codes don't mean anything to obsolete_checksetup() -- only non-zero (usually 1) or zero. So return 1 from setup_kmac().
From: Igor Zhbanov <[email protected]>
--- arch/mips/rb532/devices.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/mips/rb532/devices.c +2 -4
@@ -301,11 +301,9 @@ static int __init plat_setup_devices(void)static int __init setup_kmac (char *s) {printk (KERN_INFO "korina mac = %s\n" , s); -if (!mac_pton (s, korina_dev0_data.mac)) { +if (!mac_pton (s, korina_dev0_data.mac))printk (KERN_ERR "Invalid mac\n" ); -return -EINVAL ; - } -return 0 ; +return 1 ; }__setup ("kmac=" , setup_kmac);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 593/1017 MIPS: pgalloc: fix memory leak caused by pgd_free()
In reply to Greg Kroah-HartmanFrom: Yaliang Wang <[email protected]>
[ Upstream commit 2bc5bab9a763d520937e4f3fe8df51c6a1eceb97 ]
pgd page is freed by generic implementation pgd_free() since commit f9cb654cb550 ("asm-generic: pgalloc: provide generic pgd_free()"), however, there are scenarios that the system uses more than one page as the pgd table, in such cases the generic implementation pgd_free() won't be applicable anymore. For example, when PAGE_SIZE_4KB is enabled and MIPS_VA_BITS_48 is not enabled in a 64bit system, the macro "PGD_ORDER" will be set as "1", which will cause allocating two pages as the pgd table. Well, at the same time, the generic implementation pgd_free() just free one pgd page, which will result in the memory leak.
The memory leak can be easily detected by executing shell command:
"while true; do ls > /dev/null; grep MemFree /proc/meminfo; done"
--- arch/mips/include/asm/pgalloc.h | 6 ++++++ 1 file changed, 6 insertions(+)
arch/mips/include/asm/pgalloc.h +6 -0
@@ -15,6 +15,7 @@#define __HAVE_ARCH_PMD_ALLOC_ONE#define __HAVE_ARCH_PUD_ALLOC_ONE +#define __HAVE_ARCH_PGD_FREE#include <asm-generic/pgalloc.h> static inline void pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmd,
@@ -48,6 +49,11 @@ static inline void pud_populate(struct mm_struct *mm, pud_t *pud, pmd_t *pmd)extern void pgd_init (unsigned long page);extern pgd_t *pgd_alloc (struct mm_struct *mm); +static inline void pgd_free (struct mm_struct *mm,pgd_t *pgd) +{ +free_pages ((unsigned long )pgd,PGD_ORDER ); +} +#define __pte_free_tlb (tlb,pte,address) \ do { \ pgtable_pte_page_dtor(pte); \
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 594/1017 mtd: rawnand: atmel: fix refcount issue in atmel_nand_controller_init
In reply to Greg Kroah-HartmanFrom: Xin Xiong <[email protected]>
[ Upstream commit fecbd4a317c95d73c849648c406bcf1b6a0ec1cf ]
The reference counting issue happens in several error handling paths on a refcounted object "nc->dmac". In these paths, the function simply returns the error code, forgetting to balance the reference count of "nc->dmac", increased earlier by dma_request_channel(), which may cause refcount leaks.
Fix it by decrementing the refcount of specific object in those error paths.
--- drivers/mtd/nand/raw/atmel/nand-controller.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
drivers/mtd/nand/raw/atmel/nand-controller.c +11 -3
@@ -2060,13 +2060,15 @@ static int atmel_nand_controller_init(struct atmel_nand_controller *nc, nc->mck =of_clk_get (dev->parent->of_node,0 );if (IS_ERR (nc->mck)) {dev_err (dev,"Failed to retrieve MCK clk\n" ); -return PTR_ERR (nc->mck); + ret =PTR_ERR (nc->mck); + goto out_release_dma; } np =of_parse_phandle (dev->parent->of_node,"atmel,smc" ,0 );if (!np) {dev_err (dev,"Missing or invalid atmel,smc property\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto out_release_dma; } nc->smc =syscon_node_to_regmap (np);
@@ -2074,10 +2076,16 @@ static int atmel_nand_controller_init(struct atmel_nand_controller *nc,if (IS_ERR (nc->smc)) { ret =PTR_ERR (nc->smc);dev_err (dev,"Could not get SMC regmap (err = %d)\n" , ret); -return ret; + goto out_release_dma; }return 0 ; + +out_release_dma: +if (nc->dmac) +dma_release_channel (nc->dmac); + +return ret; } static int
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 595/1017 power: ab8500_chargalg: Use CLOCK_MONOTONIC
In reply to Greg Kroah-HartmanFrom: Linus Walleij <[email protected]>
[ Upstream commit c22fca40522e2be8af168f3087d87d85e404ea72 ]
The HRTimer in the AB8500 charging code is using CLOCK_REALTIME to set an alarm some hours forward in time +/- 5 min for a safety timer.
I have observed that this will sometimes fire sporadically early when charging a battery with the result that charging stops.
As CLOCK_REALTIME can be subject to adjustments of time from sources such as NTP, this cannot be trusted and will likely for example fire events if the clock is set forward some hours by say NTP.
Use CLOCK_MONOTONIC as indicated in other instances and the problem goes away. Also initialize the timer to REL mode as this is what will be used later.
--- drivers/power/supply/ab8500_chargalg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/power/supply/ab8500_chargalg.c +2 -2
@@ -2019,11 +2019,11 @@ static int ab8500_chargalg_probe(struct platform_device *pdev) psy_cfg.drv_data = di;/* Initilialize safety timer */ -hrtimer_init (&di->safety_timer,CLOCK_REALTIME ,HRTIMER_MODE_ABS ); +hrtimer_init (&di->safety_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); di->safety_timer.function = ab8500_chargalg_safety_timer_expired;/* Initilialize maintenance timer */ -hrtimer_init (&di->maintenance_timer,CLOCK_REALTIME ,HRTIMER_MODE_ABS ); +hrtimer_init (&di->maintenance_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_REL ); di->maintenance_timer.function = ab8500_chargalg_maintenance_timer_expired;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 596/1017 RDMA/irdma: Prevent some integer underflows
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 6f6dbb819dfc1a35bcb8b709b5c83a3ea8beff75 ]
My static checker complains that:
drivers/infiniband/hw/irdma/ctrl.c:3605 irdma_sc_ceq_init()
warn: can subtract underflow 'info->dev->hmc_fpm_misc.max_ceqs'?It appears that "info->dev->hmc_fpm_misc.max_ceqs" comes from the firmware in irdma_sc_parse_fpm_query_buf() so, yes, there is a chance that it could be zero. Even if we trust the firmware, it's easy enough to change the condition just as a hardenning measure.
--- drivers/infiniband/hw/irdma/ctrl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/infiniband/hw/irdma/ctrl.c +5 -5
@@ -431,7 +431,7 @@ enum irdma_status_code irdma_sc_qp_create(struct irdma_sc_qp *qp, struct irdma_c cqp = qp->dev->cqp;if (qp->qp_uk.qp_id < cqp->dev->hw_attrs.min_hw_qp_id || - qp->qp_uk.qp_id > (cqp->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_QP ].max_cnt -1 )) + qp->qp_uk.qp_id >= (cqp->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_QP ].max_cnt))return IRDMA_ERR_INVALID_QP_ID ; wqe =irdma_sc_cqp_get_next_send_wqe (cqp, scratch);
@@ -2510,10 +2510,10 @@ static enum irdma_status_code irdma_sc_cq_create(struct irdma_sc_cq *cq,enum irdma_status_code ret_code =0 ; cqp = cq->dev->cqp; -if (cq->cq_uk.cq_id > (cqp->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_CQ ].max_cnt -1 )) +if (cq->cq_uk.cq_id >= (cqp->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_CQ ].max_cnt))return IRDMA_ERR_INVALID_CQ_ID ; -if (cq->ceq_id > (cq->dev->hmc_fpm_misc.max_ceqs -1 )) +if (cq->ceq_id >= (cq->dev->hmc_fpm_misc.max_ceqs))return IRDMA_ERR_INVALID_CEQ_ID ; ceq = cq->dev->ceq[cq->ceq_id];
@@ -3615,7 +3615,7 @@ enum irdma_status_code irdma_sc_ceq_init(struct irdma_sc_ceq *ceq, info->elem_cnt > info->dev->hw_attrs.max_hw_ceq_size)return IRDMA_ERR_INVALID_SIZE ; -if (info->ceq_id > (info->dev->hmc_fpm_misc.max_ceqs -1 )) +if (info->ceq_id >= (info->dev->hmc_fpm_misc.max_ceqs))return IRDMA_ERR_INVALID_CEQ_ID ; pble_obj_cnt = info->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_PBLE ].cnt;
@@ -4164,7 +4164,7 @@ enum irdma_status_code irdma_sc_ccq_init(struct irdma_sc_cq *cq, info->num_elem > info->dev->hw_attrs.uk_attrs.max_hw_cq_size)return IRDMA_ERR_INVALID_SIZE ; -if (info->ceq_id > (info->dev->hmc_fpm_misc.max_ceqs -1 )) +if (info->ceq_id >= (info->dev->hmc_fpm_misc.max_ceqs ))return IRDMA_ERR_INVALID_CEQ_ID ; pble_obj_cnt = info->dev->hmc_info->hmc_obj[IRDMA_HMC_IW_PBLE ].cnt;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 597/1017 Revert "RDMA/core: Fix ib_qp_usecnt_dec() called when error"
In reply to Greg Kroah-HartmanFrom: Leon Romanovsky <[email protected]>
[ Upstream commit 7922d3de4d270a9aedb71212fc0d5ae697ced516 ]
This reverts commit 7c4a539ec38f4ce400a0f3fcb5ff6c940fcd67bb. which causes to the following error in mlx4.
Destroy of kernel CQ shouldn't fail
WARNING: CPU: 4 PID: 18064 at include/rdma/ib_verbs.h:3936 mlx4_ib_dealloc_xrcd+0x12e/0x1b0 [mlx4_ib] Modules linked in: bonding ib_ipoib ip_gre ipip tunnel4 geneve rdma_ucm nf_tables ib_umad mlx4_en mlx4_ib ib_uverbs mlx4_core ip6_gre gre ip6_tunnel tunnel6 iptable_raw openvswitch nsh rpcrdma ib_iser libiscsi scsi_transport_iscsi rdma_cm iw_cm ib_cm ib_core xt_conntrack xt_MASQUERADE nf_conntrack_netlink nfnetlink xt_addrtype iptable_nat nf_nat br_netfilter overlay fuse [last unloaded: mlx4_core] CPU: 4 PID: 18064 Comm: ibv_xsrq_pingpo Not tainted 5.17.0-rc7_master_62c6ecb #1 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 RIP: 0010:mlx4_ib_dealloc_xrcd+0x12e/0x1b0 [mlx4_ib] Code: 1e 93 08 00 40 80 fd 01 0f 87 fa f1 04 00 83 e5 01 0f 85 2b ff ff ff 48 c7 c7 20 4f b6 a0 c6 05 fd 92 08 00 01 e8 47 c9 82 e2 <0f> 0b e9 11 ff ff ff 0f b6 2d eb 92 08 00 40 80 fd 01 0f 87 b1 f1 RSP: 0018:ffff8881a4957750 EFLAGS: 00010286 RAX: 0000000000000000 RBX: ffff8881ac4b6800 RCX: 0000000000000000 RDX: 0000000000000027 RSI: 0000000000000004 RDI: ffffed103492aedc RBP: 0000000000000000 R08: 0000000000000001 R09: ffff8884d2e378eb R10: ffffed109a5c6f1d R11: 0000000000000001 R12: ffff888132620000 R13: ffff8881a4957a90 R14: ffff8881aa2d4000 R15: ffff8881a4957ad0 FS: 00007f0401747740(0000) GS:ffff8884d2e00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 000055f8ae036118 CR3: 000000012fe94005 CR4: 0000000000370ea0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Call Trace: <TASK> ib_dealloc_xrcd_user+0xce/0x120 [ib_core] ib_uverbs_dealloc_xrcd+0xad/0x210 [ib_uverbs] uverbs_free_xrcd+0xe8/0x190 [ib_uverbs] destroy_hw_idr_uobject+0x7a/0x130 [ib_uverbs] uverbs_destroy_uobject+0x164/0x730 [ib_uverbs] uobj_destroy+0x72/0xf0 [ib_uverbs] ib_uverbs_cmd_verbs+0x19fb/0x3110 [ib_uverbs] ib_uverbs_ioctl+0x169/0x260 [ib_uverbs] __x64_sys_ioctl+0x856/0x1550 do_syscall_64+0x3d/0x90 entry_SYSCALL_64_after_hwframe+0x44/0xae
--- drivers/infiniband/core/uverbs_cmd.c | 1 + drivers/infiniband/core/uverbs_std_types_qp.c | 1 + drivers/infiniband/core/verbs.c | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-)
drivers/infiniband/core/uverbs_cmd.c +1 -0
@@ -1438,6 +1438,7 @@ static int create_qp(struct uverbs_attr_bundle *attrs, ret =PTR_ERR (qp); goto err_put; } +ib_qp_usecnt_inc (qp); obj->uevent.uobject.object = qp; obj->uevent.event_file =READ_ONCE (attrs->ufile->default_async_file);
drivers/infiniband/core/uverbs_std_types_qp.c +1 -0
@@ -254,6 +254,7 @@ static int UVERBS_HANDLER(UVERBS_METHOD_QP_CREATE)( ret =PTR_ERR (qp); goto err_put; } +ib_qp_usecnt_inc (qp);if (attr.qp_type ==IB_QPT_XRC_TGT ) { obj->uxrcd = container_of(xrcd_uobj, struct ib_uxrcd_object,
drivers/infiniband/core/verbs.c +2 -1
@@ -1253,7 +1253,6 @@ static struct ib_qp *create_qp(struct ib_device *dev, struct ib_pd *pd,if (ret) goto err_security; -ib_qp_usecnt_inc (qp);rdma_restrack_add (&qp->res);return qp;
@@ -1354,6 +1353,8 @@ struct ib_qp *ib_create_qp_kernel(struct ib_pd *pd,if (IS_ERR (qp))return qp; +ib_qp_usecnt_inc (qp); +if (qp_init_attr->cap.max_rdma_ctxs) { ret =rdma_rw_init_mrs (qp, qp_init_attr);if (ret)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 598/1017 RDMA/mlx5: Fix memory leak in error flow for subscribe event routine
In reply to Greg Kroah-HartmanFrom: Yongzhi Liu <[email protected]>
[ Upstream commit 087f9c3f2309ed183f7e4b85ae57121d8663224d ]
In case the second xa_insert() fails, the obj_event is not released. Fix the error unwind flow to free that memory to avoid a memory leak.
--- drivers/infiniband/hw/mlx5/devx.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/devx.c +3 -1
@@ -1886,8 +1886,10 @@ subscribe_event_xa_alloc(struct mlx5_devx_event_table *devx_event_table, key_level2, obj_event, GFP_KERNEL); -if (err) +if (err) { +kfree (obj_event);return err; + }INIT_LIST_HEAD (&obj_event->obj_sub_list); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 599/1017 bpf, sockmap: Fix memleak in sk_psock_queue_msg
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 938d3480b92fa5e454b7734294f12a7b75126f09 ]
If tcp_bpf_sendmsg is running during a tear down operation we may enqueue data on the ingress msg queue while tear down is trying to free it.
sk1 (redirect sk2) sk2
------------------- ---------------tcp_bpf_sendmsg()
tcp_bpf_send_verdict()
tcp_bpf_sendmsg_redir()
bpf_tcp_ingress()
sock_map_close()
lock_sock()
lock_sock() ... blocking
sk_psock_stop
sk_psock_clear_state(psock, SK_PSOCK_TX_ENABLED);
release_sock(sk);
lock_sock()
sk_mem_charge()
get_page()
sk_psock_queue_msg()
sk_psock_test_state(psock, SK_PSOCK_TX_ENABLED);
drop_sk_msg()
release_sock()While drop_sk_msg(), the msg has charged memory form sk by sk_mem_charge and has sg pages need to put. To fix we use sk_msg_free() and then kfee() msg.
This issue can cause the following info:
WARNING: CPU: 0 PID: 9202 at net/core/stream.c:205 sk_stream_kill_queues+0xc8/0xe0 Call Trace: <IRQ> inet_csk_destroy_sock+0x55/0x110 tcp_rcv_state_process+0xe5f/0xe90 ? sk_filter_trim_cap+0x10d/0x230 ? tcp_v4_do_rcv+0x161/0x250 tcp_v4_do_rcv+0x161/0x250 tcp_v4_rcv+0xc3a/0xce0 ip_protocol_deliver_rcu+0x3d/0x230 ip_local_deliver_finish+0x54/0x60 ip_local_deliver+0xfd/0x110 ? ip_protocol_deliver_rcu+0x230/0x230 ip_rcv+0xd6/0x100 ? ip_local_deliver+0x110/0x110 __netif_receive_skb_one_core+0x85/0xa0 process_backlog+0xa4/0x160 __napi_poll+0x29/0x1b0 net_rx_action+0x287/0x300 __do_softirq+0xff/0x2fc do_softirq+0x79/0x90 </IRQ> WARNING: CPU: 0 PID: 531 at net/ipv4/af_inet.c:154 inet_sock_destruct+0x175/0x1b0 Call Trace: <TASK> __sk_destruct+0x24/0x1f0 sk_psock_destroy+0x19b/0x1c0 process_one_work+0x1b3/0x3c0 ? process_one_work+0x3c0/0x3c0 worker_thread+0x30/0x350 ? process_one_work+0x3c0/0x3c0 kthread+0xe6/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x22/0x30 </TASK>
--- include/linux/skmsg.h | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-)
include/linux/skmsg.h +4 -9
@@ -310,21 +310,16 @@ static inline void sock_drop(struct sock *sk, struct sk_buff *skb)kfree_skb (skb); } -static inline void drop_sk_msg (struct sk_psock *psock,struct sk_msg *msg) -{ -if (msg->skb) -sock_drop (psock->sk, msg->skb); -kfree (msg); -} -static inline void sk_psock_queue_msg (struct sk_psock *psock,struct sk_msg *msg) {spin_lock_bh (&psock->ingress_lock);if (sk_psock_test_state (psock,SK_PSOCK_TX_ENABLED ))list_add_tail (&msg->list, &psock->ingress_msg); -else -drop_sk_msg (psock, msg); +else { +sk_msg_free (psock->sk, msg); +kfree (msg); + }spin_unlock_bh (&psock->ingress_lock); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 600/1017 bpf, sockmap: Fix memleak in tcp_bpf_sendmsg while sk msg is full
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 9c34e38c4a870eb30b13f42f5b44f42e9d19ccb8 ]
If tcp_bpf_sendmsg() is running while sk msg is full. When sk_msg_alloc() returns -ENOMEM error, tcp_bpf_sendmsg() goes to wait_for_memory. If partial memory has been alloced by sk_msg_alloc(), that is, msg_tx->sg.size is greater than osize after sk_msg_alloc(), memleak occurs. To fix we use sk_msg_trim() to release the allocated memory, then goto wait for memory.
Other call paths of sk_msg_alloc() have the similar issue, such as tls_sw_sendmsg(), so handle sk_msg_trim logic inside sk_msg_alloc(), as Cong Wang suggested.
This issue can cause the following info:
WARNING: CPU: 3 PID: 7950 at net/core/stream.c:208 sk_stream_kill_queues+0xd4/0x1a0 Call Trace: <TASK> inet_csk_destroy_sock+0x55/0x110 __tcp_close+0x279/0x470 tcp_close+0x1f/0x60 inet_release+0x3f/0x80 __sock_release+0x3d/0xb0 sock_close+0x11/0x20 __fput+0x92/0x250 task_work_run+0x6a/0xa0 do_exit+0x33b/0xb60 do_group_exit+0x2f/0xa0 get_signal+0xb6/0x950 arch_do_signal_or_restart+0xac/0x2a0 exit_to_user_mode_prepare+0xa9/0x200 syscall_exit_to_user_mode+0x12/0x30 do_syscall_64+0x46/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae </TASK> WARNING: CPU: 3 PID: 2094 at net/ipv4/af_inet.c:155 inet_sock_destruct+0x13c/0x260 Call Trace: <TASK> __sk_destruct+0x24/0x1f0 sk_psock_destroy+0x19b/0x1c0 process_one_work+0x1b3/0x3c0 kthread+0xe6/0x110 ret_from_fork+0x22/0x30 </TASK>
--- net/core/skmsg.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
net/core/skmsg.c +13 -4
@@ -27,6 +27,7 @@ int sk_msg_alloc(struct sock *sk, struct sk_msg *msg, int len, int elem_first_coalesce) {struct page_frag *pfrag =sk_page_frag (sk); +u32 osize = msg->sg.size;int ret =0 ; len -= msg->sg.size;
@@ -35,13 +36,17 @@ int sk_msg_alloc(struct sock *sk, struct sk_msg *msg, int len,u32 orig_offset;int use, i; -if (!sk_page_frag_refill (sk, pfrag)) -return -ENOMEM ; +if (!sk_page_frag_refill (sk, pfrag)) { + ret = -ENOMEM ; + goto msg_trim; + } orig_offset = pfrag->offset; use =min_t (int, len, pfrag->size - orig_offset); -if (!sk_wmem_schedule (sk, use)) -return -ENOMEM ; +if (!sk_wmem_schedule (sk, use)) { + ret = -ENOMEM ; + goto msg_trim; + } i = msg->sg.end;sk_msg_iter_var_prev (i);
@@ -71,6 +76,10 @@ int sk_msg_alloc(struct sock *sk, struct sk_msg *msg, int len, }return ret; + +msg_trim: +sk_msg_trim (sk, msg, osize); +return ret; }EXPORT_SYMBOL_GPL (sk_msg_alloc);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 601/1017 bpf, sockmap: Fix more uncharged while msg has more_data
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 84472b436e760ba439e1969a9e3c5ae7c86de39d ]
In tcp_bpf_send_verdict(), if msg has more data after tcp_bpf_sendmsg_redir():
tcp_bpf_send_verdict()
tosend = msg->sg.size //msg->sg.size = 22220
case __SK_REDIRECT:
sk_msg_return() //uncharged msg->sg.size(22220) sk->sk_forward_alloc tcp_bpf_sendmsg_redir() //after tcp_bpf_sendmsg_redir, msg->sg.size=11000
goto more_data;
tosend = msg->sg.size //msg->sg.size = 11000
case __SK_REDIRECT:
sk_msg_return() //uncharged msg->sg.size(11000) to sk->sk_forward_alloc
The msg->sg.size(11000) has been uncharged twice, to fix we can charge the remaining msg->sg.size before goto more data.
This issue can cause the following info:
WARNING: CPU: 0 PID: 9860 at net/core/stream.c:208 sk_stream_kill_queues+0xd4/0x1a0 Call Trace: <TASK> inet_csk_destroy_sock+0x55/0x110 __tcp_close+0x279/0x470 tcp_close+0x1f/0x60 inet_release+0x3f/0x80 __sock_release+0x3d/0xb0 sock_close+0x11/0x20 __fput+0x92/0x250 task_work_run+0x6a/0xa0 do_exit+0x33b/0xb60 do_group_exit+0x2f/0xa0 get_signal+0xb6/0x950 arch_do_signal_or_restart+0xac/0x2a0 ? vfs_write+0x237/0x290 exit_to_user_mode_prepare+0xa9/0x200 syscall_exit_to_user_mode+0x12/0x30 do_syscall_64+0x46/0x80 entry_SYSCALL_64_after_hwframe+0x44/0xae </TASK> WARNING: CPU: 0 PID: 2136 at net/ipv4/af_inet.c:155 inet_sock_destruct+0x13c/0x260 Call Trace: <TASK> __sk_destruct+0x24/0x1f0 sk_psock_destroy+0x19b/0x1c0 process_one_work+0x1b3/0x3c0 worker_thread+0x30/0x350 ? process_one_work+0x3c0/0x3c0 kthread+0xe6/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x22/0x30 </TASK>
--- net/ipv4/tcp_bpf.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
net/ipv4/tcp_bpf.c +5 -2
@@ -335,7 +335,7 @@ static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock, cork = true; psock->cork =NULL ; } -sk_msg_return (sk, msg, tosend); +sk_msg_return (sk, msg, msg->sg.size);release_sock (sk); ret =tcp_bpf_sendmsg_redir (sk_redir, msg, tosend, flags);
@@ -375,8 +375,11 @@ static int tcp_bpf_send_verdict(struct sock *sk, struct sk_psock *psock, }if (msg && msg->sg.data[msg->sg.start].page_link && - msg->sg.data[msg->sg.start].length) + msg->sg.data[msg->sg.start].length) { +if (eval == __SK_REDIRECT) +sk_mem_charge (sk, msg->sg.size); goto more_data; + } }return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 602/1017 bpf, sockmap: Fix double uncharge the mem of sk_msg
In reply to Greg Kroah-HartmanFrom: Wang Yufen <[email protected]>
[ Upstream commit 2486ab434b2c2a14e9237296db00b1e1b7ae3273 ]
If tcp_bpf_sendmsg is running during a tear down operation, psock may be freed.
tcp_bpf_sendmsg()
tcp_bpf_send_verdict()
sk_msg_return()
tcp_bpf_sendmsg_redir()
unlikely(!psock))
sk_msg_free()
The mem of msg has been uncharged in tcp_bpf_send_verdict() by sk_msg_return(), and would be uncharged by sk_msg_free() again. When psock is null, we can simply returning an error code, this would then trigger the sk_msg_free_nocharge in the error path of __SK_REDIRECT and would have the side effect of throwing an error up to user space. This would be a slight change in behavior from user side but would look the same as an error if the redirect on the socket threw an error.
This issue can cause the following info:
WARNING: CPU: 0 PID: 2136 at net/ipv4/af_inet.c:155 inet_sock_destruct+0x13c/0x260 Call Trace: <TASK> __sk_destruct+0x24/0x1f0 sk_psock_destroy+0x19b/0x1c0 process_one_work+0x1b3/0x3c0 worker_thread+0x30/0x350 ? process_one_work+0x3c0/0x3c0 kthread+0xe6/0x110 ? kthread_complete_and_exit+0x20/0x20 ret_from_fork+0x22/0x30 </TASK>
--- net/ipv4/tcp_bpf.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
net/ipv4/tcp_bpf.c +3 -4
@@ -138,10 +138,9 @@ int tcp_bpf_sendmsg_redir(struct sock *sk, struct sk_msg *msg,struct sk_psock *psock =sk_psock_get (sk);int ret; -if (unlikely (!psock)) { -sk_msg_free (sk, msg); -return 0 ; - } +if (unlikely (!psock)) +return -EPIPE ; + ret = ingress ?bpf_tcp_ingress (sk, psock, msg, bytes, flags) :tcp_bpf_push_locked (sk, msg, bytes, flags, false);sk_psock_put (sk, psock);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 603/1017 samples/bpf, xdpsock: Fix race when running for fix duration of time
In reply to Greg Kroah-HartmanFrom: Niklas Söderlund <[email protected]>
[ Upstream commit 8fa42d78f6354bb96ad3a079dcbef528ca9fa9e0 ]
When running xdpsock for a fix duration of time before terminating using --duration=<n>, there is a race condition that may cause xdpsock to terminate immediately.
When running for a fixed duration of time the check to determine when to terminate execution is in is_benchmark_done() and is being executed in the context of the poller thread,
if (opt_duration > 0) {
unsigned long dt = (get_nsecs() - start_time);
if (dt >= opt_duration)
benchmark_done = true;
}However start_time is only set after the poller thread have been created. This leaves a small window when the poller thread is starting and calls is_benchmark_done() for the first time that start_time is not yet set. In that case start_time have its initial value of 0 and the duration check fails as it do not correlate correctly for the applications start time and immediately sets benchmark_done which in turn terminates the xdpsock application.
Fix this by setting start_time before creating the poller thread.
--- samples/bpf/xdpsock_user.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
samples/bpf/xdpsock_user.c +3 -2
@@ -1673,14 +1673,15 @@ int main(int argc, char **argv)setlocale (LC_ALL ,"" ); + prev_time =get_nsecs (); + start_time = prev_time; +if (!opt_quiet) { ret =pthread_create (&pt,NULL , poller,NULL );if (ret)exit_with_error (ret); } - prev_time =get_nsecs (); - start_time = prev_time;if (opt_bench ==BENCH_RXDROP )rx_drop_all ();
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 604/1017 USB: storage: ums-realtek: fix error code in rts51x_read_mem()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit b07cabb8361dc692522538205552b1b9dab134be ]
The rts51x_read_mem() function should return negative error codes. Currently if the kmalloc() fails it returns USB_STOR_TRANSPORT_ERROR (3) which is treated as success by the callers.
--- drivers/usb/storage/realtek_cr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/storage/realtek_cr.c +1 -1
@@ -365,7 +365,7 @@ static int rts51x_read_mem(struct us_data *us, u16 addr, u8 *data, u16 len) buf =kmalloc (len,GFP_NOIO );if (buf ==NULL ) -return USB_STOR_TRANSPORT_ERROR ; +return -ENOMEM ;usb_stor_dbg (us,"addr = 0x%x, len = %d\n" , addr, len);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 605/1017 RDMA/rxe: Change variable and function argument to proper type
In reply to Greg Kroah-HartmanFrom: Chengguang Xu <[email protected]>
[ Upstream commit 7e8e611d6a0ff228577b1167335ffefb0f44d5d8 ]
The type of wqe length is u32 so in order to avoid overflow and shadow casting change variable and relevant function argument to proper type.
--- drivers/infiniband/sw/rxe/rxe_req.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/infiniband/sw/rxe/rxe_req.c +5 -5
@@ -362,7 +362,7 @@ static inline int get_mtu(struct rxe_qp *qp)static struct sk_buff *init_req_packet (struct rxe_qp *qp,struct rxe_send_wqe *wqe, -int opcode,int payload, +int opcode,u32 payload,struct rxe_pkt_info *pkt) {struct rxe_dev *rxe =to_rdev (qp->ibqp.device);
@@ -455,7 +455,7 @@ static struct sk_buff *init_req_packet(struct rxe_qp *qp,static int finish_packet (struct rxe_qp *qp,struct rxe_send_wqe *wqe,struct rxe_pkt_info *pkt,struct sk_buff *skb, -int paylen) +u32 paylen) {int err;
@@ -503,7 +503,7 @@ static void update_wqe_state(struct rxe_qp *qp,static void update_wqe_psn (struct rxe_qp *qp,struct rxe_send_wqe *wqe,struct rxe_pkt_info *pkt, -int payload) +u32 payload) {/* number of packets left to send including current one */ int num_pkt = (wqe->dma.resid + payload + qp->mtu -1 ) / qp->mtu;
@@ -546,7 +546,7 @@ static void rollback_state(struct rxe_send_wqe *wqe, }static void update_state (struct rxe_qp *qp,struct rxe_send_wqe *wqe, -struct rxe_pkt_info *pkt,int payload) +struct rxe_pkt_info *pkt,u32 payload) { qp->req.opcode = pkt->opcode;
@@ -618,7 +618,7 @@ int rxe_requester(void *arg)struct sk_buff *skb;struct rxe_send_wqe *wqe;enum rxe_hdr_mask mask; -int payload; +u32 payload;int mtu;int opcode;int ret;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 606/1017 RDMA/rxe: Fix ref error in rxe_av.c
In reply to Greg Kroah-HartmanFrom: Bob Pearson <[email protected]>
[ Upstream commit 63221acb0c63141cc7650f8eefb148337061e6db ]
The commit referenced below can take a reference to the AH which is never dropped. This only happens in the UD request path. This patch optionally passes that AH back to the caller so that it can hold the reference while the AV is being accessed and then drop it. Code to do this is added to rxe_req.c. The AV is also passed to rxe_prepare in rxe_net.c as an optimization.
--- drivers/infiniband/sw/rxe/rxe_av.c | 19 +++++++++- drivers/infiniband/sw/rxe/rxe_loc.h | 5 ++- drivers/infiniband/sw/rxe/rxe_net.c | 17 +++++---- drivers/infiniband/sw/rxe/rxe_req.c | 55 +++++++++++++++++----------- drivers/infiniband/sw/rxe/rxe_resp.c | 2 +- 5 files changed, 63 insertions(+), 35 deletions(-)
drivers/infiniband/sw/rxe/rxe_av.c +17 -2
@@ -99,11 +99,14 @@ void rxe_av_fill_ip_info(struct rxe_av *av, struct rdma_ah_attr *attr) av->network_type = type; } -struct rxe_av *rxe_get_av (struct rxe_pkt_info *pkt) +struct rxe_av *rxe_get_av (struct rxe_pkt_info *pkt,struct rxe_ah **ahp) {struct rxe_ah *ah;u32 ah_num; +if (ahp) + *ahp =NULL ; +if (!pkt || !pkt->qp)return NULL ;
@@ -117,10 +120,22 @@ struct rxe_av *rxe_get_av(struct rxe_pkt_info *pkt)if (ah_num) {/* only new user provider or kernel client */ ah =rxe_pool_get_index (&pkt->rxe->ah_pool, ah_num); -if (!ah || ah->ah_num != ah_num ||rxe_ah_pd (ah) != pkt->qp->pd) { +if (!ah) {pr_warn ("Unable to find AH matching ah_num\n" );return NULL ; } + +if (rxe_ah_pd (ah) != pkt->qp->pd) { +pr_warn ("PDs don't match for AH and QP\n" ); +rxe_drop_ref (ah); +return NULL ; + } + +if (ahp) + *ahp = ah; +else +rxe_drop_ref (ah); +return &ah->av; }
drivers/infiniband/sw/rxe/rxe_loc.h +3 -2
@@ -19,7 +19,7 @@ void rxe_av_to_attr(struct rxe_av *av, struct rdma_ah_attr *attr);void rxe_av_fill_ip_info (struct rxe_av *av,struct rdma_ah_attr *attr); -struct rxe_av *rxe_get_av (struct rxe_pkt_info *pkt); +struct rxe_av *rxe_get_av (struct rxe_pkt_info *pkt,struct rxe_ah **ahp);/* rxe_cq.c */ int rxe_cq_chk_attr(struct rxe_dev *rxe, struct rxe_cq *cq,
@@ -102,7 +102,8 @@ void rxe_mw_cleanup(struct rxe_pool_entry *arg);/* rxe_net.c */ struct sk_buff *rxe_init_packet (struct rxe_dev *rxe,struct rxe_av *av,int paylen,struct rxe_pkt_info *pkt); -int rxe_prepare (struct rxe_pkt_info *pkt,struct sk_buff *skb); +int rxe_prepare (struct rxe_av *av,struct rxe_pkt_info *pkt, +struct sk_buff *skb);int rxe_xmit_packet (struct rxe_qp *qp,struct rxe_pkt_info *pkt,struct sk_buff *skb);const char *rxe_parent_name (struct rxe_dev *rxe,unsigned int port_num);
drivers/infiniband/sw/rxe/rxe_net.c +9 -8
@@ -293,13 +293,13 @@ static void prepare_ipv6_hdr(struct dst_entry *dst, struct sk_buff *skb, ip6h->payload_len =htons (skb->len -sizeof (*ip6h)); } -static int prepare4 (struct rxe_pkt_info *pkt,struct sk_buff *skb) +static int prepare4 (struct rxe_av *av,struct rxe_pkt_info *pkt, +struct sk_buff *skb) {struct rxe_qp *qp = pkt->qp;struct dst_entry *dst;bool xnet = false;__be16 df =htons (IP_DF ); -struct rxe_av *av =rxe_get_av (pkt);struct in_addr *saddr = &av->sgid_addr._sockaddr_in.sin_addr;struct in_addr *daddr = &av->dgid_addr._sockaddr_in.sin_addr;
@@ -319,11 +319,11 @@ static int prepare4(struct rxe_pkt_info *pkt, struct sk_buff *skb)return 0 ; } -static int prepare6 (struct rxe_pkt_info *pkt,struct sk_buff *skb) +static int prepare6 (struct rxe_av *av,struct rxe_pkt_info *pkt, +struct sk_buff *skb) {struct rxe_qp *qp = pkt->qp;struct dst_entry *dst; -struct rxe_av *av =rxe_get_av (pkt);struct in6_addr *saddr = &av->sgid_addr._sockaddr_in6.sin6_addr;struct in6_addr *daddr = &av->dgid_addr._sockaddr_in6.sin6_addr;
@@ -344,16 +344,17 @@ static int prepare6(struct rxe_pkt_info *pkt, struct sk_buff *skb)return 0 ; } -int rxe_prepare (struct rxe_pkt_info *pkt,struct sk_buff *skb) +int rxe_prepare (struct rxe_av *av,struct rxe_pkt_info *pkt, +struct sk_buff *skb) {int err =0 ;if (skb->protocol ==htons (ETH_P_IP )) - err =prepare4 (pkt, skb); + err =prepare4 (av, pkt, skb);else if (skb->protocol ==htons (ETH_P_IPV6 )) - err =prepare6 (pkt, skb); + err =prepare6 (av, pkt, skb); -if (ether_addr_equal (skb->dev->dev_addr,rxe_get_av (pkt)->dmac)) +if (ether_addr_equal (skb->dev->dev_addr, av->dmac)) pkt->mask |=RXE_LOOPBACK_MASK ;return err;
drivers/infiniband/sw/rxe/rxe_req.c +33 -22
121 lines not on this page · raw message
drivers/infiniband/sw/rxe/rxe_resp.c +1 -1
@@ -632,7 +632,7 @@ static struct sk_buff *prepare_ack_packet(struct rxe_qp *qp,if (ack->mask &RXE_ATMACK_MASK )atmack_set_orig (ack, qp->resp.atomic_orig); - err =rxe_prepare (ack, skb); + err =rxe_prepare (&qp->pri_av, ack, skb);if (err) {kfree_skb (skb);return NULL ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 607/1017 drm/i915/display: Fix HPD short pulse handling for eDP
In reply to Greg Kroah-HartmanFrom: José Roberto de Souza <[email protected]>
[ Upstream commit 3a84fd1ed53582b31e843a152ee3219e9e4ccb8c ]
Commit 13ea6db2cf24 ("drm/i915/edp: Ignore short pulse when panel powered off") completely broke short pulse handling for eDP as it is usually generated by sink when it is displaying image and there is some error or status that source needs to handle.
When power panel is enabled, this state is enough to power aux transactions and VDD override is disabled, so intel_pps_have_power() is always returning false causing short pulses to be ignored.
So here better naming this function that intends to check if aux lines are powered to avoid the endless cycle mentioned in the commit being fixed and fixing the check for what it is intended.
v2:
- renamed to intel_pps_have_panel_power_or_vdd()
- fixed indentation
--- drivers/gpu/drm/i915/display/intel_dp.c | 2 +- drivers/gpu/drm/i915/display/intel_pps.c | 6 +++--- drivers/gpu/drm/i915/display/intel_pps.h | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_dp.c +1 -1
@@ -4742,7 +4742,7 @@ intel_dp_hpd_pulse(struct intel_digital_port *dig_port, bool long_hpd)struct intel_dp *intel_dp = &dig_port->dp;if (dig_port->base.type ==INTEL_OUTPUT_EDP && - (long_hpd || !intel_pps_have_power (intel_dp))) { + (long_hpd || !intel_pps_have_panel_power_or_vdd (intel_dp))) {/* * vdd off can generate a long/short pulse on eDP which * would require vdd on to handle it, and thus we
drivers/gpu/drm/i915/display/intel_pps.c +3 -3
@@ -1075,14 +1075,14 @@ static void intel_pps_vdd_sanitize(struct intel_dp *intel_dp)edp_panel_vdd_schedule_off (intel_dp); } -bool intel_pps_have_power (struct intel_dp *intel_dp) +bool intel_pps_have_panel_power_or_vdd (struct intel_dp *intel_dp) {intel_wakeref_t wakeref;bool have_power = false; with_intel_pps_lock(intel_dp, wakeref) { - have_power =edp_have_panel_power (intel_dp) && -edp_have_panel_vdd (intel_dp); + have_power =edp_have_panel_power (intel_dp) || +edp_have_panel_vdd (intel_dp); }return have_power;
drivers/gpu/drm/i915/display/intel_pps.h +1 -1
@@ -37,7 +37,7 @@ void intel_pps_vdd_on(struct intel_dp *intel_dp);void intel_pps_on (struct intel_dp *intel_dp);void intel_pps_off (struct intel_dp *intel_dp);void intel_pps_vdd_off_sync (struct intel_dp *intel_dp); -bool intel_pps_have_power (struct intel_dp *intel_dp); +bool intel_pps_have_panel_power_or_vdd (struct intel_dp *intel_dp);void intel_pps_wait_power_cycle (struct intel_dp *intel_dp);void intel_pps_init (struct intel_dp *intel_dp);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 608/1017 drm/i915/display: Do not re-enable PSR after it was marked as not reliable
In reply to Greg Kroah-HartmanFrom: José Roberto de Souza <[email protected]>
[ Upstream commit 278da06c03655c2bb9bc36ebdf45b90a079b3bfd ]
If a error happens and sink_not_reliable is set, PSR should be disabled for good but that is not happening.
It would be disabled by the function handling the PSR error but then on the next fastset it would be enabled again in _intel_psr_post_plane_update().
It would only be disabled for good in the next modeset where has_psr will be set false.
v2:
- release psr lock before continue
--- drivers/gpu/drm/i915/display/intel_psr.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/display/intel_psr.c +4 -0
@@ -1793,6 +1793,9 @@ static void _intel_psr_post_plane_update(const struct intel_atomic_state *state,mutex_lock (&psr->lock); +if (psr->sink_not_reliable) + goto exit; +drm_WARN_ON (&dev_priv->drm, psr->enabled && !crtc_state->active_planes);/* Only enable if there is active planes */
@@ -1803,6 +1806,7 @@ static void _intel_psr_post_plane_update(const struct intel_atomic_state *state,if (crtc_state->crc_enabled && psr->enabled)psr_force_hw_tracking_exit (intel_dp); +exit:mutex_unlock (&psr->lock); } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 609/1017 netfilter: flowtable: Fix QinQ and pppoe support for inet table
In reply to Greg Kroah-HartmanFrom: Pablo Neira Ayuso <[email protected]>
[ Upstream commit 0492d857636e1c52cd71594a723c4b26a7b31978 ]
nf_flow_offload_inet_hook() does not check for 802.1q and PPPoE. Fetch inner ethertype from these encapsulation protocols.
--- include/net/netfilter/nf_flow_table.h | 18 ++++++++++++++++++ net/netfilter/nf_flow_table_inet.c | 17 +++++++++++++++++ net/netfilter/nf_flow_table_ip.c | 18 ------------------ 3 files changed, 35 insertions(+), 18 deletions(-)
include/net/netfilter/nf_flow_table.h +18 -0
@@ -10,6 +10,8 @@#include <linux/netfilter/nf_conntrack_tuple_common.h> #include <net/flow_offload.h> #include <net/dst.h> +#include <linux/if_pppox.h> +#include <linux/ppp_defs.h> struct nf_flowtable ;struct nf_flow_rule ;
@@ -313,4 +315,20 @@ int nf_flow_rule_route_ipv6(struct net *net, const struct flow_offload *flow,int nf_flow_table_offload_init (void );void nf_flow_table_offload_exit (void ); +static inline __be16 nf_flow_pppoe_proto (const struct sk_buff *skb) +{ +__be16 proto; + + proto = *((__be16 *)(skb_mac_header (skb) +ETH_HLEN + +sizeof (struct pppoe_hdr ))); +switch (proto) { +case htons (PPP_IP ): +return htons (ETH_P_IP ); +case htons (PPP_IPV6 ): +return htons (ETH_P_IPV6 ); + } + +return 0 ; +} +#endif /* _NF_FLOW_TABLE_H */
net/netfilter/nf_flow_table_inet.c +17 -0
@@ -6,12 +6,29 @@#include <linux/rhashtable.h> #include <net/netfilter/nf_flow_table.h> #include <net/netfilter/nf_tables.h> +#include <linux/if_vlan.h> static unsigned int nf_flow_offload_inet_hook (void *priv,struct sk_buff *skb,const struct nf_hook_state *state) { +struct vlan_ethhdr *veth; +__be16 proto; +switch (skb->protocol) { +case htons (ETH_P_8021Q ): + veth = (struct vlan_ethhdr *)skb_mac_header (skb); + proto = veth->h_vlan_encapsulated_proto; +break ; +case htons (ETH_P_PPP_SES ): + proto =nf_flow_pppoe_proto (skb); +break ; +default : + proto = skb->protocol; +break ; + } + +switch (proto) {case htons (ETH_P_IP ):return nf_flow_offload_ip_hook (priv, skb, state);case htons (ETH_P_IPV6 ):
net/netfilter/nf_flow_table_ip.c +0 -18
@@ -8,8 +8,6 @@#include <linux/ipv6.h> #include <linux/netdevice.h> #include <linux/if_ether.h> -#include <linux/if_pppox.h> -#include <linux/ppp_defs.h> #include <net/ip.h> #include <net/ipv6.h> #include <net/ip6_route.h>
@@ -239,22 +237,6 @@ static unsigned int nf_flow_xmit_xfrm(struct sk_buff *skb,return NF_STOLEN ; } -static inline __be16 nf_flow_pppoe_proto (const struct sk_buff *skb) -{ -__be16 proto; - - proto = *((__be16 *)(skb_mac_header (skb) +ETH_HLEN + -sizeof (struct pppoe_hdr ))); -switch (proto) { -case htons (PPP_IP ): -return htons (ETH_P_IP ); -case htons (PPP_IPV6 ): -return htons (ETH_P_IPV6 ); - } - -return 0 ; -} -static bool nf_flow_skb_encap_protocol (const struct sk_buff *skb,__be16 proto,u32 *offset) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 610/1017 mt76: mt7921: fix mt7921_queues_acq implementation
In reply to Greg Kroah-HartmanFrom: Lorenzo Bianconi <[email protected]>
[ Upstream commit 849ee6ac9dd3efd0a57cbc98b9a9d6ae87374aff ]
Fix mt7921_queues_acq implementation according to the vendor sdk.
--- drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c | 13 ++++++------- drivers/net/wireless/mediatek/mt76/mt7921/regs.h | 11 +++++------ 2 files changed, 11 insertions(+), 13 deletions(-)
drivers/net/wireless/mediatek/mt76/mt7921/debugfs.c +6 -7
@@ -129,23 +129,22 @@ mt7921_queues_acq(struct seq_file *s, void *data)mt7921_mutex_acquire (dev); -for (i =0 ; i <16 ; i++) { -int j, acs = i /4 , index = i %4 ; +for (i =0 ; i <4 ; i++) {u32 ctrl, val, qlen =0 ; +int j; - val =mt76_rr (dev,MT_PLE_AC_QEMPTY (acs, index)); - ctrl =BIT (31 ) |BIT (15 ) | (acs <<8 ); + val =mt76_rr (dev,MT_PLE_AC_QEMPTY (i)); + ctrl =BIT (31 ) |BIT (11 ) | (i <<24 );for (j =0 ; j <32 ; j++) {if (val &BIT (j))continue ; -mt76_wr (dev,MT_PLE_FL_Q0_CTRL , - ctrl | (j + (index <<5 ))); +mt76_wr (dev,MT_PLE_FL_Q0_CTRL , ctrl | j); qlen +=mt76_get_field (dev,MT_PLE_FL_Q3_CTRL ,GENMASK (11 ,0 )); } -seq_printf (s,"AC%d%d: queued=%d\n" , acs, index, qlen); +seq_printf (s,"AC%d: queued=%d\n" , i, qlen); }mt7921_mutex_release (dev);
drivers/net/wireless/mediatek/mt76/mt7921/regs.h +5 -6
@@ -17,13 +17,12 @@#define MT_PLE_BASE 0x820c0000#define MT_PLE (ofs) (MT_PLE_BASE + (ofs)) -#define MT_PLE_FL_Q0_CTRL MT_PLE(0x1b0) -#define MT_PLE_FL_Q1_CTRL MT_PLE(0x1b4) -#define MT_PLE_FL_Q2_CTRL MT_PLE(0x1b8) -#define MT_PLE_FL_Q3_CTRL MT_PLE(0x1bc) +#define MT_PLE_FL_Q0_CTRL MT_PLE(0x3e0) +#define MT_PLE_FL_Q1_CTRL MT_PLE(0x3e4) +#define MT_PLE_FL_Q2_CTRL MT_PLE(0x3e8) +#define MT_PLE_FL_Q3_CTRL MT_PLE(0x3ec) -#define MT_PLE_AC_QEMPTY (ac, n) MT_PLE(0x300 + 0x10 * (ac) + \ - ((n) << 2)) +#define MT_PLE_AC_QEMPTY (_n) MT_PLE(0x500 + 0x40 * (_n))#define MT_PLE_AMSDU_PACK_MSDU_CNT (n) MT_PLE(0x10e0 + ((n) << 2))#define MT_MDP_BASE 0x820cd000
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 611/1017 can: isotp: return -EADDRNOTAVAIL when reading from unbound socket
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
[ Upstream commit 30ffd5332e06316bd69a654c06aa033872979b7c ]
When reading from an unbound can-isotp socket the syscall blocked indefinitely. As unbound sockets (without given CAN address information) do not make sense anyway we directly return -EADDRNOTAVAIL on read() analogue to the known behavior from sendmsg().
--- net/can/isotp.c | 4 ++++ 1 file changed, 4 insertions(+)
net/can/isotp.c +4 -0
@@ -1005,12 +1005,16 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size, {struct sock *sk = sock->sk;struct sk_buff *skb; +struct isotp_sock *so =isotp_sk (sk);int err =0 ;int noblock; noblock = flags &MSG_DONTWAIT ; flags &= ~MSG_DONTWAIT ; +if (!so->bound) +return -EADDRNOTAVAIL ; + skb =skb_recv_datagram (sk, flags, noblock, &err);if (!skb)return err;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 612/1017 can: isotp: support MSG_TRUNC flag when reading from socket
In reply to Greg Kroah-HartmanFrom: Oliver Hartkopp <[email protected]>
[ Upstream commit 42bf50a1795a1854d48717b7361dbdbce496b16b ]
When providing the MSG_TRUNC flag via recvmsg() syscall the return value provides the real length of the packet or datagram, even when it was longer than the passed buffer.
--- net/can/isotp.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
net/can/isotp.c +15 -12
@@ -1006,29 +1006,28 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,struct sock *sk = sock->sk;struct sk_buff *skb;struct isotp_sock *so =isotp_sk (sk); -int err =0 ; -int noblock; +int noblock = flags &MSG_DONTWAIT ; +int ret =0 ; - noblock = flags &MSG_DONTWAIT ; - flags &= ~MSG_DONTWAIT ; +if (flags & ~(MSG_DONTWAIT |MSG_TRUNC )) +return -EINVAL ;if (!so->bound)return -EADDRNOTAVAIL ; - skb =skb_recv_datagram (sk, flags, noblock, &err); + flags &= ~MSG_DONTWAIT ; + skb =skb_recv_datagram (sk, flags, noblock, &ret);if (!skb) -return err; +return ret;if (size < skb->len) msg->msg_flags |=MSG_TRUNC ;else size = skb->len; - err =memcpy_to_msg (msg, skb->data, size); -if (err <0 ) { -skb_free_datagram (sk, skb); -return err; - } + ret =memcpy_to_msg (msg, skb->data, size); +if (ret <0 ) + goto out_err;sock_recv_timestamp (msg, sk, skb);
@@ -1038,9 +1037,13 @@ static int isotp_recvmsg(struct socket *sock, struct msghdr *msg, size_t size,memcpy (msg->msg_name, skb->cb, msg->msg_namelen); } +/* set length of return value */ + ret = (flags &MSG_TRUNC ) ? skb->len : size; + +out_err:skb_free_datagram (sk, skb); -return size; +return ret; }static int isotp_release (struct socket *sock)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 613/1017 bareudp: use ipv6_mod_enabled to check if IPv6 enabled
In reply to Greg Kroah-HartmanFrom: Hangbin Liu <[email protected]>
[ Upstream commit e077ed58c243afc197bc2a2ba0e1ff61135e4ec2 ]
bareudp_create_sock() use AF_INET6 by default if IPv6 CONFIG enabled. But if user start kernel with ipv6.disable=1, the bareudp sock will created failed, which cause the interface open failed even with ethertype ip. e.g.
# ip link add bareudp1 type bareudp dstport 2 ethertype ip # ip link set bareudp1 up RTNETLINK answers: Address family not supported by protocol
Fix it by using ipv6_mod_enabled() to check if IPv6 enabled. There is no need to check IS_ENABLED(CONFIG_IPV6) as ipv6_mod_enabled() will return false when CONFIG_IPV6 no enabled in include/linux/ipv6.h.
--- drivers/net/bareudp.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/net/bareudp.c +10 -9
@@ -141,14 +141,14 @@ static int bareudp_udp_encap_recv(struct sock *sk, struct sk_buff *skb)skb_reset_network_header (skb);skb_reset_mac_header (skb); -if (!IS_ENABLED (CONFIG_IPV6 ) || family ==AF_INET ) +if (!ipv6_mod_enabled () || family ==AF_INET ) err =IP_ECN_decapsulate (oiph, skb);else err =IP6_ECN_decapsulate (oiph, skb);if (unlikely (err)) {if (log_ecn_error) { -if (!IS_ENABLED (CONFIG_IPV6 ) || family ==AF_INET ) +if (!ipv6_mod_enabled () || family ==AF_INET ) net_info_ratelimited("non-ECT from %pI4 " "with TOS=%#x\n", &((struct iphdr *)oiph)->saddr,
@@ -214,11 +214,12 @@ static struct socket *bareudp_create_sock(struct net *net, __be16 port)int err;memset (&udp_conf,0 ,sizeof (udp_conf)); -#if IS_ENABLED (CONFIG_IPV6 ) - udp_conf.family =AF_INET6 ; -#else - udp_conf.family =AF_INET ; -#endif + +if (ipv6_mod_enabled ()) + udp_conf.family =AF_INET6 ; +else + udp_conf.family =AF_INET ; + udp_conf.local_udp_port = port;/* Open UDP socket */ err =udp_sock_create (net, &udp_conf, &sock);
@@ -441,7 +442,7 @@ static netdev_tx_t bareudp_xmit(struct sk_buff *skb, struct net_device *dev) }rcu_read_lock (); -if (IS_ENABLED (CONFIG_IPV6 ) && info->mode &IP_TUNNEL_INFO_IPV6 ) +if (ipv6_mod_enabled () && info->mode &IP_TUNNEL_INFO_IPV6 ) err =bareudp6_xmit_skb (skb, dev, bareudp, info);else err =bareudp_xmit_skb (skb, dev, bareudp, info);
@@ -471,7 +472,7 @@ static int bareudp_fill_metadata_dst(struct net_device *dev, use_cache =ip_tunnel_dst_cache_usable (skb, info); -if (!IS_ENABLED (CONFIG_IPV6 ) ||ip_tunnel_info_af (info) ==AF_INET ) { +if (!ipv6_mod_enabled () ||ip_tunnel_info_af (info) ==AF_INET ) {struct rtable *rt;__be32 saddr;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 614/1017 ibmvnic: fix race between xmit and reset
In reply to Greg Kroah-HartmanFrom: Sukadev Bhattiprolu <[email protected]>
[ Upstream commit 4219196d1f662cb10a462eb9e076633a3fc31a15 ]
There is a race between reset and the transmit paths that can lead to ibmvnic_xmit() accessing an scrq after it has been freed in the reset path. It can result in a crash like:
Kernel attempted to read user page (0) - exploit attempt? (uid: 0) BUG: Kernel NULL pointer dereference on read at 0x00000000 Faulting instruction address: 0xc0080000016189f8 Oops: Kernel access of bad area, sig: 11 [#1] ... NIP [c0080000016189f8] ibmvnic_xmit+0x60/0xb60 [ibmvnic] LR [c000000000c0046c] dev_hard_start_xmit+0x11c/0x280 Call Trace: [c008000001618f08] ibmvnic_xmit+0x570/0xb60 [ibmvnic] (unreliable) [c000000000c0046c] dev_hard_start_xmit+0x11c/0x280 [c000000000c9cfcc] sch_direct_xmit+0xec/0x330 [c000000000bfe640] __dev_xmit_skb+0x3a0/0x9d0 [c000000000c00ad4] __dev_queue_xmit+0x394/0x730 [c008000002db813c] __bond_start_xmit+0x254/0x450 [bonding] [c008000002db8378] bond_start_xmit+0x40/0xc0 [bonding] [c000000000c0046c] dev_hard_start_xmit+0x11c/0x280 [c000000000c00ca4] __dev_queue_xmit+0x564/0x730 [c000000000cf97e0] neigh_hh_output+0xd0/0x180 [c000000000cfa69c] ip_finish_output2+0x31c/0x5c0 [c000000000cfd244] __ip_queue_xmit+0x194/0x4f0 [c000000000d2a3c4] __tcp_transmit_skb+0x434/0x9b0 [c000000000d2d1e0] __tcp_retransmit_skb+0x1d0/0x6a0 [c000000000d2d984] tcp_retransmit_skb+0x34/0x130 [c000000000d310e8] tcp_retransmit_timer+0x388/0x6d0 [c000000000d315ec] tcp_write_timer_handler+0x1bc/0x330 [c000000000d317bc] tcp_write_timer+0x5c/0x200 [c000000000243270] call_timer_fn+0x50/0x1c0 [c000000000243704] __run_timers.part.0+0x324/0x460 [c000000000243894] run_timer_softirq+0x54/0xa0 [c000000000ea713c] __do_softirq+0x15c/0x3e0 [c000000000166258] __irq_exit_rcu+0x158/0x190 [c000000000166420] irq_exit+0x20/0x40 [c00000000002853c] timer_interrupt+0x14c/0x2b0 [c000000000009a00] decrementer_common_virt+0x210/0x220 --- interrupt: 900 at plpar_hcall_norets_notrace+0x18/0x2c
The immediate cause of the crash is the access of tx_scrq in the following snippet during a reset, where the tx_scrq can be either NULL or an address that will soon be invalid:
ibmvnic_xmit()
{
...
tx_scrq = adapter->tx_scrq[queue_num];
txq = netdev_get_tx_queue(netdev, queue_num);
ind_bufp = &tx_scrq->ind_buf;
if (test_bit(0, &adapter->resetting)) {
...
}But beyond that, the call to ibmvnic_xmit() itself is not safe during a reset and the reset path attempts to avoid this by stopping the queue in ibmvnic_cleanup(). However just after the queue was stopped, an in-flight ibmvnic_complete_tx() could have restarted the queue even as the reset is progressing.
Since the queue was restarted we could get a call to ibmvnic_xmit() which can then access the bad tx_scrq (or other fields).
We cannot however simply have ibmvnic_complete_tx() check the ->resetting bit and skip starting the queue. This can race at the "back-end" of a good reset which just restarted the queue but has not cleared the ->resetting bit yet. If we skip restarting the queue due to ->resetting being true, the queue would remain stopped indefinitely potentially leading to transmit timeouts.
IOW ->resetting is too broad for this purpose. Instead use a new flag that indicates whether or not the queues are active. Only the open/ reset paths control when the queues are active. ibmvnic_complete_tx() and others wake up the queue only if the queue is marked active.
So we will have:
A. reset/open thread in ibmvnic_cleanup() and __ibmvnic_open() ->resetting = true ->tx_queues_active = false disable tx queues ... ->tx_queues_active = true start tx queues B. Tx interrupt in ibmvnic_complete_tx(): if (->tx_queues_active) netif_wake_subqueue();
To ensure that ->tx_queues_active and state of the queues are consistent, we need a lock which:
- must also be taken in the interrupt path (ibmvnic_complete_tx())
- shared across the multiple queues in the adapter (so they don't become serialized)
Use rcu_read_lock() and have the reset thread synchronize_rcu() after updating the ->tx_queues_active state.
While here, consolidate a few boolean fields in ibmvnic_adapter for better alignment.
Based on discussions with Brian King and Dany Madden.
--- drivers/net/ethernet/ibm/ibmvnic.c | 63 ++++++++++++++++++++++++------ drivers/net/ethernet/ibm/ibmvnic.h | 7 +++- 2 files changed, 55 insertions(+), 15 deletions(-)
drivers/net/ethernet/ibm/ibmvnic.c +50 -13
@@ -1429,6 +1429,15 @@ static int __ibmvnic_open(struct net_device *netdev)return rc; } + adapter->tx_queues_active = true; + +/* Since queues were stopped until now, there shouldn't be any +* one in ibmvnic_complete_tx() or ibmvnic_xmit() so maybe we +* don't need the synchronize_rcu()? Leaving it for consistency +* with setting ->tx_queues_active = false. +*/ +synchronize_rcu (); +netif_tx_start_all_queues (netdev);if (prev_state ==VNIC_CLOSED ) {
@@ -1603,6 +1612,14 @@ static void ibmvnic_cleanup(struct net_device *netdev)struct ibmvnic_adapter *adapter =netdev_priv (netdev);/* ensure that transmissions are stopped if called by do_reset */ + + adapter->tx_queues_active = false; + +/* Ensure complete_tx() and ibmvnic_xmit() see ->tx_queues_active +* update so they don't restart a queue after we stop it below. +*/ +synchronize_rcu (); +if (test_bit (0 , &adapter->resetting))netif_tx_disable (netdev);else
@@ -1842,14 +1859,21 @@ static void ibmvnic_tx_scrq_clean_buffer(struct ibmvnic_adapter *adapter, tx_buff->skb =NULL ; adapter->netdev->stats.tx_dropped++; } + ind_bufp->index =0 ; +if (atomic_sub_return (entries, &tx_scrq->used) <= (adapter->req_tx_entries_per_subcrq /2 ) && -__netif_subqueue_stopped (adapter->netdev, queue_num) && - !test_bit (0 , &adapter->resetting)) { -netif_wake_subqueue (adapter->netdev, queue_num); -netdev_dbg (adapter->netdev,"Started queue %d\n" , - queue_num); +__netif_subqueue_stopped (adapter->netdev, queue_num)) { +rcu_read_lock (); + +if (adapter->tx_queues_active) { +netif_wake_subqueue (adapter->netdev, queue_num); +netdev_dbg (adapter->netdev,"Started queue %d\n" , + queue_num); + } + +rcu_read_unlock (); } }
@@ -1904,11 +1928,12 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)int index =0 ;u8 proto =0 ; - tx_scrq = adapter->tx_scrq[queue_num]; - txq =netdev_get_tx_queue (netdev, queue_num); - ind_bufp = &tx_scrq->ind_buf; - -if (test_bit (0 , &adapter->resetting)) { +/* If a reset is in progress, drop the packet since +* the scrqs may get torn down. Otherwise use the +* rcu to ensure reset waits for us to complete. +*/ +rcu_read_lock (); +if (!adapter->tx_queues_active) {dev_kfree_skb_any (skb); tx_send_failed++;
@@ -1917,6 +1942,10 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev) goto out; } + tx_scrq = adapter->tx_scrq[queue_num]; + txq =netdev_get_tx_queue (netdev, queue_num); + ind_bufp = &tx_scrq->ind_buf; +if (ibmvnic_xmit_workarounds (skb, netdev)) { tx_dropped++; tx_send_failed++;
@@ -1924,6 +1953,7 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)ibmvnic_tx_scrq_flush (adapter, tx_scrq); goto out; } +if (skb_is_gso (skb)) tx_pool = &adapter->tso_pool[queue_num];else
@@ -2078,6 +2108,7 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)netif_carrier_off (netdev); } out: +rcu_read_unlock (); netdev->stats.tx_dropped += tx_dropped; netdev->stats.tx_bytes += tx_bytes; netdev->stats.tx_packets += tx_packets;
@@ -3728,9 +3759,15 @@ static int ibmvnic_complete_tx(struct ibmvnic_adapter *adapter, (adapter->req_tx_entries_per_subcrq / 2) && __netif_subqueue_stopped(adapter->netdev, scrq->pool_index)) { -netif_wake_subqueue (adapter->netdev, scrq->pool_index); -netdev_dbg (adapter->netdev,"Started queue %d\n" , - scrq->pool_index); +rcu_read_lock (); +if (adapter->tx_queues_active) { +netif_wake_subqueue (adapter->netdev, + scrq->pool_index); +netdev_dbg (adapter->netdev, +"Started queue %d\n" , + scrq->pool_index); + } +rcu_read_unlock (); } }
drivers/net/ethernet/ibm/ibmvnic.h +5 -2
@@ -1009,11 +1009,14 @@ struct ibmvnic_adapter {struct work_struct ibmvnic_reset;struct delayed_work ibmvnic_delayed_reset;unsigned long resetting; -bool napi_enabled, from_passive_init; -bool login_pending;/* last device reset time */ unsigned long last_reset_time; +bool napi_enabled; +bool from_passive_init; +bool login_pending; +/* protected by rcu */ +bool tx_queues_active;bool failover_pending;bool force_reset_recovery;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 615/1017 af_unix: Fix some data-races around unix_sk(sk)->oob_skb.
In reply to Greg Kroah-HartmanFrom: Kuniyuki Iwashima <[email protected]>
[ Upstream commit e82025c623e2bf04d162bafceb66a59115814479 ]
Out-of-band data automatically places a "mark" showing wherein the sequence the out-of-band data would have been. If the out-of-band data implies cancelling everything sent so far, the "mark" is helpful to flush them. When the socket's read pointer reaches the "mark", the ioctl() below sets a non zero value to the arg atmark:
The out-of-band data is queued in sk->sk_receive_queue as well as ordinary data and also saved in unix_sk(sk)->oob_skb. It can be used to test if the head of the receive queue is the out-of-band data meaning the socket is at the "mark".
While testing that, unix_ioctl() reads unix_sk(sk)->oob_skb locklessly. Thus, all accesses to oob_skb need some basic protection to avoid load/store tearing which KCSAN detects when these are called concurrently:
- ioctl(fd_a, SIOCATMARK, &atmark, sizeof(atmark))
- send(fd_b_connected_to_a, buf, sizeof(buf), MSG_OOB)
BUG: KCSAN: data-race in unix_ioctl / unix_stream_sendmsg
write to 0xffff888003d9cff0 of 8 bytes by task 175 on cpu 1:
unix_stream_sendmsg (net/unix/af_unix.c:2087 net/unix/af_unix.c:2191) sock_sendmsg (net/socket.c:705 net/socket.c:725) __sys_sendto (net/socket.c:2040) __x64_sys_sendto (net/socket.c:2048) do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:113)
read to 0xffff888003d9cff0 of 8 bytes by task 176 on cpu 0:
unix_ioctl (net/unix/af_unix.c:3101 (discriminator 1)) sock_do_ioctl (net/socket.c:1128) sock_ioctl (net/socket.c:1242) __x64_sys_ioctl (fs/ioctl.c:52 fs/ioctl.c:874 fs/ioctl.c:860 fs/ioctl.c:860) do_syscall_64 (arch/x86/entry/common.c:50 arch/x86/entry/common.c:80) entry_SYSCALL_64_after_hwframe (arch/x86/entry/entry_64.S:113)
value changed: 0xffff888003da0c00 -> 0xffff888003da0d00
Reported by Kernel Concurrency Sanitizer on:
CPU: 0 PID: 176 Comm: unix_race_oob_i Not tainted 5.17.0-rc5-59529-g83dc4c2af682 #12 Hardware name: Red Hat KVM, BIOS 1.11.0-2.amzn2 04/01/2014
--- net/unix/af_unix.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
net/unix/af_unix.c +5 -7
@@ -1996,7 +1996,7 @@ static int queue_oob(struct socket *sock, struct msghdr *msg, struct sock *otherif (ousk->oob_skb)consume_skb (ousk->oob_skb); - ousk->oob_skb = skb; +WRITE_ONCE (ousk->oob_skb, skb);scm_stat_add (other, skb);skb_queue_tail (&other->sk_receive_queue, skb);
@@ -2514,9 +2514,8 @@ static int unix_stream_recv_urg(struct unix_stream_read_state *state) oob_skb = u->oob_skb; -if (!(state->flags &MSG_PEEK )) { - u->oob_skb =NULL ; - } +if (!(state->flags &MSG_PEEK )) +WRITE_ONCE (u->oob_skb,NULL );unix_state_unlock (sk);
@@ -2551,7 +2550,7 @@ static struct sk_buff *manage_oob(struct sk_buff *skb, struct sock *sk, skb =NULL ; }else if (sock_flag (sk,SOCK_URGINLINE )) {if (!(flags &MSG_PEEK )) { - u->oob_skb =NULL ; +WRITE_ONCE (u->oob_skb,NULL );consume_skb (skb); } }else if (!(flags &MSG_PEEK )) {
@@ -3006,11 +3005,10 @@ static int unix_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)case SIOCATMARK : {struct sk_buff *skb; -struct unix_sock *u =unix_sk (sk);int answ =0 ; skb =skb_peek (&sk->sk_receive_queue); -if (skb && skb == u->oob_skb) +if (skb && skb ==READ_ONCE (unix_sk (sk)->oob_skb)) answ =1 ; err =put_user (answ, (int __user *)arg); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 616/1017 selftests/bpf: Fix error reporting from sock_fields programs
In reply to Greg Kroah-HartmanFrom: Jakub Sitnicki <[email protected]>
[ Upstream commit a4c9fe0ed4a13e25e43fcd44d9f89bc19ba8fbb7 ]
The helper macro that records an error in BPF programs that exercise sock fields access has been inadvertently broken by adaptation work that happened in commit b18c1f0aa477 ("bpf: selftest: Adapt sock_fields test to use skel and global variables").
BPF_NOEXIST flag cannot be used to update BPF_MAP_TYPE_ARRAY. The operation always fails with -EEXIST, which in turn means the error never gets recorded, and the checks for errors always pass.
Revert the change in update flags.
--- tools/testing/selftests/bpf/progs/test_sock_fields.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/testing/selftests/bpf/progs/test_sock_fields.c +1 -1
@@ -113,7 +113,7 @@ static void tpcpy(struct bpf_tcp_sock *dst,#define RET_LOG () ({ \ linum = __LINE__; \ - bpf_map_update_elem(&linum_map, &linum_idx, &linum, BPF_NOEXIST); \ + bpf_map_update_elem(&linum_map, &linum_idx, &linum, BPF_ANY); \ return CG_OK; \ })
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 617/1017 Bluetooth: hci_uart: add missing NULL check in h5_enqueue
In reply to Greg Kroah-HartmanFrom: Pavel Skripkin <[email protected]>
[ Upstream commit 32cb08e958696908a9aad5e49a78d74f7e32fffb ]
Syzbot hit general protection fault in __pm_runtime_resume(). The problem was in missing NULL check.
hu->serdev can be NULL and we should not blindly pass &serdev->dev somewhere, since it will cause GPF.
--- drivers/bluetooth/hci_h5.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/bluetooth/hci_h5.c +5 -3
@@ -629,9 +629,11 @@ static int h5_enqueue(struct hci_uart *hu, struct sk_buff *skb)break ; } -pm_runtime_get_sync (&hu->serdev->dev); -pm_runtime_mark_last_busy (&hu->serdev->dev); -pm_runtime_put_autosuspend (&hu->serdev->dev); +if (hu->serdev) { +pm_runtime_get_sync (&hu->serdev->dev); +pm_runtime_mark_last_busy (&hu->serdev->dev); +pm_runtime_put_autosuspend (&hu->serdev->dev); + }return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 618/1017 Bluetooth: call hci_le_conn_failed with hdev lock in hci_le_conn_failed
In reply to Greg Kroah-HartmanFrom: Niels Dossche <[email protected]>
[ Upstream commit 9fa6b4cda3b414e990f008f45f9bcecbcb54d4d1 ]
hci_le_conn_failed function's documentation says that the caller must hold hdev->lock. The only callsite that does not hold that lock is hci_le_conn_failed. The other 3 callsites hold the hdev->lock very locally. The solution is to hold the lock during the call to hci_le_conn_failed.
--- net/bluetooth/hci_conn.c | 2 ++ 1 file changed, 2 insertions(+)
net/bluetooth/hci_conn.c +2 -0
@@ -669,7 +669,9 @@ static void le_conn_timeout(struct work_struct *work)if (conn->role ==HCI_ROLE_SLAVE ) {/* Disable LE Advertising */ le_disable_advertising (hdev); +hci_dev_lock (hdev);hci_le_conn_failed (conn,HCI_ERROR_ADVERTISING_TIMEOUT ); +hci_dev_unlock (hdev);return ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 619/1017 Bluetooth: btmtksdio: Fix kernel oops in btmtksdio_interrupt
In reply to Greg Kroah-HartmanFrom: Yake Yang <[email protected]>
[ Upstream commit b062a0b9c1dc1ff63094337dccfe1568d5b62023 ]
Fix the following kernel oops in btmtksdio_interrrupt
[ 14.339134] btmtksdio_interrupt+0x28/0x54 [ 14.339139] process_sdio_pending_irqs+0x68/0x1a0 [ 14.339144] sdio_irq_work+0x40/0x70 [ 14.339154] process_one_work+0x184/0x39c [ 14.339160] worker_thread+0x228/0x3e8 [ 14.339168] kthread+0x148/0x3ac [ 14.339176] ret_from_fork+0x10/0x30
That happened because hdev->power_on is already called before sdio_set_drvdata which btmtksdio_interrupt handler relies on is not properly set up.
The details are shown as the below: hci_register_dev would run queue_work(hdev->req_workqueue, &hdev->power_on) as WQ_HIGHPRI workqueue_struct to complete the power-on sequeunce and thus hci_power_on may run before sdio_set_drvdata is done in btmtksdio_probe.
The hci_dev_do_open in hci_power_on would initialize the device and enable the interrupt and thus it is possible that btmtksdio_interrupt is being called right before sdio_set_drvdata is filled out.
When btmtksdio_interrupt is being called and sdio_set_drvdata is not filled , the kernel oops is going to happen because btmtksdio_interrupt access an uninitialized pointer.
--- drivers/bluetooth/btmtksdio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/bluetooth/btmtksdio.c +2 -2
@@ -981,6 +981,8 @@ static int btmtksdio_probe(struct sdio_func *func, hdev->manufacturer =70 ;set_bit (HCI_QUIRK_NON_PERSISTENT_SETUP , &hdev->quirks); +sdio_set_drvdata (func, bdev); + err =hci_register_dev (hdev);if (err <0 ) {dev_err (&func->dev,"Can't register HCI device\n" );
@@ -988,8 +990,6 @@ static int btmtksdio_probe(struct sdio_func *func,return err; } -sdio_set_drvdata (func, bdev); -/* pm_runtime_enable would be done after the firmware is being * downloaded because the core layer probably already enables * runtime PM for this func such as the case host->caps &
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 620/1017 RDMA/nldev: Prevent underflow in nldev_stat_set_counter_dynamic_doit()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 87e0eacb176f9500c2063d140c0a1d7fa51ab8a5 ]
This code checks "index" for an upper bound but it does not check for negatives. Change the type to unsigned to prevent underflows.
--- drivers/infiniband/core/nldev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/infiniband/core/nldev.c +2 -1
@@ -1951,9 +1951,10 @@ static int nldev_stat_set_counter_dynamic_doit(struct nlattr *tb[], u32 port) {struct rdma_hw_stats *stats; -int rem, i, index, ret =0 ;struct nlattr *entry_attr;unsigned long *target; +int rem, i, ret =0 ; +u32 index; stats =ib_get_hw_stats_port (device, port);if (!stats)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 621/1017 ipv4: Fix route lookups when handling ICMP redirects and PMTU updates
In reply to Greg Kroah-HartmanFrom: Guillaume Nault <[email protected]>
[ Upstream commit 544b4dd568e3b09c1ab38a759d3187e7abda11a0 ]
The PMTU update and ICMP redirect helper functions initialise their fl4 variable with either __build_flow_key() or build_sk_flow_key(). These initialisation functions always set ->flowi4_scope with RT_SCOPE_UNIVERSE and might set the ECN bits of ->flowi4_tos. This is not a problem when the route lookup is later done via ip_route_output_key_hash(), which properly clears the ECN bits from ->flowi4_tos and initialises ->flowi4_scope based on the RTO_ONLINK flag. However, some helpers call fib_lookup() directly, without sanitising the tos and scope fields, so the route lookup can fail and, as a result, the ICMP redirect or PMTU update aren't taken into account.
Fix this by extracting the ->flowi4_tos and ->flowi4_scope sanitisation code into ip_rt_fix_tos(), then use this function in handlers that call fib_lookup() directly.
Note 1: We can't sanitise ->flowi4_tos and ->flowi4_scope in a central place (like __build_flow_key() or flowi4_init_output()), because ip_route_output_key_hash() expects non-sanitised values. When called with sanitised values, it can erroneously overwrite RT_SCOPE_LINK with RT_SCOPE_UNIVERSE in ->flowi4_scope. Therefore we have to be careful to sanitise the values only for those paths that don't call ip_route_output_key_hash().
Note 2: The problem is mostly about sanitising ->flowi4_tos. Having ->flowi4_scope initialised with RT_SCOPE_UNIVERSE instead of RT_SCOPE_LINK probably wasn't really a problem: sockets with the SOCK_LOCALROUTE flag set (those that'd result in RTO_ONLINK being set) normally shouldn't receive ICMP redirects or PMTU updates.
--- net/ipv4/route.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
net/ipv4/route.c +14 -4
@@ -498,6 +498,15 @@ void __ip_select_ident(struct net *net, struct iphdr *iph, int segs) }EXPORT_SYMBOL (__ip_select_ident); +static void ip_rt_fix_tos (struct flowi4 *fl4) +{ +__u8 tos =RT_FL_TOS (fl4); + + fl4->flowi4_tos = tos &IPTOS_RT_MASK ; + fl4->flowi4_scope = tos &RTO_ONLINK ? +RT_SCOPE_LINK :RT_SCOPE_UNIVERSE ; +} + static void __build_flow_key(const struct net *net, struct flowi4 *fl4, const struct sock *sk, const struct iphdr *iph,
@@ -823,6 +832,7 @@ static void ip_do_redirect(struct dst_entry *dst, struct sock *sk, struct sk_buf rt = (struct rtable *) dst;__build_flow_key (net, &fl4, sk, iph, oif, tos, prot, mark,0 ); +ip_rt_fix_tos (&fl4);__ip_do_redirect (rt, skb, &fl4, true); }
@@ -1047,6 +1057,7 @@ static void ip_rt_update_pmtu(struct dst_entry *dst, struct sock *sk,struct flowi4 fl4;ip_rt_build_flow_key (&fl4, sk, skb); +ip_rt_fix_tos (&fl4);/* Don't make lookup fail for bridged encapsulations */ if (skb &&netif_is_any_bridge_port (skb->dev))
@@ -1121,6 +1132,8 @@ void ipv4_sk_update_pmtu(struct sk_buff *skb, struct sock *sk, u32 mtu) goto out; new = true; + }else { +ip_rt_fix_tos (&fl4); }__ip_rt_update_pmtu ((struct rtable *)xfrm_dst_path (&rt->dst), &fl4, mtu);
@@ -2601,7 +2614,6 @@ static struct rtable *__mkroute_output(const struct fib_result *res,struct rtable *ip_route_output_key_hash (struct net *net,struct flowi4 *fl4,const struct sk_buff *skb) { -__u8 tos =RT_FL_TOS (fl4);struct fib_result res = { .type =RTN_UNSPEC , .fi =NULL ,
@@ -2611,9 +2623,7 @@ struct rtable *ip_route_output_key_hash(struct net *net, struct flowi4 *fl4,struct rtable *rth; fl4->flowi4_iif =LOOPBACK_IFINDEX ; - fl4->flowi4_tos = tos &IPTOS_RT_MASK ; - fl4->flowi4_scope = ((tos &RTO_ONLINK ) ? -RT_SCOPE_LINK :RT_SCOPE_UNIVERSE ); +ip_rt_fix_tos (fl4);rcu_read_lock (); rth =ip_route_output_key_hash_rcu (net, fl4, &res, skb);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 622/1017 mptcp: Fix crash due to tcp_tsorted_anchor was initialized before release skb
In reply to Greg Kroah-HartmanFrom: Yonglong Li <[email protected]>
[ Upstream commit 3ef3905aa3b5b3e222ee6eb0210bfd999417a8cc ]
Got crash when doing pressure test of mptcp:
===========================================================================dst_release: dst:ffffa06ce6e5c058 refcnt:-1
kernel tried to execute NX-protected page - exploit attempt? (uid: 0)
BUG: unable to handle kernel paging request at ffffa06ce6e5c058 PGD 190a01067 P4D 190a01067 PUD 43fffb067 PMD 22e403063 PTE 8000000226e5c063 Oops: 0011 [#1] SMP PTI CPU: 7 PID: 7823 Comm: kworker/7:0 Kdump: loaded Tainted: G E Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.2.1 04/01/2014 Call Trace: ? skb_release_head_state+0x68/0x100 ? skb_release_all+0xe/0x30 ? kfree_skb+0x32/0xa0 ? mptcp_sendmsg_frag+0x57e/0x750 ? __mptcp_retrans+0x21b/0x3c0 ? __switch_to_asm+0x35/0x70 ? mptcp_worker+0x25e/0x320 ? process_one_work+0x1a7/0x360 ? worker_thread+0x30/0x390 ? create_worker+0x1a0/0x1a0 ? kthread+0x112/0x130 ? kthread_flush_work_fn+0x10/0x10 ? ret_from_fork+0x35/0x40 ===========================================================================
In __mptcp_alloc_tx_skb skb was allocated and skb->tcp_tsorted_anchor will be initialized, in under memory pressure situation sk_wmem_schedule will return false and then kfree_skb. In this case skb->_skb_refdst is not null because_skb_refdst and tcp_tsorted_anchor are stored in the same mem, and kfree_skb will try to release dst and cause crash.
--- net/mptcp/protocol.c | 1 + 1 file changed, 1 insertion(+)
net/mptcp/protocol.c +1 -0
@@ -1202,6 +1202,7 @@ static struct sk_buff *__mptcp_alloc_tx_skb(struct sock *sk, struct sock *ssk, gtcp_skb_entail (ssk, skb);return skb; } +tcp_skb_tsorted_anchor_cleanup (skb);kfree_skb (skb);return NULL ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 623/1017 af_netlink: Fix shift out of bounds in group mask calculation
In reply to Greg Kroah-HartmanFrom: Petr Machata <[email protected]>
[ Upstream commit 0caf6d9922192dd1afa8dc2131abfb4df1443b9f ]
When a netlink message is received, netlink_recvmsg() fills in the address of the sender. One of the fields is the 32-bit bitfield nl_groups, which carries the multicast group on which the message was received. The least significant bit corresponds to group 1, and therefore the highest group that the field can represent is 32. Above that, the UB sanitizer flags the out-of-bounds shift attempts.
Which bits end up being set in such case is implementation defined, but it's either going to be a wrong non-zero value, or zero, which is at least not misleading. Make the latter choice deterministic by always setting to 0 for higher-numbered multicast groups.
To get information about membership in groups >= 32, userspace is expected to use nl_pktinfo control messages[0], which are enabled by NETLINK_PKTINFO socket option.
[0] https://lwn.net/Articles/147608/
The way to trigger this issue is e.g. through monitoring the BRVLAN group:
# bridge monitor vlan & # ip link add name br type bridge
Which produces the following citation:
UBSAN: shift-out-of-bounds in net/netlink/af_netlink.c:162:19 shift exponent 32 is too large for 32-bit type 'int'
--- net/netlink/af_netlink.c | 2 ++ 1 file changed, 2 insertions(+)
net/netlink/af_netlink.c +2 -0
@@ -157,6 +157,8 @@ EXPORT_SYMBOL(do_trace_netlink_extack);static inline u32 netlink_group_mask (u32 group) { +if (group >32 ) +return 0 ;return group ?1 << (group -1 ) :0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 624/1017 i2c: meson: Fix wrong speed use from probe
In reply to Greg Kroah-HartmanFrom: Lucas Tanure <[email protected]>
[ Upstream commit cb13aa16f34f794a9cee2626862af8a95f0f0ee9 ]
Having meson_i2c_set_clk_div after i2c_add_adapter causes issues for client drivers that try to use the bus before the requested speed is applied.
The bus can be used just after i2c_add_adapter, so move i2c_add_adapter to the final step as meson_i2c_set_clk_div needs to be called before the bus is used.
--- drivers/i2c/busses/i2c-meson.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/i2c/busses/i2c-meson.c +6 -6
@@ -465,18 +465,18 @@ static int meson_i2c_probe(struct platform_device *pdev)*/ meson_i2c_set_mask (i2c,REG_CTRL ,REG_CTRL_START ,0 ); - ret =i2c_add_adapter (&i2c->adap); -if (ret <0 ) { -clk_disable_unprepare (i2c->clk); -return ret; - } -/* Disable filtering */ meson_i2c_set_mask (i2c,REG_SLAVE_ADDR ,REG_SLV_SDA_FILTER |REG_SLV_SCL_FILTER ,0 );meson_i2c_set_clk_div (i2c, timings.bus_freq_hz); + ret =i2c_add_adapter (&i2c->adap); +if (ret <0 ) { +clk_disable_unprepare (i2c->clk); +return ret; + } +return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 625/1017 netfilter: conntrack: Add and use nf_ct_set_auto_assign_helper_warned()
In reply to Greg Kroah-HartmanFrom: Phil Sutter <[email protected]>
[ Upstream commit 31d0bb9763efad30377505f3467f958d1ebe1e3d ]
The function sets the pernet boolean to avoid the spurious warning from nf_ct_lookup_helper() when assigning conntrack helpers via nftables.
--- include/net/netfilter/nf_conntrack_helper.h | 1 + net/netfilter/nf_conntrack_helper.c | 6 ++++++ net/netfilter/nft_ct.c | 3 +++ 3 files changed, 10 insertions(+)
include/net/netfilter/nf_conntrack_helper.h +1 -0
@@ -177,4 +177,5 @@ void nf_nat_helper_unregister(struct nf_conntrack_nat_helper *nat);int nf_nat_helper_try_module_get (const char *name,u16 l3num,u8 protonum);void nf_nat_helper_put (struct nf_conntrack_helper *helper); +void nf_ct_set_auto_assign_helper_warned (struct net *net);#endif /*_NF_CONNTRACK_HELPER_H*/
net/netfilter/nf_conntrack_helper.c +6 -0
@@ -556,6 +556,12 @@ static const struct nf_ct_ext_type helper_extend = { .id = NF_CT_EXT_HELPER, }; +void nf_ct_set_auto_assign_helper_warned (struct net *net) +{ +nf_ct_pernet (net)->auto_assign_helper_warned = true; +} +EXPORT_SYMBOL_GPL (nf_ct_set_auto_assign_helper_warned); +void nf_conntrack_helper_pernet_init (struct net *net) {struct nf_conntrack_net *cnet =nf_ct_pernet (net);
net/netfilter/nft_ct.c +3 -0
@@ -1040,6 +1040,9 @@ static int nft_ct_helper_obj_init(const struct nft_ctx *ctx,if (err <0 ) goto err_put_helper; +/* Avoid the bogus warning, helper will be assigned after CT init */ +nf_ct_set_auto_assign_helper_warned (ctx->net); +return 0 ; err_put_helper:
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 626/1017 i2c: mux: demux-pinctrl: do not deactivate a master that is not active
In reply to Greg Kroah-HartmanFrom: Peter Rosin <[email protected]>
[ Upstream commit 1a22aabf20adf89cb216f566913196128766f25b ]
Attempting to rollback the activation of the current master when the current master has not been activated is bad. priv->cur_chan and priv->cur_adap are both still zeroed out and the rollback may result in attempts to revert an of changeset that has not been applied and do result in calls to both del and put the zeroed out i2c_adapter. Maybe it crashes, or whatever, but it's bad in any case.
--- drivers/i2c/muxes/i2c-demux-pinctrl.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/i2c/muxes/i2c-demux-pinctrl.c +3 -2
@@ -261,7 +261,7 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) err =device_create_file (&pdev->dev, &dev_attr_available_masters);if (err) - goto err_rollback; + goto err_rollback_activation; err =device_create_file (&pdev->dev, &dev_attr_current_master);if (err)
@@ -271,8 +271,9 @@ static int i2c_demux_pinctrl_probe(struct platform_device *pdev) err_rollback_available:device_remove_file (&pdev->dev, &dev_attr_available_masters); -err_rollback: +err_rollback_activation:i2c_demux_deactivate_master (priv); +err_rollback:for (j =0 ; j < i; j++) {of_node_put (priv->chan[j].parent_np);of_changeset_destroy (&priv->chan[j].chgset);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 627/1017 powerpc/pseries: Fix use after free in remove_phb_dynamic()
In reply to Greg Kroah-HartmanFrom: Michael Ellerman <[email protected]>
[ Upstream commit fe2640bd7a62f1f7c3f55fbda31084085075bc30 ]
In remove_phb_dynamic() we use &phb->io_resource, after we've called device_unregister(&host_bridge->dev). But the unregister may have freed phb, because pcibios_free_controller_deferred() is the release function for the host_bridge.
If there are no outstanding references when we call device_unregister() then phb will be freed out from under us.
This has gone mainly unnoticed, but with slub_debug and page_poison enabled it can lead to a crash:
PID: 7574 TASK: c0000000d492cb80 CPU: 13 COMMAND: "drmgr"
#0 [c0000000e4f075a0] crash_kexec at c00000000027d7dc
#1 [c0000000e4f075d0] oops_end at c000000000029608
#2 [c0000000e4f07650] __bad_page_fault at c0000000000904b4 #3 [c0000000e4f076c0] do_bad_slb_fault at c00000000009a5a8 #4 [c0000000e4f076f0] data_access_slb_common_virt at c000000000008b30 Data SLB Access [380] exception frame:
R0: c000000000167250 R1: c0000000e4f07a00 R2: c000000002a46100 R3: c000000002b39ce8 R4: 00000000000000c0 R5: 00000000000000a9 R6: 3894674d000000c0 R7: 0000000000000000 R8: 00000000000000ff R9: 0000000000000100 R10: 6b6b6b6b6b6b6b6b R11: 0000000000008000 R12: c00000000023da80 R13: c0000009ffd38b00 R14: 0000000000000000 R15: 000000011c87f0f0 R16: 0000000000000006 R17: 0000000000000003 R18: 0000000000000002 R19: 0000000000000004 R20: 0000000000000005 R21: 000000011c87ede8 R22: 000000011c87c5a8 R23: 000000011c87d3a0 R24: 0000000000000000 R25: 0000000000000001 R26: c0000000e4f07cc8 R27: c00000004d1cc400 R28: c0080000031d00e8 R29: c00000004d23d800 R30: c00000004d1d2400 R31: c00000004d1d2540 NIP: c000000000167258 MSR: 8000000000009033 OR3: c000000000e9f474 CTR: 0000000000000000 LR: c000000000167250 XER: 0000000020040003 CCR: 0000000024088420 MQ: 0000000000000000 DAR: 6b6b6b6b6b6b6ba3
DSISR: c0000000e4f07920 Syscall Result: fffffffffffffff2
[NIP : release_resource+56]
[LR : release_resource+48]
#5 [c0000000e4f07a00] release_resource at c000000000167258 (unreliable) #6 [c0000000e4f07a30] remove_phb_dynamic at c000000000105648 #7 [c0000000e4f07ab0] dlpar_remove_slot at c0080000031a09e8 [rpadlpar_io] #8 [c0000000e4f07b50] remove_slot_store at c0080000031a0b9c [rpadlpar_io] #9 [c0000000e4f07be0] kobj_attr_store at c000000000817d8c
#10 [c0000000e4f07c00] sysfs_kf_write at c00000000063e504
#11 [c0000000e4f07c20] kernfs_fop_write_iter at c00000000063d868 #12 [c0000000e4f07c70] new_sync_write at c00000000054339c
#13 [c0000000e4f07d10] vfs_write at c000000000546624
#14 [c0000000e4f07d60] ksys_write at c0000000005469f4
#15 [c0000000e4f07db0] system_call_exception at c000000000030840 #16 [c0000000e4f07e10] system_call_vectored_common at c00000000000c168
To avoid it, we can take a reference to the host_bridge->dev until we're done using phb. Then when we drop the reference the phb will be freed.
--- arch/powerpc/platforms/pseries/pci_dlpar.c | 4 ++++ 1 file changed, 4 insertions(+)
arch/powerpc/platforms/pseries/pci_dlpar.c +4 -0
@@ -78,6 +78,9 @@ int remove_phb_dynamic(struct pci_controller *phb)pseries_msi_free_domains (phb); +/* Keep a reference so phb isn't freed yet */ +get_device (&host_bridge->dev); +/* Remove the PCI bus and unregister the bridge device from sysfs */ phb->bus =NULL ;pci_remove_bus (b);
@@ -101,6 +104,7 @@ int remove_phb_dynamic(struct pci_controller *phb)* the pcibios_free_controller_deferred() callback; * see pseries_root_bridge_prepare(). */ +put_device (&host_bridge->dev);return 0 ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 628/1017 selftests/bpf/test_lirc_mode2.sh: Exit with proper code
In reply to Greg Kroah-HartmanFrom: Hangbin Liu <[email protected]>
[ Upstream commit ec80906b0fbd7be11e3e960813b977b1ffe5f8fe ]
When test_lirc_mode2_user exec failed, the test report failed but still exit with 0. Fix it by exiting with an error code.
Another issue is for the LIRCDEV checking. With bash -n, we need to quote the variable, or it will always be true. So if test_lirc_mode2_user was not run, just exit with skip code.
--- tools/testing/selftests/bpf/test_lirc_mode2.sh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
tools/testing/selftests/bpf/test_lirc_mode2.sh +4 -1
@@ -3,6 +3,7 @@ # Kselftest framework requirement - SKIP code is 4. ksft_skip=4 +ret=$ksft_skip msg="skip all tests:" if [ $UID != 0 ]; then
@@ -25,7 +26,7 @@ do fi done -if [ -n $LIRCDEV ]; +if [ -n "$LIRCDEV" ]; then TYPE=lirc_mode2 ./test_lirc_mode2_user $LIRCDEV $INPUTDEV
@@ -36,3 +37,5 @@ then echo -e ${GREEN}"PASS: $TYPE"${NC} fi fi + +exit $ret
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 629/1017 bpftool: Fix print error when show bpf map
In reply to Greg Kroah-HartmanFrom: Yafang Shao <[email protected]>
[ Upstream commit 1824d8ea75f275a5e69e5f6bc0ffe122ea9b938c ]
If there is no btf_id or frozen, it will not show the pids, but the pids don't depend on any one of them.
Below is the result after this change:
$ ./bpftool map show 2: lpm_trie flags 0x1 key 8B value 8B max_entries 1 memlock 4096B pids systemd(1) 3: lpm_trie flags 0x1 key 20B value 8B max_entries 1 memlock 4096B pids systemd(1)
While before this change, the 'pids systemd(1)' can't be displayed.
--- tools/bpf/bpftool/map.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
tools/bpf/bpftool/map.c +2 -5
@@ -619,17 +619,14 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info) u32_as_hash_field(info->id))printf ("\n\tpinned %s" , (char *)entry->value); } -printf ("\n" );if (frozen_str) { frozen =atoi (frozen_str);free (frozen_str); } -if (!info->btf_id && !frozen) -return 0 ; - -printf ("\t" ); +if (info->btf_id || frozen) +printf ("\n\t" );if (info->btf_id)printf ("btf_id %d" , info->btf_id);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 630/1017 PCI: Avoid broken MSI on SB600 USB devices
In reply to Greg Kroah-HartmanFrom: Bjorn Helgaas <[email protected]>
[ Upstream commit 63cd736f449445edcd7f0bcc7d84453e9beec0aa ]
Some ATI SB600 USB adapters advertise MSI, but if INTx is disabled by setting PCI_COMMAND_INTX_DISABLE, MSI doesn't work either. The PCI/PCIe specs do not require software to set PCI_COMMAND_INTX_DISABLE when enabling MSI, but Linux has done that for many years.
Mick reported that 306c54d0edb6 ("usb: hcd: Try MSI interrupts on PCI devices") broke these devices. Prior to 306c54d0edb6, they used INTx. Starting with 306c54d0edb6, they use MSI, and and the fact that Linux sets PCI_COMMAND_INTX_DISABLE means both INTx and MSI are disabled on these devices.
Avoid this SB600 defect by disabling MSI so we use INTx as before.
--- drivers/pci/quirks.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/pci/quirks.c +12 -0
@@ -1811,6 +1811,18 @@ static void quirk_alder_ioapic(struct pci_dev *pdev)DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_INTEL ,PCI_DEVICE_ID_INTEL_EESSC , quirk_alder_ioapic);#endif +static void quirk_no_msi (struct pci_dev *dev) +{ +pci_info (dev,"avoiding MSI to work around a hardware defect\n" ); + dev->no_msi =1 ; +} +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4386 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4387 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4388 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x4389 , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x438a , quirk_no_msi); +DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,0x438b , quirk_no_msi); +static void quirk_pcie_mch (struct pci_dev *pdev) { pdev->no_msi =1 ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 631/1017 net: bcmgenet: Use stronger register read/writes to assure ordering
In reply to Greg Kroah-HartmanFrom: Jeremy Linton <[email protected]>
[ Upstream commit 8d3ea3d402db94b61075617e71b67459a714a502 ]
GCC12 appears to be much smarter about its dependency tracking and is aware that the relaxed variants are just normal loads and stores and this is causing problems like:
[ 210.074549] ------------[ cut here ]------------ [ 210.079223] NETDEV WATCHDOG: enabcm6e4ei0 (bcmgenet): transmit queue 1 timed out [ 210.086717] WARNING: CPU: 1 PID: 0 at net/sched/sch_generic.c:529 dev_watchdog+0x234/0x240 [ 210.095044] Modules linked in: genet(E) nft_fib_inet nft_fib_ipv4 nft_fib_ipv6 nft_fib nft_reject_inet nf_reject_ipv4 nf_reject_ipv6 nft_reject nft_ct nft_chain_nat] [ 210.146561] ACPI CPPC: PCC check channel failed for ss: 0. ret=-110 [ 210.146927] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G E 5.17.0-rc7G12+ #58 [ 210.153226] CPPC Cpufreq:cppc_scale_freq_workfn: failed to read perf counters [ 210.161349] Hardware name: Raspberry Pi Foundation Raspberry Pi 4 Model B/Raspberry Pi 4 Model B, BIOS EDK2-DEV 02/08/2022 [ 210.161353] pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 210.161358] pc : dev_watchdog+0x234/0x240 [ 210.161364] lr : dev_watchdog+0x234/0x240 [ 210.161368] sp : ffff8000080a3a40 [ 210.161370] x29: ffff8000080a3a40 x28: ffffcd425af87000 x27: ffff8000080a3b20 [ 210.205150] x26: ffffcd425aa00000 x25: 0000000000000001 x24: ffffcd425af8ec08 [ 210.212321] x23: 0000000000000100 x22: ffffcd425af87000 x21: ffff55b142688000 [ 210.219491] x20: 0000000000000001 x19: ffff55b1426884c8 x18: ffffffffffffffff [ 210.226661] x17: 64656d6974203120 x16: 0000000000000001 x15: 6d736e617274203a [ 210.233831] x14: 2974656e65676d63 x13: ffffcd4259c300d8 x12: ffffcd425b07d5f0 [ 210.241001] x11: 00000000ffffffff x10: ffffcd425b07d5f0 x9 : ffffcd4258bdad9c [ 210.248171] x8 : 00000000ffffdfff x7 : 000000000000003f x6 : 0000000000000000 [ 210.255341] x5 : 0000000000000000 x4 : 0000000000000000 x3 : 0000000000001000 [ 210.262511] x2 : 0000000000001000 x1 : 0000000000000005 x0 : 0000000000000044 [ 210.269682] Call trace: [ 210.272133] dev_watchdog+0x234/0x240 [ 210.275811] call_timer_fn+0x3c/0x15c [ 210.279489] __run_timers.part.0+0x288/0x310 [ 210.283777] run_timer_softirq+0x48/0x80 [ 210.287716] __do_softirq+0x128/0x360 [ 210.291392] __irq_exit_rcu+0x138/0x140 [ 210.295243] irq_exit_rcu+0x1c/0x30 [ 210.298745] el1_interrupt+0x38/0x54 [ 210.302334] el1h_64_irq_handler+0x18/0x24 [ 210.306445] el1h_64_irq+0x7c/0x80 [ 210.309857] arch_cpu_idle+0x18/0x2c [ 210.313445] default_idle_call+0x4c/0x140 [ 210.317470] cpuidle_idle_call+0x14c/0x1a0 [ 210.321584] do_idle+0xb0/0x100 [ 210.324737] cpu_startup_entry+0x30/0x8c [ 210.328675] secondary_start_kernel+0xe4/0x110 [ 210.333138] __secondary_switched+0x94/0x98
The assumption when these were relaxed seems to be that device memory would be mapped non reordering, and that other constructs (spinlocks/etc) would provide the barriers to assure that packet data and in memory rings/queues were ordered with respect to device register reads/writes. This itself seems a bit sketchy, but the real problem with GCC12 is that it is moving the actual reads/writes around at will as though they were independent operations when in truth they are not, but the compiler can't know that. When looking at the assembly dumps for many of these routines its possible to see very clean, but not strictly in program order operations occurring as the compiler would be free to do if these weren't actually register reads/write operations.
Its possible to suppress the timeout with a liberal bit of dma_mb()'s sprinkled around but the device still seems unable to reliably send/receive data. A better plan is to use the safer readl/writel everywhere.
Since this partially reverts an older commit, which notes the use of the relaxed variants for performance reasons. I would suggest that any performance problems with this commit are targeted at relaxing only the performance critical code paths after assuring proper barriers.
--- drivers/net/ethernet/broadcom/genet/bcmgenet.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/genet/bcmgenet.c +2 -2
@@ -76,7 +76,7 @@ static inline void bcmgenet_writel(u32 value, void __iomem *offset)if (IS_ENABLED (CONFIG_MIPS ) &&IS_ENABLED (CONFIG_CPU_BIG_ENDIAN ))__raw_writel (value, offset);else -writel_relaxed (value, offset); +writel (value, offset); }static inline u32 bcmgenet_readl (void __iomem *offset)
@@ -84,7 +84,7 @@ static inline u32 bcmgenet_readl(void __iomem *offset)if (IS_ENABLED (CONFIG_MIPS ) &&IS_ENABLED (CONFIG_CPU_BIG_ENDIAN ))return __raw_readl (offset);else -return readl_relaxed (offset); +return readl (offset); } static inline void dmadesc_set_length_status(struct bcmgenet_priv *priv,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 632/1017 tcp: ensure PMTU updates are processed during fastopen
In reply to Greg Kroah-HartmanFrom: Jakub Kicinski <[email protected]>
[ Upstream commit ed0c99dc0f499ff8b6e75b5ae6092ab42be1ad39 ]
tp->rx_opt.mss_clamp is not populated, yet, during TFO send so we rise it to the local MSS. tp->mss_cache is not updated, however:
tcp_v6_connect():
tp->rx_opt.mss_clamp = IPV6_MIN_MTU - headers;
tcp_connect():
tcp_connect_init():
tp->mss_cache = min(mtu, tp->rx_opt.mss_clamp)
tcp_send_syn_data():
tp->rx_opt.mss_clamp = tp->advmssAfter recent fixes to ICMPv6 PTB handling we started dropping PMTU updates higher than tp->mss_cache. Because of the stale tp->mss_cache value PMTU updates during TFO are always dropped.
Thanks to Wei for helping zero in on the problem and the fix!
--- net/ipv4/tcp_output.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/ipv4/tcp_output.c +4 -1
@@ -3719,6 +3719,7 @@ static void tcp_connect_queue_skb(struct sock *sk, struct sk_buff *skb)*/ static int tcp_send_syn_data (struct sock *sk,struct sk_buff *syn) { +struct inet_connection_sock *icsk =inet_csk (sk);struct tcp_sock *tp =tcp_sk (sk);struct tcp_fastopen_request *fo = tp->fastopen_req;int space, err =0 ;
@@ -3733,8 +3734,10 @@ static int tcp_send_syn_data(struct sock *sk, struct sk_buff *syn)* private TCP options. The cost is reduced data space in SYN :( */ tp->rx_opt.mss_clamp =tcp_mss_clamp (tp, tp->rx_opt.mss_clamp); +/* Sync mss_cache after updating the mss_clamp */ +tcp_sync_mss (sk, icsk->icsk_pmtu_cookie); - space =__tcp_mtu_to_mss (sk,inet_csk (sk)->icsk_pmtu_cookie) - + space =__tcp_mtu_to_mss (sk, icsk->icsk_pmtu_cookie) -MAX_TCP_OPTION_SPACE ; space =min_t (size_t, space, fo->size);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 633/1017 openvswitch: always update flow key after nat
In reply to Greg Kroah-HartmanFrom: Aaron Conole <[email protected]>
[ Upstream commit 60b44ca6bd7518dd38fa2719bc9240378b6172c3 ]
During NAT, a tuple collision may occur. When this happens, openvswitch will make a second pass through NAT which will perform additional packet modification. This will update the skb data, but not the flow key that OVS uses. This means that future flow lookups, and packet matches will have incorrect data. This has been supported since 5d50aa83e2c8 ("openvswitch: support asymmetric conntrack").
That commit failed to properly update the sw_flow_key attributes, since it only called the ovs_ct_nat_update_key once, rather than each time ovs_ct_nat_execute was called. As these two operations are linked, the ovs_ct_nat_execute() function should always make sure that the sw_flow_key is updated after a successful call through NAT infrastructure.
--- net/openvswitch/conntrack.c | 118 ++++++++++++++++++------------------ 1 file changed, 59 insertions(+), 59 deletions(-)
net/openvswitch/conntrack.c +59 -59
@@ -732,6 +732,57 @@ static bool skb_nfct_cached(struct net *net, }#if IS_ENABLED (CONFIG_NF_NAT ) +static void ovs_nat_update_key (struct sw_flow_key *key, +const struct sk_buff *skb, +enum nf_nat_manip_type maniptype) +{ +if (maniptype ==NF_NAT_MANIP_SRC ) { +__be16 src; + + key->ct_state |=OVS_CS_F_SRC_NAT ; +if (key->eth.type ==htons (ETH_P_IP )) + key->ipv4.addr.src =ip_hdr (skb)->saddr; +else if (key->eth.type ==htons (ETH_P_IPV6 )) +memcpy (&key->ipv6.addr.src, &ipv6_hdr (skb)->saddr, +sizeof (key->ipv6.addr.src)); +else +return ; + +if (key->ip.proto ==IPPROTO_UDP ) + src =udp_hdr (skb)->source; +else if (key->ip.proto ==IPPROTO_TCP ) + src =tcp_hdr (skb)->source; +else if (key->ip.proto ==IPPROTO_SCTP ) + src =sctp_hdr (skb)->source; +else +return ; + + key->tp.src = src; + }else { +__be16 dst; + + key->ct_state |=OVS_CS_F_DST_NAT ; +if (key->eth.type ==htons (ETH_P_IP )) + key->ipv4.addr.dst =ip_hdr (skb)->daddr; +else if (key->eth.type ==htons (ETH_P_IPV6 )) +memcpy (&key->ipv6.addr.dst, &ipv6_hdr (skb)->daddr, +sizeof (key->ipv6.addr.dst)); +else +return ; + +if (key->ip.proto ==IPPROTO_UDP ) + dst =udp_hdr (skb)->dest; +else if (key->ip.proto ==IPPROTO_TCP ) + dst =tcp_hdr (skb)->dest; +else if (key->ip.proto ==IPPROTO_SCTP ) + dst =sctp_hdr (skb)->dest; +else +return ; + + key->tp.dst = dst; + } +} +/* Modelled after nf_nat_ipv[46]_fn(). * range is only used for new, uninitialized NAT state. * Returns either NF_ACCEPT or NF_DROP.
@@ -739,7 +790,7 @@ static bool skb_nfct_cached(struct net *net,static int ovs_ct_nat_execute (struct sk_buff *skb,struct nf_conn *ct,enum ip_conntrack_info ctinfo,const struct nf_nat_range2 *range, -enum nf_nat_manip_type maniptype) +enum nf_nat_manip_type maniptype,struct sw_flow_key *key) {int hooknum, nh_off, err =NF_ACCEPT ;
@@ -811,58 +862,11 @@ static int ovs_ct_nat_execute(struct sk_buff *skb, struct nf_conn *ct, push:skb_push_rcsum (skb, nh_off); -return err; -} - -static void ovs_nat_update_key (struct sw_flow_key *key, -const struct sk_buff *skb, -enum nf_nat_manip_type maniptype) -{ -if (maniptype ==NF_NAT_MANIP_SRC ) { -__be16 src; - - key->ct_state |=OVS_CS_F_SRC_NAT ; -if (key->eth.type ==htons (ETH_P_IP )) - key->ipv4.addr.src =ip_hdr (skb)->saddr; -else if (key->eth.type ==htons (ETH_P_IPV6 )) -memcpy (&key->ipv6.addr.src, &ipv6_hdr (skb)->saddr, -sizeof (key->ipv6.addr.src)); -else -return ; - -if (key->ip.proto ==IPPROTO_UDP ) - src =udp_hdr (skb)->source; -else if (key->ip.proto ==IPPROTO_TCP ) - src =tcp_hdr (skb)->source; -else if (key->ip.proto ==IPPROTO_SCTP ) - src =sctp_hdr (skb)->source; -else -return ; - - key->tp.src = src; - }else { -__be16 dst; - - key->ct_state |=OVS_CS_F_DST_NAT ; -if (key->eth.type ==htons (ETH_P_IP )) - key->ipv4.addr.dst =ip_hdr (skb)->daddr; -else if (key->eth.type ==htons (ETH_P_IPV6 )) -memcpy (&key->ipv6.addr.dst, &ipv6_hdr (skb)->daddr, -sizeof (key->ipv6.addr.dst)); -else -return ; - -if (key->ip.proto ==IPPROTO_UDP ) - dst =udp_hdr (skb)->dest; -else if (key->ip.proto ==IPPROTO_TCP ) - dst =tcp_hdr (skb)->dest; -else if (key->ip.proto ==IPPROTO_SCTP ) - dst =sctp_hdr (skb)->dest; -else -return ; +/* Update the flow key if NAT successful. */ +if (err ==NF_ACCEPT ) +ovs_nat_update_key (key, skb, maniptype); - key->tp.dst = dst; - } +return err; }/* Returns NF_DROP if the packet should be dropped, NF_ACCEPT otherwise. */
@@ -904,7 +908,7 @@ static int ovs_ct_nat(struct net *net, struct sw_flow_key *key, }else {return NF_ACCEPT ;/* Connection is not NATed. */ } - err =ovs_ct_nat_execute (skb, ct, ctinfo, &info->range, maniptype); + err =ovs_ct_nat_execute (skb, ct, ctinfo, &info->range, maniptype, key);if (err ==NF_ACCEPT && ct->status &IPS_DST_NAT ) {if (ct->status &IPS_SRC_NAT ) {
@@ -914,17 +918,13 @@ static int ovs_ct_nat(struct net *net, struct sw_flow_key *key, maniptype =NF_NAT_MANIP_SRC ; err =ovs_ct_nat_execute (skb, ct, ctinfo, &info->range, - maniptype); + maniptype, key); }else if (CTINFO2DIR (ctinfo) ==IP_CT_DIR_ORIGINAL ) { err =ovs_ct_nat_execute (skb, ct, ctinfo,NULL , -NF_NAT_MANIP_SRC ); +NF_NAT_MANIP_SRC , key); } } -/* Mark NAT done if successful and update the flow key. */ -if (err ==NF_ACCEPT ) -ovs_nat_update_key (key, skb, maniptype); -return err; }#else /* !CONFIG_NF_NAT */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 634/1017 net: dsa: fix panic on shutdown if multi-chip tree failed to probe
In reply to Greg Kroah-HartmanFrom: Vladimir Oltean <[email protected]>
[ Upstream commit 8fd36358ce82382519b50b05f437493e1e00c4a9 ]
DSA probing is atypical because a tree of devices must probe all at once, so out of N switches which call dsa_tree_setup_routing_table() during probe, for (N - 1) of them, "complete" will return false and they will exit probing early. The Nth switch will set up the whole tree on their behalf.
The implication is that for (N - 1) switches, the driver binds to the device successfully, without doing anything. When the driver is bound, the ->shutdown() method may run. But if the Nth switch has failed to initialize the tree, there is nothing to do for the (N - 1) driver instances, since the slave devices have not been created, etc. Moreover, dsa_switch_shutdown() expects that the calling @ds has been in fact initialized, so it jumps at dereferencing the various data structures, which is incorrect.
Avoid the ensuing NULL pointer dereferences by simply checking whether the Nth switch has previously set "ds->setup = true" for the switch which is currently shutting down. The entire setup is serialized under dsa2_mutex which we already hold.
--- net/dsa/dsa2.c | 5 +++++ 1 file changed, 5 insertions(+)
net/dsa/dsa2.c +5 -0
@@ -1613,6 +1613,10 @@ void dsa_switch_shutdown(struct dsa_switch *ds)struct dsa_port *dp;mutex_lock (&dsa2_mutex); + +if (!ds->setup) + goto out; +rtnl_lock ();dsa_switch_for_each_user_port (dp, ds) {
@@ -1629,6 +1633,7 @@ void dsa_switch_shutdown(struct dsa_switch *ds) dp->master->dsa_ptr =NULL ;rtnl_unlock (); +out:mutex_unlock (&dsa2_mutex); }EXPORT_SYMBOL_GPL (dsa_switch_shutdown);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 635/1017 tipc: fix the timer expires after interval 100ms
In reply to Greg Kroah-HartmanFrom: Hoang Le <[email protected]>
[ Upstream commit 6a7d8cff4a3301087dd139293e9bddcf63827282 ]
In the timer callback function tipc_sk_timeout(), we're trying to reschedule another timeout to retransmit a setup request if destination link is congested. But we use the incorrect timeout value (msecs_to_jiffies(100)) instead of (jiffies + msecs_to_jiffies(100)), so that the timer expires immediately, it's irrelevant for original description.
In this commit we correct the timeout value in sk_reset_timer()
--- net/tipc/socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/tipc/socket.c +2 -1
@@ -2852,7 +2852,8 @@ static void tipc_sk_retry_connect(struct sock *sk, struct sk_buff_head *list)/* Try again later if dest link is congested */ if (tsk->cong_link_cnt) { -sk_reset_timer (sk, &sk->sk_timer,msecs_to_jiffies (100 )); +sk_reset_timer (sk, &sk->sk_timer, + jiffies +msecs_to_jiffies (100 ));return ; }/* Prepare SYN for retransmit */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 636/1017 mfd: asic3: Add missing iounmap() on error asic3_mfd_probe
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit e84ee1a75f944a0fe3c277aaa10c426603d2b0bc ]
Add the missing iounmap() before return from asic3_mfd_probe in the error handling case.
--- drivers/mfd/asic3.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/mfd/asic3.c +7 -3
@@ -906,14 +906,14 @@ static int __init asic3_mfd_probe(struct platform_device *pdev, ret =mfd_add_devices (&pdev->dev, pdev->id, &asic3_cell_ds1wm,1 , mem, asic->irq_base,NULL );if (ret <0 ) - goto out; + goto out_unmap; }if (mem_sdio && (irq >=0 )) { ret =mfd_add_devices (&pdev->dev, pdev->id, &asic3_cell_mmc,1 , mem_sdio, irq,NULL );if (ret <0 ) - goto out; + goto out_unmap; } ret =0 ;
@@ -927,8 +927,12 @@ static int __init asic3_mfd_probe(struct platform_device *pdev, ret =mfd_add_devices (&pdev->dev,0 , asic3_cell_leds,ASIC3_NUM_LEDS ,NULL ,0 ,NULL ); } +return ret; - out: +out_unmap: +if (asic->tmio_cnf) +iounmap (asic->tmio_cnf); +out:return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 637/1017 ice: fix scheduling while atomic on aux critical err interrupt
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 32d53c0aa3a7b727243473949bad2a830b908edc ]
There's a kernel BUG splat on processing aux critical error interrupts in ice_misc_intr():
[ 2100.917085] BUG: scheduling while atomic: swapper/15/0/0x00010000 ... [ 2101.060770] Call Trace: [ 2101.063229] <IRQ> [ 2101.065252] dump_stack+0x41/0x60 [ 2101.068587] __schedule_bug.cold.100+0x4c/0x58 [ 2101.073060] __schedule+0x6a4/0x830 [ 2101.076570] schedule+0x35/0xa0 [ 2101.079727] schedule_preempt_disabled+0xa/0x10 [ 2101.084284] __mutex_lock.isra.7+0x310/0x420 [ 2101.088580] ? ice_misc_intr+0x201/0x2e0 [ice] [ 2101.093078] ice_send_event_to_aux+0x25/0x70 [ice] [ 2101.097921] ice_misc_intr+0x220/0x2e0 [ice] [ 2101.102232] __handle_irq_event_percpu+0x40/0x180 [ 2101.106965] handle_irq_event_percpu+0x30/0x80 [ 2101.111434] handle_irq_event+0x36/0x53 [ 2101.115292] handle_edge_irq+0x82/0x190 [ 2101.119148] handle_irq+0x1c/0x30 [ 2101.122480] do_IRQ+0x49/0xd0 [ 2101.125465] common_interrupt+0xf/0xf [ 2101.129146] </IRQ>
...
As Andrew correctly mentioned previously[0], the following call ladder happens:
ice_misc_intr() <- hardirq
ice_send_event_to_aux()
device_lock()
mutex_lock()
might_sleep()
might_resched() <- oops
Add a new PF state bit which indicates that an aux critical error occurred and serve it in ice_service_task() in process context. The new ice_pf::oicr_err_reg is read-write in both hardirq and process contexts, but only 3 bits of non-critical data probably aren't worth explicit synchronizing (and they're even in the same byte [31:24]).
[0] https://lore.kernel.org/all/[email protected]
--- drivers/net/ethernet/intel/ice/ice.h | 2 ++ drivers/net/ethernet/intel/ice/ice_main.c | 25 ++++++++++++++--------- 2 files changed, 17 insertions(+), 10 deletions(-)
drivers/net/ethernet/intel/ice/ice.h +2 -0
@@ -290,6 +290,7 @@ enum ice_pf_state {ICE_LINK_DEFAULT_OVERRIDE_PENDING ,ICE_PHY_INIT_COMPLETE ,ICE_FD_VF_FLUSH_CTX ,/* set at FD Rx IRQ or timeout */ +ICE_AUX_ERR_PENDING , ICE_STATE_NBITS /* must be last */ };
@@ -557,6 +558,7 @@ struct ice_pf {wait_queue_head_t reset_wait_queue;u32 hw_csum_rx_error; +u32 oicr_err_reg;u16 oicr_idx;/* Other interrupt cause MSIX vector index */ u16 num_avail_sw_msix;/* remaining MSIX SW vectors left unclaimed */ u16 max_pf_txqs;/* Total Tx queues PF wide */
drivers/net/ethernet/intel/ice/ice_main.c +15 -10
@@ -2237,6 +2237,19 @@ static void ice_service_task(struct work_struct *work)return ; } +if (test_and_clear_bit (ICE_AUX_ERR_PENDING , pf->state)) { +struct iidc_event *event; + + event =kzalloc (sizeof (*event),GFP_KERNEL ); +if (event) { +set_bit (IIDC_EVENT_CRIT_ERR , event->type); +/* report the entire OICR value to AUX driver */ +swap (event->reg, pf->oicr_err_reg); +ice_send_event_to_aux (pf, event); +kfree (event); + } + } +if (test_bit (ICE_FLAG_PLUG_AUX_DEV , pf->flags)) {/* Plug aux device per request */ ice_plug_aux_dev (pf);
@@ -3023,17 +3036,9 @@ static irqreturn_t ice_misc_intr(int __always_unused irq, void *data)#define ICE_AUX_CRIT_ERR (PFINT_OICR_PE_CRITERR_M | PFINT_OICR_HMC_ERR_M | PFINT_OICR_PE_PUSH_M)if (oicr &ICE_AUX_CRIT_ERR ) { -struct iidc_event *event; - + pf->oicr_err_reg |= oicr; +set_bit (ICE_AUX_ERR_PENDING , pf->state); ena_mask &= ~ICE_AUX_CRIT_ERR ; - event =kzalloc (sizeof (*event),GFP_ATOMIC ); -if (event) { -set_bit (IIDC_EVENT_CRIT_ERR , event->type); -/* report the entire OICR value to AUX driver */ - event->reg = oicr; -ice_send_event_to_aux (pf, event); -kfree (event); - } }/* Report any remaining unexpected interrupts */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 638/1017 ice: dont allow to run ice_send_event_to_aux() in atomic ctx
In reply to Greg Kroah-HartmanFrom: Alexander Lobakin <[email protected]>
[ Upstream commit 5a3156932da06f09953764de113419f254086faf ]
ice_send_event_to_aux() eventually descends to mutex_lock() (-> might_sched()), so it must not be called under non-task context. However, at least two fixes have happened already for the bug splats occurred due to this function being called from atomic context.
To make the emergency landings softer, bail out early when executed in non-task context emitting a warn splat only once. This way we trade some events being potentially lost for system stability and avoid any related hangs and crashes.
--- drivers/net/ethernet/intel/ice/ice_idc.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/ethernet/intel/ice/ice_idc.c +3 -0
@@ -34,6 +34,9 @@ void ice_send_event_to_aux(struct ice_pf *pf, struct iidc_event *event) {struct iidc_auxiliary_drv *iadrv; +if (WARN_ON_ONCE (!in_task ())) +return ; +if (!pf->adev)return ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 639/1017 drivers: ethernet: cpsw: fix panic when interrupt coaleceing is set via ethtool
In reply to Greg Kroah-HartmanFrom: Sondhauß, Jan <[email protected]>
[ Upstream commit 2844e2434385819f674d1fb4130c308c50ba681e ]
cpsw_ethtool_begin directly returns the result of pm_runtime_get_sync when successful.pm_runtime_get_sync returns -error code on failure and 0 on successful resume but also 1 when the device is already active. So the common case for cpsw_ethtool_begin is to return 1. That leads to inconsistent calls to pm_runtime_put in the call-chain so that pm_runtime_put is called one too many times and as result leaving the cpsw dev behind suspended.
The suspended cpsw dev leads to an access violation later on by different parts of the cpsw driver.
Fix this by calling the return-friendly pm_runtime_resume_and_get function.
--- drivers/net/ethernet/ti/cpsw_ethtool.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/net/ethernet/ti/cpsw_ethtool.c +2 -4
@@ -364,11 +364,9 @@ int cpsw_ethtool_op_begin(struct net_device *ndev)struct cpsw_common *cpsw = priv->cpsw;int ret; - ret =pm_runtime_get_sync (cpsw->dev); -if (ret <0 ) { + ret =pm_runtime_resume_and_get (cpsw->dev); +if (ret <0 )cpsw_err (priv, drv,"ethtool begin failed %d\n" , ret); -pm_runtime_put_noidle (cpsw->dev); - }return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 640/1017 kernel/resource: fix kfree() of bootmem memory again
In reply to Greg Kroah-HartmanFrom: Miaohe Lin <[email protected]>
[ Upstream commit 0cbcc92917c5de80f15c24d033566539ad696892 ]
Since commit ebff7d8f270d ("mem hotunplug: fix kfree() of bootmem memory"), we could get a resource allocated during boot via alloc_resource(). And it's required to release the resource using free_resource(). Howerver, many people use kfree directly which will result in kernel BUG. In order to fix this without fixing every call site, just leak a couple of bytes in such corner case.
--- kernel/resource.c | 41 ++++++++--------------------------------- 1 file changed, 8 insertions(+), 33 deletions(-)
kernel/resource.c +8 -33
@@ -56,14 +56,6 @@ struct resource_constraint {static DEFINE_RWLOCK (resource_lock); -/* -* For memory hotplug, there is no way to free resource entries allocated -* by boot mem after the system is up. So for reusing the resource entry -* we need to remember the resource. -*/ -static struct resource *bootmem_resource_free; -static DEFINE_SPINLOCK (bootmem_resource_lock); -static struct resource *next_resource (struct resource *p) {if (p->child)
@@ -160,36 +152,19 @@ __initcall(ioresources_init);static void free_resource (struct resource *res) { -if (!res) -return ; - -if (!PageSlab (virt_to_head_page (res))) { -spin_lock (&bootmem_resource_lock); - res->sibling = bootmem_resource_free; - bootmem_resource_free = res; -spin_unlock (&bootmem_resource_lock); - }else { +/** +* If the resource was allocated using memblock early during boot +* we'll leak it here: we can only return full pages back to the +* buddy and trying to be smart and reusing them eventually in +* alloc_resource() overcomplicates resource handling. +*/ +if (res &&PageSlab (virt_to_head_page (res)))kfree (res); - } }static struct resource *alloc_resource (gfp_t flags) { -struct resource *res =NULL ; - -spin_lock (&bootmem_resource_lock); -if (bootmem_resource_free) { - res = bootmem_resource_free; - bootmem_resource_free = res->sibling; - } -spin_unlock (&bootmem_resource_lock); - -if (res) -memset (res,0 ,sizeof (struct resource )); -else - res =kzalloc (sizeof (struct resource ), flags); - -return res; +return kzalloc (sizeof (struct resource ), flags); }/* Return the conflict entry if you can't request it */
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 641/1017 clk: renesas: r9a07g044: Update multiplier and divider values for PLL2/3
In reply to Greg Kroah-HartmanFrom: Lad Prabhakar <[email protected]>
[ Upstream commit b289cdecc7c3e25e001cde260c882e4d9a8b0772 ]
As per the HW manual (Rev.1.00 Sep, 2021) PLL2 and PLL3 should be 1600 MHz, but with current multiplier and divider values this resulted to 1596 MHz.
This patch updates the multiplier and divider values for PLL2 and PLL3 so that we get the exact (1600 MHz) values.
--- drivers/clk/renesas/r9a07g044-cpg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/renesas/r9a07g044-cpg.c +2 -2
@@ -78,8 +78,8 @@ static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {DEF_FIXED (".osc" ,R9A07G044_OSCCLK ,CLK_EXTAL ,1 ,1 ),DEF_FIXED (".osc_div1000" ,CLK_OSC_DIV1000 ,CLK_EXTAL ,1 ,1000 ),DEF_SAMPLL (".pll1" ,CLK_PLL1 ,CLK_EXTAL ,PLL146_CONF (0 )), -DEF_FIXED (".pll2" ,CLK_PLL2 ,CLK_EXTAL ,133 ,2 ), -DEF_FIXED (".pll3" ,CLK_PLL3 ,CLK_EXTAL ,133 ,2 ), +DEF_FIXED (".pll2" ,CLK_PLL2 ,CLK_EXTAL ,200 ,3 ), +DEF_FIXED (".pll3" ,CLK_PLL3 ,CLK_EXTAL ,200 ,3 ),DEF_FIXED (".pll3_400" ,CLK_PLL3_400 ,CLK_PLL3 ,1 ,4 ), DEF_FIXED(".pll3_533", CLK_PLL3_533, CLK_PLL3, 1, 3),
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 642/1017 staging: r8188eu: convert DBG_88E_LEVEL call in hal/rtl8188e_hal_init.c
In reply to Greg Kroah-HartmanFrom: Phillip Potter <[email protected]>
[ Upstream commit 5ec394d58bdba731c2a33645be7018e71f72f287 ]
Convert DBG_88E_LEVEL macro call in hal/rtl8188e_hal_init.c to plain dev_dbg call, as although the information is potentially useful, we should be exposing it using standard kernel debugging functionality.
--- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +1 -1
@@ -541,7 +541,7 @@ static int load_firmware(struct rt_firmware *pFirmware, struct device *device)memcpy (pFirmware->szFwBuffer, fw->data, fw->size); pFirmware->ulFwLength = fw->size;release_firmware (fw); -DBG_88E_LEVEL (_drv_info_,"+%s: !bUsedWoWLANFw, FmrmwareLen:%d+\n" , __func__, pFirmware->ulFwLength); +dev_dbg (device,"!bUsedWoWLANFw, FmrmwareLen:%d+\n" , pFirmware->ulFwLength); Exit:return rtStatus;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 643/1017 staging: r8188eu: release_firmware is not called if allocation fails
In reply to Greg Kroah-HartmanFrom: Michael Straube <[email protected]>
[ Upstream commit 39850edf2befe27bcb3d6c37b6ee76d2ee4df903 ]
In function load_firmware() release_firmware() is not called if the allocation of pFirmware->szFwBuffer fails or if fw->size is greater than FW_8188E_SIZE.
Move the call to release_firmware() to the exit label at the end of the function to fix this.
--- drivers/staging/r8188eu/hal/rtl8188e_hal_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/r8188eu/hal/rtl8188e_hal_init.c +1 -1
@@ -540,10 +540,10 @@ static int load_firmware(struct rt_firmware *pFirmware, struct device *device) }memcpy (pFirmware->szFwBuffer, fw->data, fw->size); pFirmware->ulFwLength = fw->size; -release_firmware (fw);dev_dbg (device,"!bUsedWoWLANFw, FmrmwareLen:%d+\n" , pFirmware->ulFwLength); Exit: +release_firmware (fw);return rtStatus; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 644/1017 mxser: fix xmit_buf leak in activate when LSR == 0xff
In reply to Greg Kroah-HartmanFrom: Jiri Slaby <[email protected]>
[ Upstream commit cd3a4907ee334b40d7aa880c7ab310b154fd5cd4 ]
When LSR is 0xff in ->activate() (rather unlike), we return an error. Provided ->shutdown() is not called when ->activate() fails, nothing actually frees the buffer in this case.
Fix this by properly freeing the buffer in a designated label. We jump there also from the "!info->type" if now too.
--- drivers/tty/mxser.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/tty/mxser.c +11 -4
@@ -719,6 +719,7 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty) struct mxser_port *info = container_of(port, struct mxser_port, port);unsigned long page;unsigned long flags; +int ret; page =__get_free_page (GFP_KERNEL );if (!page)
@@ -728,9 +729,9 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty)if (!info->type) {set_bit (TTY_IO_ERROR , &tty->flags); -free_page (page);spin_unlock_irqrestore (&info->slock, flags); -return 0 ; + ret =0 ; + goto err_free_xmit; } info->port.xmit_buf = (unsigned char *) page;
@@ -750,8 +751,10 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty)if (capable (CAP_SYS_ADMIN )) {set_bit (TTY_IO_ERROR , &tty->flags);return 0 ; - }else -return -ENODEV ; + } + + ret = -ENODEV ; + goto err_free_xmit; }/*
@@ -796,6 +799,10 @@ static int mxser_activate(struct tty_port *port, struct tty_struct *tty)spin_unlock_irqrestore (&info->slock, flags);return 0 ; +err_free_xmit: +free_page (page); + info->port.xmit_buf =NULL ; +return ret; }/*
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 645/1017 fsi: scom: Fix error handling
In reply to Greg Kroah-HartmanFrom: Joel Stanley <[email protected]>
[ Upstream commit d46fddd52d11eb6a3a7ed836f9f273e9cf8cd01c ]
SCOM error handling is made complex by trying to pass around two bits of
information: the function return code, and a status parameter that represents the CFAM error status register.
The commit f72ddbe1d7b7 ("fsi: scom: Remove retries") removed the "hidden" retries in the SCOM driver, in preference of allowing the calling code (userspace or driver) to decide how to handle a failed SCOM. However it introduced a bug by attempting to be smart about the return codes that were "errors" and which were ok to fall through to the status register parsing.
We get the following errors:
- EINVAL or ENXIO, for indirect scoms where the value is invalid
- EINVAL, where the size or address is incorrect
- EIO or ETIMEOUT, where FSI write failed (aspeed master)
- EAGAIN, where the master detected a crc error (GPIO master only)
- EBUSY, where the bus is disabled (GPIO master in external mode)
In all of these cases we should fail the SCOM read/write and return the error.
Thanks to Dan Carpenter for the detailed bug report.
--- drivers/fsi/fsi-scom.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/fsi/fsi-scom.c +2 -2
@@ -289,7 +289,7 @@ static int put_scom(struct scom_device *scom, uint64_t value,int rc; rc =raw_put_scom (scom, value, addr, &status); -if (rc == -ENODEV ) +if (rc)return rc; rc =handle_fsi2pib_status (scom, status);
@@ -308,7 +308,7 @@ static int get_scom(struct scom_device *scom, uint64_t *value,int rc; rc =raw_get_scom (scom, value, addr, &status); -if (rc == -ENODEV ) +if (rc)return rc; rc =handle_fsi2pib_status (scom, status);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 646/1017 fsi: scom: Remove retries in indirect scoms
In reply to Greg Kroah-HartmanFrom: Joel Stanley <[email protected]>
[ Upstream commit ab1b79159ad5a6dc4e4994b49737f7feb13b7155 ]
In commit f72ddbe1d7b7 ("fsi: scom: Remove retries") the retries were removed from get and put scoms. That patch missed the retires in get and put indirect scom.
For the same reason, remove them from the scom driver to allow the caller to decide to retry.
This removes the following special case which would have caused the retry code to return early:
- if ((ind_data & XSCOM_DATA_IND_COMPLETE) || (err != SCOM_PIB_BLOCKED))
- return 0;
I believe this case is handled.
--- drivers/fsi/fsi-scom.c | 41 +++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 26 deletions(-)
drivers/fsi/fsi-scom.c +15 -26
@@ -145,7 +145,7 @@ static int put_indirect_scom_form0(struct scom_device *scom, uint64_t value, uint64_t addr, uint32_t *status) { uint64_t ind_data, ind_addr; -int rc, retries, err =0 ; +int rc, err;if (value & ~XSCOM_DATA_IND_DATA )return -EINVAL ;
@@ -156,19 +156,14 @@ static int put_indirect_scom_form0(struct scom_device *scom, uint64_t value,if (rc || (*status &SCOM_STATUS_ANY_ERR ))return rc; -for (retries =0 ; retries <SCOM_MAX_IND_RETRIES ; retries++) { - rc =__get_scom (scom, &ind_data, addr, status); -if (rc || (*status &SCOM_STATUS_ANY_ERR )) -return rc; + rc =__get_scom (scom, &ind_data, addr, status); +if (rc || (*status &SCOM_STATUS_ANY_ERR )) +return rc; - err = (ind_data &XSCOM_DATA_IND_ERR_MASK ) >>XSCOM_DATA_IND_ERR_SHIFT ; - *status = err <<SCOM_STATUS_PIB_RESP_SHIFT ; -if ((ind_data &XSCOM_DATA_IND_COMPLETE ) || (err !=SCOM_PIB_BLOCKED )) -return 0 ; + err = (ind_data &XSCOM_DATA_IND_ERR_MASK ) >>XSCOM_DATA_IND_ERR_SHIFT ; + *status = err <<SCOM_STATUS_PIB_RESP_SHIFT ; -msleep (1 ); - } -return rc; +return 0 ; } static int put_indirect_scom_form1(struct scom_device *scom, uint64_t value,
@@ -188,7 +183,7 @@ static int get_indirect_scom_form0(struct scom_device *scom, uint64_t *value, uint64_t addr, uint32_t *status) { uint64_t ind_data, ind_addr; -int rc, retries, err =0 ; +int rc, err; ind_addr = addr &XSCOM_ADDR_DIRECT_PART ; ind_data = (addr &XSCOM_ADDR_INDIRECT_PART ) |XSCOM_DATA_IND_READ ;
@@ -196,21 +191,15 @@ static int get_indirect_scom_form0(struct scom_device *scom, uint64_t *value,if (rc || (*status &SCOM_STATUS_ANY_ERR ))return rc; -for (retries =0 ; retries <SCOM_MAX_IND_RETRIES ; retries++) { - rc =__get_scom (scom, &ind_data, addr, status); -if (rc || (*status &SCOM_STATUS_ANY_ERR )) -return rc; - - err = (ind_data &XSCOM_DATA_IND_ERR_MASK ) >>XSCOM_DATA_IND_ERR_SHIFT ; - *status = err <<SCOM_STATUS_PIB_RESP_SHIFT ; - *value = ind_data &XSCOM_DATA_IND_DATA ; + rc =__get_scom (scom, &ind_data, addr, status); +if (rc || (*status &SCOM_STATUS_ANY_ERR )) +return rc; -if ((ind_data &XSCOM_DATA_IND_COMPLETE ) || (err !=SCOM_PIB_BLOCKED )) -return 0 ; + err = (ind_data &XSCOM_DATA_IND_ERR_MASK ) >>XSCOM_DATA_IND_ERR_SHIFT ; + *status = err <<SCOM_STATUS_PIB_RESP_SHIFT ; + *value = ind_data &XSCOM_DATA_IND_DATA ; -msleep (1 ); - } -return rc; +return 0 ; } static int raw_put_scom(struct scom_device *scom, uint64_t value,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 647/1017 pwm: lpc18xx-sct: Initialize driver data and hardware before pwmchip_add()
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit 0401f24cd238ae200a23a13925f98de3d2c883b8 ]
When a driver calls pwmchip_add() it has to be prepared to immediately get its callbacks called. So move allocation of driver data and hardware initialization before the call to pwmchip_add().
This fixes a potential NULL pointer exception and a race condition on register writes.
--- drivers/pwm/pwm-lpc18xx-sct.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-)
drivers/pwm/pwm-lpc18xx-sct.c +9 -11
@@ -395,12 +395,6 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev)lpc18xx_pwm_writel (lpc18xx_pwm,LPC18XX_PWM_LIMIT ,BIT (lpc18xx_pwm->period_event)); - ret =pwmchip_add (&lpc18xx_pwm->chip); -if (ret <0 ) { -dev_err (&pdev->dev,"pwmchip_add failed: %d\n" , ret); - goto disable_pwmclk; - } -for (i =0 ; i < lpc18xx_pwm->chip.npwm; i++) {struct lpc18xx_pwm_data *data;
@@ -410,14 +404,12 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev) GFP_KERNEL);if (!data) { ret = -ENOMEM ; - goto remove_pwmchip; + goto disable_pwmclk; }pwm_set_chip_data (pwm, data); } -platform_set_drvdata (pdev, lpc18xx_pwm); - val =lpc18xx_pwm_readl (lpc18xx_pwm,LPC18XX_PWM_CTRL ); val &= ~LPC18XX_PWM_BIDIR ; val &= ~LPC18XX_PWM_CTRL_HALT ;
@@ -425,10 +417,16 @@ static int lpc18xx_pwm_probe(struct platform_device *pdev) val |=LPC18XX_PWM_PRE (0 );lpc18xx_pwm_writel (lpc18xx_pwm,LPC18XX_PWM_CTRL , val); + ret =pwmchip_add (&lpc18xx_pwm->chip); +if (ret <0 ) { +dev_err (&pdev->dev,"pwmchip_add failed: %d\n" , ret); + goto disable_pwmclk; + } + +platform_set_drvdata (pdev, lpc18xx_pwm); +return 0 ; -remove_pwmchip: -pwmchip_remove (&lpc18xx_pwm->chip); disable_pwmclk:clk_disable_unprepare (lpc18xx_pwm->pwm_clk);return ret;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 648/1017 pps: clients: gpio: Propagate return value from pps_gpio_probe
In reply to Greg Kroah-HartmanFrom: Robert Hancock <[email protected]>
[ Upstream commit abaca3179b41d4b3b115f27814ee36f6fb45e897 ]
If the pps-gpio driver was probed prior to the GPIO device it uses, the devm_gpiod_get call returned an -EPROBE_DEFER error, but pps_gpio_probe replaced that error code with -EINVAL, causing the pps-gpio probe to fail and not be retried later. Propagate the error return value so that deferred probe works properly.
--- drivers/pps/clients/pps-gpio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pps/clients/pps-gpio.c +1 -1
@@ -169,7 +169,7 @@ static int pps_gpio_probe(struct platform_device *pdev)/* GPIO setup */ ret =pps_gpio_setup (dev);if (ret) -return -EINVAL ; +return ret;/* IRQ setup */ ret =gpiod_to_irq (data->gpio_pin);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 649/1017 fsi: Aspeed: Fix a potential double free
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 83ba7e895debc529803a7a258653f2fe9bf3bf40 ]
A struct device can never be devm_alloc()'ed.
Here, it is embedded in "struct fsi_master", and "struct fsi_master" is embedded in "struct fsi_master_aspeed".
Since "struct device" is embedded, the data structure embedding it must be released with the release function, as is already done here.
So use kzalloc() instead of devm_kzalloc() when allocating "aspeed" and update all error handling branches accordingly.
This prevent a potential double free().
This also fix another issue if opb_readl() fails. Instead of a direct return, it now jumps in the error handling path.
--- drivers/fsi/fsi-master-aspeed.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-)
drivers/fsi/fsi-master-aspeed.c +11 -6
@@ -542,25 +542,28 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev)return rc; } - aspeed =devm_kzalloc (&pdev->dev,sizeof (*aspeed),GFP_KERNEL ); + aspeed =kzalloc (sizeof (*aspeed),GFP_KERNEL );if (!aspeed)return -ENOMEM ; aspeed->dev = &pdev->dev; aspeed->base =devm_platform_ioremap_resource (pdev,0 ); -if (IS_ERR (aspeed->base)) -return PTR_ERR (aspeed->base); +if (IS_ERR (aspeed->base)) { + rc =PTR_ERR (aspeed->base); + goto err_free_aspeed; + } aspeed->clk =devm_clk_get (aspeed->dev,NULL );if (IS_ERR (aspeed->clk)) {dev_err (aspeed->dev,"couldn't get clock\n" ); -return PTR_ERR (aspeed->clk); + rc =PTR_ERR (aspeed->clk); + goto err_free_aspeed; } rc =clk_prepare_enable (aspeed->clk);if (rc) {dev_err (aspeed->dev,"couldn't enable clock\n" ); -return rc; + goto err_free_aspeed; } rc =setup_cfam_reset (aspeed);
@@ -595,7 +598,7 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) rc =opb_readl (aspeed, ctrl_base +FSI_MVER , &raw);if (rc) {dev_err (&pdev->dev,"failed to read hub version\n" ); -return rc; + goto err_release; } reg =be32_to_cpu (raw);
@@ -634,6 +637,8 @@ static int fsi_master_aspeed_probe(struct platform_device *pdev) err_release:clk_disable_unprepare (aspeed->clk); +err_free_aspeed: +kfree (aspeed);return rc; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 650/1017 misc: alcor_pci: Fix an error handling path
In reply to Greg Kroah-HartmanFrom: Christophe JAILLET <[email protected]>
[ Upstream commit 5b3dc949f554379edcb8ef6111aa5ecb78feb798 ]
A successful ida_simple_get() should be balanced by a corresponding ida_simple_remove().
Add the missing call in the error handling path of the probe.
While at it, switch to ida_alloc()/ida_free() instead to ida_simple_get()/ida_simple_remove().
The latter is deprecated and more verbose.
--- drivers/misc/cardreader/alcor_pci.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/misc/cardreader/alcor_pci.c +6 -3
@@ -266,7 +266,7 @@ static int alcor_pci_probe(struct pci_dev *pdev,if (!priv)return -ENOMEM ; - ret =ida_simple_get (&alcor_pci_idr,0 ,0 ,GFP_KERNEL ); + ret =ida_alloc (&alcor_pci_idr,GFP_KERNEL );if (ret <0 )return ret; priv->id = ret;
@@ -280,7 +280,8 @@ static int alcor_pci_probe(struct pci_dev *pdev, ret =pci_request_regions (pdev,DRV_NAME_ALCOR_PCI );if (ret) {dev_err (&pdev->dev,"Cannot request region\n" ); -return -ENOMEM ; + ret = -ENOMEM ; + goto error_free_ida; }if (!(pci_resource_flags (pdev, bar) &IORESOURCE_MEM )) {
@@ -324,6 +325,8 @@ static int alcor_pci_probe(struct pci_dev *pdev, error_release_regions:pci_release_regions (pdev); +error_free_ida: +ida_free (&alcor_pci_idr, priv->id);return ret; }
@@ -337,7 +340,7 @@ static void alcor_pci_remove(struct pci_dev *pdev)mfd_remove_devices (&pdev->dev); -ida_simple_remove (&alcor_pci_idr, priv->id); +ida_free (&alcor_pci_idr, priv->id);pci_release_regions (pdev);pci_set_drvdata (pdev,NULL );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 651/1017 cpufreq: qcom-cpufreq-nvmem: fix reading of PVS Valid fuse
In reply to Greg Kroah-HartmanFrom: Luca Weiss <[email protected]>
[ Upstream commit 4a8a77abf0e2b6468ba0281e33384cbec5fb476a ]
The fuse consists of 64 bits, with this statement we're supposed to get the upper 32 bits but it actually read out of bounds and got 0 instead of the desired value which lead to the "PVS bin not set." codepath being run resetting our pvs value.
--- drivers/cpufreq/qcom-cpufreq-nvmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/qcom-cpufreq-nvmem.c +1 -1
@@ -130,7 +130,7 @@ static void get_krait_bin_format_b(struct device *cpu_dev, }/* Check PVS_BLOW_STATUS */ - pte_efuse = *(((u32 *)buf) +4 ); + pte_efuse = *(((u32 *)buf) +1 ); pte_efuse &=BIT (21 );if (pte_efuse) {dev_dbg (cpu_dev,"PVS bin: %d\n" , *pvs);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 652/1017 soundwire: intel: fix wrong register name in intel_shim_wake
In reply to Greg Kroah-HartmanFrom: Libin Yang <[email protected]>
[ Upstream commit 3957db3ae3dae6f8b8168791f154567fe49e1fd7 ]
When clearing the sdw wakests status, we should use SDW_SHIM_WAKESTS.
--- drivers/soundwire/intel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/soundwire/intel.c +2 -2
@@ -448,8 +448,8 @@ static void intel_shim_wake(struct sdw_intel *sdw, bool wake_enable)/* Clear wake status */ wake_sts =intel_readw (shim,SDW_SHIM_WAKESTS ); - wake_sts |= (SDW_SHIM_WAKEEN_ENABLE << link_id); -intel_writew (shim,SDW_SHIM_WAKESTS_STATUS , wake_sts); + wake_sts |= (SDW_SHIM_WAKESTS_STATUS << link_id); +intel_writew (shim,SDW_SHIM_WAKESTS , wake_sts); }mutex_unlock (sdw->link_res->shim_lock); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 653/1017 clk: qcom: ipq8074: fix PCI-E clock oops
In reply to Greg Kroah-HartmanFrom: Robert Marko <[email protected]>
[ Upstream commit bf8f5182b8f59309809b41c1d1730ed9ca6134b1 ]
Fix PCI-E clock related kernel oops that are caused by a missing clock parent.
pcie0_rchng_clk_src has num_parents set to 2 but only one parent is actually set via parent_hws, it should also have "XO" defined. This will cause the kernel to panic on a NULL pointer in clk_core_get_parent_by_index().
So, to fix this utilize clk_parent_data to provide gcc_xo_gpll0 parent data.
Since there is already an existing static const char * const gcc_xo_gpll0[] used to provide the same parents via parent_names convert those users to clk_parent_data as well.
Without this earlycon is needed to even catch the OOPS as it will reset the board before serial is initialized with the following:
[ 0.232279] Unable to handle kernel paging request at virtual address 0000a00000000000 [ 0.232322] Mem abort info: [ 0.239094] ESR = 0x96000004 [ 0.241778] EC = 0x25: DABT (current EL), IL = 32 bits [ 0.244908] SET = 0, FnV = 0 [ 0.250377] EA = 0, S1PTW = 0 [ 0.253236] FSC = 0x04: level 0 translation fault [ 0.256277] Data abort info: [ 0.261141] ISV = 0, ISS = 0x00000004 [ 0.264262] CM = 0, WnR = 0 [ 0.267820] [0000a00000000000] address between user and kernel address ranges [ 0.270954] Internal error: Oops: 96000004 [#1] SMP [ 0.278067] Modules linked in: [ 0.282751] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 5.15.10 #0 [ 0.285882] Hardware name: Xiaomi AX3600 (DT) [ 0.292043] pstate: 20400005 (nzCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 0.296299] pc : clk_core_get_parent_by_index+0x68/0xec [ 0.303067] lr : __clk_register+0x1d8/0x820 [ 0.308273] sp : ffffffc01111b7d0 [ 0.312438] x29: ffffffc01111b7d0 x28: 0000000000000000 x27: 0000000000000040 [ 0.315919] x26: 0000000000000002 x25: 0000000000000000 x24: ffffff8000308800 [ 0.323037] x23: ffffff8000308850 x22: ffffff8000308880 x21: ffffff8000308828 [ 0.330155] x20: 0000000000000028 x19: ffffff8000309700 x18: 0000000000000020 [ 0.337272] x17: 000000005cc86990 x16: 0000000000000004 x15: ffffff80001d9d0a [ 0.344391] x14: 0000000000000000 x13: 0000000000000000 x12: 0000000000000006 [ 0.351508] x11: 0000000000000003 x10: 0101010101010101 x9 : 0000000000000000 [ 0.358626] x8 : 7f7f7f7f7f7f7f7f x7 : 6468626f5e626266 x6 : 17000a3a403c1b06 [ 0.365744] x5 : 061b3c403a0a0017 x4 : 0000000000000000 x3 : 0000000000000001 [ 0.372863] x2 : 0000a00000000000 x1 : 0000000000000001 x0 : ffffff8000309700 [ 0.379982] Call trace: [ 0.387091] clk_core_get_parent_by_index+0x68/0xec [ 0.389351] __clk_register+0x1d8/0x820 [ 0.394210] devm_clk_hw_register+0x5c/0xe0 [ 0.398030] devm_clk_register_regmap+0x44/0x8c [ 0.402198] qcom_cc_really_probe+0x17c/0x1d0 [ 0.406711] qcom_cc_probe+0x34/0x44 [ 0.411224] gcc_ipq8074_probe+0x18/0x30 [ 0.414869] platform_probe+0x68/0xe0 [ 0.418776] really_probe.part.0+0x9c/0x30c [ 0.422336] __driver_probe_device+0x98/0x144 [ 0.426329] driver_probe_device+0x44/0x11c [ 0.430842] __device_attach_driver+0xb4/0x120 [ 0.434836] bus_for_each_drv+0x68/0xb0 [ 0.439349] __device_attach+0xb0/0x170 [ 0.443081] device_initial_probe+0x14/0x20 [ 0.446901] bus_probe_device+0x9c/0xa4 [ 0.451067] device_add+0x35c/0x834 [ 0.454886] of_device_add+0x54/0x64 [ 0.458360] of_platform_device_create_pdata+0xc0/0x100 [ 0.462181] of_platform_bus_create+0x114/0x370 [ 0.467128] of_platform_bus_create+0x15c/0x370 [ 0.471641] of_platform_populate+0x50/0xcc [ 0.476155] of_platform_default_populate_init+0xa8/0xc8 [ 0.480324] do_one_initcall+0x50/0x1b0 [ 0.485877] kernel_init_freeable+0x234/0x29c [ 0.489436] kernel_init+0x24/0x120 [ 0.493948] ret_from_fork+0x10/0x20 [ 0.497253] Code: d50323bf d65f03c0 f94002a2 b4000302 (f9400042) [ 0.501079] ---[ end trace 4ca7e1129da2abce ]---
--- drivers/clk/qcom/gcc-ipq8074.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/clk/qcom/gcc-ipq8074.c +9 -10
@@ -60,11 +60,6 @@ static const struct parent_map gcc_xo_gpll0_gpll0_out_main_div2_map[] = { { P_GPLL0_DIV2, 4 }, }; -static const char *const gcc_xo_gpll0[] = { -"xo" , -"gpll0" , -}; -static const struct parent_map gcc_xo_gpll0_map[] = { {P_XO ,0 }, { P_GPLL0, 1 },
@@ -956,6 +951,11 @@ static struct clk_rcg2 blsp1_uart6_apps_clk_src = { }, }; +static const struct clk_parent_data gcc_xo_gpll0[] = { + { .fw_name ="xo" }, + { .hw = &gpll0.clkr.hw }, +}; +static const struct freq_tbl ftbl_pcie_axi_clk_src[] = {F (19200000 ,P_XO ,1 ,0 ,0 ),F (200000000 ,P_GPLL0 ,4 ,0 ,0 ),
@@ -969,7 +969,7 @@ static struct clk_rcg2 pcie0_axi_clk_src = { .parent_map = gcc_xo_gpll0_map, .clkr.hw.init = &(struct clk_init_data ){ .name ="pcie0_axi_clk_src" , - .parent_names = gcc_xo_gpll0, + .parent_data = gcc_xo_gpll0, .num_parents =2 , .ops = &clk_rcg2_ops, },
@@ -1016,7 +1016,7 @@ static struct clk_rcg2 pcie1_axi_clk_src = { .parent_map = gcc_xo_gpll0_map, .clkr.hw.init = &(struct clk_init_data ){ .name ="pcie1_axi_clk_src" , - .parent_names = gcc_xo_gpll0, + .parent_data = gcc_xo_gpll0, .num_parents =2 , .ops = &clk_rcg2_ops, },
@@ -1330,7 +1330,7 @@ static struct clk_rcg2 nss_ce_clk_src = { .parent_map = gcc_xo_gpll0_map, .clkr.hw.init = &(struct clk_init_data ){ .name ="nss_ce_clk_src" , - .parent_names = gcc_xo_gpll0, + .parent_data = gcc_xo_gpll0, .num_parents =2 , .ops = &clk_rcg2_ops, },
@@ -4329,8 +4329,7 @@ static struct clk_rcg2 pcie0_rchng_clk_src = { .parent_map = gcc_xo_gpll0_map, .clkr.hw.init = &(struct clk_init_data ){ .name ="pcie0_rchng_clk_src" , - .parent_hws = (const struct clk_hw *[]) { - &gpll0.clkr.hw }, + .parent_data = gcc_xo_gpll0, .num_parents =2 , .ops = &clk_rcg2_ops, },
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 654/1017 dmaengine: idxd: change bandwidth token to read buffers
In reply to Greg Kroah-HartmanFrom: Dave Jiang <[email protected]>
[ Upstream commit 7ed6f1b85fb613e5e44ef3e14d73f2dc96860935 ]
DSA spec v1.2 has changed the term of "bandwidth tokens" to "read buffers" in order to make the concept clearer. Deprecate bandwidth token naming in the driver and convert to read buffers in order to match with the spec and reduce confusion when reading the spec.
--- drivers/dma/idxd/device.c | 25 +++++++++++---------- drivers/dma/idxd/idxd.h | 12 +++++------ drivers/dma/idxd/init.c | 6 +++--- drivers/dma/idxd/registers.h | 14 ++++++------ drivers/dma/idxd/sysfs.c | 42 ++++++++++++++++++------------------ 5 files changed, 49 insertions(+), 50 deletions(-)
drivers/dma/idxd/device.c +12 -13
@@ -688,9 +688,9 @@ static void idxd_groups_clear_state(struct idxd_device *idxd)memset (&group->grpcfg,0 ,sizeof (group->grpcfg)); group->num_engines =0 ; group->num_wqs =0 ; - group->use_token_limit = false; - group->tokens_allowed =0 ; - group->tokens_reserved =0 ; + group->use_rdbuf_limit = false; + group->rdbufs_allowed =0 ; + group->rdbufs_reserved =0 ; group->tc_a =-1 ; group->tc_b =-1 ; }
@@ -788,10 +788,10 @@ static int idxd_groups_config_write(struct idxd_device *idxd)int i;struct device *dev = &idxd->pdev->dev; -/* Setup bandwidth token limit */ -if (idxd->hw.gen_cap.config_en && idxd->token_limit) { +/* Setup bandwidth rdbuf limit */ +if (idxd->hw.gen_cap.config_en && idxd->rdbuf_limit) { reg.bits =ioread32 (idxd->reg_base +IDXD_GENCFG_OFFSET ); - reg.token_limit = idxd->token_limit; + reg.rdbuf_limit = idxd->rdbuf_limit;iowrite32 (reg.bits, idxd->reg_base +IDXD_GENCFG_OFFSET ); }
@@ -932,13 +932,12 @@ static void idxd_group_flags_setup(struct idxd_device *idxd) group->tc_b = group->grpcfg.flags.tc_b =1 ; else group->grpcfg.flags.tc_b = group->tc_b; - group->grpcfg.flags.use_token_limit = group->use_token_limit; - group->grpcfg.flags.tokens_reserved = group->tokens_reserved; -if (group->tokens_allowed) - group->grpcfg.flags.tokens_allowed = - group->tokens_allowed; + group->grpcfg.flags.use_rdbuf_limit = group->use_rdbuf_limit; + group->grpcfg.flags.rdbufs_reserved = group->rdbufs_reserved; +if (group->rdbufs_allowed) + group->grpcfg.flags.rdbufs_allowed = group->rdbufs_allowed;else - group->grpcfg.flags.tokens_allowed = idxd->max_tokens; + group->grpcfg.flags.rdbufs_allowed = idxd->max_rdbufs; } }
@@ -1131,7 +1130,7 @@ int idxd_device_load_config(struct idxd_device *idxd)int i, rc; reg.bits =ioread32 (idxd->reg_base +IDXD_GENCFG_OFFSET ); - idxd->token_limit = reg.token_limit; + idxd->rdbuf_limit = reg.rdbuf_limit;for (i =0 ; i < idxd->max_groups; i++) {struct idxd_group *group = idxd->groups[i];
drivers/dma/idxd/idxd.h +6 -6
@@ -84,9 +84,9 @@ struct idxd_group {int id;int num_engines;int num_wqs; -bool use_token_limit; -u8 tokens_allowed; -u8 tokens_reserved; +bool use_rdbuf_limit; +u8 rdbufs_allowed; +u8 rdbufs_reserved;int tc_a;int tc_b; };
@@ -276,11 +276,11 @@ struct idxd_device {u32 max_batch_size;int max_groups;int max_engines; -int max_tokens; +int max_rdbufs;int max_wqs;int max_wq_size; -int token_limit; -int nr_tokens;/* non-reserved tokens */ +int rdbuf_limit; +int nr_rdbufs;/* non-reserved read buffers */ unsigned int wqcfg_size;union sw_err_reg sw_err;
drivers/dma/idxd/init.c +3 -3
@@ -464,9 +464,9 @@ static void idxd_read_caps(struct idxd_device *idxd)dev_dbg (dev,"group_cap: %#llx\n" , idxd->hw.group_cap.bits); idxd->max_groups = idxd->hw.group_cap.num_groups;dev_dbg (dev,"max groups: %u\n" , idxd->max_groups); - idxd->max_tokens = idxd->hw.group_cap.total_tokens; -dev_dbg (dev,"max tokens: %u\n" , idxd->max_tokens); - idxd->nr_tokens = idxd->max_tokens; + idxd->max_rdbufs = idxd->hw.group_cap.total_rdbufs; +dev_dbg (dev,"max read buffers: %u\n" , idxd->max_rdbufs); + idxd->nr_rdbufs = idxd->max_rdbufs;/* read engine capabilities */ idxd->hw.engine_cap.bits =
drivers/dma/idxd/registers.h +7 -7
@@ -64,9 +64,9 @@ union wq_cap_reg {union group_cap_reg {struct {u64 num_groups:8 ; -u64 total_tokens:8 ; -u64 token_en:1 ; -u64 token_limit:1 ; +u64 total_rdbufs:8 ;/* formerly total_tokens */ +u64 rdbuf_ctrl:1 ;/* formerly token_en */ +u64 rdbuf_limit:1 ;/* formerly token_limit */ u64 rsvd:46 ; };u64 bits;
@@ -110,7 +110,7 @@ union offsets_reg {#define IDXD_GENCFG_OFFSET 0x80union gencfg_reg {struct { -u32 token_limit:8 ; +u32 rdbuf_limit:8 ;u32 rsvd:4 ;u32 user_int_en:1 ;u32 rsvd2:19 ;
@@ -287,10 +287,10 @@ union group_flags { u32 tc_a:3; u32 tc_b:3; u32 rsvd:1; - u32 use_token_limit:1; - u32 tokens_reserved:8; + u32 use_rdbuf_limit:1; + u32 rdbufs_reserved:8; u32 rsvd2:4; - u32 tokens_allowed:8; + u32 rdbufs_allowed:8; u32 rsvd3:4; };u32 bits;
drivers/dma/idxd/sysfs.c +21 -21
120 lines not on this page · raw message
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 655/1017 dmaengine: idxd: restore traffic class defaults after wq reset
In reply to Greg Kroah-HartmanFrom: Dave Jiang <[email protected]>
[ Upstream commit ea7c8f598c323f6ebaf9ddae01fb2a981fe8c56a ]
When clearing the group configurations, the driver fails to restore the default setting for DSA 1.x based devices. Add defaults in idxd_groups_clear_state() for traffic class configuration.
--- drivers/dma/idxd/device.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/dma/idxd/device.c +7 -2
@@ -691,8 +691,13 @@ static void idxd_groups_clear_state(struct idxd_device *idxd) group->use_rdbuf_limit = false; group->rdbufs_allowed =0 ; group->rdbufs_reserved =0 ; - group->tc_a =-1 ; - group->tc_b =-1 ; +if (idxd->hw.version <DEVICE_VERSION_2 && !tc_override) { + group->tc_a =1 ; + group->tc_b =1 ; + }else { + group->tc_a =-1 ; + group->tc_b =-1 ; + } } }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 656/1017 iio: mma8452: Fix probe failing when an i2c_device_id is used
In reply to Greg Kroah-HartmanFrom: Hans de Goede <[email protected]>
[ Upstream commit a47ac019e7e8129b93a0b991e04b2a59872e053d ]
The mma8452_driver declares both of_match_table and i2c_driver.id_table match-tables, but its probe() function only checked for of matches.
Add support for i2c_device_id matches. This fixes the driver not loading on some x86 tablets (e.g. the Nextbook Ares 8) where the i2c_client is instantiated by platform code using an i2c_device_id.
Drop of_match_ptr() protection to avoid unused warning.
--- drivers/iio/accel/mma8452.c | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-)
drivers/iio/accel/mma8452.c +18 -11
@@ -176,6 +176,7 @@ static const struct mma8452_event_regs trans_ev_regs = {* @enabled_events: event flags enabled and handled by this driver */ struct mma_chip_info { +const char *name;u8 chip_id;const struct iio_chan_spec *channels;int num_channels;
@@ -1301,6 +1302,7 @@ enum {static const struct mma_chip_info mma_chip_info_table[] = { [mma8451] = { + .name ="mma8451" , .chip_id =MMA8451_DEVICE_ID , .channels = mma8451_channels, .num_channels =ARRAY_SIZE (mma8451_channels),
@@ -1325,6 +1327,7 @@ static const struct mma_chip_info mma_chip_info_table[] = { MMA8452_INT_FF_MT, }, [mma8452] = { + .name = "mma8452", .chip_id = MMA8452_DEVICE_ID, .channels = mma8452_channels, .num_channels = ARRAY_SIZE(mma8452_channels),
@@ -1341,6 +1344,7 @@ static const struct mma_chip_info mma_chip_info_table[] = { MMA8452_INT_FF_MT, }, [mma8453] = { + .name = "mma8453", .chip_id = MMA8453_DEVICE_ID, .channels = mma8453_channels, .num_channels = ARRAY_SIZE(mma8453_channels),
@@ -1357,6 +1361,7 @@ static const struct mma_chip_info mma_chip_info_table[] = { MMA8452_INT_FF_MT, }, [mma8652] = { + .name = "mma8652", .chip_id = MMA8652_DEVICE_ID, .channels = mma8652_channels, .num_channels = ARRAY_SIZE(mma8652_channels),
@@ -1366,6 +1371,7 @@ static const struct mma_chip_info mma_chip_info_table[] = { .enabled_events = MMA8452_INT_FF_MT, }, [mma8653] = { + .name = "mma8653", .chip_id = MMA8653_DEVICE_ID, .channels = mma8653_channels, .num_channels = ARRAY_SIZE(mma8653_channels),
@@ -1380,6 +1386,7 @@ static const struct mma_chip_info mma_chip_info_table[] = { .enabled_events = MMA8452_INT_FF_MT, }, [fxls8471] = { + .name = "fxls8471", .chip_id = FXLS8471_DEVICE_ID, .channels = mma8451_channels, .num_channels = ARRAY_SIZE(mma8451_channels),
@@ -1522,13 +1529,6 @@ static int mma8452_probe(struct i2c_client *client,struct mma8452_data *data;struct iio_dev *indio_dev;int ret; -const struct of_device_id *match; - - match =of_match_device (mma8452_dt_ids, &client->dev); -if (!match) { -dev_err (&client->dev,"unknown device model\n" ); -return -ENODEV ; - } indio_dev =devm_iio_device_alloc (&client->dev,sizeof (*data));if (!indio_dev)
@@ -1537,7 +1537,14 @@ static int mma8452_probe(struct i2c_client *client, data =iio_priv (indio_dev); data->client = client;mutex_init (&data->lock); - data->chip_info = match->data; + + data->chip_info =device_get_match_data (&client->dev); +if (!data->chip_info && id) { + data->chip_info = &mma_chip_info_table[id->driver_data]; + }else { +dev_err (&client->dev,"unknown device model\n" ); +return -ENODEV ; + } data->vdd_reg =devm_regulator_get (&client->dev,"vdd" );if (IS_ERR (data->vdd_reg))
@@ -1581,11 +1588,11 @@ static int mma8452_probe(struct i2c_client *client, }dev_info (&client->dev,"registering %s accelerometer; ID 0x%x\n" , - match->compatible, data->chip_info->chip_id); + data->chip_info->name, data->chip_info->chip_id);i2c_set_clientdata (client, indio_dev); indio_dev->info = &mma8452_info; - indio_dev->name = id->name; + indio_dev->name = data->chip_info->name; indio_dev->modes =INDIO_DIRECT_MODE ; indio_dev->channels = data->chip_info->channels; indio_dev->num_channels = data->chip_info->num_channels;
@@ -1810,7 +1817,7 @@ MODULE_DEVICE_TABLE(i2c, mma8452_id);static struct i2c_driver mma8452_driver = { .driver = { .name ="mma8452" , - .of_match_table =of_match_ptr (mma8452_dt_ids), + .of_match_table = mma8452_dt_ids, .pm = &mma8452_pm_ops, }, .probe = mma8452_probe,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 657/1017 staging: qlge: add unregister_netdev in qlge_probe
In reply to Greg Kroah-HartmanFrom: Hangyu Hua <[email protected]>
[ Upstream commit 4fcc0c275e3f59cd68f977c57953783f8014ed15 ]
unregister_netdev need to be called when register_netdev succeeds qlge_health_create_reporters fails.
--- drivers/staging/qlge/qlge_main.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/staging/qlge/qlge_main.c +7 -4
@@ -4605,14 +4605,12 @@ static int qlge_probe(struct pci_dev *pdev, err =register_netdev (ndev);if (err) {dev_err (&pdev->dev,"net device registration failed.\n" ); -qlge_release_all (pdev); -pci_disable_device (pdev); - goto netdev_free; + goto cleanup_pdev; } err =qlge_health_create_reporters (qdev);if (err) - goto netdev_free; + goto unregister_netdev;/* Start up the timer to trigger EEH if * the bus goes dead
@@ -4626,6 +4624,11 @@ static int qlge_probe(struct pci_dev *pdev,devlink_register (devlink);return 0 ; +unregister_netdev: +unregister_netdev (ndev); +cleanup_pdev: +qlge_release_all (pdev); +pci_disable_device (pdev); netdev_free:free_netdev (ndev); devlink_free:
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 658/1017 serial: 8250_aspeed_vuart: add PORT_ASPEED_VUART port type
In reply to Greg Kroah-HartmanFrom: Zev Weiss <[email protected]>
[ Upstream commit a603ca60cebff8589882427a67f870ed946b3fc8 ]
Commit 54da3e381c2b ("serial: 8250_aspeed_vuart: use UPF_IOREMAP to set up register mapping") fixed a bug that had, as a side-effect, prevented the 8250_aspeed_vuart driver from enabling the VUART's FIFOs. However, fixing that (and hence enabling the FIFOs) has in turn revealed what appears to be a hardware bug in the ASPEED VUART in which the host-side THRE bit doesn't get if the BMC-side receive FIFO trigger level is set to anything but one byte. This causes problems for polled-mode writes from the host -- for example, Linux kernel console writes proceed at a glacial pace (less than 100 bytes per second) because the write path waits for a 10ms timeout to expire after every character instead of being able to continue on to the next character upon seeing THRE asserted. (GRUB behaves similarly.)
As a workaround, introduce a new port type for the ASPEED VUART that's identical to PORT_16550A as it had previously been using, but with UART_FCR_R_TRIG_00 instead to set the receive FIFO trigger level to one byte, which (experimentally) seems to avoid the problematic THRE behavior.
--- drivers/tty/serial/8250/8250_aspeed_vuart.c | 2 +- drivers/tty/serial/8250/8250_port.c | 8 ++++++++ include/uapi/linux/serial_core.h | 3 +++ 3 files changed, 12 insertions(+), 1 deletion(-)
drivers/tty/serial/8250/8250_aspeed_vuart.c +1 -1
@@ -487,7 +487,7 @@ static int aspeed_vuart_probe(struct platform_device *pdev) port.port.irq =irq_of_parse_and_map (np,0 ); port.port.handle_irq = aspeed_vuart_handle_irq; port.port.iotype =UPIO_MEM ; - port.port.type =PORT_16550A ; + port.port.type =PORT_ASPEED_VUART ; port.port.uartclk = clk; port.port.flags =UPF_SHARE_IRQ |UPF_BOOT_AUTOCONF |UPF_IOREMAP |UPF_FIXED_PORT |UPF_FIXED_TYPE |UPF_NO_THRE_TEST ;
drivers/tty/serial/8250/8250_port.c +8 -0
@@ -307,6 +307,14 @@ static const struct serial8250_config uart_config[] = { .rxtrig_bytes = {1, 32, 64, 112}, .flags = UART_CAP_FIFO | UART_CAP_SLEEP, }, + [PORT_ASPEED_VUART] = { + .name ="ASPEED VUART" , + .fifo_size = 16, + .tx_loadsz = 16, + .fcr = UART_FCR_ENABLE_FIFO | UART_FCR_R_TRIG_00, + .rxtrig_bytes = {1, 4, 8, 14}, + .flags = UART_CAP_FIFO, + }, };/* Uart divisor latch read */
include/uapi/linux/serial_core.h +3 -0
@@ -68,6 +68,9 @@/* NVIDIA Tegra Combined UART */ #define PORT_TEGRA_TCU 41 +/* ASPEED AST2x00 virtual UART */ +#define PORT_ASPEED_VUART 42 +/* Intel EG20 */ #define PORT_PCH_8LINE 44#define PORT_PCH_2LINE 45
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 659/1017 staging:iio:adc:ad7280a: Fix handing of device address bit reversing.
In reply to Greg Kroah-HartmanFrom: Jonathan Cameron <[email protected]>
[ Upstream commit f281e4ddbbc0b60f061bc18a2834e9363ba85f9f ]
The bit reversal was wrong for bits 1 and 3 of the 5 bits. Result is driver failure to probe if you have more than 2 daisy-chained devices. Discovered via QEMU based device emulation.
Fixes tag is for when this moved from a macro to a function, but it was broken before that.
--- drivers/staging/iio/adc/ad7280a.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/iio/adc/ad7280a.c +2 -2
@@ -107,9 +107,9 @@static unsigned int ad7280a_devaddr (unsigned int addr) {return ((addr &0x1 ) <<4 ) | - ((addr &0x2 ) <<3 ) | + ((addr &0x2 ) <<2 ) | (addr &0x4 ) | - ((addr &0x8 ) >>3 ) | + ((addr &0x8 ) >>2 ) | ((addr &0x10 ) >>4 ); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 660/1017 pinctrl: renesas: r8a77470: Reduce size for narrow VIN1 channel
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit 9e04a0eda84fccab0ac22a33825ad53f47c968c7 ]
The second video-in channel on RZ/G1C has only 12 data lanes, but the pin control driver uses the vin_data union, which is meant for 24 data lanes, thus wasting space.
Fix this by using the vin_data12 union instead.
This reduces kernel size by 96 bytes.
--- drivers/pinctrl/renesas/pfc-r8a77470.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/pinctrl/renesas/pfc-r8a77470.c +2 -2
@@ -2140,7 +2140,7 @@ static const unsigned int vin0_clk_mux[] = { VI0_CLK_MARK, };/* - VIN1 ------------------------------------------------------------------- */ -static const union vin_data vin1_data_pins = { +static const union vin_data12 vin1_data_pins = { .data12 = {RCAR_GP_PIN (3 ,1 ),RCAR_GP_PIN (3 ,2 ),RCAR_GP_PIN (3 ,3 ),RCAR_GP_PIN (3 ,4 ),
@@ -2150,7 +2150,7 @@ static const union vin_data vin1_data_pins = { RCAR_GP_PIN(3, 15), RCAR_GP_PIN(3, 16), }, }; -static const union vin_data vin1_data_mux = { +static const union vin_data12 vin1_data_mux = { .data12 = {VI1_DATA0_MARK ,VI1_DATA1_MARK ,VI1_DATA2_MARK ,VI1_DATA3_MARK ,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 661/1017 pinctrl: renesas: checker: Fix miscalculation of number of states
In reply to Greg Kroah-HartmanFrom: Geert Uytterhoeven <[email protected]>
[ Upstream commit de9b861018d46af27a5edff8b6baef35c0c0ad4f ]
The checker failed to validate all enum IDs in the description of a register with fixed-width register fields, due to a miscalculation of the number of described states: each register field of n bits can have "1 << n" possible states, not "1".
Increase SH_PFC_MAX_ENUMS accordingly, now more enum IDs are checked (SH-Mobile AG5 has more than 4000 enum IDs defined).
--- drivers/pinctrl/renesas/core.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pinctrl/renesas/core.c +3 -2
@@ -741,7 +741,7 @@ static int sh_pfc_suspend_init(struct sh_pfc *pfc) { return 0; }#ifdef DEBUG #define SH_PFC_MAX_REGS 300 -#define SH_PFC_MAX_ENUMS 3000 +#define SH_PFC_MAX_ENUMS 5000static unsigned int sh_pfc_errors__initdata ;static unsigned int sh_pfc_warnings__initdata ;
@@ -865,7 +865,8 @@ static void __init sh_pfc_check_cfg_reg(const char *drvname, GENMASK(cfg_reg->reg_width - 1, 0));if (cfg_reg->field_width) { - n = cfg_reg->reg_width / cfg_reg->field_width; + fw = cfg_reg->field_width; + n = (cfg_reg->reg_width / fw) << fw;/* Skip field checks (done at build time) */ goto check_enum_ids; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 662/1017 clk: qcom: ipq8074: Use floor ops for SDCC1 clock
In reply to Greg Kroah-HartmanFrom: Dirk Buchwalder <[email protected]>
[ Upstream commit b77d8306d84f83d1da68028a68c91da9c867b6f6 ]
Use floor ops on SDCC1 APPS clock in order to round down selected clock frequency and avoid overclocking SD/eMMC cards.
For example, currently HS200 cards were failling tuning as they were actually being clocked at 384MHz instead of 192MHz.
This caused some boards to disable 1.8V I/O and force the eMMC into the standard HS mode (50MHz) and that appeared to work despite the eMMC being overclocked to 96Mhz in that case.
There was a previous commit to use floor ops on SDCC clocks, but it looks to have only covered SDCC2 clock.
--- drivers/clk/qcom/gcc-ipq8074.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/qcom/gcc-ipq8074.c +1 -1
@@ -1074,7 +1074,7 @@ static struct clk_rcg2 sdcc1_apps_clk_src = { .name = "sdcc1_apps_clk_src", .parent_names = gcc_xo_gpll0_gpll2_gpll0_out_main_div2, .num_parents = 4, - .ops = &clk_rcg2_ops, + .ops = &clk_rcg2_floor_ops, }, };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 663/1017 phy: dphy: Correct lpx parameter and its derivatives(ta_{get,go,sure})
In reply to Greg Kroah-HartmanFrom: Liu Ying <[email protected]>
[ Upstream commit 3153fa38e38af566cf6454a03b1dbadaf6f323c0 ]
According to the comment of the function phy_mipi_dphy_get_default_config(), it uses minimum D-PHY timings based on MIPI D-PHY specification. They are derived from the valid ranges specified in Section 6.9, Table 14, Page 41 of the D-PHY specification (v1.2). The table 14 explicitly mentions that the minimum T-LPX parameter is 50 nanoseconds and the minimum TA-SURE parameter is T-LPX nanoseconds. Likewise, the kernel doc of the 'lpx' and 'ta_sure' members of struct phy_configure_opts_mipi_dphy mentions that the minimum values are 50000 picoseconds and @lpx picoseconds respectively. Also, the function phy_mipi_dphy_config_validate() checks if cfg->lpx is less than 50000 picoseconds and if cfg->ta_sure is less than cfg->lpx, which hints the same minimum values.
Without this patch, the function phy_mipi_dphy_get_default_config() wrongly sets cfg->lpx to 60000 picoseconds and cfg->ta_sure to 2 * cfg->lpx. So, let's correct them to 50000 picoseconds and cfg->lpx respectively.
Note that I've only tested the patch with RM67191 DSI panel on i.MX8mq EVK. Help is needed to test with other i.MX8mq, Meson and Rockchip platforms, as I don't have the hardwares.
--- drivers/phy/phy-core-mipi-dphy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/phy/phy-core-mipi-dphy.c +2 -2
@@ -64,10 +64,10 @@ int phy_mipi_dphy_get_default_config(unsigned long pixel_clock, cfg->hs_trail =max (4 *8 * ui,60000 +4 *4 * ui); cfg->init =100 ; - cfg->lpx =60000 ; + cfg->lpx =50000 ; cfg->ta_get =5 * cfg->lpx; cfg->ta_go =4 * cfg->lpx; - cfg->ta_sure =2 * cfg->lpx; + cfg->ta_sure = cfg->lpx; cfg->wakeup =1000 ; cfg->hs_clk_rate = hs_clk_rate;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 664/1017 phy: phy-brcm-usb: fixup BCM4908 support
In reply to Greg Kroah-HartmanFrom: Rafał Miłecki <[email protected]>
[ Upstream commit 32942d33d63d27714ed16a4176e5a99547adb6e0 ]
Just like every other family BCM4908 should get its own enum value. That is required to properly handle it in chipset conditional code.
The real change is excluding BCM4908 from the PLL reprogramming code (see brcmusb_usb3_pll_54mhz()). I'm not sure what's the BCM4908 reference clock frequency but:
1. BCM4908 custom driver from Broadcom's SDK doesn't reprogram PLL
2. Doing that in Linux driver stopped PHY handling some USB 3.0 devices
This change makes USB 3.0 PHY recognize e.g.:
1. 04e8:6860 - Samsung Electronics Co., Ltd Galaxy series, misc. (MTP mode)
2. 1058:259f - Western Digital My Passport 259F
Broadcom's STB SoCs come with a set of SUN_TOP_CTRL_* registers that allow reading chip family and product ids. Such a block & register is missing on BCM4908 so this commit introduces "compatible" string specific binding.
--- drivers/phy/broadcom/phy-brcm-usb-init.c | 36 ++++++++++++++++++++++++ drivers/phy/broadcom/phy-brcm-usb-init.h | 1 + drivers/phy/broadcom/phy-brcm-usb.c | 11 +++++++- 3 files changed, 47 insertions(+), 1 deletion(-)
drivers/phy/broadcom/phy-brcm-usb-init.c +36 -0
@@ -79,6 +79,7 @@enum brcm_family_type {BRCM_FAMILY_3390A0 , +BRCM_FAMILY_4908 ,BRCM_FAMILY_7250B0 ,BRCM_FAMILY_7271A0 ,BRCM_FAMILY_7364A0 ,
@@ -96,6 +97,7 @@ enum brcm_family_type {static const char *family_names[BRCM_FAMILY_COUNT ] = { USB_BRCM_FAMILY(3390A0), +USB_BRCM_FAMILY (4908 ), USB_BRCM_FAMILY(7250B0), USB_BRCM_FAMILY(7271A0), USB_BRCM_FAMILY(7364A0),
@@ -203,6 +205,27 @@ usb_reg_bits_map_table[BRCM_FAMILY_COUNT][USB_CTRL_SELECTOR_COUNT] = { USB_CTRL_USB_PM_USB20_HC_RESETB_VAR_MASK,ENDIAN_SETTINGS ,/* USB_CTRL_SETUP ENDIAN bits */ }, + /* 4908 */ + [BRCM_FAMILY_4908] = { +0 ,/* USB_CTRL_SETUP_SCB1_EN_MASK */ +0 ,/* USB_CTRL_SETUP_SCB2_EN_MASK */ +0 ,/* USB_CTRL_SETUP_SS_EHCI64BIT_EN_MASK */ +0 ,/* USB_CTRL_SETUP_STRAP_IPP_SEL_MASK */ +0 ,/* USB_CTRL_SETUP_OC3_DISABLE_MASK */ +0 ,/* USB_CTRL_PLL_CTL_PLL_IDDQ_PWRDN_MASK */ +0 ,/* USB_CTRL_USB_PM_BDC_SOFT_RESETB_MASK */ +USB_CTRL_USB_PM_XHC_SOFT_RESETB_MASK , +USB_CTRL_USB_PM_USB_PWRDN_MASK , +0 ,/* USB_CTRL_USB30_CTL1_XHC_SOFT_RESETB_MASK */ +0 ,/* USB_CTRL_USB30_CTL1_USB3_IOC_MASK */ +0 ,/* USB_CTRL_USB30_CTL1_USB3_IPP_MASK */ +0 ,/* USB_CTRL_USB_DEVICE_CTL1_PORT_MODE_MASK */ +0 ,/* USB_CTRL_USB_PM_SOFT_RESET_MASK */ +0 ,/* USB_CTRL_SETUP_CC_DRD_MODE_ENABLE_MASK */ +0 ,/* USB_CTRL_SETUP_STRAP_CC_DRD_MODE_ENABLE_SEL_MASK */ +0 ,/* USB_CTRL_USB_PM_USB20_HC_RESETB_VAR_MASK */ +0 ,/* USB_CTRL_SETUP ENDIAN bits */ + }, /* 7250b0 */ [BRCM_FAMILY_7250B0 ] = {USB_CTRL_SETUP_SCB1_EN_MASK ,
@@ -559,6 +582,7 @@ static void brcmusb_usb3_pll_54mhz(struct brcm_usb_init_params *params)*/ switch (params->selected_family) {case BRCM_FAMILY_3390A0 : +case BRCM_FAMILY_4908 :case BRCM_FAMILY_7250B0 :case BRCM_FAMILY_7366C0 :case BRCM_FAMILY_74371A0 :
@@ -1004,6 +1028,18 @@ static const struct brcm_usb_init_ops bcm7445_ops = { .set_dual_select = usb_set_dual_select, }; +void brcm_usb_dvr_init_4908 (struct brcm_usb_init_params *params) +{ +int fam; + + fam =BRCM_FAMILY_4908 ; + params->selected_family = fam; + params->usb_reg_bits_map = + &usb_reg_bits_map_table[fam][0 ]; + params->family_name = family_names[fam]; + params->ops = &bcm7445_ops; +} +void brcm_usb_dvr_init_7445 (struct brcm_usb_init_params *params) {int fam;
drivers/phy/broadcom/phy-brcm-usb-init.h +1 -0
@@ -64,6 +64,7 @@ struct brcm_usb_init_params {bool suspend_with_clocks; }; +void brcm_usb_dvr_init_4908 (struct brcm_usb_init_params *params);void brcm_usb_dvr_init_7445 (struct brcm_usb_init_params *params);void brcm_usb_dvr_init_7216 (struct brcm_usb_init_params *params);void brcm_usb_dvr_init_7211b0 (struct brcm_usb_init_params *params);
drivers/phy/broadcom/phy-brcm-usb.c +10 -1
@@ -283,6 +283,15 @@ static const struct attribute_group brcm_usb_phy_group = { .attrs = brcm_usb_phy_attrs, }; +static const struct match_chip_info chip_info_4908 = { + .init_func = &brcm_usb_dvr_init_4908, + .required_regs = { +BRCM_REGS_CTRL , +BRCM_REGS_XHCI_EC , +-1 , + }, +}; +static const struct match_chip_info chip_info_7216 = { .init_func = &brcm_usb_dvr_init_7216, .required_regs = {
@@ -318,7 +327,7 @@ static const struct match_chip_info chip_info_7445 = {static const struct of_device_id brcm_usb_dt_ids[] = { { .compatible ="brcm,bcm4908-usb-phy" , - .data = &chip_info_7445, + .data = &chip_info_4908, }, { .compatible ="brcm,bcm7216-usb-phy" ,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 665/1017 serial: 8250_mid: Balance reference count for PCI DMA device
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 67ec6dd0b257bd81b4e9fcac89b29da72f6265e5 ]
The pci_get_slot() increases its reference count, the caller must decrement the reference count by calling pci_dev_put().
Depends-on: d9eda9bab237 ("serial: 8250_pci: Intel MID UART support to its own driver")
--- drivers/tty/serial/8250/8250_mid.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-)
drivers/tty/serial/8250/8250_mid.c +15 -4
@@ -73,6 +73,11 @@ static int pnw_setup(struct mid8250 *mid, struct uart_port *p)return 0 ; } +static void pnw_exit (struct mid8250 *mid) +{ +pci_dev_put (mid->dma_dev); +} +static int tng_handle_irq (struct uart_port *p) {struct mid8250 *mid = p->private_data;
@@ -124,6 +129,11 @@ static int tng_setup(struct mid8250 *mid, struct uart_port *p)return 0 ; } +static void tng_exit (struct mid8250 *mid) +{ +pci_dev_put (mid->dma_dev); +} +static int dnv_handle_irq (struct uart_port *p) {struct mid8250 *mid = p->private_data;
@@ -330,9 +340,9 @@ static int mid8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)pci_set_drvdata (pdev, mid);return 0 ; + err: -if (mid->board->exit) - mid->board->exit (mid); + mid->board->exit (mid);return ret; }
@@ -342,8 +352,7 @@ static void mid8250_remove(struct pci_dev *pdev)serial8250_unregister_port (mid->line); -if (mid->board->exit) - mid->board->exit (mid); + mid->board->exit (mid); }static const struct mid8250_board pnw_board = {
@@ -351,6 +360,7 @@ static const struct mid8250_board pnw_board = { .freq = 50000000, .base_baud = 115200, .setup = pnw_setup, + .exit = pnw_exit, };static const struct mid8250_board tng_board = {
@@ -358,6 +368,7 @@ static const struct mid8250_board tng_board = { .freq = 38400000, .base_baud = 1843200, .setup = tng_setup, + .exit = tng_exit, };static const struct mid8250_board dnv_board = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 666/1017 serial: 8250_lpss: Balance reference count for PCI DMA device
In reply to Greg Kroah-HartmanFrom: Andy Shevchenko <[email protected]>
[ Upstream commit 5318f70da7e82649d794fc27d8a127c22aa3566e ]
The pci_get_slot() increases its reference count, the caller must decrement the reference count by calling pci_dev_put().
Depends-on: a13e19cf3dc1 ("serial: 8250_lpss: split LPSS driver to separate module")
--- drivers/tty/serial/8250/8250_lpss.c | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-)
drivers/tty/serial/8250/8250_lpss.c +22 -6
@@ -117,8 +117,7 @@ static int byt_serial_setup(struct lpss8250 *lpss, struct uart_port *port) {struct dw_dma_slave *param = &lpss->dma_param;struct pci_dev *pdev =to_pci_dev (port->dev); -unsigned int dma_devfn =PCI_DEVFN (PCI_SLOT (pdev->devfn),0 ); -struct pci_dev *dma_dev =pci_get_slot (pdev->bus, dma_devfn); +struct pci_dev *dma_dev;switch (pdev->device) {case PCI_DEVICE_ID_INTEL_BYT_UART1 :
@@ -137,6 +136,8 @@ static int byt_serial_setup(struct lpss8250 *lpss, struct uart_port *port)return -EINVAL ; } + dma_dev =pci_get_slot (pdev->bus,PCI_DEVFN (PCI_SLOT (pdev->devfn),0 )); + param->dma_dev = &dma_dev->dev; param->m_master =0 ; param->p_master =1 ;
@@ -152,6 +153,14 @@ static int byt_serial_setup(struct lpss8250 *lpss, struct uart_port *port)return 0 ; } +static void byt_serial_exit (struct lpss8250 *lpss) +{ +struct dw_dma_slave *param = &lpss->dma_param; + +/* Paired with pci_get_slot() in the byt_serial_setup() above */ +put_device (param->dma_dev); +} +static int ehl_serial_setup (struct lpss8250 *lpss,struct uart_port *port) {struct uart_8250_dma *dma = &lpss->data.dma;
@@ -170,6 +179,13 @@ static int ehl_serial_setup(struct lpss8250 *lpss, struct uart_port *port)return 0 ; } +static void ehl_serial_exit (struct lpss8250 *lpss) +{ +struct uart_8250_port *up =serial8250_get_port (lpss->data.line); + + up->dma =NULL ; +} +#ifdef CONFIG_SERIAL_8250_DMA static const struct dw_dma_platform_data qrk_serial_dma_pdata = { .nr_channels = 2,
@@ -344,8 +360,7 @@ static int lpss8250_probe(struct pci_dev *pdev, const struct pci_device_id *id)return 0 ; err_exit: -if (lpss->board->exit) - lpss->board->exit (lpss); + lpss->board->exit (lpss);pci_free_irq_vectors (pdev);return ret; }
@@ -356,8 +371,7 @@ static void lpss8250_remove(struct pci_dev *pdev)serial8250_unregister_port (lpss->data.line); -if (lpss->board->exit) - lpss->board->exit (lpss); + lpss->board->exit (lpss);pci_free_irq_vectors (pdev); }
@@ -365,12 +379,14 @@ static const struct lpss8250_board byt_board = { .freq = 100000000, .base_baud = 2764800, .setup = byt_serial_setup, + .exit = byt_serial_exit, };static const struct lpss8250_board ehl_board = { .freq =200000000 , .base_baud =12500000 , .setup = ehl_serial_setup, + .exit = ehl_serial_exit, };static const struct lpss8250_board qrk_board = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 667/1017 NFS: Use of mapping_set_error() results in spurious errors
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit 6c984083ec2453dfd3fcf98f392f34500c73e3f2 ]
The use of mapping_set_error() in conjunction with calls to filemap_check_errors() is problematic because every error gets reported as either an EIO or an ENOSPC by filemap_check_errors() in functions such as filemap_write_and_wait() or filemap_write_and_wait_range(). In almost all cases, we prefer to use the more nuanced wb errors.
--- fs/nfs/write.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/nfs/write.c +4 -1
@@ -315,7 +315,10 @@ static void nfs_mapping_set_error(struct page *page, int error)struct address_space *mapping =page_file_mapping (page);SetPageError (page); -mapping_set_error (mapping, error); +filemap_set_wb_err (mapping, error); +if (mapping->host) +errseq_set (&mapping->host->i_sb->s_wb_err, + error == -ENOSPC ? -ENOSPC : -EIO );nfs_set_pageerror (mapping); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 668/1017 serial: 8250: Fix race condition in RTS-after-send handling
In reply to Greg Kroah-HartmanFrom: Uwe Kleine-König <[email protected]>
[ Upstream commit dedab69fd650ea74710b2e626e63fd35584ef773 ]
Set em485->active_timer = NULL isn't always enough to take out the stop timer. While there is a check that it acts in the right state (i.e. waiting for RTS-after-send to pass after sending some chars) but the following might happen:
- CPU1: some chars send, shifter becomes empty, stop tx timer armed
- CPU0: more chars send before RTS-after-send expired
- CPU0: shifter empty irq, port lock taken
- CPU1: tx timer triggers, waits for port lock
- CPU0: em485->active_timer = &em485->stop_tx_timer, hrtimer_start(), releases lock()
- CPU1: get lock, see em485->active_timer == &em485->stop_tx_timer, tear down RTS too early
This fix bases on research done by Steffen Trumtrar.
--- drivers/tty/serial/8250/8250_port.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/tty/serial/8250/8250_port.c +12 -0
@@ -1623,6 +1623,18 @@ static inline void start_tx_rs485(struct uart_port *port)struct uart_8250_port *up =up_to_u8250p (port);struct uart_8250_em485 *em485 = up->em485; +/* +* While serial8250_em485_handle_stop_tx() is a noop if +* em485->active_timer != &em485->stop_tx_timer, it might happen that +* the timer is still armed and triggers only after the current bunch of +* chars is send and em485->active_timer == &em485->stop_tx_timer again. +* So cancel the timer. There is still a theoretical race condition if +* the timer is already running and only comes around to check for +* em485->active_timer when &em485->stop_tx_timer is armed again. +*/ +if (em485->active_timer == &em485->stop_tx_timer) +hrtimer_try_to_cancel (&em485->stop_tx_timer); + em485->active_timer =NULL ;if (em485->tx_stopped) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 669/1017 iio: adc: Add check for devm_request_threaded_irq
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit b30537a4cedcacf0ade2f33ebb7610178ed1e7d7 ]
As the potential failure of the devm_request_threaded_irq(), it should be better to check the return value and return error if fails.
--- drivers/iio/adc/twl6030-gpadc.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iio/adc/twl6030-gpadc.c +2 -0
@@ -911,6 +911,8 @@ static int twl6030_gpadc_probe(struct platform_device *pdev) ret =devm_request_threaded_irq (dev, irq,NULL , twl6030_gpadc_irq_handler,IRQF_ONESHOT ,"twl6030_gpadc" , indio_dev); +if (ret) +return ret; ret =twl6030_gpadc_enable_irq (TWL6030_GPADC_RT_SW1_EOC_MASK );if (ret <0 ) {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 670/1017 habanalabs: Add check for pci_enable_device
In reply to Greg Kroah-HartmanFrom: Jiasheng Jiang <[email protected]>
[ Upstream commit 9c27896ac1bb83ea5c461ce6f7089d02102a2b21 ]
As the potential failure of the pci_enable_device(), it should be better to check the return value and return error if fails.
--- drivers/misc/habanalabs/common/debugfs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/misc/habanalabs/common/debugfs.c +2 -0
@@ -856,6 +856,8 @@ static ssize_t hl_set_power_state(struct file *f, const char __user *buf,pci_set_power_state (hdev->pdev,PCI_D0 );pci_restore_state (hdev->pdev); rc =pci_enable_device (hdev->pdev); +if (rc <0 ) +return rc; }else if (value ==2 ) {pci_save_state (hdev->pdev);pci_disable_device (hdev->pdev);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 671/1017 NFS: Return valid errors from nfs2/3_decode_dirent()
In reply to Greg Kroah-HartmanFrom: Trond Myklebust <[email protected]>
[ Upstream commit 64cfca85bacde54caa64e0ab855c48734894fa37 ]
Valid return values for decode_dirent() callback functions are:
0: Success
-EBADCOOKIE: End of directory
-EAGAIN: End of xdr_stream
All errors need to map into one of those three values.
--- fs/nfs/nfs2xdr.c | 2 +- fs/nfs/nfs3xdr.c | 21 ++++++--------------- 2 files changed, 7 insertions(+), 16 deletions(-)
fs/nfs/nfs2xdr.c +1 -1
@@ -949,7 +949,7 @@ int nfs2_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, error =decode_filename_inline (xdr, &entry->name, &entry->len);if (unlikely (error)) -return error; +return -EAGAIN ;/* * The type (size and byte order) of nfscookie isn't defined in
fs/nfs/nfs3xdr.c +6 -15
@@ -1967,7 +1967,6 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, bool plus) {struct user_namespace *userns =rpc_userns (entry->server->client); -struct nfs_entry old = *entry;__be32 *p;int error;u64 new_cookie;
@@ -1987,15 +1986,15 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, error =decode_fileid3 (xdr, &entry->ino);if (unlikely (error)) -return error; +return -EAGAIN ; error =decode_inline_filename3 (xdr, &entry->name, &entry->len);if (unlikely (error)) -return error; +return -EAGAIN ; error =decode_cookie3 (xdr, &new_cookie);if (unlikely (error)) -return error; +return -EAGAIN ; entry->d_type =DT_UNKNOWN ;
@@ -2003,7 +2002,7 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, entry->fattr->valid =0 ; error =decode_post_op_attr (xdr, entry->fattr, userns);if (unlikely (error)) -return error; +return -EAGAIN ;if (entry->fattr->valid &NFS_ATTR_FATTR_V3 ) entry->d_type =nfs_umode_to_dtype (entry->fattr->mode);
@@ -2018,11 +2017,8 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,return -EAGAIN ;if (*p != xdr_zero) { error =decode_nfs_fh3 (xdr, entry->fh); -if (unlikely (error)) { -if (error == -E2BIG ) - goto out_truncated; -return error; - } +if (unlikely (error)) +return -EAGAIN ; }else zero_nfs_fh3 (entry->fh); }
@@ -2031,11 +2027,6 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry, entry->cookie = new_cookie;return 0 ; - -out_truncated: -dprintk ("NFS: directory entry contains invalid file handle\n" ); - *entry = old; -return -EAGAIN ; }/*
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 672/1017 staging: r8188eu: fix endless loop in recv_func
In reply to Greg Kroah-HartmanFrom: Martin Kaiser <[email protected]>
[ Upstream commit 1327fcf175fa63d3b7a058b8148ed7714acdc035 ]
Fix an endless loop in recv_func. If pending_frame is not NULL, we're stuck in the while loop forever. We have to call rtw_alloc_recvframe each time we loop.
--- drivers/staging/r8188eu/core/rtw_recv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/r8188eu/core/rtw_recv.c +1 -2
@@ -1853,8 +1853,7 @@ static int recv_func(struct adapter *padapter, struct recv_frame *rframe)struct recv_frame *pending_frame;int cnt =0 ; - pending_frame =rtw_alloc_recvframe (&padapter->recvpriv.uc_swdec_pending_queue); -while (pending_frame) { +while ((pending_frame =rtw_alloc_recvframe (&padapter->recvpriv.uc_swdec_pending_queue))) { cnt++;recv_func_posthandle (padapter, pending_frame); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 673/1017 dma-debug: fix return value of __setup handlers
In reply to Greg Kroah-HartmanFrom: Randy Dunlap <[email protected]>
[ Upstream commit 80e4390981618e290616dbd06ea190d4576f219d ]
When valid kernel command line parameters
dma_debug=off dma_debug_entries=100
are used, they are reported as Unknown parameters and added to init's environment strings, polluting it.
Unknown kernel command line parameters "BOOT_IMAGE=/boot/bzImage-517rc5
dma_debug=off dma_debug_entries=100", will be passed to user space.
and
Run /sbin/init as init process
with arguments:
/sbin/init
with environment:
HOME=/
TERM=linux
BOOT_IMAGE=/boot/bzImage-517rc5
dma_debug=off
dma_debug_entries=100Return 1 from these __setup handlers to indicate that the command line option has been handled.
--- kernel/dma/debug.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/dma/debug.c +2 -2
@@ -927,7 +927,7 @@ static __init int dma_debug_cmdline(char *str) global_disable = true; } -return 0 ; +return 1 ; }static __init int dma_debug_entries_cmdline (char *str)
@@ -936,7 +936,7 @@ static __init int dma_debug_entries_cmdline(char *str)return -EINVAL ;if (!get_option (&str, &nr_prealloc_entries)) nr_prealloc_entries =PREALLOC_DMA_DEBUG_ENTRIES ; -return 0 ; +return 1 ; }__setup ("dma_debug=" , dma_debug_cmdline);
Signature · 8 lines
2.34.1 _______________________________________________ iommu mailing list [email protected] https://lists.linuxfoundation.org/mailman/listinfo/iommu
Greg Kroah-Hartman
maintainerPATCH 674/1017 clk: imx7d: Remove audio_mclk_root_clk
In reply to Greg Kroah-HartmanFrom: Abel Vesa <[email protected]>
[ Upstream commit eccac77ede3946c90143447cdc785dc16aec4b24 ]
The audio_mclk_root_clk was added as a gate with the CCGR121 (0x4790), but according to the reference manual, there is no such gate. The CCGR121 belongs to ECSPI2 and it is not shared.
--- drivers/clk/imx/clk-imx7d.c | 1 - 1 file changed, 1 deletion(-)
drivers/clk/imx/clk-imx7d.c +0 -1
@@ -849,7 +849,6 @@ static void __init imx7d_clocks_init(struct device_node *ccm_node) hws[IMX7D_WDOG4_ROOT_CLK ] =imx_clk_hw_gate4 ("wdog4_root_clk" ,"wdog_post_div" , base +0x49f0 ,0 ); hws[IMX7D_KPP_ROOT_CLK ] =imx_clk_hw_gate4 ("kpp_root_clk" ,"ipg_root_clk" , base +0x4aa0 ,0 ); hws[IMX7D_CSI_MCLK_ROOT_CLK ] =imx_clk_hw_gate4 ("csi_mclk_root_clk" ,"csi_mclk_post_div" , base +0x4490 ,0 ); - hws[IMX7D_AUDIO_MCLK_ROOT_CLK ] =imx_clk_hw_gate4 ("audio_mclk_root_clk" ,"audio_mclk_post_div" , base +0x4790 ,0 ); hws[IMX7D_WRCLK_ROOT_CLK ] =imx_clk_hw_gate4 ("wrclk_root_clk" ,"wrclk_post_div" , base +0x47a0 ,0 ); hws[IMX7D_USB_CTRL_CLK ] =imx_clk_hw_gate4 ("usb_ctrl_clk" ,"ahb_root_clk" , base +0x4680 ,0 ); hws[IMX7D_USB_PHY1_CLK ] =imx_clk_hw_gate4 ("usb_phy1_clk" ,"pll_usb1_main_clk" , base +0x46a0 ,0 );
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 675/1017 clk: imx: off by one in imx_lpcg_parse_clks_from_dt()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
[ Upstream commit 135efc3a76d127691afaf1864e4ab627bf09d53d ]
The > needs to be >= to prevent an off by one access.
--- drivers/clk/imx/clk-imx8qxp-lpcg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/imx/clk-imx8qxp-lpcg.c +1 -1
@@ -248,7 +248,7 @@ static int imx_lpcg_parse_clks_from_dt(struct platform_device *pdev,for (i =0 ; i < count; i++) { idx = bit_offset[i] /4 ; -if (idx >IMX_LPCG_MAX_CLKS ) { +if (idx >=IMX_LPCG_MAX_CLKS ) {dev_warn (&pdev->dev,"invalid bit offset of clock %d\n" , i); ret = -EINVAL ;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 676/1017 clk: at91: sama7g5: fix parents of PDMCs GCLK
In reply to Greg Kroah-HartmanFrom: Codrin Ciubotariu <[email protected]>
[ Upstream commit 1a944729d8635fa59638f24e8727d5ccaa0c8c19 ]
Audio PLL can be used as parent by the GCLKs of PDMCs.
--- drivers/clk/at91/sama7g5.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/clk/at91/sama7g5.c +4 -4
@@ -696,16 +696,16 @@ static const struct { { .n = "pdmc0_gclk", .id = 68, .r = { .max = 50000000 }, - .pp = { "syspll_divpmcck", "baudpll_divpmcck", }, - .pp_mux_table = { 5, 8, }, + .pp = { "syspll_divpmcck", "audiopll_divpmcck", }, + .pp_mux_table = { 5, 9, }, .pp_count = 2, .pp_chg_id = INT_MIN, }, { .n = "pdmc1_gclk", .id = 69, .r = { .max = 50000000, }, - .pp = { "syspll_divpmcck", "baudpll_divpmcck", }, - .pp_mux_table = { 5, 8, }, + .pp = { "syspll_divpmcck", "audiopll_divpmcck", }, + .pp_mux_table = { 5, 9, }, .pp_count = 2, .pp_chg_id = INT_MIN, },
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 677/1017 clk: qcom: clk-rcg2: Update logic to calculate D value for RCG
In reply to Greg Kroah-HartmanFrom: Taniya Das <[email protected]>
[ Upstream commit 58922910add18583d5273c2edcdb9fd7bf4eca02 ]
The display pixel clock has a requirement on certain newer platforms to support M/N as (2/3) and the final D value calculated results in underflow errors.
As the current implementation does not check for D value is within the accepted range for a given M & N value. Update the logic to calculate the final D value based on the range.
--- drivers/clk/qcom/clk-rcg2.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-)
drivers/clk/qcom/clk-rcg2.c +11 -2
@@ -264,7 +264,7 @@ static int clk_rcg2_determine_floor_rate(struct clk_hw *hw,static int __clk_rcg2_configure (struct clk_rcg2 *rcg,const struct freq_tbl *f) { -u32 cfg, mask; +u32 cfg, mask, d_val, not2d_val, n_minus_m;struct clk_hw *hw = &rcg->clkr.hw;int ret, index =qcom_find_src_index (hw, rcg->parent_map, f->src);
@@ -283,8 +283,17 @@ static int __clk_rcg2_configure(struct clk_rcg2 *rcg, const struct freq_tbl *f)if (ret)return ret; +/* Calculate 2d value */ + d_val = f->n; + + n_minus_m = f->n - f->m; + n_minus_m *=2 ; + + d_val =clamp_t (u32, d_val, f->m, n_minus_m); + not2d_val = ~d_val & mask; + ret =regmap_update_bits (rcg->clkr.regmap, -RCG_D_OFFSET (rcg), mask, ~f->n); +RCG_D_OFFSET (rcg), mask, not2d_val);if (ret)return ret; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 678/1017 clk: qcom: clk-rcg2: Update the frac table for pixel clock
In reply to Greg Kroah-HartmanFrom: Taniya Das <[email protected]>
[ Upstream commit b527358cb4cd58a8279c9062b0786f1fab628fdc ]
Support the new numerator and denominator for pixel clock on SM8350 and support rgb101010, RGB888 use cases on SM8450.
--- drivers/clk/qcom/clk-rcg2.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/qcom/clk-rcg2.c +1 -0
@@ -729,6 +729,7 @@ static const struct frac_entry frac_table_pixel[] = { { 2, 9 }, { 4, 9 }, { 1, 1 }, + { 2, 3 }, { } };
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 679/1017 dmaengine: hisi_dma: fix MSI allocate fail when reload hisi_dma
In reply to Greg Kroah-HartmanFrom: Jie Hai <[email protected]>
[ Upstream commit b95044b38425f563404234d96bbb20cc6360c7e1 ]
Remove the loaded hisi_dma driver and reload it, the driver fails to work properly. The following error is reported in the kernel log:
[ 1475.597609] hisi_dma 0000:7b:00.0: Failed to allocate MSI vectors! [ 1475.604915] hisi_dma: probe of 0000:7b:00.0 failed with error -28
As noted in "The MSI Driver Guide HOWTO"[1], the number of MSI interrupt must be a power of two. The Kunpeng DMA driver allocates 30 MSI interrupts. As a result, no space left on device is reported when the driver is reloaded and allocates interrupt vectors from the interrupt domain.
This patch changes the number of interrupt vectors allocated by hisi_dma driver to 32 to avoid this problem.
[1] https://www.kernel.org/doc/html/latest/PCI/msi-howto.html
--- drivers/dma/hisi_dma.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/dma/hisi_dma.c +1 -1
@@ -30,7 +30,7 @@#define HISI_DMA_MODE 0x217c#define HISI_DMA_OFFSET 0x100 -#define HISI_DMA_MSI_NUM 30 +#define HISI_DMA_MSI_NUM 32#define HISI_DMA_CHAN_NUM 30#define HISI_DMA_Q_DEPTH_VAL 1024
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 680/1017 remoteproc: qcom: Fix missing of_node_put in adsp_alloc_memory_region
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 505b5b1616e200042999de715dbe7c1e2735cd65 ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done.
--- drivers/remoteproc/qcom_q6v5_adsp.c | 1 + 1 file changed, 1 insertion(+)
drivers/remoteproc/qcom_q6v5_adsp.c +1 -0
@@ -408,6 +408,7 @@ static int adsp_alloc_memory_region(struct qcom_adsp *adsp) } ret =of_address_to_resource (node,0 , &r); +of_node_put (node);if (ret)return ret;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 681/1017 remoteproc: qcom_wcnss: Add missing of_node_put() in wcnss_alloc_memory_region
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 8f90161a66bc3d6b9fe8dde4d9028d20eae1b62a ]
The device_node pointer is returned by of_parse_phandle() with refcount incremented. We should use of_node_put() on it when done.
--- drivers/remoteproc/qcom_wcnss.c | 1 + 1 file changed, 1 insertion(+)
drivers/remoteproc/qcom_wcnss.c +1 -0
@@ -500,6 +500,7 @@ static int wcnss_alloc_memory_region(struct qcom_wcnss *wcnss) } ret =of_address_to_resource (node,0 , &r); +of_node_put (node);if (ret)return ret;
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 682/1017 remoteproc: qcom_q6v5_mss: Fix some leaks in q6v5_alloc_memory_region
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 07a5dcc4bed9d7cae54adf5aa10ff9f037a3204b ]
The device_node pointer is returned by of_parse_phandle() or of_get_child_by_name() with refcount incremented. We should use of_node_put() on it when done.
This function only call of_node_put(node) when of_address_to_resource succeeds, missing error cases.
--- drivers/remoteproc/qcom_q6v5_mss.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
drivers/remoteproc/qcom_q6v5_mss.c +7 -4
@@ -1806,18 +1806,20 @@ static int q6v5_alloc_memory_region(struct q6v5 *qproc)* reserved memory regions from device's memory-region property. */ child =of_get_child_by_name (qproc->dev->of_node,"mba" ); -if (!child) +if (!child) { node =of_parse_phandle (qproc->dev->of_node,"memory-region" ,0 ); -else + }else { node =of_parse_phandle (child,"memory-region" ,0 ); +of_node_put (child); + } ret =of_address_to_resource (node,0 , &r); +of_node_put (node);if (ret) {dev_err (qproc->dev,"unable to resolve mba region\n" );return ret; } -of_node_put (node); qproc->mba_phys = r.start; qproc->mba_size =resource_size (&r);
@@ -1828,14 +1830,15 @@ static int q6v5_alloc_memory_region(struct q6v5 *qproc) }else { child =of_get_child_by_name (qproc->dev->of_node,"mpss" ); node =of_parse_phandle (child,"memory-region" ,0 ); +of_node_put (child); } ret =of_address_to_resource (node,0 , &r); +of_node_put (node);if (ret) {dev_err (qproc->dev,"unable to resolve mpss region\n" );return ret; } -of_node_put (node); qproc->mpss_phys = qproc->mpss_reloc = r.start; qproc->mpss_size =resource_size (&r);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 683/1017 nvdimm/region: Fix default alignment for small regions
In reply to Greg Kroah-HartmanFrom: Dan Williams <[email protected]>
[ Upstream commit d9d290d7e659e9db3e4518040cc18b97f5535f4a ]
In preparation for removing BLK aperture support the NVDIMM unit tests discovered that the default alignment can be set higher than the capacity of the region. Fall back to PAGE_SIZE in that case.
Given this has not been seen in the wild, elide notifying -stable.
--- drivers/nvdimm/region_devs.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/nvdimm/region_devs.c +3 -0
@@ -1025,6 +1025,9 @@ static unsigned long default_align(struct nd_region *nd_region) } } +if (nd_region->ndr_size <MEMREMAP_COMPAT_ALIGN_MAX ) + align =PAGE_SIZE ; + mappings =max_t (u16,1 , nd_region->ndr_mappings);div_u64_rem (align, mappings, &remainder);if (remainder)
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 684/1017 clk: actions: Terminate clk_div_table with sentinel element
In reply to Greg Kroah-HartmanFrom: Jonathan Neuschäfer <[email protected]>
[ Upstream commit d8a441e53e2434b1401e52dfd66b05263e442edc ]
In order that the end of a clk_div_table can be detected, it must be terminated with a sentinel element (.div = 0).
In owl-s900.s, the { 0, 8 } element was probably meant to be just that, so this patch changes { 0, 8 } to { 0, 0 }.
--- drivers/clk/actions/owl-s700.c | 1 + drivers/clk/actions/owl-s900.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
drivers/clk/actions/owl-s700.c +1 -0
@@ -162,6 +162,7 @@ static struct clk_div_table hdmia_div_table[] = {static struct clk_div_table rmii_div_table[] = { {0 ,4 }, {1 ,10 }, + {0 ,0 } };/* divider clocks */
drivers/clk/actions/owl-s900.c +1 -1
@@ -140,7 +140,7 @@ static struct clk_div_table rmii_ref_div_table[] = {static struct clk_div_table usb3_mac_div_table[] = { {1 ,2 }, {2 ,3 }, {3 ,4 }, - {0 ,8 }, + {0 ,0 } };static struct clk_div_table i2s_div_table[] = {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 685/1017 clk: loongson1: Terminate clk_div_table with sentinel element
In reply to Greg Kroah-HartmanFrom: Jonathan Neuschäfer <[email protected]>
[ Upstream commit 3eb00f89162e80083dfcaa842468b510462cfeaa ]
In order that the end of a clk_div_table can be detected, it must be terminated with a sentinel element (.div = 0).
--- drivers/clk/loongson1/clk-loongson1c.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/loongson1/clk-loongson1c.c +1 -0
@@ -37,6 +37,7 @@ static const struct clk_div_table ahb_div_table[] = { [1] = { .val = 1, .div = 4 }, [2] = { .val = 2, .div = 3 }, [3] = { .val = 3, .div = 3 }, + [4] = { /* sentinel */ } };void __init ls1x_clk_init (void )
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 686/1017 clk: hisilicon: Terminate clk_div_table with sentinel element
In reply to Greg Kroah-HartmanFrom: Jonathan Neuschäfer <[email protected]>
[ Upstream commit 113b261bdf2b4fd34e7769a147a7acd0a4d9137f ]
In order that the end of a clk_div_table can be detected, it must be terminated with a sentinel element (.div = 0).
--- drivers/clk/hisilicon/clk-hi3559a.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/hisilicon/clk-hi3559a.c +2 -2
@@ -611,8 +611,8 @@ static struct hisi_mux_clock hi3559av100_shub_mux_clks[] = {/* shub div clk */ -static struct clk_div_table shub_spi_clk_table[] = {{0 ,8 }, {1 ,4 }, {2 ,2 }}; -static struct clk_div_table shub_uart_div_clk_table[] = {{1 ,8 }, {2 ,4 }}; +static struct clk_div_table shub_spi_clk_table[] = {{0 ,8 }, {1 ,4 }, {2 ,2 }, {/*sentinel*/ }}; +static struct clk_div_table shub_uart_div_clk_table[] = {{1 ,8 }, {2 ,4 }, {/*sentinel*/ }};static struct hisi_divider_clock hi3559av100_shub_div_clks[] = { {HI3559AV100_SHUB_SPI_SOURCE_CLK ,"clk_spi_clk" ,"shub_clk" ,0 ,0x20 ,24 ,2 ,
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 687/1017 clk: clps711x: Terminate clk_div_table with sentinel element
In reply to Greg Kroah-HartmanFrom: Jonathan Neuschäfer <[email protected]>
[ Upstream commit 8bed4ed5aa3431085d9d27afc35d684856460eda ]
In order that the end of a clk_div_table can be detected, it must be terminated with a sentinel element (.div = 0).
--- drivers/clk/clk-clps711x.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/clk/clk-clps711x.c +2 -0
@@ -28,11 +28,13 @@ static const struct clk_div_table spi_div_table[] = { { .val = 1, .div = 8, }, { .val = 2, .div = 2, }, { .val = 3, .div = 1, }, + {/* sentinel */ } };static const struct clk_div_table timer_div_table[] = { { .val =0 , .div =256 , }, { .val =1 , .div =1 , }, + {/* sentinel */ } }; struct clps711x_clk {
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 688/1017 clk: Fix clk_hw_get_clk() when dev is NULL
In reply to Greg Kroah-HartmanFrom: Maxime Ripard <[email protected]>
[ Upstream commit 0c1b56df451716ba207bbf59f303473643eee4fd ]
Any registered clk_core structure can have a NULL pointer in its dev field. While never actually documented, this is evidenced by the wide usage of clk_register and clk_hw_register with a NULL device pointer, and the fact that the core of_clk_hw_register() function also passes a NULL device pointer.
A call to clk_hw_get_clk() on a clk_hw struct whose clk_core is in that case will result in a NULL pointer derefence when it calls dev_name() on that NULL device pointer.
Add a test for this case and use NULL as the dev_id if the device pointer is NULL.
--- drivers/clk/clk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clk/clk.c +2 -1
@@ -3733,8 +3733,9 @@ struct clk *clk_hw_create_clk(struct device *dev, struct clk_hw *hw,struct clk *clk_hw_get_clk (struct clk_hw *hw,const char *con_id) {struct device *dev = hw->core->dev; +const char *name = dev ?dev_name (dev) :NULL ; -return clk_hw_create_clk (dev, hw,dev_name (dev), con_id); +return clk_hw_create_clk (dev, hw, name, con_id); }EXPORT_SYMBOL (clk_hw_get_clk);
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 689/1017 clk: tegra: tegra124-emc: Fix missing put_device() call in emc_ensure_emc_driver
In reply to Greg Kroah-HartmanFrom: Miaoqian Lin <[email protected]>
[ Upstream commit 6d6ef58c2470da85a99119f74d34216c8074b9f0 ]
The reference taken by 'of_find_device_by_node()' must be released when not needed anymore.
Add the corresponding 'put_device()' in the error handling path.
--- drivers/clk/tegra/clk-tegra124-emc.c | 1 + 1 file changed, 1 insertion(+)
drivers/clk/tegra/clk-tegra124-emc.c +1 -0
@@ -198,6 +198,7 @@ static struct tegra_emc *emc_ensure_emc_driver(struct tegra_clk_emc *tegra) tegra->emc =platform_get_drvdata (pdev);if (!tegra->emc) { +put_device (&pdev->dev);pr_err ("%s: cannot find EMC driver\n" , __func__);return NULL ; }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 690/1017 mailbox: imx: fix crash in resume on i.mx8ulp
In reply to Greg Kroah-HartmanFrom: Robin Gong <[email protected]>
[ Upstream commit 8219efd08a0aa1d7944bdb66d84ba57549258968 ]
check 'priv->clk' before 'imx_mu_read()' otherwise crash happens on i.mx8ulp, since clock not enabled.
--- drivers/mailbox/imx-mailbox.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mailbox/imx-mailbox.c +1 -1
@@ -718,7 +718,7 @@ static int __maybe_unused imx_mu_resume_noirq(struct device *dev)* send failed, may lead to system freeze. This issue * is observed by testing freeze mode suspend. */ -if (!imx_mu_read (priv, priv->dcfg->xCR[0 ]) && !priv->clk) { +if (!priv->clk && !imx_mu_read (priv, priv->dcfg->xCR[0 ])) {for (i =0 ; i < IMX_MU_xCR_MAX; i++)imx_mu_write (priv, priv->xcr[i], priv->dcfg->xCR[i]); }
Signature · 1 line
2.34.1
Greg Kroah-Hartman
maintainerPATCH 691/1017 NFS: remove unneeded check in decode_devicenotify_args()
In reply to Greg Kroah-HartmanFrom: Alexey Khoroshilov <[email protected]>
[ Upstream commit cb8fac6d2727f79f211e745b16c9abbf4d8be652 ]
[You don't often get email from [email protected]. Learn why this is important at http://aka.ms/LearnAboutSenderIdentification.]
Overflow check in not needed anymore after we switch to kmalloc_array().
--- fs/nfs/callback_xdr.c | 4 ---- 1 file changed, 4 deletions(-)
fs/nfs/callback_xdr.c +0 -4
@@ -271,10 +271,6 @@ __be32 decode_devicenotify_args(struct svc_rqst *rqstp, n =ntohl (*p++);if (n ==0 ) goto out; -if (n >ULONG_MAX /sizeof (*args->devs)) { - status =htonl (NFS4ERR_BADXDR ); - goto out; - } args->devs =kmalloc_array (n,sizeof (*args->devs),GFP_KERNEL );if (!args->devs) {
Signature · 1 line
2.34.1