4.4.85-stable review
Greg Kroah-Hartman
maintainercover 4.4.85-stable review
This is the start of the stable review cycle for the 4.4.85 release. There are 53 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 Wed Aug 30 08:05:03 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.85-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.4.y
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.4.85-rc1
James Morse <[email protected]>
ACPI / APEI: Add missing synchronize_rcu() on NOTIFY_SCI removal
Joerg Roedel <[email protected]>
ACPI: ioapic: Clear on-stack resource before using it
Logan Gunthorpe <[email protected]>
ntb_transport: fix bug calculating num_qps_mw
Logan Gunthorpe <[email protected]>
ntb_transport: fix qp count bug
Kuninori Morimoto <[email protected]>
ASoC: rsnd: don't call update callback if it was NULL
Kuninori Morimoto <[email protected]>
ASoC: rsnd: ssi: 24bit data needs right-aligned settings
Geert Uytterhoeven <[email protected]>
ASoC: rsnd: Add missing initialization of ADG req_rate
Kuninori Morimoto <[email protected]>
ASoC: rsnd: avoid pointless loop in rsnd_mod_interrupt()
Kuninori Morimoto <[email protected]>
ASoC: rsnd: disable SRC.out only when stop timing
Aaro Koskinen <[email protected]>
ASoC: simple-card: don't fail if sysclk setting is not supported
Charles Milette <[email protected]>
staging: rtl8188eu: add RNX-N150NUB support
Srinivas Pandruvada <[email protected]>
iio: hid-sensor-trigger: Fix the race with user space powering up sensors
Dragos Bogdan <[email protected]>
iio: imu: adis16480: Fix acceleration scale factor for adis16480
Martijn Coenen <[email protected]>
ANDROID: binder: fix proc->tsk check.
Riley Andrews <[email protected]>
binder: Use wake up hint for synchronous transactions.
Todd Kjos <[email protected]>
binder: use group leader instead of open thread
Jeffy Chen <[email protected]>
Bluetooth: bnep: fix possible might sleep error in bnep_session
Jeffy Chen <[email protected]>
Bluetooth: cmtp: fix possible might sleep error in cmtp_session
Jeffy Chen <[email protected]>
Bluetooth: hidp: fix possible might sleep error in hidp_session_thread
Mark Rutland <[email protected]>
perf/core: Fix group {cpu,task} validation
Chuck Lever <[email protected]>
nfsd: Limit end of page list when decoding NFSv4 WRITE
Ronnie Sahlberg <[email protected]>
cifs: return ENAMETOOLONG for overlong names in cifs_open()/cifs_lookup()
Sachin Prabhu <[email protected]>
cifs: Fix df output for users with quota limits
Steven Rostedt (VMware) <[email protected]>
tracing: Fix freeing of filter in create_filter() when set_str is false
Koji Matsuoka <[email protected]>
drm: rcar-du: Fix H/V sync signal polarity configuration
Koji Matsuoka <[email protected]>
drm: rcar-du: Fix display timing controller parameter
Laurent Pinchart <[email protected]>
drm: rcar-du: Fix crash in encoder failure error path
Laurent Pinchart <[email protected]>
drm: rcar-du: lvds: Rename PLLEN bit to PLLON
Laurent Pinchart <[email protected]>
drm: rcar-du: lvds: Fix PLL frequency-related configuration
Maarten Lankhorst <[email protected]>
drm/atomic: If the atomic check fails, return its value first
Chris Wilson <[email protected]>
drm: Release driver tracking before making the object available again
Ulf Hansson <[email protected]>
i2c: designware: Fix system suspend
Alexey Brodkin <[email protected]>
ARCv2: PAE40: Explicitly set MSB counterpart of SLC region ops addresses
Takashi Iwai <[email protected]>
ALSA: hda - Add stereo mic quirk for Lenovo G50-70 (17aa:3978)
Takashi Iwai <[email protected]>
ALSA: core: Fix unexpected error at replacing user TLV
KT Liao <[email protected]>
Input: elan_i2c - add ELAN0602 ACPI ID to support Lenovo Yoga310
Aaron Ma <[email protected]>
Input: trackpoint - add new trackpoint firmware ID
Tomas Winkler <[email protected]>
mei: me: add lewisburg device ids
Tomas Winkler <[email protected]>
mei: me: add broxton pci device ids
Konstantin Khlebnikov <[email protected]>
net_sched: fix order of queue length updates in qdisc_replace()
Xin Long <[email protected]>
net: sched: fix NULL pointer dereference when action calls some targets
Colin Ian King <[email protected]>
irda: do not leak initialized list.dev to userspace
Neal Cardwell <[email protected]>
tcp: when rearming RTO, if RTO time is in past then fire RTO ASAP
Wei Wang <[email protected]>
ipv6: repair fib6 tree in failure case
Wei Wang <[email protected]>
ipv6: reset fn->rr_ptr when replacing route
Eric Dumazet <[email protected]>
tipc: fix use-after-free
Alexander Potapenko <[email protected]>
sctp: fully initialize the IPv6 address in sctp_v6_to_addr()
Eric Dumazet <[email protected]>
ipv4: better IP_MAX_MTU enforcement
Konstantin Khlebnikov <[email protected]>
net_sched/sfq: update hierarchical backlog when drop packet
Eric Dumazet <[email protected]>
ipv4: fix NULL dereference in free_fib_info_rcu()
Eric Dumazet <[email protected]>
dccp: defer ccid_hc_tx_delete() at dismantle time
Eric Dumazet <[email protected]>
dccp: purge write queue in dccp_destroy_sock()
Eric Dumazet <[email protected]>
af_key: do not use GFP_KERNEL in atomic contexts
-------------
Diffstat:
Makefile | 4 +- arch/arc/include/asm/cache.h | 2 + arch/arc/mm/cache.c | 13 +++++- drivers/acpi/apei/ghes.c | 1 + drivers/acpi/ioapic.c | 6 +++ drivers/android/binder.c | 14 ++++--- drivers/gpu/drm/drm_atomic.c | 5 ++- drivers/gpu/drm/drm_gem.c | 6 +-- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 6 +-- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 10 ++--- drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c | 8 ++-- drivers/gpu/drm/rcar-du/rcar_lvds_regs.h | 2 +- drivers/i2c/busses/i2c-designware-platdrv.c | 14 ++++++- .../iio/common/hid-sensors/hid-sensor-trigger.c | 8 ++-- drivers/iio/imu/adis16480.c | 2 +- drivers/input/mouse/elan_i2c_core.c | 1 + drivers/input/mouse/trackpoint.c | 3 +- drivers/input/mouse/trackpoint.h | 3 +- drivers/misc/mei/hw-me-regs.h | 5 +++ drivers/misc/mei/pci-me.c | 4 ++ drivers/ntb/ntb_transport.c | 8 ++-- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 + fs/cifs/dir.c | 18 +++++--- fs/cifs/smb2pdu.c | 4 +- fs/nfsd/nfs4xdr.c | 6 +-- include/net/ip.h | 4 +- include/net/sch_generic.h | 5 ++- kernel/events/core.c | 39 +++++++++--------- kernel/trace/trace_events_filter.c | 4 ++ net/bluetooth/bnep/core.c | 11 +++-- net/bluetooth/cmtp/core.c | 17 ++++---- net/bluetooth/hidp/core.c | 33 ++++++++++----- net/dccp/proto.c | 19 ++++++--- net/ipv4/fib_semantics.c | 12 +++--- net/ipv4/route.c | 2 +- net/ipv4/tcp_input.c | 3 +- net/ipv6/ip6_fib.c | 26 +++++++----- net/irda/af_irda.c | 2 +- net/key/af_key.c | 48 ++++++++++++---------- net/sched/act_ipt.c | 2 + net/sched/sch_sfq.c | 5 ++- net/sctp/ipv6.c | 2 + net/tipc/netlink_compat.c | 6 ++- sound/core/control.c | 2 +- sound/pci/hda/patch_conexant.c | 1 + sound/soc/generic/simple-card.c | 2 +- sound/soc/sh/rcar/adg.c | 2 +- sound/soc/sh/rcar/core.c | 21 ++++------ sound/soc/sh/rcar/src.c | 18 +++++++- sound/soc/sh/rcar/ssi.c | 3 +- 50 files changed, 276 insertions(+), 167 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/53 af_key: do not use GFP_KERNEL in atomic contexts
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 36f41f8fc6d8aa9f8c9072d66ff7cf9055f5e69b ]
pfkey_broadcast() might be called from non process contexts, we can not use GFP_KERNEL in these cases [1].
This patch partially reverts commit ba51b6be38c1 ("net: Fix RCU splat in af_key"), only keeping the GFP_ATOMIC forcing under rcu_read_lock() section.
[1] : syzkaller reported :
in_atomic(): 1, irqs_disabled(): 0, pid: 2932, name: syzkaller183439 3 locks held by syzkaller183439/2932:
#0: (&net->xfrm.xfrm_cfg_mutex){+.+.+.}, at: [<ffffffff83b43888>] pfkey_sendmsg+0x4c8/0x9f0 net/key/af_key.c:3649
#1: (&pfk->dump_lock){+.+.+.}, at: [<ffffffff83b467f6>] pfkey_do_dump+0x76/0x3f0 net/key/af_key.c:293
#2: (&(&net->xfrm.xfrm_policy_lock)->rlock){+...+.}, at: [<ffffffff83957632>] spin_lock_bh include/linux/spinlock.h:304 [inline]
#2: (&(&net->xfrm.xfrm_policy_lock)->rlock){+...+.}, at: [<ffffffff83957632>] xfrm_policy_walk+0x192/0xa30 net/xfrm/xfrm_policy.c:1028
CPU: 0 PID: 2932 Comm: syzkaller183439 Not tainted 4.13.0-rc4+ #24
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:16 [inline]
dump_stack+0x194/0x257 lib/dump_stack.c:52
___might_sleep+0x2b2/0x470 kernel/sched/core.c:5994
__might_sleep+0x95/0x190 kernel/sched/core.c:5947
slab_pre_alloc_hook mm/slab.h:416 [inline]
slab_alloc mm/slab.c:3383 [inline]
kmem_cache_alloc+0x24b/0x6e0 mm/slab.c:3559
skb_clone+0x1a0/0x400 net/core/skbuff.c:1037
pfkey_broadcast_one+0x4b2/0x6f0 net/key/af_key.c:207
pfkey_broadcast+0x4ba/0x770 net/key/af_key.c:281
dump_sp+0x3d6/0x500 net/key/af_key.c:2685
xfrm_policy_walk+0x2f1/0xa30 net/xfrm/xfrm_policy.c:1042
pfkey_dump_sp+0x42/0x50 net/key/af_key.c:2695
pfkey_do_dump+0xaa/0x3f0 net/key/af_key.c:299
pfkey_spddump+0x1a0/0x210 net/key/af_key.c:2722
pfkey_process+0x606/0x710 net/key/af_key.c:2814
pfkey_sendmsg+0x4d6/0x9f0 net/key/af_key.c:3650
sock_sendmsg_nosec net/socket.c:633 [inline]
sock_sendmsg+0xca/0x110 net/socket.c:643
___sys_sendmsg+0x755/0x890 net/socket.c:2035
__sys_sendmsg+0xe5/0x210 net/socket.c:2069
SYSC_sendmsg net/socket.c:2080 [inline]
SyS_sendmsg+0x2d/0x50 net/socket.c:2076
entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x445d79
RSP: 002b:00007f32447c1dc8 EFLAGS: 00000202 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 0000000000445d79
RDX: 0000000000000000 RSI: 000000002023dfc8 RDI: 0000000000000008
RBP: 0000000000000086 R08: 00007f32447c2700 R09: 00007f32447c2700
R10: 00007f32447c2700 R11: 0000000000000202 R12: 0000000000000000
R13: 00007ffe33edec4f R14: 00007f32447c29c0 R15: 0000000000000000--- net/key/af_key.c | 48 ++++++++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 22 deletions(-)
net/key/af_key.c +26 -22
@@ -228,7 +228,7 @@ static int pfkey_broadcast_one(struct sk#define BROADCAST_ONE 1#define BROADCAST_REGISTERED 2#define BROADCAST_PROMISC_ONLY 4 -static int pfkey_broadcast (struct sk_buff *skb, +static int pfkey_broadcast (struct sk_buff *skb,gfp_t allocation,int broadcast_flags,struct sock *one_sk,struct net *net) {
@@ -278,7 +278,7 @@ static int pfkey_broadcast(struct sk_bufrcu_read_unlock ();if (one_sk !=NULL ) - err =pfkey_broadcast_one (skb, &skb2,GFP_KERNEL , one_sk); + err =pfkey_broadcast_one (skb, &skb2, allocation, one_sk);kfree_skb (skb2);kfree_skb (skb);
@@ -311,7 +311,7 @@ static int pfkey_do_dump(struct pfkey_so hdr = (struct sadb_msg *) pfk->dump.skb->data; hdr->sadb_msg_seq =0 ; hdr->sadb_msg_errno = rc; -pfkey_broadcast (pfk->dump.skb,BROADCAST_ONE , +pfkey_broadcast (pfk->dump.skb,GFP_ATOMIC ,BROADCAST_ONE , &pfk->sk,sock_net (&pfk->sk)); pfk->dump.skb =NULL ; }
@@ -355,7 +355,7 @@ static int pfkey_error(const struct sadb hdr->sadb_msg_len = (sizeof (struct sadb_msg ) /sizeof (uint64_t )); -pfkey_broadcast (skb,BROADCAST_ONE , sk,sock_net (sk)); +pfkey_broadcast (skb,GFP_KERNEL ,BROADCAST_ONE , sk,sock_net (sk));return 0 ; }
@@ -1396,7 +1396,7 @@ static int pfkey_getspi(struct sock *sk,xfrm_state_put (x); -pfkey_broadcast (resp_skb,BROADCAST_ONE , sk, net); +pfkey_broadcast (resp_skb,GFP_KERNEL ,BROADCAST_ONE , sk, net);return 0 ; }
@@ -1483,7 +1483,7 @@ static int key_notify_sa(struct xfrm_sta hdr->sadb_msg_seq = c->seq; hdr->sadb_msg_pid = c->portid; -pfkey_broadcast (skb,BROADCAST_ALL ,NULL ,xs_net (x)); +pfkey_broadcast (skb,GFP_ATOMIC ,BROADCAST_ALL ,NULL ,xs_net (x));return 0 ; }
@@ -1596,7 +1596,7 @@ static int pfkey_get(struct sock *sk, st out_hdr->sadb_msg_reserved =0 ; out_hdr->sadb_msg_seq = hdr->sadb_msg_seq; out_hdr->sadb_msg_pid = hdr->sadb_msg_pid; -pfkey_broadcast (out_skb,BROADCAST_ONE , sk,sock_net (sk)); +pfkey_broadcast (out_skb,GFP_ATOMIC ,BROADCAST_ONE , sk,sock_net (sk));return 0 ; }
@@ -1701,8 +1701,8 @@ static int pfkey_register(struct sock *sreturn -ENOBUFS ; } -pfkey_broadcast (supp_skb,BROADCAST_REGISTERED , sk,sock_net (sk)); - +pfkey_broadcast (supp_skb,GFP_KERNEL ,BROADCAST_REGISTERED , sk, +sock_net (sk));return 0 ; }
@@ -1720,7 +1720,8 @@ static int unicast_flush_resp(struct soc hdr->sadb_msg_errno = (uint8_t )0 ; hdr->sadb_msg_len = (sizeof (struct sadb_msg ) /sizeof (uint64_t )); -return pfkey_broadcast (skb,BROADCAST_ONE , sk,sock_net (sk)); +return pfkey_broadcast (skb,GFP_ATOMIC ,BROADCAST_ONE , sk, +sock_net (sk)); }static int key_notify_sa_flush (const struct km_event *c)
@@ -1741,7 +1742,7 @@ static int key_notify_sa_flush(const str hdr->sadb_msg_len = (sizeof (struct sadb_msg ) /sizeof (uint64_t )); hdr->sadb_msg_reserved =0 ; -pfkey_broadcast (skb,BROADCAST_ALL ,NULL , c->net); +pfkey_broadcast (skb,GFP_ATOMIC ,BROADCAST_ALL ,NULL , c->net);return 0 ; }
@@ -1798,7 +1799,7 @@ static int dump_sa(struct xfrm_state *x, out_hdr->sadb_msg_pid = pfk->dump.msg_portid;if (pfk->dump.skb) -pfkey_broadcast (pfk->dump.skb,BROADCAST_ONE , +pfkey_broadcast (pfk->dump.skb,GFP_ATOMIC ,BROADCAST_ONE , &pfk->sk,sock_net (&pfk->sk)); pfk->dump.skb = out_skb;
@@ -1886,7 +1887,7 @@ static int pfkey_promisc(struct sock *sk new_hdr->sadb_msg_errno =0 ; } -pfkey_broadcast (skb,BROADCAST_ALL ,NULL ,sock_net (sk)); +pfkey_broadcast (skb,GFP_KERNEL ,BROADCAST_ALL ,NULL ,sock_net (sk));return 0 ; }
@@ -2219,7 +2220,7 @@ static int key_notify_policy(struct xfrm out_hdr->sadb_msg_errno =0 ; out_hdr->sadb_msg_seq = c->seq; out_hdr->sadb_msg_pid = c->portid; -pfkey_broadcast (out_skb,BROADCAST_ALL ,NULL ,xp_net (xp)); +pfkey_broadcast (out_skb,GFP_ATOMIC ,BROADCAST_ALL ,NULL ,xp_net (xp));return 0 ; }
@@ -2439,7 +2440,7 @@ static int key_pol_get_resp(struct sock out_hdr->sadb_msg_errno =0 ; out_hdr->sadb_msg_seq = hdr->sadb_msg_seq; out_hdr->sadb_msg_pid = hdr->sadb_msg_pid; -pfkey_broadcast (out_skb,BROADCAST_ONE , sk,xp_net (xp)); +pfkey_broadcast (out_skb,GFP_ATOMIC ,BROADCAST_ONE , sk,xp_net (xp)); err =0 ; out:
@@ -2695,7 +2696,7 @@ static int dump_sp(struct xfrm_policy *x out_hdr->sadb_msg_pid = pfk->dump.msg_portid;if (pfk->dump.skb) -pfkey_broadcast (pfk->dump.skb,BROADCAST_ONE , +pfkey_broadcast (pfk->dump.skb,GFP_ATOMIC ,BROADCAST_ONE , &pfk->sk,sock_net (&pfk->sk)); pfk->dump.skb = out_skb;
@@ -2752,7 +2753,7 @@ static int key_notify_policy_flush(const hdr->sadb_msg_satype =SADB_SATYPE_UNSPEC ; hdr->sadb_msg_len = (sizeof (struct sadb_msg ) /sizeof (uint64_t )); hdr->sadb_msg_reserved =0 ; -pfkey_broadcast (skb_out,BROADCAST_ALL ,NULL , c->net); +pfkey_broadcast (skb_out,GFP_ATOMIC ,BROADCAST_ALL ,NULL , c->net);return 0 ; }
@@ -2814,7 +2815,7 @@ static int pfkey_process(struct sock *skvoid *ext_hdrs[SADB_EXT_MAX ];int err; -pfkey_broadcast (skb_clone (skb,GFP_KERNEL ), +pfkey_broadcast (skb_clone (skb,GFP_KERNEL ),GFP_KERNEL ,BROADCAST_PROMISC_ONLY ,NULL ,sock_net (sk));memset (ext_hdrs,0 ,sizeof (ext_hdrs));
@@ -3036,7 +3037,8 @@ static int key_notify_sa_expire(struct x out_hdr->sadb_msg_seq =0 ; out_hdr->sadb_msg_pid =0 ; -pfkey_broadcast (out_skb,BROADCAST_REGISTERED ,NULL ,xs_net (x)); +pfkey_broadcast (out_skb,GFP_ATOMIC ,BROADCAST_REGISTERED ,NULL , +xs_net (x));return 0 ; }
@@ -3226,7 +3228,8 @@ static int pfkey_send_acquire(struct xfr xfrm_ctx->ctx_len); } -return pfkey_broadcast (skb,BROADCAST_REGISTERED ,NULL ,xs_net (x)); +return pfkey_broadcast (skb,GFP_ATOMIC ,BROADCAST_REGISTERED ,NULL , +xs_net (x)); } static struct xfrm_policy *pfkey_compile_policy(struct sock *sk, int opt,
@@ -3424,7 +3427,8 @@ static int pfkey_send_new_mapping(struct n_port->sadb_x_nat_t_port_port = sport; n_port->sadb_x_nat_t_port_reserved =0 ; -return pfkey_broadcast (skb,BROADCAST_REGISTERED ,NULL ,xs_net (x)); +return pfkey_broadcast (skb,GFP_ATOMIC ,BROADCAST_REGISTERED ,NULL , +xs_net (x)); }#ifdef CONFIG_NET_KEY_MIGRATE
@@ -3616,7 +3620,7 @@ static int pfkey_send_migrate(const stru }/* broadcast migrate message to sockets */ -pfkey_broadcast (skb,BROADCAST_ALL ,NULL , &init_net); +pfkey_broadcast (skb,GFP_ATOMIC ,BROADCAST_ALL ,NULL , &init_net);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 2/53 dccp: purge write queue in dccp_destroy_sock()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 7749d4ff88d31b0be17c8683143135adaaadc6a7 ]
syzkaller reported that DCCP could have a non empty write queue at dismantle time.
WARNING: CPU: 1 PID: 2953 at net/core/stream.c:199 sk_stream_kill_queues+0x3ce/0x520 net/core/stream.c:199 Kernel panic - not syncing: panic_on_warn set ... CPU: 1 PID: 2953 Comm: syz-executor0 Not tainted 4.13.0-rc4+ #2 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:16 [inline] dump_stack+0x194/0x257 lib/dump_stack.c:52 panic+0x1e4/0x417 kernel/panic.c:180 __warn+0x1c4/0x1d9 kernel/panic.c:541 report_bug+0x211/0x2d0 lib/bug.c:183 fixup_bug+0x40/0x90 arch/x86/kernel/traps.c:190 do_trap_no_signal arch/x86/kernel/traps.c:224 [inline] do_trap+0x260/0x390 arch/x86/kernel/traps.c:273 do_error_trap+0x120/0x390 arch/x86/kernel/traps.c:310 do_invalid_op+0x1b/0x20 arch/x86/kernel/traps.c:323 invalid_op+0x1e/0x30 arch/x86/entry/entry_64.S:846 RIP: 0010:sk_stream_kill_queues+0x3ce/0x520 net/core/stream.c:199 RSP: 0018:ffff8801d182f108 EFLAGS: 00010297 RAX: ffff8801d1144140 RBX: ffff8801d13cb280 RCX: 0000000000000000 RDX: 0000000000000000 RSI: ffffffff85137b00 RDI: ffff8801d13cb280 RBP: ffff8801d182f148 R08: 0000000000000001 R09: 0000000000000000 R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801d13cb4d0 R13: ffff8801d13cb3b8 R14: ffff8801d13cb300 R15: ffff8801d13cb3b8 inet_csk_destroy_sock+0x175/0x3f0 net/ipv4/inet_connection_sock.c:835 dccp_close+0x84d/0xc10 net/dccp/proto.c:1067 inet_release+0xed/0x1c0 net/ipv4/af_inet.c:425 sock_release+0x8d/0x1e0 net/socket.c:597 sock_close+0x16/0x20 net/socket.c:1126 __fput+0x327/0x7e0 fs/file_table.c:210 ____fput+0x15/0x20 fs/file_table.c:246 task_work_run+0x18a/0x260 kernel/task_work.c:116 exit_task_work include/linux/task_work.h:21 [inline] do_exit+0xa32/0x1b10 kernel/exit.c:865 do_group_exit+0x149/0x400 kernel/exit.c:969 get_signal+0x7e8/0x17e0 kernel/signal.c:2330 do_signal+0x94/0x1ee0 arch/x86/kernel/signal.c:808 exit_to_usermode_loop+0x21c/0x2d0 arch/x86/entry/common.c:157 prepare_exit_to_usermode arch/x86/entry/common.c:194 [inline] syscall_return_slowpath+0x3a7/0x450 arch/x86/entry/common.c:263
--- net/dccp/proto.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
net/dccp/proto.c +1 -4
@@ -201,10 +201,7 @@ void dccp_destroy_sock(struct sock *sk) {struct dccp_sock *dp =dccp_sk (sk); -/* -* DCCP doesn't use sk_write_queue, just sk_send_head -* for retransmissions -*/ +__skb_queue_purge (&sk->sk_write_queue);if (sk->sk_send_head !=NULL ) {kfree_skb (sk->sk_send_head); sk->sk_send_head =NULL ;
Greg Kroah-Hartman
maintainerPATCH 3/53 dccp: defer ccid_hc_tx_delete() at dismantle time
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 120e9dabaf551c6dc03d3a10a1f026376cb1811c ]
syszkaller team reported another problem in DCCP [1]
Problem here is that the structure holding RTO timer (ccid2_hc_tx_rto_expire() handler) is freed too soon.
We can not use del_timer_sync() to cancel the timer
since this timer wants to grab socket lock (that would risk a dead lock)
Solution is to defer the freeing of memory when all references to the socket were released. Socket timers do own a reference, so this should fix the issue.
[1]
==================================================================
BUG: KASAN: use-after-free in ccid2_hc_tx_rto_expire+0x51c/0x5c0 net/dccp/ccids/ccid2.c:144
Read of size 4 at addr ffff8801d2660540 by task kworker/u4:7/3365
CPU: 1 PID: 3365 Comm: kworker/u4:7 Not tainted 4.13.0-rc4+ #3
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events_unbound call_usermodehelper_exec_work
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:16 [inline]
dump_stack+0x194/0x257 lib/dump_stack.c:52
print_address_description+0x73/0x250 mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report+0x24e/0x340 mm/kasan/report.c:409
__asan_report_load4_noabort+0x14/0x20 mm/kasan/report.c:429
ccid2_hc_tx_rto_expire+0x51c/0x5c0 net/dccp/ccids/ccid2.c:144
call_timer_fn+0x233/0x830 kernel/time/timer.c:1268
expire_timers kernel/time/timer.c:1307 [inline]
__run_timers+0x7fd/0xb90 kernel/time/timer.c:1601
run_timer_softirq+0x21/0x80 kernel/time/timer.c:1614
__do_softirq+0x2f5/0xba3 kernel/softirq.c:284
invoke_softirq kernel/softirq.c:364 [inline]
irq_exit+0x1cc/0x200 kernel/softirq.c:405
exiting_irq arch/x86/include/asm/apic.h:638 [inline]
smp_apic_timer_interrupt+0x76/0xa0 arch/x86/kernel/apic/apic.c:1044
apic_timer_interrupt+0x93/0xa0 arch/x86/entry/entry_64.S:702
RIP: 0010:arch_local_irq_enable arch/x86/include/asm/paravirt.h:824 [inline]
RIP: 0010:__raw_write_unlock_irq include/linux/rwlock_api_smp.h:267 [inline]
RIP: 0010:_raw_write_unlock_irq+0x56/0x70 kernel/locking/spinlock.c:343
RSP: 0018:ffff8801cd50eaa8 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff10
RAX: dffffc0000000000 RBX: ffffffff85a090c0 RCX: 0000000000000006
RDX: 1ffffffff0b595f3 RSI: 1ffff1003962f989 RDI: ffffffff85acaf98
RBP: ffff8801cd50eab0 R08: 0000000000000001 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffff8801cc96ea60
R13: dffffc0000000000 R14: ffff8801cc96e4c0 R15: ffff8801cc96e4c0
</IRQ>
release_task+0xe9e/0x1a40 kernel/exit.c:220
wait_task_zombie kernel/exit.c:1162 [inline]
wait_consider_task+0x29b8/0x33c0 kernel/exit.c:1389
do_wait_thread kernel/exit.c:1452 [inline]
do_wait+0x441/0xa90 kernel/exit.c:1523
kernel_wait4+0x1f5/0x370 kernel/exit.c:1665
SYSC_wait4+0x134/0x140 kernel/exit.c:1677
SyS_wait4+0x2c/0x40 kernel/exit.c:1673
call_usermodehelper_exec_sync kernel/kmod.c:286 [inline]
call_usermodehelper_exec_work+0x1a0/0x2c0 kernel/kmod.c:323
process_one_work+0xbf3/0x1bc0 kernel/workqueue.c:2097
worker_thread+0x223/0x1860 kernel/workqueue.c:2231
kthread+0x35e/0x430 kernel/kthread.c:231
ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:425
Allocated by task 21267:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x43/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489
kmem_cache_alloc+0x127/0x750 mm/slab.c:3561
ccid_new+0x20e/0x390 net/dccp/ccid.c:151
dccp_hdlr_ccid+0x27/0x140 net/dccp/feat.c:44
__dccp_feat_activate+0x142/0x2a0 net/dccp/feat.c:344
dccp_feat_activate_values+0x34e/0xa90 net/dccp/feat.c:1538
dccp_rcv_request_sent_state_process net/dccp/input.c:472 [inline]
dccp_rcv_state_process+0xed1/0x1620 net/dccp/input.c:677
dccp_v4_do_rcv+0xeb/0x160 net/dccp/ipv4.c:679
sk_backlog_rcv include/net/sock.h:911 [inline]
__release_sock+0x124/0x360 net/core/sock.c:2269
release_sock+0xa4/0x2a0 net/core/sock.c:2784
inet_wait_for_connect net/ipv4/af_inet.c:557 [inline]
__inet_stream_connect+0x671/0xf00 net/ipv4/af_inet.c:643
inet_stream_connect+0x58/0xa0 net/ipv4/af_inet.c:682
SYSC_connect+0x204/0x470 net/socket.c:1642
SyS_connect+0x24/0x30 net/socket.c:1623
entry_SYSCALL_64_fastpath+0x1f/0xbe
Freed by task 3049:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x43/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3503 [inline]
kmem_cache_free+0x77/0x280 mm/slab.c:3763
ccid_hc_tx_delete+0xc5/0x100 net/dccp/ccid.c:190
dccp_destroy_sock+0x1d1/0x2b0 net/dccp/proto.c:225
inet_csk_destroy_sock+0x166/0x3f0 net/ipv4/inet_connection_sock.c:833
dccp_done+0xb7/0xd0 net/dccp/proto.c:145
dccp_time_wait+0x13d/0x300 net/dccp/minisocks.c:72
dccp_rcv_reset+0x1d1/0x5b0 net/dccp/input.c:160
dccp_rcv_state_process+0x8fc/0x1620 net/dccp/input.c:663
dccp_v4_do_rcv+0xeb/0x160 net/dccp/ipv4.c:679
sk_backlog_rcv include/net/sock.h:911 [inline]
__sk_receive_skb+0x33e/0xc00 net/core/sock.c:521
dccp_v4_rcv+0xef1/0x1c00 net/dccp/ipv4.c:871
ip_local_deliver_finish+0x2e2/0xba0 net/ipv4/ip_input.c:216
NF_HOOK include/linux/netfilter.h:248 [inline]
ip_local_deliver+0x1ce/0x6d0 net/ipv4/ip_input.c:257
dst_input include/net/dst.h:477 [inline]
ip_rcv_finish+0x8db/0x19c0 net/ipv4/ip_input.c:397
NF_HOOK include/linux/netfilter.h:248 [inline]
ip_rcv+0xc3f/0x17d0 net/ipv4/ip_input.c:488
__netif_receive_skb_core+0x19af/0x33d0 net/core/dev.c:4417
__netif_receive_skb+0x2c/0x1b0 net/core/dev.c:4455
process_backlog+0x203/0x740 net/core/dev.c:5130
napi_poll net/core/dev.c:5527 [inline]
net_rx_action+0x792/0x1910 net/core/dev.c:5593
__do_softirq+0x2f5/0xba3 kernel/softirq.c:284
The buggy address belongs to the object at ffff8801d2660100
which belongs to the cache ccid2_hc_tx_sock of size 1240
The buggy address is located 1088 bytes inside of
1240-byte region [ffff8801d2660100, ffff8801d26605d8)
The buggy address belongs to the page:
page:ffffea0007499800 count:1 mapcount:0 mapping:ffff8801d2660100 index:0x0 compound_mapcount: 0
flags: 0x200000000008100(slab|head)
raw: 0200000000008100 ffff8801d2660100 0000000000000000 0000000100000005
raw: ffffea00075271a0 ffffea0007538820 ffff8801d3aef9c0 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8801d2660400: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8801d2660480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801d2660500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8801d2660580: fb fb fb fb fb fb fb fb fb fb fb fc fc fc fc fc
ffff8801d2660600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================--- net/dccp/proto.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
net/dccp/proto.c +12 -2
@@ -24,6 +24,7 @@#include <net/checksum.h> #include <net/inet_sock.h> +#include <net/inet_common.h> #include <net/sock.h> #include <net/xfrm.h>
@@ -170,6 +171,15 @@ const char *dccp_packet_name(const int tEXPORT_SYMBOL_GPL (dccp_packet_name); +static void dccp_sk_destruct (struct sock *sk) +{ +struct dccp_sock *dp =dccp_sk (sk); + +ccid_hc_tx_delete (dp->dccps_hc_tx_ccid, sk); + dp->dccps_hc_tx_ccid =NULL ; +inet_sock_destruct (sk); +} +int dccp_init_sock (struct sock *sk,const __u8 ctl_sock_initialized) {struct dccp_sock *dp =dccp_sk (sk);
@@ -179,6 +189,7 @@ int dccp_init_sock(struct sock *sk, cons icsk->icsk_syn_retries = sysctl_dccp_request_retries; sk->sk_state =DCCP_CLOSED ; sk->sk_write_space = dccp_write_space; + sk->sk_destruct = dccp_sk_destruct; icsk->icsk_sync_mss = dccp_sync_mss; dp->dccps_mss_cache =536 ; dp->dccps_rate_last = jiffies;
@@ -219,8 +230,7 @@ void dccp_destroy_sock(struct sock *sk) dp->dccps_hc_rx_ackvec =NULL ; }ccid_hc_rx_delete (dp->dccps_hc_rx_ccid, sk); -ccid_hc_tx_delete (dp->dccps_hc_tx_ccid, sk); - dp->dccps_hc_rx_ccid = dp->dccps_hc_tx_ccid =NULL ; + dp->dccps_hc_rx_ccid =NULL ;/* clean up feature negotiation state */ dccp_feat_list_purge (&dp->dccps_featneg);
Greg Kroah-Hartman
maintainerPATCH 4/53 ipv4: fix NULL dereference in free_fib_info_rcu()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 187e5b3ac84d3421d2de3aca949b2791fbcad554 ]
If fi->fib_metrics could not be allocated in fib_create_info() we attempt to dereference a NULL pointer in free_fib_info_rcu() :
m = fi->fib_metrics;
if (m != &dst_default_metrics && atomic_dec_and_test(&m->refcnt))
kfree(m);Before my recent patch, we used to call kfree(NULL) and nothing wrong happened.
Instead of using RCU to defer freeing while we are under memory stress, it seems better to take immediate action.
This was reported by syzkaller team.
--- net/ipv4/fib_semantics.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
net/ipv4/fib_semantics.c +7 -5
@@ -1044,15 +1044,17 @@ struct fib_info *fib_create_info(struct fi =kzalloc (sizeof (*fi)+nhs*sizeof (struct fib_nh ),GFP_KERNEL );if (!fi) goto failure; - fib_info_cnt++;if (cfg->fc_mx) { fi->fib_metrics =kzalloc (sizeof (*fi->fib_metrics),GFP_KERNEL ); -if (!fi->fib_metrics) - goto failure; +if (unlikely (!fi->fib_metrics)) { +kfree (fi); +return ERR_PTR (err); + }atomic_set (&fi->fib_metrics->refcnt,1 ); - }else + }else { fi->fib_metrics = (struct dst_metrics *)&dst_default_metrics; - + } + fib_info_cnt++; fi->fib_net = net; fi->fib_protocol = cfg->fc_protocol; fi->fib_scope = cfg->fc_scope;
Greg Kroah-Hartman
maintainerPATCH 5/53 net_sched/sfq: update hierarchical backlog when drop packet
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Khlebnikov <[email protected]>
[ Upstream commit 325d5dc3f7e7c2840b65e4a2988c082c2c0025c5 ]
When sfq_enqueue() drops head packet or packet from another queue it have to update backlog at upper qdiscs too.
--- net/sched/sch_sfq.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/sched/sch_sfq.c +4 -1
@@ -434,6 +434,7 @@ congestion_drop:qdisc_drop (head, sch);slot_queue_add (slot, skb); +qdisc_tree_reduce_backlog (sch,0 , delta);return NET_XMIT_CN ; }
@@ -465,8 +466,10 @@ enqueue:/* Return Congestion Notification only if we dropped a packet * from this flow. */ -if (qlen != slot->qlen) +if (qlen != slot->qlen) { +qdisc_tree_reduce_backlog (sch,0 , dropped -qdisc_pkt_len (skb));return NET_XMIT_CN ; + }/* As we dropped a packet, better let upper stack know this */ qdisc_tree_reduce_backlog (sch,1 , dropped);
Greg Kroah-Hartman
maintainerPATCH 6/53 ipv4: better IP_MAX_MTU enforcement
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit c780a049f9bf442314335372c9abc4548bfe3e44 ]
While working on yet another syzkaller report, I found that our IP_MAX_MTU enforcements were not properly done.
gcc seems to reload dev->mtu for min(dev->mtu, IP_MAX_MTU), and final result can be bigger than IP_MAX_MTU :/
This is a problem because device mtu can be changed on other cpus or threads.
While this patch does not fix the issue I am working on, it is probably worth addressing it.
--- include/net/ip.h | 4 ++-- net/ipv4/route.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
include/net/ip.h +2 -2
@@ -314,7 +314,7 @@ static inline unsigned int ip_dst_mtu_ma !forwarding)return dst_mtu (dst); -return min (dst->dev->mtu,IP_MAX_MTU ); +return min (READ_ONCE (dst->dev->mtu),IP_MAX_MTU ); }static inline unsigned int ip_skb_dst_mtu (const struct sk_buff *skb)
@@ -327,7 +327,7 @@ static inline unsigned int ip_skb_dst_mtreturn ip_dst_mtu_maybe_forward (skb_dst (skb), forwarding); } -return min (skb_dst (skb)->dev->mtu,IP_MAX_MTU ); +return min (READ_ONCE (skb_dst (skb)->dev->mtu),IP_MAX_MTU ); }u32 ip_idents_reserve (u32 hash,int segs);
net/ipv4/route.c +1 -1
@@ -1241,7 +1241,7 @@ static unsigned int ipv4_mtu(const strucif (mtu)return mtu; - mtu = dst->dev->mtu; + mtu =READ_ONCE (dst->dev->mtu);if (unlikely (dst_metric_locked (dst,RTAX_MTU ))) {if (rt->rt_uses_gateway && mtu >576 )
Greg Kroah-Hartman
maintainerPATCH 7/53 sctp: fully initialize the IPv6 address in sctp_v6_to_addr()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Potapenko <[email protected]>
[ Upstream commit 15339e441ec46fbc3bf3486bb1ae4845b0f1bb8d ]
KMSAN reported use of uninitialized sctp_addr->v4.sin_addr.s_addr and sctp_addr->v6.sin6_scope_id in sctp_v6_cmp_addr() (see below). Make sure all fields of an IPv6 address are initialized, which guarantees that the IPv4 fields are also initialized.
==================================================================
BUG: KMSAN: use of uninitialized memory in sctp_v6_cmp_addr+0x8d4/0x9f0 net/sctp/ipv6.c:517 CPU: 2 PID: 31056 Comm: syz-executor1 Not tainted 4.11.0-rc5+ #2944 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Call Trace: dump_stack+0x172/0x1c0 lib/dump_stack.c:42 is_logbuf_locked mm/kmsan/kmsan.c:59 [inline] kmsan_report+0x12a/0x180 mm/kmsan/kmsan.c:938 native_save_fl arch/x86/include/asm/irqflags.h:18 [inline] arch_local_save_flags arch/x86/include/asm/irqflags.h:72 [inline] arch_local_irq_save arch/x86/include/asm/irqflags.h:113 [inline] __msan_warning_32+0x61/0xb0 mm/kmsan/kmsan_instr.c:467 sctp_v6_cmp_addr+0x8d4/0x9f0 net/sctp/ipv6.c:517 sctp_v6_get_dst+0x8c7/0x1630 net/sctp/ipv6.c:290 sctp_transport_route+0x101/0x570 net/sctp/transport.c:292 sctp_assoc_add_peer+0x66d/0x16f0 net/sctp/associola.c:651 sctp_sendmsg+0x35a5/0x4f90 net/sctp/socket.c:1871 inet_sendmsg+0x498/0x670 net/ipv4/af_inet.c:762 sock_sendmsg_nosec net/socket.c:633 [inline] sock_sendmsg net/socket.c:643 [inline] SYSC_sendto+0x608/0x710 net/socket.c:1696 SyS_sendto+0x8a/0xb0 net/socket.c:1664 entry_SYSCALL_64_fastpath+0x13/0x94 RIP: 0033:0x44b479 RSP: 002b:00007f6213f21c08 EFLAGS: 00000286 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 0000000020000000 RCX: 000000000044b479 RDX: 0000000000000041 RSI: 0000000020edd000 RDI: 0000000000000006 RBP: 00000000007080a8 R08: 0000000020b85fe4 R09: 000000000000001c R10: 0000000000040005 R11: 0000000000000286 R12: 00000000ffffffff R13: 0000000000003760 R14: 00000000006e5820 R15: 0000000000ff8000 origin description: ----dst_saddr@sctp_v6_get_dst local variable created at: sk_fullsock include/net/sock.h:2321 [inline] inet6_sk include/linux/ipv6.h:309 [inline] sctp_v6_get_dst+0x91/0x1630 net/sctp/ipv6.c:241 sctp_transport_route+0x101/0x570 net/sctp/transport.c:292 ================================================================== BUG: KMSAN: use of uninitialized memory in sctp_v6_cmp_addr+0x8d4/0x9f0 net/sctp/ipv6.c:517 CPU: 2 PID: 31056 Comm: syz-executor1 Not tainted 4.11.0-rc5+ #2944 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Call Trace: dump_stack+0x172/0x1c0 lib/dump_stack.c:42 is_logbuf_locked mm/kmsan/kmsan.c:59 [inline] kmsan_report+0x12a/0x180 mm/kmsan/kmsan.c:938 native_save_fl arch/x86/include/asm/irqflags.h:18 [inline] arch_local_save_flags arch/x86/include/asm/irqflags.h:72 [inline] arch_local_irq_save arch/x86/include/asm/irqflags.h:113 [inline] __msan_warning_32+0x61/0xb0 mm/kmsan/kmsan_instr.c:467 sctp_v6_cmp_addr+0x8d4/0x9f0 net/sctp/ipv6.c:517 sctp_v6_get_dst+0x8c7/0x1630 net/sctp/ipv6.c:290 sctp_transport_route+0x101/0x570 net/sctp/transport.c:292 sctp_assoc_add_peer+0x66d/0x16f0 net/sctp/associola.c:651 sctp_sendmsg+0x35a5/0x4f90 net/sctp/socket.c:1871 inet_sendmsg+0x498/0x670 net/ipv4/af_inet.c:762 sock_sendmsg_nosec net/socket.c:633 [inline] sock_sendmsg net/socket.c:643 [inline] SYSC_sendto+0x608/0x710 net/socket.c:1696 SyS_sendto+0x8a/0xb0 net/socket.c:1664 entry_SYSCALL_64_fastpath+0x13/0x94 RIP: 0033:0x44b479 RSP: 002b:00007f6213f21c08 EFLAGS: 00000286 ORIG_RAX: 000000000000002c RAX: ffffffffffffffda RBX: 0000000020000000 RCX: 000000000044b479 RDX: 0000000000000041 RSI: 0000000020edd000 RDI: 0000000000000006 RBP: 00000000007080a8 R08: 0000000020b85fe4 R09: 000000000000001c R10: 0000000000040005 R11: 0000000000000286 R12: 00000000ffffffff R13: 0000000000003760 R14: 00000000006e5820 R15: 0000000000ff8000 origin description: ----dst_saddr@sctp_v6_get_dst local variable created at: sk_fullsock include/net/sock.h:2321 [inline] inet6_sk include/linux/ipv6.h:309 [inline] sctp_v6_get_dst+0x91/0x1630 net/sctp/ipv6.c:241 sctp_transport_route+0x101/0x570 net/sctp/transport.c:292 ==================================================================
--- net/sctp/ipv6.c | 2 ++ 1 file changed, 2 insertions(+)
net/sctp/ipv6.c +2 -0
@@ -510,7 +510,9 @@ static void sctp_v6_to_addr(union sctp_a { addr->sa.sa_family =AF_INET6 ; addr->v6.sin6_port = port; + addr->v6.sin6_flowinfo =0 ; addr->v6.sin6_addr = *saddr; + addr->v6.sin6_scope_id =0 ; }/* Compare addresses exactly.
Greg Kroah-Hartman
maintainerPATCH 8/53 tipc: fix use-after-free
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 5bfd37b4de5c98e86b12bd13be5aa46c7484a125 ]
syszkaller reported use-after-free in tipc [1]
When msg->rep skb is freed, set the pointer to NULL, so that caller does not free it again.
[1]
==================================================================
BUG: KASAN: use-after-free in skb_push+0xd4/0xe0 net/core/skbuff.c:1466
Read of size 8 at addr ffff8801c6e71e90 by task syz-executor5/4115
CPU: 1 PID: 4115 Comm: syz-executor5 Not tainted 4.13.0-rc4+ #32
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:16 [inline]
dump_stack+0x194/0x257 lib/dump_stack.c:52
print_address_description+0x73/0x250 mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report+0x24e/0x340 mm/kasan/report.c:409
__asan_report_load8_noabort+0x14/0x20 mm/kasan/report.c:430
skb_push+0xd4/0xe0 net/core/skbuff.c:1466
tipc_nl_compat_recv+0x833/0x18f0 net/tipc/netlink_compat.c:1209
genl_family_rcv_msg+0x7b7/0xfb0 net/netlink/genetlink.c:598
genl_rcv_msg+0xb2/0x140 net/netlink/genetlink.c:623
netlink_rcv_skb+0x216/0x440 net/netlink/af_netlink.c:2397
genl_rcv+0x28/0x40 net/netlink/genetlink.c:634
netlink_unicast_kernel net/netlink/af_netlink.c:1265 [inline]
netlink_unicast+0x4e8/0x6f0 net/netlink/af_netlink.c:1291
netlink_sendmsg+0xa4a/0xe60 net/netlink/af_netlink.c:1854
sock_sendmsg_nosec net/socket.c:633 [inline]
sock_sendmsg+0xca/0x110 net/socket.c:643
sock_write_iter+0x31a/0x5d0 net/socket.c:898
call_write_iter include/linux/fs.h:1743 [inline]
new_sync_write fs/read_write.c:457 [inline]
__vfs_write+0x684/0x970 fs/read_write.c:470
vfs_write+0x189/0x510 fs/read_write.c:518
SYSC_write fs/read_write.c:565 [inline]
SyS_write+0xef/0x220 fs/read_write.c:557
entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x4512e9
RSP: 002b:00007f3bc8184c08 EFLAGS: 00000216 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 0000000000718000 RCX: 00000000004512e9
RDX: 0000000000000020 RSI: 0000000020fdb000 RDI: 0000000000000006
RBP: 0000000000000086 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000216 R12: 00000000004b5e76
R13: 00007f3bc8184b48 R14: 00000000004b5e86 R15: 0000000000000000
Allocated by task 4115:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x43/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551
kasan_slab_alloc+0x12/0x20 mm/kasan/kasan.c:489
kmem_cache_alloc_node+0x13d/0x750 mm/slab.c:3651
__alloc_skb+0xf1/0x740 net/core/skbuff.c:219
alloc_skb include/linux/skbuff.h:903 [inline]
tipc_tlv_alloc+0x26/0xb0 net/tipc/netlink_compat.c:148
tipc_nl_compat_dumpit+0xf2/0x3c0 net/tipc/netlink_compat.c:248
tipc_nl_compat_handle net/tipc/netlink_compat.c:1130 [inline]
tipc_nl_compat_recv+0x756/0x18f0 net/tipc/netlink_compat.c:1199
genl_family_rcv_msg+0x7b7/0xfb0 net/netlink/genetlink.c:598
genl_rcv_msg+0xb2/0x140 net/netlink/genetlink.c:623
netlink_rcv_skb+0x216/0x440 net/netlink/af_netlink.c:2397
genl_rcv+0x28/0x40 net/netlink/genetlink.c:634
netlink_unicast_kernel net/netlink/af_netlink.c:1265 [inline]
netlink_unicast+0x4e8/0x6f0 net/netlink/af_netlink.c:1291
netlink_sendmsg+0xa4a/0xe60 net/netlink/af_netlink.c:1854
sock_sendmsg_nosec net/socket.c:633 [inline]
sock_sendmsg+0xca/0x110 net/socket.c:643
sock_write_iter+0x31a/0x5d0 net/socket.c:898
call_write_iter include/linux/fs.h:1743 [inline]
new_sync_write fs/read_write.c:457 [inline]
__vfs_write+0x684/0x970 fs/read_write.c:470
vfs_write+0x189/0x510 fs/read_write.c:518
SYSC_write fs/read_write.c:565 [inline]
SyS_write+0xef/0x220 fs/read_write.c:557
entry_SYSCALL_64_fastpath+0x1f/0xbe
Freed by task 4115:
save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
save_stack+0x43/0xd0 mm/kasan/kasan.c:447
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0x71/0xc0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3503 [inline]
kmem_cache_free+0x77/0x280 mm/slab.c:3763
kfree_skbmem+0x1a1/0x1d0 net/core/skbuff.c:622
__kfree_skb net/core/skbuff.c:682 [inline]
kfree_skb+0x165/0x4c0 net/core/skbuff.c:699
tipc_nl_compat_dumpit+0x36a/0x3c0 net/tipc/netlink_compat.c:260
tipc_nl_compat_handle net/tipc/netlink_compat.c:1130 [inline]
tipc_nl_compat_recv+0x756/0x18f0 net/tipc/netlink_compat.c:1199
genl_family_rcv_msg+0x7b7/0xfb0 net/netlink/genetlink.c:598
genl_rcv_msg+0xb2/0x140 net/netlink/genetlink.c:623
netlink_rcv_skb+0x216/0x440 net/netlink/af_netlink.c:2397
genl_rcv+0x28/0x40 net/netlink/genetlink.c:634
netlink_unicast_kernel net/netlink/af_netlink.c:1265 [inline]
netlink_unicast+0x4e8/0x6f0 net/netlink/af_netlink.c:1291
netlink_sendmsg+0xa4a/0xe60 net/netlink/af_netlink.c:1854
sock_sendmsg_nosec net/socket.c:633 [inline]
sock_sendmsg+0xca/0x110 net/socket.c:643
sock_write_iter+0x31a/0x5d0 net/socket.c:898
call_write_iter include/linux/fs.h:1743 [inline]
new_sync_write fs/read_write.c:457 [inline]
__vfs_write+0x684/0x970 fs/read_write.c:470
vfs_write+0x189/0x510 fs/read_write.c:518
SYSC_write fs/read_write.c:565 [inline]
SyS_write+0xef/0x220 fs/read_write.c:557
entry_SYSCALL_64_fastpath+0x1f/0xbe
The buggy address belongs to the object at ffff8801c6e71dc0
which belongs to the cache skbuff_head_cache of size 224
The buggy address is located 208 bytes inside of
224-byte region [ffff8801c6e71dc0, ffff8801c6e71ea0)
The buggy address belongs to the page:
page:ffffea00071b9c40 count:1 mapcount:0 mapping:ffff8801c6e71000 index:0x0
flags: 0x200000000000100(slab)
raw: 0200000000000100 ffff8801c6e71000 0000000000000000 000000010000000c
raw: ffffea0007224a20 ffff8801d98caf48 ffff8801d9e79040 0000000000000000
page dumped because: kasan: bad access detected
Memory state around the buggy address:
ffff8801c6e71d80: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
ffff8801c6e71e00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8801c6e71e80: fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff8801c6e71f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8801c6e71f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================--- net/tipc/netlink_compat.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/tipc/netlink_compat.c +4 -2
@@ -258,13 +258,15 @@ static int tipc_nl_compat_dumpit(struct arg =nlmsg_new (0 ,GFP_KERNEL );if (!arg) {kfree_skb (msg->rep); + msg->rep =NULL ;return -ENOMEM ; } err =__tipc_nl_compat_dumpit (cmd, msg, arg); -if (err) +if (err) {kfree_skb (msg->rep); - + msg->rep =NULL ; + }kfree_skb (arg);return err;
Greg Kroah-Hartman
maintainerPATCH 9/53 ipv6: reset fn->rr_ptr when replacing route
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Wang <[email protected]>
[ Upstream commit 383143f31d7d3525a1dbff733d52fff917f82f15 ]
syzcaller reported the following use-after-free issue in rt6_select():
BUG: KASAN: use-after-free in rt6_select net/ipv6/route.c:755 [inline] at addr ffff8800bc6994e8 BUG: KASAN: use-after-free in ip6_pol_route.isra.46+0x1429/0x1470 net/ipv6/route.c:1084 at addr ffff8800bc6994e8 Read of size 4 by task syz-executor1/439628 CPU: 0 PID: 439628 Comm: syz-executor1 Not tainted 4.3.5+ #8 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 0000000000000000 ffff88018fe435b0 ffffffff81ca384d ffff8801d3588c00 ffff8800bc699380 ffff8800bc699500 dffffc0000000000 ffff8801d40a47c0 ffff88018fe435d8 ffffffff81735751 ffff88018fe43660 ffff8800bc699380 Call Trace: [<ffffffff81ca384d>] __dump_stack lib/dump_stack.c:15 [inline] [<ffffffff81ca384d>] dump_stack+0xc1/0x124 lib/dump_stack.c:51 sctp: [Deprecated]: syz-executor0 (pid 439615) Use of struct sctp_assoc_value in delayed_ack socket option. Use struct sctp_sack_info instead [<ffffffff81735751>] kasan_object_err+0x21/0x70 mm/kasan/report.c:158 [<ffffffff817359c4>] print_address_description mm/kasan/report.c:196 [inline] [<ffffffff817359c4>] kasan_report_error+0x1b4/0x4a0 mm/kasan/report.c:285 [<ffffffff81735d93>] kasan_report mm/kasan/report.c:305 [inline] [<ffffffff81735d93>] __asan_report_load4_noabort+0x43/0x50 mm/kasan/report.c:325 [<ffffffff82a28e39>] rt6_select net/ipv6/route.c:755 [inline] [<ffffffff82a28e39>] ip6_pol_route.isra.46+0x1429/0x1470 net/ipv6/route.c:1084 [<ffffffff82a28fb1>] ip6_pol_route_output+0x81/0xb0 net/ipv6/route.c:1203 [<ffffffff82ab0a50>] fib6_rule_action+0x1f0/0x680 net/ipv6/fib6_rules.c:95 [<ffffffff8265cbb6>] fib_rules_lookup+0x2a6/0x7a0 net/core/fib_rules.c:223 [<ffffffff82ab1430>] fib6_rule_lookup+0xd0/0x250 net/ipv6/fib6_rules.c:41 [<ffffffff82a22006>] ip6_route_output+0x1d6/0x2c0 net/ipv6/route.c:1224 [<ffffffff829e83d2>] ip6_dst_lookup_tail+0x4d2/0x890 net/ipv6/ip6_output.c:943 [<ffffffff829e889a>] ip6_dst_lookup_flow+0x9a/0x250 net/ipv6/ip6_output.c:1079 [<ffffffff82a9f7d8>] ip6_datagram_dst_update+0x538/0xd40 net/ipv6/datagram.c:91 [<ffffffff82aa0978>] __ip6_datagram_connect net/ipv6/datagram.c:251 [inline] [<ffffffff82aa0978>] ip6_datagram_connect+0x518/0xe50 net/ipv6/datagram.c:272 [<ffffffff82aa1313>] ip6_datagram_connect_v6_only+0x63/0x90 net/ipv6/datagram.c:284 [<ffffffff8292f790>] inet_dgram_connect+0x170/0x1f0 net/ipv4/af_inet.c:564 [<ffffffff82565547>] SYSC_connect+0x1a7/0x2f0 net/socket.c:1582 [<ffffffff8256a649>] SyS_connect+0x29/0x30 net/socket.c:1563 [<ffffffff82c72032>] entry_SYSCALL_64_fastpath+0x12/0x17
Object at ffff8800bc699380, in cache ip6_dst_cache size: 384
The root cause of it is that in fib6_add_rt2node(), when it replaces an existing route with the new one, it does not update fn->rr_ptr. This commit resets fn->rr_ptr to NULL when it points to a route which is replaced in fib6_add_rt2node().
--- net/ipv6/ip6_fib.c | 4 ++++ 1 file changed, 4 insertions(+)
net/ipv6/ip6_fib.c +4 -0
@@ -892,6 +892,8 @@ add: } nsiblings = iter->rt6i_nsiblings;fib6_purge_rt (iter, fn, info->nl_net); +if (fn->rr_ptr == iter) + fn->rr_ptr =NULL ;rt6_release (iter);if (nsiblings) {
@@ -904,6 +906,8 @@ add:if (rt6_qualify_for_ecmp (iter)) { *ins = iter->dst.rt6_next;fib6_purge_rt (iter, fn, info->nl_net); +if (fn->rr_ptr == iter) + fn->rr_ptr =NULL ;rt6_release (iter); nsiblings--; }else {
Greg Kroah-Hartman
maintainerPATCH 10/53 ipv6: repair fib6 tree in failure case
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Wang <[email protected]>
[ Upstream commit 348a4002729ccab8b888b38cbc099efa2f2a2036 ]
In fib6_add(), it is possible that fib6_add_1() picks an intermediate node and sets the node's fn->leaf to NULL in order to add this new route. However, if fib6_add_rt2node() fails to add the new route for some reason, fn->leaf will be left as NULL and could potentially cause crash when fn->leaf is accessed in fib6_locate(). This patch makes sure fib6_repair_tree() is called to properly repair fn->leaf in the above failure case.
Here is the syzkaller reported general protection fault in fib6_locate:
kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] SMP KASAN Modules linked in: CPU: 0 PID: 40937 Comm: syz-executor3 Not tainted Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 task: ffff8801d7d64100 ti: ffff8801d01a0000 task.ti: ffff8801d01a0000 RIP: 0010:[<ffffffff82a3e0e1>] [<ffffffff82a3e0e1>] __ipv6_prefix_equal64_half include/net/ipv6.h:475 [inline] RIP: 0010:[<ffffffff82a3e0e1>] [<ffffffff82a3e0e1>] ipv6_prefix_equal include/net/ipv6.h:492 [inline] RIP: 0010:[<ffffffff82a3e0e1>] [<ffffffff82a3e0e1>] fib6_locate_1 net/ipv6/ip6_fib.c:1210 [inline] RIP: 0010:[<ffffffff82a3e0e1>] [<ffffffff82a3e0e1>] fib6_locate+0x281/0x3c0 net/ipv6/ip6_fib.c:1233 RSP: 0018:ffff8801d01a36a8 EFLAGS: 00010202 RAX: 0000000000000020 RBX: ffff8801bc790e00 RCX: ffffc90002983000 RDX: 0000000000001219 RSI: ffff8801d01a37a0 RDI: 0000000000000100 RBP: ffff8801d01a36f0 R08: 00000000000000ff R09: 0000000000000000 R10: 0000000000000003 R11: 0000000000000000 R12: 0000000000000001 R13: dffffc0000000000 R14: ffff8801d01a37a0 R15: 0000000000000000 FS: 00007f6afd68c700(0000) GS:ffff8801db400000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 00000000004c6340 CR3: 00000000ba41f000 CR4: 00000000001426f0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 Stack: ffff8801d01a37a8 ffff8801d01a3780 ffffed003a0346f5 0000000c82a23ea0 ffff8800b7bd7700 ffff8801d01a3780 ffff8800b6a1c940 ffffffff82a23ea0 ffff8801d01a3920 ffff8801d01a3748 ffffffff82a223d6 ffff8801d7d64988 Call Trace: [<ffffffff82a223d6>] ip6_route_del+0x106/0x570 net/ipv6/route.c:2109 [<ffffffff82a23f9d>] inet6_rtm_delroute+0xfd/0x100 net/ipv6/route.c:3075 [<ffffffff82621359>] rtnetlink_rcv_msg+0x549/0x7a0 net/core/rtnetlink.c:3450 [<ffffffff8274c1d1>] netlink_rcv_skb+0x141/0x370 net/netlink/af_netlink.c:2281 [<ffffffff82613ddf>] rtnetlink_rcv+0x2f/0x40 net/core/rtnetlink.c:3456 [<ffffffff8274ad38>] netlink_unicast_kernel net/netlink/af_netlink.c:1206 [inline] [<ffffffff8274ad38>] netlink_unicast+0x518/0x750 net/netlink/af_netlink.c:1232 [<ffffffff8274b83e>] netlink_sendmsg+0x8ce/0xc30 net/netlink/af_netlink.c:1778 [<ffffffff82564aff>] sock_sendmsg_nosec net/socket.c:609 [inline] [<ffffffff82564aff>] sock_sendmsg+0xcf/0x110 net/socket.c:619 [<ffffffff82564d62>] sock_write_iter+0x222/0x3a0 net/socket.c:834 [<ffffffff8178523d>] new_sync_write+0x1dd/0x2b0 fs/read_write.c:478 [<ffffffff817853f4>] __vfs_write+0xe4/0x110 fs/read_write.c:491 [<ffffffff81786c38>] vfs_write+0x178/0x4b0 fs/read_write.c:538 [<ffffffff817892a9>] SYSC_write fs/read_write.c:585 [inline] [<ffffffff817892a9>] SyS_write+0xd9/0x1b0 fs/read_write.c:577 [<ffffffff82c71e32>] entry_SYSCALL_64_fastpath+0x12/0x17
Note: there is no "Fixes" tag as this seems to be a bug introduced very early.
--- net/ipv6/ip6_fib.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
net/ipv6/ip6_fib.c +11 -11
@@ -996,7 +996,7 @@ int fib6_add(struct fib6_node *root, str/* Create subtree root node */ sfn =node_alloc ();if (!sfn) - goto st_failure; + goto failure; sfn->leaf = info->nl_net->ipv6.ip6_null_entry;atomic_inc (&info->nl_net->ipv6.ip6_null_entry->rt6i_ref);
@@ -1012,12 +1012,12 @@ int fib6_add(struct fib6_node *root, strif (IS_ERR (sn)) {/* If it is failed, discard just allocated -root, and then (in st_failure) stale node +root, and then (in failure) stale node in main tree. */ node_free (sfn); err =PTR_ERR (sn); - goto st_failure; + goto failure; }/* Now link new subtree to main tree */
@@ -1031,7 +1031,7 @@ int fib6_add(struct fib6_node *root, strif (IS_ERR (sn)) { err =PTR_ERR (sn); - goto st_failure; + goto failure; } }
@@ -1073,22 +1073,22 @@ out: atomic_inc(&pn->leaf->rt6i_ref); }#endif -if (!(rt->dst.flags &DST_NOCACHE )) -dst_free (&rt->dst); + goto failure; }return err; -#ifdef CONFIG_IPV6_SUBTREES -/* Subtree creation failed, probably main tree node -is orphan. If it is, shoot it. +failure: +/* fn->leaf could be NULL if fn is an intermediate node and we +* failed to add the new route to it in both subtree creation +* failure and fib6_add_rt2node() failure case. +* In both cases, fib6_repair_tree() should be called to fix +* fn->leaf. */ -st_failure:if (fn && !(fn->fn_flags & (RTN_RTINFO |RTN_ROOT )))fib6_repair_tree (info->nl_net, fn);if (!(rt->dst.flags &DST_NOCACHE ))dst_free (&rt->dst);return err; -#endif }/*
Greg Kroah-Hartman
maintainerPATCH 11/53 tcp: when rearming RTO, if RTO time is in past then fire RTO ASAP
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neal Cardwell <[email protected]>
[ Upstream commit cdbeb633ca71a02b7b63bfeb94994bf4e1a0b894 ]
In some situations tcp_send_loss_probe() can realize that it's unable to send a loss probe (TLP), and falls back to calling tcp_rearm_rto() to schedule an RTO timer. In such cases, sometimes tcp_rearm_rto() realizes that the RTO was eligible to fire immediately or at some point in the past (delta_us <= 0). Previously in such cases tcp_rearm_rto() was scheduling such "overdue" RTOs to happen at now + icsk_rto, which caused needless delays of hundreds of milliseconds (and non-linear behavior that made reproducible testing difficult). This commit changes the logic to schedule "overdue" RTOs ASAP, rather than at now + icsk_rto.
--- net/ipv4/tcp_input.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/ipv4/tcp_input.c +1 -2
@@ -3028,8 +3028,7 @@ void tcp_rearm_rto(struct sock *sk)/* delta may not be positive if the socket is locked * when the retrans timer fires and is rescheduled. */ -if (delta >0 ) - rto = delta; + rto =max (delta,1 ); }inet_csk_reset_xmit_timer (sk,ICSK_TIME_RETRANS , rto,TCP_RTO_MAX );
Greg Kroah-Hartman
maintainerPATCH 12/53 irda: do not leak initialized list.dev to userspace
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
[ Upstream commit b024d949a3c24255a7ef1a470420eb478949aa4c ]
list.dev has not been initialized and so the copy_to_user is copying data from the stack back to user space which is a potential information leak. Fix this ensuring all of list is initialized to zero.
Detected by CoverityScan, CID#1357894 ("Uninitialized scalar variable")
--- net/irda/af_irda.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/irda/af_irda.c +1 -1
@@ -2227,7 +2227,7 @@ static int irda_getsockopt(struct socket {struct sock *sk = sock->sk;struct irda_sock *self =irda_sk (sk); -struct irda_device_list list; +struct irda_device_list list = {0 };struct irda_device_info *discoveries;struct irda_ias_set * ias_opt;/* IAS get/query params */ struct ias_object * ias_obj;/* Object in IAS */
Greg Kroah-Hartman
maintainerPATCH 13/53 net: sched: fix NULL pointer dereference when action calls some targets
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Xin Long <[email protected]>
[ Upstream commit 4f8a881acc9d1adaf1e552349a0b1df28933a04c ]
As we know in some target's checkentry it may dereference par.entryinfo to check entry stuff inside. But when sched action calls xt_check_target, par.entryinfo is set with NULL. It would cause kernel panic when calling some targets.
It can be reproduce with:
# tc qd add dev eth1 ingress handle ffff:
# tc filter add dev eth1 parent ffff: u32 match u32 0 0 action xt \
-j ECN --ecn-tcp-removeIt could also crash kernel when using target CLUSTERIP or TPROXY.
By now there's no proper value for par.entryinfo in ipt_init_target, but it can not be set with NULL. This patch is to void all these panics by setting it with an ipt_entry obj with all members = 0.
Note that this issue has been there since the very beginning.
--- net/sched/act_ipt.c | 2 ++ 1 file changed, 2 insertions(+)
net/sched/act_ipt.c +2 -0
@@ -34,6 +34,7 @@ static int ipt_init_target(struct xt_ent {struct xt_tgchk_param par;struct xt_target *target; +struct ipt_entry e = {};int ret =0 ; target = xt_request_find_target(AF_INET, t->u.user.name,
@@ -44,6 +45,7 @@ static int ipt_init_target(struct xt_ent t->u.kernel.target = target;memset (&par,0 ,sizeof (par)); par.table = table; + par.entryinfo = &e; par.target = target; par.targinfo = t->data; par.hook_mask = hook;
Greg Kroah-Hartman
maintainerPATCH 14/53 net_sched: fix order of queue length updates in qdisc_replace()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Khlebnikov <[email protected]>
[ Upstream commit 68a66d149a8c78ec6720f268597302883e48e9fa ]
This important to call qdisc_tree_reduce_backlog() after changing queue length. Parent qdisc should deactivate class in ->qlen_notify() called from qdisc_tree_reduce_backlog() but this happens only if qdisc->q.qlen in zero.
Missed class deactivations leads to crashes/warnings at picking packets from empty qdisc and corrupting state at reactivating this class in future.
--- include/net/sch_generic.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
include/net/sch_generic.h +4 -1
@@ -717,8 +717,11 @@ static inline struct Qdisc *qdisc_replac old = *pold; *pold = new;if (old !=NULL ) { -qdisc_tree_reduce_backlog (old, old->q.qlen, old->qstats.backlog); +unsigned int qlen = old->q.qlen; +unsigned int backlog = old->qstats.backlog; +qdisc_reset (old); +qdisc_tree_reduce_backlog (old, qlen, backlog); }sch_tree_unlock (sch);
Greg Kroah-Hartman
maintainerPATCH 15/53 mei: me: add broxton pci device ids
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Winkler <[email protected]>
commit dd16f6cdeb4e02a728863d3cf99aaab352f0d761 upstream.
Add device ids for Broxton SoC based devices.
--- drivers/misc/mei/hw-me-regs.h | 3 +++ drivers/misc/mei/pci-me.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/misc/mei/hw-me-regs.h +3 -0
@@ -125,6 +125,9 @@#define MEI_DEV_ID_KBP 0xA2BA/* Kaby Point */ #define MEI_DEV_ID_KBP_2 0xA2BB/* Kaby Point 2 */ +#define MEI_DEV_ID_BXT_M 0x1A9A/* Broxton M */ +#define MEI_DEV_ID_APL_I 0x5A9A/* Apollo Lake I */ +/* * MEI HW Section */
drivers/misc/mei/pci-me.c +3 -0
@@ -90,6 +90,9 @@ static const struct pci_device_id mei_me {MEI_PCI_DEVICE(MEI_DEV_ID_KBP, mei_me_pch8_cfg)}, {MEI_PCI_DEVICE(MEI_DEV_ID_KBP_2, mei_me_pch8_cfg)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_BXT_M, mei_me_pch8_cfg)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_APL_I, mei_me_pch8_cfg)}, +/* required last entry */ {0, } };
Greg Kroah-Hartman
maintainerPATCH 16/53 mei: me: add lewisburg device ids
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tomas Winkler <[email protected]>
commit 9ff2007bea1f1bfc53ac0bc7ccf8200bb275fd52 upstream.
Add MEI Lewisburg PCH IDs for Purley based workstations.
--- drivers/misc/mei/hw-me-regs.h | 2 ++ drivers/misc/mei/pci-me.c | 1 + 2 files changed, 3 insertions(+)
drivers/misc/mei/hw-me-regs.h +2 -0
@@ -125,6 +125,8 @@#define MEI_DEV_ID_KBP 0xA2BA/* Kaby Point */ #define MEI_DEV_ID_KBP_2 0xA2BB/* Kaby Point 2 */ +#define MEI_DEV_ID_LBG 0xA1BA/* Lewisburg (SPT) */ +#define MEI_DEV_ID_BXT_M 0x1A9A/* Broxton M */ #define MEI_DEV_ID_APL_I 0x5A9A/* Apollo Lake I */
drivers/misc/mei/pci-me.c +1 -0
@@ -86,6 +86,7 @@ static const struct pci_device_id mei_me {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_2, mei_me_pch8_cfg)}, {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H, mei_me_pch8_sps_cfg)}, {MEI_PCI_DEVICE(MEI_DEV_ID_SPT_H_2, mei_me_pch8_sps_cfg)}, + {MEI_PCI_DEVICE(MEI_DEV_ID_LBG, mei_me_pch8_cfg)}, {MEI_PCI_DEVICE(MEI_DEV_ID_KBP, mei_me_pch8_cfg)}, {MEI_PCI_DEVICE(MEI_DEV_ID_KBP_2, mei_me_pch8_cfg)},
Greg Kroah-Hartman
maintainerPATCH 17/53 Input: trackpoint - add new trackpoint firmware ID
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Ma <[email protected]>
commit ec667683c532c93fb41e100e5d61a518971060e2 upstream.
Synaptics add new TP firmware ID: 0x2 and 0x3, for now both lower 2 bits are indicated as TP. Change the constant to bitwise values.
This makes trackpoint to be recognized on Lenovo Carbon X1 Gen5 instead of it being identified as "PS/2 Generic Mouse".
--- drivers/input/mouse/trackpoint.c | 3 ++- drivers/input/mouse/trackpoint.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
drivers/input/mouse/trackpoint.c +2 -1
@@ -265,7 +265,8 @@ static int trackpoint_start_protocol(strif (ps2_command (&psmouse->ps2dev, param,MAKE_PS2_CMD (0 ,2 ,TP_READ_ID )))return -1 ; -if (param[0 ] !=TP_MAGIC_IDENT ) +/* add new TP ID. */ +if (!(param[0 ] &TP_MAGIC_IDENT ))return -1 ;if (firmware_id)
drivers/input/mouse/trackpoint.h +2 -1
@@ -21,8 +21,9 @@#define TP_COMMAND 0xE2/* Commands start with this */ #define TP_READ_ID 0xE1/* Sent for device identification */ -#define TP_MAGIC_IDENT 0x01/* Sent after a TP_READ_ID followed */ +#define TP_MAGIC_IDENT 0x03/* Sent after a TP_READ_ID followed */ /* by the firmware ID */ +/* Firmware ID includes 0x1, 0x2, 0x3 */ /*
Greg Kroah-Hartman
maintainerPATCH 18/53 Input: elan_i2c - add ELAN0602 ACPI ID to support Lenovo Yoga310
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: KT Liao <[email protected]>
commit 1d2226e45040ed4aee95b633cbd64702bf7fc2a1 upstream.
Add ELAN0602 to the list of known ACPI IDs to enable support for ELAN touchpads found in Lenovo Yoga310.
--- drivers/input/mouse/elan_i2c_core.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/mouse/elan_i2c_core.c +1 -0
@@ -1234,6 +1234,7 @@ static const struct acpi_device_id elan_ { "ELAN0000", 0 }, { "ELAN0100", 0 }, { "ELAN0600", 0 }, + { "ELAN0602", 0 }, { "ELAN0605", 0 }, { "ELAN0608", 0 }, { "ELAN0605", 0 },
Greg Kroah-Hartman
maintainerPATCH 19/53 ALSA: core: Fix unexpected error at replacing user TLV
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 88c54cdf61f508ebcf8da2d819f5dfc03e954d1d upstream.
When user tries to replace the user-defined control TLV, the kernel checks the change of its content via memcmp(). The problem is that the kernel passes the return value from memcmp() as is. memcmp() gives a non-zero negative value depending on the comparison result, and this shall be recognized as an error code.
The patch covers that corner-case, return 1 properly for the changed TLV.
--- sound/core/control.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/control.c +1 -1
@@ -1126,7 +1126,7 @@ static int snd_ctl_elem_user_tlv(structmutex_lock (&ue->card->user_ctl_lock); change = ue->tlv_data_size != size;if (!change) - change =memcmp (ue->tlv_data, new_data, size); + change =memcmp (ue->tlv_data, new_data, size) !=0 ;kfree (ue->tlv_data); ue->tlv_data = new_data; ue->tlv_data_size = size;
Greg Kroah-Hartman
maintainerPATCH 20/53 ALSA: hda - Add stereo mic quirk for Lenovo G50-70 (17aa:3978)
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit bbba6f9d3da357bbabc6fda81e99ff5584500e76 upstream.
Lenovo G50-70 (17aa:3978) with Conexant codec chip requires the similar workaround for the inverted stereo dmic like other Lenovo models.
Bugzilla: https://bugzilla.suse.com/show_bug.cgi?id=1020657
--- sound/pci/hda/patch_conexant.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_conexant.c +1 -0
@@ -854,6 +854,7 @@ static const struct snd_pci_quirk cxt506SND_PCI_QUIRK (0x17aa ,0x390b ,"Lenovo G50-80" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x3975 ,"Lenovo U300s" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x3977 ,"Lenovo IdeaPad U310" ,CXT_FIXUP_STEREO_DMIC ), +SND_PCI_QUIRK (0x17aa ,0x3978 ,"Lenovo G50-70" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK (0x17aa ,0x397b ,"Lenovo S205" ,CXT_FIXUP_STEREO_DMIC ),SND_PCI_QUIRK_VENDOR (0x17aa ,"Thinkpad" ,CXT_FIXUP_THINKPAD_ACPI ), SND_PCI_QUIRK(0x1c06, 0x2011, "Lemote A1004", CXT_PINCFG_LEMOTE_A1004),
Greg Kroah-Hartman
maintainerPATCH 21/53 ARCv2: PAE40: Explicitly set MSB counterpart of SLC region ops addresses
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Brodkin <[email protected]>
commit 7d79cee2c6540ea64dd917a14e2fd63d4ac3d3c0 upstream.
It is necessary to explicitly set both SLC_AUX_RGN_START1 and SLC_AUX_RGN_END1 which hold MSB bits of the physical address correspondingly of region start and end otherwise SLC region operation is executed in unpredictable manner
Without this patch, SLC flushes on HSDK (IOC disabled) were taking seconds.
--- arch/arc/include/asm/cache.h | 2 ++ arch/arc/mm/cache.c | 13 +++++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)
arch/arc/include/asm/cache.h +2 -0
@@ -88,7 +88,9 @@ extern int ioc_exists;#define ARC_REG_SLC_FLUSH 0x904#define ARC_REG_SLC_INVALIDATE 0x905#define ARC_REG_SLC_RGN_START 0x914 +#define ARC_REG_SLC_RGN_START1 0x915#define ARC_REG_SLC_RGN_END 0x916 +#define ARC_REG_SLC_RGN_END1 0x917/* Bit val in SLC_CONTROL */ #define SLC_CTRL_IM 0x040
arch/arc/mm/cache.c +11 -2
@@ -543,6 +543,7 @@ noinline void slc_op(phys_addr_t paddr,static DEFINE_SPINLOCK (lock);unsigned long flags;unsigned int ctrl; +phys_addr_t end;spin_lock_irqsave (&lock, flags);
@@ -572,8 +573,16 @@ noinline void slc_op(phys_addr_t paddr,* END needs to be setup before START (latter triggers the operation) * END can't be same as START, so add (l2_line_sz - 1) to sz */ -write_aux_reg (ARC_REG_SLC_RGN_END , (paddr + sz + l2_line_sz -1 )); -write_aux_reg (ARC_REG_SLC_RGN_START , paddr); + end = paddr + sz + l2_line_sz -1 ; +if (is_pae40_enabled ()) +write_aux_reg (ARC_REG_SLC_RGN_END1 ,upper_32_bits (end)); + +write_aux_reg (ARC_REG_SLC_RGN_END ,lower_32_bits (end)); + +if (is_pae40_enabled ()) +write_aux_reg (ARC_REG_SLC_RGN_START1 ,upper_32_bits (paddr)); + +write_aux_reg (ARC_REG_SLC_RGN_START ,lower_32_bits (paddr));while (read_aux_reg (ARC_REG_SLC_CTRL ) &SLC_CTRL_BUSY );
Greg Kroah-Hartman
maintainerPATCH 22/53 i2c: designware: Fix system suspend
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ulf Hansson <[email protected]>
commit a23318feeff662c8d25d21623daebdd2e55ec221 upstream.
The commit 8503ff166504 ("i2c: designware: Avoid unnecessary resuming during system suspend"), may suggest to the PM core to try out the so called direct_complete path for system sleep. In this path, the PM core treats a runtime suspended device as it's already in a proper low power state for system sleep, which makes it skip calling the system sleep callbacks for the device, except for the ->prepare() and the ->complete() callbacks.
However, the PM core may unset the direct_complete flag for a parent device, in case its child device are being system suspended before. In this scenario, the PM core invokes the system sleep callbacks, no matter if the device is runtime suspended or not.
Particularly in cases of an existing i2c slave device, the above path is triggered, which breaks the assumption that the i2c device is always runtime resumed whenever the dw_i2c_plat_suspend() is being called.
More precisely, dw_i2c_plat_suspend() calls clk_core_disable() and clk_core_unprepare(), for an already disabled/unprepared clock, leading to a splat in the log about clocks calls being wrongly balanced and breaking system sleep.
To still allow the direct_complete path in cases when it's possible, but also to keep the fix simple, let's runtime resume the i2c device in the ->suspend() callback, before continuing to put the device into low power state.
Note, in cases when the i2c device is attached to the ACPI PM domain, this problem doesn't occur, because ACPI's ->suspend() callback, assigned to acpi_subsys_suspend(), already calls pm_runtime_resume() for the device.
It should also be noted that this change does not fix commit 8503ff166504 ("i2c: designware: Avoid unnecessary resuming during system suspend"). Because for the non-ACPI case, the system sleep support was already broken prior that point.
--- drivers/i2c/busses/i2c-designware-platdrv.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-designware-platdrv.c +12 -2
@@ -294,7 +294,7 @@ static void dw_i2c_plat_complete(struct#endif #ifdef CONFIG_PM -static int dw_i2c_plat_suspend (struct device *dev) +static int dw_i2c_plat_runtime_suspend (struct device *dev) {struct platform_device *pdev =to_platform_device (dev);struct dw_i2c_dev *i_dev =platform_get_drvdata (pdev);
@@ -318,11 +318,21 @@ static int dw_i2c_plat_resume(struct devreturn 0 ; } +#ifdef CONFIG_PM_SLEEP +static int dw_i2c_plat_suspend (struct device *dev) +{ +pm_runtime_resume (dev); +return dw_i2c_plat_runtime_suspend (dev); +} +#endif +static const struct dev_pm_ops dw_i2c_dev_pm_ops = { .prepare = dw_i2c_plat_prepare, .complete = dw_i2c_plat_complete, SET_SYSTEM_SLEEP_PM_OPS(dw_i2c_plat_suspend, dw_i2c_plat_resume) -SET_RUNTIME_PM_OPS (dw_i2c_plat_suspend, dw_i2c_plat_resume,NULL ) +SET_RUNTIME_PM_OPS (dw_i2c_plat_runtime_suspend, + dw_i2c_plat_resume, +NULL ) };#define DW_I2C_DEV_PMOPS (&dw_i2c_dev_pm_ops)
Greg Kroah-Hartman
maintainerPATCH 24/53 drm/atomic: If the atomic check fails, return its value first
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maarten Lankhorst <[email protected]>
commit a0ffc51e20e90e0c1c2491de2b4b03f48b6caaba upstream.
The last part of drm_atomic_check_only is testing whether we need to fail with -EINVAL when modeset is not allowed, but forgets to return the value when atomic_check() fails first.
This results in -EDEADLK being replaced by -EINVAL, and the sanity check in drm_modeset_drop_locks kicks in:
[ 308.531734] ------------[ cut here ]------------ [ 308.531791] WARNING: CPU: 0 PID: 1886 at drivers/gpu/drm/drm_modeset_lock.c:217 drm_modeset_drop_locks+0x33/0xc0 [drm] [ 308.531828] Modules linked in: [ 308.532050] CPU: 0 PID: 1886 Comm: kms_atomic Tainted: G U W 4.13.0-rc5-patser+ #5225 [ 308.532082] Hardware name: NUC5i7RYB, BIOS RYBDWi35.86A.0246.2015.0309.1355 03/09/2015 [ 308.532124] task: ffff8800cd9dae00 task.stack: ffff8800ca3b8000 [ 308.532168] RIP: 0010:drm_modeset_drop_locks+0x33/0xc0 [drm] [ 308.532189] RSP: 0018:ffff8800ca3bf980 EFLAGS: 00010282 [ 308.532211] RAX: dffffc0000000000 RBX: ffff8800ca3bfaf8 RCX: 0000000013a171e6 [ 308.532235] RDX: 1ffff10019477f69 RSI: ffffffffa8ba4fa0 RDI: ffff8800ca3bfb48 [ 308.532258] RBP: ffff8800ca3bf998 R08: 0000000000000000 R09: 0000000000000003 [ 308.532281] R10: 0000000079dbe066 R11: 00000000f760b34b R12: 0000000000000001 [ 308.532304] R13: dffffc0000000000 R14: 00000000ffffffea R15: ffff880096889680 [ 308.532328] FS: 00007ff00959cec0(0000) GS:ffff8800d4e00000(0000) knlGS:0000000000000000 [ 308.532359] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 308.532380] CR2: 0000000000000008 CR3: 00000000ca2e3000 CR4: 00000000003406f0 [ 308.532402] Call Trace: [ 308.532440] drm_mode_atomic_ioctl+0x19fa/0x1c00 [drm] [ 308.532488] ? drm_atomic_set_property+0x1220/0x1220 [drm] [ 308.532565] ? avc_has_extended_perms+0xc39/0xff0 [ 308.532593] ? lock_downgrade+0x610/0x610 [ 308.532640] ? drm_atomic_set_property+0x1220/0x1220 [drm] [ 308.532680] drm_ioctl_kernel+0x154/0x1a0 [drm] [ 308.532755] drm_ioctl+0x624/0x8f0 [drm] [ 308.532858] ? drm_atomic_set_property+0x1220/0x1220 [drm] [ 308.532976] ? drm_getunique+0x210/0x210 [drm] [ 308.533061] do_vfs_ioctl+0xd92/0xe40 [ 308.533121] ? ioctl_preallocate+0x1b0/0x1b0 [ 308.533160] ? selinux_capable+0x20/0x20 [ 308.533191] ? do_fcntl+0x1b1/0xbf0 [ 308.533219] ? kasan_slab_free+0xa2/0xb0 [ 308.533249] ? f_getown+0x4b/0xa0 [ 308.533278] ? putname+0xcf/0xe0 [ 308.533309] ? security_file_ioctl+0x57/0x90 [ 308.533342] SyS_ioctl+0x4e/0x80 [ 308.533374] entry_SYSCALL_64_fastpath+0x18/0xad [ 308.533405] RIP: 0033:0x7ff00779e4d7 [ 308.533431] RSP: 002b:00007fff66a043d8 EFLAGS: 00000246 ORIG_RAX: 0000000000000010 [ 308.533481] RAX: ffffffffffffffda RBX: 000000e7c7ca5910 RCX: 00007ff00779e4d7 [ 308.533560] RDX: 00007fff66a04430 RSI: 00000000c03864bc RDI: 0000000000000003 [ 308.533608] RBP: 00007ff007a5fb00 R08: 000000e7c7ca4620 R09: 000000e7c7ca5e60 [ 308.533647] R10: 0000000000000001 R11: 0000000000000246 R12: 0000000000000070 [ 308.533685] R13: 0000000000000000 R14: 0000000000000000 R15: 000000e7c7ca5930 [ 308.533770] Code: ff df 55 48 89 e5 41 55 41 54 53 48 89 fb 48 83 c7 50 48 89 fa 48 c1 ea 03 80 3c 02 00 74 05 e8 94 d4 16 e7 48 83 7b 50 00 74 02 <0f> ff 4c 8d 6b 58 48 b8 00 00 00 00 00 fc ff df 4c 89 ea 48 c1 [ 308.534086] ---[ end trace 77f11e53b1df44ad ]---
Solve this by adding the missing return.
This is also a bugfix because we could end up rejecting updates with -EINVAL because of a early -EDEADLK, while if atomic_check ran to completion it might have downgraded the modeset to a fastset.
Testcase: kms_atomic
--- drivers/gpu/drm/drm_atomic.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_atomic.c +4 -1
@@ -1247,6 +1247,9 @@ int drm_atomic_check_only(struct drm_atoif (config->funcs->atomic_check) ret = config->funcs->atomic_check (state->dev, state); +if (ret) +return ret; +if (!state->allow_modeset) {for_each_crtc_in_state (state, crtc, crtc_state, i) {if (drm_atomic_crtc_needs_modeset (crtc_state)) {
@@ -1257,7 +1260,7 @@ int drm_atomic_check_only(struct drm_ato } } -return ret; +return 0 ; }EXPORT_SYMBOL (drm_atomic_check_only);
Greg Kroah-Hartman
maintainerPATCH 25/53 drm: rcar-du: lvds: Fix PLL frequency-related configuration
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Pinchart <[email protected]>
commit 5e1ac3bdc6bbb4f378251b87625b8acfbfc4ae82 upstream.
The frequency checks don't match the datasheet, fix them.
--- drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c +3 -3
@@ -56,11 +56,11 @@ static int rcar_du_lvdsenc_start(structreturn ret;/* PLL clock configuration */ -if (freq <=38000 ) +if (freq <39000 ) pllcr =LVDPLLCR_CEEN |LVDPLLCR_COSEL |LVDPLLCR_PLLDLYCNT_38M ; -else if (freq <=60000 ) +else if (freq <61000 ) pllcr =LVDPLLCR_CEEN |LVDPLLCR_COSEL |LVDPLLCR_PLLDLYCNT_60M ; -else if (freq <=121000 ) +else if (freq <121000 ) pllcr =LVDPLLCR_CEEN |LVDPLLCR_COSEL |LVDPLLCR_PLLDLYCNT_121M ;else pllcr =LVDPLLCR_PLLDLYCNT_150M ;
Greg Kroah-Hartman
maintainerPATCH 26/53 drm: rcar-du: lvds: Rename PLLEN bit to PLLON
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Pinchart <[email protected]>
commit 82e7c5e4964545352accff4b44bbcaa2c38e7fc1 upstream.
The bit is named PLLON in the datasheet, rename it.
--- drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c | 2 +- drivers/gpu/drm/rcar-du/rcar_lvds_regs.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_lvdsenc.c +1 -1
@@ -102,7 +102,7 @@ static int rcar_du_lvdsenc_start(struct/* Turn the PLL on, wait for the startup delay, and turn the output * on. */ - lvdcr0 |=LVDCR0_PLLEN ; + lvdcr0 |=LVDCR0_PLLON ;rcar_lvds_write (lvds,LVDCR0 , lvdcr0);usleep_range (100 ,150 );
drivers/gpu/drm/rcar-du/rcar_lvds_regs.h +1 -1
@@ -18,7 +18,7 @@#define LVDCR0_DMD (1 << 12)#define LVDCR0_LVMD_MASK (0xf << 8)#define LVDCR0_LVMD_SHIFT 8 -#define LVDCR0_PLLEN (1 << 4) +#define LVDCR0_PLLON (1 << 4)#define LVDCR0_BEN (1 << 2)#define LVDCR0_LVEN (1 << 1)#define LVDCR0_LVRES (1 << 0)
Greg Kroah-Hartman
maintainerPATCH 27/53 drm: rcar-du: Fix crash in encoder failure error path
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Laurent Pinchart <[email protected]>
commit 05ee29e94acf0d4b3998c3f93374952de8f90176 upstream.
When an encoder fails to initialize the driver prints an error message to the kernel log. The message contains the name of the encoder's DT node, which is NULL for internal encoders. Use the of_node_full_name() macro to avoid dereferencing a NULL pointer, print the output number to add more context to the error, and make sure we still own a reference to the encoder's DT node by delaying the of_node_put() call.
--- drivers/gpu/drm/rcar-du/rcar_du_kms.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_kms.c +5 -5
@@ -642,13 +642,13 @@ static int rcar_du_encoders_init_one(str } ret =rcar_du_encoder_init (rcdu, enc_type, output, encoder, connector); -of_node_put (encoder); -of_node_put (connector); -if (ret && ret != -EPROBE_DEFER )dev_warn (rcdu->dev, -"failed to initialize encoder %s (%d), skipping\n" , - encoder->full_name, ret); +"failed to initialize encoder %s on output %u (%d), skipping\n" , +of_node_full_name (encoder), output, ret); + +of_node_put (encoder); +of_node_put (connector);return ret; }
Greg Kroah-Hartman
maintainerPATCH 28/53 drm: rcar-du: Fix display timing controller parameter
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Koji Matsuoka <[email protected]>
commit 9cdced8a39c04cf798ddb2a27cb5952f7d39f633 upstream.
There is a bug in the setting of the DES (Display Enable Signal) register. This current setting occurs 1 dot left shift. The DES register should be set minus one value about the specifying value with H/W specification. This patch corrects it.
--- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/rcar-du/rcar_du_crtc.c +1 -1
@@ -171,7 +171,7 @@ static void rcar_du_crtc_set_display_tim mode->crtc_vsync_start - 1);rcar_du_crtc_write (rcrtc,VCR , mode->crtc_vtotal -1 ); -rcar_du_crtc_write (rcrtc,DESR , mode->htotal - mode->hsync_start); +rcar_du_crtc_write (rcrtc,DESR , mode->htotal - mode->hsync_start -1 );rcar_du_crtc_write (rcrtc,DEWR , mode->hdisplay); }
Greg Kroah-Hartman
maintainerPATCH 29/53 drm: rcar-du: Fix H/V sync signal polarity configuration
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Koji Matsuoka <[email protected]>
commit fd1adef3bff0663c5ac31b45bc4a05fafd43d19b upstream.
The VSL and HSL bits in the DSMR register set the corresponding horizontal and vertical sync signal polarity to active high. The code got it the wrong way around, fix it.
--- drivers/gpu/drm/rcar-du/rcar_du_crtc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/rcar-du/rcar_du_crtc.c +2 -2
@@ -148,8 +148,8 @@ static void rcar_du_crtc_set_display_timrcar_du_group_write (rcrtc->group, rcrtc->index %2 ?OTAR2 :OTAR ,0 );/* Signal polarities */ - value = ((mode->flags &DRM_MODE_FLAG_PVSYNC ) ?0 :DSMR_VSL ) - | ((mode->flags &DRM_MODE_FLAG_PHSYNC ) ?0 :DSMR_HSL ) + value = ((mode->flags &DRM_MODE_FLAG_PVSYNC ) ?DSMR_VSL :0 ) + | ((mode->flags &DRM_MODE_FLAG_PHSYNC ) ?DSMR_HSL :0 ) |DSMR_DIPM_DE |DSMR_CSPM ;rcar_du_crtc_write (rcrtc,DSMR , value);
Greg Kroah-Hartman
maintainerPATCH 30/53 tracing: Fix freeing of filter in create_filter() when set_str is false
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Steven Rostedt (VMware) <[email protected]>
commit 8b0db1a5bdfcee0dbfa89607672598ae203c9045 upstream.
Performing the following task with kmemleak enabled:
# cd /sys/kernel/tracing/events/irq/irq_handler_entry/
# echo 'enable_event:kmem:kmalloc:3 if irq >' > trigger
# echo 'enable_event:kmem:kmalloc:3 if irq > 31' > trigger
# echo scan > /sys/kernel/debug/kmemleak
# cat /sys/kernel/debug/kmemleak
unreferenced object 0xffff8800b9290308 (size 32):
comm "bash", pid 1114, jiffies 4294848451 (age 141.139s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
backtrace:
[<ffffffff81cef5aa>] kmemleak_alloc+0x4a/0xa0
[<ffffffff81357938>] kmem_cache_alloc_trace+0x158/0x290
[<ffffffff81261c09>] create_filter_start.constprop.28+0x99/0x940
[<ffffffff812639c9>] create_filter+0xa9/0x160
[<ffffffff81263bdc>] create_event_filter+0xc/0x10
[<ffffffff812655e5>] set_trigger_filter+0xe5/0x210
[<ffffffff812660c4>] event_enable_trigger_func+0x324/0x490
[<ffffffff812652e2>] event_trigger_write+0x1a2/0x260
[<ffffffff8138cf87>] __vfs_write+0xd7/0x380
[<ffffffff8138f421>] vfs_write+0x101/0x260
[<ffffffff8139187b>] SyS_write+0xab/0x130
[<ffffffff81cfd501>] entry_SYSCALL_64_fastpath+0x1f/0xbe
[<ffffffffffffffff>] 0xffffffffffffffffThe function create_filter() is passed a 'filterp' pointer that gets allocated, and if "set_str" is true, it is up to the caller to free it, even on error. The problem is that the pointer is not freed by create_filter() when set_str is false. This is a bug, and it is not up to the caller to free the filter on error if it doesn't care about the string.
--- kernel/trace/trace_events_filter.c | 4 ++++ 1 file changed, 4 insertions(+)
kernel/trace/trace_events_filter.c +4 -0
@@ -1979,6 +1979,10 @@ static int create_filter(struct trace_evif (err && set_str)append_filter_err (ps, filter); } +if (err && !set_str) { +free_event_filter (filter); + filter =NULL ; + }create_filter_finish (ps); *filterp = filter;
Greg Kroah-Hartman
maintainerPATCH 31/53 cifs: Fix df output for users with quota limits
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sachin Prabhu <[email protected]>
commit 42bec214d8bd432be6d32a1acb0a9079ecd4d142 upstream.
The df for a SMB2 share triggers a GetInfo call for FS_FULL_SIZE_INFORMATION. The values returned are used to populate struct statfs.
The problem is that none of the information returned by the call contains the total blocks available on the filesystem. Instead we use the blocks available to the user ie. quota limitation when filling out statfs.f_blocks. The information returned does contain Actual free units on the filesystem and is used to populate statfs.f_bfree. For users with quota enabled, it can lead to situations where the total free space reported is more than the total blocks on the system ending up with df reports like the following
# df -h /mnt/a Filesystem Size Used Avail Use% Mounted on //192.168.22.10/a 2.5G -2.3G 2.5G - /mnt/a
To fix this problem, we instead populate both statfs.f_bfree with the same value as statfs.f_bavail ie. CallerAvailableAllocationUnits. This is similar to what is done already in the code for cifs and df now reports the quota information for the user used to mount the share.
# df --si /mnt/a Filesystem Size Used Avail Use% Mounted on //192.168.22.10/a 2.7G 101M 2.6G 4% /mnt/a
--- fs/cifs/smb2pdu.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/cifs/smb2pdu.c +2 -2
@@ -2768,8 +2768,8 @@ copy_fs_info_to_kstatfs(struct smb2_fs_f kst->f_bsize =le32_to_cpu (pfs_inf->BytesPerSector) *le32_to_cpu (pfs_inf->SectorsPerAllocationUnit); kst->f_blocks =le64_to_cpu (pfs_inf->TotalAllocationUnits); - kst->f_bfree =le64_to_cpu (pfs_inf->ActualAvailableAllocationUnits); - kst->f_bavail =le64_to_cpu (pfs_inf->CallerAvailableAllocationUnits); + kst->f_bfree = kst->f_bavail = +le64_to_cpu (pfs_inf->CallerAvailableAllocationUnits);return ; }
Greg Kroah-Hartman
maintainerPATCH 32/53 cifs: return ENAMETOOLONG for overlong names in cifs_open()/cifs_lookup()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ronnie Sahlberg <[email protected]>
commit d3edede29f74d335f81d95a4588f5f136a9f7dcf upstream.
Add checking for the path component length and verify it is <= the maximum that the server advertizes via FileFsAttributeInformation.
With this patch cifs.ko will now return ENAMETOOLONG instead of ENOENT when users to access an overlong path.
To test this, try to cd into a (non-existing) directory on a CIFS share that has a too long name:
cd /mnt/aaaaaaaaaaaaaaa...
and it now should show a good error message from the shell:
bash: cd: /mnt/aaaaaaaaaaaaaaaa...aaaaaa: File name too long
rh bz 1153996
--- fs/cifs/dir.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
fs/cifs/dir.c +12 -6
@@ -183,15 +183,20 @@ cifs_bp_rename_retry: }/* +* Don't allow path components longer than the server max. * Don't allow the separator character in a path component. * The VFS will not allow "/", but "\" is allowed by posix. */ static int -check_name (struct dentry *direntry) +check_name (struct dentry *direntry,struct cifs_tcon *tcon) {struct cifs_sb_info *cifs_sb =CIFS_SB (direntry->d_sb);int i; +if (unlikely (direntry->d_name.len > + tcon->fsAttrInfo.MaxPathNameComponentLength)) +return -ENAMETOOLONG ; +if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_POSIX_PATHS )) {for (i =0 ; i < direntry->d_name.len; i++) {if (direntry->d_name.name[i] =='\\' ) {
@@ -489,10 +494,6 @@ cifs_atomic_open(struct inode *inode, streturn finish_no_open (file, res); } - rc =check_name (direntry); -if (rc) -return rc; - xid =get_xid (); cifs_dbg(FYI, "parent inode = 0x%p name is: %pd and dentry = 0x%p\n",
@@ -505,6 +506,11 @@ cifs_atomic_open(struct inode *inode, st } tcon =tlink_tcon (tlink); + + rc =check_name (direntry, tcon); +if (rc) + goto out_free_xid; + server = tcon->ses->server;if (server->ops->new_lease_key)
@@ -765,7 +771,7 @@ cifs_lookup(struct inode *parent_dir_ino } pTcon =tlink_tcon (tlink); - rc =check_name (direntry); + rc =check_name (direntry, pTcon);if (rc) goto lookup_out;
Re: [PATCH 4.4 32/53] cifs: return ENAMETOOLONG for overlong names in cifs_open()/cifs_lookup()
Quoted 7 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ronnie Sahlberg <[email protected]>
commit
d3edede29f74d335f81d95a4588f5f136a9f7dcfupstream.
[...]
Quoted 9 lines
(quoted diff) +0
-0@@ -505,6 +506,11 @@ cifs_atomic_open(struct inode *inode, st }
tcon =tlink_tcon(tlink);fs/cifs/dir.c +5
-0+ + rc =check_name (direntry, tcon); +if (rc) + goto out_free_xid; +
Quoted 3 lines
server =
tcon->ses->server;
if (server->ops->new_lease_key)
[...]
Doesn't this leak a reference to tlink? Seems like the exit label should be 'out' not 'out_free_xid'.
Ben.
Signature · 2 lines
Ben Hutchings Software Developer, Codethink Ltd.
Greg Kroah-Hartman
maintainerPATCH 33/53 nfsd: Limit end of page list when decoding NFSv4 WRITE
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chuck Lever <[email protected]>
commit fc788f64f1f3eb31e87d4f53bcf1ab76590d5838 upstream.
When processing an NFSv4 WRITE operation, argp->end should never point past the end of the data in the final page of the page list. Otherwise, nfsd4_decode_compound can walk into uninitialized memory.
More critical, nfsd4_decode_write is failing to increment argp->pagelen when it increments argp->pagelist. This can cause later xdr decoders to assume more data is available than really is, which can cause server crashes on malformed requests.
--- fs/nfsd/nfs4xdr.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
fs/nfsd/nfs4xdr.c +2 -4
@@ -129,7 +129,7 @@ static void next_decode_page(struct nfsd argp->p =page_address (argp->pagelist[0 ]); argp->pagelist++;if (argp->pagelen <PAGE_SIZE ) { - argp->end = argp->p + (argp->pagelen>>2 ); + argp->end = argp->p +XDR_QUADLEN (argp->pagelen); argp->pagelen =0 ; }else { argp->end = argp->p + (PAGE_SIZE >>2 );
@@ -1246,9 +1246,7 @@ nfsd4_decode_write(struct nfsd4_compound argp->pagelen -= pages *PAGE_SIZE ; len -= pages *PAGE_SIZE ; - argp->p = (__be32 *)page_address (argp->pagelist[0 ]); - argp->pagelist++; - argp->end = argp->p +XDR_QUADLEN (PAGE_SIZE ); +next_decode_page (argp); } argp->p +=XDR_QUADLEN (len);
Greg Kroah-Hartman
maintainerPATCH 34/53 perf/core: Fix group {cpu,task} validation
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Rutland <[email protected]>
commit 64aee2a965cf2954a038b5522f11d2cd2f0f8f3e upstream.
Regardless of which events form a group, it does not make sense for the events to target different tasks and/or CPUs, as this leaves the group inconsistent and impossible to schedule. The core perf code assumes that these are consistent across (successfully intialised) groups.
Core perf code only verifies this when moving SW events into a HW context. Thus, we can violate this requirement for pure SW groups and pure HW groups, unless the relevant PMU driver happens to perform this verification itself. These mismatched groups subsequently wreak havoc elsewhere.
For example, we handle watchpoints as SW events, and reserve watchpoint HW on a per-CPU basis at pmu::event_init() time to ensure that any event that is initialised is guaranteed to have a slot at pmu::add() time. However, the core code only checks the group leader's cpu filter (via event_filter_match()), and can thus install follower events onto CPUs violating thier (mismatched) CPU filters, potentially installing them into a CPU without sufficient reserved slots.
This can be triggered with the below test case, resulting in warnings from arch backends.
#define _GNU_SOURCE #include <linux/hw_breakpoint.h> #include <linux/perf_event.h> #include <sched.h> #include <stdio.h> #include <sys/prctl.h> #include <sys/syscall.h> #include <unistd.h>
static int perf_event_open(struct perf_event_attr *attr, pid_t pid, int cpu,
int group_fd, unsigned long flags)
{
return syscall(__NR_perf_event_open, attr, pid, cpu, group_fd, flags);}
char watched_char;
struct perf_event_attr wp_attr = {
.type = PERF_TYPE_BREAKPOINT,
.bp_type = HW_BREAKPOINT_RW,
.bp_addr = (unsigned long)&watched_char,
.bp_len = 1,
.size = sizeof(wp_attr),
};
int main(int argc, char *argv[])
{
int leader, ret;
cpu_set_t cpus;
/*
* Force use of CPU0 to ensure our CPU0-bound events get scheduled.
*/
CPU_ZERO(&cpus);
CPU_SET(0, &cpus);
ret = sched_setaffinity(0, sizeof(cpus), &cpus);
if (ret) {
printf("Unable to set cpu affinity\n");
return 1;
}
/* open leader event, bound to this task, CPU0 only */
leader = perf_event_open(&wp_attr, 0, 0, -1, 0);
if (leader < 0) {
printf("Couldn't open leader: %d\n", leader);
return 1;
}
/*
* Open a follower event that is bound to the same task, but a
* different CPU. This means that the group should never be possible to
* schedule.
*/
ret = perf_event_open(&wp_attr, 0, 1, leader, 0);
if (ret < 0) {
printf("Couldn't open mismatched follower: %d\n", ret);
return 1;
} else {
printf("Opened leader/follower with mismastched CPUs\n");
}
/*
* Open as many independent events as we can, all bound to the same
* task, CPU0 only.
*/
do {
ret = perf_event_open(&wp_attr, 0, 0, -1, 0);
} while (ret >= 0);
/*
* Force enable/disble all events to trigger the erronoeous
* installation of the follower event.
*/
printf("Opened all events. Toggling..\n");
for (;;) {
prctl(PR_TASK_PERF_EVENTS_DISABLE, 0, 0, 0, 0);
prctl(PR_TASK_PERF_EVENTS_ENABLE, 0, 0, 0, 0);
}
return 0;}
Fix this by validating this requirement regardless of whether we're moving events.
--- kernel/events/core.c | 39 +++++++++++++++++++-------------------- 1 file changed, 19 insertions(+), 20 deletions(-)
kernel/events/core.c +19 -20
@@ -8473,28 +8473,27 @@ SYSCALL_DEFINE5(perf_event_open, goto err_context;/* -* Do not allow to attach to a group in a different -* task or CPU context: +* Make sure we're both events for the same CPU; +* grouping events for different CPUs is broken; since +* you can never concurrently schedule them anyhow. */ -if (move_group) { -/* -* Make sure we're both on the same task, or both -* per-cpu events. -*/ -if (group_leader->ctx->task != ctx->task) - goto err_context; +if (group_leader->cpu != event->cpu) + goto err_context; + +/* +* Make sure we're both on the same task, or both +* per-CPU events. +*/ +if (group_leader->ctx->task != ctx->task) + goto err_context; -/* -* Make sure we're both events for the same CPU; -* grouping events for different CPUs is broken; since -* you can never concurrently schedule them anyhow. -*/ -if (group_leader->cpu != event->cpu) - goto err_context; - }else { -if (group_leader->ctx != ctx) - goto err_context; - } +/* +* Do not allow to attach to a group in a different task +* or CPU context. If we're moving SW events, we'll fix +* this up later, so allow that. +*/ +if (!move_group && group_leader->ctx != ctx) + goto err_context;/* * Only a group leader can be exclusive or pinned
Greg Kroah-Hartman
maintainerPATCH 35/53 Bluetooth: hidp: fix possible might sleep error in hidp_session_thread
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeffy Chen <[email protected]>
commit 5da8e47d849d3d37b14129f038782a095b9ad049 upstream.
It looks like hidp_session_thread has same pattern as the issue reported in old rfcomm:
while (1) {
set_current_state(TASK_INTERRUPTIBLE);
if (condition)
break;
// may call might_sleep here
schedule();
}
__set_current_state(TASK_RUNNING);Which fixed at:
dfb2fae Bluetooth: Fix nested sleeps
So let's fix it at the same way, also follow the suggestion of:
https://lwn.net/Articles/628628/
--- net/bluetooth/hidp/core.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-)
net/bluetooth/hidp/core.c +22 -11
@@ -36,6 +36,7 @@#define VERSION "1.2"static DECLARE_RWSEM (hidp_session_sem); +static DECLARE_WAIT_QUEUE_HEAD (hidp_session_wq);static LIST_HEAD (hidp_session_list);static unsigned char hidp_keycode[256 ] = {
@@ -1068,12 +1069,12 @@ static int hidp_session_start_sync(struc* Wake up session thread and notify it to stop. This is asynchronous and * returns immediately. Call this whenever a runtime error occurs and you want * the session to stop. -* Note: wake_up_process() performs any necessary memory-barriers for us. +* Note: wake_up_interruptible() performs any necessary memory-barriers for us. */ static void hidp_session_terminate (struct hidp_session *session) {atomic_inc (&session->terminate); -wake_up_process (session->task); +wake_up_interruptible (&hidp_session_wq); }/*
@@ -1180,7 +1181,9 @@ static void hidp_session_run(struct hidpstruct sock *ctrl_sk = session->ctrl_sock->sk;struct sock *intr_sk = session->intr_sock->sk;struct sk_buff *skb; +DEFINE_WAIT_FUNC (wait, woken_wake_function); +add_wait_queue (&hidp_session_wq, &wait);for (;;) {/* * This thread can be woken up two ways:
@@ -1188,12 +1191,10 @@ static void hidp_session_run(struct hidp* session->terminate flag and wakes this thread up. * - Via modifying the socket state of ctrl/intr_sock. This * thread is woken up by ->sk_state_changed(). -* -* Note: set_current_state() performs any necessary -* memory-barriers for us. */ -set_current_state (TASK_INTERRUPTIBLE ); +/* Ensure session->terminate is updated */ +smp_mb__before_atomic ();if (atomic_read (&session->terminate))break ;
@@ -1227,11 +1228,22 @@ static void hidp_session_run(struct hidphidp_process_transmit (session, &session->ctrl_transmit, session->ctrl_sock); -schedule (); +wait_woken (&wait,TASK_INTERRUPTIBLE ,MAX_SCHEDULE_TIMEOUT ); } +remove_wait_queue (&hidp_session_wq, &wait);atomic_inc (&session->terminate); -set_current_state (TASK_RUNNING ); + +/* Ensure session->terminate is updated */ +smp_mb__after_atomic (); +} + +static int hidp_session_wake_function (wait_queue_t *wait, +unsigned int mode, +int sync,void *key) +{ +wake_up_interruptible (&hidp_session_wq); +return false; }/*
@@ -1244,7 +1256,8 @@ static void hidp_session_run(struct hidpstatic int hidp_session_thread (void *arg) {struct hidp_session *session = arg; -wait_queue_t ctrl_wait, intr_wait; +DEFINE_WAIT_FUNC (ctrl_wait, hidp_session_wake_function); +DEFINE_WAIT_FUNC (intr_wait, hidp_session_wake_function);BT_DBG ("session %p" , session);
@@ -1254,8 +1267,6 @@ static int hidp_session_thread(void *argset_user_nice (current,-15 );hidp_set_timer (session); -init_waitqueue_entry (&ctrl_wait, current); -init_waitqueue_entry (&intr_wait, current);add_wait_queue (sk_sleep (session->ctrl_sock->sk), &ctrl_wait);add_wait_queue (sk_sleep (session->intr_sock->sk), &intr_wait);/* This memory barrier is paired with wq_has_sleeper(). See
Re: [PATCH 4.4 35/53] Bluetooth: hidp: fix possible might sleep error in hidp_session_thread
Quoted 39 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeffy Chen <[email protected]>
commit
5da8e47d849d3d37b14129f038782a095b9ad049upstream.It looks like
hidp_session_threadhas same pattern as the issue reported in old rfcomm:while (1) { set_current_state(TASK_INTERRUPTIBLE); if (condition) break; // may call might_sleep here schedule(); } __set_current_state(TASK_RUNNING);Which fixed at:
dfb2fae Bluetooth: Fix nested sleepsSo let's fix it at the same way, also follow the suggestion of:
https://lwn.net/Articles/628628/Signed-off-by Jeffy Chen <[email protected]>Tested-by AL Yu-Chen Cho <[email protected]>Tested-by Rohit Vaswani <[email protected]>Signed-off-by Marcel Holtmann <[email protected]>Cc Jiri Slaby <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- net/bluetooth/hidp/core.c | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-)net/bluetooth/hidp/core.c +0
-0
[...]
net/bluetooth/hidp/core.c static void hidp_session_run(struct hidp · line 1199
Quoted 4 lines
net/bluetooth/hidp/core.c +2
-0+/* Ensure session->terminate is updated */ +smp_mb__before_atomic ();if (atomic_read (&session->terminate))break ;
[...]
smp_mb__before_atomic() is only meant to avoid adding a redundant barrier next to an atomic RMW operation if it already includes one
(which is arch-dependent). atomic_read() is not an RMW operation and
never includes a barrier, so it needs an smp_mb() before it.
Ben.
Signature · 2 lines
Ben Hutchings Software Developer, Codethink Ltd.
Greg Kroah-Hartman
maintainerPATCH 36/53 Bluetooth: cmtp: fix possible might sleep error in cmtp_session
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeffy Chen <[email protected]>
commit f06d977309d09253c744e54e75c5295ecc52b7b4 upstream.
It looks like cmtp_session has same pattern as the issue reported in old rfcomm:
while (1) {
set_current_state(TASK_INTERRUPTIBLE);
if (condition)
break;
// may call might_sleep here
schedule();
}
__set_current_state(TASK_RUNNING);Which fixed at:
dfb2fae Bluetooth: Fix nested sleeps
So let's fix it at the same way, also follow the suggestion of:
https://lwn.net/Articles/628628/
--- net/bluetooth/cmtp/core.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
net/bluetooth/cmtp/core.c +10 -7
@@ -281,16 +281,16 @@ static int cmtp_session(void *arg)struct cmtp_session *session = arg;struct sock *sk = session->sock->sk;struct sk_buff *skb; -wait_queue_t wait; +DEFINE_WAIT_FUNC (wait, woken_wake_function);BT_DBG ("session %p" , session);set_user_nice (current,-15 ); -init_waitqueue_entry (&wait, current);add_wait_queue (sk_sleep (sk), &wait);while (1 ) { -set_current_state (TASK_INTERRUPTIBLE ); +/* Ensure session->terminate is updated */ +smp_mb__before_atomic ();if (atomic_read (&session->terminate))break ;
@@ -307,9 +307,8 @@ static int cmtp_session(void *arg)cmtp_process_transmit (session); -schedule (); +wait_woken (&wait,TASK_INTERRUPTIBLE ,MAX_SCHEDULE_TIMEOUT ); } -__set_current_state (TASK_RUNNING );remove_wait_queue (sk_sleep (sk), &wait);down_write (&cmtp_session_sem);
@@ -394,7 +393,7 @@ int cmtp_add_connection(struct cmtp_conn err =cmtp_attach_device (session);if (err <0 ) {atomic_inc (&session->terminate); -wake_up_process (session->task); +wake_up_interruptible (sk_sleep (session->sock->sk));up_write (&cmtp_session_sem);return err; }
@@ -432,7 +431,11 @@ int cmtp_del_connection(struct cmtp_conn/* Stop session thread */ atomic_inc (&session->terminate); -wake_up_process (session->task); + +/* Ensure session->terminate is updated */ +smp_mb__after_atomic (); + +wake_up_interruptible (sk_sleep (session->sock->sk)); }else err = -ENOENT ;
Greg Kroah-Hartman
maintainerPATCH 37/53 Bluetooth: bnep: fix possible might sleep error in bnep_session
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeffy Chen <[email protected]>
commit 25717382c1dd0ddced2059053e3ca5088665f7a5 upstream.
It looks like bnep_session has same pattern as the issue reported in old rfcomm:
while (1) {
set_current_state(TASK_INTERRUPTIBLE);
if (condition)
break;
// may call might_sleep here
schedule();
}
__set_current_state(TASK_RUNNING);Which fixed at:
dfb2fae Bluetooth: Fix nested sleeps
So let's fix it at the same way, also follow the suggestion of:
https://lwn.net/Articles/628628/
--- net/bluetooth/bnep/core.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
net/bluetooth/bnep/core.c +5 -6
@@ -484,16 +484,16 @@ static int bnep_session(void *arg)struct net_device *dev = s->dev;struct sock *sk = s->sock->sk;struct sk_buff *skb; -wait_queue_t wait; +DEFINE_WAIT_FUNC (wait, woken_wake_function);BT_DBG ("" );set_user_nice (current,-15 ); -init_waitqueue_entry (&wait, current);add_wait_queue (sk_sleep (sk), &wait);while (1 ) { -set_current_state (TASK_INTERRUPTIBLE ); +/* Ensure session->terminate is updated */ +smp_mb__before_atomic ();if (atomic_read (&s->terminate))break ;
@@ -515,9 +515,8 @@ static int bnep_session(void *arg)break ;netif_wake_queue (dev); -schedule (); +wait_woken (&wait,TASK_INTERRUPTIBLE ,MAX_SCHEDULE_TIMEOUT ); } -__set_current_state (TASK_RUNNING );remove_wait_queue (sk_sleep (sk), &wait);/* Cleanup session */
@@ -663,7 +662,7 @@ int bnep_del_connection(struct bnep_conn s =__bnep_get_session (req->dst);if (s) {atomic_inc (&s->terminate); -wake_up_process (s->task); +wake_up_interruptible (sk_sleep (s->sock->sk)); }else err = -ENOENT ;
Greg Kroah-Hartman
maintainerPATCH 38/53 binder: use group leader instead of open thread
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Todd Kjos <[email protected]>
commit c4ea41ba195d01c9af66fb28711a16cc97caa9c5 upstream.
The binder allocator assumes that the thread that called binder_open will never die for the lifetime of that proc. That thread is normally the group_leader, however it may not be. Use the group_leader instead of current.
--- drivers/android/binder.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/android/binder.c +2 -2
@@ -2966,8 +2966,8 @@ static int binder_open(struct inode *nod proc =kzalloc (sizeof (*proc),GFP_KERNEL );if (proc ==NULL )return -ENOMEM ; -get_task_struct (current); - proc->tsk = current; +get_task_struct (current->group_leader); + proc->tsk = current->group_leader;INIT_LIST_HEAD (&proc->todo);init_waitqueue_head (&proc->wait); proc->default_priority =task_nice (current);
Greg Kroah-Hartman
maintainerPATCH 39/53 binder: Use wake up hint for synchronous transactions.
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Riley Andrews <[email protected]>
commit 00b40d613352c623aaae88a44e5ded7c912909d7 upstream.
Use wake_up_interruptible_sync() to hint to the scheduler binder transactions are synchronous wakeups. Disable preemption while waking to avoid ping-ponging on the binder lock.
--- drivers/android/binder.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/android/binder.c +6 -2
@@ -1718,8 +1718,12 @@ static void binder_transaction(struct bilist_add_tail (&t->work.entry, target_list); tcomplete->type =BINDER_WORK_TRANSACTION_COMPLETE ;list_add_tail (&tcomplete->entry, &thread->todo); -if (target_wait) -wake_up_interruptible (target_wait); +if (target_wait) { +if (reply || !(t->flags &TF_ONE_WAY )) +wake_up_interruptible_sync (target_wait); +else +wake_up_interruptible (target_wait); + }return ; err_get_unused_fd_failed:
Greg Kroah-Hartman
maintainerPATCH 40/53 ANDROID: binder: fix proc->tsk check.
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martijn Coenen <[email protected]>
commit b2a6d1b999a4c13e5997bb864694e77172d45250 upstream.
Commit c4ea41ba195d ("binder: use group leader instead of open thread")' was incomplete and didn't update a check in binder_mmap(), causing all mmap() calls into the binder driver to fail.
--- drivers/android/binder.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/android/binder.c +1 -1
@@ -2869,7 +2869,7 @@ static int binder_mmap(struct file *filpconst char *failure_string;struct binder_buffer *buffer; -if (proc->tsk != current) +if (proc->tsk != current->group_leader)return -EINVAL ;if ((vma->vm_end - vma->vm_start) >SZ_4M )
Greg Kroah-Hartman
maintainerPATCH 41/53 iio: imu: adis16480: Fix acceleration scale factor for adis16480
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dragos Bogdan <[email protected]>
commit fdd0d32eb95f135041236a6885d9006315aa9a1d upstream.
According to the datasheet, the range of the acceleration is [-10 g, + 10 g], so the scale factor should be 10 instead of 5.
--- drivers/iio/imu/adis16480.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/imu/adis16480.c +1 -1
@@ -696,7 +696,7 @@ static const struct adis16480_chip_info .gyro_max_val = IIO_RAD_TO_DEGREE(22500), .gyro_max_scale = 450, .accel_max_val = IIO_M_S_2_TO_G(12500), - .accel_max_scale = 5, + .accel_max_scale = 10, }, [ADIS16485] = { .channels = adis16485_channels,
Greg Kroah-Hartman
maintainerPATCH 42/53 iio: hid-sensor-trigger: Fix the race with user space powering up sensors
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinivas Pandruvada <[email protected]>
commit f1664eaacec31035450132c46ed2915fd2b2049a upstream.
It has been reported for a while that with iio-sensor-proxy service the rotation only works after one suspend/resume cycle. This required a wait in the systemd unit file to avoid race. I found a Yoga 900 where I could reproduce this.
The problem scenerio is:
- During sensor driver init, enable run time PM and also set a auto-suspend for 3 seconds.
This result in one runtime resume. But there is a check to avoid
a powerup in this sequence, but rpm is active
- User space iio-sensor-proxy tries to power up the sensor. Since rpm is active it will simply return. But sensors were not actually
powered up in the prior sequence, so actaully the sensors will not work
- After 3 seconds the auto suspend kicks
If we add a wait in systemd service file to fire iio-sensor-proxy after 3 seconds, then now everything will work as the runtime resume will actually powerup the sensor as this is a user request.
To avoid this:
- Remove the check to match user requested state, this will cause a brief powerup, but if the iio-sensor-proxy starts immediately it will
still work as the sensors are ON.
- Also move the autosuspend delay to place when user requested turn off of sensors, like after user finished raw read or buffer disable
--- drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/iio/common/hid-sensors/hid-sensor-trigger.c +4 -4
@@ -36,8 +36,6 @@ static int _hid_sensor_power_state(strucs32 poll_value =0 ;if (state) { -if (!atomic_read (&st->user_requested_state)) -return 0 ;if (sensor_hub_device_open (st->hsdev))return -EIO ;
@@ -84,6 +82,9 @@ static int _hid_sensor_power_state(struc &report_val); } +pr_debug ("HID_SENSOR %s set power_state %d report_state %d\n" , + st->pdev->name, state_val, report_val); +sensor_hub_get_feature (st->hsdev, st->power_state.report_id, st->power_state.index,sizeof (state_val), &state_val);
@@ -107,6 +108,7 @@ int hid_sensor_power_state(struct hid_se ret =pm_runtime_get_sync (&st->pdev->dev); else {pm_runtime_mark_last_busy (&st->pdev->dev); +pm_runtime_use_autosuspend (&st->pdev->dev); ret =pm_runtime_put_autosuspend (&st->pdev->dev); }if (ret <0 ) {
@@ -175,8 +177,6 @@ int hid_sensor_setup_trigger(struct iio_/* Default to 3 seconds, but can be changed from sysfs */ pm_runtime_set_autosuspend_delay (&attrb->pdev->dev,3000 ); -pm_runtime_use_autosuspend (&attrb->pdev->dev); -return ret; error_unreg_trigger:iio_trigger_unregister (trig);
Greg Kroah-Hartman
maintainerPATCH 43/53 staging: rtl8188eu: add RNX-N150NUB support
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Charles Milette <[email protected]>
commit f299aec6ebd747298e35934cff7709c6b119ca52 upstream.
Add support for USB Device Rosewill RNX-N150NUB.
VendorID: 0x0bda, ProductID: 0xffef
--- drivers/staging/rtl8188eu/os_dep/usb_intf.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/rtl8188eu/os_dep/usb_intf.c +1 -0
@@ -49,6 +49,7 @@ static struct usb_device_id rtw_usb_id_t {USB_DEVICE(0x2001, 0x3311)}, /* DLink GO-USB-N150 REV B1 */ {USB_DEVICE(0x2357, 0x010c)}, /* TP-Link TL-WN722N v2 */ {USB_DEVICE(0x0df6, 0x0076)}, /* Sitecom N150 v2 */ + {USB_DEVICE(USB_VENDER_ID_REALTEK, 0xffef)}, /* Rosewill RNX-N150NUB */ {} /* Terminating entry */ };
Greg Kroah-Hartman
maintainerPATCH 44/53 ASoC: simple-card: dont fail if sysclk setting is not supported
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaro Koskinen <[email protected]>
commit ee43a1a0cd2a8f33cddfa1323a60b5cfcf865ba0 upstream.
Commit e22579713ae1 ("ASoC: simple card: set cpu-dai sysclk with mclk-fs") added sysclk / SND_SOC_CLOCK_OUT setting, that makes asoc_simple_card_hw_params fail if the operation is not supported, although the intention clearly was to ignore ENOTSUPP. Fix it.
The patch fixes audio playback on Kirkwood / OpenRD client, where the following errors are seen:
asoc-simple-card sound: ASoC: machine hw_params failed: -524 alsa-lib: /alsa-lib-1.0.28/src/pcm/pcm_hw.c:327:(snd_pcm_hw_hw_params) SNDRV_PCM_IOCTL_HW_PARAMS failed (-524): Unknown error 524
--- sound/soc/generic/simple-card.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/generic/simple-card.c +1 -1
@@ -100,7 +100,7 @@ static int asoc_simple_card_hw_params(stif (ret && ret != -ENOTSUPP ) goto err; } - +return 0 ; err:return ret; }
Greg Kroah-Hartman
maintainerPATCH 45/53 ASoC: rsnd: disable SRC.out only when stop timing
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuninori Morimoto <[email protected]>
commit b761bf272bce6dff4d8a7ccf4385c9f3d4018094 upstream.
Because SRC is connected to DMA and DMA want to keep dreq when stop timing. This patch makes SRC stop SRC.out only when stop timing. And it stops both SRC.out/SRC.in when quit timing
--- sound/soc/sh/rcar/src.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-)
sound/soc/sh/rcar/src.c +16 -2
@@ -691,13 +691,27 @@ static int _rsnd_src_stop_gen2(struct rs {rsnd_src_irq_disable_gen2 (mod); -rsnd_mod_write (mod,SRC_CTRL ,0 ); +/* +* stop SRC output only +* see rsnd_src_quit_gen2 +*/ +rsnd_mod_write (mod,SRC_CTRL ,0x01 );rsnd_src_error_record_gen2 (mod);return rsnd_src_stop (mod); } +static int rsnd_src_quit_gen2 (struct rsnd_mod *mod, +struct rsnd_dai_stream *io, +struct rsnd_priv *priv) +{ +/* stop both out/in */ +rsnd_mod_write (mod,SRC_CTRL ,0 ); + +return 0 ; +} +static void __rsnd_src_interrupt_gen2 (struct rsnd_mod *mod,struct rsnd_dai_stream *io) {
@@ -971,7 +985,7 @@ static struct rsnd_mod_ops rsnd_src_gen2 .probe = rsnd_src_probe_gen2, .remove = rsnd_src_remove_gen2, .init = rsnd_src_init_gen2, - .quit = rsnd_src_quit, + .quit = rsnd_src_quit_gen2, .start = rsnd_src_start_gen2, .stop = rsnd_src_stop_gen2, .hw_params = rsnd_src_hw_params,
Greg Kroah-Hartman
maintainerPATCH 46/53 ASoC: rsnd: avoid pointless loop in rsnd_mod_interrupt()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuninori Morimoto <[email protected]>
commit 2daf71ad8da6cb57f919c9c876ee7e42530371df upstream.
Current Renesas sound driver doesn't have 1:1 relationship between stream <-> mod because it is supporting MIX. Because of this reason rsnd_mod_interrupt() is searching correspond mod by for loop. But this loop is not needed, because each mod has own type. This patch avoid pointless loop by using mod->type.
This patch is good for SSI-parent support, because stream might have 2 SSI as SSI-parent/child. SSI interrupt handler will be called twice if stream has SSI-parent without this patch.
--- sound/soc/sh/rcar/core.c | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-)
sound/soc/sh/rcar/core.c +8 -11
@@ -192,19 +192,16 @@ void rsnd_mod_interrupt(struct rsnd_modstruct rsnd_priv *priv =rsnd_mod_to_priv (mod);struct rsnd_dai_stream *io;struct rsnd_dai *rdai; -int i, j; +int i; -for_each_rsnd_dai (rdai, priv, j) { +for_each_rsnd_dai (rdai, priv, i) { + io = &rdai->playback; +if (mod == io->mod[mod->type]) +callback (mod, io); -for (i =0 ; i <RSND_MOD_MAX ; i++) { - io = &rdai->playback; -if (mod == io->mod[i]) -callback (mod, io); - - io = &rdai->capture; -if (mod == io->mod[i]) -callback (mod, io); - } + io = &rdai->capture; +if (mod == io->mod[mod->type]) +callback (mod, io); } }
Greg Kroah-Hartman
maintainerPATCH 47/53 ASoC: rsnd: Add missing initialization of ADG req_rate
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 8b27418f300cafbdbbb8cfa9c29d398ed34d6723 upstream.
If the "clock-frequency" DT property is not found, req_rate is used uninitialized, and the "audio_clkout" clock will be created with an arbitrary clock rate.
This uninitialized kernel stack data may leak to userspace through /sys/kernel/debug/clk/clk_summary, cfr. the value in the "rate" column:
clock enable_cnt prepare_cnt rate accuracy phase
--------------------------------------------------------------------
audio_clkout 0 0 4001836240 0 0
--- sound/soc/sh/rcar/adg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sh/rcar/adg.c +1 -1
@@ -437,7 +437,7 @@ static void rsnd_adg_get_clkout(struct rstruct device *dev =rsnd_priv_to_dev (priv);struct device_node *np = dev->of_node;u32 ckr, rbgx, rbga, rbgb; -u32 rate, req_rate, div; +u32 rate, req_rate =0 , div;uint32_t count =0 ;unsigned long req_48kHz_rate, req_441kHz_rate;int i;
Greg Kroah-Hartman
maintainerPATCH 48/53 ASoC: rsnd: ssi: 24bit data needs right-aligned settings
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuninori Morimoto <[email protected]>
commit f46a93b820eb3707faf238cd769a004e2504515f upstream.
Data left/right aligned is controlled by PDTA bit on SSICR. But default is left-aligned. Thus 24bit sound will be very small sound without this patch.
--- sound/soc/sh/rcar/ssi.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/sh/rcar/ssi.c +2 -1
@@ -39,6 +39,7 @@#define SCKP (1 << 13)/* Serial Bit Clock Polarity */ #define SWSP (1 << 12)/* Serial WS Polarity */ #define SDTA (1 << 10)/* Serial Data Alignment */ +#define PDTA (1 << 9)/* Parallel Data Alignment */ #define DEL (1 << 8)/* Serial Data Delay */ #define CKDV (v) (v << 4)/* Serial Clock Division Ratio */ #define TRMD (1 << 1)/* Transmit/Receive Mode Select */
@@ -286,7 +287,7 @@ static int rsnd_ssi_init(struct rsnd_modstruct snd_pcm_runtime *runtime =rsnd_io_to_runtime (io);u32 cr; - cr =FORCE ; + cr =FORCE |PDTA ;/* * always use 32bit system word for easy clock calculation.
Greg Kroah-Hartman
maintainerPATCH 49/53 ASoC: rsnd: dont call update callback if it was NULL
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kuninori Morimoto <[email protected]>
commit d7289565483c65094d0473555625a4acd89567d3 upstream.
--- sound/soc/sh/rcar/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/sh/rcar/core.c +1 -1
@@ -1016,7 +1016,7 @@ static int rsnd_kctrl_put(struct snd_kco } } -if (change) +if (change && cfg->update) cfg->update (cfg->io, mod);return change;
Greg Kroah-Hartman
maintainerPATCH 50/53 ntb_transport: fix qp count bug
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Logan Gunthorpe <[email protected]>
commit cb827ee6ccc3e480f0d9c0e8e53eef55be5b0414 upstream.
In cases where there are more mw's than spads/2-2, the mw count gets reduced to match the limitation. ntb_transport also tries to ensure that there are fewer qps than mws but uses the full mw count instead of the reduced one. When this happens, the math in 'ntb_transport_setup_qp_mw' will get confused and result in a kernel paging request bug.
This patch fixes the bug by reducing qp_count to the reduced mw count instead of the full mw count.
--- drivers/ntb/ntb_transport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ntb/ntb_transport.c +2 -2
@@ -1065,8 +1065,8 @@ static int ntb_transport_probe(struct nt qp_count =ilog2 (qp_bitmap);if (max_num_clients && max_num_clients < qp_count) qp_count = max_num_clients; -else if (mw_count < qp_count) - qp_count = mw_count; +else if (nt->mw_count < qp_count) + qp_count = nt->mw_count; qp_bitmap &=BIT_ULL (qp_count) -1 ;
Re: [PATCH 4.4 50/53] ntb_transport: fix qp count bug
Quoted 10 lines · Greg Kroah-Hartman
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Logan Gunthorpe <[email protected]>
commit
cb827ee6ccc3e480f0d9c0e8e53eef55be5b0414upstream.In cases where there are more mw's than spads/2-2, the mw count gets reduced to match the limitation.
[...]
In 4.4-stable, it doesn't, so this patch doesn't fix anything. It looks like 4.4 would need a backport of:
commit b17faba03fc72091f4d040b879def004316952ec
Author: Shyam Sundar S K <[email protected]> Date: Wed Dec 7 22:37:05 2016 +0530
ntb_transport: Limit memory windows based on available, scratchpads
Ben.
Signature · 2 lines
Ben Hutchings Software Developer, Codethink Ltd.
Re: [PATCH 4.4 50/53] ntb_transport: fix qp count bug
Quoted 2 lines · Ben Hutchings
In 4.4-stable, it doesn't, so this patch doesn't fix anything. It looks like 4.4 would need a backport of:
Yup, look like the Fixes tag should have been b17faba0 instead of cb827ee. In which case it doesn't apply to 4.4.
Thanks,
Logan
Greg Kroah-Hartman
maintainerRe: [PATCH 4.4 50/53] ntb_transport: fix qp count bug
Quoted 8 lines · Logan Gunthorpe
Quoted 2 lines · Ben Hutchings
In 4.4-stable, it doesn't, so this patch doesn't fix anything. It looks like 4.4 would need a backport of:
Yup, look like the Fixes tag should have been
b17faba0instead of cb827ee. In which case it doesn't apply to 4.4.
Ah, should this be reverted then from 4.4?
thanks,
greg k-h
Re: [PATCH 4.4 50/53] ntb_transport: fix qp count bug
Quoted 11 lines · Greg Kroah-Hartman
Quoted 8 lines · Logan Gunthorpe
Quoted 2 lines · Ben Hutchings
In 4.4-stable, it doesn't, so this patch doesn't fix anything. It looks like 4.4 would need a backport of:
Yup, look like the Fixes tag should have been
b17faba0instead of cb827ee. In which case it doesn't apply to 4.4.Ah, should this be reverted then from 4.4?
It probably doesn't matter. The patch changes mw_count to nt->mw_count, but in 4.4 these values are exactly the same. So the patch shouldn't hurt anything but it also didn't fix anything.
Logan
Greg Kroah-Hartman
maintainerRe: [PATCH 4.4 50/53] ntb_transport: fix qp count bug
Quoted 10 lines · Logan Gunthorpe
Quoted 7 lines · Greg Kroah-Hartman
Quoted 6 lines · Logan Gunthorpe
Quoted 2 lines · Ben Hutchings
In 4.4-stable, it doesn't, so this patch doesn't fix anything. It looks like 4.4 would need a backport of:
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
Yup, look like the Fixes tag should have been
b17faba0instead of cb827ee. In which case it doesn't apply to 4.4.Ah, should this be reverted then from 4.4?
It probably doesn't matter. The patch changes
mw_counttont->mw_count, but in 4.4 these values are exactly the same. So the patch shouldn't hurt anything but it also didn't fix anything.
Ok, I'll leave it as-is, thanks for letting me know.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 51/53 ntb_transport: fix bug calculating num_qps_mw
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Logan Gunthorpe <[email protected]>
commit 8e8496e0e9564b66165f5219a4e8ed20b0d3fc6b upstream.
A divide by zero error occurs if qp_count is less than mw_count because num_qps_mw is calculated to be zero. The calculation appears to be incorrect.
The requirement is for num_qps_mw to be set to qp_count / mw_count with any remainder divided among the earlier mws.
For example, if mw_count is 5 and qp_count is 12 then mws 0 and 1 will have 3 qps per window and mws 2 through 4 will have 2 qps per window. Thus, when mw_num < qp_count % mw_count, num_qps_mw is 1 higher than when mw_num >= qp_count.
--- drivers/ntb/ntb_transport.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ntb/ntb_transport.c +2 -2
@@ -599,7 +599,7 @@ static int ntb_transport_setup_qp_mw(strif (!mw->virt_addr)return -ENOMEM ; -if (qp_count % mw_count && mw_num +1 < qp_count / mw_count) +if (mw_num < qp_count % mw_count) num_qps_mw = qp_count / mw_count +1 ;else num_qps_mw = qp_count / mw_count;
@@ -947,7 +947,7 @@ static int ntb_transport_init_queue(stru qp->event_handler =NULL ;ntb_qp_link_down_reset (qp); -if (qp_count % mw_count && mw_num +1 < qp_count / mw_count) +if (mw_num < qp_count % mw_count) num_qps_mw = qp_count / mw_count +1 ;else num_qps_mw = qp_count / mw_count;
Greg Kroah-Hartman
maintainerPATCH 52/53 ACPI: ioapic: Clear on-stack resource before using it
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joerg Roedel <[email protected]>
commit e3d5092b6756b9e0b08f94bbeafcc7afe19f0996 upstream.
The on-stack resource-window 'win' in setup_res() is not properly initialized. This causes the pointers in the embedded 'struct resource' to contain stale addresses.
These pointers (in my case the ->child pointer) later get propagated to the global iomem_resources list, causing a #GP exception when the list is traversed in iomem_map_sanity_check().
--- drivers/acpi/ioapic.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/acpi/ioapic.c +6 -0
@@ -45,6 +45,12 @@ static acpi_status setup_res(struct acpistruct resource *res = data;struct resource_win win; +/* +* We might assign this to 'res' later, make sure all pointers are +* cleared before the resource is added to the global list +*/ +memset (&win,0 ,sizeof (win)); + res->flags =0 ;if (acpi_dev_filter_resource_type (acpi_res,IORESOURCE_MEM ) ==0 )return AE_OK ;
Greg Kroah-Hartman
maintainerPATCH 53/53 ACPI / APEI: Add missing synchronize_rcu() on NOTIFY_SCI removal
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Morse <[email protected]>
commit 7d64f82cceb21e6d95db312d284f5f195e120154 upstream.
When removing a GHES device notified by SCI, list_del_rcu() is used, ghes_remove() should call synchronize_rcu() before it goes on to call kfree(ghes), otherwise concurrent RCU readers may still hold this list entry after it has been freed.
--- drivers/acpi/apei/ghes.c | 1 + 1 file changed, 1 insertion(+)
drivers/acpi/apei/ghes.c +1 -0
@@ -1067,6 +1067,7 @@ static int ghes_remove(struct platform_dif (list_empty (&ghes_sci))unregister_acpi_hed_notifier (&ghes_notifier_sci);mutex_unlock (&ghes_list_mutex); +synchronize_rcu ();break ;case ACPI_HEST_NOTIFY_NMI :ghes_nmi_remove (ghes);
Quoted 9 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.85 release. There are 53 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 Wed Aug 30 08:05:03 UTC 2017. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
Quoted 9 lines
kernel.org/pub/linux/kernel/v4.x/stable-review/patch-4.4.85-rc1.gzor in the git tree and branch at:
git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.gitlinux-4.4.y
and the diffstat can be found below.thanks,
greg k-h
Compiled and booted on my test system. No dmesg regressions.
thanks,
-- Shuah
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 4.4.85 release. There are 53 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 Wed Aug 30 08:05:03 UTC 2017. Anything received after that time might be too late.
Build results:
total: 145 pass: 145 fail: 0 Qemu test results: total: 115 pass: 115 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter