4.14.144-stable review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 4.14.144-stable review
This is the start of the stable review cycle for the 4.14.144 release. There are 21 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun 15 Sep 2019 01:03:32 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.144-rc1.gz
or in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.14.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.14.144-rc1
yongduan <[email protected]>
vhost: make sure log_num < in_num
Michael S. Tsirkin <[email protected]>
vhost: block speculation of translated descriptors
YueHaibing <[email protected]>
kernel/module: Fix mem leak in module_add_modinfo_attrs
Nathan Chancellor <[email protected]>
clk: s2mps11: Add used attribute to s2mps11_dt_match
Nicolas Boichat <[email protected]>
scripts/decode_stacktrace: match basepath using shell prefix operator, not regex
Dmitry Voytik <[email protected]>
arm64: dts: rockchip: enable usb-host regulators at boot on rk3328-rock64
Christophe Leroy <[email protected]>
powerpc/64: mark start_here_multiplatform as __ref
Dexuan Cui <[email protected]>
hv_sock: Fix hang when a connection is closed
Sven Eckelmann <[email protected]>
batman-adv: Only read OGM tvlv_len after buffer len check
Eric Dumazet <[email protected]>
batman-adv: fix uninit-value in batadv_netlink_get_ifindex()
Tiwei Bie <[email protected]>
vhost/test: fix build for vhost test
Vignesh R <[email protected]>
PCI: dra7xx: Fix legacy INTD IRQ handling
Niklas Cassel <[email protected]>
PCI: designware-ep: Fix find_first_zero_bit() usage
Eric Dumazet <[email protected]>
ip6: fix skb leak in ip6frag_expire_frag_queue()
Cong Wang <[email protected]>
xfrm: clean up xfrm protocol checks
Gustavo Romero <[email protected]>
powerpc/tm: Fix FP/VMX unavailable exceptions inside a transaction
Dan Carpenter <[email protected]>
drm/vmwgfx: Fix double free in vmw_recv_msg()
Liangyan <[email protected]>
sched/fair: Don't assign runtime for throttled cfs_rq
Hui Wang <[email protected]>
ALSA: hda/realtek - Fix the problem of two front mics on a ThinkCentre
Takashi Iwai <[email protected]>
ALSA: hda/realtek - Fix overridden device-specific initialization
Takashi Iwai <[email protected]>
ALSA: hda - Fix potential endless loop at applying quirks
-------------
Diffstat:
Makefile | 4 +-- arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 2 ++ arch/powerpc/kernel/head_64.S | 2 ++ arch/powerpc/kernel/process.c | 3 ++- drivers/clk/clk-s2mps11.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 8 +++--- drivers/pci/dwc/pci-dra7xx.c | 3 ++- drivers/pci/dwc/pcie-designware-ep.c | 34 ++++++++++++++++++++------ drivers/pci/dwc/pcie-designware.h | 8 ++++-- drivers/vhost/test.c | 13 +++++++--- drivers/vhost/vhost.c | 10 +++++--- include/net/ipv6_frag.h | 1 - include/net/xfrm.h | 17 +++++++++++++ kernel/module.c | 22 +++++++++++++---- kernel/sched/fair.c | 5 ++++ net/batman-adv/bat_iv_ogm.c | 20 +++++++++------ net/batman-adv/netlink.c | 2 +- net/key/af_key.c | 4 ++- net/vmw_vsock/hyperv_transport.c | 8 ++++++ net/xfrm/xfrm_state.c | 2 +- net/xfrm/xfrm_user.c | 14 +---------- scripts/decode_stacktrace.sh | 2 +- sound/pci/hda/hda_auto_parser.c | 4 +-- sound/pci/hda/hda_generic.c | 3 ++- sound/pci/hda/hda_generic.h | 1 + sound/pci/hda/patch_realtek.c | 4 +++ 26 files changed, 137 insertions(+), 61 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/21 ALSA: hda - Fix potential endless loop at applying quirks
From: Takashi Iwai <[email protected]>
commit 333f31436d3db19f4286f8862a00ea1d8d8420a1 upstream.
Since the chained quirks via chained_before flag is applied before the depth check, it may lead to the endless recursive calls, when the chain were set up incorrectly. Fix it by moving the depth check at the beginning of the loop.
--- sound/pci/hda/hda_auto_parser.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/hda_auto_parser.c +2 -2
@@ -828,6 +828,8 @@ static void apply_fixup(struct hda_codecwhile (id >=0 ) {const struct hda_fixup *fix = codec->fixup_list + id; +if (++depth >10 ) +break ;if (fix->chained_before)apply_fixup (codec, fix->chain_id, action, depth +1 );
@@ -867,8 +869,6 @@ static void apply_fixup(struct hda_codec }if (!fix->chained || fix->chained_before)break ; -if (++depth >10 ) -break ; id = fix->chain_id; } }
Greg Kroah-Hartman
maintainerPATCH 2/21 ALSA: hda/realtek - Fix overridden device-specific initialization
In reply to Greg Kroah-HartmanFrom: Takashi Iwai <[email protected]>
commit 89781d0806c2c4f29072d3f00cb2dd4274aabc3d upstream.
The recent change to shuffle the codec initialization procedure for Realtek via commit 607ca3bd220f ("ALSA: hda/realtek - EAPD turn on later") caused the silent output on some machines. This change was supposed to be safe, but it isn't actually; some devices have quirk setups to override the EAPD via COEF or BTL in the additional verb table, which is applied at the beginning of snd_hda_gen_init(). And this EAPD setup is again overridden in alc_auto_init_amp().
For recovering from the regression, tell snd_hda_gen_init() not to apply the verbs there by a new flag, then apply the verbs in alc_init().
--- sound/pci/hda/hda_generic.c | 3 ++- sound/pci/hda/hda_generic.h | 1 + sound/pci/hda/patch_realtek.c | 2 ++ 3 files changed, 5 insertions(+), 1 deletion(-)
sound/pci/hda/hda_generic.c +2 -1
@@ -5854,7 +5854,8 @@ int snd_hda_gen_init(struct hda_codec *cif (spec->init_hook) spec->init_hook (codec); -snd_hda_apply_verbs (codec); +if (!spec->skip_verbs) +snd_hda_apply_verbs (codec);init_multi_out (codec);init_extra_out (codec);
sound/pci/hda/hda_generic.h +1 -0
@@ -237,6 +237,7 @@ struct hda_gen_spec { unsigned int indep_hp_enabled:1; /* independent HP enabled */ unsigned int have_aamix_ctl:1; unsigned int hp_mic_jack_modes:1; + unsigned int skip_verbs:1; /* don't apply verbs at snd_hda_gen_init() *//* additional mute flags (only effective with auto_mute_via_amp=1) */ u64 mute_bits;
sound/pci/hda/patch_realtek.c +2 -0
@@ -781,9 +781,11 @@ static int alc_init(struct hda_codec *coif (spec->init_hook) spec->init_hook (codec); + spec->gen.skip_verbs =1 ;/* applied in below */ snd_hda_gen_init (codec);alc_fix_pll (codec);alc_auto_init_amp (codec, spec->init_amp); +snd_hda_apply_verbs (codec);/* apply verbs here after own init */ snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_INIT );
Greg Kroah-Hartman
maintainerPATCH 3/21 ALSA: hda/realtek - Fix the problem of two front mics on a ThinkCentre
In reply to Greg Kroah-HartmanFrom: Hui Wang <[email protected]>
commit 2a36c16efab254dd6017efeb35ad88ecc96f2328 upstream.
This ThinkCentre machine has a new realtek codec alc222, it is not in the support list, we add it in the realtek.c then this machine can apply FIXUPs for the realtek codec.
And this machine has two front mics which can't be handled by PA so far, it uses the pin 0x18 and 0x19 as the front mics, as a result the existing FIXUP ALC294_FIXUP_LENOVO_MIC_LOCATION doesn't work on this machine. Fortunately another FIXUP ALC283_FIXUP_HEADSET_MIC also can change the location for one of the two mics on this machine.
--- sound/pci/hda/patch_realtek.c | 2 ++ 1 file changed, 2 insertions(+)
sound/pci/hda/patch_realtek.c +2 -0
@@ -6588,6 +6588,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x17aa ,0x312a ,"ThinkCentre Station" ,ALC294_FIXUP_LENOVO_MIC_LOCATION ),SND_PCI_QUIRK (0x17aa ,0x312f ,"ThinkCentre Station" ,ALC294_FIXUP_LENOVO_MIC_LOCATION ),SND_PCI_QUIRK (0x17aa ,0x313c ,"ThinkCentre Station" ,ALC294_FIXUP_LENOVO_MIC_LOCATION ), +SND_PCI_QUIRK (0x17aa ,0x3151 ,"ThinkCentre Station" ,ALC283_FIXUP_HEADSET_MIC ),SND_PCI_QUIRK (0x17aa ,0x3902 ,"Lenovo E50-80" ,ALC269_FIXUP_DMIC_THINKPAD_ACPI ),SND_PCI_QUIRK (0x17aa ,0x3977 ,"IdeaPad S210" ,ALC283_FIXUP_INT_MIC ), SND_PCI_QUIRK(0x17aa, 0x3978, "Lenovo B50-70", ALC269_FIXUP_DMIC_THINKPAD_ACPI),
@@ -8289,6 +8290,7 @@ static int patch_alc680(struct hda_codecstatic const struct hda_device_id snd_hda_id_realtek[] = {HDA_CODEC_ENTRY (0x10ec0215 ,"ALC215" , patch_alc269),HDA_CODEC_ENTRY (0x10ec0221 ,"ALC221" , patch_alc269), +HDA_CODEC_ENTRY (0x10ec0222 ,"ALC222" , patch_alc269),HDA_CODEC_ENTRY (0x10ec0225 ,"ALC225" , patch_alc269),HDA_CODEC_ENTRY (0x10ec0231 ,"ALC231" , patch_alc269),HDA_CODEC_ENTRY (0x10ec0233 ,"ALC233" , patch_alc269),
Greg Kroah-Hartman
maintainerPATCH 4/21 sched/fair: Dont assign runtime for throttled cfs_rq
In reply to Greg Kroah-HartmanFrom: Liangyan <[email protected]>
commit 5e2d2cc2588bd3307ce3937acbc2ed03c830a861 upstream.
do_sched_cfs_period_timer() will refill cfs_b runtime and call distribute_cfs_runtime to unthrottle cfs_rq, sometimes cfs_b->runtime will allocate all quota to one cfs_rq incorrectly, then other cfs_rqs attached to this cfs_b can't get runtime and will be throttled.
We find that one throttled cfs_rq has non-negative cfs_rq->runtime_remaining and cause an unexpetced cast from s64 to u64 in snippet:
distribute_cfs_runtime() {
runtime = -cfs_rq->runtime_remaining + 1;
}The runtime here will change to a large number and consume all cfs_b->runtime in this cfs_b period.
According to Ben Segall, the throttled cfs_rq can have account_cfs_rq_runtime called on it because it is throttled before idle_balance, and the idle_balance calls update_rq_clock to add time that is accounted to the task.
This commit prevents cfs_rq to be assgined new runtime if it has been throttled until that distribute_cfs_runtime is called.
--- kernel/sched/fair.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/sched/fair.c +5 -0
@@ -4206,6 +4206,8 @@ static void __account_cfs_rq_runtime(strif (likely (cfs_rq->runtime_remaining >0 ))return ; +if (cfs_rq->throttled) +return ;/* * if we're unable to extend our runtime we resched so that the active * hierarchy can be throttled
@@ -4402,6 +4404,9 @@ static u64 distribute_cfs_runtime(structif (!cfs_rq_throttled (cfs_rq)) goto next; +/* By the above check, this should never be true */ +SCHED_WARN_ON (cfs_rq->runtime_remaining >0 ); + runtime = -cfs_rq->runtime_remaining +1 ;if (runtime > remaining) runtime = remaining;
Greg Kroah-Hartman
maintainerPATCH 5/21 drm/vmwgfx: Fix double free in vmw_recv_msg()
In reply to Greg Kroah-HartmanFrom: Dan Carpenter <[email protected]>
commit 08b0c891605acf727e43e3e03a25857d3e789b61 upstream.
We recently added a kfree() after the end of the loop:
if (retries == RETRIES) {
kfree(reply);
return -EINVAL;
}There are two problems. First the test is wrong and because retries equals RETRIES if we succeed on the last iteration through the loop. Second if we fail on the last iteration through the loop then the kfree is a double free.
When you're reading this code, please note the break statement at the end of the while loop. This patch changes the loop so that if it's not successful then "reply" is NULL and we can test for that afterward.
--- drivers/gpu/drm/vmwgfx/vmwgfx_msg.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/vmwgfx/vmwgfx_msg.c +3 -5
@@ -264,7 +264,7 @@ static int vmw_recv_msg(struct rpc_channif ((HIGH_WORD (ebx) &MESSAGE_STATUS_SUCCESS ) ==0 ) {kfree (reply); - + reply =NULL ;if ((HIGH_WORD (ebx) &MESSAGE_STATUS_CPT ) !=0 ) {/* A checkpoint occurred. Retry. */ continue ;
@@ -288,7 +288,7 @@ static int vmw_recv_msg(struct rpc_channif ((HIGH_WORD (ecx) &MESSAGE_STATUS_SUCCESS ) ==0 ) {kfree (reply); - + reply =NULL ;if ((HIGH_WORD (ecx) &MESSAGE_STATUS_CPT ) !=0 ) {/* A checkpoint occurred. Retry. */ continue ;
@@ -300,10 +300,8 @@ static int vmw_recv_msg(struct rpc_channbreak ; } -if (retries ==RETRIES ) { -kfree (reply); +if (!reply)return -EINVAL ; - } *msg_len = reply_len; *msg = reply;
Greg Kroah-Hartman
maintainerPATCH 6/21 powerpc/tm: Fix FP/VMX unavailable exceptions inside a transaction
In reply to Greg Kroah-HartmanFrom: Gustavo Romero <[email protected]>
commit 8205d5d98ef7f155de211f5e2eb6ca03d95a5a60 upstream.
When we take an FP unavailable exception in a transaction we have to account for the hardware FP TM checkpointed registers being incorrect. In this case for this process we know the current and checkpointed FP registers must be the same (since FP wasn't used inside the transaction) hence in the thread_struct we copy the current FP registers to the checkpointed ones.
This copy is done in tm_reclaim_thread(). We use thread->ckpt_regs.msr to determine if FP was on when in userspace. thread->ckpt_regs.msr represents the state of the MSR when exiting userspace. This is setup by check_if_tm_restore_required().
Unfortunatley there is an optimisation in giveup_all() which returns early if tsk->thread.regs->msr (via local variable usermsr) has FP=VEC=VSX=SPE=0. This optimisation means that check_if_tm_restore_required() is not called and hence thread->ckpt_regs.msr is not updated and will contain an old value.
This can happen if due to load_fp=255 we start a userspace process with MSR FP=1 and then we are context switched out. In this case thread->ckpt_regs.msr will contain FP=1. If that same process is then context switched in and load_fp overflows, MSR will have FP=0. If that process now enters a transaction and does an FP instruction, the FP unavailable will not update thread->ckpt_regs.msr (the bug) and MSR FP=1 will be retained in thread->ckpt_regs.msr. tm_reclaim_thread() will then not perform the required memcpy and the checkpointed FP regs in the thread struct will contain the wrong values.
The code path for this happening is:
Userspace: Kernel
Start userspace
with MSR FP/VEC/VSX/SPE=0 TM=1
< -----
...
tbegin
bne
fp instruction
FP unavailable
---- >
fp_unavailable_tm()
tm_reclaim_current()
tm_reclaim_thread()
giveup_all()
return early since FP/VMX/VSX=0
/* ckpt MSR not updated (Incorrect) */
tm_reclaim()
/* thread_struct ckpt FP regs contain junk (OK) */
/* Sees ckpt MSR FP=1 (Incorrect) */
no memcpy() performed
/* thread_struct ckpt FP regs not fixed (Incorrect) */
tm_recheckpoint()
/* Put junk in hardware checkpoint FP regs */
....
< -----
Return to userspace
with MSR TM=1 FP=1
with junk in the FP TM checkpoint
TM rollback
reads FP junkThis is a data integrity problem for the current process as the FP registers are corrupted. It's also a security problem as the FP registers from one process may be leaked to another.
This patch moves up check_if_tm_restore_required() in giveup_all() to ensure thread->ckpt_regs.msr is updated correctly.
A simple testcase to replicate this will be posted to tools/testing/selftests/powerpc/tm/tm-poison.c
Similarly for VMX.
This fixes CVE-2019-15030.
--- arch/powerpc/kernel/process.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/kernel/process.c +2 -1
@@ -475,13 +475,14 @@ void giveup_all(struct task_struct *tsk)if (!tsk->thread.regs)return ; +check_if_tm_restore_required (tsk); + usermsr = tsk->thread.regs->msr;if ((usermsr & msr_all_available) ==0 )return ;msr_check_and_set (msr_all_available); -check_if_tm_restore_required (tsk);WARN_ON ((usermsr &MSR_VSX ) && !((usermsr &MSR_FP ) && (usermsr &MSR_VEC )));
Greg Kroah-Hartman
maintainerPATCH 7/21 xfrm: clean up xfrm protocol checks
In reply to Greg Kroah-HartmanFrom: Cong Wang <[email protected]>
commit dbb2483b2a46fbaf833cfb5deb5ed9cace9c7399 upstream.
In commit 6a53b7593233 ("xfrm: check id proto in validate_tmpl()") I introduced a check for xfrm protocol, but according to Herbert IPSEC_PROTO_ANY should only be used as a wildcard for lookup, so it should be removed from validate_tmpl().
And, IPSEC_PROTO_ANY is expected to only match 3 IPSec-specific protocols, this is why xfrm_state_flush() could still miss IPPROTO_ROUTING, which leads that those entries are left in net->xfrm.state_all before exit net. Fix this by replacing IPSEC_PROTO_ANY with zero.
This patch also extracts the check from validate_tmpl() to xfrm_id_proto_valid() and uses it in parse_ipsecrequest(). With this, no other protocols should be added into xfrm.
--- include/net/xfrm.h | 17 +++++++++++++++++ net/key/af_key.c | 4 +++- net/xfrm/xfrm_state.c | 2 +- net/xfrm/xfrm_user.c | 14 +------------- 4 files changed, 22 insertions(+), 15 deletions(-)
include/net/xfrm.h +17 -0
@@ -1366,6 +1366,23 @@ static inline int xfrm_state_kern(constreturn atomic_read (&x->tunnel_users); } +static inline bool xfrm_id_proto_valid (u8 proto) +{ +switch (proto) { +case IPPROTO_AH : +case IPPROTO_ESP : +case IPPROTO_COMP : +#if IS_ENABLED (CONFIG_IPV6 ) +case IPPROTO_ROUTING : +case IPPROTO_DSTOPTS : +#endif +return true; +default : +return false; + } +} + +/* IPSEC_PROTO_ANY only matches 3 IPsec protocols, 0 could match all. */ static inline int xfrm_id_proto_match (u8 proto,u8 userproto) { return (!userproto || proto == userproto ||
net/key/af_key.c +3 -1
@@ -1951,8 +1951,10 @@ parse_ipsecrequest(struct xfrm_policy *xif (rq->sadb_x_ipsecrequest_mode ==0 )return -EINVAL ; +if (!xfrm_id_proto_valid (rq->sadb_x_ipsecrequest_proto)) +return -EINVAL ; - t->id.proto = rq->sadb_x_ipsecrequest_proto;/* XXX check proto */ + t->id.proto = rq->sadb_x_ipsecrequest_proto;if ((mode =pfkey_mode_to_xfrm (rq->sadb_x_ipsecrequest_mode)) <0 )return -EINVAL ; t->mode = mode;
net/xfrm/xfrm_state.c +1 -1
@@ -2330,7 +2330,7 @@ void xfrm_state_fini(struct net *net)unsigned int sz;flush_work (&net->xfrm.state_hash_work); -xfrm_state_flush (net,IPSEC_PROTO_ANY , false); +xfrm_state_flush (net,0 , false);flush_work (&xfrm_state_gc_work);WARN_ON (!list_empty (&net->xfrm.state_all));
net/xfrm/xfrm_user.c +1 -13
@@ -1489,20 +1489,8 @@ static int validate_tmpl(int nr, structreturn -EINVAL ; } -switch (ut[i].id.proto) { -case IPPROTO_AH : -case IPPROTO_ESP : -case IPPROTO_COMP : -#if IS_ENABLED (CONFIG_IPV6 ) -case IPPROTO_ROUTING : -case IPPROTO_DSTOPTS : -#endif -case IPSEC_PROTO_ANY : -break ; -default : +if (!xfrm_id_proto_valid (ut[i].id.proto))return -EINVAL ; - } - }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 8/21 ip6: fix skb leak in ip6frag_expire_frag_queue()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit 47d3d7fdb10a21c223036b58bd70ffdc24a472c4 upstream.
Since ip6frag_expire_frag_queue() now pulls the head skb from frag queue, we should no longer use skb_get(), since this leads to an skb leak.
Stefan Bader initially reported a problem in 4.4.stable [1] caused by the skb_get(), so this patch should also fix this issue.
296583.091021] kernel BUG at /build/linux-6VmqmP/linux-4.4.0/net/core/skbuff.c:1207!
[296583.091734] Call Trace: [296583.091749] [<ffffffff81740e50>] __pskb_pull_tail+0x50/0x350 [296583.091764] [<ffffffff8183939a>] _decode_session6+0x26a/0x400 [296583.091779] [<ffffffff817ec719>] __xfrm_decode_session+0x39/0x50 [296583.091795] [<ffffffff818239d0>] icmpv6_route_lookup+0xf0/0x1c0 [296583.091809] [<ffffffff81824421>] icmp6_send+0x5e1/0x940 [296583.091823] [<ffffffff81753238>] ? __netif_receive_skb+0x18/0x60 [296583.091838] [<ffffffff817532b2>] ? netif_receive_skb_internal+0x32/0xa0 [296583.091858] [<ffffffffc0199f74>] ? ixgbe_clean_rx_irq+0x594/0xac0 [ixgbe] [296583.091876] [<ffffffffc04eb260>] ? nf_ct_net_exit+0x50/0x50 [nf_defrag_ipv6] [296583.091893] [<ffffffff8183d431>] icmpv6_send+0x21/0x30 [296583.091906] [<ffffffff8182b500>] ip6_expire_frag_queue+0xe0/0x120 [296583.091921] [<ffffffffc04eb27f>] nf_ct_frag6_expire+0x1f/0x30 [nf_defrag_ipv6] [296583.091938] [<ffffffff810f3b57>] call_timer_fn+0x37/0x140 [296583.091951] [<ffffffffc04eb260>] ? nf_ct_net_exit+0x50/0x50 [nf_defrag_ipv6] [296583.091968] [<ffffffff810f5464>] run_timer_softirq+0x234/0x330 [296583.091982] [<ffffffff8108a339>] __do_softirq+0x109/0x2b0
--- include/net/ipv6_frag.h | 1 - 1 file changed, 1 deletion(-)
include/net/ipv6_frag.h +0 -1
@@ -94,7 +94,6 @@ ip6frag_expire_frag_queue(struct net *ne goto out; head->dev = dev; -skb_get (head);spin_unlock (&fq->q.lock);icmpv6_send (head,ICMPV6_TIME_EXCEED ,ICMPV6_EXC_FRAGTIME ,0 );
Greg Kroah-Hartman
maintainerPATCH 9/21 PCI: designware-ep: Fix find_first_zero_bit() usage
In reply to Greg Kroah-HartmanFrom: Niklas Cassel <[email protected]>
commit ad4a5becc689c3f32bbbc2b37eff89efe19dc2f9 upstream.
find_first_zero_bit()'s parameter 'size' is defined in bits, not in bytes.
find_first_zero_bit() is called with size in bytes rather than bits, which thus defines a too low upper limit, causing dw_pcie_ep_inbound_atu() to assign iatu index #4 to both bar 4 and bar 5, which makes bar 5 overwrite the settings set by bar 4.
Since the sizes of the bitmaps are known, dynamically allocate the bitmaps, and use the correct size when calling find_first_zero_bit().
Additionally, make sure that ep->num_ob_windows and ep->num_ib_windows, which are obtained from device tree, are smaller than the maximum number of iATUs (MAX_IATU_IN/MAX_IATU_OUT).
--- drivers/pci/dwc/pcie-designware-ep.c | 34 ++++++++++++++++++++++++++-------- drivers/pci/dwc/pcie-designware.h | 8 ++++++-- 2 files changed, 32 insertions(+), 10 deletions(-)
drivers/pci/dwc/pcie-designware-ep.c +26 -8
@@ -74,8 +74,7 @@ static int dw_pcie_ep_inbound_atu(structu32 free_win;struct dw_pcie *pci =to_dw_pcie_from_ep (ep); - free_win =find_first_zero_bit (&ep->ib_window_map, -sizeof (ep->ib_window_map)); + free_win =find_first_zero_bit (ep->ib_window_map, ep->num_ib_windows);if (free_win >= ep->num_ib_windows) {dev_err (pci->dev,"no free inbound window\n" );return -EINVAL ;
@@ -89,7 +88,7 @@ static int dw_pcie_ep_inbound_atu(struct } ep->bar_to_atu[bar] = free_win; -set_bit (free_win, &ep->ib_window_map); +set_bit (free_win, ep->ib_window_map);return 0 ; }
@@ -100,8 +99,7 @@ static int dw_pcie_ep_outbound_atu(strucu32 free_win;struct dw_pcie *pci =to_dw_pcie_from_ep (ep); - free_win =find_first_zero_bit (&ep->ob_window_map, -sizeof (ep->ob_window_map)); + free_win =find_first_zero_bit (ep->ob_window_map, ep->num_ob_windows);if (free_win >= ep->num_ob_windows) {dev_err (pci->dev,"no free outbound window\n" );return -EINVAL ;
@@ -110,7 +108,7 @@ static int dw_pcie_ep_outbound_atu(strucdw_pcie_prog_outbound_atu (pci, free_win,PCIE_ATU_TYPE_MEM , phys_addr, pci_addr, size); -set_bit (free_win, &ep->ob_window_map); +set_bit (free_win, ep->ob_window_map); ep->outbound_addr[free_win] = phys_addr;return 0 ;
@@ -125,7 +123,7 @@ static void dw_pcie_ep_clear_bar(structdw_pcie_ep_reset_bar (pci, bar);dw_pcie_disable_atu (pci, atu_index,DW_PCIE_REGION_INBOUND ); -clear_bit (atu_index, &ep->ib_window_map); +clear_bit (atu_index, ep->ib_window_map); } static int dw_pcie_ep_set_bar(struct pci_epc *epc, enum pci_barno bar,
@@ -181,7 +179,7 @@ static void dw_pcie_ep_unmap_addr(structreturn ;dw_pcie_disable_atu (pci, atu_index,DW_PCIE_REGION_OUTBOUND ); -clear_bit (atu_index, &ep->ob_window_map); +clear_bit (atu_index, ep->ob_window_map); } static int dw_pcie_ep_map_addr(struct pci_epc *epc, phys_addr_t addr,
@@ -302,12 +300,32 @@ int dw_pcie_ep_init(struct dw_pcie_ep *edev_err (dev,"unable to read *num-ib-windows* property\n" );return ret; } +if (ep->num_ib_windows >MAX_IATU_IN ) { +dev_err (dev,"invalid *num-ib-windows*\n" ); +return -EINVAL ; + } ret =of_property_read_u32 (np,"num-ob-windows" , &ep->num_ob_windows);if (ret <0 ) {dev_err (dev,"unable to read *num-ob-windows* property\n" );return ret; } +if (ep->num_ob_windows >MAX_IATU_OUT ) { +dev_err (dev,"invalid *num-ob-windows*\n" ); +return -EINVAL ; + } + + ep->ib_window_map =devm_kzalloc (dev,sizeof (long ) * +BITS_TO_LONGS (ep->num_ib_windows), +GFP_KERNEL ); +if (!ep->ib_window_map) +return -ENOMEM ; + + ep->ob_window_map =devm_kzalloc (dev,sizeof (long ) * +BITS_TO_LONGS (ep->num_ob_windows), +GFP_KERNEL ); +if (!ep->ob_window_map) +return -ENOMEM ; addr =devm_kzalloc (dev,sizeof (phys_addr_t) * ep->num_ob_windows,GFP_KERNEL );
drivers/pci/dwc/pcie-designware.h +6 -2
@@ -114,6 +114,10 @@#define MAX_MSI_IRQS 32#define MAX_MSI_CTRLS (MAX_MSI_IRQS / 32) +/* Maximum number of inbound/outbound iATUs */ +#define MAX_IATU_IN 256 +#define MAX_IATU_OUT 256 +struct pcie_port ;struct dw_pcie ;struct dw_pcie_ep ;
@@ -193,8 +197,8 @@ struct dw_pcie_ep {size_t page_size;u8 bar_to_atu[6 ];phys_addr_t *outbound_addr; -unsigned long ib_window_map; -unsigned long ob_window_map; +unsigned long *ib_window_map; +unsigned long *ob_window_map;u32 num_ib_windows;u32 num_ob_windows; };
Greg Kroah-Hartman
maintainerPATCH 10/21 PCI: dra7xx: Fix legacy INTD IRQ handling
In reply to Greg Kroah-HartmanFrom: Vignesh R <[email protected]>
commit 524d59f6e30aab5b618da55e604c802ccd83e708 upstream.
Legacy INTD IRQ handling is broken on dra7xx due to fact that driver uses hwirq in range of 1-4 for INTA, INTD whereas IRQ domain is of size 4 which is numbered 0-3. Therefore when INTD IRQ line is used with pci-dra7xx driver following warning is seen:
WARNING: CPU: 0 PID: 1 at kernel/irq/irqdomain.c:342 irq_domain_associate+0x12c/0x1c4
error: hwirq 0x4 is too large for dummyFix this by using pci_irqd_intx_xlate() helper to translate the INTx 1-4 range into the 0-3 as done in other PCIe drivers.
--- drivers/pci/dwc/pci-dra7xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/pci/dwc/pci-dra7xx.c +2 -1
@@ -227,6 +227,7 @@ static int dra7xx_pcie_intx_map(struct istatic const struct irq_domain_ops intx_domain_ops = { .map = dra7xx_pcie_intx_map, + .xlate = pci_irqd_intx_xlate, };static int dra7xx_pcie_init_irq_domain (struct pcie_port *pp)
@@ -270,7 +271,7 @@ static irqreturn_t dra7xx_pcie_msi_irq_hcase INTC :case INTD :generic_handle_irq (irq_find_mapping (dra7xx->irq_domain, -ffs (reg))); +ffs (reg) -1 ));break ; }
Greg Kroah-Hartman
maintainerPATCH 11/21 vhost/test: fix build for vhost test
In reply to Greg Kroah-HartmanFrom: Tiwei Bie <[email protected]>
commit 264b563b8675771834419057cbe076c1a41fb666 upstream.
Since vhost_exceeds_weight() was introduced, callers need to specify the packet weight and byte weight in vhost_dev_init(). Note that, the packet weight isn't counted in this patch to keep the original behavior unchanged.
--- drivers/vhost/test.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-)
drivers/vhost/test.c +9 -4
@@ -23,6 +23,12 @@* Using this limit prevents one virtqueue from starving others. */ #define VHOST_TEST_WEIGHT 0x80000 +/* Max number of packets transferred before requeueing the job. +* Using this limit prevents one virtqueue from starving others with +* pkts. +*/ +#define VHOST_TEST_PKT_WEIGHT 256 +enum {VHOST_TEST_VQ =0 ,VHOST_TEST_VQ_MAX =1 ,
@@ -81,10 +87,8 @@ static void handle_vq(struct vhost_test }vhost_add_used_and_signal (&n->dev, vq, head,0 ); total_len += len; -if (unlikely (total_len >=VHOST_TEST_WEIGHT )) { -vhost_poll_queue (&vq->poll); +if (unlikely (vhost_exceeds_weight (vq,0 , total_len)))break ; - } }mutex_unlock (&vq->mutex);
@@ -116,7 +120,8 @@ static int vhost_test_open(struct inode dev = &n->dev; vqs[VHOST_TEST_VQ ] = &n->vqs[VHOST_TEST_VQ ]; n->vqs[VHOST_TEST_VQ ].handle_kick = handle_vq_kick; -vhost_dev_init (dev, vqs,VHOST_TEST_VQ_MAX ); +vhost_dev_init (dev, vqs,VHOST_TEST_VQ_MAX , +VHOST_TEST_PKT_WEIGHT ,VHOST_TEST_WEIGHT ); f->private_data = n;
Greg Kroah-Hartman
maintainerPATCH 12/21 batman-adv: fix uninit-value in batadv_netlink_get_ifindex()
In reply to Greg Kroah-HartmanFrom: Eric Dumazet <[email protected]>
commit 3ee1bb7aae97324ec9078da1f00cb2176919563f upstream.
batadv_netlink_get_ifindex() needs to make sure user passed a correct u32 attribute.
syzbot reported :
BUG: KMSAN: uninit-value in batadv_netlink_dump_hardif+0x70d/0x880 net/batman-adv/netlink.c:968 CPU: 1 PID: 11705 Comm: syz-executor888 Not tainted 5.1.0+ #1 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x191/0x1f0 lib/dump_stack.c:113 kmsan_report+0x130/0x2a0 mm/kmsan/kmsan.c:622 __msan_warning+0x75/0xe0 mm/kmsan/kmsan_instr.c:310 batadv_netlink_dump_hardif+0x70d/0x880 net/batman-adv/netlink.c:968 genl_lock_dumpit+0xc6/0x130 net/netlink/genetlink.c:482 netlink_dump+0xa84/0x1ab0 net/netlink/af_netlink.c:2253 __netlink_dump_start+0xa3a/0xb30 net/netlink/af_netlink.c:2361 genl_family_rcv_msg net/netlink/genetlink.c:550 [inline] genl_rcv_msg+0xfc1/0x1a40 net/netlink/genetlink.c:627 netlink_rcv_skb+0x431/0x620 net/netlink/af_netlink.c:2486 genl_rcv+0x63/0x80 net/netlink/genetlink.c:638 netlink_unicast_kernel net/netlink/af_netlink.c:1311 [inline] netlink_unicast+0xf3e/0x1020 net/netlink/af_netlink.c:1337 netlink_sendmsg+0x127e/0x12f0 net/netlink/af_netlink.c:1926 sock_sendmsg_nosec net/socket.c:651 [inline] sock_sendmsg net/socket.c:661 [inline] ___sys_sendmsg+0xcc6/0x1200 net/socket.c:2260 __sys_sendmsg net/socket.c:2298 [inline] __do_sys_sendmsg net/socket.c:2307 [inline] __se_sys_sendmsg+0x305/0x460 net/socket.c:2305 __x64_sys_sendmsg+0x4a/0x70 net/socket.c:2305 do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291 entry_SYSCALL_64_after_hwframe+0x63/0xe7 RIP: 0033:0x440209
--- net/batman-adv/netlink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/batman-adv/netlink.c +1 -1
@@ -110,7 +110,7 @@ batadv_netlink_get_ifindex(const struct {struct nlattr *attr =nlmsg_find_attr (nlh,GENL_HDRLEN , attrtype); -return attr ?nla_get_u32 (attr) :0 ; +return (attr &&nla_len (attr) ==sizeof (u32)) ?nla_get_u32 (attr) :0 ; }/**
Greg Kroah-Hartman
maintainerPATCH 13/21 batman-adv: Only read OGM tvlv_len after buffer len check
In reply to Greg Kroah-HartmanFrom: Sven Eckelmann <[email protected]>
commit a15d56a60760aa9dbe26343b9a0ac5228f35d445 upstream.
Multiple batadv_ogm_packet can be stored in an skbuff. The functions batadv_iv_ogm_send_to_if()/batadv_iv_ogm_receive() use batadv_iv_ogm_aggr_packet() to check if there is another additional batadv_ogm_packet in the skb or not before they continue processing the packet.
The length for such an OGM is BATADV_OGM_HLEN + batadv_ogm_packet->tvlv_len. The check must first check that at least BATADV_OGM_HLEN bytes are available before it accesses tvlv_len (which is part of the header. Otherwise it might try read outside of the currently available skbuff to get the content of tvlv_len.
--- net/batman-adv/bat_iv_ogm.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
net/batman-adv/bat_iv_ogm.c +13 -7
@@ -450,17 +450,23 @@ static u8 batadv_hop_penalty(u8 tq, cons* batadv_iv_ogm_aggr_packet - checks if there is another OGM attached * @buff_pos: current position in the skb * @packet_len: total length of the skb -* @tvlv_len: tvlv length of the previously considered OGM +* @ogm_packet: potential OGM in buffer * * Return: true if there is enough space for another OGM, false otherwise. */ -static bool batadv_iv_ogm_aggr_packet (int buff_pos,int packet_len, -__be16 tvlv_len) +static bool +batadv_iv_ogm_aggr_packet (int buff_pos,int packet_len, +const struct batadv_ogm_packet *ogm_packet) {int next_buff_pos =0 ; - next_buff_pos += buff_pos +BATADV_OGM_HLEN ; - next_buff_pos +=ntohs (tvlv_len); +/* check if there is enough space for the header */ + next_buff_pos += buff_pos +sizeof (*ogm_packet); +if (next_buff_pos > packet_len) +return false; + +/* check if there is enough space for the optional TVLV */ + next_buff_pos +=ntohs (ogm_packet->tvlv_len);return (next_buff_pos <= packet_len) && (next_buff_pos <=BATADV_MAX_AGGREGATION_BYTES );
@@ -488,7 +494,7 @@ static void batadv_iv_ogm_send_to_if(str/* adjust all flags and log packets */ while (batadv_iv_ogm_aggr_packet (buff_pos, forw_packet->packet_len, - batadv_ogm_packet->tvlv_len)) { + batadv_ogm_packet)) {/* we might have aggregated direct link packets with an * ordinary base packet */
@@ -1838,7 +1844,7 @@ static int batadv_iv_ogm_receive(struct/* unpack the aggregated packets and process them one by one */ while (batadv_iv_ogm_aggr_packet (ogm_offset,skb_headlen (skb), - ogm_packet->tvlv_len)) { + ogm_packet)) {batadv_iv_ogm_process (skb, ogm_offset, if_incoming); ogm_offset +=BATADV_OGM_HLEN ;
Greg Kroah-Hartman
maintainerPATCH 14/21 hv_sock: Fix hang when a connection is closed
In reply to Greg Kroah-Hartman[ Upstream commit 685703b497bacea8765bb409d6b73455b73c540e ]
There is a race condition for an established connection that is being closed by the guest: the refcnt is 4 at the end of hvs_release() (Note: here the 'remove_sock' is false):
1 for the initial value;
1 for the sk being in the bound list;
1 for the sk being in the connected list;
1 for the delayed close_work.
After hvs_release() finishes, __vsock_release() -> sock_put(sk) *may* decrease the refcnt to 3.
Concurrently, hvs_close_connection() runs in another thread:
calls vsock_remove_sock() to decrease the refcnt by 2; call sock_put() to decrease the refcnt to 0, and free the sk; next, the "release_sock(sk)" may hang due to use-after-free.
In the above, after hvs_release() finishes, if hvs_close_connection() runs faster than "__vsock_release() -> sock_put(sk)", then there is not any issue, because at the beginning of hvs_close_connection(), the refcnt is still 4.
The issue can be resolved if an extra reference is taken when the connection is established.
--- net/vmw_vsock/hyperv_transport.c | 8 ++++++++ 1 file changed, 8 insertions(+)
net/vmw_vsock/hyperv_transport.c +8 -0
@@ -320,6 +320,11 @@ static void hvs_close_connection(struct vmbus_channel *chan)lock_sock (sk);hvs_do_close_lock_held (vsock_sk (sk), true);release_sock (sk); + +/* Release the refcnt for the channel that's opened in +* hvs_open_connection(). +*/ +sock_put (sk); }static void hvs_open_connection (struct vmbus_channel *chan)
@@ -389,6 +394,9 @@ static void hvs_open_connection(struct vmbus_channel *chan) }set_per_channel_state (chan, conn_from_host ? new : sk); + +/* This reference will be dropped by hvs_close_connection(). */ +sock_hold (conn_from_host ? new : sk);vmbus_set_chn_rescind_callback (chan, hvs_close_connection);/* Set the pending send size to max packet size to always get
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 15/21 powerpc/64: mark start_here_multiplatform as __ref
In reply to Greg Kroah-Hartman[ Upstream commit 9c4e4c90ec24652921e31e9551fcaedc26eec86d ]
Otherwise, the following warning is encountered:
WARNING: vmlinux.o(.text+0x3dc6): Section mismatch in reference from the variable start_here_multiplatform to the function .init.text:.early_setup() The function start_here_multiplatform() references
the function __init .early_setup().
This is often because start_here_multiplatform lacks a __init
annotation or the annotation of .early_setup is wrong.
--- arch/powerpc/kernel/head_64.S | 2 ++ 1 file changed, 2 insertions(+)
arch/powerpc/kernel/head_64.S +2 -0
@@ -897,6 +897,7 @@ p_toc: .8byte __toc_start + 0x8000 - 0b /* * This is where the main kernel code starts. */ +__REF start_here_multiplatform: /* set up the TOC */ bl relative_toc
@@ -972,6 +973,7 @@ start_here_multiplatform: RFI b . /* prevent speculative execution */ + .previous /* This is where all platforms converge execution */ start_here_common:
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 16/21 arm64: dts: rockchip: enable usb-host regulators at boot on rk3328-rock64
In reply to Greg Kroah-Hartman[ Upstream commit 26e2d7b03ea7ff254bf78305aa44dda62e70b78e ]
After commit ef05bcb60c1a, boot from USB drives is broken. Fix this problem by enabling usb-host regulators during boot time.
--- arch/arm64/boot/dts/rockchip/rk3328-rock64.dts | 2 ++ 1 file changed, 2 insertions(+)
arch/arm64/boot/dts/rockchip/rk3328-rock64.dts +2 -0
@@ -77,6 +77,7 @@ pinctrl-0 = <&usb30_host_drv>; regulator-name = "vcc_host_5v"; regulator-always-on; + regulator-boot-on; vin-supply = <&vcc_sys>; };
@@ -87,6 +88,7 @@ pinctrl-0 = <&usb20_host_drv>; regulator-name = "vcc_host1_5v"; regulator-always-on; + regulator-boot-on; vin-supply = <&vcc_sys>; };
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 17/21 scripts/decode_stacktrace: match basepath using shell prefix operator, not regex
In reply to Greg Kroah-Hartman[ Upstream commit 31013836a71e07751a6827f9d2ad41ef502ddaff ]
The basepath may contain special characters, which would confuse the regex matcher. ${var#prefix} does the right thing.
--- scripts/decode_stacktrace.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/decode_stacktrace.sh +1 -1
@@ -78,7 +78,7 @@ parse_symbol() { fi # Strip out the base of the path - code=${code//^$basepath/""} + code=${code#$basepath/} # In the case of inlines, move everything to same line code=${code//$'\n'/' '}
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 18/21 clk: s2mps11: Add used attribute to s2mps11_dt_match
In reply to Greg Kroah-Hartman[ Upstream commit 9c940bbe2bb47e03ca5e937d30b6a50bf9c0e671 ]
Clang warns after commit 8985167ecf57 ("clk: s2mps11: Fix matching when built as module and DT node contains compatible"):
drivers/clk/clk-s2mps11.c:242:34: warning: variable 's2mps11_dt_match' is not needed and will not be emitted [-Wunneeded-internal-declaration]
static const struct of_device_id s2mps11_dt_match[] = {
^1 warning generated.
This warning happens when a variable is used in some construct that doesn't require a reference to that variable to be emitted in the symbol table; in this case, it's MODULE_DEVICE_TABLE, which only needs to hold the data of the variable, not the variable itself.
$ nm -S drivers/clk/clk-s2mps11.o | rg s2mps11_dt_match 00000078 000003d4 R __mod_of__s2mps11_dt_match_device_table
Normally, with device ID table variables, it means that the variable just needs to be tied to the device declaration at the bottom of the file, like s2mps11_clk_id:
$ nm -S drivers/clk/clk-s2mps11.o | rg s2mps11_clk_id 00000000 00000078 R __mod_platform__s2mps11_clk_id_device_table 00000000 00000078 r s2mps11_clk_id
However, because the comment above this deliberately doesn't want this variable added to .of_match_table, we need to mark s2mps11_dt_match as __used to silence this warning. This makes it clear to Clang that the variable is used for something, even if a reference to it isn't being emitted.
--- drivers/clk/clk-s2mps11.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/clk-s2mps11.c +1 -1
@@ -255,7 +255,7 @@ MODULE_DEVICE_TABLE(platform, s2mps11_clk_id);* This requires of_device_id table. In the same time this will not change the * actual *device* matching so do not add .of_match_table. */ -static const struct of_device_id s2mps11_dt_match[] = { +static const struct of_device_id s2mps11_dt_match[]__used = { { .compatible ="samsung,s2mps11-clk" , .data = (void *)S2MPS11X ,
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 19/21 kernel/module: Fix mem leak in module_add_modinfo_attrs
In reply to Greg Kroah-Hartman[ Upstream commit bc6f2a757d525e001268c3658bd88822e768f8db ]
In module_add_modinfo_attrs if sysfs_create_file
fails, we forget to free allocated modinfo_attrs
and roll back the sysfs files.
--- kernel/module.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-)
kernel/module.c +17 -5
@@ -1695,6 +1695,8 @@ static int add_usage_links(struct module *mod)return ret; } +static void module_remove_modinfo_attrs (struct module *mod,int end); +static int module_add_modinfo_attrs (struct module *mod) {struct module_attribute *attr;
@@ -1709,24 +1711,34 @@ static int module_add_modinfo_attrs(struct module *mod)return -ENOMEM ; temp_attr = mod->modinfo_attrs; -for (i =0 ; (attr = modinfo_attrs[i]) && !error; i++) { +for (i =0 ; (attr = modinfo_attrs[i]); i++) {if (!attr->test || attr->test (mod)) {memcpy (temp_attr, attr,sizeof (*temp_attr));sysfs_attr_init (&temp_attr->attr); error =sysfs_create_file (&mod->mkobj.kobj, &temp_attr->attr); +if (error) + goto error_out; ++temp_attr; } } + +return 0 ; + +error_out: +if (i >0 ) +module_remove_modinfo_attrs (mod, --i);return error; } -static void module_remove_modinfo_attrs (struct module *mod) +static void module_remove_modinfo_attrs (struct module *mod,int end) {struct module_attribute *attr;int i;for (i =0 ; (attr = &mod->modinfo_attrs[i]); i++) { +if (end >=0 && i > end) +break ;/* pick a field to test for end of list */ if (!attr->attr.name)break ;
@@ -1814,7 +1826,7 @@ static int mod_sysfs_setup(struct module *mod,return 0 ; out_unreg_modinfo_attrs: -module_remove_modinfo_attrs (mod); +module_remove_modinfo_attrs (mod,-1 ); out_unreg_param:module_param_sysfs_remove (mod); out_unreg_holders:
@@ -1850,7 +1862,7 @@ static void mod_sysfs_fini(struct module *mod) { } -static void module_remove_modinfo_attrs (struct module *mod) +static void module_remove_modinfo_attrs (struct module *mod,int end) { }
@@ -1866,7 +1878,7 @@ static void init_param_lock(struct module *mod)static void mod_sysfs_teardown (struct module *mod) {del_usage_links (mod); -module_remove_modinfo_attrs (mod); +module_remove_modinfo_attrs (mod,-1 );module_param_sysfs_remove (mod);kobject_put (mod->mkobj.drivers_dir);kobject_put (mod->holders_dir);
Signature · 1 line
2.20.1
Greg Kroah-Hartman
maintainerPATCH 20/21 vhost: block speculation of translated descriptors
In reply to Greg Kroah-HartmanFrom: Michael S. Tsirkin <[email protected]>
commit a89db445fbd7f1f8457b03759aa7343fa530ef6b upstream.
iovec addresses coming from vhost are assumed to be pre-validated, but in fact can be speculated to a value out of range.
Userspace address are later validated with array_index_nospec so we can be sure kernel info does not leak through these addresses, but vhost must also not leak userspace info outside the allowed memory table to guests.
Following the defence in depth principle, make sure the address is not validated out of node range.
--- drivers/vhost/vhost.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/vhost/vhost.c +4 -2
@@ -1954,8 +1954,10 @@ static int translate_desc(struct vhost_v _iov = iov + ret; size = node->size - addr + node->start; _iov->iov_len =min ((u64 )len - s, size); - _iov->iov_base = (void __user *)(unsigned long ) - (node->userspace_addr + addr - node->start); + _iov->iov_base = (void __user *) + ((unsigned long )node->userspace_addr + +array_index_nospec ((unsigned long )(addr - node->start), + node->size)); s += size; addr += size; ++ret;
Greg Kroah-Hartman
maintainerPATCH 21/21 vhost: make sure log_num < in_num
In reply to Greg Kroah-HartmanFrom: yongduan <[email protected]>
commit 060423bfdee3f8bc6e2c1bac97de24d5415e2bc4 upstream.
The code assumes log_num < in_num everywhere, and that is true as long as in_num is incremented by descriptor iov count, and log_num by 1. However this breaks if there's a zero sized descriptor.
As a result, if a malicious guest creates a vring desc with desc.len = 0, it may cause the host kernel to crash by overflowing the log array. This bug can be triggered during the VM migration.
There's no need to log when desc.len = 0, so just don't increment log_num in this case.
--- drivers/vhost/vhost.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/vhost/vhost.c +2 -2
@@ -2068,7 +2068,7 @@ static int get_indirect(struct vhost_vir/* If this is an input descriptor, increment that count. */ if (access ==VHOST_ACCESS_WO ) { *in_num += ret; -if (unlikely (log)) { +if (unlikely (log && ret)) { log[*log_num].addr =vhost64_to_cpu (vq, desc.addr); log[*log_num].len =vhost32_to_cpu (vq, desc.len); ++*log_num;
@@ -2211,7 +2211,7 @@ int vhost_get_vq_desc(struct vhost_virtq/* If this is an input descriptor, * increment that count. */ *in_num += ret; -if (unlikely (log)) { +if (unlikely (log && ret)) { log[*log_num].addr =vhost64_to_cpu (vq, desc.addr); log[*log_num].len =vhost32_to_cpu (vq, desc.len); ++*log_num;
stable-rc/linux-4.14.y boot: 130 boots: 0 failed, 122 passed with 8 offline (v4.14.143-22-g6073f0ee406c)
stable-rc/linux-4.14.y boot: 130 boots: 0 failed, 122 passed with 8 offline (v4.14.143-22-g6073f0ee406c)
Full Boot Summary: https://kernelci.org/boot/all/job/stable-rc/branch/linux-4.14.y/kernel/v4.14.143-22-g6073f0ee406c/
Full Build Summary: https://kernelci.org/build/stable-rc/branch/linux-4.14.y/kernel/v4.14.143-22-g6073f0ee406c/
Tree: stable-rc
Branch: linux-4.14.y
Git Describe: v4.14.143-22-g6073f0ee406c
Git Commit: 6073f0ee406c52baaf3625e28c631a33b20efef5
Git URL: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
Tested: 66 unique boards, 23 SoC families, 13 builds out of 201
Offline Platforms:
arm64:
defconfig:
gcc-8
apq8016-sbc: 1 offline labarm:
multi_v7_defconfig:
gcc-8
qcom-apq8064-cm-qs600: 1 offline lab
qcom-apq8064-ifc6410: 1 offline lab
sun5i-r8-chip: 1 offline lab
davinci_all_defconfig:
gcc-8
dm365evm,legacy: 1 offline lab
qcom_defconfig:
gcc-8
qcom-apq8064-cm-qs600: 1 offline lab
qcom-apq8064-ifc6410: 1 offline lab
sunxi_defconfig:
gcc-8
sun5i-r8-chip: 1 offline lab---
For more info write to <[email protected]>
Quoted 10 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.144 release. There are 21 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun 15 Sep 2019 01:03:32 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.144-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
Results from Linaro’s test farm.
No regressions on arm64, arm, x86_64, and i386.
Summary
------------------------------------------------------------------------
kernel: 4.14.144-rc1
git repo: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git branch: linux-4.14.y
git commit: 6073f0ee406c52baaf3625e28c631a33b20efef5
git describe: v4.14.143-22-g6073f0ee406c
Test details: https://qa-reports.linaro.org/lkft/linux-stable-rc-4.14-oe/build/v4.14.143-22-g6073f0ee406c
No regressions (compared to build v4.14.142-41-g9ea9c62091b3)
No fixes (compared to build v4.14.142-41-g9ea9c62091b3)
Ran 23599 total tests in the following environments and test suites.
Environments
--------------
- dragonboard-410c - arm64
- hi6220-hikey - arm64
- i386
- juno-r2 - arm64
- qemu_arm
- qemu_arm64
- qemu_i386
- qemu_x86_64
- x15 - arm
- x86_64
Test Suites
-----------
* build
* install-android-platform-tools-r2600
* kselftest
* libhugetlbfs
* ltp-cap_bounds-tests
* ltp-commands-tests
* ltp-cpuhotplug-tests
* ltp-cve-tests
* ltp-dio-tests
* ltp-fcntl-locktests-tests
* ltp-filecaps-tests
* ltp-fs_bind-tests
* ltp-fs_perms_simple-tests
* ltp-fsx-tests
* ltp-hugetlb-tests
* ltp-io-tests
* ltp-ipc-tests
* ltp-math-tests
* ltp-mm-tests
* ltp-nptl-tests
* ltp-pty-tests
* ltp-sched-tests
* ltp-securebits-tests
* ltp-syscalls-tests
* ltp-timers-tests
* perf
* spectre-meltdown-checker-test
* v4l2-compliance
* ltp-containers-tests
* ltp-fs-tests
* network-basic-tests
* ltp-open-posix-tests
* kvm-unit-tests
* ssuite
* kselftest-vsyscall-mode-native
* kselftest-vsyscall-mode-none
Signature · 2 lines
Linaro LKFT https://lkft.linaro.org
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.144 release. There are 21 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun 15 Sep 2019 01:03:32 PM UTC. Anything received after that time might be too late.
Build results:
total: 172 pass: 168 fail: 4
Failed builds:
arm:allmodconfig
i386:allyesconfig
i386:allmodconfig
mips:allmodconfig
Qemu test results:
total: 372 pass: 372 fail: 0
drivers/vhost/vhost.c: In function 'translate_desc':include/linux/compiler.h:549:38: error:
call to '__compiletime_assert_1879' declared with attribute error: BUILD_BUG_ON failed: sizeof(_s) > sizeof(long)
Affects all 32 bit builds with vhost enabled in v4.9.y and all more recent branches. Caused by commit a89db445fbd7f1 ("vhost: block speculation of translated descriptors").
Guenter
Greg Kroah-Hartman
maintainerQuoted 5 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.144 release. There are 21 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Quoted 8 lines
Responses should be made by Sun 15 Sep 2019 01:03:32 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.144-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.
I have released -rc2 to resolve a build issue:
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.144-rc2.gz
Jon Hunter
maintainerQuoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.14.144 release. There are 21 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Sun 15 Sep 2019 01:03:32 PM UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 8 lines
https://www.kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.14.144-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.14.y
and the diffstat can be found below.thanks,
greg k-h
All tests passing for Tegra ...
Test results for stable-v4.14:
8 builds: 8 pass, 0 fail
16 boots: 16 pass, 0 fail
24 tests: 24 pass, 0 failLinux version: 4.14.144-rc2-ga0bf0c3c56ab
Boards tested: tegra124-jetson-tk1, tegra20-ventana,
tegra210-p2371-2180, tegra30-cardhu-a04
Cheers
Jon
Signature · 1 line
nvpublic