4.4.4-stable review
Subsystems (5)
Greg Kroah-Hartman
maintainerPATCH 1/342 af_iucv: Validate socket address length in iucv_sock_bind()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ursula Braun <[email protected]>
[ Upstream commit 52a82e23b9f2a9e1d429c5207f8575784290d008 ]
--- net/iucv/af_iucv.c | 3 +++ 1 file changed, 3 insertions(+)
net/iucv/af_iucv.c +3 -0
@@ -708,6 +708,9 @@ static int iucv_sock_bind(struct socketif (!addr || addr->sa_family !=AF_IUCV )return -EINVAL ; +if (addr_len <sizeof (struct sockaddr_iucv )) +return -EINVAL ; +lock_sock (sk);if (sk->sk_state !=IUCV_OPEN ) { err = -EBADFD ;
Greg Kroah-Hartman
maintainerPATCH 10/342 net: dsa: fix mv88e6xxx switches
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
[ Upstream commit db0e51afa481088e6396f11e02018d64113a6578 ]
Since commit 76e398a62712 ("net: dsa: use switchdev obj for VLAN add/del ops"), the Marvell 88E6xxx switch has been unable to pass traffic between ports - any received traffic is discarded by the switch. Taking a port out of bridge mode and configuring a vlan on it also the port to start passing traffic.
With the debugfs files re-instated to allow debug of this issue by comparing the register settings between the working and non-working case, the reason becomes clear:
GLOBAL GLOBAL2 SERDES 0 1 2 3 4 5 6
- 7: 1111 707f 2001 2 2 2 2 2 0 2 + 7: 1111 707f 2001 1 1 1 1 1 0 1
Register 7 for the ports is the default vlan tag register, and in the non-working setup, it has been set to 2, despite vlan 2 not being configured. This causes the switch to drop all packets coming in to these ports. The working setup has the default vlan tag register set to 1, which is the default vlan when none is configured.
Inspection of the code reveals why. The code prior to this commit was:
- for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) {
...
- if (!err && vlan->flags & BRIDGE_VLAN_INFO_PVID)
- err = ds->drv->port_pvid_set(ds, p->port, vid);
but the new code is:
+ for (vid = vlan->vid_begin; vid <= vlan->vid_end; ++vid) {
...
+ }
...
+ if (pvid)
+ err = _mv88e6xxx_port_pvid_set(ds, port, vid);
This causes the new code to always set the default vlan to one higher than the old code.
Fix this.
--- drivers/net/dsa/mv88e6xxx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/dsa/mv88e6xxx.c +1 -1
@@ -1519,7 +1519,7 @@ int mv88e6xxx_port_vlan_add(struct dsa_s/* no PVID with ranges, otherwise it's a bug */ if (pvid) - err =_mv88e6xxx_port_pvid_set (ds, port, vid); + err =_mv88e6xxx_port_pvid_set (ds, port, vlan->vid_end); unlock:mutex_unlock (&ps->smi_mutex);
Greg Kroah-Hartman
maintainerPATCH 14/342 tcp: beware of alignments in tcp_get_info()
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 ff5d749772018602c47509bdc0093ff72acd82ec ]
With some combinations of user provided flags in netlink command, it is possible to call tcp_get_info() with a buffer that is not 8-bytes aligned.
It does matter on some arches, so we need to use put_unaligned() to store the u64 fields.
Current iproute2 package does not trigger this particular issue.
--- net/ipv4/tcp.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
net/ipv4/tcp.c +8 -4
@@ -279,6 +279,7 @@#include <asm/uaccess.h> #include <asm/ioctls.h> +#include <asm/unaligned.h> #include <net/busy_poll.h> int sysctl_tcp_fin_timeout__read_mostly =TCP_FIN_TIMEOUT ;
@@ -2637,6 +2638,7 @@ void tcp_get_info(struct sock *sk, strucconst struct inet_connection_sock *icsk =inet_csk (sk);u32 now = tcp_time_stamp;unsigned int start; +u64 rate64;u32 rate;memset (info,0 ,sizeof (*info));
@@ -2702,15 +2704,17 @@ void tcp_get_info(struct sock *sk, struc info->tcpi_total_retrans = tp->total_retrans; rate =READ_ONCE (sk->sk_pacing_rate); - info->tcpi_pacing_rate = rate != ~0U ? rate : ~0ULL ; + rate64 = rate != ~0U ? rate : ~0ULL ; +put_unaligned (rate64, &info->tcpi_pacing_rate); rate =READ_ONCE (sk->sk_max_pacing_rate); - info->tcpi_max_pacing_rate = rate != ~0U ? rate : ~0ULL ; + rate64 = rate != ~0U ? rate : ~0ULL ; +put_unaligned (rate64, &info->tcpi_max_pacing_rate);do { start =u64_stats_fetch_begin_irq (&tp->syncp); - info->tcpi_bytes_acked = tp->bytes_acked; - info->tcpi_bytes_received = tp->bytes_received; +put_unaligned (tp->bytes_acked, &info->tcpi_bytes_acked); +put_unaligned (tp->bytes_received, &info->tcpi_bytes_received); }while (u64_stats_fetch_retry_irq (&tp->syncp, start)); info->tcpi_segs_out = tp->segs_out; info->tcpi_segs_in = tp->segs_in;
Greg Kroah-Hartman
maintainerPATCH 16/342 ipv6/udp: use sticky pktinfo egress ifindex on connect()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 1cdda91871470f15e79375991bd2eddc6e86ddb1 ]
Currently, the egress interface index specified via IPV6_PKTINFO is ignored by __ip6_datagram_connect(), so that RFC 3542 section 6.7 can be subverted when the user space application calls connect() before sendmsg().
Fix it by initializing properly flowi6_oif in connect() before performing the route lookup.
--- net/ipv6/datagram.c | 3 +++ 1 file changed, 3 insertions(+)
net/ipv6/datagram.c +3 -0
@@ -162,6 +162,9 @@ ipv4_connected: fl6.fl6_dport = inet->inet_dport; fl6.fl6_sport = inet->inet_sport; +if (!fl6.flowi6_oif) + fl6.flowi6_oif = np->sticky_pktinfo.ipi6_ifindex; +if (!fl6.flowi6_oif && (addr_type&IPV6_ADDR_MULTICAST )) fl6.flowi6_oif = np->mcast_oif;
Greg Kroah-Hartman
maintainerPATCH 19/342 unix: correctly track in-flight fds in sending process user_struct
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Frederic Sowa <[email protected]>
[ Upstream commit 415e3d3e90ce9e18727e8843ae343eda5a58fad6 ]
The commit referenced in the Fixes tag incorrectly accounted the number of in-flight fds over a unix domain socket to the original opener of the file-descriptor. This allows another process to arbitrary deplete the original file-openers resource limit for the maximum of open files. Instead the sending processes and its struct cred should be credited.
To do so, we add a reference counted struct user_struct pointer to the scm_fp_list and use it to account for the number of inflight unix fds.
--- include/net/af_unix.h | 4 ++-- include/net/scm.h | 1 + net/core/scm.c | 7 +++++++ net/unix/af_unix.c | 4 ++-- net/unix/garbage.c | 8 ++++---- 5 files changed, 16 insertions(+), 8 deletions(-)
include/net/af_unix.h +2 -2
@@ -6,8 +6,8 @@#include <linux/mutex.h> #include <net/sock.h> -void unix_inflight (struct file *fp); -void unix_notinflight (struct file *fp); +void unix_inflight (struct user_struct *user,struct file *fp); +void unix_notinflight (struct user_struct *user,struct file *fp);void unix_gc (void );void wait_for_unix_gc (void );struct sock *unix_get_socket (struct file *filp);
include/net/scm.h +1 -0
@@ -21,6 +21,7 @@ struct scm_creds {struct scm_fp_list {short count;short max; +struct user_struct *user;struct file *fp[SCM_MAX_FD ]; };
net/core/scm.c +7 -0
@@ -87,6 +87,7 @@ static int scm_fp_copy(struct cmsghdr *c *fplp = fpl; fpl->count =0 ; fpl->max =SCM_MAX_FD ; + fpl->user =NULL ; } fpp = &fpl->fp[fpl->count];
@@ -107,6 +108,10 @@ static int scm_fp_copy(struct cmsghdr *c *fpp++ = file; fpl->count++; } + +if (!fpl->user) + fpl->user =get_uid (current_user ()); +return num; }
@@ -119,6 +124,7 @@ void __scm_destroy(struct scm_cookie *sc scm->fp =NULL ;for (i=fpl->count-1 ; i>=0 ; i--)fput (fpl->fp[i]); +free_uid (fpl->user);kfree (fpl); } }
@@ -336,6 +342,7 @@ struct scm_fp_list *scm_fp_dup(struct scfor (i =0 ; i < fpl->count; i++)get_file (fpl->fp[i]); new_fpl->max = new_fpl->count; + new_fpl->user =get_uid (fpl->user); }return new_fpl; }
net/unix/af_unix.c +2 -2
@@ -1496,7 +1496,7 @@ static void unix_detach_fds(struct scm_cUNIXCB (skb).fp =NULL ;for (i = scm->fp->count-1 ; i >=0 ; i--) -unix_notinflight (scm->fp->fp[i]); +unix_notinflight (scm->fp->user, scm->fp->fp[i]); }static void unix_destruct_scm (struct sk_buff *skb)
@@ -1561,7 +1561,7 @@ static int unix_attach_fds(struct scm_coreturn -ENOMEM ;for (i = scm->fp->count -1 ; i >=0 ; i--) -unix_inflight (scm->fp->fp[i]); +unix_inflight (scm->fp->user, scm->fp->fp[i]);return max_level; }
net/unix/garbage.c +4 -4
@@ -116,7 +116,7 @@ struct sock *unix_get_socket(struct file* descriptor if it is for an AF_UNIX socket. */ -void unix_inflight (struct file *fp) +void unix_inflight (struct user_struct *user,struct file *fp) {struct sock *s =unix_get_socket (fp);
@@ -133,11 +133,11 @@ void unix_inflight(struct file *fp) } unix_tot_inflight++; } - fp->f_cred->user->unix_inflight++; + user->unix_inflight++;spin_unlock (&unix_gc_lock); } -void unix_notinflight (struct file *fp) +void unix_notinflight (struct user_struct *user,struct file *fp) {struct sock *s =unix_get_socket (fp);
@@ -152,7 +152,7 @@ void unix_notinflight(struct file *fp)list_del_init (&u->link); unix_tot_inflight--; } - fp->f_cred->user->unix_inflight--; + user->unix_inflight--;spin_unlock (&unix_gc_lock); }
Greg Kroah-Hartman
maintainerPATCH 20/342 tcp: do not drop syn_recv on all icmp reports
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 9cf7490360bf2c46a16b7525f899e4970c5fc144 ]
Petr Novopashenniy reported that ICMP redirects on SYN_RECV sockets were leading to RST.
This is of course incorrect.
A specific list of ICMP messages should be able to drop a SYN_RECV.
For instance, a REDIRECT on SYN_RECV shall be ignored, as we do not hold a dst per SYN_RECV pseudo request.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=111751
--- include/net/tcp.h | 2 +- net/ipv4/tcp_ipv4.c | 11 ++++++++--- net/ipv6/tcp_ipv6.c | 5 +++-- 3 files changed, 12 insertions(+), 6 deletions(-)
include/net/tcp.h +1 -1
@@ -449,7 +449,7 @@ const u8 *tcp_parse_md5sig_option(constvoid tcp_v4_send_check (struct sock *sk,struct sk_buff *skb);void tcp_v4_mtu_reduced (struct sock *sk); -void tcp_req_err (struct sock *sk,u32 seq); +void tcp_req_err (struct sock *sk,u32 seq,bool abort);int tcp_v4_conn_request (struct sock *sk,struct sk_buff *skb); struct sock *tcp_create_openreq_child(const struct sock *sk, struct request_sock *req,
net/ipv4/tcp_ipv4.c +8 -3
@@ -312,7 +312,7 @@ static void do_redirect(struct sk_buff */* handle ICMP messages on TCP_NEW_SYN_RECV request sockets */ -void tcp_req_err (struct sock *sk,u32 seq) +void tcp_req_err (struct sock *sk,u32 seq,bool abort) {struct request_sock *req =inet_reqsk (sk);struct net *net =sock_net (sk);
@@ -324,7 +324,7 @@ void tcp_req_err(struct sock *sk, u32 seif (seq !=tcp_rsk (req)->snt_isn) {NET_INC_STATS_BH (net,LINUX_MIB_OUTOFWINDOWICMPS ); - }else { + }else if (abort) {/* * Still in SYN_RECV, just remove it silently. * There is no good way to pass the error to the newly
@@ -384,7 +384,12 @@ void tcp_v4_err(struct sk_buff *icmp_skb } seq =ntohl (th->seq);if (sk->sk_state ==TCP_NEW_SYN_RECV ) -return tcp_req_err (sk, seq); +return tcp_req_err (sk, seq, + type ==ICMP_PARAMETERPROB || + type ==ICMP_TIME_EXCEEDED || + (type ==ICMP_DEST_UNREACH && + (code ==ICMP_NET_UNREACH || + code ==ICMP_HOST_UNREACH )));bh_lock_sock (sk);/* If too many ICMPs get dropped on busy
net/ipv6/tcp_ipv6.c +3 -2
@@ -328,6 +328,7 @@ static void tcp_v6_err(struct sk_buff *sstruct tcp_sock *tp;__u32 seq, snd_una;struct sock *sk; +bool fatal;int err; sk = __inet6_lookup_established(net, &tcp_hashinfo,
@@ -346,8 +347,9 @@ static void tcp_v6_err(struct sk_buff *sreturn ; } seq =ntohl (th->seq); + fatal =icmpv6_err_convert (type, code, &err);if (sk->sk_state ==TCP_NEW_SYN_RECV ) -return tcp_req_err (sk, seq); +return tcp_req_err (sk, seq, fatal);bh_lock_sock (sk);if (sock_owned_by_user (sk) && type !=ICMPV6_PKT_TOOBIG )
@@ -401,7 +403,6 @@ static void tcp_v6_err(struct sk_buff *s goto out; } -icmpv6_err_convert (type, code, &err);/* Might be for an request_sock */ switch (sk->sk_state) {
Greg Kroah-Hartman
maintainerPATCH 21/342 net:Add sysctl_max_skb_frags
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Westgaard Ry <[email protected]>
[ Upstream commit 5f74f82ea34c0da80ea0b49192bb5ea06e063593 ]
Devices may have limits on the number of fragments in an skb they support. Current codebase uses a constant as maximum for number of fragments one skb can hold and use.
When enabling scatter/gather and running traffic with many small messages the codebase uses the maximum number of fragments and may thereby violate the max for certain devices.
The patch introduces a global variable as max number of fragments.
--- include/linux/skbuff.h | 1 + net/core/skbuff.c | 2 ++ net/core/sysctl_net_core.c | 10 ++++++++++ net/ipv4/tcp.c | 4 ++-- 4 files changed, 15 insertions(+), 2 deletions(-)
include/linux/skbuff.h +1 -0
@@ -219,6 +219,7 @@ struct sk_buff;#else #define MAX_SKB_FRAGS (65536/PAGE_SIZE + 1)#endif +extern int sysctl_max_skb_frags;typedef struct skb_frag_struct skb_frag_t ;
net/core/skbuff.c +2 -0
@@ -79,6 +79,8 @@struct kmem_cache *skbuff_head_cache__read_mostly ;static struct kmem_cache *skbuff_fclone_cache__read_mostly ; +int sysctl_max_skb_frags__read_mostly =MAX_SKB_FRAGS ; +EXPORT_SYMBOL (sysctl_max_skb_frags);/** * skb_panic - private function for out-of-line support
net/core/sysctl_net_core.c +10 -0
@@ -26,6 +26,7 @@ static int zero = 0;static int one =1 ;static int min_sndbuf =SOCK_MIN_SNDBUF ;static int min_rcvbuf =SOCK_MIN_RCVBUF ; +static int max_skb_frags =MAX_SKB_FRAGS ;static int net_msg_warn;/* Unused, but still a sysctl */
@@ -392,6 +393,15 @@ static struct ctl_table net_core_table[] .mode = 0644, .proc_handler = proc_dointvec }, + { + .procname = "max_skb_frags", + .data = &sysctl_max_skb_frags, + .maxlen = sizeof(int), + .mode = 0644, + .proc_handler = proc_dointvec_minmax, + .extra1 = &one, + .extra2 = &max_skb_frags, + }, { } };
net/ipv4/tcp.c +2 -2
@@ -939,7 +939,7 @@ new_segment: i =skb_shinfo (skb)->nr_frags; can_coalesce =skb_can_coalesce (skb, i, page, offset); -if (!can_coalesce && i >=MAX_SKB_FRAGS ) { +if (!can_coalesce && i >= sysctl_max_skb_frags) {tcp_mark_push (tp, skb); goto new_segment; }
@@ -1212,7 +1212,7 @@ new_segment:if (!skb_can_coalesce (skb, i, pfrag->page, pfrag->offset)) { -if (i ==MAX_SKB_FRAGS || !sg) { +if (i == sysctl_max_skb_frags || !sg) {tcp_mark_push (tp, skb); goto new_segment; }
Greg Kroah-Hartman
maintainerPATCH 23/342 enic: increment devcmd2 result ring in case of timeout
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sandeep Pillai <[email protected]>
[ Upstream commit ca7f41a4957b872577807169bd7464b36aae9b9c ]
Firmware posts the devcmd result in result ring. In case of timeout, driver does not increment the current result pointer and firmware could post the result after timeout has occurred. During next devcmd, driver would be reading the result of previous devcmd.
Fix this by incrementing result even in case of timeout.
--- drivers/net/ethernet/cisco/enic/enic.h | 2 +- drivers/net/ethernet/cisco/enic/vnic_dev.c | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-)
drivers/net/ethernet/cisco/enic/enic.h +1 -1
@@ -33,7 +33,7 @@#define DRV_NAME "enic"#define DRV_DESCRIPTION "Cisco VIC Ethernet NIC Driver" -#define DRV_VERSION "2.3.0.12" +#define DRV_VERSION "2.3.0.20"#define DRV_COPYRIGHT "Copyright 2008-2013 Cisco Systems, Inc"#define ENIC_BARS_MAX 6
drivers/net/ethernet/cisco/enic/vnic_dev.c +12 -7
@@ -298,7 +298,8 @@ static int _vnic_dev_cmd2(struct vnic_de int wait) {struct devcmd2_controller *dc2c = vdev->devcmd2; -struct devcmd2_result *result = dc2c->result + dc2c->next_result; +struct devcmd2_result *result; +u8 color;unsigned int i;int delay, err;u32 fetch_index, new_posted;
@@ -336,13 +337,17 @@ static int _vnic_dev_cmd2(struct vnic_deif (dc2c->cmd_ring[posted].flags &DEVCMD2_FNORESULT )return 0 ; + result = dc2c->result + dc2c->next_result; + color = dc2c->color; + + dc2c->next_result++; +if (dc2c->next_result == dc2c->result_size) { + dc2c->next_result =0 ; + dc2c->color = dc2c->color ?0 :1 ; + } +for (delay =0 ; delay < wait; delay++) { -if (result->color == dc2c->color) { - dc2c->next_result++; -if (dc2c->next_result == dc2c->result_size) { - dc2c->next_result =0 ; - dc2c->color = dc2c->color ?0 :1 ; - } +if (result->color == color) {if (result->error) { err = result->error; if (err != ERR_ECMDUNKNOWN ||
Greg Kroah-Hartman
maintainerPATCH 27/342 bpf: fix branch offset adjustment on backjumps after patching ctx expansion
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Borkmann <[email protected]>
[ Upstream commit a1b14d27ed0965838350f1377ff97c93ee383492 ]
When ctx access is used, the kernel often needs to expand/rewrite instructions, so after that patching, branch offsets have to be adjusted for both forward and backward jumps in the new eBPF program, but for backward jumps it fails to account the delta. Meaning, for example, if the expansion happens exactly on the insn that sits at the jump target, it doesn't fix up the back jump offset.
Analysis on what the check in adjust_branches() is currently doing:
/* adjust offset of jmps if necessary */
if (i < pos && i + insn->off + 1 > pos)
insn->off += delta;
else if (i > pos && i + insn->off + 1 < pos)
insn->off -= delta;First condition (forward jumps):
Before: After:
insns[0] insns[0]
insns[1] <--- i/insn insns[1] <--- i/insn
insns[2] <--- pos insns[P] <--- pos
insns[3] insns[P] `------| delta
insns[4] <--- target_X insns[P] `-----|
insns[5] insns[3]
insns[4] <--- target_X
insns[5]First case is if we cross pos-boundary and the jump instruction was before pos. This is handeled correctly. I.e. if i == pos, then this would mean our jump that we currently check was the patchlet itself that we just injected. Since such patchlets are self-contained and have no awareness of any insns before or after the patched one, the delta is correctly not adjusted. Also, for the second condition in case of i + insn->off + 1 == pos, means we jump to that newly patched instruction, so no offset adjustment are needed. That part is correct.
Second condition (backward jumps):
Before: After:
insns[0] insns[0]
insns[1] <--- target_X insns[1] <--- target_X
insns[2] <--- pos <-- target_Y insns[P] <--- pos <-- target_Y
insns[3] insns[P] `------| delta
insns[4] <--- i/insn insns[P] `-----|
insns[5] insns[3]
insns[4] <--- i/insn
insns[5]Second interesting case is where we cross pos-boundary and the jump instruction was after pos. Backward jump with i == pos would be impossible and pose a bug somewhere in the patchlet, so the first condition checking i > pos is okay only by itself. However, i + insn->off + 1 < pos does not always work as intended to trigger the adjustment. It works when jump targets would be far off where the delta wouldn't matter. But, for example, where the fixed insn->off before pointed to pos (target_Y), it now points to pos + delta, so that additional room needs to be taken into account for the check. This means that i) both tests here need to be adjusted into pos + delta, and ii) for the second condition, the test needs to be <= as pos itself can be a target in the backjump, too.
--- kernel/bpf/verifier.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/bpf/verifier.c +1 -1
@@ -2082,7 +2082,7 @@ static void adjust_branches(struct bpf_p/* adjust offset of jmps if necessary */ if (i < pos && i + insn->off +1 > pos) insn->off += delta; -else if (i > pos && i + insn->off +1 < pos) +else if (i > pos + delta && i + insn->off +1 <= pos + delta) insn->off -= delta; } }
Greg Kroah-Hartman
maintainerPATCH 28/342 bonding: Fix ARP monitor validation
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jay Vosburgh <[email protected]>
[ Upstream commit 21a75f0915dde8674708b39abfcda113911c49b1 ]
The current logic in bond_arp_rcv will accept an incoming ARP for validation if (a) the receiving slave is either "active" (which includes the currently active slave, or the current ARP slave) or, (b) there is a currently active slave, and it has received an ARP since it became active. For case (b), the receiving slave isn't the currently active slave, and is receiving the original broadcast ARP request, not an ARP reply from the target.
This logic can fail if there is no currently active slave. In
this situation, the ARP probe logic cycles through all slaves, assigning each in turn as the "current_arp_slave" for one arp_interval, then setting that one as "active," and sending an ARP probe from that slave. The current logic expects the ARP reply to arrive on the sending current_arp_slave, however, due to switch FDB updating delays, the reply may be directed to another slave.
This can arise if the bonding slaves and switch are working, but
the ARP target is not responding. When the ARP target recovers, a condition may result wherein the ARP target host replies faster than the switch can update its forwarding table, causing each ARP reply to be sent to the previous current_arp_slave. This will never pass the logic in bond_arp_rcv, as neither of the above conditions (a) or (b) are met.
Some experimentation on a LAN shows ARP reply round trips in the
200 usec range, but my available switches never update their FDB in less than 4000 usec.
This patch changes the logic in bond_arp_rcv to additionally
accept an ARP reply for validation on any slave if there is a current ARP slave and it sent an ARP probe during the previous arp_interval.
--- drivers/net/bonding/bond_main.c | 39 ++++++++++++++++++++++++++++----------- 1 file changed, 28 insertions(+), 11 deletions(-)
drivers/net/bonding/bond_main.c +28 -11
@@ -214,6 +214,8 @@ static void bond_uninit(struct net_devicstatic struct rtnl_link_stats64 *bond_get_stats (struct net_device *bond_dev,struct rtnl_link_stats64 *stats);static void bond_slave_arr_handler (struct work_struct *work); +static bool bond_time_in_interval (struct bonding *bond,unsigned long last_act, +int mod);/*---------------------------- General routines -----------------------------*/
@@ -2418,7 +2420,7 @@ int bond_arp_rcv(const struct sk_buff *s struct slave *slave) {struct arphdr *arp = (struct arphdr *)skb->data; -struct slave *curr_active_slave; +struct slave *curr_active_slave, *curr_arp_slave;unsigned char *arp_ptr;__be32 sip, tip;int alen, is_arp = skb->protocol ==__cpu_to_be16 (ETH_P_ARP );
@@ -2465,26 +2467,41 @@ int bond_arp_rcv(const struct sk_buff *s &sip, &tip); curr_active_slave =rcu_dereference (bond->curr_active_slave); + curr_arp_slave =rcu_dereference (bond->current_arp_slave); -/* Backup slaves won't see the ARP reply, but do come through -* here for each ARP probe (so we swap the sip/tip to validate -* the probe). In a "redundant switch, common router" type of -* configuration, the ARP probe will (hopefully) travel from -* the active, through one switch, the router, then the other -* switch before reaching the backup. +/* We 'trust' the received ARP enough to validate it if: * -* We 'trust' the arp requests if there is an active slave and -* it received valid arp reply(s) after it became active. This -* is done to avoid endless looping when we can't reach the +* (a) the slave receiving the ARP is active (which includes the +* current ARP slave, if any), or +* +* (b) the receiving slave isn't active, but there is a currently +* active slave and it received valid arp reply(s) after it became +* the currently active slave, or +* +* (c) there is an ARP slave that sent an ARP during the prior ARP +* interval, and we receive an ARP reply on any slave. We accept +* these because switch FDB update delays may deliver the ARP +* reply to a slave other than the sender of the ARP request. +* +* Note: for (b), backup slaves are receiving the broadcast ARP +* request, not a reply. This request passes from the sending +* slave through the L2 switch(es) to the receiving slave. Since +* this is checking the request, sip/tip are swapped for +* validation. +* +* This is done to avoid endless looping when we can't reach the * arp_ip_target and fool ourselves with our own arp requests. */ -if (bond_is_active_slave (slave))bond_validate_arp (bond, slave, sip, tip);else if (curr_active_slave &&time_after (slave_last_rx (bond, curr_active_slave), curr_active_slave->last_link_up))bond_validate_arp (bond, slave, tip, sip); +else if (curr_arp_slave && (arp->ar_op ==htons (ARPOP_REPLY )) && +bond_time_in_interval (bond, +dev_trans_start (curr_arp_slave->dev),1 )) +bond_validate_arp (bond, slave, sip, tip); out_unlock:if (arp != (struct arphdr *)skb->data)
Greg Kroah-Hartman
maintainerPATCH 4/342 tunnels: Allow IPv6 UDP checksums to be correctly controlled.
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Gross <[email protected]>
[ Upstream commit 35e2d1152b22eae99c961affbe85374bef05a775 ]
When configuring checksums on UDP tunnels, the flags are different for IPv4 vs. IPv6 (and reversed). However, when lightweight tunnels are enabled the flags used are always the IPv4 versions, which are ignored in the IPv6 code paths. This uses the correct IPv6 flags, so checksums can be controlled appropriately.
--- drivers/net/vxlan.c | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-)
drivers/net/vxlan.c +16 -7
@@ -1984,11 +1984,6 @@ static void vxlan_xmit_one(struct sk_buf vxlan->cfg.port_max, true);if (info) { -if (info->key.tun_flags &TUNNEL_CSUM ) - flags |=VXLAN_F_UDP_CSUM ; -else - flags &= ~VXLAN_F_UDP_CSUM ; - ttl = info->key.ttl; tos = info->key.tos;
@@ -2003,8 +1998,15 @@ static void vxlan_xmit_one(struct sk_buf goto drop; sk = vxlan->vn4_sock->sock->sk; -if (info && (info->key.tun_flags &TUNNEL_DONT_FRAGMENT )) - df =htons (IP_DF ); +if (info) { +if (info->key.tun_flags &TUNNEL_DONT_FRAGMENT ) + df =htons (IP_DF ); + +if (info->key.tun_flags &TUNNEL_CSUM ) + flags |=VXLAN_F_UDP_CSUM ; +else + flags &= ~VXLAN_F_UDP_CSUM ; + }memset (&fl4,0 ,sizeof (fl4)); fl4.flowi4_oif = rdst ? rdst->remote_ifindex :0 ;
@@ -2102,6 +2104,13 @@ static void vxlan_xmit_one(struct sk_bufreturn ; } +if (info) { +if (info->key.tun_flags &TUNNEL_CSUM ) + flags &= ~VXLAN_F_UDP_ZERO_CSUM6_TX ; +else + flags |=VXLAN_F_UDP_ZERO_CSUM6_TX ; + } + ttl = ttl ? :ip6_dst_hoplimit (ndst); err = vxlan6_xmit_skb(ndst, sk, skb, dev, &saddr, &dst->sin6.sin6_addr, 0, ttl, src_port, dst_port, htonl(vni << 8), md,
Greg Kroah-Hartman
maintainerPATCH 7/342 af_unix: fix struct pid memory leak
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 fa0dc04df259ba2df3ce1920e9690c7842f8fa4b ]
Dmitry reported a struct pid leak detected by a syzkaller program.
Bug happens in unix_stream_recvmsg() when we break the loop when a signal is pending, without properly releasing scm.
--- net/unix/af_unix.c | 1 + 1 file changed, 1 insertion(+)
net/unix/af_unix.c +1 -0
@@ -2332,6 +2332,7 @@ again:if (signal_pending (current)) { err =sock_intr_errno (timeo); +scm_destroy (&scm); goto out; }
Greg Kroah-Hartman
maintainerPATCH 9/342 sctp: allow setting SCTP_SACK_IMMEDIATELY by the application
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcelo Ricardo Leitner <[email protected]>
[ Upstream commit 27f7ed2b11d42ab6d796e96533c2076ec220affc ]
This patch extends commit b93d6471748d ("sctp: implement the sender side for SACK-IMMEDIATELY extension") as it didn't white list SCTP_SACK_IMMEDIATELY on sctp_msghdr_parse(), causing it to be understood as an invalid flag and returning -EINVAL to the application.
Note that the actual handling of the flag is already there in sctp_datamsg_from_user().
https://tools.ietf.org/html/rfc7053#section-7
--- net/sctp/socket.c | 2 ++ 1 file changed, 2 insertions(+)
net/sctp/socket.c +2 -0
@@ -6640,6 +6640,7 @@ static int sctp_msghdr_parse(const strucif (cmsgs->srinfo->sinfo_flags & ~(SCTP_UNORDERED |SCTP_ADDR_OVER | +SCTP_SACK_IMMEDIATELY |SCTP_ABORT |SCTP_EOF ))return -EINVAL ;break ;
@@ -6663,6 +6664,7 @@ static int sctp_msghdr_parse(const strucif (cmsgs->sinfo->snd_flags & ~(SCTP_UNORDERED |SCTP_ADDR_OVER | +SCTP_SACK_IMMEDIATELY |SCTP_ABORT |SCTP_EOF ))return -EINVAL ;break ;
Greg Kroah-Hartman
maintainerPATCH 31/342 af_unix: Guard against other == sk in unix_dgram_sendmsg
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rainer Weikusat <[email protected]>
[ Upstream commit a5527dda344fff0514b7989ef7a755729769daa1 ]
The unix_dgram_sendmsg routine use the following test
if (unlikely(unix_peer(other) != sk && unix_recvq_full(other))) {
to determine if sk and other are in an n:1 association (either established via connect or by using sendto to send messages to an unrelated socket identified by address). This isn't correct as the specified address could have been bound to the sending socket itself or because this socket could have been connected to itself by the time of the unix_peer_get but disconnected before the unix_state_lock(other). In both cases, the if-block would be entered despite other == sk which might either block the sender unintentionally or lead to trying to unlock the same spin lock twice for a non-blocking send. Add a other != sk check to guard against this.
--- net/unix/af_unix.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
net/unix/af_unix.c +6 -1
@@ -1781,7 +1781,12 @@ restart_locked: goto out_unlock; } -if (unlikely (unix_peer (other) != sk &&unix_recvq_full (other))) { +/* other == sk && unix_peer(other) != sk if +* - unix_peer(sk) == NULL, destination address bound to sk +* - unix_peer(sk) == sk by time of get but disconnected before lock +*/ +if (other != sk && +unlikely (unix_peer (other) != sk &&unix_recvq_full (other))) {if (timeo) { timeo =unix_wait_for_peer (other, timeo);
Greg Kroah-Hartman
maintainerPATCH 43/342 IFF_NO_QUEUE: Fix for drivers not calling ether_setup()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Phil Sutter <[email protected]>
[ Upstream commit a813104d923339144078939175faf4e66aca19b4 ]
My implementation around IFF_NO_QUEUE driver flag assumed that leaving tx_queue_len untouched (specifically: not setting it to zero) by drivers would make it possible to assign a regular qdisc to them without having to worry about setting tx_queue_len to a useful value. This was only partially true: I overlooked that some drivers don't call ether_setup() and therefore not initialize tx_queue_len to the default value of 1000. Consequently, removing the workarounds in place for that case in qdisc implementations which cared about it (namely, pfifo, bfifo, gred, htb, plug and sfb) leads to problems with these specific interface types and qdiscs.
Luckily, there's already a sanitization point for drivers setting tx_queue_len to zero, which can be reused to assign the fallback value most qdisc implementations used, which is 1.
--- net/core/dev.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/core/dev.c +3 -1
@@ -7128,8 +7128,10 @@ struct net_device *alloc_netdev_mqs(int dev->priv_flags =IFF_XMIT_DST_RELEASE |IFF_XMIT_DST_RELEASE_PERM ;setup (dev); -if (!dev->tx_queue_len) +if (!dev->tx_queue_len) { dev->priv_flags |=IFF_NO_QUEUE ; + dev->tx_queue_len =1 ; + } dev->num_tx_queues = txqs; dev->real_num_tx_queues = txqs;
Greg Kroah-Hartman
maintainerPATCH 45/342 tipc: unlock in error path
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Insu Yun <[email protected]>
[ Upstream commit b53ce3e7d407aa4196877a48b8601181162ab158 ]
tipc_bcast_unlock need to be unlocked in error path.
--- net/tipc/bcast.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/tipc/bcast.c +3 -1
@@ -399,8 +399,10 @@ int tipc_nl_add_bc_link(struct net *net, hdr =genlmsg_put (msg->skb, msg->portid, msg->seq, &tipc_genl_family,NLM_F_MULTI ,TIPC_NL_LINK_GET ); -if (!hdr) +if (!hdr) { +tipc_bcast_unlock (net);return -EMSGSIZE ; + } attrs =nla_nest_start (msg->skb,TIPC_NLA_LINK );if (!attrs)
Greg Kroah-Hartman
maintainerPATCH 46/342 unix_diag: fix incorrect sign extension in unix_lookup_by_ino
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Dmitry V. Levin" <[email protected]>
[ Upstream commit b5f0549231ffb025337be5a625b0ff9f52b016f0 ]
The value passed by unix_diag_get_exact to unix_lookup_by_ino has type __u32, but unix_lookup_by_ino's argument ino has type int, which is not a problem yet.
However, when ino is compared with sock_i_ino return value of type unsigned long, ino is sign extended to signed long, and this results to incorrect comparison on 64-bit architectures for inode numbers greater than INT_MAX.
This bug was found by strace test suite.
--- net/unix/diag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/unix/diag.c +1 -1
@@ -220,7 +220,7 @@ done:return skb->len; } -static struct sock *unix_lookup_by_ino (int ino) +static struct sock *unix_lookup_by_ino (unsigned int ino) {int i;struct sock *sk;
Greg Kroah-Hartman
maintainerPATCH 50/342 arm64: errata: Add -mpc-relative-literal-loads to build flags
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: dann frazier <[email protected]>
commit 67dfa1751ce71e629aad7c438e1678ad41054677 upstream.
GCC6 (and Linaro's 2015.12 snapshot of GCC5) has a new default that uses adrp/ldr or adrp/add to address literal pools. When CONFIG_ARM64_ERRATUM_843419 is enabled, modules built with this toolchain fail to load:
module libahci: unsupported RELA relocation: 275
This patch fixes the problem by passing '-mpc-relative-literal-loads' to the compiler.
--- arch/arm64/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/arm64/Makefile +1 -0
@@ -27,6 +27,7 @@ $(warning LSE atomics not supported by b endif KBUILD_CFLAGS += -mgeneral-regs-only $(lseinstr) +KBUILD_CFLAGS += $(call cc-option, -mpc-relative-literal-loads) KBUILD_AFLAGS += $(lseinstr) ifeq ($(CONFIG_CPU_BIG_ENDIAN), y)
Greg Kroah-Hartman
maintainerPATCH 51/342 KVM: s390: fix guest fprs memory leak
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit 9c7ebb613bffea2feef4ec562ba1dbcaa810942b upstream.
fprs is never freed, therefore resulting in a memory leak if kvm_vcpu_init() fails or the vcpu is destroyed.
--- arch/s390/kvm/kvm-s390.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/s390/kvm/kvm-s390.c +4 -1
@@ -1202,6 +1202,7 @@ void kvm_arch_vcpu_destroy(struct kvm_vcif (vcpu->kvm->arch.use_cmma)kvm_s390_vcpu_unsetup_cmma (vcpu); +kfree (vcpu->arch.guest_fpregs.fprs);free_page ((unsigned long )(vcpu->arch.sie_block));kvm_vcpu_uninit (vcpu);
@@ -1516,12 +1517,14 @@ struct kvm_vcpu *kvm_arch_vcpu_create(st rc =kvm_vcpu_init (vcpu, kvm, id);if (rc) - goto out_free_sie_block; + goto out_free_fprs;VM_EVENT (kvm,3 ,"create cpu %d at %p, sie block at %p" , id, vcpu, vcpu->arch.sie_block);trace_kvm_s390_create_vcpu (id, vcpu, vcpu->arch.sie_block);return vcpu; +out_free_fprs: +kfree (vcpu->arch.guest_fpregs.fprs); out_free_sie_block:free_page ((unsigned long )(vcpu->arch.sie_block)); out_free_cpu:
Greg Kroah-Hartman
maintainerPATCH 52/342 devm_memremap: Fix error value when memremap failed
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Toshi Kani <[email protected]>
commit 93f834df9c2d4e362dfdc4b05daa0a4e18814836 upstream.
devm_memremap() returns an ERR_PTR() value in case of error. However, it returns NULL when memremap() failed. This causes the caller, such as the pmem driver, to proceed and oops later.
Change devm_memremap() to return ERR_PTR(-ENXIO) when memremap() failed.
--- kernel/memremap.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
kernel/memremap.c +3 -1
@@ -133,8 +133,10 @@ void *devm_memremap(struct device *dev,if (addr) { *ptr = addr;devres_add (dev, ptr); - }else + }else {devres_free (ptr); +return ERR_PTR (-ENXIO ); + }return addr; }
Greg Kroah-Hartman
maintainerPATCH 55/342 lib/ucs2_string: Add ucs2 -> utf8 helper functions
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Jones <[email protected]>
commit 73500267c930baadadb0d02284909731baf151f7 upstream.
This adds ucs2_utf8size(), which tells us how big our ucs2 string is in bytes, and ucs2_as_utf8, which translates from ucs2 to utf8..
--- include/linux/ucs2_string.h | 4 ++ lib/ucs2_string.c | 62 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+)
include/linux/ucs2_string.h +4 -0
@@ -11,4 +11,8 @@ unsigned long ucs2_strlen(const ucs2_chaunsigned long ucs2_strsize (const ucs2_char_t *data,unsigned long maxlength);int ucs2_strncmp (const ucs2_char_t *a,const ucs2_char_t *b,size_t len); +unsigned long ucs2_utf8size (const ucs2_char_t *src); +unsigned long ucs2_as_utf8 (u8 *dest,const ucs2_char_t *src, +unsigned long maxlength); +#endif /* _LINUX_UCS2_STRING_H_ */
lib/ucs2_string.c +62 -0
65 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 56/342 efi: Use ucs2_as_utf8 in efivarfs instead of open coding a bad version
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Jones <[email protected]>
commit e0d64e6a880e64545ad7d55786aa84ab76bac475 upstream.
Translate EFI's UCS-2 variable names to UTF-8 instead of just assuming all variable names fit in ASCII.
--- drivers/firmware/efi/efivars.c | 30 +++++++++++------------------- fs/efivarfs/super.c | 7 +++---- 2 files changed, 14 insertions(+), 23 deletions(-)
drivers/firmware/efi/efivars.c +11 -19
@@ -540,38 +540,30 @@ static ssize_t efivar_delete(struct filestatic int efivar_create_sysfs_entry (struct efivar_entry *new_var) { -int i, short_name_size; +int short_name_size;char *short_name; -unsigned long variable_name_size; -efi_char16_t *variable_name; +unsigned long utf8_name_size; +efi_char16_t *variable_name = new_var->var.VariableName;int ret; - variable_name = new_var->var.VariableName; - variable_name_size =ucs2_strlen (variable_name) *sizeof (efi_char16_t); -/* -* Length of the variable bytes in ASCII, plus the '-' separator, +* Length of the variable bytes in UTF8, plus the '-' separator, * plus the GUID, plus trailing NUL */ - short_name_size = variable_name_size /sizeof (efi_char16_t) - +1 +EFI_VARIABLE_GUID_LEN +1 ; - - short_name =kzalloc (short_name_size,GFP_KERNEL ); + utf8_name_size =ucs2_utf8size (variable_name); + short_name_size = utf8_name_size +1 +EFI_VARIABLE_GUID_LEN +1 ; + short_name =kmalloc (short_name_size,GFP_KERNEL );if (!short_name)return -ENOMEM ; -/* Convert Unicode to normal chars (assume top bits are 0), -ala UTF-8 */ -for (i=0 ; i < (int )(variable_name_size /sizeof (efi_char16_t)); i++) { - short_name[i] = variable_name[i] &0xFF ; - } +ucs2_as_utf8 (short_name, variable_name, short_name_size); +/* This is ugly, but necessary to separate one vendor's private variables from another's. */ - - *(short_name +strlen (short_name)) ='-' ; + short_name[utf8_name_size] ='-' ;efi_guid_to_str (&new_var->var.VendorGuid, - short_name +strlen (short_name)); + short_name + utf8_name_size +1 ); new_var->kobj.kset = efivars_kset;
fs/efivarfs/super.c +3 -4
@@ -118,7 +118,7 @@ static int efivarfs_callback(efi_char16_struct dentry *dentry, *root = sb->s_root;unsigned long size =0 ;char *name; -int len, i; +int len;int err = -ENOMEM ; entry =kzalloc (sizeof (*entry),GFP_KERNEL );
@@ -128,15 +128,14 @@ static int efivarfs_callback(efi_char16_memcpy (entry->var.VariableName, name16, name_size);memcpy (&(entry->var.VendorGuid), &vendor,sizeof (efi_guid_t)); - len =ucs2_strlen (entry->var.VariableName); + len =ucs2_utf8size (entry->var.VariableName);/* name, plus '-', plus GUID, plus NUL*/ name =kmalloc (len +1 +EFI_VARIABLE_GUID_LEN +1 ,GFP_KERNEL );if (!name) goto fail; -for (i =0 ; i < len; i++) - name[i] = entry->var.VariableName[i] &0xFF ; +ucs2_as_utf8 (name, entry->var.VariableName, len); name[len] ='-' ;
Greg Kroah-Hartman
maintainerPATCH 33/342 tcp: md5: release request socket instead of listener
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 729235554d805c63e5e274fcc6a98e71015dd847 ]
If tcp_v4_inbound_md5_hash() returns an error, we must release the refcount on the request socket, not on the listener.
The bug was added for IPv4 only.
--- net/ipv4/tcp_ipv4.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/ipv4/tcp_ipv4.c +4 -2
@@ -1597,8 +1597,10 @@ process:struct sock *nsk =NULL ; sk = req->rsk_listener; -if (tcp_v4_inbound_md5_hash (sk, skb)) - goto discard_and_relse; +if (unlikely (tcp_v4_inbound_md5_hash (sk, skb))) { +reqsk_put (req); + goto discard_it; + }if (likely (sk->sk_state ==TCP_LISTEN )) { nsk =tcp_check_req (sk, skb, req, false); }else {
Greg Kroah-Hartman
maintainerPATCH 60/342 efi: Add pstore variables to the deletion whitelist
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matt Fleming <[email protected]>
commit e246eb568bc4cbbdd8a30a3c11151ff9b7ca7312 upstream.
Laszlo explains why this is a good idea,
'This is because the pstore filesystem can be backed by UEFI variables,
and (for example) a crash might dump the last kilobytes of the dmesg into a number of pstore entries, each entry backed by a separate UEFI variable in the above GUID namespace, and with a variable name according to the above pattern.
Please see "drivers/firmware/efi/efi-pstore.c".
While this patch series will not prevent the user from deleting those UEFI variables via the pstore filesystem (i.e., deleting a pstore fs entry will continue to delete the backing UEFI variable), I think it would be nice to preserve the possibility for the sysadmin to delete Linux-created UEFI variables that carry portions of the crash log, *without* having to mount the pstore filesystem.'
There's also no chance of causing machines to become bricked by deleting these variables, which is the whole purpose of excluding things from the whitelist.
Use the LINUX_EFI_CRASH_GUID guid and a wildcard '*' for the match so that we don't have to update the string in the future if new variable name formats are created for crash dump variables.
--- drivers/firmware/efi/vars.c | 1 + 1 file changed, 1 insertion(+)
drivers/firmware/efi/vars.c +1 -0
@@ -198,6 +198,7 @@ static const struct variable_validate va { EFI_GLOBAL_VARIABLE_GUID, "OsIndications", NULL }, { EFI_GLOBAL_VARIABLE_GUID, "PlatformLang", validate_ascii_string }, { EFI_GLOBAL_VARIABLE_GUID, "Timeout", validate_uint16 }, + { LINUX_EFI_CRASH_GUID, "*", NULL }, { NULL_GUID, "", NULL }, };
Greg Kroah-Hartman
maintainerPATCH 63/342 bcache: Add a cond_resched() call to gc
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kent Overstreet <[email protected]>
commit c5f1e5adf956e3ba82d204c7c141a75da9fa449a upstream.
--- drivers/md/bcache/btree.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/bcache/btree.c +1 -0
@@ -1741,6 +1741,7 @@ static void bch_btree_gc(struct cache_se do { ret = btree_root(gc_root, c, &op, &writes, &stats); closure_sync(&writes); + cond_resched(); if (ret && ret != -EAGAIN) pr_warn("gc failed!");
Greg Kroah-Hartman
maintainerPATCH 61/342 lib/ucs2_string: Correct ucs2 -> utf8 conversion
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jason Andryuk <[email protected]>
commit a68075908a37850918ad96b056acc9ac4ce1bd90 upstream.
The comparisons should be >= since 0x800 and 0x80 require an additional bit to store.
For the 3 byte case, the existing shift would drop off 2 more bits than intended.
For the 2 byte case, there should be 5 bits bits in byte 1, and 6 bits in byte 2.
--- lib/ucs2_string.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
lib/ucs2_string.c +7 -7
@@ -59,9 +59,9 @@ ucs2_utf8size(const ucs2_char_t *src)for (i =0 ; i <ucs2_strlen (src); i++) {u16 c = src[i]; -if (c >0x800 ) +if (c >=0x800 ) j +=3 ; -else if (c >0x80 ) +else if (c >=0x80 ) j +=2 ;else j +=1 ;
@@ -88,19 +88,19 @@ ucs2_as_utf8(u8 *dest, const ucs2_char_tfor (i =0 ; maxlength && i < limit; i++) {u16 c = src[i]; -if (c >0x800 ) { +if (c >=0x800 ) {if (maxlength <3 )break ; maxlength -=3 ; dest[j++] =0xe0 | (c &0xf000 ) >>12 ; - dest[j++] =0x80 | (c &0x0fc0 ) >>8 ; + dest[j++] =0x80 | (c &0x0fc0 ) >>6 ; dest[j++] =0x80 | (c &0x003f ); - }else if (c >0x80 ) { + }else if (c >=0x80 ) {if (maxlength <2 )break ; maxlength -=2 ; - dest[j++] =0xc0 | (c &0xfe0 ) >>5 ; - dest[j++] =0x80 | (c &0x01f ); + dest[j++] =0xc0 | (c &0x7c0 ) >>6 ; + dest[j++] =0x80 | (c &0x03f ); }else { maxlength -=1 ; dest[j++] = c &0x7f ;
Greg Kroah-Hartman
maintainerPATCH 65/342 bcache: fix a leak in bch_cached_dev_run()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 4d4d8573a8451acc9f01cbea24b7e55f04a252fe upstream.
--- drivers/md/bcache/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/md/bcache/super.c +4 -1
@@ -849,8 +849,11 @@ void bch_cached_dev_run(struct cached_de buf[SB_LABEL_SIZE ] ='\0' ; env[2 ] =kasprintf (GFP_KERNEL ,"CACHED_LABEL=%s" , buf); -if (atomic_xchg (&dc->running,1 )) +if (atomic_xchg (&dc->running,1 )) { +kfree (env[1 ]); +kfree (env[2 ]);return ; + }if (!d->c &&BDEV_STATE (&dc->sb) !=BDEV_STATE_NONE ) {
Greg Kroah-Hartman
maintainerPATCH 66/342 bcache: unregister reboot notifier if bcache fails to unregister device
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Liu <[email protected]>
commit 2ecf0cdb2b437402110ab57546e02abfa68a716b upstream.
In bcache_init() function it forgot to unregister reboot notifier if bcache fails to unregister a block device. This commit fixes this.
--- drivers/md/bcache/super.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/bcache/super.c +3 -1
@@ -2071,8 +2071,10 @@ static int __init bcache_init(void)closure_debug_init (); bcache_major =register_blkdev (0 ,"bcache" ); -if (bcache_major <0 ) +if (bcache_major <0 ) { +unregister_reboot_notifier (&reboot);return bcache_major; + } if (!(bcache_wq = create_workqueue("bcache")) || !(bcache_kobj = kobject_create_and_add("bcache", fs_kobj)) ||
Greg Kroah-Hartman
maintainerPATCH 69/342 bcache: Change refill_dirty() to always scan entire disk if necessary
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kent Overstreet <[email protected]>
commit 627ccd20b4ad3ba836472468208e2ac4dfadbf03 upstream.
Previously, it would only scan the entire disk if it was starting from the very start of the disk - i.e. if the previous scan got to the end.
This was broken by refill_full_stripes(), which updates last_scanned so that refill_dirty was never triggering the searched_from_start path.
But if we change refill_dirty() to always scan the entire disk if necessary, regardless of what last_scanned was, the code gets cleaner and we fix that bug too.
--- drivers/md/bcache/writeback.c | 37 ++++++++++++++++++++++++++++++------- 1 file changed, 30 insertions(+), 7 deletions(-)
drivers/md/bcache/writeback.c +30 -7
@@ -323,6 +323,10 @@ void bcache_dev_sectors_dirty_add(structstatic bool dirty_pred (struct keybuf *buf,struct bkey *k) { + struct cached_dev *dc = container_of(buf, struct cached_dev, writeback_keys); + +BUG_ON (KEY_INODE (k) != dc->disk.id); +return KEY_DIRTY (k); }
@@ -372,11 +376,24 @@ next: } } +/* +* Returns true if we scanned the entire disk +*/ static bool refill_dirty (struct cached_dev *dc) {struct keybuf *buf = &dc->writeback_keys; +struct bkey start =KEY (dc->disk.id,0 ,0 );struct bkey end =KEY (dc->disk.id,MAX_KEY_OFFSET ,0 ); -bool searched_from_start = false; +struct bkey start_pos; + +/* +* make sure keybuf pos is inside the range for this disk - at bringup +* we might not be attached yet so this disk's inode nr isn't +* initialized then +*/ +if (bkey_cmp (&buf->last_scanned, &start) <0 || +bkey_cmp (&buf->last_scanned, &end) >0 ) + buf->last_scanned = start;if (dc->partial_stripes_expensive) {refill_full_stripes (dc);
@@ -384,14 +401,20 @@ static bool refill_dirty(struct cached_dreturn false; } -if (bkey_cmp (&buf->last_scanned, &end) >=0 ) { - buf->last_scanned =KEY (dc->disk.id,0 ,0 ); - searched_from_start = true; - } - + start_pos = buf->last_scanned;bch_refill_keybuf (dc->disk.c, buf, &end, dirty_pred); -return bkey_cmp (&buf->last_scanned, &end) >=0 && searched_from_start; +if (bkey_cmp (&buf->last_scanned, &end) <0 ) +return false; + +/* +* If we get to the end start scanning again from the beginning, and +* only scan up to where we initially started scanning from: +*/ + buf->last_scanned = start; +bch_refill_keybuf (dc->disk.c, buf, &start_pos, dirty_pred); + +return bkey_cmp (&buf->last_scanned, &start_pos) >=0 ; }static int bch_writeback_thread (void *arg)
Greg Kroah-Hartman
maintainerPATCH 70/342 dm thin: fix race condition when destroying thin pool workqueue
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Borisov <[email protected]>
commit 18d03e8c25f173f4107a40d0b8c24defb6ed69f3 upstream.
When a thin pool is being destroyed delayed work items are cancelled using cancel_delayed_work(), which doesn't guarantee that on return the delayed item isn't running. This can cause the work item to requeue itself on an already destroyed workqueue. Fix this by using cancel_delayed_work_sync() which guarantees that on return the work item is not running anymore.
--- drivers/md/dm-thin.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/md/dm-thin.c +2 -2
@@ -3453,8 +3453,8 @@ static void pool_postsuspend(struct dm_tstruct pool_c *pt = ti->private;struct pool *pool = pt->pool; -cancel_delayed_work (&pool->waker); -cancel_delayed_work (&pool->no_space_timeout); +cancel_delayed_work_sync (&pool->waker); +cancel_delayed_work_sync (&pool->no_space_timeout);flush_workqueue (pool->wq); (void )commit (pool); }
Greg Kroah-Hartman
maintainerPATCH 71/342 can: ems_usb: Fix possible tx overflow
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gerhard Uttenthaler <[email protected]>
commit 90cfde46586d2286488d8ed636929e936c0c9ab2 upstream.
This patch fixes the problem that more CAN messages could be sent to the interface as could be send on the CAN bus. This was more likely for slow baud rates. The sleeping _start_xmit was woken up in the _write_bulk_callback. Under heavy TX load this produced another bulk transfer without checking the free_slots variable and hence caused the overflow in the interface.
--- drivers/net/can/usb/ems_usb.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
drivers/net/can/usb/ems_usb.c +10 -4
@@ -117,6 +117,9 @@ MODULE_LICENSE("GPL v2");*/ #define EMS_USB_ARM7_CLOCK 8000000 +#define CPC_TX_QUEUE_TRIGGER_LOW 25 +#define CPC_TX_QUEUE_TRIGGER_HIGH 35 +/* * CAN-Message representation in a CPC_MSG. Message object type is * CPC_MSG_TYPE_CAN_FRAME or CPC_MSG_TYPE_RTR_FRAME or
@@ -278,6 +281,11 @@ static void ems_usb_read_interrupt_callbswitch (urb->status) {case 0 : dev->free_slots = dev->intr_in_buffer[1 ]; +if (dev->free_slots >CPC_TX_QUEUE_TRIGGER_HIGH ){ +if (netif_queue_stopped (netdev)){ +netif_wake_queue (netdev); + } + }break ;case -ECONNRESET :/* unlink */
@@ -526,8 +534,6 @@ static void ems_usb_write_bulk_callback(/* Release context */ context->echo_index =MAX_TX_URBS ; -if (netif_queue_stopped (netdev)) -netif_wake_queue (netdev); }/*
@@ -587,7 +593,7 @@ static int ems_usb_start(struct ems_usbint err, i; dev->intr_in_buffer[0 ] =0 ; - dev->free_slots =15 ;/* initial size */ + dev->free_slots =50 ;/* initial size */ for (i =0 ; i <MAX_RX_URBS ; i++) {struct urb *urb =NULL ;
@@ -835,7 +841,7 @@ static netdev_tx_t ems_usb_start_xmit(st/* Slow down tx path */ if (atomic_read (&dev->active_tx_urbs) >=MAX_TX_URBS || - dev->free_slots <5 ) { + dev->free_slots <CPC_TX_QUEUE_TRIGGER_LOW ) {netif_stop_queue (netdev); } }
Greg Kroah-Hartman
maintainerPATCH 72/342 usb: dwc3: Fix assignment of EP transfer resources
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: John Youn <[email protected]>
commit c450960187f45d4260db87c7dd4fc0bceb5565d8 upstream.
The assignement of EP transfer resources was not handled properly in the dwc3 driver. Commit aebda6187181 ("usb: dwc3: Reset the transfer resource index on SET_INTERFACE") previously fixed one aspect of this where resources may be exhausted with multiple calls to SET_INTERFACE. However, it introduced an issue where composite devices with multiple interfaces can be assigned the same transfer resources for different endpoints. This patch solves both issues.
The assignment of transfer resources cannot perfectly follow the data book due to the fact that the controller driver does not have all knowledge of the configuration in advance. It is given this information piecemeal by the composite gadget framework after every SET_CONFIGURATION and SET_INTERFACE. Trying to follow the databook programming model in this scenario can cause errors. For two reasons:
1) The databook says to do DEPSTARTCFG for every SET_CONFIGURATION and SET_INTERFACE (8.1.5). This is incorrect in the scenario of multiple interfaces.
2) The databook does not mention doing more DEPXFERCFG for new endpoint on alt setting (8.1.6).
The following simplified method is used instead:
All hardware endpoints can be assigned a transfer resource and this setting will stay persistent until either a core reset or hibernation. So whenever we do a DEPSTARTCFG(0) we can go ahead and do DEPXFERCFG for every hardware endpoint as well. We are guaranteed that there are as many transfer resources as endpoints.
This patch triggers off of the calling dwc3_gadget_start_config() for EP0-out, which always happens first, and which should only happen in one of the above conditions.
--- drivers/usb/dwc3/core.h | 1 drivers/usb/dwc3/ep0.c | 5 --- drivers/usb/dwc3/gadget.c | 70 ++++++++++++++++++++++++++++++++++------------ 3 files changed, 52 insertions(+), 24 deletions(-)
drivers/usb/dwc3/core.h +0 -1
@@ -853,7 +853,6 @@ struct dwc3 { unsigned pullups_connected:1; unsigned resize_fifos:1; unsigned setup_packet_pending:1; - unsigned start_config_issued:1; unsigned three_stage_setup:1; unsigned usb3_lpm_capable:1;
drivers/usb/dwc3/ep0.c +0 -5
@@ -555,7 +555,6 @@ static int dwc3_ep0_set_config(struct dwint ret;u32 reg; - dwc->start_config_issued = false; cfg =le16_to_cpu (ctrl->wValue);switch (state) {
@@ -737,10 +736,6 @@ static int dwc3_ep0_std_request(struct ddwc3_trace (trace_dwc3_ep0,"USB_REQ_SET_ISOCH_DELAY" ); ret =dwc3_ep0_set_isoch_delay (dwc, ctrl);break ; -case USB_REQ_SET_INTERFACE : -dwc3_trace (trace_dwc3_ep0,"USB_REQ_SET_INTERFACE" ); - dwc->start_config_issued = false; -/* Fall through */ default :dwc3_trace (trace_dwc3_ep0,"Forwarding to gadget driver" ); ret =dwc3_ep0_delegate_req (dwc, ctrl);
drivers/usb/dwc3/gadget.c +52 -18
108 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 74/342 USB: option: add support for SIM7100E
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Skvortsov <[email protected]>
commit 3158a8d416f4e1b79dcc867d67cb50013140772c upstream.
$ lsusb: Bus 001 Device 101: ID 1e0e:9001 Qualcomm / Option
$ usb-devices: T: Bus=01 Lev=02 Prnt=02 Port=00 Cnt=01 Dev#=101 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 2 P: Vendor=1e0e ProdID=9001 Rev= 2.32 S: Manufacturer=SimTech, Incorporated S: Product=SimTech, Incorporated S: SerialNumber=0123456789ABCDEF C:* #Ifs= 7 Cfg#= 1 Atr=80 MxPwr=500mA I:* If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I:* If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I:* If#= 2 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I:* If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I:* If#= 4 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=00 Prot=00 Driver=option I:* If#= 5 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan I:* If#= 6 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=42 Prot=01 Driver=(none)
The last interface (6) is used for Android Composite ADB interface.
Serial port layout:
0: QCDM/DIAG
1: NMEA
2: AT
3: AT/PPP
4: audio
--- drivers/usb/serial/option.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/usb/serial/option.c +7 -0
@@ -315,6 +315,7 @@ static void option_instat_callback(struc#define TOSHIBA_PRODUCT_G450 0x0d45#define ALINK_VENDOR_ID 0x1e0e +#define SIMCOM_PRODUCT_SIM7100E 0x9001/* Yes, ALINK_VENDOR_ID */ #define ALINK_PRODUCT_PH300 0x9100#define ALINK_PRODUCT_3GU 0x9200
@@ -607,6 +608,10 @@ static const struct option_blacklist_inf .reserved = BIT(3) | BIT(4), }; +static const struct option_blacklist_info simcom_sim7100e_blacklist = { + .reserved =BIT (5 ) |BIT (6 ), +}; +static const struct option_blacklist_info telit_le910_blacklist = { .sendsetup =BIT (0 ), .reserved =BIT (1 ) |BIT (2 ),
@@ -1645,6 +1650,8 @@ static const struct usb_device_id option { USB_DEVICE(ALINK_VENDOR_ID, 0x9000) }, { USB_DEVICE(ALINK_VENDOR_ID, ALINK_PRODUCT_PH300) }, { USB_DEVICE_AND_INTERFACE_INFO(ALINK_VENDOR_ID, ALINK_PRODUCT_3GU, 0xff, 0xff, 0xff) }, + { USB_DEVICE(ALINK_VENDOR_ID, SIMCOM_PRODUCT_SIM7100E), + .driver_info = (kernel_ulong_t)&simcom_sim7100e_blacklist }, { USB_DEVICE(ALCATEL_VENDOR_ID, ALCATEL_PRODUCT_X060S_X200), .driver_info = (kernel_ulong_t)&alcatel_x200_blacklist },
Greg Kroah-Hartman
maintainerPATCH 75/342 USB: option: add "4G LTE usb-modem U901"
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit d061c1caa31d4d9792cfe48a2c6b309a0e01ef46 upstream.
Thomas reports:
T: Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#= 4 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=05c6 ProdID=6001 Rev=00.00 S: Manufacturer=USB Modem S: Product=USB Modem S: SerialNumber=1234567890ABCDEF C: #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan I: If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -1127,6 +1127,8 @@ static const struct usb_device_id option { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC650) }, { USB_DEVICE(KYOCERA_VENDOR_ID, KYOCERA_PRODUCT_KPC680) }, { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6000)}, /* ZTE AC8700 */ + { USB_DEVICE_AND_INTERFACE_INFO(QUALCOMM_VENDOR_ID, 0x6001, 0xff, 0xff, 0xff), /* 4G LTE usb-modem U901 */ + .driver_info = (kernel_ulong_t)&net_intf3_blacklist }, { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x6613)}, /* Onda H600/ZTE MF330 */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x0023)}, /* ONYX 3G device */ { USB_DEVICE(QUALCOMM_VENDOR_ID, 0x9000)}, /* SIMCom SIM5218 */
Greg Kroah-Hartman
maintainerPATCH 77/342 spi: omap2-mcspi: Prevent duplicate gpio_request
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Welling <[email protected]>
commit 2f538c017e1a8620d19553931199c6d6a6d31bb2 upstream.
Occasionally the setup function will be called multiple times. Only request the gpio the first time otherwise -EBUSY will occur on subsequent calls to setup.
--- drivers/spi/spi-omap2-mcspi.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/spi/spi-omap2-mcspi.c +10 -9
@@ -1024,6 +1024,16 @@ static int omap2_mcspi_setup(struct spi_ spi->controller_state = cs;/* Link this to context save list */ list_add_tail (&cs->node, &ctx->cs); + +if (gpio_is_valid (spi->cs_gpio)) { + ret =gpio_request (spi->cs_gpio,dev_name (&spi->dev)); +if (ret) { +dev_err (&spi->dev,"failed to request gpio\n" ); +return ret; + } +gpio_direction_output (spi->cs_gpio, + !(spi->mode &SPI_CS_HIGH )); + } }if (!mcspi_dma->dma_rx || !mcspi_dma->dma_tx) {
@@ -1032,15 +1042,6 @@ static int omap2_mcspi_setup(struct spi_return ret; } -if (gpio_is_valid (spi->cs_gpio)) { - ret =gpio_request (spi->cs_gpio,dev_name (&spi->dev)); -if (ret) { -dev_err (&spi->dev,"failed to request gpio\n" ); -return ret; - } -gpio_direction_output (spi->cs_gpio, !(spi->mode &SPI_CS_HIGH )); - } - ret =pm_runtime_get_sync (mcspi->dev);if (ret <0 )return ret;
Greg Kroah-Hartman
maintainerPATCH 35/342 net/mlx4_en: Count HW buffer overrun only once
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amir Vadai <[email protected]>
[ Upstream commit 281e8b2fdf8e4ef366b899453cae50e09b577ada ]
RdropOvflw counts overrun of HW buffer, therefore should be used for rx_fifo_errors only.
Currently RdropOvflw counter is mistakenly also set into rx_missed_errors and rx_over_errors too, which makes the device total dropped packets accounting to show wrong results.
Fix that. Use it for rx_fifo_errors only.
--- drivers/net/ethernet/mellanox/mlx4/en_port.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_port.c +2 -2
@@ -238,11 +238,11 @@ int mlx4_en_DUMP_ETH_STATS(struct mlx4_e stats->collisions =0 ; stats->rx_dropped =be32_to_cpu (mlx4_en_stats->RDROP); stats->rx_length_errors =be32_to_cpu (mlx4_en_stats->RdropLength); - stats->rx_over_errors =be32_to_cpu (mlx4_en_stats->RdropOvflw); + stats->rx_over_errors =0 ; stats->rx_crc_errors =be32_to_cpu (mlx4_en_stats->RCRC); stats->rx_frame_errors =0 ; stats->rx_fifo_errors =be32_to_cpu (mlx4_en_stats->RdropOvflw); - stats->rx_missed_errors =be32_to_cpu (mlx4_en_stats->RdropOvflw); + stats->rx_missed_errors =0 ; stats->tx_aborted_errors =0 ; stats->tx_carrier_errors =0 ; stats->tx_fifo_errors =0 ;
Greg Kroah-Hartman
maintainerPATCH 37/342 net/mlx4_en: Avoid changing dev->features directly in run-time
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eugenia Emantayev <[email protected]>
[ Upstream commit 925ab1aa9394bbaeac47ee5b65d3fdf0fb8135cf ]
It's forbidden to manually change dev->features in run-time. Currently, this is done in the driver to make sure that GSO_UDP_TUNNEL is advertized only when VXLAN tunnel is set. However, since the stack actually does features intersection with hw_enc_features, we can safely revert to advertizing features early when registering the netdevice.
--- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +5 -4
@@ -2381,8 +2381,6 @@ out:/* set offloads */ priv->dev->hw_enc_features |=NETIF_F_IP_CSUM |NETIF_F_RXCSUM |NETIF_F_TSO |NETIF_F_GSO_UDP_TUNNEL ; - priv->dev->hw_features |=NETIF_F_GSO_UDP_TUNNEL ; - priv->dev->features |=NETIF_F_GSO_UDP_TUNNEL ; }static void mlx4_en_del_vxlan_offloads (struct work_struct *work)
@@ -2393,8 +2391,6 @@ static void mlx4_en_del_vxlan_offloads(s/* unset offloads */ priv->dev->hw_enc_features &= ~(NETIF_F_IP_CSUM |NETIF_F_RXCSUM |NETIF_F_TSO |NETIF_F_GSO_UDP_TUNNEL ); - priv->dev->hw_features &= ~NETIF_F_GSO_UDP_TUNNEL ; - priv->dev->features &= ~NETIF_F_GSO_UDP_TUNNEL ; ret =mlx4_SET_PORT_VXLAN (priv->mdev->dev, priv->port,VXLAN_STEER_BY_OUTER_MAC ,0 );
@@ -3020,6 +3016,11 @@ int mlx4_en_init_netdev(struct mlx4_en_d priv->rss_hash_fn =ETH_RSS_HASH_TOP ; } +if (mdev->dev->caps.tunnel_offload_mode ==MLX4_TUNNEL_OFFLOAD_MODE_VXLAN ) { + dev->hw_features |=NETIF_F_GSO_UDP_TUNNEL ; + dev->features |=NETIF_F_GSO_UDP_TUNNEL ; + } + mdev->pndev[port] = dev; mdev->upper[port] =NULL ;
Greg Kroah-Hartman
maintainerPATCH 12/342 inet: frag: Always orphan skbs inside ip_defrag()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Stringer <[email protected]>
[ Upstream commit 8282f27449bf15548cb82c77b6e04ee0ab827bdc ]
Later parts of the stack (including fragmentation) expect that there is never a socket attached to frag in a frag_list, however this invariant was not enforced on all defrag paths. This could lead to the BUG_ON(skb->sk) during ip_do_fragment(), as per the call stack at the end of this commit message.
While the call could be added to openvswitch to fix this particular error, the head and tail of the frags list are already orphaned indirectly inside ip_defrag(), so it seems like the remaining fragments should all be orphaned in all circumstances.
kernel BUG at net/ipv4/ip_output.c:586!
[...]
Call Trace: <IRQ> [<ffffffffa0205270>] ? do_output.isra.29+0x1b0/0x1b0 [openvswitch] [<ffffffffa02167a7>] ovs_fragment+0xcc/0x214 [openvswitch] [<ffffffff81667830>] ? dst_discard_out+0x20/0x20 [<ffffffff81667810>] ? dst_ifdown+0x80/0x80 [<ffffffffa0212072>] ? find_bucket.isra.2+0x62/0x70 [openvswitch] [<ffffffff810e0ba5>] ? mod_timer_pending+0x65/0x210 [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90 [<ffffffffa03205a2>] ? nf_conntrack_in+0x252/0x500 [nf_conntrack] [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70 [<ffffffffa02051a3>] do_output.isra.29+0xe3/0x1b0 [openvswitch] [<ffffffffa0206411>] do_execute_actions+0xe11/0x11f0 [openvswitch] [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70 [<ffffffffa0206822>] ovs_execute_actions+0x32/0xd0 [openvswitch] [<ffffffffa020b505>] ovs_dp_process_packet+0x85/0x140 [openvswitch] [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70 [<ffffffffa02068a2>] ovs_execute_actions+0xb2/0xd0 [openvswitch] [<ffffffffa020b505>] ovs_dp_process_packet+0x85/0x140 [openvswitch] [<ffffffffa0215019>] ? ovs_ct_get_labels+0x49/0x80 [openvswitch] [<ffffffffa0213a1d>] ovs_vport_receive+0x5d/0xa0 [openvswitch] [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90 [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90 [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90 [<ffffffffa0214895>] ? internal_dev_xmit+0x5/0x140 [openvswitch] [<ffffffffa02148fc>] internal_dev_xmit+0x6c/0x140 [openvswitch] [<ffffffffa0214895>] ? internal_dev_xmit+0x5/0x140 [openvswitch] [<ffffffff81660299>] dev_hard_start_xmit+0x2b9/0x5e0 [<ffffffff8165fc21>] ? netif_skb_features+0xd1/0x1f0 [<ffffffff81660f20>] __dev_queue_xmit+0x800/0x930 [<ffffffff81660770>] ? __dev_queue_xmit+0x50/0x930 [<ffffffff810b53f1>] ? mark_held_locks+0x71/0x90 [<ffffffff81669876>] ? neigh_resolve_output+0x106/0x220 [<ffffffff81661060>] dev_queue_xmit+0x10/0x20 [<ffffffff816698e8>] neigh_resolve_output+0x178/0x220 [<ffffffff816a8e6f>] ? ip_finish_output2+0x1ff/0x590 [<ffffffff816a8e6f>] ip_finish_output2+0x1ff/0x590 [<ffffffff816a8cee>] ? ip_finish_output2+0x7e/0x590 [<ffffffff816a9a31>] ip_do_fragment+0x831/0x8a0 [<ffffffff816a8c70>] ? ip_copy_metadata+0x1b0/0x1b0 [<ffffffff816a9ae3>] ip_fragment.constprop.49+0x43/0x80 [<ffffffff816a9c9c>] ip_finish_output+0x17c/0x340 [<ffffffff8169a6f4>] ? nf_hook_slow+0xe4/0x190 [<ffffffff816ab4c0>] ip_output+0x70/0x110 [<ffffffff816a9b20>] ? ip_fragment.constprop.49+0x80/0x80 [<ffffffff816aa9f9>] ip_local_out+0x39/0x70 [<ffffffff816abf89>] ip_send_skb+0x19/0x40 [<ffffffff816abfe3>] ip_push_pending_frames+0x33/0x40 [<ffffffff816df21a>] icmp_push_reply+0xea/0x120 [<ffffffff816df93d>] icmp_reply.constprop.23+0x1ed/0x230 [<ffffffff816df9ce>] icmp_echo.part.21+0x4e/0x50 [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70 [<ffffffff810d5f9e>] ? rcu_read_lock_held+0x5e/0x70 [<ffffffff816dfa06>] icmp_echo+0x36/0x70 [<ffffffff816e0d11>] icmp_rcv+0x271/0x450 [<ffffffff816a4ca7>] ip_local_deliver_finish+0x127/0x3a0 [<ffffffff816a4bc1>] ? ip_local_deliver_finish+0x41/0x3a0 [<ffffffff816a5160>] ip_local_deliver+0x60/0xd0 [<ffffffff816a4b80>] ? ip_rcv_finish+0x560/0x560 [<ffffffff816a46fd>] ip_rcv_finish+0xdd/0x560 [<ffffffff816a5453>] ip_rcv+0x283/0x3e0 [<ffffffff810b6302>] ? match_held_lock+0x192/0x200 [<ffffffff816a4620>] ? inet_del_offload+0x40/0x40 [<ffffffff8165d062>] __netif_receive_skb_core+0x392/0xae0 [<ffffffff8165e68e>] ? process_backlog+0x8e/0x230 [<ffffffff810b53f1>] ? mark_held_locks+0x71/0x90 [<ffffffff8165d7c8>] __netif_receive_skb+0x18/0x60 [<ffffffff8165e678>] process_backlog+0x78/0x230 [<ffffffff8165e6dd>] ? process_backlog+0xdd/0x230 [<ffffffff8165e355>] net_rx_action+0x155/0x400 [<ffffffff8106b48c>] __do_softirq+0xcc/0x420 [<ffffffff816a8e87>] ? ip_finish_output2+0x217/0x590 [<ffffffff8178e78c>] do_softirq_own_stack+0x1c/0x30 <EOI> [<ffffffff8106b88e>] do_softirq+0x4e/0x60 [<ffffffff8106b948>] __local_bh_enable_ip+0xa8/0xb0 [<ffffffff816a8eb0>] ip_finish_output2+0x240/0x590 [<ffffffff816a9a31>] ? ip_do_fragment+0x831/0x8a0 [<ffffffff816a9a31>] ip_do_fragment+0x831/0x8a0 [<ffffffff816a8c70>] ? ip_copy_metadata+0x1b0/0x1b0 [<ffffffff816a9ae3>] ip_fragment.constprop.49+0x43/0x80 [<ffffffff816a9c9c>] ip_finish_output+0x17c/0x340 [<ffffffff8169a6f4>] ? nf_hook_slow+0xe4/0x190 [<ffffffff816ab4c0>] ip_output+0x70/0x110 [<ffffffff816a9b20>] ? ip_fragment.constprop.49+0x80/0x80 [<ffffffff816aa9f9>] ip_local_out+0x39/0x70 [<ffffffff816abf89>] ip_send_skb+0x19/0x40 [<ffffffff816abfe3>] ip_push_pending_frames+0x33/0x40 [<ffffffff816d55d3>] raw_sendmsg+0x7d3/0xc30 [<ffffffff810b732b>] ? __lock_acquire+0x3db/0x1b90 [<ffffffff816e7557>] ? inet_sendmsg+0xc7/0x1d0 [<ffffffff810b63c4>] ? __lock_is_held+0x54/0x70 [<ffffffff816e759a>] inet_sendmsg+0x10a/0x1d0 [<ffffffff816e7495>] ? inet_sendmsg+0x5/0x1d0 [<ffffffff8163e398>] sock_sendmsg+0x38/0x50 [<ffffffff8163ec5f>] ___sys_sendmsg+0x25f/0x270 [<ffffffff811aadad>] ? handle_mm_fault+0x8dd/0x1320 [<ffffffff8178c147>] ? _raw_spin_unlock+0x27/0x40 [<ffffffff810529b2>] ? __do_page_fault+0x1e2/0x460 [<ffffffff81204886>] ? __fget_light+0x66/0x90 [<ffffffff8163f8e2>] __sys_sendmsg+0x42/0x80 [<ffffffff8163f932>] SyS_sendmsg+0x12/0x20 [<ffffffff8178cb17>] entry_SYSCALL_64_fastpath+0x12/0x6f Code: 00 00 44 89 e0 e9 7c fb ff ff 4c 89 ff e8 e7 e7 ff ff 41 8b 9d 80 00 00 00 2b 5d d4 89 d8 c1 f8 03 0f b7 c0 e9 33 ff ff f 66 66 66 2e 0f 1f 84 00 00 00 00 00 66 66 66 66 90 55 48 RIP [<ffffffff816a9a92>] ip_do_fragment+0x892/0x8a0 RSP <ffff88006d603170>
--- net/ipv4/ip_fragment.c | 1 + net/ipv4/netfilter/nf_defrag_ipv4.c | 2 -- 2 files changed, 1 insertion(+), 2 deletions(-)
net/ipv4/ip_fragment.c +1 -0
@@ -661,6 +661,7 @@ int ip_defrag(struct net *net, struct skstruct ipq *qp;IP_INC_STATS_BH (net,IPSTATS_MIB_REASMREQDS ); +skb_orphan (skb);/* Lookup (or create) queue header */ qp =ip_find (net,ip_hdr (skb), user, vif);
net/ipv4/netfilter/nf_defrag_ipv4.c +0 -2
@@ -27,8 +27,6 @@ static int nf_ct_ipv4_gather_frags(struc {int err; -skb_orphan (skb); -local_bh_disable (); err =ip_defrag (net, skb, user);local_bh_enable ();
Greg Kroah-Hartman
maintainerPATCH 38/342 l2tp: Fix error creating L2TP tunnels
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Tomlinson <[email protected]>
[ Upstream commit 853effc55b0f975abd6d318cca486a9c1b67e10f ]
A previous commit (33f72e6) added notification via netlink for tunnels when created/modified/deleted. If the notification returned an error, this error was returned from the tunnel function. If there were no listeners, the error code ESRCH was returned, even though having no listeners is not an error. Other calls to this and other similar notification functions either ignore the error code, or filter ESRCH. This patch checks for ESRCH and does not flag this as an error.
--- net/l2tp/l2tp_netlink.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
net/l2tp/l2tp_netlink.c +14 -4
@@ -124,8 +124,13 @@ static int l2tp_tunnel_notify(struct gen ret =l2tp_nl_tunnel_send (msg, info->snd_portid, info->snd_seq,NLM_F_ACK , tunnel, cmd); -if (ret >=0 ) -return genlmsg_multicast_allns (family, msg,0 ,0 ,GFP_ATOMIC ); +if (ret >=0 ) { + ret =genlmsg_multicast_allns (family, msg,0 ,0 ,GFP_ATOMIC ); +/* We don't care if no one is listening */ +if (ret == -ESRCH ) + ret =0 ; +return ret; + }nlmsg_free (msg);
@@ -147,8 +152,13 @@ static int l2tp_session_notify(struct ge ret =l2tp_nl_session_send (msg, info->snd_portid, info->snd_seq,NLM_F_ACK , session, cmd); -if (ret >=0 ) -return genlmsg_multicast_allns (family, msg,0 ,0 ,GFP_ATOMIC ); +if (ret >=0 ) { + ret =genlmsg_multicast_allns (family, msg,0 ,0 ,GFP_ATOMIC ); +/* We don't care if no one is listening */ +if (ret == -ESRCH ) + ret =0 ; +return ret; + }nlmsg_free (msg);
Greg Kroah-Hartman
maintainerPATCH 88/342 Btrfs: igrab inode in writepage
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
commit be7bd730841e69fe8f70120098596f648cd1f3ff upstream.
We hit this panic on a few of our boxes this week where we have an ordered_extent with an NULL inode. We do an igrab() of the inode in writepages, but weren't doing it in writepage which can be called directly from the VM on dirty pages. If the inode has been unlinked then we could have I_FREEING set which means igrab() would return NULL and we get this panic. Fix this by trying to igrab in btrfs_writepage, and if it returns NULL then just redirty the page and return AOP_WRITEPAGE_ACTIVATE; so the VM knows it wasn't successful. Thanks,
--- fs/btrfs/inode.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-)
fs/btrfs/inode.c +15 -2
@@ -8548,15 +8548,28 @@ int btrfs_readpage(struct file *file, ststatic int btrfs_writepage (struct page *page,struct writeback_control *wbc) {struct extent_io_tree *tree; - +struct inode *inode = page->mapping->host; +int ret;if (current->flags &PF_MEMALLOC ) {redirty_page_for_writepage (wbc, page);unlock_page (page);return 0 ; } + +/* +* If we are under memory pressure we will call this directly from the +* VM, we need to make sure we have the inode referenced for the ordered +* extent. If not just return like we didn't do anything. +*/ +if (!igrab (inode)) { +redirty_page_for_writepage (wbc, page); +return AOP_WRITEPAGE_ACTIVATE ; + } tree = &BTRFS_I (page->mapping->host)->io_tree; -return extent_write_full_page (tree, page, btrfs_get_extent, wbc); + ret =extent_write_full_page (tree, page, btrfs_get_extent, wbc); +btrfs_add_delayed_iput (inode); +return ret; } static int btrfs_writepages(struct address_space *mapping,
Greg Kroah-Hartman
maintainerPATCH 89/342 btrfs: statfs: report zero available if metadata are exhausted
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
commit ca8a51b3a979d57b082b14eda38602b7f52d81d1 upstream.
There is one ENOSPC case that's very confusing. There's Available greater than zero but no file operation succeds (besides removing files). This happens when the metadata are exhausted and there's no possibility to allocate another chunk.
In this scenario it's normal that there's still some space in the data chunk and the calculation in df reflects that in the Avail value.
To at least give some clue about the ENOSPC situation, let statfs report zero value in Avail, even if there's still data space available.
Current:
/dev/sdb1 4.0G 3.3G 719M 83% /mnt/test
New:
/dev/sdb1 4.0G 3.3G 0 100% /mnt/test
We calculate the remaining metadata space minus global reserve. If this is (supposedly) smaller than zero, there's no space. But this does not hold in practice, the exhausted state happens where's still some positive delta. So we apply some guesswork and compare the delta to a 4M threshold. (Practically observed delta was 2M.)
We probably cannot calculate the exact threshold value because this depends on the internal reservations requested by various operations, so some operations that consume a few metadata will succeed even if the Avail is zero. But this is better than the other way around.
--- fs/btrfs/super.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
fs/btrfs/super.c +24 -0
@@ -1956,6 +1956,8 @@ static int btrfs_calc_avail_data_space(s* there are other factors that may change the result (like a new metadata * chunk). * +* If metadata is exhausted, f_bavail will be 0. +* * FIXME: not accurate for mixed block groups, total and free/used are ok, * available appears slightly larger. */
@@ -1967,11 +1969,13 @@ static int btrfs_statfs(struct dentry *dstruct btrfs_space_info *found;u64 total_used =0 ;u64 total_free_data =0 ; +u64 total_free_meta =0 ;int bits = dentry->d_sb->s_blocksize_bits;__be32 *fsid = (__be32 *)fs_info->fsid;unsigned factor =1 ;struct btrfs_block_rsv *block_rsv = &fs_info->global_block_rsv;int ret; +u64 thresh =0 ;/* * holding chunk_muext to avoid allocating new chunks, holding
@@ -1997,6 +2001,8 @@ static int btrfs_statfs(struct dentry *d } } } +if (found->flags &BTRFS_BLOCK_GROUP_METADATA ) + total_free_meta += found->disk_total - found->disk_used; total_used += found->disk_used; }
@@ -2019,6 +2025,24 @@ static int btrfs_statfs(struct dentry *d buf->f_bavail +=div_u64 (total_free_data, factor); buf->f_bavail = buf->f_bavail >> bits; +/* +* We calculate the remaining metadata space minus global reserve. If +* this is (supposedly) smaller than zero, there's no space. But this +* does not hold in practice, the exhausted state happens where's still +* some positive delta. So we apply some guesswork and compare the +* delta to a 4M threshold. (Practically observed delta was ~2M.) +* +* We probably cannot calculate the exact threshold value because this +* depends on the internal reservations requested by various +* operations, so some operations that consume a few metadata will +* succeed even if the Avail is zero. But this is better than the other +* way around. +*/ + thresh =4 *1024 *1024 ; + +if (total_free_meta - thresh < block_rsv->size) + buf->f_bavail =0 ; + buf->f_type =BTRFS_SUPER_MAGIC ; buf->f_bsize = dentry->d_sb->s_blocksize; buf->f_namelen =BTRFS_NAME_LEN ;
Greg Kroah-Hartman
maintainerPATCH 90/342 Btrfs: send, dont BUG_ON() when an empty symlink is found
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe Manana <[email protected]>
commit a879719b8c90e15c9e7fa7266d5e3c0ca962f9df upstream.
When a symlink is successfully created it always has an inline extent containing the source path. However if an error happens when creating the symlink, we can leave in the subvolume's tree a symlink inode without any such inline extent item - this happens if after btrfs_symlink() calls btrfs_end_transaction() and before it calls the inode eviction handler (through the final iput() call), the transaction gets committed and a crash happens before the eviction handler gets called, or if a snapshot of the subvolume is made before the eviction handler gets called. Sadly we can't just avoid this by making btrfs_symlink() call btrfs_end_transaction() after it calls the eviction handler, because the later can commit the current transaction before it removes any items from the subvolume tree (if it encounters ENOSPC errors while reserving space for removing all the items).
So make send fail more gracefully, with an -EIO error, and print a message to dmesg/syslog informing that there's an empty symlink inode, so that the user can delete the empty symlink or do something else about it.
--- fs/btrfs/send.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
fs/btrfs/send.c +15 -1
@@ -1469,7 +1469,21 @@ static int read_symlink(struct btrfs_roo ret =btrfs_search_slot (NULL , root, &key, path,0 ,0 );if (ret <0 ) goto out; -BUG_ON (ret); +if (ret) { +/* +* An empty symlink inode. Can happen in rare error paths when +* creating a symlink (transaction committed before the inode +* eviction handler removed the symlink inode items and a crash +* happened in between or the subvol was snapshoted in between). +* Print an informative message to dmesg/syslog so that the user +* can delete the symlink. +*/ +btrfs_err (root->fs_info, +"Found empty symlink inode %llu at root %llu" , + ino, root->root_key.objectid); + ret = -EIO ; + goto out; + } ei =btrfs_item_ptr (path->nodes[0 ], path->slots[0 ], struct btrfs_file_extent_item);
Greg Kroah-Hartman
maintainerPATCH 93/342 Btrfs: Initialize btrfs_root->highest_objectid when loading tree root and subvolume roots
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chandan Rajendra <[email protected]>
commit f32e48e925964c4f8ab917850788a87e1cef3bad upstream.
The following call trace is seen when btrfs/031 test is executed in a loop,
[ 158.661848] ------------[ cut here ]------------ [ 158.662634] WARNING: CPU: 2 PID: 890 at /home/chandan/repos/linux/fs/btrfs/ioctl.c:558 create_subvol+0x3d1/0x6ea() [ 158.664102] BTRFS: Transaction aborted (error -2) [ 158.664774] Modules linked in: [ 158.665266] CPU: 2 PID: 890 Comm: btrfs Not tainted 4.4.0-rc6-g511711a #2 [ 158.666251] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 [ 158.667392] ffffffff81c0a6b0 ffff8806c7c4f8e8 ffffffff81431fc8 ffff8806c7c4f930 [ 158.668515] ffff8806c7c4f920 ffffffff81051aa1 ffff880c85aff000 ffff8800bb44d000 [ 158.669647] ffff8808863b5c98 0000000000000000 00000000fffffffe ffff8806c7c4f980 [ 158.670769] Call Trace: [ 158.671153] [<ffffffff81431fc8>] dump_stack+0x44/0x5c [ 158.671884] [<ffffffff81051aa1>] warn_slowpath_common+0x81/0xc0 [ 158.672769] [<ffffffff81051b27>] warn_slowpath_fmt+0x47/0x50 [ 158.673620] [<ffffffff813bc98d>] create_subvol+0x3d1/0x6ea [ 158.674440] [<ffffffff813777c9>] btrfs_mksubvol.isra.30+0x369/0x520 [ 158.675376] [<ffffffff8108a4aa>] ? percpu_down_read+0x1a/0x50 [ 158.676235] [<ffffffff81377a81>] btrfs_ioctl_snap_create_transid+0x101/0x180 [ 158.677268] [<ffffffff81377b52>] btrfs_ioctl_snap_create+0x52/0x70 [ 158.678183] [<ffffffff8137afb4>] btrfs_ioctl+0x474/0x2f90 [ 158.678975] [<ffffffff81144b8e>] ? vma_merge+0xee/0x300 [ 158.679751] [<ffffffff8115be31>] ? alloc_pages_vma+0x91/0x170 [ 158.680599] [<ffffffff81123f62>] ? lru_cache_add_active_or_unevictable+0x22/0x70 [ 158.681686] [<ffffffff813d99cf>] ? selinux_file_ioctl+0xff/0x1d0 [ 158.682581] [<ffffffff8117b791>] do_vfs_ioctl+0x2c1/0x490 [ 158.683399] [<ffffffff813d3cde>] ? security_file_ioctl+0x3e/0x60 [ 158.684297] [<ffffffff8117b9d4>] SyS_ioctl+0x74/0x80 [ 158.685051] [<ffffffff819b2bd7>] entry_SYSCALL_64_fastpath+0x12/0x6a [ 158.685958] ---[ end trace 4b63312de5a2cb76 ]--- [ 158.686647] BTRFS: error (device loop0) in create_subvol:558: errno=-2 No such entry [ 158.709508] BTRFS info (device loop0): forced readonly [ 158.737113] BTRFS info (device loop0): disk space caching is enabled [ 158.738096] BTRFS error (device loop0): Remounting read-write after error is not allowed [ 158.851303] BTRFS error (device loop0): cleaner transaction attach returned -30
This occurs because,
Mount filesystem
Create subvol with ID 257
Unmount filesystem
Mount filesystem
Delete subvol with ID 257
btrfs_drop_snapshot()
Add root corresponding to subvol 257 into
btrfs_transaction->dropped_roots list
Create new subvol (i.e. create_subvol())
257 is returned as the next free objectid
btrfs_read_fs_root_no_name()
Finds the btrfs_root instance corresponding to the old subvol with ID 257
in btrfs_fs_info->fs_roots_radix.
Returns error since btrfs_root_item->refs has the value of 0.To fix the issue the commit initializes tree root's and subvolume root's highest_objectid when loading the roots from disk.
--- fs/btrfs/disk-io.c | 27 +++++++++++++++++++++++++++ fs/btrfs/inode-map.c | 9 +-------- fs/btrfs/inode-map.h | 1 + fs/btrfs/ioctl.c | 4 ++++ 4 files changed, 33 insertions(+), 8 deletions(-)
fs/btrfs/disk-io.c +27 -0
@@ -1582,8 +1582,23 @@ int btrfs_init_fs_root(struct btrfs_root ret =get_anon_bdev (&root->anon_dev);if (ret) goto free_writers; + +mutex_lock (&root->objectid_mutex); + ret =btrfs_find_highest_objectid (root, + &root->highest_objectid); +if (ret) { +mutex_unlock (&root->objectid_mutex); + goto free_root_dev; + } + +ASSERT (root->highest_objectid <=BTRFS_LAST_FREE_OBJECTID ); + +mutex_unlock (&root->objectid_mutex); +return 0 ; +free_root_dev: +free_anon_bdev (root->anon_dev); free_writers:btrfs_free_subvolume_writers (root->subv_writers); fail:
@@ -2900,6 +2915,18 @@ retry_root_backup: tree_root->commit_root =btrfs_root_node (tree_root);btrfs_set_root_refs (&tree_root->root_item,1 ); +mutex_lock (&tree_root->objectid_mutex); + ret =btrfs_find_highest_objectid (tree_root, + &tree_root->highest_objectid); +if (ret) { +mutex_unlock (&tree_root->objectid_mutex); + goto recovery_tree_root; + } + +ASSERT (tree_root->highest_objectid <=BTRFS_LAST_FREE_OBJECTID ); + +mutex_unlock (&tree_root->objectid_mutex); + ret =btrfs_read_roots (fs_info, tree_root);if (ret) goto recovery_tree_root;
fs/btrfs/inode-map.c +1 -8
@@ -515,7 +515,7 @@ out:return ret; } -static int btrfs_find_highest_objectid (struct btrfs_root *root,u64 *objectid) +int btrfs_find_highest_objectid (struct btrfs_root *root,u64 *objectid) {struct btrfs_path *path;int ret;
@@ -555,13 +555,6 @@ int btrfs_find_free_objectid(struct btrfint ret;mutex_lock (&root->objectid_mutex); -if (unlikely (root->highest_objectid <BTRFS_FIRST_FREE_OBJECTID )) { - ret =btrfs_find_highest_objectid (root, - &root->highest_objectid); -if (ret) - goto out; - } -if (unlikely (root->highest_objectid >=BTRFS_LAST_FREE_OBJECTID )) { ret = -ENOSPC ; goto out;
fs/btrfs/inode-map.h +1 -0
@@ -9,5 +9,6 @@ int btrfs_save_ino_cache(struct btrfs_ro struct btrfs_trans_handle *trans);int btrfs_find_free_objectid (struct btrfs_root *root,u64 *objectid); +int btrfs_find_highest_objectid (struct btrfs_root *root,u64 *objectid);#endif
fs/btrfs/ioctl.c +4 -0
@@ -568,6 +568,10 @@ static noinline int create_subvol(struct goto fail; } +mutex_lock (&new_root->objectid_mutex); + new_root->highest_objectid = new_dirid; +mutex_unlock (&new_root->objectid_mutex); +/* * insert the directory item */
Greg Kroah-Hartman
maintainerPATCH 94/342 btrfs: initialize the seq counter in struct btrfs_device
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sebastian Andrzej Siewior <[email protected]>
commit 546bed631203344611f42b2af1d224d2eedb4e6b upstream.
I managed to trigger this:
| INFO: trying to register non-static key. | the code is fine but needs lockdep annotation. | turning off the locking correctness validator. | CPU: 1 PID: 781 Comm: systemd-gpt-aut Not tainted 4.4.0-rt2+ #14 | Hardware name: ARM-Versatile Express | [<80307cec>] (dump_stack) | [<80070e98>] (__lock_acquire) | [<8007184c>] (lock_acquire) | [<80287800>] (btrfs_ioctl) | [<8012a8d4>] (do_vfs_ioctl) | [<8012ac14>] (SyS_ioctl)
so I think that btrfs_device_data_ordered_init() is not invoked behind a macro somewhere.
--- fs/btrfs/volumes.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/volumes.c +1 -0
@@ -232,6 +232,7 @@ static struct btrfs_device *__alloc_devispin_lock_init (&dev->reada_lock);atomic_set (&dev->reada_in_flight,0 );atomic_set (&dev->dev_stats_ccnt,0 ); +btrfs_device_data_ordered_init (dev);INIT_RADIX_TREE (&dev->reada_zones,GFP_NOFS & ~__GFP_DIRECT_RECLAIM);INIT_RADIX_TREE (&dev->reada_extents,GFP_NOFS & ~__GFP_DIRECT_RECLAIM);
Greg Kroah-Hartman
maintainerPATCH 95/342 s390: fix normalization bug in exception table sorting
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit bcb7825a77f41c7dd91da6f7ac10b928156a322e upstream.
The normalization pass in the sorting routine of the relative exception table serves two purposes:
- it ensures that the address fields of the exception table entries are fully ordered, so that no ambiguities arise between entries with identical instruction offsets (i.e., when two instructions that are exactly 8 bytes apart each have an exception table entry associated with them)
- it ensures that the offsets of both the instruction and the fixup fields of each entry are relative to their final location after sorting.
Commit eb608fb366de ("s390/exceptions: switch to relative exception table entries") ported the relative exception table format from x86, but modified the sorting routine to only normalize the instruction offset field and not the fixup offset field. The result is that the fixup offset of each entry will be relative to the original location of the entry before sorting, likely leading to crashes when those entries are dereferenced.
--- arch/s390/mm/extable.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/s390/mm/extable.c +6 -2
@@ -52,12 +52,16 @@ void sort_extable(struct exception_tableint i;/* Normalize entries to being relative to the start of the section */ -for (p = start, i =0 ; p < finish; p++, i +=8 ) +for (p = start, i =0 ; p < finish; p++, i +=8 ) { p->insn += i; + p->fixup += i +4 ; + }sort (start, finish - start,sizeof (*start), cmp_ex,NULL );/* Denormalize all entries */ -for (p = start, i =0 ; p < finish; p++, i +=8 ) +for (p = start, i =0 ; p < finish; p++, i +=8 ) { p->insn -= i; + p->fixup -= i +4 ; + } }#ifdef CONFIG_MODULES
Greg Kroah-Hartman
maintainerPATCH 96/342 s390/dasd: prevent incorrect length error under z/VM after PAV changes
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Haberland <[email protected]>
commit 020bf042e5b397479c1174081b935d0ff15d1a64 upstream.
The channel checks the specified length and the provided amount of data for CCWs and provides an incorrect length error if the size does not match. Under z/VM with simulation activated the length may get changed. Having the suppress length indication bit set is stated as good CCW coding practice and avoids errors under z/VM.
--- drivers/s390/block/dasd_alias.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/s390/block/dasd_alias.c +1 -1
@@ -723,7 +723,7 @@ static int reset_summary_unit_check(struASCEBC ((char *) &cqr->magic,4 ); ccw = cqr->cpaddr; ccw->cmd_code =DASD_ECKD_CCW_RSCK ; - ccw->flags =0 ; + ccw->flags =CCW_FLAG_SLI ; ccw->count =16 ; ccw->cda = (__u32 )(addr_t ) cqr->data; ((char *)cqr->data)[0 ] = reason;
Greg Kroah-Hartman
maintainerPATCH 18/342 ipv6: fix a lockdep splat
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 44c3d0c1c0a880354e9de5d94175742e2c7c9683 ]
Silence lockdep false positive about rcu_dereference() being used in the wrong context.
First one should use rcu_dereference_protected() as we own the spinlock.
Second one should be a normal assignation, as no barrier is needed.
--- net/ipv6/ip6_flowlabel.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/ipv6/ip6_flowlabel.c +3 -2
@@ -540,12 +540,13 @@ int ipv6_flowlabel_opt(struct sock *sk, }spin_lock_bh (&ip6_sk_fl_lock);for (sflp = &np->ipv6_fl_list; - (sfl =rcu_dereference (*sflp)) !=NULL ; + (sfl =rcu_dereference_protected (*sflp, +lockdep_is_held (&ip6_sk_fl_lock))) !=NULL ; sflp = &sfl->next) {if (sfl->fl->label == freq.flr_label) {if (freq.flr_label == (np->flow_label&IPV6_FLOWLABEL_MASK )) np->flow_label &= ~IPV6_FLOWLABEL_MASK ; - *sflp =rcu_dereference (sfl->next); + *sflp = sfl->next;spin_unlock_bh (&ip6_sk_fl_lock);fl_release (sfl->fl);kfree_rcu (sfl, rcu);
Greg Kroah-Hartman
maintainerPATCH 99/342 s390/compat: correct restore of high gprs on signal return
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
commit 342300cc9cd3428bc6bfe5809bfcc1b9a0f06702 upstream.
git commit 8070361799ae1e3f4ef347bd10f0a508ac10acfb "s390: add support for vector extension"
broke 31-bit compat processes in regard to signal handling.
The restore_sigregs_ext32() function is used to restore the additional elements from the user space signal frame. Among the additional elements are the upper registers halves for 64-bit register support for 31-bit processes. The copy_from_user that is used to retrieve the high-gprs array from the user stack uses an incorrect length, 8 bytes instead of 64 bytes. This causes incorrect upper register halves to get loaded.
--- arch/s390/kernel/compat_signal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/s390/kernel/compat_signal.c +1 -1
@@ -271,7 +271,7 @@ static int restore_sigregs_ext32(struct/* Restore high gprs from signal stack */ if (__copy_from_user (&gprs_high, &sregs_ext->gprs_high, -sizeof (&sregs_ext->gprs_high))) +sizeof (sregs_ext->gprs_high)))return -EFAULT ;for (i =0 ; i <NUM_GPRS ; i++) *(__u32 *)®s->gprs[i] = gprs_high[i];
Greg Kroah-Hartman
maintainerPATCH 80/342 ocfs2: unlock inode if deleting inode from orphan fails
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guozhonghua <[email protected]>
commit a4a8481ff68a8a324a878e281bc37f18665224f7 upstream.
When doing append direct io cleanup, if deleting inode fails, it goes out without unlocking inode, which will cause the inode deadlock.
This issue was introduced by commit cf1776a9e834 ("ocfs2: fix a tiny race when truncate dio orohaned entry").
--- fs/ocfs2/aops.c | 1 + 1 file changed, 1 insertion(+)
fs/ocfs2/aops.c +1 -0
@@ -956,6 +956,7 @@ clean_orphan: tmp_ret =ocfs2_del_inode_from_orphan (osb, inode, di_bh, update_isize, end);if (tmp_ret <0 ) { +ocfs2_inode_unlock (inode,1 ); ret = tmp_ret;mlog_errno (ret);brelse (di_bh);
Greg Kroah-Hartman
maintainerPATCH 102/342 uml: fix hostfs mknod()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vegard Nossum <[email protected]>
commit 9f2dfda2f2f1c6181c3732c16b85c59ab2d195e0 upstream.
An inverted return value check in hostfs_mknod() caused the function to return success after handling it as an error (and cleaning up).
It resulted in the following segfault when trying to bind() a named unix socket:
Pid: 198, comm: a.out Not tainted 4.4.0-rc4
RIP: 0033:[<0000000061077df6>] RSP: 00000000daae5d60 EFLAGS: 00010202 RAX: 0000000000000000 RBX: 000000006092a460 RCX: 00000000dfc54208 RDX: 0000000061073ef1 RSI: 0000000000000070 RDI: 00000000e027d600 RBP: 00000000daae5de0 R08: 00000000da980ac0 R09: 0000000000000000 R10: 0000000000000003 R11: 00007fb1ae08f72a R12: 0000000000000000 R13: 000000006092a460 R14: 00000000daaa97c0 R15: 00000000daaa9a88 Kernel panic - not syncing: Kernel mode fault at addr 0x40, ip 0x61077df6 CPU: 0 PID: 198 Comm: a.out Not tainted 4.4.0-rc4 #1 Stack: e027d620 dfc54208 0000006f da981398 61bee000 0000c1ed daae5de0 0000006e e027d620 dfcd4208 00000005 6092a460 Call Trace: [<60dedc67>] SyS_bind+0xf7/0x110 [<600587be>] handle_syscall+0x7e/0x80 [<60066ad7>] userspace+0x3e7/0x4e0 [<6006321f>] ? save_registers+0x1f/0x40 [<6006c88e>] ? arch_prctl+0x1be/0x1f0 [<60054985>] fork_handler+0x85/0x90
Let's also get rid of the "cosmic ray protection" while we're at it.
--- fs/hostfs/hostfs_kern.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
fs/hostfs/hostfs_kern.c +1 -3
@@ -730,15 +730,13 @@ static int hostfs_mknod(struct inode *diinit_special_inode (inode, mode, dev); err =do_mknod (name, mode,MAJOR (dev),MINOR (dev)); -if (!err) +if (err) goto out_free; err =read_name (inode, name);__putname (name);if (err) goto out_put; -if (err) - goto out_put;d_instantiate (dentry, inode);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 107/342 rtlwifi: rtl8192ce: Fix handling of module parameters
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit b24f19f16b9e43f54218c07609b783ea8625406a upstream.
The module parameter for software encryption was never transferred to the location used by the driver.
--- drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/wireless/realtek/rtlwifi/rtl8192ce/sw.c +2 -0
@@ -139,6 +139,8 @@ int rtl92c_init_sw_vars(struct ieee80211 rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps; rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; + rtlpriv->cfg->mod_params->sw_crypto = + rtlpriv->cfg->mod_params->sw_crypto;if (!rtlpriv->psc.inactiveps)pr_info ("rtl8192ce: Power Save off (module option)\n" );if (!rtlpriv->psc.fwctrl_lps)
Greg Kroah-Hartman
maintainerPATCH 108/342 rtlwifi: rtl8192de: Fix incorrect module parameter descriptions
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit d4d60b4caaa5926e1b243070770968f05656107a upstream.
Two of the module parameters are listed with incorrect default values.
--- drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8192de/sw.c +2 -2
@@ -376,8 +376,8 @@ module_param_named(swlps, rtl92de_mod_pamodule_param_named (fwlps, rtl92de_mod_params.fwctrl_lps, bool,0444 );MODULE_PARM_DESC (swenc,"Set to 1 for software crypto (default 0)\n" );MODULE_PARM_DESC (ips,"Set to 0 to not use link power save (default 1)\n" ); -MODULE_PARM_DESC (swlps,"Set to 1 to use SW control power save (default 0)\n" ); -MODULE_PARM_DESC (fwlps,"Set to 1 to use FW control power save (default 1)\n" ); +MODULE_PARM_DESC (swlps,"Set to 1 to use SW control power save (default 1)\n" ); +MODULE_PARM_DESC (fwlps,"Set to 1 to use FW control power save (default 0)\n" );MODULE_PARM_DESC (debug,"Set debug level (0-5) (default 0)" ); static SIMPLE_DEV_PM_OPS(rtlwifi_pm_ops, rtl_pci_suspend, rtl_pci_resume);
Greg Kroah-Hartman
maintainerPATCH 109/342 rtlwifi: rtl8723ae: Fix initialization of module parameters
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 793b09994211fbe0b5cd5f7b6dd8cc9b6256c3c6 upstream.
This driver has some errors in the handling of module parameters. These include missing initialization for parameters msi_support and disable_watchdog. In addition, neither of these parameters nor sw_crypto are transferred into the locations used by the driver. A final fix is adding parameter msi to the module named and description macros.
--- drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/net/wireless/realtek/rtlwifi/rtl8723ae/sw.c +9 -0
@@ -150,6 +150,11 @@ int rtl8723e_init_sw_vars(struct ieee802 rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps; rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; + rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; + rtlpriv->cfg->mod_params->sw_crypto = + rtlpriv->cfg->mod_params->sw_crypto; + rtlpriv->cfg->mod_params->disable_watchdog = + rtlpriv->cfg->mod_params->disable_watchdog;if (rtlpriv->cfg->mod_params->disable_watchdog)pr_info ("watchdog disabled\n" ); rtlpriv->psc.reg_fwctrl_lps =3 ;
@@ -267,6 +272,8 @@ static struct rtl_mod_params rtl8723e_mo .swctrl_lps = false, .fwctrl_lps = true, .debug = DBG_EMERG, + .msi_support = false, + .disable_watchdog = false, };static struct rtl_hal_cfg rtl8723e_hal_cfg = {
@@ -383,12 +390,14 @@ module_param_named(debug, rtl8723e_mod_pmodule_param_named (ips, rtl8723e_mod_params.inactiveps, bool,0444 );module_param_named (swlps, rtl8723e_mod_params.swctrl_lps, bool,0444 );module_param_named (fwlps, rtl8723e_mod_params.fwctrl_lps, bool,0444 ); +module_param_named (msi, rtl8723e_mod_params.msi_support, bool,0444 );module_param_named (disable_watchdog, rtl8723e_mod_params.disable_watchdog, bool,0444 );MODULE_PARM_DESC (swenc,"Set to 1 for software crypto (default 0)\n" );MODULE_PARM_DESC (ips,"Set to 0 to not use link power save (default 1)\n" );MODULE_PARM_DESC (swlps,"Set to 1 to use SW control power save (default 0)\n" );MODULE_PARM_DESC (fwlps,"Set to 1 to use FW control power save (default 1)\n" ); +MODULE_PARM_DESC (msi,"Set to 1 to use MSI interrupts mode (default 0)\n" );MODULE_PARM_DESC (debug,"Set debug level (0-5) (default 0)" );MODULE_PARM_DESC (disable_watchdog,"Set to 1 to disable the watchdog (default 0)\n" );
Greg Kroah-Hartman
maintainerPATCH 22/342 tg3: Fix for tg3 transmit queue 0 timed out when too many gso_segs
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Siva Reddy Kallam <[email protected]>
[ Upstream commit b7d987295c74500b733a0ba07f9a9bcc4074fa83 ]
tg3_tso_bug() can hit a condition where the entire tx ring is not big enough to segment the GSO packet. For example, if MSS is very small, gso_segs can exceed the tx ring size. When we hit the condition, it will cause tx timeout.
tg3_tso_bug() is called to handle TSO and DMA hardware bugs. For TSO bugs, if tg3_tso_bug() cannot succeed, we have to drop the packet. For DMA bugs, we can still fall back to linearize the SKB and let the hardware transmit the TSO packet.
This patch adds a function tg3_tso_bug_gso_check() to check if there are enough tx descriptors for GSO before calling tg3_tso_bug(). The caller will then handle the error appropriately - drop or lineraize the SKB.
v2: Corrected patch description to avoid confusion.
--- drivers/net/ethernet/broadcom/tg3.c | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +19 -6
@@ -7833,6 +7833,14 @@ static int tigon3_dma_hwbug_workaround(sreturn ret; } +static bool tg3_tso_bug_gso_check (struct tg3_napi *tnapi,struct sk_buff *skb) +{ +/* Check if we will never have enough descriptors, +* as gso_segs can be more than current ring size +*/ +return skb_shinfo (skb)->gso_segs < tnapi->tx_pending /3 ; +} +static netdev_tx_t tg3_start_xmit (struct sk_buff *,struct net_device *);/* Use GSO to workaround all TSO packets that meet HW bug conditions
@@ -7936,14 +7944,19 @@ static netdev_tx_t tg3_start_xmit(struct* vlan encapsulated. */ if (skb->protocol ==htons (ETH_P_8021Q ) || - skb->protocol ==htons (ETH_P_8021AD )) -return tg3_tso_bug (tp, tnapi, txq, skb); + skb->protocol ==htons (ETH_P_8021AD )) { +if (tg3_tso_bug_gso_check (tnapi, skb)) +return tg3_tso_bug (tp, tnapi, txq, skb); + goto drop; + }if (!skb_is_gso_v6 (skb)) {if (unlikely ((ETH_HLEN + hdr_len) >80 ) && -tg3_flag (tp,TSO_BUG )) -return tg3_tso_bug (tp, tnapi, txq, skb); - +tg3_flag (tp,TSO_BUG )) { +if (tg3_tso_bug_gso_check (tnapi, skb)) +return tg3_tso_bug (tp, tnapi, txq, skb); + goto drop; + } ip_csum = iph->check; ip_tot_len = iph->tot_len; iph->check =0 ;
@@ -8075,7 +8088,7 @@ static netdev_tx_t tg3_start_xmit(structif (would_hit_hwbug) {tg3_tx_skb_unmap (tnapi, tnapi->tx_prod, i); -if (mss) { +if (mss &&tg3_tso_bug_gso_check (tnapi, skb)) {/* If it's a TSO packet, do GSO instead of * allocating and copying to a large linear SKB */
Greg Kroah-Hartman
maintainerPATCH 111/342 rtlwifi: rtl8188ee: Fix module parameter initialization
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 06f34572c6110e2e2d5e653a957f1d74db9e3f2b upstream.
In this driver, parameters disable_watchdog and sw_crypto are never copied into the locations used in the main code. While modifying the parameter handling, the copying of parameter msi_support is moved to be with the rest.
--- drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/net/wireless/realtek/rtlwifi/rtl8188ee/sw.c +5 -2
@@ -88,8 +88,6 @@ int rtl88e_init_sw_vars(struct ieee80211u8 tid;rtl8188ee_bt_reg_init (hw); - rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; - rtlpriv->dm.dm_initialgain_enable =1 ; rtlpriv->dm.dm_flag =0 ; rtlpriv->dm.disable_framebursting =0 ;
@@ -138,6 +136,11 @@ int rtl88e_init_sw_vars(struct ieee80211 rtlpriv->psc.inactiveps = rtlpriv->cfg->mod_params->inactiveps; rtlpriv->psc.swctrl_lps = rtlpriv->cfg->mod_params->swctrl_lps; rtlpriv->psc.fwctrl_lps = rtlpriv->cfg->mod_params->fwctrl_lps; + rtlpci->msi_support = rtlpriv->cfg->mod_params->msi_support; + rtlpriv->cfg->mod_params->sw_crypto = + rtlpriv->cfg->mod_params->sw_crypto; + rtlpriv->cfg->mod_params->disable_watchdog = + rtlpriv->cfg->mod_params->disable_watchdog;if (rtlpriv->cfg->mod_params->disable_watchdog)pr_info ("watchdog disabled\n" );if (!rtlpriv->psc.inactiveps)
Greg Kroah-Hartman
maintainerPATCH 115/342 namei: ->d_inode of a pinned dentry is stable only for positives
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit d4565649b6d6923369112758212b851adc407f0c upstream.
both do_last() and walk_component() risk picking a NULL inode out of dentry about to become positive, *then* checking its flags and seeing that it's not negative anymore and using (already stale by then) value they'd fetched earlier. Usually ends up oopsing soon after that...
--- fs/namei.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/namei.c +2 -2
@@ -1742,11 +1742,11 @@ static int walk_component(struct nameidaif (err <0 )return err; - inode =d_backing_inode (path.dentry); seq =0 ;/* we are already out of RCU mode */ err = -ENOENT ;if (d_is_negative (path.dentry)) goto out_path_put; + inode =d_backing_inode (path.dentry); }if (flags &WALK_PUT )
@@ -3130,12 +3130,12 @@ retry_lookup:return error;BUG_ON (nd->flags &LOOKUP_RCU ); - inode =d_backing_inode (path.dentry); seq =0 ;/* out of RCU mode, so the value doesn't matter */ if (unlikely (d_is_negative (path.dentry))) {path_to_nameidata (&path, nd);return -ENOENT ; } + inode =d_backing_inode (path.dentry); finish_lookup:if (nd->depth)put_link (nd);
Greg Kroah-Hartman
maintainerPATCH 116/342 rc: sunxi-cir: Initialize the spinlock properly
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit 768acf46e1320d6c41ed1b7c4952bab41c1cde79 upstream.
The driver allocates the spinlock but fails to initialize it correctly. The kernel reports a BUG indicating bad spinlock magic when spinlock debugging is enabled.
Call spin_lock_init() on it to initialize it correctly.
--- drivers/media/rc/sunxi-cir.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/rc/sunxi-cir.c +2 -0
@@ -153,6 +153,8 @@ static int sunxi_ir_probe(struct platforif (!ir)return -ENOMEM ; +spin_lock_init (&ir->ir_lock); +if (of_device_is_compatible (dn,"allwinner,sun5i-a13-ir" )) ir->fifo_size =64 ;else
Greg Kroah-Hartman
maintainerPATCH 24/342 sctp: translate network order to host order when users get a hmacid
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 7a84bd46647ff181eb2659fdc99590e6f16e501d ]
Commit ed5a377d87dc ("sctp: translate host order to network order when setting a hmacid") corrected the hmacid byte-order when setting a hmacid. but the same issue also exists on getting a hmacid.
We fix it by changing hmacids to host order when users get them with getsockopt.
--- net/sctp/socket.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
net/sctp/socket.c +7 -2
@@ -5542,6 +5542,7 @@ static int sctp_getsockopt_hmac_ident(ststruct sctp_hmac_algo_param *hmacs;__u16 data_len =0 ;u32 num_idents; +int i;if (!ep->auth_enable)return -EACCES ;
@@ -5559,8 +5560,12 @@ static int sctp_getsockopt_hmac_ident(streturn -EFAULT ;if (put_user (num_idents, &p->shmac_num_idents))return -EFAULT ; -if (copy_to_user (p->shmac_idents, hmacs->hmac_ids, data_len)) -return -EFAULT ; +for (i =0 ; i < num_idents; i++) { +__u16 hmacid =ntohs (hmacs->hmac_ids[i]); + +if (copy_to_user (&p->shmac_idents[i], &hmacid,sizeof (__u16))) +return -EFAULT ; + }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 26/342 flow_dissector: Fix unaligned access in __skb_flow_dissector when used by eth_get_headlen
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Duyck <[email protected]>
[ Upstream commit 461547f3158978c180d74484d58e82be9b8e7357 ]
This patch fixes an issue with unaligned accesses when using eth_get_headlen on a page that was DMA aligned instead of being IP aligned. The fact is when trying to check the length we don't need to be looking at the flow label so we can reorder the checks to first check if we are supposed to gather the flow label and then make the call to actually get it.
v2: Updated path so that either STOP_AT_FLOW_LABEL or KEY_FLOW_LABEL can
cause us to check for the flow label.
--- net/core/flow_dissector.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
net/core/flow_dissector.c +6 -3
@@ -208,7 +208,6 @@ ip:case htons (ETH_P_IPV6 ): {const struct ipv6hdr *iph;struct ipv6hdr _iph; -__be32 flow_label; ipv6: iph =__skb_header_pointer (skb, nhoff,sizeof (_iph), data, hlen, &_iph);
@@ -230,8 +229,12 @@ ipv6: key_control->addr_type =FLOW_DISSECTOR_KEY_IPV6_ADDRS ; } - flow_label =ip6_flowlabel (iph); -if (flow_label) { +if ((dissector_uses_key (flow_dissector, +FLOW_DISSECTOR_KEY_FLOW_LABEL ) || + (flags &FLOW_DISSECTOR_F_STOP_AT_FLOW_LABEL )) && +ip6_flowlabel (iph)) { +__be32 flow_label =ip6_flowlabel (iph); +if (dissector_uses_key (flow_dissector,FLOW_DISSECTOR_KEY_FLOW_LABEL )) { key_tags = skb_flow_dissector_target(flow_dissector,
Greg Kroah-Hartman
maintainerPATCH 119/342 gspca: ov534/topro: prevent a division by 0
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Ospite <[email protected]>
commit dcc7fdbec53a960588f2c40232db2c6466c09917 upstream.
v4l2-compliance sends a zeroed struct v4l2_streamparm in v4l2-test-formats.cpp::testParmType(), and this results in a division by 0 in some gspca subdrivers:
divide error: 0000 [#1] SMP
Modules linked in: gspca_ov534 gspca_main ...
CPU: 0 PID: 17201 Comm: v4l2-compliance Not tainted 4.3.0-rc2-ao2 #1
Hardware name: System manufacturer System Product Name/M2N-E SLI, BIOS
ASUS M2N-E SLI ACPI BIOS Revision 1301 09/16/2010
task: ffff8800818306c0 ti: ffff880095c4c000 task.ti: ffff880095c4c000
RIP: 0010:[<ffffffffa079bd62>] [<ffffffffa079bd62>] sd_set_streamparm+0x12/0x60 [gspca_ov534]
RSP: 0018:ffff880095c4fce8 EFLAGS: 00010296
RAX: 0000000000000000 RBX: ffff8800c9522000 RCX: ffffffffa077a140
RDX: 0000000000000000 RSI: ffff880095e0c100 RDI: ffff8800c9522000
RBP: ffff880095e0c100 R08: ffffffffa077a100 R09: 00000000000000cc
R10: ffff880067ec7740 R11: 0000000000000016 R12: ffffffffa07bb400
R13: 0000000000000000 R14: ffff880081b6a800 R15: 0000000000000000
FS: 00007fda0de78740(0000) GS:ffff88012fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000014630f8 CR3: 00000000cf349000 CR4: 00000000000006f0
Stack:
ffffffffa07a6431 ffff8800c9522000 ffffffffa077656e 00000000c0cc5616
ffff8800c9522000 ffffffffa07a5e20 ffff880095e0c100 0000000000000000
ffff880067ec7740 ffffffffa077a140 ffff880067ec7740 0000000000000016
Call Trace:
[<ffffffffa07a6431>] ? v4l_s_parm+0x21/0x50 [videodev]
[<ffffffffa077656e>] ? vidioc_s_parm+0x4e/0x60 [gspca_main]
[<ffffffffa07a5e20>] ? __video_do_ioctl+0x280/0x2f0 [videodev]
[<ffffffffa07a5ba0>] ? video_ioctl2+0x20/0x20 [videodev]
[<ffffffffa07a59b9>] ? video_usercopy+0x319/0x4e0 [videodev]
[<ffffffff81182dc1>] ? page_add_new_anon_rmap+0x71/0xa0
[<ffffffff811afb92>] ? mem_cgroup_commit_charge+0x52/0x90
[<ffffffff81179b18>] ? handle_mm_fault+0xc18/0x1680
[<ffffffffa07a15cc>] ? v4l2_ioctl+0xac/0xd0 [videodev]
[<ffffffff811c846f>] ? do_vfs_ioctl+0x28f/0x480
[<ffffffff811c86d4>] ? SyS_ioctl+0x74/0x80
[<ffffffff8154a8b6>] ? entry_SYSCALL_64_fastpath+0x16/0x75
Code: c7 93 d9 79 a0 5b 5d e9 f1 f3 9a e0 0f 1f 00 66 2e 0f 1f 84 00
00 00 00 00 66 66 66 66 90 53 31 d2 48 89 fb 48 83 ec 08 8b 46 10 <f7>
76 0c 80 bf ac 0c 00 00 00 88 87 4e 0e 00 00 74 09 80 bf 4f
RIP [<ffffffffa079bd62>] sd_set_streamparm+0x12/0x60 [gspca_ov534]
RSP <ffff880095c4fce8>
---[ end trace 279710c2c6c72080 ]---Following what the doc says about a zeroed timeperframe (see
http://www.linuxtv.org/downloads/v4l-dvb-apis/vidioc-g-parm.html):
...
To reset manually applications can just set this field to zero.
fix the issue by resetting the frame rate to a default value in case of an unusable timeperframe.
The fix is done in the subdrivers instead of gspca.c because only the subdrivers have notion of a default frame rate to reset the camera to.
--- drivers/media/usb/gspca/ov534.c | 9 +++++++-- drivers/media/usb/gspca/topro.c | 6 +++++- 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/media/usb/gspca/ov534.c +7 -2
@@ -1491,8 +1491,13 @@ static void sd_set_streamparm(struct gspstruct v4l2_fract *tpf = &cp->timeperframe;struct sd *sd = (struct sd *) gspca_dev; -/* Set requested framerate */ - sd->frame_rate = tpf->denominator / tpf->numerator; +if (tpf->numerator ==0 || tpf->denominator ==0 ) +/* Set default framerate */ + sd->frame_rate =30 ; +else +/* Set requested framerate */ + sd->frame_rate = tpf->denominator / tpf->numerator; +if (gspca_dev->streaming)set_frame_rate (gspca_dev);
drivers/media/usb/gspca/topro.c +5 -1
@@ -4802,7 +4802,11 @@ static void sd_set_streamparm(struct gspstruct v4l2_fract *tpf = &cp->timeperframe;int fr, i; - sd->framerate = tpf->denominator / tpf->numerator; +if (tpf->numerator ==0 || tpf->denominator ==0 ) + sd->framerate =30 ; +else + sd->framerate = tpf->denominator / tpf->numerator; +if (gspca_dev->streaming)setframerate (gspca_dev,v4l2_ctrl_g_ctrl (gspca_dev->exposure));
Greg Kroah-Hartman
maintainerPATCH 82/342 mm: numa: quickly fail allocations for NUMA balancing on full nodes
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mel Gorman <[email protected]>
commit 8479eba7781fa9ffb28268840de6facfc12c35a7 upstream.
Commit 4167e9b2cf10 ("mm: remove GFP_THISNODE") removed the GFP_THISNODE flag combination due to confusing semantics. It noted that alloc_misplaced_dst_page() was one such user after changes made by commit e97ca8e5b864 ("mm: fix GFP_THISNODE callers and clarify").
Unfortunately when GFP_THISNODE was removed, users of alloc_misplaced_dst_page() started waking kswapd and entering direct reclaim because the wrong GFP flags are cleared. The consequence is that workloads that used to fit into memory now get reclaimed which is addressed by this patch.
The problem can be demonstrated with "mutilate" that exercises memcached which is software dedicated to memory object caching. The configuration uses 80% of memory and is run 3 times for varying numbers of clients. The results on a 4-socket NUMA box are
mutilate
4.4.0 4.4.0
vanilla numaswap-v1
Hmean 1 8394.71 ( 0.00%) 8395.32 ( 0.01%)
Hmean 4 30024.62 ( 0.00%) 34513.54 ( 14.95%)
Hmean 7 32821.08 ( 0.00%) 70542.96 (114.93%)
Hmean 12 55229.67 ( 0.00%) 93866.34 ( 69.96%)
Hmean 21 39438.96 ( 0.00%) 85749.21 (117.42%)
Hmean 30 37796.10 ( 0.00%) 50231.49 ( 32.90%)
Hmean 47 18070.91 ( 0.00%) 38530.13 (113.22%)The metric is queries/second with the more the better. The results are way outside of the noise and the reason for the improvement is obvious from some of the vmstats
4.4.0 4.4.0
vanillanumaswap-v1r1
Minor Faults 1929399272 2146148218
Major Faults 19746529 3567
Swap Ins 57307366 9913
Swap Outs 50623229 17094Allocation stalls 35909 443
DMA allocs 0 0
DMA32 allocs 72976349 170567396
Normal allocs 5306640898 5310651252
Movable allocs 0 0
Direct pages scanned 404130893 799577
Kswapd pages scanned 160230174 0
Kswapd pages reclaimed 55928786 0
Direct pages reclaimed 1843936 41921
Page writes file 2391 0
Page writes anon 50623229 17094
The vanilla kernel is swapping like crazy with large amounts of direct reclaim and kswapd activity. The figures are aggregate but it's known that the bad activity is throughout the entire test.
Note that simple streaming anon/file memory consumers also see this problem but it's not as obvious. In those cases, kswapd is awake when it should not be.
As there are at least two reclaim-related bugs out there, it's worth spelling out the user-visible impact. This patch only addresses bugs related to excessive reclaim on NUMA hardware when the working set is larger than a NUMA node. There is a bug related to high kswapd CPU usage but the reports are against laptops and other UMA hardware and is not addressed by this patch.
--- mm/migrate.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/migrate.c +1 -1
@@ -1578,7 +1578,7 @@ static struct page *alloc_misplaced_dst_ (GFP_HIGHUSER_MOVABLE | __GFP_THISNODE | __GFP_NOMEMALLOC | __GFP_NORETRY | __GFP_NOWARN) & - ~(__GFP_IO | __GFP_FS), 0); + ~__GFP_RECLAIM, 0);return newpage; }
Greg Kroah-Hartman
maintainerPATCH 120/342 vb2: fix a regression in poll() behavior for output,streams
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
commit 4623e5967448444a4ea1e77beb58898c4af48693 upstream.
In the 3.17 kernel the poll() behavior changed for output streams:
as long as not all buffers were queued up poll() would return that userspace can write. This is fine for the write() call, but when using stream I/O this changed the behavior since the expectation was that it would wait for buffers to become available for dequeuing.
This patch only enables the check whether you can queue buffers for file I/O only, and skips it for stream I/O.
--- drivers/media/v4l2-core/videobuf2-v4l2.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/media/v4l2-core/videobuf2-v4l2.c +3 -3
@@ -822,10 +822,10 @@ unsigned int vb2_poll(struct vb2_queue *return res |POLLERR ;/* -* For output streams you can write as long as there are fewer buffers -* queued than there are buffers available. +* For output streams you can call write() as long as there are fewer +* buffers queued than there are buffers available. */ -if (q->is_output && q->queued_count < q->num_buffers) +if (q->is_output && q->fileio && q->queued_count < q->num_buffers)return res |POLLOUT |POLLWRNORM ;if (list_empty (&q->done_list)) {
Greg Kroah-Hartman
maintainerPATCH 122/342 dm space map metadata: remove unused variable in brb_pop()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit 512167788a6fe9481a33a3cce5f80b684631a1bb upstream.
Remove the unused struct block_op pointer that was inadvertantly introduced, via cut-and-paste of previous brb_op() code, as part of commit 50dd842ad.
(Cc'ing stable@ because commit 50dd842ad did)
--- drivers/md/persistent-data/dm-space-map-metadata.c | 3 --- 1 file changed, 3 deletions(-)
drivers/md/persistent-data/dm-space-map-metadata.c +0 -3
@@ -152,12 +152,9 @@ static int brb_peek(struct bop_ring_buffstatic int brb_pop (struct bop_ring_buffer *brb) { -struct block_op *bop; -if (brb_empty (brb))return -ENODATA ; - bop = brb->bops + brb->begin; brb->begin =brb_next (brb, brb->begin);return 0 ;
Greg Kroah-Hartman
maintainerPATCH 124/342 dm: fix dm_rq_target_io leak on faults with .request_fn DM w/ blk-mq paths
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit 4328daa2e79ed904a42ce00a9f38b9c36b44b21a upstream.
Using request-based DM mpath configured with the following stacking (.request_fn DM mpath ontop of scsi-mq paths):
echo Y > /sys/module/scsi_mod/parameters/use_blk_mq echo N > /sys/module/dm_mod/parameters/use_blk_mq
'struct dm_rq_target_io' would leak if a request is requeued before a blk-mq clone is allocated (or fails to allocate). free_rq_tio() wasn't being called.
kmemleak reported:
unreferenced object 0xffff8800b90b98c0 (size 112):
comm "kworker/7:1H", pid 5692, jiffies 4295056109 (age 78.589s) hex dump (first 32 bytes):
00 d0 5c 2c 03 88 ff ff 40 00 bf 01 00 c9 ff ff ..\,....@.......
e0 d9 b1 34 00 88 ff ff 00 00 00 00 00 00 00 00 ...4............
backtrace:
[<ffffffff81672b6e>] kmemleak_alloc+0x4e/0xb0
[<ffffffff811dbb63>] kmem_cache_alloc+0xc3/0x1e0
[<ffffffff8117eae5>] mempool_alloc_slab+0x15/0x20
[<ffffffff8117ec1e>] mempool_alloc+0x6e/0x170
[<ffffffffa00029ac>] dm_old_prep_fn+0x3c/0x180 [dm_mod]
[<ffffffff812fbd78>] blk_peek_request+0x168/0x290
[<ffffffffa0003e62>] dm_request_fn+0xb2/0x1b0 [dm_mod]
[<ffffffff812f66e3>] __blk_run_queue+0x33/0x40
[<ffffffff812f9585>] blk_delay_work+0x25/0x40
[<ffffffff81096fff>] process_one_work+0x14f/0x3d0
[<ffffffff81097715>] worker_thread+0x125/0x4b0
[<ffffffff8109ce88>] kthread+0xd8/0xf0
[<ffffffff8167cb8f>] ret_from_fork+0x3f/0x70
[<ffffffffffffffff>] 0xffffffffffffffffcrash> struct -o dm_rq_target_io
struct dm_rq_target_io {
...
}SIZE: 112
--- drivers/md/dm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/md/dm.c +2 -0
@@ -1191,6 +1191,8 @@ static void dm_unprep_request(struct reqif (clone)free_rq_clone (clone); +else if (!tio->md->queue->mq_ops) +free_rq_tio (tio); }/*
Greg Kroah-Hartman
maintainerPATCH 83/342 genirq: Validate action before dereferencing it in handle_irq_event_percpu()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Gleixner <[email protected]>
commit 570540d50710ed192e98e2f7f74578c9486b6b05 upstream.
commit 71f64340fc0e changed the handling of irq_desc->action from
CPU 0 CPU 1
free_irq() lock(desc)
lock(desc) handle_edge_irq()
if (desc->action) {
handle_irq_event()
action = desc->action
unlock(desc)
desc->action = NULL handle_irq_event_percpu(desc, action)
action->xxxto
CPU 0 CPU 1
free_irq() lock(desc)
lock(desc) handle_edge_irq()
if (desc->action) {
handle_irq_event()
unlock(desc)
desc->action = NULL handle_irq_event_percpu(desc, action)
action = desc->action
action->xxxSo if free_irq manages to set the action to NULL between the unlock and before the readout, we happily dereference a null pointer.
We could simply revert 71f64340fc0e, but we want to preserve the better code generation. A simple solution is to change the action loop from a do {} while to a while {} loop.
This is safe because we either see a valid desc->action or NULL. If the action is about to be removed it is still valid as free_irq() is blocked on synchronize_irq().
CPU 0 CPU 1
free_irq() lock(desc)
lock(desc) handle_edge_irq()
handle_irq_event(desc)
set(INPROGRESS)
unlock(desc)
handle_irq_event_percpu(desc)
action = desc->action
desc->action = NULL while (action) {
action->xxx
...
action = action->next; sychronize_irq()
while(INPROGRESS); lock(desc)
clr(INPROGRESS)
free(action)
That's basically the same mechanism as we have for shared interrupts. action->next can become NULL while handle_irq_event_percpu() runs. Either it sees the action or NULL. It does not matter, because action itself cannot go away before the interrupt in progress flag has been cleared.
--- kernel/irq/handle.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
kernel/irq/handle.c +3 -2
@@ -138,7 +138,8 @@ irqreturn_t handle_irq_event_percpu(struunsigned int flags =0 , irq = desc->irq_data.irq;struct irqaction *action = desc->action; - do { +/* action might have become NULL since we dropped the lock */ +while (action) {irqreturn_t res;trace_irq_handler_entry (irq, action);
@@ -173,7 +174,7 @@ irqreturn_t handle_irq_event_percpu(stru retval |= res; action = action->next; - }while (action); + }add_interrupt_randomness (irq, flags);
Greg Kroah-Hartman
maintainerPATCH 85/342 s390/kvm: remove dependency on struct save_area definition
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
commit d9a3a09af54d01ab8b0c320580f4f95328d4a7ac upstream.
Replace the offsets based on the struct area_area with the offset constants from asm-offsets.c based on the struct _lowcore.
--- arch/s390/kernel/asm-offsets.c | 1 + arch/s390/kvm/kvm-s390.c | 30 +++++++++++++++--------------- 2 files changed, 16 insertions(+), 15 deletions(-)
arch/s390/kernel/asm-offsets.c +1 -0
@@ -181,6 +181,7 @@ int main(void)OFFSET (__LC_PSW_SAVE_AREA, _lowcore, psw_save_area);OFFSET (__LC_PREFIX_SAVE_AREA, _lowcore, prefixreg_save_area);OFFSET (__LC_FP_CREG_SAVE_AREA, _lowcore, fpt_creg_save_area); +OFFSET (__LC_TOD_PROGREG_SAVE_AREA, _lowcore, tod_progreg_save_area);OFFSET (__LC_CPU_TIMER_SAVE_AREA, _lowcore, cpu_timer_save_area);OFFSET (__LC_CLOCK_COMP_SAVE_AREA, _lowcore, clock_comp_save_area);OFFSET (__LC_AREGS_SAVE_AREA, _lowcore, access_regs_save_area);
arch/s390/kvm/kvm-s390.c +15 -15
@@ -2273,37 +2273,37 @@ int kvm_s390_store_status_unloaded(strucu64 clkcomp;int rc; + px =kvm_s390_get_prefix (vcpu);if (gpa ==KVM_S390_STORE_STATUS_NOADDR ) {if (write_guest_abs (vcpu,163 , &archmode,1 ))return -EFAULT ; - gpa =SAVE_AREA_BASE ; + gpa =0 ; }else if (gpa ==KVM_S390_STORE_STATUS_PREFIXED ) {if (write_guest_real (vcpu,163 , &archmode,1 ))return -EFAULT ; - gpa =kvm_s390_real_to_abs (vcpu,SAVE_AREA_BASE ); - } - rc =write_guest_abs (vcpu, gpa + offsetof(struct save_area , fp_regs), + gpa = px; + }else + gpa -= __LC_FPREGS_SAVE_AREA; + rc =write_guest_abs (vcpu, gpa + __LC_FPREGS_SAVE_AREA, vcpu->arch.guest_fpregs.fprs,128 ); - rc |=write_guest_abs (vcpu, gpa + offsetof(struct save_area , gp_regs), + rc |=write_guest_abs (vcpu, gpa + __LC_GPREGS_SAVE_AREA, vcpu->run->s.regs.gprs,128 ); - rc |=write_guest_abs (vcpu, gpa + offsetof(struct save_area , psw), + rc |=write_guest_abs (vcpu, gpa + __LC_PSW_SAVE_AREA, &vcpu->arch.sie_block->gpsw,16 ); - px =kvm_s390_get_prefix (vcpu); - rc |=write_guest_abs (vcpu, gpa + offsetof(struct save_area , pref_reg), + rc |=write_guest_abs (vcpu, gpa + __LC_PREFIX_SAVE_AREA, &px,4 ); - rc |=write_guest_abs (vcpu, - gpa + offsetof(struct save_area , fp_ctrl_reg), + rc |=write_guest_abs (vcpu, gpa + __LC_FP_CREG_SAVE_AREA, &vcpu->arch.guest_fpregs.fpc,4 ); - rc |=write_guest_abs (vcpu, gpa + offsetof(struct save_area , tod_reg), + rc |=write_guest_abs (vcpu, gpa + __LC_TOD_PROGREG_SAVE_AREA, &vcpu->arch.sie_block->todpr,4 ); - rc |=write_guest_abs (vcpu, gpa + offsetof(struct save_area , timer), + rc |=write_guest_abs (vcpu, gpa + __LC_CPU_TIMER_SAVE_AREA, &vcpu->arch.sie_block->cputm,8 ); clkcomp = vcpu->arch.sie_block->ckc >>8 ; - rc |=write_guest_abs (vcpu, gpa + offsetof(struct save_area , clk_cmp), + rc |=write_guest_abs (vcpu, gpa + __LC_CLOCK_COMP_SAVE_AREA, &clkcomp,8 ); - rc |=write_guest_abs (vcpu, gpa + offsetof(struct save_area , acc_regs), + rc |=write_guest_abs (vcpu, gpa + __LC_AREGS_SAVE_AREA, &vcpu->run->s.regs.acrs,64 ); - rc |=write_guest_abs (vcpu, gpa + offsetof(struct save_area , ctrl_regs), + rc |=write_guest_abs (vcpu, gpa + __LC_CREGS_SAVE_AREA, &vcpu->arch.sie_block->gcr,128 );return rc ? -EFAULT :0 ; }
Greg Kroah-Hartman
maintainerPATCH 86/342 KVM: s390: fix memory overwrites when vx is disabled
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Hildenbrand <[email protected]>
commit 9abc2a08a7d665b02bdde974fd6c44aae86e923e upstream.
The kernel now always uses vector registers when available, however KVM has special logic if support is really enabled for a guest. If support is disabled, guest_fpregs.fregs will only contain memory for the fpu. The kernel, however, will store vector registers into that area, resulting in crazy memory overwrites.
Simply extending that area is not enough, because the format of the registers also changes. We would have to do additional conversions, making the code even more complex. Therefore let's directly use one place for the vector/fpu registers + fpc (in kvm_run). We just have to convert the data properly when accessing it. This makes current code much easier.
Please note that vector/fpu registers are now always stored to vcpu->run->s.regs.vrs. Although this data is visible to QEMU and used for migration, we only guarantee valid values to user space when KVM_SYNC_VRS is set. As that is only the case when we have vector register support, we are on the safe side.
--- arch/s390/include/asm/kvm_host.h | 1 arch/s390/kvm/kvm-s390.c | 128 +++++++++++++-------------------------- 2 files changed, 43 insertions(+), 86 deletions(-)
arch/s390/include/asm/kvm_host.h +0 -1
@@ -506,7 +506,6 @@ struct kvm_vcpu_arch {struct kvm_s390_sie_block *sie_block;unsigned int host_acrs[NUM_ACRS ];struct fpu host_fpregs; -struct fpu guest_fpregs;struct kvm_s390_local_interrupt local_int;struct hrtimer ckc_timer;struct kvm_s390_pgm_info pgm;
arch/s390/kvm/kvm-s390.c +43 -85
209 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 84/342 clocksource/drivers/vt8500: Increase the minimum delta
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roman Volkov <[email protected]>
commit f9eccf24615672896dc13251410c3f2f33a14f95 upstream.
The vt8500 clocksource driver declares itself as capable to handle the minimum delay of 4 cycles by passing the value into clockevents_config_and_register(). The vt8500_timer_set_next_event() requires the passed cycles value to be at least 16. The impact is that userspace hangs in nanosleep() calls with small delay intervals.
This problem is reproducible in Linux 4.2 starting from:c6eb3f70d448 ('hrtimer: Get rid of hrtimer softirq')
Quoted 1 line
Quoted 1 line
From Russell King, more detailed explanation:
"It's a speciality of the StrongARM/PXA hardware. It takes a certain number of OSCR cycles for the value written to hit the compare registers. So, if a very small delta is written (eg, the compare register is written with a value of OSCR + 1), the OSCR will have incremented past this value before it hits the underlying hardware. The result is, that you end up waiting a very long time for the OSCR to wrap before the event fires.
So, we introduce a check in set_next_event() to detect this and return -ETIME if the calculated delta is too small, which causes the generic clockevents code to retry after adding the min_delta specified in clockevents_config_and_register() to the current time value.
min_delta must be sufficient that we don't re-trip the -ETIME check - if we do, we will return -ETIME, forward the next event time, try to set it, return -ETIME again, and basically lock the system up. So, min_delta must be larger than the check inside set_next_event(). A factor of two was chosen to ensure that this situation would never occur.
The PXA code worked on PXA systems for years, and I'd suggest no one changes this mechanism without access to a wide range of PXA systems, otherwise they're risking breakage."
--- drivers/clocksource/vt8500_timer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/clocksource/vt8500_timer.c +4 -2
@@ -50,6 +50,8 @@#define msecs_to_loops (t) (loops_per_jiffy / 1000 * HZ * t) +#define MIN_OSCR_DELTA 16 +static void __iomem *regbase;static cycle_t vt8500_timer_read (struct clocksource *cs)
@@ -80,7 +82,7 @@ static int vt8500_timer_set_next_event(ucpu_relax ();writel ((unsigned long )alarm, regbase +TIMER_MATCH_VAL ); -if ((signed )(alarm - clocksource.read (&clocksource)) <=16 ) +if ((signed )(alarm - clocksource.read (&clocksource)) <=MIN_OSCR_DELTA )return -ETIME ;writel (1 , regbase +TIMER_IER_VAL );
@@ -151,7 +153,7 @@ static void __init vt8500_timer_init(strpr_err ("%s: setup_irq failed for %s\n" , __func__, clockevent.name);clockevents_config_and_register (&clockevent,VT8500_TIMER_HZ , -4 ,0xf0000000 ); +MIN_OSCR_DELTA *2 ,0xf0000000 ); }CLOCKSOURCE_OF_DECLARE (vt8500,"via,vt8500-timer" , vt8500_timer_init);
Greg Kroah-Hartman
maintainerPATCH 87/342 Btrfs: add missing brelse when superblock checksum fails
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anand Jain <[email protected]>
commit b2acdddfad13c38a1e8b927d83c3cf321f63601a upstream.
Looks like oversight, call brelse() when checksum fails. Further down the code, in the non error path, we do call brelse() and so we don't see brelse() in the goto error paths.
--- fs/btrfs/disk-io.c | 1 + 1 file changed, 1 insertion(+)
fs/btrfs/disk-io.c +1 -0
@@ -2667,6 +2667,7 @@ int open_ctree(struct super_block *sb,if (btrfs_check_super_csum (bh->b_data)) {printk (KERN_ERR "BTRFS: superblock checksum mismatch\n" ); err = -EINVAL ; +brelse (bh); goto fail_alloc; }
Greg Kroah-Hartman
maintainerPATCH 29/342 ipv4: fix memory leaks in ip_cmsg_send() callers
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 919483096bfe75dda338e98d56da91a263746a0a ]
Dmitry reported memory leaks of IP options allocated in ip_cmsg_send() when/if this function returns an error.
Callers are responsible for the freeing.
Many thanks to Dmitry for the report and diagnostic.
--- net/ipv4/ip_sockglue.c | 2 ++ net/ipv4/ping.c | 4 +++- net/ipv4/raw.c | 4 +++- net/ipv4/udp.c | 4 +++- 4 files changed, 11 insertions(+), 3 deletions(-)
net/ipv4/ip_sockglue.c +2 -0
@@ -249,6 +249,8 @@ int ip_cmsg_send(struct net *net, structswitch (cmsg->cmsg_type) {case IP_RETOPTS : err = cmsg->cmsg_len -CMSG_ALIGN (sizeof (struct cmsghdr )); + +/* Our caller is responsible for freeing ipc->opt */ err =ip_options_get (net, &ipc->opt,CMSG_DATA (cmsg), err <40 ? err :40 );if (err)
net/ipv4/ping.c +3 -1
@@ -746,8 +746,10 @@ static int ping_v4_sendmsg(struct sock *if (msg->msg_controllen) { err =ip_cmsg_send (sock_net (sk), msg, &ipc, false); -if (err) +if (unlikely (err)) { +kfree (ipc.opt);return err; + }if (ipc.opt) free =1 ; }
net/ipv4/raw.c +3 -1
@@ -547,8 +547,10 @@ static int raw_sendmsg(struct sock *sk,if (msg->msg_controllen) { err =ip_cmsg_send (net, msg, &ipc, false); -if (err) +if (unlikely (err)) { +kfree (ipc.opt); goto out; + }if (ipc.opt) free =1 ; }
net/ipv4/udp.c +3 -1
@@ -966,8 +966,10 @@ int udp_sendmsg(struct sock *sk, structif (msg->msg_controllen) { err =ip_cmsg_send (sock_net (sk), msg, &ipc, sk->sk_family ==AF_INET6 ); -if (err) +if (unlikely (err)) { +kfree (ipc.opt);return err; + }if (ipc.opt) free =1 ; connected =0 ;
Greg Kroah-Hartman
maintainerPATCH 137/342 mmc: sdhci: Fix sdhci_runtime_pm_bus_on/off()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 5c671c410c8704800f4f1673b6f572137e7e6ddd upstream.
sdhci has a legacy facility to prevent runtime suspend if the bus power is on. This is needed in cases where the power to the card is dependent on the bus power. It is controlled by a pair of functions: sdhci_runtime_pm_bus_on() and sdhci_runtime_pm_bus_off(). These functions use a boolean variable 'bus_on' to ensure changes are always paired. There is an additional check for 'runtime_suspended' which is the problem. In fact, its use is ill-conceived as the only requirement for the logic is that 'on' and 'off' are paired, which is actually broken by the check, for example if the bus power is turned on during runtime resume. So remove the check.
--- drivers/mmc/host/sdhci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mmc/host/sdhci.c +2 -2
@@ -2763,7 +2763,7 @@ static int sdhci_runtime_pm_put(struct sstatic void sdhci_runtime_pm_bus_on (struct sdhci_host *host) { -if (host->runtime_suspended || host->bus_on) +if (host->bus_on)return ; host->bus_on = true;pm_runtime_get_noresume (host->mmc->parent);
@@ -2771,7 +2771,7 @@ static void sdhci_runtime_pm_bus_on(strustatic void sdhci_runtime_pm_bus_off (struct sdhci_host *host) { -if (host->runtime_suspended || !host->bus_on) +if (!host->bus_on)return ; host->bus_on = false;pm_runtime_put_noidle (host->mmc->parent);
Greg Kroah-Hartman
maintainerPATCH 11/342 tipc: fix connection abort during subscription cancel
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Parthasarathy Bhuvaragan <[email protected]>
[ Upstream commit 4d5cfcba2f6ec494d8810b9e3c0a7b06255c8067 ]
In 'commit 7fe8097cef5f ("tipc: fix nullpointer bug when subscribing to events")', we terminate the connection if the subscription creation fails.
In the same commit, the subscription creation result was based on the value of the subscription pointer (set in the function) instead of the return code.
Unfortunately, the same function tipc_subscrp_create() handles subscription cancel request. For a subscription cancellation request, the subscription pointer cannot be set. Thus if a subscriber has several subscriptions and cancels any of them, the connection is terminated.
In this commit, we terminate the connection based on the return value of tipc_subscrp_create().
--- net/tipc/subscr.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
net/tipc/subscr.c +5 -6
@@ -289,15 +289,14 @@ static void tipc_subscrb_rcv_cb(struct n struct sockaddr_tipc *addr, void *usr_data, void *buf, size_t len) { - struct tipc_subscriber *subscriber = usr_data; + struct tipc_subscriber *subscrb = usr_data;struct tipc_subscription *sub =NULL ;struct tipc_net *tn =net_generic (net, tipc_net_id); -tipc_subscrp_create (net, (struct tipc_subscr *)buf, subscriber, &sub); -if (sub) -tipc_nametbl_subscribe (sub); -else -tipc_conn_terminate (tn->topsrv, subscriber->conid); +if (tipc_subscrp_create (net, (struct tipc_subscr *)buf, subscrb, &sub)) +return tipc_conn_terminate (tn->topsrv, subscrb->conid); + +tipc_nametbl_subscribe (sub); }/* Handle one request to establish a new subscriber */
Greg Kroah-Hartman
maintainerPATCH 138/342 mmc: core: Enable tuning according to the actual timing
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carlo Caione <[email protected]>
commit e10c321977091f163eceedec0650e0ef4b3cf4bb upstream.
While in sdhci_execute_tuning() the choice whether or not to enable the tuning is done on the actual timing, in the mmc_sdio_init_uhs_card() the check is done on the capability of the card.
This difference is causing some issues with some SDIO cards in DDR50 mode where the CDM19 is wrongly issued.
With this patch we modify the check in both mmc_(sd|sdio)_init_uhs_card() functions to take the proper decision only according to the actual timing specification.
--- drivers/mmc/core/sd.c | 8 ++++---- drivers/mmc/core/sdio.c | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/mmc/core/sd.c +4 -4
@@ -626,9 +626,9 @@ static int mmc_sd_init_uhs_card(struct m* SDR104 mode SD-cards. Note that tuning is mandatory for SDR104. */ if (!mmc_host_is_spi (card->host) && - (card->sd_bus_speed ==UHS_SDR50_BUS_SPEED || - card->sd_bus_speed ==UHS_DDR50_BUS_SPEED || - card->sd_bus_speed ==UHS_SDR104_BUS_SPEED )) { + (card->host->ios.timing ==MMC_TIMING_UHS_SDR50 || + card->host->ios.timing ==MMC_TIMING_UHS_DDR50 || + card->host->ios.timing ==MMC_TIMING_UHS_SDR104 )) { err =mmc_execute_tuning (card);/*
@@ -638,7 +638,7 @@ static int mmc_sd_init_uhs_card(struct m* difference between v3.00 and 3.01 spec means that CMD19 * tuning is also available for DDR50 mode. */ -if (err && card->sd_bus_speed ==UHS_DDR50_BUS_SPEED ) { +if (err && card->host->ios.timing ==MMC_TIMING_UHS_DDR50 ) {pr_warn ("%s: ddr50 tuning failed\n" ,mmc_hostname (card->host)); err =0 ;
drivers/mmc/core/sdio.c +2 -2
@@ -535,8 +535,8 @@ static int mmc_sdio_init_uhs_card(struct* SDR104 mode SD-cards. Note that tuning is mandatory for SDR104. */ if (!mmc_host_is_spi (card->host) && - ((card->sw_caps.sd3_bus_mode &SD_MODE_UHS_SDR50 ) || - (card->sw_caps.sd3_bus_mode &SD_MODE_UHS_SDR104 ))) + ((card->host->ios.timing ==MMC_TIMING_UHS_SDR50 ) || + (card->host->ios.timing ==MMC_TIMING_UHS_SDR104 ))) err =mmc_execute_tuning (card); out:return err;
Greg Kroah-Hartman
maintainerPATCH 140/342 mmc: sdhci-acpi: Fix card detect race for Intel BXT/APL
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 6a645dd87a5a506779810d7d9935c25fc2ef4687 upstream.
Intel BXT/APL use a card detect GPIO however the host controller will not enable bus power unless it's card detect also reflects the presence of a card. Unfortunately those 2 things race which can result in commands not starting, after which the controller does nothing and there is a 10 second wait for the driver's 10-second timer to timeout.
That is fixed by having the driver look also at the present state register to determine if the card is present. Consequently, provide a 'get_cd' mmc host operation for BXT/APL that does that.
--- drivers/mmc/host/sdhci-acpi.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/mmc/host/sdhci-acpi.c +30 -0
@@ -146,6 +146,33 @@ static const struct sdhci_acpi_chip sdhc .ops = &sdhci_acpi_ops_int, }; +static int bxt_get_cd (struct mmc_host *mmc) +{ +int gpio_cd =mmc_gpio_get_cd (mmc); +struct sdhci_host *host =mmc_priv (mmc); +unsigned long flags; +int ret =0 ; + +if (!gpio_cd) +return 0 ; + +pm_runtime_get_sync (mmc->parent); + +spin_lock_irqsave (&host->lock, flags); + +if (host->flags &SDHCI_DEVICE_DEAD ) + goto out; + + ret = !!(sdhci_readl (host,SDHCI_PRESENT_STATE ) &SDHCI_CARD_PRESENT ); +out: +spin_unlock_irqrestore (&host->lock, flags); + +pm_runtime_mark_last_busy (mmc->parent); +pm_runtime_put_autosuspend (mmc->parent); + +return ret; +} +static int sdhci_acpi_emmc_probe_slot (struct platform_device *pdev,const char *hid,const char *uid) {
@@ -196,6 +223,9 @@ static int sdhci_acpi_sd_probe_slot(stru/* Platform specific code during sd probe slot goes here */ +if (hid && !strcmp (hid,"80865ACA" )) + host->mmc_host_ops.get_cd = bxt_get_cd; +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 142/342 mmc: sdhci-pci: Fix card detect race for Intel BXT/APL
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 163cbe31e5163459908a41a2b4e0d33a28fd557a upstream.
Intel BXT/APL use a card detect GPIO however the host controller will not enable bus power unless it's card detect also reflects the presence of a card. Unfortunately those 2 things race which can result in commands not starting, after which the controller does nothing and there is a 10 second wait for the driver's 10-second timer to timeout.
That is fixed by having the driver look also at the present state register to determine if the card is present. Consequently, provide a 'get_cd' mmc host operation for BXT/APL that does that.
--- drivers/mmc/host/sdhci-pci-core.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+)
drivers/mmc/host/sdhci-pci-core.c +31 -0
@@ -330,6 +330,33 @@ static void spt_read_drive_strength(stru sdhci_pci_spt_drive_strength =0x10 | ((val >>12 ) &0xf ); } +static int bxt_get_cd (struct mmc_host *mmc) +{ +int gpio_cd =mmc_gpio_get_cd (mmc); +struct sdhci_host *host =mmc_priv (mmc); +unsigned long flags; +int ret =0 ; + +if (!gpio_cd) +return 0 ; + +pm_runtime_get_sync (mmc->parent); + +spin_lock_irqsave (&host->lock, flags); + +if (host->flags &SDHCI_DEVICE_DEAD ) + goto out; + + ret = !!(sdhci_readl (host,SDHCI_PRESENT_STATE ) &SDHCI_CARD_PRESENT ); +out: +spin_unlock_irqrestore (&host->lock, flags); + +pm_runtime_mark_last_busy (mmc->parent); +pm_runtime_put_autosuspend (mmc->parent); + +return ret; +} +static int byt_emmc_probe_slot (struct sdhci_pci_slot *slot) { slot->host->mmc->caps |= MMC_CAP_8_BIT_DATA | MMC_CAP_NONREMOVABLE |
@@ -362,6 +389,10 @@ static int byt_sd_probe_slot(struct sdhc slot->cd_con_id =NULL ; slot->cd_idx =0 ; slot->cd_override_level = true; +if (slot->chip->pdev->device ==PCI_DEVICE_ID_INTEL_BXT_SD || + slot->chip->pdev->device ==PCI_DEVICE_ID_INTEL_APL_SD ) + slot->host->mmc_host_ops.get_cd = bxt_get_cd; +return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 144/342 mmc: sdhci: Allow override of get_cd() called from sdhci_request()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 8d28b7a72fe18bcdcdb047243ba8fec36b149955 upstream.
Drivers may need to provide their own get_cd() mmc host op, but currently the internals of the current op (sdhci_get_cd()) are provided by sdhci_do_get_cd() which is also called from sdhci_request().
To allow override of the get_cd functionality, change sdhci_request() to call ->get_cd() instead of sdhci_do_get_cd().
Note, in the future the call to ->get_cd() will likely be removed from sdhci_request() since most drivers don't need actually it. However this change is being done now to facilitate a subsequent bug fix.
--- drivers/mmc/host/sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +1 -1
@@ -1367,7 +1367,7 @@ static void sdhci_request(struct mmc_hossdhci_runtime_pm_get (host);/* Firstly check card presence */ - present =sdhci_do_get_cd (host); + present = mmc->ops->get_cd (mmc);spin_lock_irqsave (&host->lock, flags);
Greg Kroah-Hartman
maintainerPATCH 128/342 irqchip/atmel-aic: Fix wrong bit operation for IRQ priority
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Milo Kim <[email protected]>
commit 49f34134aea74f19ca016f055d25ee55ec359dee upstream.
Atmel AIC has common structure for SMR (Source Mode Register).
bit[6:5] Interrupt source type
bit[2:0] Priority level
Other bits are unused.
To update new priority value, bit[2:0] should be cleared first and then new priority level can be written. However, aic_common_set_priority() helper clears source type bits instead of priority bits. This patch fixes wrong mask bit operation.
--- drivers/irqchip/irq-atmel-aic-common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/irqchip/irq-atmel-aic-common.c +1 -1
@@ -86,7 +86,7 @@ int aic_common_set_priority(int priority priority > AT91_AIC_IRQ_MAX_PRIORITY)return -EINVAL ; - *val &=AT91_AIC_PRIOR ; + *val &= ~AT91_AIC_PRIOR ; *val |= priority;return 0 ;
Greg Kroah-Hartman
maintainerPATCH 146/342 Drivers: hv: vmbus: Fix a Host signaling bug
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: K. Y. Srinivasan <[email protected]>
commit 8599846d73997cdbccf63f23394d871cfad1e5e6 upstream.
Currently we have two policies for deciding when to signal the host:
One based on the ring buffer state and the other based on what the VMBUS client driver wants to do. Consider the case when the client wants to explicitly control when to signal the host. In this case, if the client were to defer signaling, we will not be able to signal the host subsequently when the client does want to signal since the ring buffer state will prevent the signaling. Implement logic to have only one signaling policy in force for a given channel.
--- drivers/hv/channel.c | 18 ++++++++++++++++++ include/linux/hyperv.h | 18 ++++++++++++++++++ 2 files changed, 36 insertions(+)
drivers/hv/channel.c +18 -0
@@ -630,10 +630,19 @@ int vmbus_sendpacket_ctl(struct vmbus_ch* on the ring. We will not signal if more data is * to be placed. * +* Based on the channel signal state, we will decide +* which signaling policy will be applied. +* * If we cannot write to the ring-buffer; signal the host * even if we may not have written anything. This is a rare * enough condition that it should not matter. */ + +if (channel->signal_policy) + signal = true; +else + kick_q = true; +if (((ret ==0 ) && kick_q && signal) || (ret))vmbus_setevent (channel);
@@ -733,10 +742,19 @@ int vmbus_sendpacket_pagebuffer_ctl(stru* on the ring. We will not signal if more data is * to be placed. * +* Based on the channel signal state, we will decide +* which signaling policy will be applied. +* * If we cannot write to the ring-buffer; signal the host * even if we may not have written anything. This is a rare * enough condition that it should not matter. */ + +if (channel->signal_policy) + signal = true; +else + kick_q = true; +if (((ret ==0 ) && kick_q && signal) || (ret))vmbus_setevent (channel);
include/linux/hyperv.h +18 -0
@@ -630,6 +630,11 @@ struct hv_input_signal_event_buffer {struct hv_input_signal_event event; }; +enum hv_signal_policy { +HV_SIGNAL_POLICY_DEFAULT =0 , +HV_SIGNAL_POLICY_EXPLICIT , +}; +struct vmbus_channel {/* Unique channel id */ int id;
@@ -757,8 +762,21 @@ struct vmbus_channel {* link up channels based on their CPU affinity. */ struct list_head percpu_list; +/* +* Host signaling policy: The default policy will be +* based on the ring buffer state. We will also support +* a policy where the client driver can have explicit +* signaling control. +*/ +enum hv_signal_policy signal_policy; }; +static inline void set_channel_signal_state (struct vmbus_channel *c, +enum hv_signal_policy policy) +{ + c->signal_policy = policy; +} +static inline void set_channel_read_state (struct vmbus_channel *c,bool state) { c->batched_reading = state;
Greg Kroah-Hartman
maintainerPATCH 147/342 Bluetooth: Use continuous scanning when creating LE connections
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hedberg <[email protected]>
commit 2f99536a5b34d5b0f54723067d68f6cef3f0fdc6 upstream.
All LE connections are now triggered through a preceding passive scan and waiting for a connectable advertising report. This means we've got the best possible guarantee that the device is within range and should be able to request the controller to perform continuous scanning. This way we minimize the risk that we miss out on any advertising packets.
--- net/bluetooth/hci_conn.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
net/bluetooth/hci_conn.c +5 -1
@@ -722,8 +722,12 @@ static void hci_req_add_le_create_conn(sif (hci_update_random_address (req, false, &own_addr_type))return ; +/* Set window to be the same value as the interval to enable +* continuous scanning. +*/ cp.scan_interval =cpu_to_le16 (hdev->le_scan_interval); - cp.scan_window =cpu_to_le16 (hdev->le_scan_window); + cp.scan_window = cp.scan_interval; +bacpy (&cp.peer_addr, &conn->dst); cp.peer_addr_type = conn->dst_type; cp.own_address_type = own_addr_type;
Greg Kroah-Hartman
maintainerPATCH 148/342 Bluetooth: Add support of Toshiba Broadcom based devices
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Tunin <[email protected]>
commit 1623d0bf847d3b38d8cf24367b3689ba0e3fe2aa upstream.
T: Bus=03 Lev=02 Prnt=02 Port=05 Cnt=02 Dev#= 4 Spd=12 MxCh= 0
D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
P: Vendor=0930 ProdID=0225 Rev=01.12
S: Manufacturer=Broadcom Corp
S: Product=BCM43142A0
S: SerialNumber=4CBB58034671
C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)--- drivers/bluetooth/btusb.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/bluetooth/btusb.c +4 -0
@@ -153,6 +153,10 @@ static const struct usb_device_id btusb_ { USB_VENDOR_AND_INTERFACE_INFO(0x13d3, 0xff, 0x01, 0x01), .driver_info = BTUSB_BCM_PATCHRAM }, + /* Toshiba Corp - Broadcom based */ + { USB_VENDOR_AND_INTERFACE_INFO(0x0930, 0xff, 0x01, 0x01), + .driver_info = BTUSB_BCM_PATCHRAM }, + /* Intel Bluetooth USB Bootloader (RAM module) */ { USB_DEVICE(0x8087, 0x0a5a), .driver_info = BTUSB_INTEL_BOOT | BTUSB_BROKEN_ISOC },
Greg Kroah-Hartman
maintainerPATCH 149/342 Bluetooth: Fix incorrect removing of IRKs
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hedberg <[email protected]>
commit cff10ce7b4f02718ffd25e3914e60559f5ef6ca0 upstream.
The commit cad20c278085d893ebd616cd20c0747a8e9d53c7 was supposed to fix handling of devices first using public addresses and then switching to RPAs after pairing. Unfortunately it missed a couple of key places in the code.
1. When evaluating which devices should be removed from the existing white list we also need to consider whether we have an IRK for them or not, i.e. a call to hci_find_irk_by_addr() is needed.
2. In smp_notify_keys() we should not be requiring the knowledge of the RPA, but should simply keep the IRK around if the other conditions require it.
--- net/bluetooth/hci_request.c | 28 ++++++++++++++++++---------- net/bluetooth/smp.c | 16 ---------------- 2 files changed, 18 insertions(+), 26 deletions(-)
net/bluetooth/hci_request.c +18 -10
@@ -175,21 +175,29 @@ static u8 update_white_list(struct hci_r* command to remove it from the controller. */ list_for_each_entry (b, &hdev->le_white_list, list) { -struct hci_cp_le_del_from_white_list cp; +/* If the device is neither in pend_le_conns nor +* pend_le_reports then remove it from the whitelist. +*/ +if (!hci_pend_le_action_lookup (&hdev->pend_le_conns, + &b->bdaddr, b->bdaddr_type) && + !hci_pend_le_action_lookup (&hdev->pend_le_reports, + &b->bdaddr, b->bdaddr_type)) { +struct hci_cp_le_del_from_white_list cp; -if (hci_pend_le_action_lookup (&hdev->pend_le_conns, - &b->bdaddr, b->bdaddr_type) || -hci_pend_le_action_lookup (&hdev->pend_le_reports, - &b->bdaddr, b->bdaddr_type)) { - white_list_entries++; + cp.bdaddr_type = b->bdaddr_type; +bacpy (&cp.bdaddr, &b->bdaddr); + +hci_req_add (req,HCI_OP_LE_DEL_FROM_WHITE_LIST , +sizeof (cp), &cp);continue ; } - cp.bdaddr_type = b->bdaddr_type; -bacpy (&cp.bdaddr, &b->bdaddr); +if (hci_find_irk_by_addr (hdev, &b->bdaddr, b->bdaddr_type)) { +/* White list can not be used with RPAs */ +return 0x00 ; + } -hci_req_add (req,HCI_OP_LE_DEL_FROM_WHITE_LIST , -sizeof (cp), &cp); + white_list_entries++; }/* Since all no longer valid white list entries have been
net/bluetooth/smp.c +0 -16
@@ -1072,22 +1072,6 @@ static void smp_notify_keys(struct l2cap hcon->dst_type = smp->remote_irk->addr_type;queue_work (hdev->workqueue, &conn->id_addr_update_work); } - -/* When receiving an indentity resolving key for -* a remote device that does not use a resolvable -* private address, just remove the key so that -* it is possible to use the controller white -* list for scanning. -* -* Userspace will have been told to not store -* this key at this point. So it is safe to -* just remove it. -*/ -if (!bacmp (&smp->remote_irk->rpa,BDADDR_ANY )) { -list_del_rcu (&smp->remote_irk->list); -kfree_rcu (smp->remote_irk, rcu); - smp->remote_irk =NULL ; - } }if (smp->csrk) {
Greg Kroah-Hartman
maintainerPATCH 150/342 Bluetooth: 6lowpan: Fix kernel NULL pointer dereferences
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Glenn Ruben Bakke <[email protected]>
commit 4c58f3282e3de43d34f8955f8eca676294380bf9 upstream.
The fixes provided in this patch assigns a valid net_device structure to skb before dispatching it for further processing.
Scenario #1:
============
Bluetooth 6lowpan receives an uncompressed IPv6 header, and dispatches it to netif. The following error occurs:
Null pointer dereference error #1 crash log:
[ 845.854013] BUG: unable to handle kernel NULL pointer dereference at
0000000000000048
[ 845.855785] IP: [<ffffffff816e3d36>] enqueue_to_backlog+0x56/0x240
...
[ 845.909459] Call Trace:
[ 845.911678] [<ffffffff816e3f64>] netif_rx_internal+0x44/0xf0The first modification fixes the NULL pointer dereference error by assigning dev to the local_skb in order to set a valid net_device before processing the skb by netif_rx_ni().
Scenario #2:
============
Bluetooth 6lowpan receives an UDP compressed message which needs further decompression by nhc_udp. The following error occurs:
Null pointer dereference error #2 crash log:
[ 63.295149] BUG: unable to handle kernel NULL pointer dereference at
0000000000000840
[ 63.295931] IP: [<ffffffffc0559540>] udp_uncompress+0x320/0x626
[nhc_udp]The second modification fixes the NULL pointer dereference error by assigning dev to the local_skb in the case of a udp compressed packet. The 6lowpan udp_uncompress function expects that the net_device is set in the skb when checking lltype.
--- net/bluetooth/6lowpan.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/bluetooth/6lowpan.c +3 -1
@@ -317,6 +317,7 @@ static int recv_pkt(struct sk_buff *skb, local_skb->protocol =htons (ETH_P_IPV6 ); local_skb->pkt_type =PACKET_HOST ; + local_skb->dev = dev;skb_set_transport_header (local_skb,sizeof (struct ipv6hdr ));
@@ -335,6 +336,8 @@ static int recv_pkt(struct sk_buff *skb,if (!local_skb) goto drop; + local_skb->dev = dev; + ret =iphc_decompress (local_skb, dev, chan);if (ret <0 ) {kfree_skb (local_skb);
@@ -343,7 +346,6 @@ static int recv_pkt(struct sk_buff *skb, local_skb->protocol =htons (ETH_P_IPV6 ); local_skb->pkt_type =PACKET_HOST ; - local_skb->dev = dev;if (give_skb_to_upper (local_skb, dev) !=NET_RX_SUCCESS ) {
Greg Kroah-Hartman
maintainerPATCH 13/342 switchdev: Require RTNL mutex to be held when sending FDB notifications
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ido Schimmel <[email protected]>
[ Upstream commit 4f2c6ae5c64c353fb1b0425e4747e5603feadba1 ]
When switchdev drivers process FDB notifications from the underlying device they resolve the netdev to which the entry points to and notify the bridge using the switchdev notifier.
However, since the RTNL mutex is not held there is nothing preventing the netdev from disappearing in the middle, which will cause br_switchdev_event() to dereference a non-existing netdev.
Make switchdev drivers hold the lock at the beginning of the notification processing session and release it once it ends, after notifying the bridge.
Also, remove switchdev_mutex and fdb_lock, as they are no longer needed when RTNL mutex is held.
--- drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c | 3 +++ drivers/net/ethernet/rocker/rocker.c | 2 ++ net/bridge/br.c | 3 +-- net/switchdev/switchdev.c | 15 ++++++++------- 4 files changed, 14 insertions(+), 9 deletions(-)
drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c +3 -0
@@ -45,6 +45,7 @@#include <linux/if_bridge.h> #include <linux/workqueue.h> #include <linux/jiffies.h> +#include <linux/rtnetlink.h> #include <net/switchdev.h> #include "spectrum.h"
@@ -812,6 +813,7 @@ static void mlxsw_sp_fdb_notify_work(str mlxsw_sp = container_of(work, struct mlxsw_sp, fdb_notify.dw.work); +rtnl_lock (); do { mlxsw_reg_sfn_pack(sfn_pl); err = mlxsw_reg_query(mlxsw_sp->core, MLXSW_REG(sfn), sfn_pl);
@@ -824,6 +826,7 @@ static void mlxsw_sp_fdb_notify_work(strmlxsw_sp_fdb_notify_rec_process (mlxsw_sp, sfn_pl, i); }while (num_rec); +rtnl_unlock ();kfree (sfn_pl);mlxsw_sp_fdb_notify_work_schedule (mlxsw_sp);
drivers/net/ethernet/rocker/rocker.c +2 -0
@@ -3531,12 +3531,14 @@ static void rocker_port_fdb_learn_work(s info.addr = lw->addr; info.vid = lw->vid; +rtnl_lock ();if (learned && removing)call_switchdev_notifiers (SWITCHDEV_FDB_DEL , lw->rocker_port->dev, &info.info);else if (learned && !removing)call_switchdev_notifiers (SWITCHDEV_FDB_ADD , lw->rocker_port->dev, &info.info); +rtnl_unlock ();rocker_port_kfree (lw->trans, work); }
net/bridge/br.c +1 -2
@@ -121,6 +121,7 @@ static struct notifier_block br_device_n .notifier_call = br_device_event }; +/* called with RTNL */ static int br_switchdev_event (struct notifier_block *unused,unsigned long event,void *ptr) {
@@ -130,7 +131,6 @@ static int br_switchdev_event(struct notstruct switchdev_notifier_fdb_info *fdb_info;int err =NOTIFY_DONE ; -rtnl_lock (); p =br_port_get_rtnl (dev);if (!p) goto out;
@@ -155,7 +155,6 @@ static int br_switchdev_event(struct not } out: -rtnl_unlock ();return err; }
net/switchdev/switchdev.c +8 -7
@@ -20,6 +20,7 @@#include <linux/list.h> #include <linux/workqueue.h> #include <linux/if_vlan.h> +#include <linux/rtnetlink.h> #include <net/ip_fib.h> #include <net/switchdev.h>
@@ -565,7 +566,6 @@ int switchdev_port_obj_dump(struct net_d }EXPORT_SYMBOL_GPL (switchdev_port_obj_dump); -static DEFINE_MUTEX (switchdev_mutex);static RAW_NOTIFIER_HEAD (switchdev_notif_chain);/**
@@ -580,9 +580,9 @@ int register_switchdev_notifier(struct n {int err; -mutex_lock (&switchdev_mutex); +rtnl_lock (); err =raw_notifier_chain_register (&switchdev_notif_chain, nb); -mutex_unlock (&switchdev_mutex); +rtnl_unlock ();return err; }EXPORT_SYMBOL_GPL (register_switchdev_notifier);
@@ -598,9 +598,9 @@ int unregister_switchdev_notifier(struct {int err; -mutex_lock (&switchdev_mutex); +rtnl_lock (); err =raw_notifier_chain_unregister (&switchdev_notif_chain, nb); -mutex_unlock (&switchdev_mutex); +rtnl_unlock ();return err; }EXPORT_SYMBOL_GPL (unregister_switchdev_notifier);
@@ -614,16 +614,17 @@ EXPORT_SYMBOL_GPL(unregister_switchdev_n* Call all network notifier blocks. This should be called by driver * when it needs to propagate hardware event. * Return values are same as for atomic_notifier_call_chain(). +* rtnl_lock must be held. */ int call_switchdev_notifiers (unsigned long val,struct net_device *dev,struct switchdev_notifier_info *info) {int err; +ASSERT_RTNL (); + info->dev = dev; -mutex_lock (&switchdev_mutex); err =raw_notifier_call_chain (&switchdev_notif_chain, val, info); -mutex_unlock (&switchdev_mutex);return err; }EXPORT_SYMBOL_GPL (call_switchdev_notifiers);
Greg Kroah-Hartman
maintainerPATCH 152/342 time: Avoid signed overflow in timekeeping_get_ns()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Gibson <[email protected]>
commit 35a4933a895927990772ae96fdcfd2f806929ee2 upstream.
1e75fa8 "time: Condense timekeeper.xtime into xtime_sec" replaced a call to clocksource_cyc2ns() from timekeeping_get_ns() with an open-coded version of the same logic to avoid keeping a semi-redundant struct timespec in struct timekeeper.
However, the commit also introduced a subtle semantic change - where clocksource_cyc2ns() uses purely unsigned math, the new version introduces a signed temporary, meaning that if (delta * tk->mult) has a 63-bit overflow the following shift will still give a negative result. The choice of 'maxsec' in __clocksource_updatefreq_scale() means this will generally happen if there's a ~10 minute pause in examining the clocksource.
This can be triggered on a powerpc KVM guest by stopping it from qemu for a bit over 10 minutes. After resuming time has jumped backwards several minutes causing numerous problems (jiffies does not advance, msleep()s can be extended by minutes..). It doesn't happen on x86 KVM guests, because the guest TSC is effectively frozen while the guest is stopped, which is not the case for the powerpc timebase.
Obviously an unsigned (64 bit) overflow will only take twice as long as a signed, 63-bit overflow. I don't know the time code well enough to know if that will still cause incorrect calculations, or if a 64-bit overflow is avoided elsewhere.
Still, an incorrect forwards clock adjustment will cause less trouble than time going backwards. So, this patch removes the potential for intermediate signed overflow.
--- kernel/time/timekeeping.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
kernel/time/timekeeping.c +1 -2
@@ -305,8 +305,7 @@ static inline s64 timekeeping_get_ns(str delta =timekeeping_get_delta (tkr); - nsec = delta * tkr->mult + tkr->xtime_nsec; - nsec >>= tkr->shift; + nsec = (delta * tkr->mult + tkr->xtime_nsec) >> tkr->shift;/* If arch requires, add in get_arch_timeoffset() */ return nsec +arch_gettimeoffset ();
Greg Kroah-Hartman
maintainerPATCH 153/342 cputime: Prevent 32bit overflow in time[val|spec]_to_cputime()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: zengtao <[email protected]>
commit 0f26922fe5dc5724b1adbbd54b21bad03590b4f3 upstream.
The datatype __kernel_time_t is u32 on 32bit platform, so its subject to overflows in the timeval/timespec to cputime conversion.
Currently the following functions are affected:
1. setitimer()
2. timer_create/timer_settime()
3. sys_clock_nanosleep
This can happen on MIPS32 and ARM32 with "Full dynticks CPU time accounting" enabled, which is required for CONFIG_NO_HZ_FULL.
Enforce u64 conversion to prevent the overflow.
--- include/asm-generic/cputime_nsecs.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
include/asm-generic/cputime_nsecs.h +3 -2
@@ -75,7 +75,7 @@ typedef u64 __nocast cputime64_t;*/ static inline cputime_t timespec_to_cputime (const struct timespec *val) { -u64 ret = val->tv_sec *NSEC_PER_SEC + val->tv_nsec; +u64 ret = (u64 )val->tv_sec *NSEC_PER_SEC + val->tv_nsec;return (__force cputime_t ) ret; }static inline void cputime_to_timespec (const cputime_t ct,struct timespec *val)
@@ -91,7 +91,8 @@ static inline void cputime_to_timespec(c*/ static inline cputime_t timeval_to_cputime (const struct timeval *val) { -u64 ret = val->tv_sec *NSEC_PER_SEC + val->tv_usec *NSEC_PER_USEC ; +u64 ret = (u64 )val->tv_sec *NSEC_PER_SEC + + val->tv_usec *NSEC_PER_USEC ;return (__force cputime_t ) ret; }static inline void cputime_to_timeval (const cputime_t ct,struct timeval *val)
Greg Kroah-Hartman
maintainerPATCH 156/342 MIPS: hpet: Choose a safe value for the ETIME check
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 5610b1254e3689b6ef8ebe2db260709a74da06c8 upstream.
This patch is borrowed from x86 hpet driver and explaind below:
Due to the overly intelligent design of HPETs, we need to workaround the problem that the compare value which we write is already behind the actual counter value at the point where the value hits the real compare register. This happens for two reasons:
1) We read out the counter, add the delta and write the result to the compare register. When a NMI hits between the read out and the write then the counter can be ahead of the event already.
2) The write to the compare register is delayed by up to two HPET cycles in AMD chipsets.
We can work around this by reading back the compare register to make sure that the written value has hit the hardware. But that is bad performance wise for the normal case where the event is far enough in the future.
As we already know that the write can be delayed by up to two cycles we can avoid the read back of the compare register completely if we make the decision whether the delta has elapsed already or not based on the following calculation:
cmp = event - actual_count;
If cmp is less than 64 HPET clock cycles, then we decide that the event has happened already and return -ETIME. That covers the above #1 and #2 problems which would cause a wait for HPET wraparound (~306 seconds).
Patchwork: https://patchwork.linux-mips.org/patch/12162/
--- arch/mips/loongson64/loongson-3/hpet.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
arch/mips/loongson64/loongson-3/hpet.c +7 -3
@@ -13,6 +13,9 @@#define SMBUS_PCI_REG64 0x64#define SMBUS_PCI_REGB4 0xb4 +#define HPET_MIN_CYCLES 64 +#define HPET_MIN_PROG_DELTA (HPET_MIN_CYCLES + (HPET_MIN_CYCLES >> 1)) +static DEFINE_SPINLOCK (hpet_lock); DEFINE_PER_CPU(struct clock_event_device, hpet_clockevent_device);
@@ -161,8 +164,9 @@ static int hpet_next_event(unsigned long cnt += delta;hpet_write (HPET_T0_CMP , cnt); - res = ((int )(hpet_read (HPET_COUNTER ) - cnt) >0 ) ? -ETIME :0 ; -return res; + res = (int )(cnt -hpet_read (HPET_COUNTER )); + +return res <HPET_MIN_CYCLES ? -ETIME :0 ; }static irqreturn_t hpet_irq_handler (int irq,void *data)
@@ -237,7 +241,7 @@ void __init setup_hpet_timer(void) cd->cpumask =cpumask_of (cpu);clockevent_set_clock (cd,HPET_FREQ ); cd->max_delta_ns =clockevent_delta2ns (0x7fffffff , cd); - cd->min_delta_ns =5000 ; + cd->min_delta_ns =clockevent_delta2ns (HPET_MIN_PROG_DELTA , cd);clockevents_register_device (cd);setup_irq (HPET_T0_IRQ , &hpet_irq);
Greg Kroah-Hartman
maintainerPATCH 15/342 ipv6: enforce flowi6_oif usage in ip6_dst_lookup_tail()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit 6f21c96a78b835259546d8f3fb4edff0f651d478 ]
The current implementation of ip6_dst_lookup_tail basically ignore the egress ifindex match: if the saddr is set, ip6_route_output() purposefully ignores flowi6_oif, due to the commit d46a9d678e4c ("net: ipv6: Dont add RT6_LOOKUP_F_IFACE flag if saddr set"), if the saddr is 'any' the first route lookup in ip6_dst_lookup_tail fails, but upon failure a second lookup will be performed with saddr set, thus ignoring the ifindex constraint.
This commit adds an output route lookup function variant, which allows the caller to specify lookup flags, and modify ip6_dst_lookup_tail() to enforce the ifindex match on the second lookup via said helper.
ip6_route_output() becames now a static inline function build on top of ip6_route_output_flags(); as a side effect, out-of-tree modules need now a GPL license to access the output route lookup functionality.
--- include/net/ip6_route.h | 12 ++++++++++-- net/ipv6/ip6_output.c | 6 +++++- net/ipv6/route.c | 7 +++---- 3 files changed, 18 insertions(+), 7 deletions(-)
include/net/ip6_route.h +10 -2
@@ -64,8 +64,16 @@ static inline bool rt6_need_strict(constvoid ip6_route_input (struct sk_buff *skb); -struct dst_entry *ip6_route_output (struct net *net,const struct sock *sk, -struct flowi6 *fl6); +struct dst_entry *ip6_route_output_flags (struct net *net,const struct sock *sk, +struct flowi6 *fl6,int flags); + +static inline struct dst_entry *ip6_route_output (struct net *net, +const struct sock *sk, +struct flowi6 *fl6) +{ +return ip6_route_output_flags (net, sk, fl6,0 ); +} +struct dst_entry *ip6_route_lookup (struct net *net,struct flowi6 *fl6,int flags);
net/ipv6/ip6_output.c +5 -1
@@ -909,6 +909,7 @@ static int ip6_dst_lookup_tail(struct nestruct rt6_info *rt;#endif int err; +int flags =0 ;/* The correct way to handle this would be to do * ip6_route_get_saddr, and then ip6_route_output; however,
@@ -940,10 +941,13 @@ static int ip6_dst_lookup_tail(struct nedst_release (*dst); *dst =NULL ; } + +if (fl6->flowi6_oif) + flags |=RT6_LOOKUP_F_IFACE ; }if (!*dst) - *dst =ip6_route_output (net, sk, fl6); + *dst =ip6_route_output_flags (net, sk, fl6, flags); err = (*dst)->error;if (err)
net/ipv6/route.c +3 -4
@@ -1174,11 +1174,10 @@ static struct rt6_info *ip6_pol_route_oureturn ip6_pol_route (net, table, fl6->flowi6_oif, fl6, flags); } -struct dst_entry *ip6_route_output (struct net *net,const struct sock *sk, -struct flowi6 *fl6) +struct dst_entry *ip6_route_output_flags (struct net *net,const struct sock *sk, +struct flowi6 *fl6,int flags) {struct dst_entry *dst; -int flags =0 ;bool any_src; dst =l3mdev_rt6_dst_by_oif (net, fl6);
@@ -1199,7 +1198,7 @@ struct dst_entry *ip6_route_output(strucreturn fib6_rule_lookup (net, fl6, flags, ip6_pol_route_output); } -EXPORT_SYMBOL (ip6_route_output); +EXPORT_SYMBOL_GPL (ip6_route_output_flags);struct dst_entry *ip6_blackhole_route (struct net *net,struct dst_entry *dst_orig) {
Greg Kroah-Hartman
maintainerPATCH 157/342 MIPS: Fix some missing CONFIG_CPU_MIPSR6 #ifdefs
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 4f33f6c522948fffc345261896042b58dea23754 upstream.
Commit be0c37c985eddc4 (MIPS: Rearrange PTE bits into fixed positions.) defines fixed PTE bits for MIPS R2. Then, commit d7b631419b3d230a4d383 (MIPS: pgtable-bits: Fix XPA damage to R6 definitions.) adds the MIPS R6 definitions in the same way as MIPS R2. But some R6 #ifdefs in the later commit are missing, so in this patch I fix that.
Patchwork: https://patchwork.linux-mips.org/patch/12164/
--- arch/mips/include/asm/pgtable.h | 4 ++-- arch/mips/mm/tlbex.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
arch/mips/include/asm/pgtable.h +2 -2
@@ -353,7 +353,7 @@ static inline pte_t pte_mkdirty(pte_t ptstatic inline pte_t pte_mkyoung (pte_t pte) {pte_val (pte) |= _PAGE_ACCESSED; -#ifdef CONFIG_CPU_MIPSR2 +#if defined(CONFIG_CPU_MIPSR2 ) || defined(CONFIG_CPU_MIPSR6 )if (!(pte_val (pte) & _PAGE_NO_READ))pte_val (pte) |= _PAGE_SILENT_READ;else
@@ -560,7 +560,7 @@ static inline pmd_t pmd_mkyoung(pmd_t pm {pmd_val (pmd) |= _PAGE_ACCESSED; -#ifdef CONFIG_CPU_MIPSR2 +#if defined(CONFIG_CPU_MIPSR2 ) || defined(CONFIG_CPU_MIPSR6 )if (!(pmd_val (pmd) & _PAGE_NO_READ))pmd_val (pmd) |= _PAGE_SILENT_READ;else
arch/mips/mm/tlbex.c +1 -1
@@ -242,7 +242,7 @@ static void output_pgtable_bits_defines(pr_define ("_PAGE_HUGE_SHIFT %d\n" , _PAGE_HUGE_SHIFT);pr_define ("_PAGE_SPLITTING_SHIFT %d\n" , _PAGE_SPLITTING_SHIFT);#endif -#ifdef CONFIG_CPU_MIPSR2 +#if defined(CONFIG_CPU_MIPSR2 ) || defined(CONFIG_CPU_MIPSR6 )if (cpu_has_rixi) {#ifdef _PAGE_NO_EXEC_SHIFTpr_define ("_PAGE_NO_EXEC_SHIFT %d\n" , _PAGE_NO_EXEC_SHIFT);
Greg Kroah-Hartman
maintainerPATCH 163/342 clk: exynos: use irqsave version of spin_lock to avoid deadlock with irqs
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marek Szyprowski <[email protected]>
commit 6b4feaea251a97bf08c7d41eabdec07f63a11073 upstream.
It is allowed to enable/disable clocks from interrupts, so common Exynos ARM clock management code for CPUfreq should use 'irqsave' version of spin_lock calls to avoid potential deadlock caused by spin_lock recursion. The same spin_lock is used by gate/mux clocks during enable/disable calls.
This deadlock, can be reproduced by enabling CPUfreq (ondemand or userspace) and decoding video with s5p-mfc driver.
Relevant stack trace:
[ 5928.061534] BUG: spinlock recursion on CPU#0, bash/1252 [ 5928.061609] lock: 0xee80454c, .magic: dead4ead, .owner: bash/1252, .owner_cpu: 0 [ 5928.068586] CPU: 0 PID: 1252 Comm: bash Tainted: G W 4.4.0-rc4-00001-g447a7fd #678 [ 5928.077260] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree) [ 5928.083359] [<c00153dc>] (unwind_backtrace) from [<c00121b4>] (show_stack+0x10/0x14) [ 5928.091072] [<c00121b4>] (show_stack) from [<c0213e28>] (dump_stack+0x68/0xb8) [ 5928.098275] [<c0213e28>] (dump_stack) from [<c005c1ec>] (do_raw_spin_lock+0x184/0x1ac) [ 5928.106177] [<c005c1ec>] (do_raw_spin_lock) from [<c05cfa98>] (_raw_spin_lock_irqsave+0x20/0x28) [ 5928.114943] [<c05cfa98>] (_raw_spin_lock_irqsave) from [<c0468698>] (clk_gate_endisable+0x24/0x98) [ 5928.123882] [<c0468698>] (clk_gate_endisable) from [<c0464d40>] (clk_core_disable+0x60/0x84) [ 5928.132299] [<c0464d40>] (clk_core_disable) from [<c0465e00>] (clk_disable+0x24/0x30) [ 5928.140117] [<c0465e00>] (clk_disable) from [<c03f3b80>] (s5p_mfc_handle_frame+0x254/0x860) [ 5928.148445] [<c03f3b80>] (s5p_mfc_handle_frame) from [<c03f4b34>] (s5p_mfc_irq+0x890/0xa24) [ 5928.156778] [<c03f4b34>] (s5p_mfc_irq) from [<c00627bc>] (handle_irq_event_percpu+0x50/0x14c) [ 5928.165283] [<c00627bc>] (handle_irq_event_percpu) from [<c00628f0>] (handle_irq_event+0x38/0x5c) [ 5928.174143] [<c00628f0>] (handle_irq_event) from [<c0065864>] (handle_fasteoi_irq+0xdc/0x1a4) [ 5928.182645] [<c0065864>] (handle_fasteoi_irq) from [<c0062090>] (generic_handle_irq+0x18/0x28) [ 5928.191236] [<c0062090>] (generic_handle_irq) from [<c00621a4>] (__handle_domain_irq+0x6c/0xdc) [ 5928.199917] [<c00621a4>] (__handle_domain_irq) from [<c0009470>] (gic_handle_irq+0x4c/0x98) [ 5928.208249] [<c0009470>] (gic_handle_irq) from [<c0012c54>] (__irq_svc+0x54/0x90) [ 5928.215709] Exception stack(0xeddb5cb8 to 0xeddb5d00) [ 5928.220745] 5ca0: ee80454c faddfadc [ 5928.228906] 5cc0: 00000000 01000001 ee831ce0 f8114200 ee807c00 01130520 00000403 eddb5d84 [ 5928.237063] 5ce0: ee807c48 2faf0800 ee807c0c eddb5d08 c046b618 c046b634 20000053 ffffffff [ 5928.245225] [<c0012c54>] (__irq_svc) from [<c046b634>] (exynos_cpuclk_notifier_cb+0x170/0x270) [ 5928.253823] [<c046b634>] (exynos_cpuclk_notifier_cb) from [<c003cb58>] (notifier_call_chain+0x44/0x84) [ 5928.263106] [<c003cb58>] (notifier_call_chain) from [<c003ccd4>] (__srcu_notifier_call_chain+0x6c/0x9c) [ 5928.272480] [<c003ccd4>] (__srcu_notifier_call_chain) from [<c003cd1c>] (srcu_notifier_call_chain+0x18/0x20) [ 5928.282288] [<c003cd1c>] (srcu_notifier_call_chain) from [<c0464ed0>] (__clk_notify+0x6c/0x74) [ 5928.290881] [<c0464ed0>] (__clk_notify) from [<c0465388>] (clk_propagate_rate_change+0xa0/0xac) [ 5928.299561] [<c0465388>] (clk_propagate_rate_change) from [<c0465378>] (clk_propagate_rate_change+0x90/0xac) [ 5928.309370] [<c0465378>] (clk_propagate_rate_change) from [<c04666fc>] (clk_core_set_rate_nolock+0x64/0xa8) [ 5928.319091] [<c04666fc>] (clk_core_set_rate_nolock) from [<c0466760>] (clk_set_rate+0x20/0x30) [ 5928.327686] [<c0466760>] (clk_set_rate) from [<c0428c70>] (set_target+0xe8/0x23c) [ 5928.335152] [<c0428c70>] (set_target) from [<c04244d0>] (__cpufreq_driver_target+0x184/0x29c) [ 5928.343655] [<c04244d0>] (__cpufreq_driver_target) from [<c0427128>] (cpufreq_set+0x44/0x64) [ 5928.352074] [<c0427128>] (cpufreq_set) from [<c0423948>] (store_scaling_setspeed+0x5c/0x74) [ 5928.360407] [<c0423948>] (store_scaling_setspeed) from [<c04238d0>] (store+0x7c/0x98) [ 5928.368221] [<c04238d0>] (store) from [<c0132540>] (sysfs_kf_write+0x44/0x48) [ 5928.375338] [<c0132540>] (sysfs_kf_write) from [<c0131b9c>] (kernfs_fop_write+0xb8/0x1bc) [ 5928.383496] [<c0131b9c>] (kernfs_fop_write) from [<c00d71f8>] (__vfs_write+0x2c/0xd4) [ 5928.391308] [<c00d71f8>] (__vfs_write) from [<c00d7de8>] (vfs_write+0xa0/0x144) [ 5928.398598] [<c00d7de8>] (vfs_write) from [<c00d8048>] (SyS_write+0x44/0x84) [ 5928.405631] [<c00d8048>] (SyS_write) from [<c000f540>] (ret_fast_syscall+0x0/0x3c)
--- drivers/clk/samsung/clk-cpu.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/clk/samsung/clk-cpu.c +6 -4
@@ -148,6 +148,7 @@ static int exynos_cpuclk_pre_rate_changeunsigned long alt_prate =clk_get_rate (cpuclk->alt_parent);unsigned long alt_div =0 , alt_div_mask =DIV_MASK ;unsigned long div0, div1 =0 , mux_reg; +unsigned long flags;/* find out the divider values to use for clock data */ while ((cfg_data->prate *1000 ) != ndata->new_rate) {
@@ -156,7 +157,7 @@ static int exynos_cpuclk_pre_rate_change cfg_data++; } -spin_lock (cpuclk->lock); +spin_lock_irqsave (cpuclk->lock, flags);/* * For the selected PLL clock frequency, get the pre-defined divider
@@ -212,7 +213,7 @@ static int exynos_cpuclk_pre_rate_change DIV_MASK_ALL); } -spin_unlock (cpuclk->lock); +spin_unlock_irqrestore (cpuclk->lock, flags);return 0 ; }
@@ -223,6 +224,7 @@ static int exynos_cpuclk_post_rate_changconst struct exynos_cpuclk_cfg_data *cfg_data = cpuclk->cfg;unsigned long div =0 , div_mask =DIV_MASK ;unsigned long mux_reg; +unsigned long flags;/* find out the divider values to use for clock data */ if (cpuclk->flags &CLK_CPU_NEEDS_DEBUG_ALT_DIV ) {
@@ -233,7 +235,7 @@ static int exynos_cpuclk_post_rate_chang } } -spin_lock (cpuclk->lock); +spin_lock_irqsave (cpuclk->lock, flags);/* select mout_apll as the alternate parent */ mux_reg =readl (base +E4210_SRC_CPU );
@@ -246,7 +248,7 @@ static int exynos_cpuclk_post_rate_chang }exynos_set_safe_div (base, div, div_mask); -spin_unlock (cpuclk->lock); +spin_unlock_irqrestore (cpuclk->lock, flags);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 164/342 regulator: axp20x: Fix GPIO LDO enable value for AXP22x
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chen-Yu Tsai <[email protected]>
commit 3cb99e2ea99a454c8837a55aac88753ef05fc1eb upstream.
The enable/disable values for GPIO LDOs are reversed. It seems no one noticed as AXP22x support was introduced recently, and no one was using the GPIO LDOs, either because no designs actually use them or board support hasn't caught up.
--- drivers/regulator/axp20x-regulator.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/regulator/axp20x-regulator.c +2 -2
@@ -27,8 +27,8 @@#define AXP20X_IO_ENABLED 0x03#define AXP20X_IO_DISABLED 0x07 -#define AXP22X_IO_ENABLED 0x04 -#define AXP22X_IO_DISABLED 0x03 +#define AXP22X_IO_ENABLED 0x03 +#define AXP22X_IO_DISABLED 0x04#define AXP20X_WORKMODE_DCDC2_MASK BIT(2)#define AXP20X_WORKMODE_DCDC3_MASK BIT(1)
Greg Kroah-Hartman
maintainerPATCH 165/342 regulator: mt6311: MT6311_REGULATOR needs to select REGMAP_I2C
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Henry Chen <[email protected]>
commit aab3c3f34cc2dd8230052770712606d65de6538f upstream.
This patch fix the below build error:drivers/regulator/mt6311-regulator.c:111: undefined reference to `__devm_regmap_init_i2c'
--- drivers/regulator/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/regulator/Kconfig +1 -0
@@ -446,6 +446,7 @@ config REGULATOR_MC13892 config REGULATOR_MT6311 tristate "MediaTek MT6311 PMIC" depends on I2C + select REGMAP_I2C help Say y here to select this option to enable the power regulator of MediaTek MT6311 PMIC.
Greg Kroah-Hartman
maintainerPATCH 166/342 virtio_balloon: fix race by fill and leak
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Minchan Kim <[email protected]>
commit f68b992bbb474641881932c61c92dcfa6f5b3689 upstream.
During my compaction-related stuff, I encountered a bug with ballooning.
With repeated inflating and deflating cycle, guest memory( ie, cat /proc/meminfo | grep MemTotal) is decreased and couldn't be recovered.
The reason is balloon_lock doesn't cover release_pages_balloon so struct virtio_balloon fields could be overwritten by race of fill_balloon(e,g, vb->*pfns could be critical).
This patch fixes it in my test.
--- drivers/virtio/virtio_balloon.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/virtio/virtio_balloon.c +1 -1
@@ -209,8 +209,8 @@ static unsigned leak_balloon(struct virt*/ if (vb->num_pfns !=0 )tell_host (vb, vb->deflate_vq); -mutex_unlock (&vb->balloon_lock);release_pages_balloon (vb); +mutex_unlock (&vb->balloon_lock);return num_freed_pages; }
Greg Kroah-Hartman
maintainerPATCH 154/342 Revert "MIPS: Fix PAGE_MASK definition"
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 800dc4f49cc002879e1e5e6b79926f86b60528e6 upstream.
This reverts commit 22b14523994588279ae9c5ccfe64073c1e5b3c00.
It was originally sent in an earlier revision of the pfn_t patchset. Besides being broken, the warning is also fixed by PFN_FLAGS_MASK casting the PAGE_MASK to an unsigned long.
Patchwork: https://patchwork.linux-mips.org/patch/12182/
--- arch/mips/include/asm/page.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/include/asm/page.h +1 -1
@@ -33,7 +33,7 @@#define PAGE_SHIFT 16#endif #define PAGE_SIZE (_AC(1,UL) << PAGE_SHIFT) -#define PAGE_MASK (~(PAGE_SIZE - 1)) +#define PAGE_MASK (~((1 << PAGE_SHIFT) - 1))/* * This is used for calculating the real page sizes
Greg Kroah-Hartman
maintainerPATCH 167/342 virtio_balloon: fix race between migration and ballooning
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Minchan Kim <[email protected]>
commit 21ea9fb69e7c4b1b1559c3e410943d3ff248ffcb upstream.
In balloon_page_dequeue, pages_lock should cover the loop (ie, list_for_each_entry_safe). Otherwise, the cursor page could be isolated by compaction and then list_del by isolation could poison the page->lru.{prev,next} so the loop finally could access wrong address like this. This patch fixes the bug.
general protection fault: 0000 [#1] SMP Dumping ftrace buffer: (ftrace buffer empty) Modules linked in: CPU: 2 PID: 82 Comm: vballoon Not tainted 4.4.0-rc5-mm1-access_bit+ #1906 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 task: ffff8800a7ff0000 ti: ffff8800a7fec000 task.ti: ffff8800a7fec000 RIP: 0010:[<ffffffff8115e754>] [<ffffffff8115e754>] balloon_page_dequeue+0x54/0x130 RSP: 0018:ffff8800a7fefdc0 EFLAGS: 00010246 RAX: ffff88013fff9a70 RBX: ffffea000056fe00 RCX: 0000000000002b7d RDX: ffff88013fff9a70 RSI: ffffea000056fe00 RDI: ffff88013fff9a68 RBP: ffff8800a7fefde8 R08: ffffea000056fda0 R09: 0000000000000000 R10: ffff8800a7fefd90 R11: 0000000000000001 R12: dead0000000000e0 R13: ffffea000056fe20 R14: ffff880138809070 R15: ffff880138809060 FS: 0000000000000000(0000) GS:ffff88013fc40000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 00007f229c10e000 CR3: 00000000b8b53000 CR4: 00000000000006a0 Stack: 0000000000000100 ffff880138809088 ffff880138809000 ffff880138809060 0000000000000046 ffff8800a7fefe28 ffffffff812c86d3 ffff880138809020 ffff880138809000 fffffffffff91900 0000000000000100 ffff880138809060 Call Trace: [<ffffffff812c86d3>] leak_balloon+0x93/0x1a0 [<ffffffff812c8bc7>] balloon+0x217/0x2a0 [<ffffffff8143739e>] ? __schedule+0x31e/0x8b0 [<ffffffff81078160>] ? abort_exclusive_wait+0xb0/0xb0 [<ffffffff812c89b0>] ? update_balloon_stats+0xf0/0xf0 [<ffffffff8105b6e9>] kthread+0xc9/0xe0 [<ffffffff8105b620>] ? kthread_park+0x60/0x60 [<ffffffff8143b4af>] ret_from_fork+0x3f/0x70 [<ffffffff8105b620>] ? kthread_park+0x60/0x60 Code: 8d 60 e0 0f 84 af 00 00 00 48 8b 43 20 a8 01 75 3b 48 89 d8 f0 0f ba 28 00 72 10 48 8b 03 f6 c4 08 75 2f 48 89 df e8 8c 83 f9 ff <49> 8b 44 24 20 4d 8d 6c 24 20 48 83 e8 20 4d 39 f5 74 7a 4c 89 RIP [<ffffffff8115e754>] balloon_page_dequeue+0x54/0x130 RSP <ffff8800a7fefdc0> ---[ end trace 43cf28060d708d5f ]--- Kernel panic - not syncing: Fatal exception
Dumping ftrace buffer:
(ftrace buffer empty)
Kernel Offset: disabled
--- mm/balloon_compaction.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
mm/balloon_compaction.c +2 -2
@@ -61,6 +61,7 @@ struct page *balloon_page_dequeue(structbool dequeued_page; dequeued_page = false; +spin_lock_irqsave (&b_dev_info->pages_lock, flags);list_for_each_entry_safe (page, tmp, &b_dev_info->pages, lru) {/* * Block others from accessing the 'page' while we get around
@@ -75,15 +76,14 @@ struct page *balloon_page_dequeue(struct continue; }#endif -spin_lock_irqsave (&b_dev_info->pages_lock, flags);balloon_page_delete (page);__count_vm_event (BALLOON_DEFLATE ); -spin_unlock_irqrestore (&b_dev_info->pages_lock, flags);unlock_page (page); dequeued_page = true;break ; } } +spin_unlock_irqrestore (&b_dev_info->pages_lock, flags);if (!dequeued_page) {/*
Greg Kroah-Hartman
maintainerPATCH 169/342 drm/vmwgfx: Fix an incorrect lock check
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Hellstrom <[email protected]>
commit fb89ac5102ae2875d685c847e6b5dbc141622d43 upstream.
With CONFIG_SMP=n and CONFIG_DEBUG_SPINLOCK=y the vmwgfx kernel module would unconditionally throw a bug when checking for a held spinlock in the command buffer code. Fix this by using a lockdep check.
--- drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c +1 -1
@@ -247,7 +247,7 @@ static void __vmw_cmdbuf_header_free(str {struct vmw_cmdbuf_man *man = header->man; -BUG_ON (!spin_is_locked (&man->lock)); +lockdep_assert_held_once (&man->lock);if (header->inline_space) {vmw_cmdbuf_header_inline_free (header);
Greg Kroah-Hartman
maintainerPATCH 17/342 ipv6: addrconf: Fix recursive spin lock call
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
[ Upstream commit 16186a82de1fdd868255448274e64ae2616e2640 ]
A rcu stall with the following backtrace was seen on a system with forwarding, optimistic_dad and use_optimistic set. To reproduce, set these flags and allow ipv6 autoconf.
This occurs because the device write_lock is acquired while already holding the read_lock. Back trace below -
INFO: rcu_preempt self-detected stall on CPU { 1} (t=2100 jiffies
g=3992 c=3991 q=4471)<6> Task dump for CPU 1:
<2> kworker/1:0 R running task 12168 15 2 0x00000002
<2> Workqueue: ipv6_addrconf addrconf_dad_work <6> Call trace:
<2> [<ffffffc000084da8>] el1_irq+0x68/0xdc
<2> [<ffffffc000cc4e0c>] _raw_write_lock_bh+0x20/0x30 <2> [<ffffffc000bc5dd8>] __ipv6_dev_ac_inc+0x64/0x1b4 <2> [<ffffffc000bcbd2c>] addrconf_join_anycast+0x9c/0xc4 <2> [<ffffffc000bcf9f0>] __ipv6_ifa_notify+0x160/0x29c <2> [<ffffffc000bcfb7c>] ipv6_ifa_notify+0x50/0x70 <2> [<ffffffc000bd035c>] addrconf_dad_work+0x314/0x334 <2> [<ffffffc0000b64c8>] process_one_work+0x244/0x3fc <2> [<ffffffc0000b7324>] worker_thread+0x2f8/0x418 <2> [<ffffffc0000bb40c>] kthread+0xe0/0xec
v2: do addrconf_dad_kick inside read lock and then acquire write lock for ipv6_ifa_notify as suggested by Eric
addresses useful candidates")
--- net/ipv6/addrconf.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/ipv6/addrconf.c +4 -1
@@ -3506,6 +3506,7 @@ static void addrconf_dad_begin(struct in {struct inet6_dev *idev = ifp->idev;struct net_device *dev = idev->dev; +bool notify = false;addrconf_join_solict (dev, &ifp->addr);
@@ -3551,7 +3552,7 @@ static void addrconf_dad_begin(struct in/* Because optimistic nodes can use this address, * notify listeners. If DAD fails, RTM_DELADDR is sent. */ -ipv6_ifa_notify (RTM_NEWADDR , ifp); + notify = true; } }
@@ -3559,6 +3560,8 @@ static void addrconf_dad_begin(struct in out:spin_unlock (&ifp->lock);read_unlock_bh (&idev->lock); +if (notify) +ipv6_ifa_notify (RTM_NEWADDR , ifp); }static void addrconf_dad_start (struct inet6_ifaddr *ifp)
Greg Kroah-Hartman
maintainerPATCH 41/342 route: check and remove route cache when we get route
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 deed49df7390d5239024199e249190328f1651e7 ]
Since the gc of ipv4 route was removed, the route cached would has no chance to be removed, and even it has been timeout, it still could be used, cause no code to check it's expires.
Fix this issue by checking and removing route cache when we get route.
--- include/net/ip_fib.h | 1 net/ipv4/route.c | 77 +++++++++++++++++++++++++++++++++++++++++---------- 2 files changed, 64 insertions(+), 14 deletions(-)
include/net/ip_fib.h +1 -0
@@ -61,6 +61,7 @@ struct fib_nh_exception {struct rtable __rcu *fnhe_rth_input;struct rtable __rcu *fnhe_rth_output;unsigned long fnhe_stamp; +struct rcu_head rcu; };struct fnhe_hash_bucket {
net/ipv4/route.c +63 -14
119 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 155/342 MIPS: Loongson-3: Fix SMP_ASK_C0COUNT IPI handler
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Huacai Chen <[email protected]>
commit 5754843225f78ac7cbe142a6899890a9733a5a5d upstream.
When Core-0 handle SMP_ASK_C0COUNT IPI, we should make other cores to see the result as soon as possible (especially when Store-Fill-Buffer is enabled). Otherwise, C0_Count syncronization makes no sense.
BTW, array is more suitable than per-cpu variable for syncronization, and there is a corner case should be avoid: C0_Count of Core-0 can be really 0.
Patchwork: https://patchwork.linux-mips.org/patch/12160/
--- arch/mips/loongson64/loongson-3/smp.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
arch/mips/loongson64/loongson-3/smp.c +13 -7
@@ -30,13 +30,13 @@#include "smp.h" DEFINE_PER_CPU (int, cpu_state); -DEFINE_PER_CPU (uint32_t, core0_c0count);static void *ipi_set0_regs[16 ];static void *ipi_clear0_regs[16 ];static void *ipi_status0_regs[16 ];static void *ipi_en0_regs[16 ];static void *ipi_mailbox_buf[16 ]; +static uint32_t core0_c0count[NR_CPUS ];/* read a 32bit value from ipi register */ #define loongson3_ipi_read32 (addr) readl(addr)
@@ -275,12 +275,14 @@ void loongson3_ipi_interrupt(struct pt_rif (action &SMP_ASK_C0COUNT ) {BUG_ON (cpu !=0 ); c0count =read_c0_count (); -for (i =1 ; i <num_possible_cpus (); i++) -per_cpu (core0_c0count, i) = c0count; + c0count = c0count ? c0count :1 ; +for (i =1 ; i < nr_cpu_ids; i++) + core0_c0count[i] = c0count; +__wbflush ();/* Let others see the result ASAP */ } } -#define MAX_LOOPS 1111 +#define MAX_LOOPS 800/* * SMP init and finish on secondary CPUs */
@@ -305,16 +307,20 @@ static void loongson3_init_secondary(voicpu_logical_map (cpu) / loongson_sysconf.cores_per_package; i =0 ; -__this_cpu_write (core0_c0count,0 ); + core0_c0count[cpu] =0 ;loongson3_send_ipi_single (0 ,SMP_ASK_C0COUNT ); -while (!__this_cpu_read (core0_c0count)) { +while (!core0_c0count[cpu]) { i++;cpu_relax (); }if (i >MAX_LOOPS ) i =MAX_LOOPS ; - initcount =__this_cpu_read (core0_c0count) + i; +if (cpu_data[cpu].package) + initcount = core0_c0count[cpu] + i; +else /* Local access is faster for loops */ + initcount = core0_c0count[cpu] + i/2 ; +write_c0_count (initcount); }
Greg Kroah-Hartman
maintainerPATCH 158/342 MIPS: Fix buffer overflow in syscall_get_arguments()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Hogan <[email protected]>
commit f4dce1ffd2e30fa31756876ef502ce6d2324be35 upstream.
Since commit 4c21b8fd8f14 ("MIPS: seccomp: Handle indirect system calls (o32)"), syscall_get_arguments() attempts to handle o32 indirect syscall arguments by incrementing both the start argument number and the number of arguments to fetch. However only the start argument number needs to be incremented. The number of arguments does not change, they're just shifted up by one, and in fact the output array is provided by the caller and is likely only n entries long, so reading more arguments overflows the output buffer.
In the case of seccomp, this results in it fetching 7 arguments starting at the 2nd one, which overflows the unsigned long args[6] in populate_seccomp_data(). This clobbers the $s0 register from syscall_trace_enter() which __seccomp_phase1_filter() saved onto the stack, into which syscall_trace_enter() had placed its syscall number argument. This caused Chromium to crash.
Credit goes to Milko for tracking it down as far as $s0 being clobbered.
Patchwork: https://patchwork.linux-mips.org/patch/12213/
--- arch/mips/include/asm/syscall.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
arch/mips/include/asm/syscall.h +1 -3
@@ -101,10 +101,8 @@ static inline void syscall_get_arguments/* O32 ABI syscall() - Either 64-bit with O32 or 32-bit */ if ((config_enabled (CONFIG_32BIT ) ||test_tsk_thread_flag (task,TIF_32BIT_REGS )) && - (regs->regs[2 ] == __NR_syscall)) { + (regs->regs[2 ] == __NR_syscall)) i++; - n++; - }while (n--) ret |=mips_get_syscall_arg (args++, task, regs, i++);
Greg Kroah-Hartman
maintainerPATCH 42/342 tcp/dccp: fix another race at listener dismantle
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 7716682cc58e305e22207d5bb315f26af6b1e243 ]
Ilya reported following lockdep splat:
kernel: =========================
kernel: [ BUG: held lock freed! ]
kernel: 4.5.0-rc1-ceph-00026-g5e0a311 #1 Not tainted
kernel: -------------------------
kernel: swapper/5/0 is freeing memory ffff880035c9d200-ffff880035c9dbff, with a lock still held there!
kernel: (&(&queue->rskq_lock)->rlock){+.-...}, at:
[<ffffffff816f6a88>] inet_csk_reqsk_queue_add+0x28/0xa0 kernel: 4 locks held by swapper/5/0:
kernel: #0: (rcu_read_lock){......}, at: [<ffffffff8169ef6b>] netif_receive_skb_internal+0x4b/0x1f0
kernel: #1: (rcu_read_lock){......}, at: [<ffffffff816e977f>] ip_local_deliver_finish+0x3f/0x380
kernel: #2: (slock-AF_INET){+.-...}, at: [<ffffffff81685ffb>] sk_clone_lock+0x19b/0x440
kernel: #3: (&(&queue->rskq_lock)->rlock){+.-...}, at:
[<ffffffff816f6a88>] inet_csk_reqsk_queue_add+0x28/0xa0
To properly fix this issue, inet_csk_reqsk_queue_add() needs to return to its callers if the child as been queued into accept queue.
We also need to make sure listener is still there before calling sk->sk_data_ready(), by holding a reference on it, since the reference carried by the child can disappear as soon as the child is put on accept queue.
--- include/net/inet_connection_sock.h | 5 +++-- net/dccp/ipv4.c | 14 +++++++------- net/dccp/ipv6.c | 14 +++++++------- net/ipv4/inet_connection_sock.c | 14 +++++++------- net/ipv4/tcp_ipv4.c | 14 +++++++------- net/ipv6/tcp_ipv6.c | 14 +++++++------- 6 files changed, 38 insertions(+), 37 deletions(-)
include/net/inet_connection_sock.h +3 -2
@@ -270,8 +270,9 @@ struct dst_entry *inet_csk_route_child_sstruct sock *newsk, const struct request_sock *req); -void inet_csk_reqsk_queue_add (struct sock *sk,struct request_sock *req, -struct sock *child); +struct sock *inet_csk_reqsk_queue_add (struct sock *sk, +struct request_sock *req, +struct sock *child);void inet_csk_reqsk_queue_hash_add (struct sock *sk,struct request_sock *req,unsigned long timeout); struct sock *inet_csk_complete_hashdance(struct sock *sk, struct sock *child,
net/dccp/ipv4.c +7 -7
@@ -824,26 +824,26 @@ lookup:if (sk->sk_state ==DCCP_NEW_SYN_RECV ) {struct request_sock *req =inet_reqsk (sk); -struct sock *nsk =NULL ; +struct sock *nsk; sk = req->rsk_listener; -if (likely (sk->sk_state ==DCCP_LISTEN )) { - nsk =dccp_check_req (sk, skb, req); - }else { +if (unlikely (sk->sk_state !=DCCP_LISTEN )) {inet_csk_reqsk_queue_drop_and_put (sk, req); goto lookup; } +sock_hold (sk); + nsk =dccp_check_req (sk, skb, req);if (!nsk) {reqsk_put (req); - goto discard_it; + goto discard_and_relse; }if (nsk == sk) { -sock_hold (sk);reqsk_put (req); }else if (dccp_child_process (sk, nsk, skb)) {dccp_v4_ctl_send_reset (sk, skb); - goto discard_it; + goto discard_and_relse; }else { +sock_put (sk);return 0 ; } }
net/dccp/ipv6.c +7 -7
@@ -691,26 +691,26 @@ lookup:if (sk->sk_state ==DCCP_NEW_SYN_RECV ) {struct request_sock *req =inet_reqsk (sk); -struct sock *nsk =NULL ; +struct sock *nsk; sk = req->rsk_listener; -if (likely (sk->sk_state ==DCCP_LISTEN )) { - nsk =dccp_check_req (sk, skb, req); - }else { +if (unlikely (sk->sk_state !=DCCP_LISTEN )) {inet_csk_reqsk_queue_drop_and_put (sk, req); goto lookup; } +sock_hold (sk); + nsk =dccp_check_req (sk, skb, req);if (!nsk) {reqsk_put (req); - goto discard_it; + goto discard_and_relse; }if (nsk == sk) { -sock_hold (sk);reqsk_put (req); }else if (dccp_child_process (sk, nsk, skb)) {dccp_v6_ctl_send_reset (sk, skb); - goto discard_it; + goto discard_and_relse; }else { +sock_put (sk);return 0 ; } }
net/ipv4/inet_connection_sock.c +7 -7
@@ -789,14 +789,16 @@ static void inet_child_forget(struct socreqsk_put (req); } -void inet_csk_reqsk_queue_add (struct sock *sk,struct request_sock *req, -struct sock *child) +struct sock *inet_csk_reqsk_queue_add (struct sock *sk, +struct request_sock *req, +struct sock *child) {struct request_sock_queue *queue = &inet_csk (sk)->icsk_accept_queue;spin_lock (&queue->rskq_lock);if (unlikely (sk->sk_state !=TCP_LISTEN )) {inet_child_forget (sk, req, child); + child =NULL ; }else { req->sk = child; req->dl_next =NULL ;
@@ -808,6 +810,7 @@ void inet_csk_reqsk_queue_add(struct socsk_acceptq_added (sk); }spin_unlock (&queue->rskq_lock); +return child; }EXPORT_SYMBOL (inet_csk_reqsk_queue_add);
@@ -817,11 +820,8 @@ struct sock *inet_csk_complete_hashdanceif (own_req) {inet_csk_reqsk_queue_drop (sk, req);reqsk_queue_removed (&inet_csk (sk)->icsk_accept_queue, req); -inet_csk_reqsk_queue_add (sk, req, child); -/* Warning: caller must not call reqsk_put(req); -* child stole last reference on it. -*/ -return child; +if (inet_csk_reqsk_queue_add (sk, req, child)) +return child; }/* Too bad, another child took ownership of the request, undo. */ bh_unlock_sock (child);
net/ipv4/tcp_ipv4.c +7 -7
@@ -1594,30 +1594,30 @@ process:if (sk->sk_state ==TCP_NEW_SYN_RECV ) {struct request_sock *req =inet_reqsk (sk); -struct sock *nsk =NULL ; +struct sock *nsk; sk = req->rsk_listener;if (unlikely (tcp_v4_inbound_md5_hash (sk, skb))) {reqsk_put (req); goto discard_it; } -if (likely (sk->sk_state ==TCP_LISTEN )) { - nsk =tcp_check_req (sk, skb, req, false); - }else { +if (unlikely (sk->sk_state !=TCP_LISTEN )) {inet_csk_reqsk_queue_drop_and_put (sk, req); goto lookup; } +sock_hold (sk); + nsk =tcp_check_req (sk, skb, req, false);if (!nsk) {reqsk_put (req); - goto discard_it; + goto discard_and_relse; }if (nsk == sk) { -sock_hold (sk);reqsk_put (req); }else if (tcp_child_process (sk, nsk, skb)) {tcp_v4_send_reset (nsk, skb); - goto discard_it; + goto discard_and_relse; }else { +sock_put (sk);return 0 ; } }
net/ipv6/tcp_ipv6.c +7 -7
@@ -1388,7 +1388,7 @@ process:if (sk->sk_state ==TCP_NEW_SYN_RECV ) {struct request_sock *req =inet_reqsk (sk); -struct sock *nsk =NULL ; +struct sock *nsk; sk = req->rsk_listener;tcp_v6_fill_cb (skb, hdr, th);
@@ -1396,24 +1396,24 @@ process:reqsk_put (req); goto discard_it; } -if (likely (sk->sk_state ==TCP_LISTEN )) { - nsk =tcp_check_req (sk, skb, req, false); - }else { +if (unlikely (sk->sk_state !=TCP_LISTEN )) {inet_csk_reqsk_queue_drop_and_put (sk, req); goto lookup; } +sock_hold (sk); + nsk =tcp_check_req (sk, skb, req, false);if (!nsk) {reqsk_put (req); - goto discard_it; + goto discard_and_relse; }if (nsk == sk) { -sock_hold (sk);reqsk_put (req);tcp_v6_restore_cb (skb); }else if (tcp_child_process (sk, nsk, skb)) {tcp_v6_send_reset (nsk, skb); - goto discard_it; + goto discard_and_relse; }else { +sock_put (sk);return 0 ; } }
Greg Kroah-Hartman
maintainerPATCH 131/342 clockevents/tcb_clksrc: Prevent disabling an already disabled clock
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexandre Belloni <[email protected]>
commit f02b4b72d12cbae7020a959e2ed0410a464b4cc4 upstream.
clockevents_exchange_device is calling clockevents_shutdown() on the new clockenvents device but it may have never been enabled in the first place. This results in the tcb clock being disabled without being enabled first:
------------[ cut here ]------------ WARNING: CPU: 0 PID: 1 at drivers/clk/clk.c:680 clk_disable+0x28/0x34() Modules linked in: CPU: 0 PID: 1 Comm: swapper Not tainted 4.4.0+ #6 Hardware name: Atmel AT91SAM9 [<c000f2b8>] (unwind_backtrace) from [<c000d01c>] (show_stack+0x10/0x14) [<c000d01c>] (show_stack) from [<c00172f0>] (warn_slowpath_common+0x78/0xa0) [<c00172f0>] (warn_slowpath_common) from [<c00173a8>] (warn_slowpath_null+0x18/0x20) [<c00173a8>] (warn_slowpath_null) from [<c0361528>] (clk_disable+0x28/0x34) [<c0361528>] (clk_disable) from [<c034d560>] (tc_shutdown+0x38/0x4c) [<c034d560>] (tc_shutdown) from [<c0059ad4>] (clockevents_switch_state+0x38/0x6c) [<c0059ad4>] (clockevents_switch_state) from [<c0059b18>] (clockevents_shutdown+0x10/0x24) [<c0059b18>] (clockevents_shutdown) from [<c005a458>] (tick_check_new_device+0x84/0xac) [<c005a458>] (tick_check_new_device) from [<c0059660>] (clockevents_register_device+0x7c/0x108) [<c0059660>] (clockevents_register_device) from [<c06b5a68>] (tcb_clksrc_init+0x390/0x3e8) [<c06b5a68>] (tcb_clksrc_init) from [<c00097cc>] (do_one_initcall+0x114/0x1d4) [<c00097cc>] (do_one_initcall) from [<c069bd54>] (kernel_init_freeable+0xfc/0x1b8) [<c069bd54>] (kernel_init_freeable) from [<c04c3818>] (kernel_init+0x8/0xe0) [<c04c3818>] (kernel_init) from [<c000a410>] (ret_from_fork+0x14/0x24) ---[ end trace 0000000000000001 ]---
Check what state we were in before trying to disable the clock.
--- drivers/clocksource/tcb_clksrc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/clocksource/tcb_clksrc.c +2 -1
@@ -98,7 +98,8 @@ static int tc_shutdown(struct clock_even__raw_writel (0xff , regs +ATMEL_TC_REG (2 ,IDR ));__raw_writel (ATMEL_TC_CLKDIS , regs +ATMEL_TC_REG (2 ,CCR )); -clk_disable (tcd->clk); +if (!clockevent_state_detached (d)) +clk_disable (tcd->clk);return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 133/342 mmc: sdhci-pci: Do not default to 33 Ohm driver strength for Intel SPT
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 1ca896856281d3f1ad4f6f7d4e32e2943452de23 upstream.
In some cases, the stronger 33 Ohm driver strength must not be used so it is not a suitable default. Change it to the standard default 50 Ohm value.
The patch applies to v4.2+ except the file name changed. It is drivers/mmc/host/sdhci-pci.c prior to v.4.4.
--- drivers/mmc/host/sdhci-pci-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/host/sdhci-pci-core.c +1 -1
@@ -277,7 +277,7 @@ static int spt_select_drive_strength(strif (sdhci_pci_spt_drive_strength >0 ) drive_strength = sdhci_pci_spt_drive_strength &0xf ;else - drive_strength =1 ;/* 33-ohm */ + drive_strength =0 ;/* Default 50-ohm */ if ((mmc_driver_type_mask (drive_strength) & card_drv) ==0 ) drive_strength =0 ;/* Default 50-ohm */
Greg Kroah-Hartman
maintainerPATCH 134/342 mmc: sdhci: Fix DMA descriptor with zero data length
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit 347ea32dc118326c4f2636928239a29d192cc9b8 upstream.
SDHCI has built-in DMA called ADMA2. ADMA2 uses a descriptor table to define DMA scatter-gather. Each desciptor can specify a data length up to 65536 bytes, however the length field is only 16-bits so zero means 65536. Consequently, putting zero when the size is zero must not be allowed. This patch fixes one case where zero data length could be set inadvertently.
The problem happens because unaligned data gets split and the code did not consider that the remaining aligned portion might be zero length. That case really only happens for SDIO because SD and eMMC cards transfer blocks that are invariably sector- aligned. For SDIO, access to function registers is done by data transfer (CMD53) when the register is bigger than 1 byte. Generally registers are 4 bytes but 2-byte registers are possible. So DMA of 4 bytes or less can happen. When 32-bit DMA is used, the data alignment must be 4, so 4-byte transfers won't casue a problem, but a 2-byte transfer could. However with the introduction of 64-bit DMA, the data alignment for 64-bit DMA was made 8 bytes, so all 4-byte transfers not on 8-byte boundaries get "split" into a 4-byte chunk and a 0-byte chunk, thereby hitting the bug.
In fact, a closer look at the SDHCI specs indicates that only the descriptor table requires 8-byte alignment for 64-bit DMA. That will be dealt with in a separate patch, but the potential for a 2-byte access remains, so this fix is needed anyway.
--- drivers/mmc/host/sdhci.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/mmc/host/sdhci.c +6 -3
@@ -540,9 +540,12 @@ static int sdhci_adma_table_pre(struct sBUG_ON (len >65536 ); -/* tran, valid */ -sdhci_adma_write_desc (host, desc, addr, len,ADMA2_TRAN_VALID ); - desc += host->desc_sz; +if (len) { +/* tran, valid */ +sdhci_adma_write_desc (host, desc, addr, len, +ADMA2_TRAN_VALID ); + desc += host->desc_sz; + }/* * If this triggers then we have a calculation bug
Greg Kroah-Hartman
maintainerPATCH 135/342 mmc: sdio: Fix invalid vdd in voltage switch power cycle
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Adrian Hunter <[email protected]>
commit d9bfbb95ed598a09cf336adb0f190ee0ff802f0d upstream.
The 'ocr' parameter passed to mmc_set_signal_voltage() defines the power-on voltage used when power cycling after a failure to set the voltage. However, in the case of mmc_sdio_init_card(), the value passed has the R4_18V_PRESENT flag set which is not valid for power-on and results in an invalid vdd. Fix by passing the card's ocr value which does not have the flag.
--- drivers/mmc/core/sdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mmc/core/sdio.c +1 -1
@@ -630,7 +630,7 @@ try_again:*/ if (!powered_resume && (rocr & ocr &R4_18V_PRESENT )) { err =mmc_set_signal_voltage (host,MMC_SIGNAL_VOLTAGE_180 , - ocr); + ocr_card);if (err == -EAGAIN ) {sdio_reset (host);mmc_go_idle (host);
Greg Kroah-Hartman
maintainerPATCH 126/342 irqchip/omap-intc: Add support for spurious irq handling
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sekhar Nori <[email protected]>
commit d3b421cd07e4c0d4d6c0bbd55ca169c054fc081d upstream.
Under some conditions, irq sorting procedure used by INTC can go wrong resulting in a spurious irq getting reported.
If this condition is not handled, it results in endless stream of:
unexpected IRQ trap at vector 00
messages from ack_bad_irq()
Handle the spurious interrupt condition in omap-intc driver to prevent this.
Measurements using kernel function profiler on AM335x EVM running at 720MHz show that after this patch omap_intc_handle_irq() takes about 37.4us against 34us before this patch.
--- drivers/irqchip/irq-omap-intc.c | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
drivers/irqchip/irq-omap-intc.c +26 -1
@@ -47,6 +47,7 @@#define INTC_ILR0 0x0100#define ACTIVEIRQ_MASK 0x7f/* omap2/3 active interrupt bits */ +#define SPURIOUSIRQ_MASK (0x1ffffff << 7)#define INTCPS_NR_ILR_REGS 128#define INTCPS_NR_MIR_REGS 4
@@ -330,11 +331,35 @@ static int __init omap_init_irq(u32 base static asmlinkage void __exception_irq_entryomap_intc_handle_irq (struct pt_regs *regs) { +extern unsigned long irq_err_count;u32 irqnr; irqnr =intc_readl (INTC_SIR ); + +/* +* A spurious IRQ can result if interrupt that triggered the +* sorting is no longer active during the sorting (10 INTC +* functional clock cycles after interrupt assertion). Or a +* change in interrupt mask affected the result during sorting +* time. There is no special handling required except ignoring +* the SIR register value just read and retrying. +* See section 6.2.5 of AM335x TRM Literature Number: SPRUH73K +* +* Many a times, a spurious interrupt situation has been fixed +* by adding a flush for the posted write acking the IRQ in +* the device driver. Typically, this is going be the device +* driver whose interrupt was handled just before the spurious +* IRQ occurred. Pay attention to those device drivers if you +* run into hitting the spurious IRQ condition below. +*/ +if (unlikely ((irqnr &SPURIOUSIRQ_MASK ) ==SPURIOUSIRQ_MASK )) { +pr_err_once ("%s: spurious irq!\n" , __func__); + irq_err_count++; +omap_ack_irq (NULL ); +return ; + } + irqnr &=ACTIVEIRQ_MASK ; -WARN_ONCE (!irqnr,"Spurious IRQ ?\n" );handle_domain_irq (domain, irqnr, regs); }
Greg Kroah-Hartman
maintainerPATCH 2/342 gro: Make GRO aware of lightweight tunnels.
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesse Gross <[email protected]>
[ Upstream commit ce87fc6ce3f9f4488546187e3757cf666d9d4a2a ]
GRO is currently not aware of tunnel metadata generated by lightweight tunnels and stored in the dst. This leads to two possible problems:
* Incorrectly merging two frames that have different metadata.
* Leaking of allocated metadata from merged frames.
This avoids those problems by comparing the tunnel information before merging, similar to how we handle other metadata (such as vlan tags), and releasing any state when we are done.
--- include/net/dst_metadata.h | 18 ++++++++++++++++++ net/core/dev.c | 7 +++++-- 2 files changed, 23 insertions(+), 2 deletions(-)
include/net/dst_metadata.h +18 -0
@@ -44,6 +44,24 @@ static inline bool skb_valid_dst(const sreturn dst && !(dst->flags &DST_METADATA ); } +static inline int skb_metadata_dst_cmp (const struct sk_buff *skb_a, +const struct sk_buff *skb_b) +{ +const struct metadata_dst *a, *b; + +if (!(skb_a->_skb_refdst | skb_b->_skb_refdst)) +return 0 ; + + a = (const struct metadata_dst *)skb_dst (skb_a); + b = (const struct metadata_dst *)skb_dst (skb_b); + +if (!a != !b || a->u.tun_info.options_len != b->u.tun_info.options_len) +return 1 ; + +return memcmp (&a->u.tun_info, &b->u.tun_info, +sizeof (a->u.tun_info) + a->u.tun_info.options_len); +} +struct metadata_dst *metadata_dst_alloc (u8 optslen,gfp_t flags);struct metadata_dst __percpu *metadata_dst_alloc_percpu (u8 optslen,gfp_t flags);
net/core/dev.c +5 -2
@@ -4145,6 +4145,7 @@ static void gro_list_prepare(struct napi diffs = (unsigned long )p->dev ^ (unsigned long )skb->dev; diffs |= p->vlan_tci ^ skb->vlan_tci; + diffs |=skb_metadata_dst_cmp (p, skb);if (maclen ==ETH_HLEN ) diffs |=compare_ether_header (skb_mac_header (p),skb_mac_header (skb));
@@ -4342,10 +4343,12 @@ static gro_result_t napi_skb_finish(gro_break ;case GRO_MERGED_FREE : -if (NAPI_GRO_CB (skb)->free ==NAPI_GRO_FREE_STOLEN_HEAD ) +if (NAPI_GRO_CB (skb)->free ==NAPI_GRO_FREE_STOLEN_HEAD ) { +skb_dst_drop (skb);kmem_cache_free (skbuff_head_cache, skb); -else + }else {__kfree_skb (skb); + }break ;case GRO_HELD :
Greg Kroah-Hartman
maintainerPATCH 186/342 drm/amdgpu: remove unnecessary forward declaration
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolai Hähnle <[email protected]>
commit b19763d0d867eb863953500a5c87f2fd663863b8 upstream.
--- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 2 -- 1 file changed, 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu.h +0 -2
@@ -604,8 +604,6 @@ struct amdgpu_sa_manager {uint32_t align; }; -struct amdgpu_sa_bo ; -/* sub-allocation buffer */ struct amdgpu_sa_bo {struct list_head olist;
Greg Kroah-Hartman
maintainerPATCH 44/342 rtnl: RTM_GETNETCONF: fix wrong return value
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Protopopov <[email protected]>
[ Upstream commit a97eb33ff225f34a8124774b3373fd244f0e83ce ]
An error response from a RTM_GETNETCONF request can return the positive error value EINVAL in the struct nlmsgerr that can mislead userspace.
--- net/ipv4/devinet.c | 2 +- net/ipv6/addrconf.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/devinet.c +1 -1
@@ -1847,7 +1847,7 @@ static int inet_netconf_get_devconf(struif (err <0 ) goto errout; - err =EINVAL ; + err = -EINVAL ;if (!tb[NETCONFA_IFINDEX ]) goto errout;
net/ipv6/addrconf.c +1 -1
@@ -583,7 +583,7 @@ static int inet6_netconf_get_devconf(strif (err <0 ) goto errout; - err =EINVAL ; + err = -EINVAL ;if (!tb[NETCONFA_IFINDEX ]) goto errout;
Greg Kroah-Hartman
maintainerPATCH 190/342 drm/amdgpu: Dont hang in amdgpu_flip_work_func on disabled crtc.
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mario Kleiner <[email protected]>
commit e1d09dc0ccc6c91e3916476f636edb76da1f65bb upstream.
This fixes a regression introduced in Linux 4.4.
This is a port of the same fix for radeon-kms in the patch "drm/radeon: Don't hang in radeon_flip_work_func on disabled crtc. (v2)"
Limit the amount of time amdgpu_flip_work_func can delay programming a page flip, by both limiting the maximum amount of time per wait cycle and the maximum number of wait cycles. Continue the flip if the limit is exceeded, even if that may result in a visual or timing glitch.
This is to prevent a hang of page flips, as reported in fdo bug #93746: Disconnecting a DisplayPort display in parallel to a kms pageflip getting queued can cause the following hang of page flips and thereby an unusable desktop:
1. kms pageflip ioctl() queues pageflip -> queues execution of amdgpu_flip_work_func.
2. Hotunplug of display causes the driver to DPMS OFF the unplugged display. Display engine shuts down, scanout no longer moves, but stays at its resting position at start line of vblank.
3. amdgpu_flip_work_func executes while crtc is off, and due to the non-moving scanout position, the new flip delay code introduced into Linux 4.4 by
commit 8e36f9d33c13 ("drm/amdgpu: Fixup hw vblank counter/ts..") enters an infinite wait loop.
4. After reconnecting the display, the pageflip continues to hang in 3. and the display doesn't update its view of the desktop.
This patch fixes the Linux 4.4 regression from fdo bug #93746
<https://bugs.freedesktop.org/show_bug.cgi?id=93746>
--- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_display.c +15 -3
@@ -72,8 +72,8 @@ static void amdgpu_flip_work_func(structstruct drm_crtc *crtc = &amdgpuCrtc->base;unsigned long flags; -unsigned i; -int vpos, hpos, stat, min_udelay; +unsigned i, repcnt =4 ; +int vpos, hpos, stat, min_udelay =0 ;struct drm_vblank_crtc *vblank = &crtc->dev->vblank[work->crtc_id];amdgpu_flip_wait_fence (adev, &work->excl);
@@ -96,7 +96,7 @@ static void amdgpu_flip_work_func(struct* In practice this won't execute very often unless on very fast * machines because the time window for this to happen is very small. */ -for (;;) { +while (amdgpuCrtc->enabled && repcnt--) {/* GET_DISTANCE_TO_VBLANKSTART returns distance to real vblank * start in hpos, and to the "fudged earlier" vblank start in * vpos.
@@ -114,10 +114,22 @@ static void amdgpu_flip_work_func(struct/* Sleep at least until estimated real start of hw vblank */ spin_unlock_irqrestore (&crtc->dev->event_lock, flags); min_udelay = (-hpos +1 ) *max (vblank->linedur_ns /1000 ,5 ); +if (min_udelay > vblank->framedur_ns /2000 ) { +/* Don't wait ridiculously long - something is wrong */ + repcnt =0 ; +break ; + }usleep_range (min_udelay,2 * min_udelay);spin_lock_irqsave (&crtc->dev->event_lock, flags); }; +if (!repcnt) +DRM_DEBUG_DRIVER ("Delay problem on crtc %d: min_udelay %d, " +"framedur %d, linedur %d, stat %d, vpos %d, " +"hpos %d\n" , work->crtc_id, min_udelay, + vblank->framedur_ns /1000 , + vblank->linedur_ns /1000 , stat, vpos, hpos); +/* do the flip (mmio) */ adev->mode_info.funcs->page_flip (adev, work->crtc_id, work->base);/* set the flip status */
Greg Kroah-Hartman
maintainerPATCH 191/342 drm/amdgpu/pm: adjust display configuration after powerstate
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 8e7cedc6f7fe762ffe6e348502be34b11fa79298 upstream.
set_power_state defaults to no displays, so we need to update the display configuration after setting up the powerstate on the first call. In most cases this is not an issue since ends up getting called multiple times at any given modeset and the proper order is achieved in the display changed handling at the top of the function.
--- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c +3 -2
@@ -595,8 +595,6 @@ force:/* update display watermarks based on new power state */ amdgpu_display_bandwidth_update (adev); -/* update displays */ -amdgpu_dpm_display_configuration_changed (adev); adev->pm.dpm.current_active_crtcs = adev->pm.dpm.new_active_crtcs; adev->pm.dpm.current_active_crtc_count = adev->pm.dpm.new_active_crtc_count;
@@ -616,6 +614,9 @@ force:amdgpu_dpm_post_set_power_state (adev); +/* update displays */ +amdgpu_dpm_display_configuration_changed (adev); +if (adev->pm.funcs->force_performance_level) {if (adev->pm.dpm.thermal_active) {enum amdgpu_dpm_forced_level level = adev->pm.dpm.forced_level;
Greg Kroah-Hartman
maintainerPATCH 40/342 net_sched fix: reclassification needs to consider ether protocol changes
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jamal Hadi Salim <[email protected]>
[ Upstream commit 619fe32640b4b01f370574d50344ae0f62689816 ]
actions could change the etherproto in particular with ethernet tunnelled data. Typically such actions, after peeling the outer header, will ask for the packet to be reclassified. We then need to restart the classification with the new proto header.
Example setup used to catch this:
sudo tc qdisc add dev $ETH ingress
sudo $TC filter add dev $ETH parent ffff: pref 1 protocol 802.1Q \
u32 match u32 0 0 flowid 1:1 \
action vlan pop reclassify
--- net/sched/sch_api.c | 1 + 1 file changed, 1 insertion(+)
net/sched/sch_api.c +1 -0
@@ -1852,6 +1852,7 @@ reset: } tp = old_tp; + protocol =tc_skb_protocol (skb); goto reclassify;#endif }
Greg Kroah-Hartman
maintainerPATCH 176/342 drm/amdgpu: fix amdgpu_bo_pin_restricted VRAM placing v2
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian König <[email protected]>
commit 78d0e182b6c1f5336f6e8cbb197f403276dabc7f upstream.
We could pin BOs into invisible VRAM otherwise.
v2: make logic more readable as suggested by Michel
--- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/amdgpu_object.c +2 -1
@@ -399,7 +399,8 @@ int amdgpu_bo_pin_restricted(struct amdg }if (fpfn > bo->placements[i].fpfn) bo->placements[i].fpfn = fpfn; -if (lpfn && lpfn < bo->placements[i].lpfn) +if (!bo->placements[i].lpfn || + (lpfn && lpfn < bo->placements[i].lpfn)) bo->placements[i].lpfn = lpfn; bo->placements[i].flags |=TTM_PL_FLAG_NO_EVICT ; }
Greg Kroah-Hartman
maintainerPATCH 47/342 sctp: Fix port hash table size computation
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neil Horman <[email protected]>
[ Upstream commit d9749fb5942f51555dc9ce1ac0dbb1806960a975 ]
Dmitry Vyukov noted recently that the sctp_port_hashtable had an error in its size computation, observing that the current method never guaranteed that the hashsize (measured in number of entries) would be a power of two, which the input hash function for that table requires. The root cause of the problem is that two values need to be computed (one, the allocation order of the storage requries, as passed to __get_free_pages, and two the number of entries for the hash table). Both need to be ^2, but for different reasons, and the existing code is simply computing one order value, and using it as the basis for both, which is wrong (i.e. it assumes that ((1<<order)*PAGE_SIZE)/sizeof(bucket) is still ^2 when its not).
To fix this, we change the logic slightly. We start by computing a goal allocation order (which is limited by the maximum size hash table we want to support. Then we attempt to allocate that size table, decreasing the order until a successful allocation is made. Then, with the resultant successful order we compute the number of buckets that hash table supports, which we then round down to the nearest power of two, giving us the number of entries the table actually supports.
I've tested this locally here, using non-debug and spinlock-debug kernels, and the number of entries in the hashtable consistently work out to be powers of two in all cases.
--- net/sctp/protocol.c | 43 ++++++++++++++++++++++++++++++++++++------- 1 file changed, 36 insertions(+), 7 deletions(-)
net/sctp/protocol.c +36 -7
@@ -60,6 +60,8 @@#include <net/inet_common.h> #include <net/inet_ecn.h> +#define MAX_SCTP_PORT_HASH_ENTRIES (64 * 1024) +/* Global data structures. */ struct sctp_globals sctp_globals__read_mostly ;
@@ -1352,6 +1354,8 @@ static __init int sctp_init(void)unsigned long limit;int max_share;int order; +int num_entries; +int max_entry_order;sock_skb_cb_check_size (sizeof (struct sctp_ulpevent ));
@@ -1404,14 +1408,24 @@ static __init int sctp_init(void)/* Size and allocate the association hash table. * The methodology is similar to that of the tcp hash tables. +* Though not identical. Start by getting a goal size */ if (totalram_pages >= (128 *1024 )) goal = totalram_pages >> (22 -PAGE_SHIFT );else goal = totalram_pages >> (24 -PAGE_SHIFT ); -for (order =0 ; (1UL << order) < goal; order++) - ; +/* Then compute the page order for said goal */ + order =get_order (goal); + +/* Now compute the required page order for the maximum sized table we +* want to create +*/ + max_entry_order =get_order (MAX_SCTP_PORT_HASH_ENTRIES * +sizeof (struct sctp_bind_hashbucket )); + +/* Limit the page order by that maximum hash table size */ + order =min (order, max_entry_order); do { sctp_assoc_hashsize = (1UL << order) * PAGE_SIZE /
@@ -1445,20 +1459,35 @@ static __init int sctp_init(void)INIT_HLIST_HEAD (&sctp_ep_hashtable[i].chain); } -/* Allocate and initialize the SCTP port hash table. */ +/* Allocate and initialize the SCTP port hash table. +* Note that order is initalized to start at the max sized +* table we want to support. If we can't get that many pages +* reduce the order and try again +*/ do { - sctp_port_hashsize = (1UL << order) *PAGE_SIZE / -sizeof (struct sctp_bind_hashbucket ); -if ((sctp_port_hashsize > (64 *1024 )) && order >0 ) -continue ; sctp_port_hashtable = (struct sctp_bind_hashbucket *)__get_free_pages (GFP_ATOMIC |__GFP_NOWARN, order); }while (!sctp_port_hashtable && --order >0 ); +if (!sctp_port_hashtable) {pr_err ("Failed bind hash alloc\n" ); status = -ENOMEM ; goto err_bhash_alloc; } + +/* Now compute the number of entries that will fit in the +* port hash space we allocated +*/ + num_entries = (1UL << order) *PAGE_SIZE / +sizeof (struct sctp_bind_hashbucket ); + +/* And finish by rounding it down to the nearest power of two +* this wastes some memory of course, but its needed because +* the hash function operates based on the assumption that +* that the number of entries is a power of two +*/ + sctp_port_hashsize =rounddown_pow_of_two (num_entries); +for (i =0 ; i < sctp_port_hashsize; i++) {spin_lock_init (&sctp_port_hashtable[i].lock);INIT_HLIST_HEAD (&sctp_port_hashtable[i].chain);
Greg Kroah-Hartman
maintainerPATCH 48/342 ext4: fix bh->b_state corruption
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit ed8ad83808f009ade97ebbf6519bc3a97fefbc0c upstream.
ext4 can update bh->b_state non-atomically in _ext4_get_block() and ext4_da_get_block_prep(). Usually this is fine since bh is just a temporary storage for mapping information on stack but in some cases it can be fully living bh attached to a page. In such case non-atomic update of bh->b_state can race with an atomic update which then gets lost. Usually when we are mapping bh and thus updating bh->b_state non-atomically, nobody else touches the bh and so things work out fine but there is one case to especially worry about: ext4_finish_bio() uses BH_Uptodate_Lock on the first bh in the page to synchronize handling of PageWriteback state. So when blocksize < pagesize, we can be atomically modifying bh->b_state of a buffer that actually isn't under IO and thus can race e.g. with delalloc trying to map that buffer. The result is that we can mistakenly set / clear BH_Uptodate_Lock bit resulting in the corruption of PageWriteback state or missed unlock of BH_Uptodate_Lock.
Fix the problem by always updating bh->b_state bits atomically.
--- fs/ext4/inode.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-)
fs/ext4/inode.c +30 -2
@@ -657,6 +657,34 @@ has_zeroout:return retval; } +/* +* Update EXT4_MAP_FLAGS in bh->b_state. For buffer heads attached to pages +* we have to be careful as someone else may be manipulating b_state as well. +*/ +static void ext4_update_bh_state (struct buffer_head *bh,unsigned long flags) +{ +unsigned long old_state; +unsigned long new_state; + + flags &=EXT4_MAP_FLAGS ; + +/* Dummy buffer_head? Set non-atomically. */ +if (!bh->b_page) { + bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS ) | flags; +return ; + } +/* +* Someone else may be modifying b_state. Be careful! This is ugly but +* once we get rid of using bh as a container for mapping information +* to pass to / from get_block functions, this can go away. +*/ +do { + old_state =READ_ONCE (bh->b_state); + new_state = (old_state & ~EXT4_MAP_FLAGS ) | flags; + }while (unlikely ( +cmpxchg (&bh->b_state, old_state, new_state) != old_state)); +} +/* Maximum number of blocks we map for direct IO at once. */ #define DIO_MAX_BLOCKS 4096
@@ -693,7 +721,7 @@ static int _ext4_get_block(struct inodeext4_io_end_t *io_end =ext4_inode_aio (inode);map_bh (bh, inode->i_sb, map.m_pblk); - bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS ) | map.m_flags; +ext4_update_bh_state (bh, map.m_flags);if (IS_DAX (inode) &&buffer_unwritten (bh)) {/* * dgc: I suspect unwritten conversion on ext4+DAX is
@@ -1669,7 +1697,7 @@ int ext4_da_get_block_prep(struct inodereturn ret;map_bh (bh, inode->i_sb, map.m_pblk); - bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS ) | map.m_flags; +ext4_update_bh_state (bh, map.m_flags);if (buffer_unwritten (bh)) {/* A delayed write to unwritten bh should be marked
Greg Kroah-Hartman
maintainerPATCH 200/342 drm: Add drm_fixp_from_fraction and drm_fixp2int_ceil
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harry Wentland <[email protected]>
commit 64566b5e767f9bc3161055ca1b443a51afb52aad upstream.
drm_fixp_from_fraction allows us to create a fixed point directly from a fraction, rather than creating fixed point values and dividing later. This avoids overflow of our 64 bit value for large numbers.
drm_fixp2int_ceil allows us to return the ceiling of our fixed point value.
[airlied: squash Jordan's fix] 32-bit-build-fix: Jordan Lazare <[email protected]>
--- include/drm/drm_fixed.h | 53 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-)
include/drm/drm_fixed.h +51 -2
@@ -73,18 +73,28 @@ static inline u32 dfixed_div(fixed20_12#define DRM_FIXED_ONE (1ULL << DRM_FIXED_POINT)#define DRM_FIXED_DECIMAL_MASK (DRM_FIXED_ONE - 1)#define DRM_FIXED_DIGITS_MASK (~DRM_FIXED_DECIMAL_MASK) +#define DRM_FIXED_EPSILON 1LL +#define DRM_FIXED_ALMOST_ONE (DRM_FIXED_ONE - DRM_FIXED_EPSILON)static inline s64 drm_int2fixp (int a) {return ((s64 )a) <<DRM_FIXED_POINT ; } -static inline int drm_fixp2int (int64_t a) +static inline int drm_fixp2int (s64 a) {return ((s64 )a) >>DRM_FIXED_POINT ; } -static inline unsigned drm_fixp_msbset (int64_t a) +static inline int drm_fixp2int_ceil (s64 a) +{ +if (a >0 ) +return drm_fixp2int (a +DRM_FIXED_ALMOST_ONE ); +else +return drm_fixp2int (a -DRM_FIXED_ALMOST_ONE ); +} + +static inline unsigned drm_fixp_msbset (s64 a) {unsigned shift, sign = (a >>63 ) &1 ;
@@ -136,6 +146,45 @@ static inline s64 drm_fixp_div(s64 a, s6return result; } +static inline s64 drm_fixp_from_fraction (s64 a,s64 b) +{ +s64 res; +bool a_neg = a <0 ; +bool b_neg = b <0 ; +u64 a_abs = a_neg ? -a : a; +u64 b_abs = b_neg ? -b : b; +u64 rem; + +/* determine integer part */ +u64 res_abs =div64_u64_rem (a_abs, b_abs, &rem); + +/* determine fractional part */ + { +u32 i =DRM_FIXED_POINT ; + +do { + rem <<=1 ; + res_abs <<=1 ; +if (rem >= b_abs) { + res_abs |=1 ; + rem -= b_abs; + } + }while (--i !=0 ); + } + +/* round up LSB */ + { +u64 summand = (rem <<1 ) >= b_abs; + + res_abs += summand; + } + + res = (s64 ) res_abs; +if (a_neg ^ b_neg) + res = -res; +return res; +} +static inline s64 drm_fixp_exp (s64 x) {s64 tolerance =div64_s64 (DRM_FIXED_ONE ,1000000 );
Greg Kroah-Hartman
maintainerPATCH 201/342 drm/dp/mst: Calculate MST PBN with 31.32 fixed point
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harry Wentland <[email protected]>
commit a9ebb3e46c7ef6112c0da466ef0954673ad36832 upstream.
Our PBN value overflows the 20 bits integer part of the 20.12 fixed point. We need to use 31.32 fixed point to avoid this.
This happens with display clocks larger than 293122 (at 24 bpp), which we see with the Sharp (and similar) 4k tiled displays.
--- drivers/gpu/drm/drm_dp_mst_topology.c | 67 +++++++++++++++++++--------------- 1 file changed, 39 insertions(+), 28 deletions(-)
drivers/gpu/drm/drm_dp_mst_topology.c +39 -28
@@ -2571,32 +2571,31 @@ EXPORT_SYMBOL(drm_dp_check_act_status);*/ int drm_dp_calc_pbn_mode (int clock,int bpp) { -fixed20_12 pix_bw; -fixed20_12 fbpp; -fixed20_12 result; -fixed20_12 margin, tmp; -u32 res; - - pix_bw.full =dfixed_const (clock); - fbpp.full =dfixed_const (bpp); - tmp.full =dfixed_const (8 ); - fbpp.full =dfixed_div (fbpp, tmp); - - result.full =dfixed_mul (pix_bw, fbpp); - margin.full =dfixed_const (54 ); - tmp.full =dfixed_const (64 ); - margin.full =dfixed_div (margin, tmp); - result.full =dfixed_div (result, margin); - - margin.full =dfixed_const (1006 ); - tmp.full =dfixed_const (1000 ); - margin.full =dfixed_div (margin, tmp); - result.full =dfixed_mul (result, margin); - - result.full =dfixed_div (result, tmp); - result.full =dfixed_ceil (result); - res =dfixed_trunc (result); -return res; +u64 kbps; +s64 peak_kbps; +u32 numerator; +u32 denominator; + + kbps = clock * bpp; + +/* +* margin 5300ppm + 300ppm ~ 0.6% as per spec, factor is 1.006 +* The unit of 54/64Mbytes/sec is an arbitrary unit chosen based on +* common multiplier to render an integer PBN for all link rate/lane +* counts combinations +* calculate +* peak_kbps *= (1006/1000) +* peak_kbps *= (64/54) +* peak_kbps *= 8 convert to bytes +*/ + + numerator =64 *1006 ; + denominator =54 *8 *1000 *1000 ; + + kbps *= numerator; + peak_kbps =drm_fixp_from_fraction (kbps, denominator); + +return drm_fixp2int_ceil (peak_kbps); }EXPORT_SYMBOL (drm_dp_calc_pbn_mode);
@@ -2604,11 +2603,23 @@ static int test_calc_pbn_mode(void) {int ret; ret =drm_dp_calc_pbn_mode (154000 ,30 ); -if (ret !=689 ) +if (ret !=689 ) { +DRM_ERROR ("PBN calculation test failed - clock %d, bpp %d, expected PBN %d, actual PBN %d.\n" , +154000 ,30 ,689 , ret);return -EINVAL ; + } ret =drm_dp_calc_pbn_mode (234000 ,30 ); -if (ret !=1047 ) +if (ret !=1047 ) { +DRM_ERROR ("PBN calculation test failed - clock %d, bpp %d, expected PBN %d, actual PBN %d.\n" , +234000 ,30 ,1047 , ret); +return -EINVAL ; + } + ret =drm_dp_calc_pbn_mode (297000 ,24 ); +if (ret !=1063 ) { +DRM_ERROR ("PBN calculation test failed - clock %d, bpp %d, expected PBN %d, actual PBN %d.\n" , +297000 ,24 ,1063 , ret);return -EINVAL ; + }return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 53/342 drm/gma500: Use correct unref in the gem bo create function
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit d3e376f52d095103ca51dbda4d6ff8aaf488f98f upstream.
This is called without dev->struct_mutex held, we need to use the _unlocked variant.
Never caught in the wild since you'd need an evil userspace which races a gem_close ioctl call with the in-progress open.
--- drivers/gpu/drm/gma500/gem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/gma500/gem.c +1 -1
@@ -130,7 +130,7 @@ int psb_gem_create(struct drm_file *filereturn ret; }/* We have the initial and handle reference but need only one now */ -drm_gem_object_unreference (&r->gem); +drm_gem_object_unreference_unlocked (&r->gem); *handlep = handle;return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 205/342 drm/radeon: Fix off-by-one errors in radeon_vm_bo_set_addr
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felix Kuehling <[email protected]>
commit 42ef344c0994cc453477afdc7a8eadc578ed0257 upstream.
eoffset is sometimes treated as the last address inside the address range, and sometimes as the first address outside the range. This was resulting in errors when a test filled up the entire address space. Make it consistent to always be the last address within the range. Also fixed related errors when checking the VA limit and in radeon_vm_fence_pts.
--- drivers/gpu/drm/radeon/radeon_vm.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/radeon_vm.c +6 -6
@@ -455,15 +455,15 @@ int radeon_vm_bo_set_addr(struct radeon_if (soffset) {/* make sure object fit at this offset */ - eoffset = soffset + size; + eoffset = soffset + size -1 ;if (soffset >= eoffset) { r = -EINVAL ; goto error_unreserve; } last_pfn = eoffset /RADEON_GPU_PAGE_SIZE ; -if (last_pfn > rdev->vm_manager.max_pfn) { -dev_err (rdev->dev,"va above limit (0x%08X > 0x%08X)\n" , +if (last_pfn >= rdev->vm_manager.max_pfn) { +dev_err (rdev->dev,"va above limit (0x%08X >= 0x%08X)\n" , last_pfn, rdev->vm_manager.max_pfn); r = -EINVAL ; goto error_unreserve;
@@ -478,7 +478,7 @@ int radeon_vm_bo_set_addr(struct radeon_ eoffset /=RADEON_GPU_PAGE_SIZE ;if (soffset || eoffset) {struct interval_tree_node *it; - it =interval_tree_iter_first (&vm->va, soffset, eoffset -1 ); + it =interval_tree_iter_first (&vm->va, soffset, eoffset);if (it && it != &bo_va->it) {struct radeon_bo_va *tmp; tmp = container_of(it, struct radeon_bo_va, it);
@@ -518,7 +518,7 @@ int radeon_vm_bo_set_addr(struct radeon_if (soffset || eoffset) {spin_lock (&vm->status_lock); bo_va->it.start = soffset; - bo_va->it.last = eoffset -1 ; + bo_va->it.last = eoffset;list_add (&bo_va->vm_status, &vm->cleared);spin_unlock (&vm->status_lock);interval_tree_insert (&bo_va->it, &vm->va);
@@ -888,7 +888,7 @@ static void radeon_vm_fence_pts(struct runsigned i; start >>= radeon_vm_block_size; - end >>= radeon_vm_block_size; + end = (end -1 ) >> radeon_vm_block_size;for (i = start; i <= end; ++i)radeon_bo_fence (vm->page_tables[i].bo, fence, true);
Greg Kroah-Hartman
maintainerPATCH 206/342 drm/radeon: call hpd_irq_event on resume
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit dbb17a21c131eca94eb31136eee9a7fe5aff00d9 upstream.
Need to call this on resume if displays changes during suspend in order to properly be notified of changes.
--- drivers/gpu/drm/radeon/radeon_device.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/radeon/radeon_device.c +1 -0
@@ -1744,6 +1744,7 @@ int radeon_resume_kms(struct drm_device }drm_kms_helper_poll_enable (dev); +drm_helper_hpd_irq_event (dev);/* set the power state here in case we are a PX system or headless */ if ((rdev->pm.pm_method ==PM_METHOD_DPM ) && rdev->pm.dpm_enabled)
Greg Kroah-Hartman
maintainerPATCH 211/342 drm/radeon: Add a common function for DFS handling
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Slava Grigorev <[email protected]>
commit a64c9dab1c4d05c87ec8a1cb9b48915816462143 upstream.
Move encoding of DFS (digital frequency synthesizer) divider into a separate function and improve calculation precision.
--- drivers/gpu/drm/radeon/dce6_afmt.c | 12 ++---------- drivers/gpu/drm/radeon/radeon_audio.c | 12 ++++++++++++ drivers/gpu/drm/radeon/radeon_audio.h | 1 + 3 files changed, 15 insertions(+), 10 deletions(-)
drivers/gpu/drm/radeon/dce6_afmt.c +2 -10
@@ -304,18 +304,10 @@ void dce6_dp_audio_set_dto(struct radeonunsigned int div = (RREG32 (DENTIST_DISPCLK_CNTL ) &DENTIST_DPREFCLK_WDIVIDER_MASK ) >>DENTIST_DPREFCLK_WDIVIDER_SHIFT ; - -if (div <128 && div >=96 ) - div -=64 ; -else if (div >=64 ) - div = div /2 -16 ; -else if (div >=8 ) - div /=4 ; -else - div =0 ; + div =radeon_audio_decode_dfs_div (div);if (div) - clock /= div; + clock = clock *100 / div;WREG32 (DCE8_DCCG_AUDIO_DTO1_PHASE ,24000 );WREG32 (DCE8_DCCG_AUDIO_DTO1_MODULE , clock);
drivers/gpu/drm/radeon/radeon_audio.c +12 -0
@@ -775,3 +775,15 @@ void radeon_audio_dpms(struct drm_encodeif (radeon_encoder->audio && radeon_encoder->audio->dpms) radeon_encoder->audio->dpms (encoder, mode ==DRM_MODE_DPMS_ON ); } + +unsigned int radeon_audio_decode_dfs_div (unsigned int div) +{ +if (div >=8 && div <64 ) +return (div -8 ) *25 +200 ; +else if (div >=64 && div <96 ) +return (div -64 ) *50 +1600 ; +else if (div >=96 && div <128 ) +return (div -96 ) *100 +3200 ; +else +return 0 ; +}
drivers/gpu/drm/radeon/radeon_audio.h +1 -0
@@ -79,5 +79,6 @@ void radeon_audio_fini(struct radeon_devvoid radeon_audio_mode_set (struct drm_encoder *encoder,struct drm_display_mode *mode);void radeon_audio_dpms (struct drm_encoder *encoder,int mode); +unsigned int radeon_audio_decode_dfs_div (unsigned int div);#endif
Greg Kroah-Hartman
maintainerPATCH 58/342 efi: Make our variable validation list include the guid
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Jones <[email protected]>
commit 8282f5d9c17fe15a9e658c06e3f343efae1a2a2f upstream.
All the variables in this list so far are defined to be in the global namespace in the UEFI spec, so this just further ensures we're validating the variables we think we are.
Including the guid for entries will become more important in future patches when we decide whether or not to allow deletion of variables based on presence in this list.
--- drivers/firmware/efi/efivars.c | 5 ++- drivers/firmware/efi/vars.c | 52 ++++++++++++++++++++++++++--------------- include/linux/efi.h | 3 +- 3 files changed, 38 insertions(+), 22 deletions(-)
drivers/firmware/efi/efivars.c +3 -2
@@ -221,7 +221,7 @@ sanity_check(struct efi_variable *var, e }if ((attributes & ~EFI_VARIABLE_MASK ) !=0 || -efivar_validate (name, data, size) == false) { +efivar_validate (vendor, name, data, size) == false) {printk (KERN_ERR "efivars: Malformed variable content\n" );return -EINVAL ; }
@@ -447,7 +447,8 @@ static ssize_t efivar_create(struct file }if ((attributes & ~EFI_VARIABLE_MASK ) !=0 || -efivar_validate (name, data, size) == false) { +efivar_validate (new_var->VendorGuid, name, data, + size) == false) {printk (KERN_ERR "efivars: Malformed variable content\n" );return -EINVAL ; }
drivers/firmware/efi/vars.c +33 -19
80 lines not on this page · raw message
include/linux/efi.h +2 -1
@@ -1199,7 +1199,8 @@ int efivar_entry_iter(int (*func)(structstruct efivar_entry *efivar_entry_find (efi_char16_t *name,efi_guid_t guid,struct list_head *head,bool remove); -bool efivar_validate (efi_char16_t *var_name,u8 *data,unsigned long len); +bool efivar_validate (efi_guid_t vendor,efi_char16_t *var_name,u8 *data, +unsigned long data_size);extern struct work_struct efivar_work;void efivar_run_worker (void );
Greg Kroah-Hartman
maintainerPATCH 178/342 drm/amdgpu: move gmc7 support out of CIK dependency
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit e42d85261680edfc350a6c2a86b7fbb44a85014b upstream.
It's used by iceland which is VI.
--- drivers/gpu/drm/amd/amdgpu/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/amdgpu/Makefile +2 -1
@@ -22,7 +22,7 @@ amdgpu-y += amdgpu_device.o amdgpu_kms.o amdgpu_ucode.o amdgpu_bo_list.o amdgpu_ctx.o amdgpu_sync.o # add asic specific block -amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o gmc_v7_0.o cik_ih.o kv_smc.o kv_dpm.o \ +amdgpu-$(CONFIG_DRM_AMDGPU_CIK)+= cik.o cik_ih.o kv_smc.o kv_dpm.o \ ci_smc.o ci_dpm.o dce_v8_0.o gfx_v7_0.o cik_sdma.o uvd_v4_2.o vce_v2_0.o \ amdgpu_amdkfd_gfx_v7.o
@@ -31,6 +31,7 @@ amdgpu-y += \ # add GMC block amdgpu-y += \ + gmc_v7_0.o \ gmc_v8_0.o # add IH block
Greg Kroah-Hartman
maintainerPATCH 25/342 net: Copy inner L3 and L4 headers as unaligned on GRE TEB
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Duyck <[email protected]>
[ Upstream commit 78565208d73ca9b654fb9a6b142214d52eeedfd1 ]
This patch corrects the unaligned accesses seen on GRE TEB tunnels when generating hash keys. Specifically what this patch does is make it so that we force the use of skb_copy_bits when the GRE inner headers will be unaligned due to NET_IP_ALIGNED being a non-zero value.
--- net/core/flow_dissector.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/core/flow_dissector.c +7 -0
@@ -396,6 +396,13 @@ ip_proto_again: goto out_bad; proto = eth->h_proto; nhoff +=sizeof (*eth); + +/* Cap headers that we access via pointers at the +* end of the Ethernet header as our maximum alignment +* at that point is only 2 bytes. +*/ +if (NET_IP_ALIGN ) + hlen = nhoff; } key_control->flags |=FLOW_DIS_ENCAPSULATION ;
Greg Kroah-Hartman
maintainerPATCH 214/342 drm/radeon: mask out WC from BO on unsupported arches
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oded Gabbay <[email protected]>
commit c5244987394648913ae1a03879c58058a2fc2cee upstream.
--- drivers/gpu/drm/radeon/radeon_object.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/gpu/drm/radeon/radeon_object.c +7 -0
@@ -33,6 +33,7 @@#include <linux/slab.h> #include <drm/drmP.h> #include <drm/radeon_drm.h> +#include <drm/drm_cache.h> #include "radeon.h" #include "radeon_trace.h"
@@ -245,6 +246,12 @@ int radeon_bo_create(struct radeon_devicDRM_INFO_ONCE ("Please enable CONFIG_MTRR and CONFIG_X86_PAT for " "better performance thanks to write-combining\n" ); bo->flags &= ~(RADEON_GEM_GTT_WC |RADEON_GEM_GTT_UC ); +#else +/* For architectures that don't support WC memory, +* mask out the WC flag from the BO +*/ +if (!drm_arch_can_wc_memory ()) + bo->flags &= ~RADEON_GEM_GTT_WC ;#endif radeon_ttm_placement_from_domain (bo, domain);
Greg Kroah-Hartman
maintainerPATCH 215/342 drm/radeon: hold reference to fences in radeon_sa_bo_new
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolai Hähnle <[email protected]>
commit f6ff4f67cdf8455d0a4226eeeaf5af17c37d05eb upstream.
An arbitrary amount of time can pass between spin_unlock and radeon_fence_wait_any, so we need to ensure that nobody frees the fences from under us.
Based on the analogous fix for amdgpu.
--- drivers/gpu/drm/radeon/radeon_sa.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/gpu/drm/radeon/radeon_sa.c +5 -0
@@ -349,8 +349,13 @@ int radeon_sa_bo_new(struct radeon_devic/* see if we can skip over some allocations */ }while (radeon_sa_bo_next_hole (sa_manager, fences, tries)); +for (i =0 ; i <RADEON_NUM_RINGS ; ++i) +radeon_fence_ref (fences[i]); +spin_unlock (&sa_manager->wq.lock); r =radeon_fence_wait_any (rdev, fences, false); +for (i =0 ; i <RADEON_NUM_RINGS ; ++i) +radeon_fence_unref (&fences[i]);spin_lock (&sa_manager->wq.lock);/* if we have nothing to wait for block */ if (r == -ENOENT ) {
Greg Kroah-Hartman
maintainerPATCH 216/342 drm: fix missing reference counting decrease
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Insu Yun <[email protected]>
commit dabe19540af9e563d526113bb102e1b9b9fa73f9 upstream.
In drm_dp_mst_allocate_vcpi, it returns true in two paths, but in one path, there is no reference couting decrease.
--- drivers/gpu/drm/drm_dp_mst_topology.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/drm_dp_mst_topology.c +1 -0
@@ -2463,6 +2463,7 @@ bool drm_dp_mst_allocate_vcpi(struct drmDRM_DEBUG_KMS ("payload: vcpi %d already allocated for pbn %d - requested pbn %d\n" , port->vcpi.vcpi, port->vcpi.pbn, pbn);if (pbn == port->vcpi.pbn) { *slots = port->vcpi.num_slots; +drm_dp_put_port (port);return true; } }
Greg Kroah-Hartman
maintainerPATCH 54/342 ARM: 8457/1: psci-smp is built only for SMP
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit be95485a0b8288a93402705730d3ea32f9f812b9 upstream.
The PSCI SMP implementation is built only when both CONFIG_SMP and CONFIG_ARM_PSCI are set, so a configuration that has the latter but not the former can get a link error when it tries to call psci_smp_available().
arch/arm/mach-tegra/built-in.o: In function `tegra114_cpuidle_init':
cpuidle-tegra114.c:(.init.text+0x52a): undefined reference to `psci_smp_available'
This corrects the #ifdef in the psci.h header file to match the Makefile conditional we have for building that function.
--- arch/arm/include/asm/psci.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/include/asm/psci.h +1 -1
@@ -16,7 +16,7 @@extern struct smp_operations psci_smp_ops; -#ifdef CONFIG_ARM_PSCI +#if defined(CONFIG_SMP ) && defined(CONFIG_ARM_PSCI )bool psci_smp_available (void );#else static inline bool psci_smp_available (void ) {return false; }
Greg Kroah-Hartman
maintainerPATCH 217/342 drm/i915: Restore inhibiting the load of the default context
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Wilson <[email protected]>
commit 06ef83a705a98da63797a5a570220b6ca36febd4 upstream.
Following a GPU reset, we may leave the context in a poorly defined state, and reloading from that context will leave the GPU flummoxed. For secondary contexts, this will lead to that context being banned - but currently it is also causing the default context to become banned, leading to turmoil in the shared state.
This is a regression from
commit 6702cf16e0ba8b0129f5aa1b6609d4e9c70bc13b [v4.1]
Author: Ben Widawsky <[email protected]> Date: Mon Mar 16 16:00:58 2015 +0000
drm/i915: Initialize all contexts
which quietly introduced the removal of the MI_RESTORE_INHIBIT on the default context.
v2: Mark the global default context as uninitialized on GPU reset so that the context-local workarounds are reloaded upon re-enabling.
[danvet: This seems to fix a gpu hand on after the first resume, resulting in any future suspend operation failing with -EIO because the gpu seems to be in a funky state. Somehow this patch fixes that.]
--- drivers/gpu/drm/i915/i915_gem_context.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_gem_context.c +5 -1
@@ -340,6 +340,10 @@ void i915_gem_context_reset(struct drm_di915_gem_context_unreference (lctx); ring->last_context =NULL ; } + +/* Force the GPU state to be reinitialised on enabling */ +if (ring->default_context) + ring->default_context->legacy_hw_ctx.initialized = false; } }
@@ -708,7 +712,7 @@ static int do_switch(struct drm_i915_gemif (ret) goto unpin_out; -if (!to->legacy_hw_ctx.initialized) { +if (!to->legacy_hw_ctx.initialized ||i915_gem_context_is_default (to)) { hw_flags |=MI_RESTORE_INHIBIT ;/* NB: If we inhibit the restore, the context is not allowed to * die because future work may end up depending on valid address
Greg Kroah-Hartman
maintainerPATCH 3/342 net: dp83640: Fix tx timestamp overflow handling.
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Manfred Rudigier <[email protected]>
[ Upstream commit 81e8f2e930fe76b9814c71b9d87c30760b5eb705 ]
PHY status frames are not reliable, the PHY may not be able to send them during heavy receive traffic. This overflow condition is signaled by the PHY in the next status frame, but the driver did not make use of it. Instead it always reported wrong tx timestamps to user space after an overflow happened because it assigned newly received tx timestamps to old packets in the queue.
This commit fixes this issue by clearing the tx timestamp queue every time an overflow happens, so that no timestamps are delivered for overflow packets. This way time stamping will continue correctly after an overflow.
--- drivers/net/phy/dp83640.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)
drivers/net/phy/dp83640.c +17 -0
@@ -845,6 +845,11 @@ static void decode_rxts(struct dp83640_pstruct skb_shared_hwtstamps *shhwtstamps =NULL ;struct sk_buff *skb;unsigned long flags; +u8 overflow; + + overflow = (phy_rxts->ns_hi >>14 ) &0x3 ; +if (overflow) +pr_debug ("rx timestamp queue overflow, count %d\n" , overflow);spin_lock_irqsave (&dp83640->rx_lock, flags);
@@ -887,6 +892,7 @@ static void decode_txts(struct dp83640_pstruct skb_shared_hwtstamps shhwtstamps;struct sk_buff *skb;u64 ns; +u8 overflow;/* We must already have the skb that triggered this. */
@@ -896,6 +902,17 @@ static void decode_txts(struct dp83640_ppr_debug ("have timestamp but tx_queue empty\n" );return ; } + + overflow = (phy_txts->ns_hi >>14 ) &0x3 ; +if (overflow) { +pr_debug ("tx timestamp queue overflow, count %d\n" , overflow); +while (skb) { +skb_complete_tx_timestamp (skb,NULL ); + skb =skb_dequeue (&dp83640->tx_queue); + } +return ; + } + ns =phy2txts (phy_txts);memset (&shhwtstamps,0 ,sizeof (shhwtstamps)); shhwtstamps.hwtstamp =ns_to_ktime (ns);
Greg Kroah-Hartman
maintainerPATCH 62/342 bcache: fix a livelock when we cause a huge number of cache misses
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zheng Liu <[email protected]>
commit 2ef9ccbfcb90cf84bdba320a571b18b05c41101b upstream.
Subject : [PATCH v2] bcache: fix a livelock in btree lock
Date : Wed, 25 Feb 2015 20:32:09 +0800 (02/25/2015 04:32:09 AM)
This commit tries to fix a livelock in bcache. This livelock might happen when we causes a huge number of cache misses simultaneously.
When we get a cache miss, bcache will execute the following path.
->cached_dev_make_request()
->cached_dev_read()
->cached_lookup()
->bch->btree_map_keys()
->btree_root() <------------------------
->bch_btree_map_keys_recurse() |
->cache_lookup_fn() |
->cached_dev_cache_miss() |
->bch_btree_insert_check_key() -|
[If btree->seq is not equal to seq + 1, we should return
EINTR and traverse btree again.]In bch_btree_insert_check_key() function we first need to check upgrade flag (op->lock == -1), and when this flag is true we need to release read btree->lock and try to take write btree->lock. During taking and releasing this write lock, btree->seq will be monotone increased in order to prevent other threads modify this in cache miss (see btree.h:74). But if there are some cache misses caused by some requested, we could meet a livelock because btree->seq is always changed by others. Thus no one can make progress.
This commit will try to take write btree->lock if it encounters a race when we traverse btree. Although it sacrifice the scalability but we can ensure that only one can modify the btree.
--- drivers/md/bcache/btree.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/bcache/btree.c +3 -1
@@ -2162,8 +2162,10 @@ int bch_btree_insert_check_key(struct btrw_lock (true, b, b->level);if (b->key.ptr[0 ] != btree_ptr || - b->seq != seq +1 ) + b->seq != seq +1 ) { + op->lock = b->level; goto out; + } }SET_KEY_PTRS (check_key,1 );
Greg Kroah-Hartman
maintainerPATCH 181/342 drm/amdgpu: pull topaz gmc bits into gmc_v7
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 72b459c8f716ef03a8a0c78078547ce64d8d29a2 upstream.
Add the topaz golden settings into the gmc7 module.
--- drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 35 ++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c +33 -2
@@ -44,8 +44,37 @@ MODULE_FIRMWARE("radeon/bonaire_mc.bin")MODULE_FIRMWARE ("radeon/hawaii_mc.bin" );MODULE_FIRMWARE ("amdgpu/topaz_mc.bin" ); +static const u32 golden_settings_iceland_a11[] = +{ + mmVM_PRT_APERTURE0_LOW_ADDR,0x0fffffff ,0x0fffffff , + mmVM_PRT_APERTURE1_LOW_ADDR,0x0fffffff ,0x0fffffff , + mmVM_PRT_APERTURE2_LOW_ADDR,0x0fffffff ,0x0fffffff , + mmVM_PRT_APERTURE3_LOW_ADDR,0x0fffffff ,0x0fffffff +}; + +static const u32 iceland_mgcg_cgcg_init[] = +{ + mmMC_MEM_POWER_LS,0xffffffff ,0x00000104 +}; + +static void gmc_v7_0_init_golden_registers (struct amdgpu_device *adev) +{ +switch (adev->asic_type) { +case CHIP_TOPAZ : +amdgpu_program_register_sequence (adev, + iceland_mgcg_cgcg_init, + (const u32 )ARRAY_SIZE (iceland_mgcg_cgcg_init)); +amdgpu_program_register_sequence (adev, + golden_settings_iceland_a11, + (const u32 )ARRAY_SIZE (golden_settings_iceland_a11)); +break ; +default : +break ; + } +} +/** -* gmc8_mc_wait_for_idle - wait for MC idle callback. +* gmc7_mc_wait_for_idle - wait for MC idle callback. * * @adev: amdgpu_device pointer *
@@ -142,7 +171,7 @@ static int gmc_v7_0_init_microcode(strucdefault :BUG (); } -if (adev->asic_type ==CHIP_TOPAZ ) +if (adev->asic_type ==CHIP_TOPAZ )snprintf (fw_name,sizeof (fw_name),"amdgpu/%s_mc.bin" , chip_name);else snprintf (fw_name,sizeof (fw_name),"radeon/%s_mc.bin" , chip_name);
@@ -988,6 +1017,8 @@ static int gmc_v7_0_hw_init(void *handleint r;struct amdgpu_device *adev = (struct amdgpu_device *)handle; +gmc_v7_0_init_golden_registers (adev); +gmc_v7_0_mc_program (adev);if (!(adev->flags &AMD_IS_APU )) {
Greg Kroah-Hartman
maintainerPATCH 182/342 drm/amdgpu: drop topaz support from gmc8 module
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 8878d8548ac7fae43cd6d82579f966eb8825e282 upstream.
topaz is actually gmc7.
--- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 28 +--------------------------- 1 file changed, 1 insertion(+), 27 deletions(-)
drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c +1 -27
@@ -42,7 +42,6 @@static void gmc_v8_0_set_gart_funcs (struct amdgpu_device *adev);static void gmc_v8_0_set_irq_funcs (struct amdgpu_device *adev); -MODULE_FIRMWARE ("amdgpu/topaz_mc.bin" );MODULE_FIRMWARE ("amdgpu/tonga_mc.bin" ); static const u32 golden_settings_tonga_a11[] =
@@ -74,19 +73,6 @@ static const u32 fiji_mgcg_cgcg_init[] = mmMC_MEM_POWER_LS,0xffffffff ,0x00000104 }; -static const u32 golden_settings_iceland_a11[] = -{ - mmVM_PRT_APERTURE0_LOW_ADDR,0x0fffffff ,0x0fffffff , - mmVM_PRT_APERTURE1_LOW_ADDR,0x0fffffff ,0x0fffffff , - mmVM_PRT_APERTURE2_LOW_ADDR,0x0fffffff ,0x0fffffff , - mmVM_PRT_APERTURE3_LOW_ADDR,0x0fffffff ,0x0fffffff -}; - -static const u32 iceland_mgcg_cgcg_init[] = -{ - mmMC_MEM_POWER_LS,0xffffffff ,0x00000104 -}; -static const u32 cz_mgcg_cgcg_init[] = { mmMC_MEM_POWER_LS, 0xffffffff, 0x00000104
@@ -101,14 +87,6 @@ static const u32 stoney_mgcg_cgcg_init[]static void gmc_v8_0_init_golden_registers (struct amdgpu_device *adev) {switch (adev->asic_type) { -case CHIP_TOPAZ : -amdgpu_program_register_sequence (adev, - iceland_mgcg_cgcg_init, - (const u32 )ARRAY_SIZE (iceland_mgcg_cgcg_init)); -amdgpu_program_register_sequence (adev, - golden_settings_iceland_a11, - (const u32 )ARRAY_SIZE (golden_settings_iceland_a11)); -break ;case CHIP_FIJI : amdgpu_program_register_sequence(adev, fiji_mgcg_cgcg_init,
@@ -228,9 +206,6 @@ static int gmc_v8_0_init_microcode(strucDRM_DEBUG ("\n" );switch (adev->asic_type) { -case CHIP_TOPAZ : - chip_name ="topaz" ; -break ;case CHIP_TONGA : chip_name ="tonga" ;break ;
@@ -1000,8 +975,7 @@ static int gmc_v8_0_hw_init(void *handlegmc_v8_0_mc_program (adev); -if ((adev->asic_type ==CHIP_TOPAZ ) || - (adev->asic_type ==CHIP_TONGA )) { +if (adev->asic_type ==CHIP_TONGA ) { r =gmc_v8_0_mc_load_microcode (adev);if (r) {DRM_ERROR ("Failed to load MC firmware!\n" );
Greg Kroah-Hartman
maintainerPATCH 5/342 lwt: fix rx checksum setting for lwt devices tunneling over ipv6
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paolo Abeni <[email protected]>
[ Upstream commit c868ee7063bdb53f3ef9eac7bcec84960980b471 ]
the commit 35e2d1152b22 ("tunnels: Allow IPv6 UDP checksums to be correctly controlled.") changed the default xmit checksum setting for lwt vxlan/geneve ipv6 tunnels, so that now the checksum is not set into external UDP header.
This commit changes the rx checksum setting for both lwt vxlan/geneve devices created by openvswitch accordingly, so that lwt over ipv6 tunnel pairs are again able to communicate with default values.
--- net/openvswitch/vport-vxlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/openvswitch/vport-vxlan.c +1 -1
@@ -90,7 +90,7 @@ static struct vport *vxlan_tnl_create(coint err;struct vxlan_config conf = { .no_share = true, - .flags =VXLAN_F_COLLECT_METADATA , + .flags =VXLAN_F_COLLECT_METADATA |VXLAN_F_UDP_ZERO_CSUM6_RX , };if (!options) {
Greg Kroah-Hartman
maintainerPATCH 183/342 drm/amdgpu: dont load MEC2 on topaz
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 97dde76a30c2e67fa5fb9cb6a4072c0178c9df26 upstream.
Not validated.
--- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/iceland_smc.c | 12 +++--------- 2 files changed, 5 insertions(+), 11 deletions(-)
drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c +2 -2
@@ -90,7 +90,6 @@ MODULE_FIRMWARE("amdgpu/topaz_ce.bin");MODULE_FIRMWARE ("amdgpu/topaz_pfp.bin" );MODULE_FIRMWARE ("amdgpu/topaz_me.bin" );MODULE_FIRMWARE ("amdgpu/topaz_mec.bin" ); -MODULE_FIRMWARE ("amdgpu/topaz_mec2.bin" );MODULE_FIRMWARE ("amdgpu/topaz_rlc.bin" );MODULE_FIRMWARE ("amdgpu/fiji_ce.bin" );
@@ -807,7 +806,8 @@ static int gfx_v8_0_init_microcode(struc adev->gfx.mec_fw_version =le32_to_cpu (cp_hdr->header.ucode_version); adev->gfx.mec_feature_version =le32_to_cpu (cp_hdr->ucode_feature_version); -if (adev->asic_type !=CHIP_STONEY ) { +if ((adev->asic_type !=CHIP_STONEY ) && + (adev->asic_type !=CHIP_TOPAZ )) {snprintf (fw_name,sizeof (fw_name),"amdgpu/%s_mec2.bin" , chip_name); err =request_firmware (&adev->gfx.mec2_fw, fw_name, adev->dev);if (!err) {
drivers/gpu/drm/amd/amdgpu/iceland_smc.c +3 -9
@@ -432,7 +432,7 @@ static uint32_t iceland_smu_get_mask_forcase AMDGPU_UCODE_ID_CP_ME :return UCODE_ID_CP_ME_MASK ;case AMDGPU_UCODE_ID_CP_MEC1 : -return UCODE_ID_CP_MEC_MASK |UCODE_ID_CP_MEC_JT1_MASK |UCODE_ID_CP_MEC_JT2_MASK ; +return UCODE_ID_CP_MEC_MASK |UCODE_ID_CP_MEC_JT1_MASK ;case AMDGPU_UCODE_ID_CP_MEC2 :return UCODE_ID_CP_MEC_MASK ;case AMDGPU_UCODE_ID_RLC_G :
@@ -522,12 +522,6 @@ static int iceland_smu_request_load_fw(sreturn -EINVAL ; } -if (iceland_smu_populate_single_firmware_entry (adev,UCODE_ID_CP_MEC_JT2 , - &toc->entry[toc->num_entries++])) { -DRM_ERROR ("Failed to get firmware entry for MEC_JT2\n" ); -return -EINVAL ; - } -if (iceland_smu_populate_single_firmware_entry (adev,UCODE_ID_SDMA0 , &toc->entry[toc->num_entries++])) {DRM_ERROR ("Failed to get firmware entry for SDMA0\n" );
@@ -550,8 +544,8 @@ static int iceland_smu_request_load_fw(sUCODE_ID_CP_ME_MASK |UCODE_ID_CP_PFP_MASK |UCODE_ID_CP_MEC_MASK | -UCODE_ID_CP_MEC_JT1_MASK | -UCODE_ID_CP_MEC_JT2_MASK ; +UCODE_ID_CP_MEC_JT1_MASK ; +if (iceland_send_msg_to_smc_with_parameter_without_waiting (adev, PPSMC_MSG_LoadUcodes, fw_to_load)) {DRM_ERROR ("Fail to request SMU load ucode\n" );
Greg Kroah-Hartman
maintainerPATCH 6/342 tcp: fix NULL deref in tcp_v4_send_ack()
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 e62a123b8ef7c5dc4db2c16383d506860ad21b47 ]
Neal reported crashes with this stack trace :
RIP: 0010:[<ffffffff8c57231b>] tcp_v4_send_ack+0x41/0x20f ... CR2: 0000000000000018 CR3: 000000044005c000 CR4: 00000000001427e0 ... [<ffffffff8c57258e>] tcp_v4_reqsk_send_ack+0xa5/0xb4 [<ffffffff8c1a7caa>] tcp_check_req+0x2ea/0x3e0 [<ffffffff8c19e420>] tcp_rcv_state_process+0x850/0x2500 [<ffffffff8c1a6d21>] tcp_v4_do_rcv+0x141/0x330 [<ffffffff8c56cdb2>] sk_backlog_rcv+0x21/0x30 [<ffffffff8c098bbd>] tcp_recvmsg+0x75d/0xf90 [<ffffffff8c0a8700>] inet_recvmsg+0x80/0xa0 [<ffffffff8c17623e>] sock_aio_read+0xee/0x110 [<ffffffff8c066fcf>] do_sync_read+0x6f/0xa0 [<ffffffff8c0673a1>] SyS_read+0x1e1/0x290 [<ffffffff8c5ca262>] system_call_fastpath+0x16/0x1b
The problem here is the skb we provide to tcp_v4_send_ack() had to be parked in the backlog of a new TCP fastopen child because this child was owned by the user at the time an out of window packet arrived.
Before queuing a packet, TCP has to set skb->dev to NULL as the device could disappear before packet is removed from the queue.
Fix this issue by using the net pointer provided by the socket (being a timewait or a request socket).
IPv6 is immune to the bug : tcp_v6_send_response() already gets the net pointer from the socket if provided.
--- net/ipv4/tcp_ipv4.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
net/ipv4/tcp_ipv4.c +8 -5
@@ -705,7 +705,8 @@ release_sk1:outside socket context is ugly, certainly. What can I do? */ -static void tcp_v4_send_ack (struct sk_buff *skb,u32 seq,u32 ack, +static void tcp_v4_send_ack (struct net *net, +struct sk_buff *skb,u32 seq,u32 ack,u32 win,u32 tsval,u32 tsecr,int oif,struct tcp_md5sig_key *key,int reply_flags,u8 tos)
@@ -720,7 +721,6 @@ static void tcp_v4_send_ack(struct sk_bu ]; } rep;struct ip_reply_arg arg; -struct net *net =dev_net (skb_dst (skb)->dev);memset (&rep.th,0 ,sizeof (struct tcphdr ));memset (&arg,0 ,sizeof (arg));
@@ -782,7 +782,8 @@ static void tcp_v4_timewait_ack(struct sstruct inet_timewait_sock *tw =inet_twsk (sk);struct tcp_timewait_sock *tcptw =tcp_twsk (sk); - tcp_v4_send_ack(skb, tcptw->tw_snd_nxt, tcptw->tw_rcv_nxt, + tcp_v4_send_ack(sock_net(sk), skb, + tcptw->tw_snd_nxt, tcptw->tw_rcv_nxt, tcptw->tw_rcv_wnd >> tw->tw_rcv_wscale, tcp_time_stamp + tcptw->tw_ts_offset, tcptw->tw_ts_recent,
@@ -801,8 +802,10 @@ static void tcp_v4_reqsk_send_ack(const/* sk->sk_state == TCP_LISTEN -> for regular TCP_SYN_RECV * sk->sk_state == TCP_SYN_RECV -> for Fast Open. */ - tcp_v4_send_ack(skb, (sk->sk_state == TCP_LISTEN) ? - tcp_rsk(req)->snt_isn + 1 : tcp_sk(sk)->snd_nxt, +u32 seq = (sk->sk_state ==TCP_LISTEN ) ?tcp_rsk (req)->snt_isn +1 : +tcp_sk (sk)->snd_nxt; + + tcp_v4_send_ack(sock_net(sk), skb, seq, tcp_rsk(req)->rcv_nxt, req->rsk_rcv_wnd, tcp_time_stamp, req->ts_recent,
Greg Kroah-Hartman
maintainerPATCH 237/342 ideapad-laptop: Add Lenovo ideapad Y700-17ISK to no_hw_rfkill dmi list
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Boyer <[email protected]>
commit edde316acb5f07c04abf09a92f59db5d2efd14e2 upstream.
One of the newest ideapad models also lacks a physical hw rfkill switch, and trying to read the hw rfkill switch through the ideapad module causes it to always reported blocking breaking wifi.
Fix it by adding this model to the DMI list.
--- drivers/platform/x86/ideapad-laptop.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/ideapad-laptop.c +7 -0
@@ -865,6 +865,13 @@ static const struct dmi_system_id no_hw_ }, }, { + .ident = "Lenovo ideapad Y700-17ISK", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo ideapad Y700-17ISK"), + }, + }, + { .ident ="Lenovo Yoga 2 11 / 13 / Pro" , .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
Greg Kroah-Hartman
maintainerPATCH 238/342 ideapad-laptop: Add Lenovo Yoga 700 to no_hw_rfkill dmi list
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Boyer <[email protected]>
commit 6b31de3e698582fe0b8f7f4bab15831b73204800 upstream.
Like the Yoga 900 models the Lenovo Yoga 700 does not have a hw rfkill switch, and trying to read the hw rfkill switch through the ideapad module causes it to always reported blocking breaking wifi.
This commit adds the Lenovo Yoga 700 to the no_hw_rfkill dmi list, fixing the wifi breakage.
--- drivers/platform/x86/ideapad-laptop.c | 7 +++++++ 1 file changed, 7 insertions(+)
drivers/platform/x86/ideapad-laptop.c +7 -0
@@ -900,6 +900,13 @@ static const struct dmi_system_id no_hw_ }, }, { + .ident = "Lenovo Yoga 700", + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"LENOVO" ), + DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo YOGA 700"), + }, + }, + { .ident ="Lenovo Yoga 900" , .matches = { DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
Greg Kroah-Hartman
maintainerPATCH 8/342 pptp: fix illegal memory access caused by multiple bind()s
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Frederic Sowa <[email protected]>
[ Upstream commit 9a368aff9cb370298fa02feeffa861f2db497c18 ]
Several times already this has been reported as kasan reports caused by syzkaller and trinity and people always looked at RCU races, but it is much more simple. :)
In case we bind a pptp socket multiple times, we simply add it to the callid_sock list but don't remove the old binding. Thus the old socket stays in the bucket with unused call_id indexes and doesn't get cleaned up. This causes various forms of kasan reports which were hard to pinpoint.
Simply don't allow multiple binds and correct error handling in pptp_bind. Also keep sk_state bits in place in pptp_connect.
--- drivers/net/ppp/pptp.c | 34 ++++++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 10 deletions(-)
drivers/net/ppp/pptp.c +24 -10
@@ -129,24 +129,27 @@ static int lookup_chan_dst(u16 call_id,return i <MAX_CALLID ; } -static int add_chan (struct pppox_sock *sock) +static int add_chan (struct pppox_sock *sock, +struct pptp_addr *sa) {static int call_id;spin_lock (&chan_lock); -if (!sock->proto.pptp.src_addr.call_id) { +if (!sa->call_id) { call_id =find_next_zero_bit (callid_bitmap,MAX_CALLID , call_id +1 );if (call_id ==MAX_CALLID ) { call_id =find_next_zero_bit (callid_bitmap,MAX_CALLID ,1 );if (call_id ==MAX_CALLID ) goto out_err; } - sock->proto.pptp.src_addr.call_id = call_id; - }else if (test_bit (sock->proto.pptp.src_addr.call_id, callid_bitmap)) + sa->call_id = call_id; + }else if (test_bit (sa->call_id, callid_bitmap)) { goto out_err; + } -set_bit (sock->proto.pptp.src_addr.call_id, callid_bitmap); -rcu_assign_pointer (callid_sock[sock->proto.pptp.src_addr.call_id], sock); + sock->proto.pptp.src_addr = *sa; +set_bit (sa->call_id, callid_bitmap); +rcu_assign_pointer (callid_sock[sa->call_id], sock);spin_unlock (&chan_lock);return 0 ;
@@ -416,7 +419,6 @@ static int pptp_bind(struct socket *sockstruct sock *sk = sock->sk;struct sockaddr_pppox *sp = (struct sockaddr_pppox *) uservaddr;struct pppox_sock *po =pppox_sk (sk); -struct pptp_opt *opt = &po->proto.pptp;int error =0 ;if (sockaddr_len <sizeof (struct sockaddr_pppox ))
@@ -424,10 +426,22 @@ static int pptp_bind(struct socket *socklock_sock (sk); - opt->src_addr = sp->sa_addr.pptp; -if (add_chan (po)) +if (sk->sk_state &PPPOX_DEAD ) { + error = -EALREADY ; + goto out; + } + +if (sk->sk_state &PPPOX_BOUND ) { error = -EBUSY ; + goto out; + } + +if (add_chan (po, &sp->sa_addr.pptp)) + error = -EBUSY ; +else + sk->sk_state |=PPPOX_BOUND ; +out:release_sock (sk);return error; }
@@ -498,7 +512,7 @@ static int pptp_connect(struct socket *s } opt->dst_addr = sp->sa_addr.pptp; - sk->sk_state =PPPOX_CONNECTED ; + sk->sk_state |=PPPOX_CONNECTED ; end:release_sock (sk);
Greg Kroah-Hartman
maintainerPATCH 224/342 drm/i915/dsi: defend gpio table against out of bounds access
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jani Nikula <[email protected]>
commit 4db3a2448ec8902310acb78de39b6227a9a56ac8 upstream.
Do not blindly trust the VBT data used for indexing.
--- drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/i915/intel_dsi_panel_vbt.c +6 -0
@@ -209,6 +209,11 @@ static const u8 *mipi_exec_gpio(struct i/* pull up/down */ action = *data++; +if (gpio >=ARRAY_SIZE (gtable)) { +DRM_DEBUG_KMS ("unknown gpio %u\n" , gpio); + goto out; + } + function = gtable[gpio].function_reg; pad = gtable[gpio].pad_reg;
@@ -226,6 +231,7 @@ static const u8 *mipi_exec_gpio(struct ivlv_gpio_nc_write (dev_priv, pad, val);mutex_unlock (&dev_priv->sb_lock); +out:return data; }
Greg Kroah-Hartman
maintainerPATCH 242/342 ACPI / video: Add disable_backlight_sysfs_if quirk for the Toshiba Satellite R830
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit b21f2e81bd3fd8ed260590e72901254bca2193cd upstream.
The Toshiba Satellite R830 needs disable_backlight_sysfs_if=1, just like the Toshiba Portege R830. Add a quirk for this.
--- drivers/acpi/acpi_video.c | 9 +++++++++ 1 file changed, 9 insertions(+)
drivers/acpi/acpi_video.c +9 -0
@@ -482,6 +482,15 @@ static struct dmi_system_id video_dmi_ta DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE R830"), }, }, + { + /* https://bugzilla.kernel.org/show_bug.cgi?id=21012 */ + .callback = video_disable_backlight_sysfs_if, + .ident = "Toshiba Satellite R830", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), + DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE R830"), + }, + },/* * Some machine's _DOD IDs don't have bit 31(Device ID Scheme) set * but the IDs actually follow the Device ID Scheme.
Greg Kroah-Hartman
maintainerPATCH 68/342 bcache: prevent crash on changing writeback_running
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Bader <[email protected]>
commit 8d16ce540c94c9d366eb36fc91b7154d92d6397b upstream.
Added a safeguard in the shutdown case. At least while not being attached it is also possible to trigger a kernel bug by writing into writeback_running. This change adds the same check before trying to wake up the thread for that case.
--- drivers/md/bcache/writeback.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/md/bcache/writeback.h +2 -1
@@ -63,7 +63,8 @@ static inline bool should_writeback(strustatic inline void bch_writeback_queue (struct cached_dev *dc) { -wake_up_process (dc->writeback_thread); +if (!IS_ERR_OR_NULL (dc->writeback_thread)) +wake_up_process (dc->writeback_thread); }static inline void bch_writeback_add (struct cached_dev *dc)
Greg Kroah-Hartman
maintainerPATCH 244/342 ACPI / PCI / hotplug: unlock in error path in acpiphp_enable_slot()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Insu Yun <[email protected]>
commit 2c3033a0664dfae91e1dee7fabac10f24354b958 upstream.
In acpiphp_enable_slot(), there is a missing unlock path when error occurred. It needs to be unlocked before returning an error.
--- drivers/pci/hotplug/acpiphp_glue.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/pci/hotplug/acpiphp_glue.c +3 -1
@@ -953,8 +953,10 @@ int acpiphp_enable_slot(struct acpiphp_s {pci_lock_rescan_remove (); -if (slot->flags &SLOT_IS_GOING_AWAY ) +if (slot->flags &SLOT_IS_GOING_AWAY ) { +pci_unlock_rescan_remove ();return -ENODEV ; + }/* configure all functions */ if (!(slot->flags &SLOT_ENABLED ))
Greg Kroah-Hartman
maintainerPATCH 245/342 nfit: fix multi-interface dimm handling, acpi6.1 compatibility
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 6697b2cf69d4363266ca47eaebc49ef13dabc1c9 upstream.
ACPI 6.1 clarified that multi-interface dimms require multiple control region entries (DCRs) per dimm. Previously we were assuming that a control region is only present when block-data-windows are present. This implementation was done with an eye to be compatibility with the looser ACPI 6.0 interpretation of this table.
1/ When coalescing the memory device (MEMDEV) tables for a single dimm, coalesce on device_handle rather than control region index.
2/ Whenever we disocver a control region with non-zero block windows re-scan for block-data-window (BDW) entries.
We may need to revisit this if a DIMM ever implements a format interface outside of blk or pmem, but that is not on the foreseeable horizon.
--- drivers/acpi/nfit.c | 71 +++++++++++++++++++++++++--------------------------- 1 file changed, 35 insertions(+), 36 deletions(-)
drivers/acpi/nfit.c +35 -36
@@ -468,37 +468,16 @@ static void nfit_mem_find_spa_bdw(struct nfit_mem->bdw =NULL ; } -static int nfit_mem_add (struct acpi_nfit_desc *acpi_desc, +static void nfit_mem_init_bdw (struct acpi_nfit_desc *acpi_desc,struct nfit_mem *nfit_mem,struct acpi_nfit_system_address *spa) {u16 dcr =__to_nfit_memdev (nfit_mem)->region_index;struct nfit_memdev *nfit_memdev;struct nfit_flush *nfit_flush; -struct nfit_dcr *nfit_dcr;struct nfit_bdw *nfit_bdw;struct nfit_idt *nfit_idt;u16 idt_idx, range_index; -list_for_each_entry (nfit_dcr, &acpi_desc->dcrs, list) { -if (nfit_dcr->dcr->region_index != dcr) -continue ; - nfit_mem->dcr = nfit_dcr->dcr; -break ; - } - -if (!nfit_mem->dcr) { -dev_dbg (acpi_desc->dev,"SPA %d missing:%s%s\n" , - spa->range_index,__to_nfit_memdev (nfit_mem) - ?"" :" MEMDEV" , nfit_mem->dcr ?"" :" DCR" ); -return -ENODEV ; - } - -/* -* We've found enough to create an nvdimm, optionally -* find an associated BDW -*/ -list_add (&nfit_mem->list, &acpi_desc->dimms); -list_for_each_entry (nfit_bdw, &acpi_desc->bdws, list) {if (nfit_bdw->bdw->region_index != dcr)continue ;
@@ -507,12 +486,12 @@ static int nfit_mem_add(struct acpi_nfit }if (!nfit_mem->bdw) -return 0 ; +return ;nfit_mem_find_spa_bdw (acpi_desc, nfit_mem);if (!nfit_mem->spa_bdw) -return 0 ; +return ; range_index = nfit_mem->spa_bdw->range_index;list_for_each_entry (nfit_memdev, &acpi_desc->memdevs, list) {
@@ -537,8 +516,6 @@ static int nfit_mem_add(struct acpi_nfit }break ; } - -return 0 ; } static int nfit_mem_dcr_init(struct acpi_nfit_desc *acpi_desc,
@@ -547,7 +524,6 @@ static int nfit_mem_dcr_init(struct acpistruct nfit_mem *nfit_mem, *found;struct nfit_memdev *nfit_memdev;int type =nfit_spa_type (spa); -u16 dcr;switch (type) {case NFIT_SPA_DCR :
@@ -558,14 +534,18 @@ static int nfit_mem_dcr_init(struct acpi }list_for_each_entry (nfit_memdev, &acpi_desc->memdevs, list) { -int rc; +struct nfit_dcr *nfit_dcr; +u32 device_handle; +u16 dcr;if (nfit_memdev->memdev->range_index != spa->range_index)continue ; found =NULL ; dcr = nfit_memdev->memdev->region_index; + device_handle = nfit_memdev->memdev->device_handle;list_for_each_entry (nfit_mem, &acpi_desc->dimms, list) -if (__to_nfit_memdev (nfit_mem)->region_index == dcr) { +if (__to_nfit_memdev (nfit_mem)->device_handle + == device_handle) { found = nfit_mem;break ; }
@@ -578,6 +558,31 @@ static int nfit_mem_dcr_init(struct acpiif (!nfit_mem)return -ENOMEM ;INIT_LIST_HEAD (&nfit_mem->list); +list_add (&nfit_mem->list, &acpi_desc->dimms); + } + +list_for_each_entry (nfit_dcr, &acpi_desc->dcrs, list) { +if (nfit_dcr->dcr->region_index != dcr) +continue ; +/* +* Record the control region for the dimm. For +* the ACPI 6.1 case, where there are separate +* control regions for the pmem vs blk +* interfaces, be sure to record the extended +* blk details. +*/ +if (!nfit_mem->dcr) + nfit_mem->dcr = nfit_dcr->dcr; +else if (nfit_mem->dcr->windows ==0 + && nfit_dcr->dcr->windows) + nfit_mem->dcr = nfit_dcr->dcr; +break ; + } + +if (dcr && !nfit_mem->dcr) { +dev_err (acpi_desc->dev,"SPA %d missing DCR %d\n" , + spa->range_index, dcr); +return -ENODEV ; }if (type ==NFIT_SPA_DCR ) {
@@ -594,6 +599,7 @@ static int nfit_mem_dcr_init(struct acpi nfit_mem->idt_dcr = nfit_idt->idt;break ; } +nfit_mem_init_bdw (acpi_desc, nfit_mem, spa); }else {/* * A single dimm may belong to multiple SPA-PM
@@ -602,13 +608,6 @@ static int nfit_mem_dcr_init(struct acpi*/ nfit_mem->memdev_pmem = nfit_memdev->memdev; } - -if (found) -continue ; - - rc =nfit_mem_add (acpi_desc, nfit_mem, spa); -if (rc) -return rc; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 247/342 dmaengine: dw: fix cyclic transfer callbacks
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mans Rullgard <[email protected]>
commit 2895b2cad6e7a95104cf396e5330054453382ae1 upstream.
Cyclic transfer callbacks rely on block completion interrupts which were disabled in commit ff7b05f29fd4 ("dmaengine/dw_dmac: Don't handle block interrupts"). This re-enables block interrupts so the cyclic callbacks can work. Other transfer types are not affected as they set the INT_EN bit only on the last block.
--- drivers/dma/dw/core.c | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-)
drivers/dma/dw/core.c +15 -6
@@ -156,6 +156,7 @@ static void dwc_initialize(struct dw_dma/* Enable interrupts */ channel_set_bit (dw,MASK .XFER, dwc->mask); +channel_set_bit (dw,MASK .BLOCK, dwc->mask);channel_set_bit (dw,MASK .ERROR, dwc->mask); dwc->initialized = true;
@@ -536,16 +537,17 @@ EXPORT_SYMBOL(dw_dma_get_dst_addr);/* Called with dwc->lock held and all DMAC interrupts disabled */ static void dwc_handle_cyclic (struct dw_dma *dw,struct dw_dma_chan *dwc, -u32 status_err,u32 status_xfer) +u32 status_block,u32 status_err,u32 status_xfer) {unsigned long flags; -if (dwc->mask) { +if (status_block & dwc->mask) {void (*callback)(void *param);void *callback_param;dev_vdbg (chan2dev (&dwc->chan),"new cyclic period llp 0x%08x\n" ,channel_readl (dwc,LLP )); +dma_writel (dw,CLEAR .BLOCK, dwc->mask); callback = dwc->cdesc->period_callback; callback_param = dwc->cdesc->period_callback_param;
@@ -577,6 +579,7 @@ static void dwc_handle_cyclic(struct dw_channel_writel (dwc,CTL_LO ,0 );channel_writel (dwc,CTL_HI ,0 ); +dma_writel (dw,CLEAR .BLOCK, dwc->mask);dma_writel (dw,CLEAR .ERROR, dwc->mask);dma_writel (dw,CLEAR .XFER, dwc->mask);
@@ -593,10 +596,12 @@ static void dw_dma_tasklet(unsigned long {struct dw_dma *dw = (struct dw_dma *)data;struct dw_dma_chan *dwc; +u32 status_block;u32 status_xfer;u32 status_err;int i; + status_block =dma_readl (dw,RAW .BLOCK); status_xfer =dma_readl (dw,RAW .XFER); status_err =dma_readl (dw,RAW .ERROR);
@@ -605,7 +610,8 @@ static void dw_dma_tasklet(unsigned longfor (i =0 ; i < dw->dma.chancnt; i++) { dwc = &dw->chan[i];if (test_bit (DW_DMA_IS_CYCLIC , &dwc->flags)) -dwc_handle_cyclic (dw, dwc, status_err, status_xfer); +dwc_handle_cyclic (dw, dwc, status_block, status_err, + status_xfer);else if (status_err & (1 << i))dwc_handle_error (dw, dwc);else if (status_xfer & (1 << i))
@@ -616,6 +622,7 @@ static void dw_dma_tasklet(unsigned long* Re-enable interrupts. */ channel_set_bit (dw,MASK .XFER, dw->all_chan_mask); +channel_set_bit (dw,MASK .BLOCK, dw->all_chan_mask);channel_set_bit (dw,MASK .ERROR, dw->all_chan_mask); }
@@ -635,6 +642,7 @@ static irqreturn_t dw_dma_interrupt(int* softirq handler. */ channel_clear_bit (dw,MASK .XFER, dw->all_chan_mask); +channel_clear_bit (dw,MASK .BLOCK, dw->all_chan_mask);channel_clear_bit (dw,MASK .ERROR, dw->all_chan_mask); status =dma_readl (dw,STATUS_INT );
@@ -645,6 +653,7 @@ static irqreturn_t dw_dma_interrupt(int/* Try to recover */ channel_clear_bit (dw,MASK .XFER, (1 <<8 ) -1 ); +channel_clear_bit (dw,MASK .BLOCK, (1 <<8 ) -1 );channel_clear_bit (dw,MASK .SRC_TRAN, (1 <<8 ) -1 );channel_clear_bit (dw,MASK .DST_TRAN, (1 <<8 ) -1 );channel_clear_bit (dw,MASK .ERROR, (1 <<8 ) -1 );
@@ -1111,6 +1120,7 @@ static void dw_dma_off(struct dw_dma *dwdma_writel (dw,CFG ,0 );channel_clear_bit (dw,MASK .XFER, dw->all_chan_mask); +channel_clear_bit (dw,MASK .BLOCK, dw->all_chan_mask);channel_clear_bit (dw,MASK .SRC_TRAN, dw->all_chan_mask);channel_clear_bit (dw,MASK .DST_TRAN, dw->all_chan_mask);channel_clear_bit (dw,MASK .ERROR, dw->all_chan_mask);
@@ -1216,6 +1226,7 @@ static void dwc_free_chan_resources(stru/* Disable interrupts */ channel_clear_bit (dw,MASK .XFER, dwc->mask); +channel_clear_bit (dw,MASK .BLOCK, dwc->mask);channel_clear_bit (dw,MASK .ERROR, dwc->mask);spin_unlock_irqrestore (&dwc->lock, flags);
@@ -1458,6 +1469,7 @@ void dw_dma_cyclic_free(struct dma_chandwc_chan_disable (dw, dwc); +dma_writel (dw,CLEAR .BLOCK, dwc->mask);dma_writel (dw,CLEAR .ERROR, dwc->mask);dma_writel (dw,CLEAR .XFER, dwc->mask);
@@ -1546,9 +1558,6 @@ int dw_dma_probe(struct dw_dma_chip *chi/* Force dma off, just in case */ dw_dma_off (dw); -/* Disable BLOCK interrupts as well */ -channel_clear_bit (dw,MASK .BLOCK, dw->all_chan_mask); -/* Create a pool of consistent memory blocks for hardware descriptors */ dw->desc_pool =dmam_pool_create ("dw_dmac_desc_pool" , chip->dev,sizeof (struct dw_desc ),4 ,0 );
Greg Kroah-Hartman
maintainerPATCH 250/342 IB/cm: Fix a recently introduced deadlock
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 4bfdf635c668869c69fd18ece37ec66fb6f38fcf upstream.
ib_send_cm_drep() calls cm_enter_timewait() while holding a spinlock that can be locked from inside an interrupt handler. Hence do not enable interrupts inside cm_enter_timewait() if called with interrupts disabled.
This patch fixes e.g. the following deadlock:
=================================
[ INFO: inconsistent lock state ]
4.4.0-rc7+ #1 Tainted: G E
---------------------------------
inconsistent {HARDIRQ-ON-W} -> {IN-HARDIRQ-W} usage.
swapper/8/0 [HC1[1]:SC0[0]:HE0:SE1] takes:
(&(&cm_id_priv->lock)->rlock){?.+...}, at: [<ffffffffa036eec4>] cm_establish+0x 74/0x1b0 [ib_cm]
{HARDIRQ-ON-W} state was registered at:
[<ffffffff810a3c11>] mark_held_locks+0x71/0x90 [<ffffffff810a3e87>] trace_hardirqs_on_caller+0xa7/0x1c0 [<ffffffff810a3fad>] trace_hardirqs_on+0xd/0x10 [<ffffffff8151c40b>] _raw_spin_unlock_irq+0x2b/0x40 [<ffffffffa036ea8e>] cm_enter_timewait+0xae/0x100 [ib_cm] [<ffffffffa036ff76>] ib_send_cm_drep+0xb6/0x190 [ib_cm] [<ffffffffa052ed08>] srp_cm_handler+0x128/0x1a0 [ib_srp] [<ffffffffa0370340>] cm_process_work+0x20/0xf0 [ib_cm] [<ffffffffa0371335>] cm_dreq_handler+0x135/0x2c0 [ib_cm] [<ffffffffa03733c5>] cm_work_handler+0x75/0xd0 [ib_cm] [<ffffffff8107184d>] process_one_work+0x1bd/0x460 [<ffffffff81073148>] worker_thread+0x118/0x420 [<ffffffff81078454>] kthread+0xe4/0x100 [<ffffffff8151cbbf>] ret_from_fork+0x3f/0x70 irq event stamp: 1672286 hardirqs last enabled at (1672283): [<ffffffff81408ec0>] poll_idle+0x10/0x80 hardirqs last disabled at (1672284): [<ffffffff8151d304>] common_interrupt+0x84/0x89 softirqs last enabled at (1672286): [<ffffffff8105b4dc>] _local_bh_enable+0x1c/0x50 softirqs last disabled at (1672285): [<ffffffff8105b697>] irq_enter+0x47/0x70
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(&(&cm_id_priv->lock)->rlock);
<Interrupt>
lock(&(&cm_id_priv->lock)->rlock);*** DEADLOCK ***
no locks held by swapper/8/0.
stack backtrace: CPU: 8 PID: 0 Comm: swapper/8 Tainted: G E 4.4.0-rc7+ #1 Hardware name: Dell Inc. PowerEdge R430/03XKDV, BIOS 1.0.2 11/17/2014 ffff88045af5e950 ffff88046e503a88 ffffffff81251c1b 0000000000000007 0000000000000006 0000000000000003 ffff88045af5ddc0 ffff88046e503ad8 ffffffff810a32f4 0000000000000000 0000000000000000 0000000000000001 Call Trace: <IRQ> [<ffffffff81251c1b>] dump_stack+0x4f/0x74 [<ffffffff810a32f4>] print_usage_bug+0x184/0x190 [<ffffffff810a36e2>] mark_lock_irq+0xf2/0x290 [<ffffffff810a3995>] mark_lock+0x115/0x1b0 [<ffffffff810a3b8c>] mark_irqflags+0x15c/0x170 [<ffffffff810a4fef>] __lock_acquire+0x1ef/0x560 [<ffffffff810a53c2>] lock_acquire+0x62/0x80 [<ffffffff8151bd33>] _raw_spin_lock_irqsave+0x43/0x60 [<ffffffffa036eec4>] cm_establish+0x74/0x1b0 [ib_cm] [<ffffffffa036f031>] ib_cm_notify+0x31/0x100 [ib_cm] [<ffffffffa0637f24>] srpt_qp_event+0x54/0xd0 [ib_srpt] [<ffffffffa0196052>] mlx4_ib_qp_event+0x72/0xc0 [mlx4_ib] [<ffffffffa00775b9>] mlx4_qp_event+0x69/0xd0 [mlx4_core] [<ffffffffa006000e>] mlx4_eq_int+0x51e/0xd50 [mlx4_core] [<ffffffffa006084f>] mlx4_msi_x_interrupt+0xf/0x20 [mlx4_core] [<ffffffff810b67b0>] handle_irq_event_percpu+0x40/0x110 [<ffffffff810b68bf>] handle_irq_event+0x3f/0x70 [<ffffffff810ba7f9>] handle_edge_irq+0x79/0x120 [<ffffffff81007f3d>] handle_irq+0x5d/0x130 [<ffffffff810071fd>] do_IRQ+0x6d/0x130 [<ffffffff8151d309>] common_interrupt+0x89/0x89 <EOI> [<ffffffff8140895f>] cpuidle_enter_state+0xcf/0x200 [<ffffffff81408aa2>] cpuidle_enter+0x12/0x20 [<ffffffff810990d6>] call_cpuidle+0x36/0x60 [<ffffffff81099163>] cpuidle_idle_call+0x63/0x110 [<ffffffff8109930a>] cpu_idle_loop+0xfa/0x130 [<ffffffff8109934e>] cpu_startup_entry+0xe/0x10 [<ffffffff8103c443>] start_secondary+0x83/0x90
--- drivers/infiniband/core/cm.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/core/cm.c +2 -2
@@ -782,11 +782,11 @@ static void cm_enter_timewait(struct cm_ wait_time =cm_convert_to_ms (cm_id_priv->av.timeout);/* Check if the device started its remove_one */ -spin_lock_irq (&cm.lock); +spin_lock_irqsave (&cm.lock, flags);if (!cm_dev->going_down)queue_delayed_work (cm.wq, &cm_id_priv->timewait_info->work.work,msecs_to_jiffies (wait_time)); -spin_unlock_irq (&cm.lock); +spin_unlock_irqrestore (&cm.lock, flags); cm_id_priv->timewait_info =NULL ; }
Greg Kroah-Hartman
maintainerPATCH 251/342 IB/qib: fix mcast detach when qp not attached
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Marciniszyn <[email protected]>
commit 09dc9cd6528f5b52bcbd3292a6312e762c85260f upstream.
The code produces the following trace:
[1750924.419007] general protection fault: 0000 [#3] SMP [1750924.420364] Modules linked in: nfnetlink autofs4 rpcsec_gss_krb5 nfsv4
dcdbas rfcomm bnep bluetooth nfsd auth_rpcgss nfs_acl dm_multipath nfs lockd scsi_dh sunrpc fscache radeon ttm drm_kms_helper drm serio_raw parport_pc ppdev i2c_algo_bit lpc_ich ipmi_si ib_mthca ib_qib dca lp parport ib_ipoib mac_hid ib_cm i3000_edac ib_sa ib_uverbs edac_core ib_umad ib_mad ib_core ib_addr tg3 ptp dm_mirror dm_region_hash dm_log psmouse pps_core
[1750924.420364] CPU: 1 PID: 8401 Comm: python Tainted: G D 3.13.0-39-generic #66-Ubuntu [1750924.420364] Hardware name: Dell Computer Corporation PowerEdge 860/0XM089, BIOS A04 07/24/2007 [1750924.420364] task: ffff8800366a9800 ti: ffff88007af1c000 task.ti: ffff88007af1c000 [1750924.420364] RIP: 0010:[<ffffffffa0131d51>] [<ffffffffa0131d51>] qib_mcast_qp_free+0x11/0x50 [ib_qib] [1750924.420364] RSP: 0018:ffff88007af1dd70 EFLAGS: 00010246 [1750924.420364] RAX: 0000000000000001 RBX: ffff88007b822688 RCX: 000000000000000f [1750924.420364] RDX: ffff88007b822688 RSI: ffff8800366c15a0 RDI: 6764697200000000 [1750924.420364] RBP: ffff88007af1dd78 R08: 0000000000000001 R09: 0000000000000000 [1750924.420364] R10: 0000000000000011 R11: 0000000000000246 R12: ffff88007baa1d98 [1750924.420364] R13: ffff88003ecab000 R14: ffff88007b822660 R15: 0000000000000000 [1750924.420364] FS: 00007ffff7fd8740(0000) GS:ffff88007fc80000(0000) knlGS:0000000000000000 [1750924.420364] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [1750924.420364] CR2: 00007ffff597c750 CR3: 000000006860b000 CR4: 00000000000007e0 [1750924.420364] Stack: [1750924.420364] ffff88007b822688 ffff88007af1ddf0 ffffffffa0132429 000000007af1de20 [1750924.420364] ffff88007baa1dc8 ffff88007baa0000 ffff88007af1de70 ffffffffa00cb313 [1750924.420364] 00007fffffffde88 0000000000000000 0000000000000008 ffff88003ecab000 [1750924.420364] Call Trace: [1750924.420364] [<ffffffffa0132429>] qib_multicast_detach+0x1e9/0x350 [ib_qib] [1750924.568035] [<ffffffffa00cb313>] ? ib_uverbs_modify_qp+0x323/0x3d0 [ib_uverbs] [1750924.568035] [<ffffffffa0092d61>] ib_detach_mcast+0x31/0x50 [ib_core] [1750924.568035] [<ffffffffa00cc213>] ib_uverbs_detach_mcast+0x93/0x170 [ib_uverbs] [1750924.568035] [<ffffffffa00c61f6>] ib_uverbs_write+0xc6/0x2c0 [ib_uverbs] [1750924.568035] [<ffffffff81312e68>] ? apparmor_file_permission+0x18/0x20 [1750924.568035] [<ffffffff812d4cd3>] ? security_file_permission+0x23/0xa0 [1750924.568035] [<ffffffff811bd214>] vfs_write+0xb4/0x1f0 [1750924.568035] [<ffffffff811bdc49>] SyS_write+0x49/0xa0 [1750924.568035] [<ffffffff8172f7ed>] system_call_fastpath+0x1a/0x1f [1750924.568035] Code: 66 2e 0f 1f 84 00 00 00 00 00 31 c0 5d c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 0f 1f 44 00 00 55 48 89 e5 53 48 89 fb 48 8b 7f 10 <f0> ff 8f 40 01 00 00 74 0e 48 89 df e8 8e f8 06 e1 5b 5d c3 0f [1750924.568035] RIP [<ffffffffa0131d51>] qib_mcast_qp_free+0x11/0x50 [ib_qib] [1750924.568035] RSP <ffff88007af1dd70> [1750924.650439] ---[ end trace 73d5d4b3f8ad4851 ]
The fix is to note the qib_mcast_qp that was found. If none is found, then
return EINVAL indicating the error.
--- drivers/infiniband/hw/qib/qib_verbs_mcast.c | 35 ++++++++++++---------------- 1 file changed, 15 insertions(+), 20 deletions(-)
drivers/infiniband/hw/qib/qib_verbs_mcast.c +15 -20
@@ -286,15 +286,13 @@ int qib_multicast_detach(struct ib_qp *istruct qib_ibdev *dev =to_idev (ibqp->device);struct qib_ibport *ibp =to_iport (ibqp->device, qp->port_num);struct qib_mcast *mcast =NULL ; -struct qib_mcast_qp *p, *tmp; +struct qib_mcast_qp *p, *tmp, *delp =NULL ;struct rb_node *n;int last =0 ;int ret; -if (ibqp->qp_num <=1 || qp->state ==IB_QPS_RESET ) { - ret = -EINVAL ; - goto bail; - } +if (ibqp->qp_num <=1 || qp->state ==IB_QPS_RESET ) +return -EINVAL ;spin_lock_irq (&ibp->lock);
@@ -303,8 +301,7 @@ int qib_multicast_detach(struct ib_qp *iwhile (1 ) {if (n ==NULL ) {spin_unlock_irq (&ibp->lock); - ret = -EINVAL ; - goto bail; +return -EINVAL ; } mcast = rb_entry(n, struct qib_mcast, rb_node);
@@ -328,6 +325,7 @@ int qib_multicast_detach(struct ib_qp *i*/ list_del_rcu (&p->list); mcast->n_attached--; + delp = p;/* If this was the last attached QP, remove the GID too. */ if (list_empty (&mcast->qp_list)) {
@@ -338,15 +336,16 @@ int qib_multicast_detach(struct ib_qp *i }spin_unlock_irq (&ibp->lock); +/* QP not attached */ +if (!delp) +return -EINVAL ; +/* +* Wait for any list walkers to finish before freeing the +* list element. +*/ +wait_event (mcast->wait,atomic_read (&mcast->refcount) <=1 ); +qib_mcast_qp_free (delp); -if (p) { -/* -* Wait for any list walkers to finish before freeing the -* list element. -*/ -wait_event (mcast->wait,atomic_read (&mcast->refcount) <=1 ); -qib_mcast_qp_free (p); - }if (last) {atomic_dec (&mcast->refcount);wait_event (mcast->wait, !atomic_read (&mcast->refcount));
@@ -355,11 +354,7 @@ int qib_multicast_detach(struct ib_qp *i dev->n_mcast_grps_allocated--;spin_unlock_irq (&dev->n_mcast_grps_lock); } - - ret =0 ; - -bail: -return ret; +return 0 ; }int qib_mcast_tree_empty (struct qib_ibport *ibp)
Greg Kroah-Hartman
maintainerPATCH 252/342 IB/qib: Support creating qps with GFP_NOIO flag
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vinit Agnihotri <[email protected]>
commit fbbeb8632bf0b46ab44cfcedc4654cd7831b7161 upstream.
The current code is problematic when the QP creation and ipoib is used to support NFS and NFS desires to do IO for paging purposes. In that case, the GFP_KERNEL allocation in qib_qp.c causes a deadlock in tight memory situations.
This fix adds support to create queue pair with GFP_NOIO flag for connected mode only to cleanly fail the create queue pair in those situations.
--- drivers/infiniband/hw/qib/qib_qp.c | 46 +++++++++++++++++++++++++------------ 1 file changed, 32 insertions(+), 14 deletions(-)
drivers/infiniband/hw/qib/qib_qp.c +32 -14
@@ -100,9 +100,10 @@ static u32 credit_table[31] = { 32768 /* 1E */ }; -static void get_map_page (struct qib_qpn_table *qpt,struct qpn_map *map) +static void get_map_page (struct qib_qpn_table *qpt,struct qpn_map *map, +gfp_t gfp) { -unsigned long page =get_zeroed_page (GFP_KERNEL ); +unsigned long page =get_zeroed_page (gfp);/* * Free the page if someone raced with us installing it.
@@ -121,7 +122,7 @@ static void get_map_page(struct qib_qpn_* zero/one for QP type IB_QPT_SMI/IB_QPT_GSI. */ static int alloc_qpn (struct qib_devdata *dd,struct qib_qpn_table *qpt, -enum ib_qp_type type,u8 port) +enum ib_qp_type type,u8 port,gfp_t gfp) {u32 i, offset, max_scan, qpn;struct qpn_map *map;
@@ -151,7 +152,7 @@ static int alloc_qpn(struct qib_devdata max_scan = qpt->nmaps - !offset;for (i =0 ;;) {if (unlikely (!map->page)) { -get_map_page (qpt, map); +get_map_page (qpt, map, gfp);if (unlikely (!map->page))break ; }
@@ -983,13 +984,21 @@ struct ib_qp *qib_create_qp(struct ib_pdsize_t sz;size_t sg_list_sz;struct ib_qp *ret; +gfp_t gfp; +if (init_attr->cap.max_send_sge > ib_qib_max_sges || init_attr->cap.max_send_wr > ib_qib_max_qp_wrs || - init_attr->create_flags) { - ret =ERR_PTR (-EINVAL ); - goto bail; - } + init_attr->create_flags & ~(IB_QP_CREATE_USE_GFP_NOIO )) +return ERR_PTR (-EINVAL ); + +/* GFP_NOIO is applicable in RC QPs only */ +if (init_attr->create_flags &IB_QP_CREATE_USE_GFP_NOIO && + init_attr->qp_type !=IB_QPT_RC ) +return ERR_PTR (-EINVAL ); + + gfp = init_attr->create_flags &IB_QP_CREATE_USE_GFP_NOIO ? +GFP_NOIO :GFP_KERNEL ;/* Check receive queue parameters if no SRQ is specified. */ if (!init_attr->srq) {
@@ -1021,7 +1030,8 @@ struct ib_qp *qib_create_qp(struct ib_pd sz =sizeof (struct qib_sge ) * init_attr->cap.max_send_sge +sizeof (struct qib_swqe ); - swq =vmalloc ((init_attr->cap.max_send_wr +1 ) * sz); + swq =__vmalloc ((init_attr->cap.max_send_wr +1 ) * sz, + gfp,PAGE_KERNEL );if (swq ==NULL ) { ret =ERR_PTR (-ENOMEM ); goto bail;
@@ -1037,13 +1047,13 @@ struct ib_qp *qib_create_qp(struct ib_pd }else if (init_attr->cap.max_recv_sge >1 ) sg_list_sz =sizeof (*qp->r_sg_list) * (init_attr->cap.max_recv_sge -1 ); - qp =kzalloc (sz + sg_list_sz,GFP_KERNEL ); + qp =kzalloc (sz + sg_list_sz, gfp);if (!qp) { ret =ERR_PTR (-ENOMEM ); goto bail_swq; }RCU_INIT_POINTER (qp->next,NULL ); - qp->s_hdr =kzalloc (sizeof (*qp->s_hdr),GFP_KERNEL ); + qp->s_hdr =kzalloc (sizeof (*qp->s_hdr), gfp);if (!qp->s_hdr) { ret =ERR_PTR (-ENOMEM ); goto bail_qp;
@@ -1058,8 +1068,16 @@ struct ib_qp *qib_create_qp(struct ib_pd qp->r_rq.max_sge = init_attr->cap.max_recv_sge; sz = (sizeof (struct ib_sge ) * qp->r_rq.max_sge) +sizeof (struct qib_rwqe ); - qp->r_rq.wq =vmalloc_user (sizeof (struct qib_rwq ) + - qp->r_rq.size * sz); +if (gfp !=GFP_NOIO ) + qp->r_rq.wq =vmalloc_user ( +sizeof (struct qib_rwq ) + + qp->r_rq.size * sz); +else + qp->r_rq.wq =__vmalloc ( +sizeof (struct qib_rwq ) + + qp->r_rq.size * sz, + gfp,PAGE_KERNEL ); +if (!qp->r_rq.wq) { ret =ERR_PTR (-ENOMEM ); goto bail_qp;
@@ -1090,7 +1108,7 @@ struct ib_qp *qib_create_qp(struct ib_pd dev =to_idev (ibpd->device); dd =dd_from_dev (dev); err =alloc_qpn (dd, &dev->qpn_table, init_attr->qp_type, - init_attr->port_num); + init_attr->port_num, gfp);if (err <0 ) { ret =ERR_PTR (err);vfree (qp->r_rq.wq);
Greg Kroah-Hartman
maintainerPATCH 254/342 Thermal: initialize thermal zone device correctly
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Rui <[email protected]>
commit bb431ba26c5cd0a17c941ca6c3a195a3a6d5d461 upstream.
After thermal zone device registered, as we have not read any temperature before, thus tz->temperature should not be 0, which actually means 0C, and thermal trend is not available. In this case, we need specially handling for the first thermal_zone_device_update().
Both thermal core framework and step_wise governor is enhanced to handle this. And since the step_wise governor is the only one that uses trends, so it's the only thermal governor that needs to be updated.
--- drivers/thermal/step_wise.c | 17 +++++++++++++++-- drivers/thermal/thermal_core.c | 19 +++++++++++++++++-- drivers/thermal/thermal_core.h | 1 + include/linux/thermal.h | 3 +++ 4 files changed, 36 insertions(+), 4 deletions(-)
drivers/thermal/step_wise.c +15 -2
@@ -63,6 +63,19 @@ static unsigned long get_target_state(st next_target = instance->target;dev_dbg (&cdev->device,"cur_state=%ld\n" , cur_state); +if (!instance->initialized) { +if (throttle) { + next_target = (cur_state +1 ) >= instance->upper ? + instance->upper : + ((cur_state +1 ) < instance->lower ? + instance->lower : (cur_state +1 )); + }else { + next_target =THERMAL_NO_TARGET ; + } + +return next_target; + } +switch (trend) {case THERMAL_TREND_RAISING :if (throttle) {
@@ -149,7 +162,7 @@ static void thermal_zone_trip_update(strdev_dbg (&instance->cdev->device,"old_target=%d, target=%d\n" , old_target, (int )instance->target); -if (old_target == instance->target) +if (instance->initialized && old_target == instance->target)continue ;/* Activate a passive thermal instance */
@@ -161,7 +174,7 @@ static void thermal_zone_trip_update(str instance->target == THERMAL_NO_TARGET)update_passive_instance (tz, trip_type,-1 ); - + instance->initialized = true; instance->cdev->updated = false;/* cdev needs update */ }
drivers/thermal/thermal_core.c +17 -2
@@ -532,8 +532,22 @@ static void update_temperature(struct thmutex_unlock (&tz->lock);trace_thermal_temperature (tz); -dev_dbg (&tz->device,"last_temperature=%d, current_temperature=%d\n" , - tz->last_temperature, tz->temperature); +if (tz->last_temperature ==THERMAL_TEMP_INVALID ) +dev_dbg (&tz->device,"last_temperature N/A, current_temperature=%d\n" , + tz->temperature); +else +dev_dbg (&tz->device,"last_temperature=%d, current_temperature=%d\n" , + tz->last_temperature, tz->temperature); +} + +static void thermal_zone_device_reset (struct thermal_zone_device *tz) +{ +struct thermal_instance *pos; + + tz->temperature =THERMAL_TEMP_INVALID ; + tz->passive =0 ; +list_for_each_entry (pos, &tz->thermal_instances, tz_node) + pos->initialized = false; }void thermal_zone_device_update (struct thermal_zone_device *tz)
@@ -1900,6 +1914,7 @@ struct thermal_zone_device *thermal_zoneINIT_DELAYED_WORK (&(tz->poll_queue), thermal_zone_device_check); +thermal_zone_device_reset (tz);thermal_zone_device_update (tz);return tz;
drivers/thermal/thermal_core.h +1 -0
@@ -41,6 +41,7 @@ struct thermal_instance {struct thermal_zone_device *tz;struct thermal_cooling_device *cdev;int trip; +bool initialized;unsigned long upper;/* Highest cooling state for this trip point */ unsigned long lower;/* Lowest cooling state for this trip point */ unsigned long target;/* expected cooling state */
include/linux/thermal.h +3 -0
@@ -43,6 +43,9 @@/* Default weight of a bound cooling device */ #define THERMAL_WEIGHT_DEFAULT 0 +/* use value, which < 0K, to indicate an invalid/uninitialized temperature */ +#define THERMAL_TEMP_INVALID -274000 +/* Unit conversion macros */ #define DECI_KELVIN_TO_CELSIUS (t) ({ \ long _t = (t); \
Greg Kroah-Hartman
maintainerPATCH 34/342 qmi_wwan: add "4G LTE usb-modem U901"
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Bj=C3=B8rn=20Mork?= <[email protected]>
[ Upstream commit aac8d3c282e024c344c5b86dc1eab7af88bb9716 ]
Thomas reports:
T: Bus=01 Lev=01 Prnt=01 Port=03 Cnt=01 Dev#= 4 Spd=480 MxCh= 0 D: Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs= 1 P: Vendor=05c6 ProdID=6001 Rev=00.00 S: Manufacturer=USB Modem S: Product=USB Modem S: SerialNumber=1234567890ABCDEF C: #Ifs= 5 Cfg#= 1 Atr=e0 MxPwr=500mA I: If#= 0 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 1 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=option I: If#= 3 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=ff Prot=ff Driver=qmi_wwan I: If#= 4 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
--- drivers/net/usb/qmi_wwan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/usb/qmi_wwan.c +1 -0
@@ -492,6 +492,7 @@ static const struct usb_device_id produc/* 3. Combined interface devices matching on interface number */ {QMI_FIXED_INTF(0x0408, 0xea42, 4)}, /* Yota / Megafon M100-1 */ + {QMI_FIXED_INTF(0x05c6, 0x6001, 3)}, /* 4G LTE usb-modem U901 */ {QMI_FIXED_INTF(0x05c6, 0x7000, 0)}, {QMI_FIXED_INTF(0x05c6, 0x7001, 1)}, {QMI_FIXED_INTF(0x05c6, 0x7002, 1)},
Greg Kroah-Hartman
maintainerPATCH 255/342 Thermal: handle thermal zone device properly during system sleep
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Zhang Rui <[email protected]>
commit ff140fea847e1c2002a220571ab106c2456ed252 upstream.
Current thermal code does not handle system sleep well because
1. the cooling device cooling state may be changed during suspend
2. the previous temperature reading becomes invalid after resumed because it is got before system sleep
3. updating thermal zone device during suspending/resuming
is wrong because some devices may have already been suspended or may have not been resumed.
Thus, the proper way to do this is to cancel all thermal zone device update requirements during suspend/resume, and after all the devices have been resumed, reset and update every registered thermal zone devices.
This also fixes a regression introduced by:
Commit 19593a1fb1f6 ("ACPI / fan: convert to platform driver") Because, with above commit applied, all the fan devices are attached to the acpi_general_pm_domain, and they are turned on by the pm_domain automatically after resume, without the awareness of thermal core.
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=78201
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=91411
--- drivers/thermal/thermal_core.c | 42 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+)
drivers/thermal/thermal_core.c +42 -0
@@ -37,6 +37,7 @@#include <linux/of.h> #include <net/netlink.h> #include <net/genetlink.h> +#include <linux/suspend.h> #define CREATE_TRACE_POINTS #include <trace/events/thermal.h>
@@ -59,6 +60,8 @@ static LIST_HEAD(thermal_governor_list);static DEFINE_MUTEX (thermal_list_lock);static DEFINE_MUTEX (thermal_governor_lock); +static atomic_t in_suspend; +static struct thermal_governor *def_governor;static struct thermal_governor *__find_governor (const char *name)
@@ -554,6 +557,9 @@ void thermal_zone_device_update(struct t {int count; +if (atomic_read (&in_suspend)) +return ; +if (!tz->ops->get_temp)return ;
@@ -2155,6 +2161,36 @@ static void thermal_unregister_governorsthermal_gov_power_allocator_unregister (); } +static int thermal_pm_notify (struct notifier_block *nb, +unsigned long mode,void *_unused) +{ +struct thermal_zone_device *tz; + +switch (mode) { +case PM_HIBERNATION_PREPARE : +case PM_RESTORE_PREPARE : +case PM_SUSPEND_PREPARE : +atomic_set (&in_suspend,1 ); +break ; +case PM_POST_HIBERNATION : +case PM_POST_RESTORE : +case PM_POST_SUSPEND : +atomic_set (&in_suspend,0 ); +list_for_each_entry (tz, &thermal_tz_list, node) { +thermal_zone_device_reset (tz); +thermal_zone_device_update (tz); + } +break ; +default : +break ; + } +return 0 ; +} + +static struct notifier_block thermal_pm_nb = { + .notifier_call = thermal_pm_notify, +}; +static int __init thermal_init (void ) {int result;
@@ -2175,6 +2211,11 @@ static int __init thermal_init(void)if (result) goto exit_netlink; + result =register_pm_notifier (&thermal_pm_nb); +if (result) +pr_warn ("Thermal: Can not register suspend notifier, return %d\n" , + result); +return 0 ; exit_netlink:
@@ -2194,6 +2235,7 @@ error: static void __exit thermal_exit(void) { +unregister_pm_notifier (&thermal_pm_nb);of_thermal_destroy_zones ();genetlink_exit ();class_unregister (&thermal_class);
Greg Kroah-Hartman
maintainerPATCH 67/342 bcache: allows use of register in udev to avoid "device_busy" error.
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gabriel de Perthuis <[email protected]>
commit d7076f21629f8f329bca4a44dc408d94670f49e2 upstream.
Allows to use register, not register_quiet in udev to avoid "device_busy" error. The initial patch proposed at https://lkml.org/lkml/2013/8/26/549 by Gabriel de Perthuis <[email protected]> does not unlock the mutex and hangs the kernel.
See http://thread.gmane.org/gmane.linux.kernel.bcache.devel/2594 for the discussion.
--- drivers/md/bcache/super.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/md/bcache/super.c +3 -2
@@ -1938,6 +1938,8 @@ static ssize_t register_bcache(struct koelse err ="device busy" ;mutex_unlock (&bch_register_lock); +if (attr == &ksysfs_register_quiet) + goto out; } goto err; }
@@ -1976,8 +1978,7 @@ out: err_close:blkdev_put (bdev,FMODE_READ |FMODE_WRITE |FMODE_EXCL ); err: -if (attr != &ksysfs_register_quiet) -pr_info ("error opening %s: %s" , path, err); +pr_info ("error opening %s: %s" , path, err); ret = -EINVAL ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 226/342 drm/i915: fix error path in intel_setup_gmbus()
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rasmus Villemoes <[email protected]>
commit ed3f9fd1e865975ceefdb2a43b453e090b1fd787 upstream.
This fails to undo the setup for pin==0; moreover, something interesting happens if the setup failed already at pin==0.
--- drivers/gpu/drm/i915/intel_i2c.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_i2c.c +1 -1
@@ -675,7 +675,7 @@ int intel_setup_gmbus(struct drm_devicereturn 0 ; err: -while (--pin) { +while (pin--) {if (!intel_gmbus_is_valid_pin (dev_priv, pin))continue ;
Greg Kroah-Hartman
maintainercover 4.4.4-stable review
This is the start of the stable review cycle for the 4.4.4 release. There are 342 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 Thu Mar 3 23:44:48 UTC 2016. 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.4-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 4.4.4-rc1
Luca Coelho <[email protected]>
iwlwifi: mvm: don't allow sched scans without matches to be started
Oren Givon <[email protected]>
iwlwifi: update and fix 7265 series PCI IDs
Emmanuel Grumbach <[email protected]>
iwlwifi: pcie: properly configure the debug buffer size for 8000
Emmanuel Grumbach <[email protected]>
iwlwifi: dvm: fix WoWLAN
Jann Horn <[email protected]>
security: let security modules use PTRACE_MODE_* with bitmasks
Matan Barak <[email protected]>
IB/cma: Fix RDMA port validation for iWarp
Thomas Gleixner <[email protected]>
x86/irq: Plug vector cleanup race
Thomas Gleixner <[email protected]>
x86/irq: Call irq_force_move_complete with irq descriptor
Thomas Gleixner <[email protected]>
x86/irq: Remove outgoing CPU from vector cleanup mask
Thomas Gleixner <[email protected]>
x86/irq: Remove the cpumask allocation from send_cleanup_vector()
Thomas Gleixner <[email protected]>
x86/irq: Clear move_in_progress before sending cleanup IPI
Thomas Gleixner <[email protected]>
x86/irq: Remove offline cpus from vector cleanup
Thomas Gleixner <[email protected]>
x86/irq: Get rid of code duplication
Thomas Gleixner <[email protected]>
x86/irq: Copy vectormask instead of an AND operation
Thomas Gleixner <[email protected]>
x86/irq: Check vector allocation early
Thomas Gleixner <[email protected]>
x86/irq: Reorganize the search in assign_irq_vector
Thomas Gleixner <[email protected]>
x86/irq: Reorganize the return path in assign_irq_vector
Jiang Liu <[email protected]>
x86/irq: Do not use apic_chip_data.old_domain as temporary buffer
Thomas Gleixner <[email protected]>
x86/irq: Validate that irq descriptor is still active
Jiang Liu <[email protected]>
x86/irq: Fix a race in x86_vector_free_irqs()
Thomas Gleixner <[email protected]>
x86/irq: Call chip->irq_set_affinity in proper context
Andy Lutomirski <[email protected]>
x86/entry/compat: Add missing CLAC to entry_INT80_32
Colin Ian King <[email protected]>
x86/mpx: Fix off-by-one comparison with nr_registers
Mikulas Patocka <[email protected]>
hpfs: don't truncate the file when delete fails
Al Viro <[email protected]>
do_last(): ELOOP failure exit should be done after leaving RCU mode
Al Viro <[email protected]>
should_follow_link(): validate ->d_seq after having decided to follow
Konrad Rzeszutek Wilk <[email protected]>
xen/pcifront: Fix mysterious crashes when NUMA locality information was extracted.
Konrad Rzeszutek Wilk <[email protected]>
xen/pciback: Save the number of MSI-X entries to be copied later.
Konrad Rzeszutek Wilk <[email protected]>
xen/pciback: Check PF instead of VF for PCI_COMMAND_MEMORY
Juergen Gross <[email protected]>
xen/scsiback: correct frontend counting
Ian Campbell <[email protected]>
xen/arm: correctly handle DMA mapping of compound pages
Ludovic Desroches <[email protected]>
ARM: at91/dt: fix typo in sama5d2 pinmux descriptions
Ivaylo Dimitrov <[email protected]>
ARM: OMAP2+: Fix onenand initialization to avoid filesystem corruption
Al Viro <[email protected]>
do_last(): don't let a bogus return value from ->open() et.al. to confuse us
Simon Guinot <[email protected]>
kernel/resource.c: fix muxed resource handling in __request_region()
Stefan Hajnoczi <[email protected]>
sunrpc/cache: fix off-by-one in qword_get()
Steven Rostedt (Red Hat) <[email protected]>
tracing: Fix showing function event in available_events
Gavin Shan <[email protected]>
powerpc/eeh: Fix partial hotplug criterion
Mike Krinkin <[email protected]>
KVM: x86: MMU: fix ubsan index-out-of-range warning
Paolo Bonzini <[email protected]>
KVM: x86: fix conversion of addresses to linear in 32-bit protected mode
Paolo Bonzini <[email protected]>
KVM: x86: fix missed hardware breakpoints
Mark Rutland <[email protected]>
KVM: arm/arm64: vgic: Ensure bitmaps are long enough
Christian Borntraeger <[email protected]>
KVM: async_pf: do not warn on page allocation failures
Robin Murphy <[email protected]>
of/irq: Fix msi-map calculation for nonzero rid-base
Benjamin Coddington <[email protected]>
NFSv4: Fix a dentry leak on alias use
Christoph Hellwig <[email protected]>
nfs: fix nfs_size_to_loff_t
Mike Krinkin <[email protected]>
block: fix use-after-free in dio_bio_complete
Hannes Reinecke <[email protected]>
bio: return EINTR if copying to user space got interrupted
Alexandra Yates <[email protected]>
i2c: i801: Adding Intel Lewisburg support for iTCO
Shawn Lin <[email protected]>
phy: core: fix wrong err handle for phy_power_on
Tejun Heo <[email protected]>
writeback: keep superblock pinned during cgroup writeback association switches
Tejun Heo <[email protected]>
cgroup: make sure a parent css isn't offlined before its children
Tejun Heo <[email protected]>
cpuset: make mm migration asynchronous
Sebastian Andrzej Siewior <[email protected]>
PCI/AER: Flush workqueue on device remove to avoid use-after-free
Vineet Gupta <[email protected]>
ARCv2: SMP: Emulate IPI to self using software triggered interrupt
Vineet Gupta <[email protected]>
ARCv2: STAR 9000950267: Handle return from intr to Delay Slot #2
Tejun Heo <[email protected]>
libata: fix sff host state machine locking while polling
Quinn Tran <[email protected]>
qla2xxx: Fix stale pointer access.
Cyrille Pitchen <[email protected]>
spi: atmel: fix gpio chip-select in case of non-DT platform
Nicholas Bellinger <[email protected]>
target: Fix race with SCF_SEND_DELAYED_TAS handling
Nicholas Bellinger <[email protected]>
target: Fix remote-port TMR ABORT + se_cmd fabric stop
Nicholas Bellinger <[email protected]>
target: Fix TAS handling for multi-session se_node_acls
Nicholas Bellinger <[email protected]>
target: Fix LUN_RESET active TMR descriptor handling
Nicholas Bellinger <[email protected]>
target: Fix LUN_RESET active I/O handling for ACK_KREF
Kai-Heng Feng <[email protected]>
ALSA: hda - Fixing background noise on Dell Inspiron 3162
Takashi Iwai <[email protected]>
ALSA: hda - Apply clock gate workaround to Skylake, too
Tejun Heo <[email protected]>
Revert "workqueue: make sure delayed work run in local cpu"
Tejun Heo <[email protected]>
workqueue: handle NUMA_NO_NODE for unbound pool_workqueue lookup
Sachin Kulkarni <[email protected]>
mac80211: Requeue work after scan complete for all VIF types.
Johannes Berg <[email protected]>
rfkill: fix rfkill_fop_read wait_event usage
Wanpeng Li <[email protected]>
tick/nohz: Set the correct expiry when switching to nohz/lowres mode
Jiri Olsa <[email protected]>
perf stat: Do not clean event's private stats
Oliver Neukum <[email protected]>
cdc-acm:exclude Samsung phone 04e8:685d
Sudip Mukherjee <[email protected]>
Revert "Staging: panel: usleep_range is preferred over udelay"
Samuel Thibault <[email protected]>
Staging: speakup: Fix getting port information
Martin K. Petersen <[email protected]>
sd: Optimal I/O size is in bytes, not sectors
Ilya Dryomov <[email protected]>
libceph: don't spam dmesg with stray reply warnings
Ilya Dryomov <[email protected]>
libceph: use the right footer size when skipping a message
Ilya Dryomov <[email protected]>
libceph: don't bail early from try_read() when skipping a message
Ilya Dryomov <[email protected]>
libceph: fix ceph_msg_revoke()
Jann Horn <[email protected]>
seccomp: always propagate NO_NEW_PRIVS on tsync
Viresh Kumar <[email protected]>
cpufreq: Fix NULL reference crash while accessing policy->governor_data
Arnd Bergmann <[email protected]>
cpufreq: pxa2xx: fix pxa_cpufreq_change_voltage prototype
Peter Rosin <[email protected]>
hwmon: (ads1015) Handle negative conversion values correctly
Nishanth Menon <[email protected]>
hwmon: (gpio-fan) Remove un-necessary speed_index lookup for thermal hook
Thorsten Leemhuis <[email protected]>
hwmon: (dell-smm) Blacklist Dell Studio XPS 8000
Chen Yu <[email protected]>
Thermal: do thermal zone update after a cooling device registered
Zhang Rui <[email protected]>
Thermal: handle thermal zone device properly during system sleep
Zhang Rui <[email protected]>
Thermal: initialize thermal zone device correctly
Leon Romanovsky <[email protected]>
IB/mlx5: Expose correct maximum number of CQE capacity
Vinit Agnihotri <[email protected]>
IB/qib: Support creating qps with GFP_NOIO flag
Mike Marciniszyn <[email protected]>
IB/qib: fix mcast detach when qp not attached
Bart Van Assche <[email protected]>
IB/cm: Fix a recently introduced deadlock
Andy Shevchenko <[email protected]>
dmaengine: dw: disable BLOCK IRQs for non-cyclic xfer
Songjun Wu <[email protected]>
dmaengine: at_xdmac: fix resume for cyclic transfers
Mans Rullgard <[email protected]>
dmaengine: dw: fix cyclic transfer callbacks
Mans Rullgard <[email protected]>
dmaengine: dw: fix cyclic transfer setup
Dan Williams <[email protected]>
nfit: fix multi-interface dimm handling, acpi6.1 compatibility
Insu Yun <[email protected]>
ACPI / PCI / hotplug: unlock in error path in acpiphp_enable_slot()
Hans de Goede <[email protected]>
ACPI: Revert "ACPI / video: Add Dell Inspiron 5737 to the blacklist"
Hans de Goede <[email protected]>
ACPI / video: Add disable_backlight_sysfs_if quirk for the Toshiba Satellite R830
Hans de Goede <[email protected]>
ACPI / video: Add disable_backlight_sysfs_if quirk for the Toshiba Portege R700
Arnd Bergmann <[email protected]>
lib: sw842: select crc32
Mike Frysinger <[email protected]>
uapi: update install list after nvme.h rename
Josh Boyer <[email protected]>
ideapad-laptop: Add Lenovo Yoga 700 to no_hw_rfkill dmi list
Josh Boyer <[email protected]>
ideapad-laptop: Add Lenovo ideapad Y700-17ISK to no_hw_rfkill dmi list
Azael Avalos <[email protected]>
toshiba_acpi: Fix blank screen at boot if transflective backlight is supported
Al Viro <[email protected]>
make sure that freeing shmem fast symlinks is RCU-delayed
Alex Deucher <[email protected]>
drm/radeon/pm: adjust display configuration after powerstate
Mario Kleiner <[email protected]>
drm/radeon: Don't hang in radeon_flip_work_func on disabled crtc. (v2)
Mario Kleiner <[email protected]>
drm: Fix treatment of drm_vblank_offdelay in drm_vblank_on() (v2)
Mario Kleiner <[email protected]>
drm: Fix drm_vblank_pre/post_modeset regression from Linux 4.4
Mario Kleiner <[email protected]>
drm: Prevent vblank counter bumps > 1 with active vblank clients. (v2)
Mario Kleiner <[email protected]>
drm: No-Op redundant calls to drm_vblank_off() (v2)
Rasmus Villemoes <[email protected]>
drm/radeon: use post-decrement in error handling
Gerd Hoffmann <[email protected]>
drm/qxl: use kmalloc_array to alloc reloc_info in qxl_process_single_command
Rasmus Villemoes <[email protected]>
drm/i915: fix error path in intel_setup_gmbus()
Jani Nikula <[email protected]>
drm/i915/dsi: don't pass arbitrary data to sideband
Jani Nikula <[email protected]>
drm/i915/dsi: defend gpio table against out of bounds access
Lyude <[email protected]>
drm/i915/skl: Don't skip mst encoders in skl_ddi_pll_select()
Ville Syrjälä <[email protected]>
drm/i915: Don't reject primary plane windowing with color keying enabled on SKL+
Jani Nikula <[email protected]>
drm/i915/dp: fall back to 18 bpp when sink capability is unknown
Francisco Jerez <[email protected]>
drm/i915: Make sure DC writes are coherent on flush.
Daniel Vetter <[email protected]>
drm/i915: Init power domains early in driver load
Lyude <[email protected]>
drm/i915: intel_hpd_init(): Fix suspend/resume reprobing
Chris Wilson <[email protected]>
drm/i915: Restore inhibiting the load of the default context
Insu Yun <[email protected]>
drm: fix missing reference counting decrease
Nicolai Hähnle <[email protected]>
drm/radeon: hold reference to fences in radeon_sa_bo_new
Oded Gabbay <[email protected]>
drm/radeon: mask out WC from BO on unsupported arches
Dave Airlie <[email protected]>
drm: add helper to check for wc memory support
Slava Grigorev <[email protected]>
drm/radeon: fix DP audio support for APU with DCE4.1 display engine
Slava Grigorev <[email protected]>
drm/radeon: Add a common function for DFS handling
Slava Grigorev <[email protected]>
drm/radeon: cleaned up VCO output settings for DP audio
Alex Deucher <[email protected]>
drm/radeon: properly byte swap vce firmware setup
Alex Deucher <[email protected]>
drm/radeon: clean up fujitsu quirks
Slava Grigorev <[email protected]>
drm/radeon: Fix "slow" audio over DP on DCE8+
Alex Deucher <[email protected]>
drm/radeon: call hpd_irq_event on resume
Felix Kuehling <[email protected]>
drm/radeon: Fix off-by-one errors in radeon_vm_bo_set_addr
Mykola Lysenko <[email protected]>
drm/dp/mst: deallocate payload on port destruction
Andrey Grodzovsky <[email protected]>
drm/dp/mst: Reverse order of MST enable and clearing VC payload table.
Hersen Wu <[email protected]>
drm/dp/mst: move GUID storage from mgr, port to only mst branch
Harry Wentland <[email protected]>
drm/dp/mst: Calculate MST PBN with 31.32 fixed point
Harry Wentland <[email protected]>
drm: Add drm_fixp_from_fraction and drm_fixp2int_ceil
Mykola Lysenko <[email protected]>
drm/dp/mst: fix in RAD element access
Mykola Lysenko <[email protected]>
drm/dp/mst: fix in MSTB RAD initialization
Mykola Lysenko <[email protected]>
drm/dp/mst: always send reply for UP request
Mykola Lysenko <[email protected]>
drm/dp/mst: process broadcast messages correctly
Thierry Reding <[email protected]>
drm/nouveau: platform: Fix deferred probe
Ben Skeggs <[email protected]>
drm/nouveau/disp/dp: ensure sink is powered up before attempting link training
Mario Kleiner <[email protected]>
drm/nouveau/display: Enable vblank irqs after display engine is on again.
Ben Skeggs <[email protected]>
drm/nouveau/kms: take mode_config mutex in connector hotplug path
Alex Deucher <[email protected]>
drm/amdgpu/pm: adjust display configuration after powerstate
Mario Kleiner <[email protected]>
drm/amdgpu: Don't hang in amdgpu_flip_work_func on disabled crtc.
Rasmus Villemoes <[email protected]>
drm/amdgpu: use post-decrement in error handling
Christian König <[email protected]>
drm/amdgpu: fix issue with overlapping userptrs
Nicolai Hähnle <[email protected]>
drm/amdgpu: hold reference to fences in amdgpu_sa_bo_new (v2)
Nicolai Hähnle <[email protected]>
drm/amdgpu: remove unnecessary forward declaration
Flora Cui <[email protected]>
drm/amdgpu: fix s4 resume
Alex Deucher <[email protected]>
drm/amdgpu: remove exp hardware support from iceland
Alex Deucher <[email protected]>
drm/amdgpu: don't load MEC2 on topaz
Alex Deucher <[email protected]>
drm/amdgpu: drop topaz support from gmc8 module
Alex Deucher <[email protected]>
drm/amdgpu: pull topaz gmc bits into gmc_v7
Ken Wang <[email protected]>
drm/amdgpu: The VI specific EXE bit should only apply to GMC v8.0 above
Ken Wang <[email protected]>
drm/amdgpu: iceland use CI based MC IP
Alex Deucher <[email protected]>
drm/amdgpu: move gmc7 support out of CIK dependency
Alex Deucher <[email protected]>
drm/amdgpu: no need to load MC firmware on fiji
Christian König <[email protected]>
drm/amdgpu: fix amdgpu_bo_pin_restricted VRAM placing v2
Alex Deucher <[email protected]>
drm/amdgpu: fix tonga smu resume
Chunming Zhou <[email protected]>
drm/amdgpu: fix lost sync_to if scheduler is enabled.
Alex Deucher <[email protected]>
drm/amdgpu: call hpd_irq_event on resume
Felix Kuehling <[email protected]>
drm/amdgpu: Fix off-by-one errors in amdgpu_vm_bo_map
Rob Clark <[email protected]>
drm/vmwgfx: respect 'nomodeset'
Thomas Hellstrom <[email protected]>
drm/vmwgfx: Fix a width / pitch mismatch on framebuffer updates
Thomas Hellstrom <[email protected]>
drm/vmwgfx: Fix an incorrect lock check
Michael S. Tsirkin <[email protected]>
virtio_pci: fix use after free on release
Minchan Kim <[email protected]>
virtio_balloon: fix race between migration and ballooning
Minchan Kim <[email protected]>
virtio_balloon: fix race by fill and leak
Henry Chen <[email protected]>
regulator: mt6311: MT6311_REGULATOR needs to select REGMAP_I2C
Chen-Yu Tsai <[email protected]>
regulator: axp20x: Fix GPIO LDO enable value for AXP22x
Marek Szyprowski <[email protected]>
clk: exynos: use irqsave version of spin_lock to avoid deadlock with irqs
Andrew Donnellan <[email protected]>
cxl: use correct operator when writing pcie config space values
Dmitry V. Levin <[email protected]>
sparc64: fix incorrect sign extension in sys_sparc64_personality
Borislav Petkov <[email protected]>
EDAC, mc_sysfs: Fix freeing bus' name
Borislav Petkov <[email protected]>
EDAC: Robustify workqueues destruction
James Hogan <[email protected]>
MIPS: Fix buffer overflow in syscall_get_arguments()
Huacai Chen <[email protected]>
MIPS: Fix some missing CONFIG_CPU_MIPSR6 #ifdefs
Huacai Chen <[email protected]>
MIPS: hpet: Choose a safe value for the ETIME check
Huacai Chen <[email protected]>
MIPS: Loongson-3: Fix SMP_ASK_C0COUNT IPI handler
Dan Williams <[email protected]>
Revert "MIPS: Fix PAGE_MASK definition"
zengtao <[email protected]>
cputime: Prevent 32bit overflow in time[val|spec]_to_cputime()
David Gibson <[email protected]>
time: Avoid signed overflow in timekeeping_get_ns()
Lukasz Duda <[email protected]>
Bluetooth: 6lowpan: Fix handling of uncompressed IPv6 packets
Glenn Ruben Bakke <[email protected]>
Bluetooth: 6lowpan: Fix kernel NULL pointer dereferences
Johan Hedberg <[email protected]>
Bluetooth: Fix incorrect removing of IRKs
Dmitry Tunin <[email protected]>
Bluetooth: Add support of Toshiba Broadcom based devices
Johan Hedberg <[email protected]>
Bluetooth: Use continuous scanning when creating LE connections
K. Y. Srinivasan <[email protected]>
Drivers: hv: vmbus: Fix a Host signaling bug
Dexuan Cui <[email protected]>
tools: hv: vss: fix the write()'s argument: error -> vss_msg
Adrian Hunter <[email protected]>
mmc: sdhci: Allow override of get_cd() called from sdhci_request()
Adrian Hunter <[email protected]>
mmc: sdhci: Allow override of mmc host operations
Adrian Hunter <[email protected]>
mmc: sdhci-pci: Fix card detect race for Intel BXT/APL
Robert Jarzmik <[email protected]>
mmc: pxamci: fix again read-only gpio detection polarity
Adrian Hunter <[email protected]>
mmc: sdhci-acpi: Fix card detect race for Intel BXT/APL
Linus Walleij <[email protected]>
mmc: mmci: fix an ages old detection error
Carlo Caione <[email protected]>
mmc: core: Enable tuning according to the actual timing
Adrian Hunter <[email protected]>
mmc: sdhci: Fix sdhci_runtime_pm_bus_on/off()
Wenkai Du <[email protected]>
mmc: mmc: Fix incorrect use of driver strength switching HS200 and HS400
Adrian Hunter <[email protected]>
mmc: sdio: Fix invalid vdd in voltage switch power cycle
Adrian Hunter <[email protected]>
mmc: sdhci: Fix DMA descriptor with zero data length
Adrian Hunter <[email protected]>
mmc: sdhci-pci: Do not default to 33 Ohm driver strength for Intel SPT
Rabin Vincent <[email protected]>
mmc: usdhi6rol0: handle NULL data in timeout
Alexandre Belloni <[email protected]>
clockevents/tcb_clksrc: Prevent disabling an already disabled clock
Richard Cochran <[email protected]>
posix-clock: Fix return code on the poll method's error path
Ashok Kumar <[email protected]>
irqchip/gic-v3-its: Fix double ICC_EOIR write for LPI in EOImode==1
Milo Kim <[email protected]>
irqchip/atmel-aic: Fix wrong bit operation for IRQ priority
Oleksij Rempel <[email protected]>
irqchip/mxs: Add missing set_handle_irq()
Sekhar Nori <[email protected]>
irqchip/omap-intc: Add support for spurious irq handling
Mathieu Poirier <[email protected]>
coresight: checking for NULL string in coresight_name_match()
Mike Snitzer <[email protected]>
dm: fix dm_rq_target_io leak on faults with .request_fn DM w/ blk-mq paths
Mikulas Patocka <[email protected]>
dm snapshot: fix hung bios when copy error occurs
Mike Snitzer <[email protected]>
dm space map metadata: remove unused variable in brb_pop()
Mauro Carvalho Chehab <[email protected]>
tda1004x: only update the frontend properties if locked
Hans Verkuil <[email protected]>
vb2: fix a regression in poll() behavior for output,streams
Antonio Ospite <[email protected]>
gspca: ov534/topro: prevent a division by 0
Laura Abbott <[email protected]>
si2157: return -EINVAL if firmware blob is too big
Malcolm Priestley <[email protected]>
media: dvb-core: Don't force CAN_INVERSION_AUTO in oneshot mode
Chen-Yu Tsai <[email protected]>
rc: sunxi-cir: Initialize the spinlock properly
Al Viro <[email protected]>
namei: ->d_inode of a pinned dentry is stable only for positives
Alexander Usyskin <[email protected]>
mei: validate request value in client notify request ioctl
Tomas Winkler <[email protected]>
mei: fix fasync return value on error
Larry Finger <[email protected]>
rtlwifi: rtl8723be: Fix module parameter initialization
Larry Finger <[email protected]>
rtlwifi: rtl8188ee: Fix module parameter initialization
Larry Finger <[email protected]>
rtlwifi: rtl8192se: Fix module parameter initialization
Larry Finger <[email protected]>
rtlwifi: rtl8723ae: Fix initialization of module parameters
Larry Finger <[email protected]>
rtlwifi: rtl8192de: Fix incorrect module parameter descriptions
Larry Finger <[email protected]>
rtlwifi: rtl8192ce: Fix handling of module parameters
Larry Finger <[email protected]>
rtlwifi: rtl8192cu: Add missing parameter setup
Larry Finger <[email protected]>
rtlwifi: rtl_pci: Fix kernel panic
Jeff Layton <[email protected]>
locks: fix unlock when fcntl_setlk races with a close
Vegard Nossum <[email protected]>
um: link with -lpthread
Vegard Nossum <[email protected]>
uml: fix hostfs mknod()
Vegard Nossum <[email protected]>
uml: flush stdout before forking
Martin Schwidefsky <[email protected]>
s390/fpu: signals vs. floating point control register
Martin Schwidefsky <[email protected]>
s390/compat: correct restore of high gprs on signal return
Stefan Haberland <[email protected]>
s390/dasd: fix performance drop
Stefan Haberland <[email protected]>
s390/dasd: fix refcount for PAV reassignment
Stefan Haberland <[email protected]>
s390/dasd: prevent incorrect length error under z/VM after PAV changes
Ard Biesheuvel <[email protected]>
s390: fix normalization bug in exception table sorting
Sebastian Andrzej Siewior <[email protected]>
btrfs: initialize the seq counter in struct btrfs_device
Chandan Rajendra <[email protected]>
Btrfs: Initialize btrfs_root->highest_objectid when loading tree root and subvolume roots
Filipe Manana <[email protected]>
Btrfs: fix transaction handle leak on failure to create hard link
Filipe Manana <[email protected]>
Btrfs: fix number of transaction units required to create symlink
Filipe Manana <[email protected]>
Btrfs: send, don't BUG_ON() when an empty symlink is found
David Sterba <[email protected]>
btrfs: statfs: report zero available if metadata are exhausted
Josef Bacik <[email protected]>
Btrfs: igrab inode in writepage
Anand Jain <[email protected]>
Btrfs: add missing brelse when superblock checksum fails
David Hildenbrand <[email protected]>
KVM: s390: fix memory overwrites when vx is disabled
Martin Schwidefsky <[email protected]>
s390/kvm: remove dependency on struct save_area definition
Roman Volkov <[email protected]>
clocksource/drivers/vt8500: Increase the minimum delta
Thomas Gleixner <[email protected]>
genirq: Validate action before dereferencing it in handle_irq_event_percpu()
Mel Gorman <[email protected]>
mm: numa: quickly fail allocations for NUMA balancing on full nodes
Andrea Arcangeli <[email protected]>
mm: thp: fix SMP race condition between THP page fault and MADV_DONTNEED
Guozhonghua <[email protected]>
ocfs2: unlock inode if deleting inode from orphan fails
Daniel Vetter <[email protected]>
drm/i915: shut up gen8+ SDE irq dmesg noise
Hariprasad S <[email protected]>
iw_cxgb3: Fix incorrectly returning error on success
Michael Welling <[email protected]>
spi: omap2-mcspi: Prevent duplicate gpio_request
Lisa Du <[email protected]>
drivers: android: correct the size of struct binder_uintptr_t for BC_DEAD_BINDER_DONE
Bjørn Mork <[email protected]>
USB: option: add "4G LTE usb-modem U901"
Andrey Skvortsov <[email protected]>
USB: option: add support for SIM7100E
Ken Lin <[email protected]>
USB: cp210x: add IDs for GE B650V3 and B850V3 boards
John Youn <[email protected]>
usb: dwc3: Fix assignment of EP transfer resources
Gerhard Uttenthaler <[email protected]>
can: ems_usb: Fix possible tx overflow
Nikolay Borisov <[email protected]>
dm thin: fix race condition when destroying thin pool workqueue
Kent Overstreet <[email protected]>
bcache: Change refill_dirty() to always scan entire disk if necessary
Stefan Bader <[email protected]>
bcache: prevent crash on changing writeback_running
Gabriel de Perthuis <[email protected]>
bcache: allows use of register in udev to avoid "device_busy" error.
Zheng Liu <[email protected]>
bcache: unregister reboot notifier if bcache fails to unregister device
Al Viro <[email protected]>
bcache: fix a leak in bch_cached_dev_run()
Zheng Liu <[email protected]>
bcache: clear BCACHE_DEV_UNLINK_DONE flag when attaching a backing device
Kent Overstreet <[email protected]>
bcache: Add a cond_resched() call to gc
Zheng Liu <[email protected]>
bcache: fix a livelock when we cause a huge number of cache misses
Jason Andryuk <[email protected]>
lib/ucs2_string: Correct ucs2 -> utf8 conversion
Matt Fleming <[email protected]>
efi: Add pstore variables to the deletion whitelist
Peter Jones <[email protected]>
efi: Make efivarfs entries immutable by default
Peter Jones <[email protected]>
efi: Make our variable validation list include the guid
Peter Jones <[email protected]>
efi: Do variable name validation tests in utf8
Peter Jones <[email protected]>
efi: Use ucs2_as_utf8 in efivarfs instead of open coding a bad version
Peter Jones <[email protected]>
lib/ucs2_string: Add ucs2 -> utf8 helper functions
Arnd Bergmann <[email protected]>
ARM: 8457/1: psci-smp is built only for SMP
Daniel Vetter <[email protected]>
drm/gma500: Use correct unref in the gem bo create function
Toshi Kani <[email protected]>
devm_memremap: Fix error value when memremap failed
David Hildenbrand <[email protected]>
KVM: s390: fix guest fprs memory leak
dann frazier <[email protected]>
arm64: errata: Add -mpc-relative-literal-loads to build flags
Arnd Bergmann <[email protected]>
ARM: debug-ll: fix BCM63xx entry for multiplatform
Jan Kara <[email protected]>
ext4: fix bh->b_state corruption
Neil Horman <[email protected]>
sctp: Fix port hash table size computation
Dmitry V. Levin <[email protected]>
unix_diag: fix incorrect sign extension in unix_lookup_by_ino
Insu Yun <[email protected]>
tipc: unlock in error path
Anton Protopopov <[email protected]>
rtnl: RTM_GETNETCONF: fix wrong return value
Phil Sutter <[email protected]>
IFF_NO_QUEUE: Fix for drivers not calling ether_setup()
Eric Dumazet <[email protected]>
tcp/dccp: fix another race at listener dismantle
Xin Long <[email protected]>
route: check and remove route cache when we get route
Jamal Hadi Salim <[email protected]>
net_sched fix: reclassification needs to consider ether protocol changes
Guillaume Nault <[email protected]>
pppoe: fix reference counting in PPPoE proxy
Mark Tomlinson <[email protected]>
l2tp: Fix error creating L2TP tunnels
Eugenia Emantayev <[email protected]>
net/mlx4_en: Avoid changing dev->features directly in run-time
Eugenia Emantayev <[email protected]>
net/mlx4_en: Choose time-stamping shift value according to HW frequency
Amir Vadai <[email protected]>
net/mlx4_en: Count HW buffer overrun only once
Bjørn Mork <[email protected]>
qmi_wwan: add "4G LTE usb-modem U901"
Eric Dumazet <[email protected]>
tcp: md5: release request socket instead of listener
Jon Paul Maloy <[email protected]>
tipc: fix premature addition of node to lookup table
Rainer Weikusat <[email protected]>
af_unix: Guard against other == sk in unix_dgram_sendmsg
Rainer Weikusat <[email protected]>
af_unix: Don't set err in unix_stream_read_generic unless there was an error
Eric Dumazet <[email protected]>
ipv4: fix memory leaks in ip_cmsg_send() callers
Jay Vosburgh <[email protected]>
bonding: Fix ARP monitor validation
Daniel Borkmann <[email protected]>
bpf: fix branch offset adjustment on backjumps after patching ctx expansion
Alexander Duyck <[email protected]>
flow_dissector: Fix unaligned access in __skb_flow_dissector when used by eth_get_headlen
Alexander Duyck <[email protected]>
net: Copy inner L3 and L4 headers as unaligned on GRE TEB
Xin Long <[email protected]>
sctp: translate network order to host order when users get a hmacid
Sandeep Pillai <[email protected]>
enic: increment devcmd2 result ring in case of timeout
Siva Reddy Kallam <[email protected]>
tg3: Fix for tg3 transmit queue 0 timed out when too many gso_segs
Hans Westgaard Ry <[email protected]>
net:Add sysctl_max_skb_frags
Eric Dumazet <[email protected]>
tcp: do not drop syn_recv on all icmp reports
Hannes Frederic Sowa <[email protected]>
unix: correctly track in-flight fds in sending process user_struct
Eric Dumazet <[email protected]>
ipv6: fix a lockdep splat
[email protected] <[email protected]>
ipv6: addrconf: Fix recursive spin lock call
Paolo Abeni <[email protected]>
ipv6/udp: use sticky pktinfo egress ifindex on connect()
Paolo Abeni <[email protected]>
ipv6: enforce flowi6_oif usage in ip6_dst_lookup_tail()
Eric Dumazet <[email protected]>
tcp: beware of alignments in tcp_get_info()
Ido Schimmel <[email protected]>
switchdev: Require RTNL mutex to be held when sending FDB notifications
Joe Stringer <[email protected]>
inet: frag: Always orphan skbs inside ip_defrag()
Parthasarathy Bhuvaragan <[email protected]>
tipc: fix connection abort during subscription cancel
Russell King <[email protected]>
net: dsa: fix mv88e6xxx switches
Marcelo Ricardo Leitner <[email protected]>
sctp: allow setting SCTP_SACK_IMMEDIATELY by the application
Hannes Frederic Sowa <[email protected]>
pptp: fix illegal memory access caused by multiple bind()s
Eric Dumazet <[email protected]>
af_unix: fix struct pid memory leak
Eric Dumazet <[email protected]>
tcp: fix NULL deref in tcp_v4_send_ack()
Paolo Abeni <[email protected]>
lwt: fix rx checksum setting for lwt devices tunneling over ipv6
Jesse Gross <[email protected]>
tunnels: Allow IPv6 UDP checksums to be correctly controlled.
Manfred Rudigier <[email protected]>
net: dp83640: Fix tx timestamp overflow handling.
Jesse Gross <[email protected]>
gro: Make GRO aware of lightweight tunnels.
Ursula Braun <[email protected]>
af_iucv: Validate socket address length in iucv_sock_bind()
-------------
Diffstat:
Documentation/filesystems/efivarfs.txt | 7 + Makefile | 4 +- arch/arc/include/asm/irqflags-arcv2.h | 11 + arch/arc/kernel/entry-arcv2.S | 30 +- arch/arc/kernel/mcip.c | 15 + arch/arm/Kconfig.debug | 17 +- arch/arm/boot/dts/sama5d2-pinfunc.h | 2 +- arch/arm/include/asm/psci.h | 2 +- arch/arm/include/asm/xen/page-coherent.h | 21 +- arch/arm/mach-omap2/gpmc-onenand.c | 6 +- arch/arm64/Makefile | 1 + arch/mips/include/asm/page.h | 2 +- arch/mips/include/asm/pgtable.h | 4 +- arch/mips/include/asm/syscall.h | 4 +- arch/mips/loongson64/loongson-3/hpet.c | 10 +- arch/mips/loongson64/loongson-3/smp.c | 20 +- arch/mips/mm/tlbex.c | 2 +- arch/powerpc/kernel/eeh_driver.c | 3 +- arch/s390/include/asm/fpu/internal.h | 2 + arch/s390/include/asm/kvm_host.h | 1 - arch/s390/kernel/asm-offsets.c | 1 + arch/s390/kernel/compat_signal.c | 2 +- arch/s390/kvm/kvm-s390.c | 149 ++++----- arch/s390/mm/extable.c | 8 +- arch/sparc/kernel/sys_sparc_64.c | 2 +- arch/um/os-Linux/start_up.c | 2 + arch/x86/entry/entry_64_compat.S | 1 + arch/x86/include/asm/irq.h | 5 +- arch/x86/kernel/apic/io_apic.c | 6 +- arch/x86/kernel/apic/vector.c | 221 ++++++++----- arch/x86/kernel/irq.c | 11 +- arch/x86/kvm/emulate.c | 4 +- arch/x86/kvm/paging_tmpl.h | 2 +- arch/x86/kvm/x86.c | 1 + arch/x86/mm/mpx.c | 2 +- block/bio.c | 7 +- drivers/acpi/acpi_video.c | 18 + drivers/acpi/nfit.c | 71 ++-- drivers/acpi/video_detect.c | 8 - drivers/android/binder.c | 2 +- drivers/ata/libata-sff.c | 32 +- drivers/bluetooth/btusb.c | 4 + drivers/clk/samsung/clk-cpu.c | 10 +- drivers/clocksource/tcb_clksrc.c | 3 +- drivers/clocksource/vt8500_timer.c | 6 +- drivers/cpufreq/cpufreq_governor.c | 11 +- drivers/cpufreq/pxa2xx-cpufreq.c | 2 +- drivers/dma/at_xdmac.c | 3 + drivers/dma/dw/core.c | 49 ++- drivers/edac/edac_device.c | 11 +- drivers/edac/edac_mc.c | 14 +- drivers/edac/edac_mc_sysfs.c | 21 +- drivers/edac/edac_pci.c | 9 +- drivers/firmware/efi/efivars.c | 35 +- drivers/firmware/efi/vars.c | 144 +++++--- drivers/gpu/drm/amd/amdgpu/Makefile | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 4 +- drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 14 +- drivers/gpu/drm/amd/amdgpu/amdgpu_display.c | 18 +- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 10 +- drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 3 +- drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 5 +- drivers/gpu/drm/amd/amdgpu/amdgpu_sa.c | 5 +- drivers/gpu/drm/amd/amdgpu/amdgpu_sync.c | 5 +- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 23 +- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 10 +- drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c | 4 +- drivers/gpu/drm/amd/amdgpu/gmc_v7_0.c | 43 ++- drivers/gpu/drm/amd/amdgpu/gmc_v8_0.c | 30 +- drivers/gpu/drm/amd/amdgpu/iceland_smc.c | 12 +- drivers/gpu/drm/amd/amdgpu/tonga_dpm.c | 17 +- drivers/gpu/drm/amd/amdgpu/vi.c | 7 +- drivers/gpu/drm/drm_dp_mst_topology.c | 362 ++++++++++++++------- drivers/gpu/drm/drm_irq.c | 73 ++++- drivers/gpu/drm/gma500/gem.c | 2 +- drivers/gpu/drm/i915/i915_dma.c | 6 +- drivers/gpu/drm/i915/i915_gem_context.c | 6 +- drivers/gpu/drm/i915/i915_irq.c | 10 +- drivers/gpu/drm/i915/intel_ddi.c | 3 +- drivers/gpu/drm/i915/intel_display.c | 33 +- drivers/gpu/drm/i915/intel_dsi_panel_vbt.c | 8 +- drivers/gpu/drm/i915/intel_hotplug.c | 9 +- drivers/gpu/drm/i915/intel_i2c.c | 2 +- drivers/gpu/drm/i915/intel_lrc.c | 1 + drivers/gpu/drm/i915/intel_ringbuffer.c | 2 + drivers/gpu/drm/nouveau/nouveau_connector.c | 3 + drivers/gpu/drm/nouveau/nouveau_display.c | 8 +- drivers/gpu/drm/nouveau/nouveau_platform.c | 2 +- drivers/gpu/drm/nouveau/nvkm/engine/device/tegra.c | 40 ++- drivers/gpu/drm/nouveau/nvkm/engine/disp/dport.c | 10 + drivers/gpu/drm/nouveau/nvkm/engine/disp/dport.h | 6 + drivers/gpu/drm/qxl/qxl_ioctl.c | 3 +- drivers/gpu/drm/radeon/dce6_afmt.c | 8 + drivers/gpu/drm/radeon/evergreen_hdmi.c | 10 + drivers/gpu/drm/radeon/evergreend.h | 5 + drivers/gpu/drm/radeon/radeon.h | 1 + drivers/gpu/drm/radeon/radeon_atombios.c | 58 +++- drivers/gpu/drm/radeon/radeon_audio.c | 20 +- drivers/gpu/drm/radeon/radeon_audio.h | 1 + drivers/gpu/drm/radeon/radeon_device.c | 1 + drivers/gpu/drm/radeon/radeon_display.c | 17 +- drivers/gpu/drm/radeon/radeon_object.c | 7 + drivers/gpu/drm/radeon/radeon_pm.c | 5 +- drivers/gpu/drm/radeon/radeon_sa.c | 5 + drivers/gpu/drm/radeon/radeon_ttm.c | 2 +- drivers/gpu/drm/radeon/radeon_vm.c | 12 +- drivers/gpu/drm/radeon/sid.h | 5 + drivers/gpu/drm/radeon/vce_v1_0.c | 12 +- drivers/gpu/drm/vmwgfx/vmwgfx_cmdbuf.c | 2 +- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 7 + drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 6 +- drivers/hv/channel.c | 18 + drivers/hwmon/ads1015.c | 2 +- drivers/hwmon/dell-smm-hwmon.c | 11 + drivers/hwmon/gpio-fan.c | 7 +- drivers/hwtracing/coresight/coresight.c | 2 +- drivers/i2c/busses/i2c-i801.c | 2 + drivers/infiniband/core/cm.c | 4 +- drivers/infiniband/core/cma.c | 2 +- drivers/infiniband/hw/cxgb3/iwch_cm.c | 4 +- drivers/infiniband/hw/mlx5/main.c | 2 +- drivers/infiniband/hw/qib/qib_qp.c | 46 ++- drivers/infiniband/hw/qib/qib_verbs_mcast.c | 35 +- drivers/irqchip/irq-atmel-aic-common.c | 2 +- drivers/irqchip/irq-gic-v3-its.c | 7 +- drivers/irqchip/irq-mxs.c | 1 + drivers/irqchip/irq-omap-intc.c | 27 +- drivers/md/bcache/btree.c | 5 +- drivers/md/bcache/super.c | 16 +- drivers/md/bcache/writeback.c | 37 ++- drivers/md/bcache/writeback.h | 3 +- drivers/md/dm-exception-store.h | 2 +- drivers/md/dm-snap-persistent.c | 5 +- drivers/md/dm-snap-transient.c | 4 +- drivers/md/dm-snap.c | 20 +- drivers/md/dm-thin.c | 4 +- drivers/md/dm.c | 2 + drivers/md/persistent-data/dm-space-map-metadata.c | 3 - drivers/media/dvb-core/dvb_frontend.c | 6 +- drivers/media/dvb-frontends/tda1004x.c | 9 + drivers/media/rc/sunxi-cir.c | 2 + drivers/media/tuners/si2157.c | 1 + drivers/media/usb/gspca/ov534.c | 9 +- drivers/media/usb/gspca/topro.c | 6 +- drivers/media/v4l2-core/videobuf2-v4l2.c | 6 +- drivers/misc/cxl/vphb.c | 2 +- drivers/misc/mei/main.c | 12 +- drivers/mmc/core/mmc.c | 6 +- drivers/mmc/core/sd.c | 8 +- drivers/mmc/core/sdio.c | 6 +- drivers/mmc/host/mmci.c | 2 +- drivers/mmc/host/pxamci.c | 2 +- drivers/mmc/host/sdhci-acpi.c | 30 ++ drivers/mmc/host/sdhci-pci-core.c | 33 +- drivers/mmc/host/sdhci.c | 18 +- drivers/mmc/host/sdhci.h | 1 + drivers/mmc/host/usdhi6rol0.c | 3 +- drivers/net/bonding/bond_main.c | 39 ++- drivers/net/can/usb/ems_usb.c | 14 +- drivers/net/dsa/mv88e6xxx.c | 2 +- drivers/net/ethernet/broadcom/tg3.c | 25 +- drivers/net/ethernet/cisco/enic/enic.h | 2 +- drivers/net/ethernet/cisco/enic/vnic_dev.c | 19 +- drivers/net/ethernet/mellanox/mlx4/en_clock.c | 25 +- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 9 +- drivers/net/ethernet/mellanox/mlx4/en_port.c | 4 +- .../ethernet/mellanox/mlxsw/spectrum_switchdev.c | 3 + drivers/net/ethernet/rocker/rocker.c | 2 + drivers/net/phy/dp83640.c | 17 + drivers/net/ppp/pppoe.c | 2 + drivers/net/ppp/pptp.c | 34 +- drivers/net/usb/qmi_wwan.c | 1 + drivers/net/vxlan.c | 23 +- drivers/net/wireless/iwlwifi/dvm/lib.c | 3 + drivers/net/wireless/iwlwifi/mvm/scan.c | 4 + drivers/net/wireless/iwlwifi/pcie/drv.c | 5 +- drivers/net/wireless/iwlwifi/pcie/trans.c | 15 +- drivers/net/wireless/realtek/rtlwifi/pci.c | 11 +- .../net/wireless/realtek/rtlwifi/rtl8188ee/sw.c | 7 +- .../net/wireless/realtek/rtlwifi/rtl8192ce/sw.c | 2 + .../net/wireless/realtek/rtlwifi/rtl8192cu/sw.c | 2 + .../net/wireless/realtek/rtlwifi/rtl8192de/sw.c | 4 +- .../net/wireless/realtek/rtlwifi/rtl8192se/sw.c | 6 +- .../net/wireless/realtek/rtlwifi/rtl8723ae/sw.c | 9 + .../net/wireless/realtek/rtlwifi/rtl8723be/sw.c | 8 +- drivers/of/irq.c | 9 +- drivers/pci/hotplug/acpiphp_glue.c | 4 +- drivers/pci/pcie/aer/aerdrv.c | 4 +- drivers/pci/pcie/aer/aerdrv.h | 1 - drivers/pci/pcie/aer/aerdrv_core.c | 2 - drivers/pci/xen-pcifront.c | 10 +- drivers/phy/phy-core.c | 16 +- drivers/platform/x86/ideapad-laptop.c | 14 + drivers/platform/x86/toshiba_acpi.c | 8 + drivers/regulator/Kconfig | 1 + drivers/regulator/axp20x-regulator.c | 4 +- drivers/s390/block/dasd.c | 1 + drivers/s390/block/dasd_alias.c | 23 +- drivers/scsi/qla2xxx/qla_init.c | 10 +- drivers/scsi/qla2xxx/qla_isr.c | 4 +- drivers/scsi/qla2xxx/qla_mid.c | 4 +- drivers/scsi/qla2xxx/qla_os.c | 6 + drivers/scsi/qla2xxx/qla_tmpl.c | 16 + drivers/scsi/sd.c | 2 +- drivers/spi/spi-atmel.c | 1 + drivers/spi/spi-omap2-mcspi.c | 19 +- drivers/staging/panel/panel.c | 34 +- drivers/staging/speakup/serialio.c | 13 +- drivers/target/target_core_tmr.c | 139 ++++++-- drivers/target/target_core_transport.c | 278 +++++++++++----- drivers/thermal/step_wise.c | 17 +- drivers/thermal/thermal_core.c | 75 ++++- drivers/thermal/thermal_core.h | 1 + drivers/usb/class/cdc-acm.c | 5 + drivers/usb/dwc3/core.h | 1 - drivers/usb/dwc3/ep0.c | 5 - drivers/usb/dwc3/gadget.c | 70 +++- drivers/usb/serial/cp210x.c | 2 + drivers/usb/serial/option.c | 9 + drivers/virtio/virtio_balloon.c | 2 +- drivers/virtio/virtio_pci_common.c | 2 + drivers/xen/xen-pciback/pciback_ops.c | 9 +- drivers/xen/xen-scsiback.c | 10 +- fs/btrfs/disk-io.c | 28 ++ fs/btrfs/inode-map.c | 9 +- fs/btrfs/inode-map.h | 1 + fs/btrfs/inode.c | 27 +- fs/btrfs/ioctl.c | 4 + fs/btrfs/send.c | 16 +- fs/btrfs/super.c | 24 ++ fs/btrfs/volumes.c | 1 + fs/direct-io.c | 2 +- fs/efivarfs/file.c | 70 ++++ fs/efivarfs/inode.c | 30 +- fs/efivarfs/internal.h | 3 +- fs/efivarfs/super.c | 16 +- fs/ext4/inode.c | 32 +- fs/fs-writeback.c | 15 +- fs/hostfs/hostfs_kern.c | 4 +- fs/hpfs/namei.c | 31 +- fs/locks.c | 51 +-- fs/namei.c | 22 +- fs/nfs/nfs4proc.c | 4 +- fs/ocfs2/aops.c | 1 + include/asm-generic/cputime_nsecs.h | 5 +- include/drm/drm_cache.h | 9 + include/drm/drm_dp_mst_helper.h | 27 +- include/drm/drm_fixed.h | 53 ++- include/linux/ceph/messenger.h | 2 +- include/linux/cgroup-defs.h | 6 + include/linux/cpuset.h | 6 + include/linux/efi.h | 5 +- include/linux/hyperv.h | 18 + include/linux/nfs_fs.h | 4 +- include/linux/shmem_fs.h | 5 +- include/linux/skbuff.h | 1 + include/linux/thermal.h | 5 + include/linux/ucs2_string.h | 4 + include/net/af_unix.h | 4 +- include/net/dst_metadata.h | 18 + include/net/inet_connection_sock.h | 5 +- include/net/ip6_route.h | 12 +- include/net/ip_fib.h | 1 + include/net/scm.h | 1 + include/net/tcp.h | 2 +- include/target/target_core_base.h | 3 + include/uapi/linux/Kbuild | 2 +- kernel/bpf/verifier.c | 2 +- kernel/cgroup.c | 25 +- kernel/cpuset.c | 71 ++-- kernel/irq/handle.c | 5 +- kernel/memremap.c | 4 +- kernel/resource.c | 5 +- kernel/seccomp.c | 22 +- kernel/time/posix-clock.c | 4 +- kernel/time/tick-sched.c | 4 +- kernel/time/timekeeping.c | 3 +- kernel/trace/trace_events.c | 3 +- kernel/workqueue.c | 18 +- lib/Kconfig | 2 + lib/ucs2_string.c | 62 ++++ mm/balloon_compaction.c | 4 +- mm/memory.c | 14 +- mm/migrate.c | 2 +- mm/shmem.c | 9 +- net/bluetooth/6lowpan.c | 7 +- net/bluetooth/hci_conn.c | 6 +- net/bluetooth/hci_request.c | 28 +- net/bluetooth/smp.c | 16 - net/bridge/br.c | 3 +- net/ceph/messenger.c | 91 ++++-- net/ceph/osd_client.c | 4 +- net/core/dev.c | 11 +- net/core/flow_dissector.c | 16 +- net/core/scm.c | 7 + net/core/skbuff.c | 2 + net/core/sysctl_net_core.c | 10 + net/dccp/ipv4.c | 14 +- net/dccp/ipv6.c | 14 +- net/ipv4/devinet.c | 2 +- net/ipv4/inet_connection_sock.c | 14 +- net/ipv4/ip_fragment.c | 1 + net/ipv4/ip_sockglue.c | 2 + net/ipv4/netfilter/nf_defrag_ipv4.c | 2 - net/ipv4/ping.c | 4 +- net/ipv4/raw.c | 4 +- net/ipv4/route.c | 77 ++++- net/ipv4/tcp.c | 16 +- net/ipv4/tcp_ipv4.c | 44 ++- net/ipv4/udp.c | 4 +- net/ipv6/addrconf.c | 7 +- net/ipv6/datagram.c | 3 + net/ipv6/ip6_flowlabel.c | 5 +- net/ipv6/ip6_output.c | 6 +- net/ipv6/route.c | 7 +- net/ipv6/tcp_ipv6.c | 19 +- net/iucv/af_iucv.c | 3 + net/l2tp/l2tp_netlink.c | 18 +- net/mac80211/ibss.c | 1 - net/mac80211/mesh.c | 11 - net/mac80211/mesh.h | 4 - net/mac80211/mlme.c | 2 - net/mac80211/scan.c | 12 +- net/openvswitch/vport-vxlan.c | 2 +- net/rfkill/core.c | 16 +- net/sched/sch_api.c | 1 + net/sctp/protocol.c | 43 ++- net/sctp/socket.c | 11 +- net/sunrpc/cache.c | 2 +- net/switchdev/switchdev.c | 15 +- net/tipc/bcast.c | 4 +- net/tipc/node.c | 12 +- net/tipc/subscr.c | 11 +- net/unix/af_unix.c | 28 +- net/unix/diag.c | 2 +- net/unix/garbage.c | 8 +- scripts/link-vmlinux.sh | 2 +- security/smack/smack_lsm.c | 8 +- security/yama/yama_lsm.c | 4 +- sound/pci/hda/hda_intel.c | 16 +- sound/pci/hda/patch_realtek.c | 8 + tools/hv/hv_vss_daemon.c | 2 +- tools/perf/util/stat.c | 1 - tools/testing/selftests/efivarfs/efivarfs.sh | 19 +- tools/testing/selftests/efivarfs/open-unlink.c | 72 +++- virt/kvm/arm/vgic.c | 4 +- virt/kvm/async_pf.c | 2 +- 348 files changed, 3636 insertions(+), 1595 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 264/342 libceph: dont bail early from try_read() when skipping a message
4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <[email protected]>
commit e7a88e82fe380459b864e05b372638aeacb0f52d upstream.
The contract between try_read() and try_write() is that when called each processes as much data as possible. When instructed by osd_client to skip a message, try_read() is violating this contract by returning after receiving and discarding a single message instead of checking for more. try_write() then gets a chance to write out more requests, generating more replies/skips for try_read() to handle, forcing the messenger into a starvation loop.
--- net/ceph/messenger.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ceph/messenger.c +2 -2
@@ -2340,7 +2340,7 @@ static int read_partial_message(struct c con->in_base_pos = -front_len - middle_len - data_len -sizeof (m->footer); con->in_tag =CEPH_MSGR_TAG_READY ; -return 0 ; +return 1 ; }else if ((s64 )seq - (s64 )con->in_seq >1 ) {pr_err ("read_partial_message bad seq %lld expected %lld\n" , seq, con->in_seq +1 );
@@ -2366,7 +2366,7 @@ static int read_partial_message(struct csizeof (m->footer); con->in_tag =CEPH_MSGR_TAG_READY ; con->in_seq++; -return 0 ; +return 1 ; }BUG_ON (!con->in_msg);
Greg Kroah-Hartman
maintainerPATCH 265/342 libceph: use the right footer size when skipping a message
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <[email protected]>
commit dbc0d3caff5b7591e0cf8e34ca686ca6f4479ee1 upstream.
ceph_msg_footer is 21 bytes long, while ceph_msg_footer_old is only 13. Don't skip too much when CEPH_FEATURE_MSG_AUTH isn't negotiated.
--- net/ceph/messenger.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
net/ceph/messenger.c +9 -2
@@ -1200,6 +1200,13 @@ static bool ceph_msg_data_advance(structreturn new_piece; } +static size_t sizeof_footer (struct ceph_connection *con) +{ +return (con->peer_features &CEPH_FEATURE_MSG_AUTH ) ? +sizeof (struct ceph_msg_footer ) : +sizeof (struct ceph_msg_footer_old ); +} +static void prepare_message_data (struct ceph_msg *msg,u32 data_len) {BUG_ON (!msg);
@@ -2338,7 +2345,7 @@ static int read_partial_message(struct cceph_pr_addr (&con->peer_addr.in_addr), seq, con->in_seq + 1); con->in_base_pos = -front_len - middle_len - data_len - -sizeof (m->footer); +sizeof_footer (con); con->in_tag =CEPH_MSGR_TAG_READY ;return 1 ; }else if ((s64 )seq - (s64 )con->in_seq >1 ) {
@@ -2363,7 +2370,7 @@ static int read_partial_message(struct c/* skip this message */ dout ("alloc_msg said skip message\n" ); con->in_base_pos = -front_len - middle_len - data_len - -sizeof (m->footer); +sizeof_footer (con); con->in_tag =CEPH_MSGR_TAG_READY ; con->in_seq++;return 1 ;
Greg Kroah-Hartman
maintainerPATCH 266/342 libceph: dont spam dmesg with stray reply warnings
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilya Dryomov <[email protected]>
commit cd8140c673d9ba9be3591220e1b2226d9e1e40d3 upstream.
Commit d15f9d694b77 ("libceph: check data_len in ->alloc_msg()") mistakenly bumped the log level on the "tid %llu unknown, skipping" message. Turn it back into a dout() - stray replies are perfectly normal when OSDs flap, crash, get killed for testing purposes, etc.
--- net/ceph/osd_client.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/ceph/osd_client.c +2 -2
@@ -2843,8 +2843,8 @@ static struct ceph_msg *get_reply(structmutex_lock (&osdc->request_mutex); req =__lookup_request (osdc, tid);if (!req) { -pr_warn ("%s osd%d tid %llu unknown, skipping\n" , - __func__, osd->o_osd, tid); +dout ("%s osd%d tid %llu unknown, skipping\n" , __func__, + osd->o_osd, tid); m =NULL ; *skip =1 ; goto out;
Greg Kroah-Hartman
maintainerPATCH 268/342 Staging: speakup: Fix getting port information
In reply to Greg Kroah-Hartman4.4-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Thibault <[email protected]>
commit 327b882d3bcc1fba82dbd39b5cf5a838c81218e2 upstream.
Commit f79b0d9c223c ("staging: speakup: Fixed warning <linux/serial.h> instead of <asm/serial.h>") broke the port information in the speakup
driver: SERIAL_PORT_DFNS only gets defined if asm/serial.h is included, and no other header includes asm/serial.h.
We here make sure serialio.c does get the arch-specific definition of SERIAL_PORT_DFNS from asm/serial.h, if any.
Along the way, this makes sure that we do have information for the requested serial port number (index)
--- drivers/staging/speakup/serialio.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/staging/speakup/serialio.c +12 -1
@@ -6,6 +6,11 @@#include "spk_priv.h" #include "serialio.h" +#include <linux/serial_core.h> +/* WARNING: Do not change this to <linux/serial.h> without testing that +* SERIAL_PORT_DFNS does get defined to the appropriate value. */ +#include <asm/serial.h> +#ifndef SERIAL_PORT_DFNS #define SERIAL_PORT_DFNS #endif
@@ -23,9 +28,15 @@ const struct old_serial_port *spk_serialint baud =9600 , quot =0 ;unsigned int cval =0 ;int cflag =CREAD |HUPCL |CLOCAL |B9600 |CS8 ; -const struct old_serial_port *ser = rs_table + index; +const struct old_serial_port *ser;int err; +if (index >=ARRAY_SIZE (rs_table)) { +pr_info ("no port info for ttyS%d\n" , index); +return NULL ; + } + ser = rs_table + index; +/* Divisor, bytesize and parity */ quot = ser->baud_base / baud; cval = cflag & (CSIZE |CSTOPB );