Linux 3.19.8-ckt11 stable review
Subsystems (108)
PATCH 155/164 ipv6: fix tunnel error handling
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Michal=20Kube=C4=8Dek?= <[email protected]>
commit ebac62fe3d24c0ce22dd83afa7b07d1a2aaef44d upstream.
Both tunnel6_protocol and tunnel46_protocol share the same error handler, tunnel6_err(), which traverses through tunnel6_handlers list. For ipip6 tunnels, we need to traverse tunnel46_handlers as we do e.g. in tunnel46_rcv(). Current code can generate an ICMPv6 error message with an IPv4 packet embedded in it.
--- net/ipv6/tunnel6.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
net/ipv6/tunnel6.c +11 -1
@@ -144,6 +144,16 @@ static void tunnel6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,break ; } +static void tunnel46_err (struct sk_buff *skb,struct inet6_skb_parm *opt, +u8 type,u8 code,int offset,__be32 info) +{ +struct xfrm6_tunnel *handler; + +for_each_tunnel_rcu (tunnel46_handlers, handler) +if (!handler->err_handler (skb, opt, type, code, offset, info)) +break ; +} +static const struct inet6_protocol tunnel6_protocol = { .handler = tunnel6_rcv, .err_handler = tunnel6_err,
@@ -152,7 +162,7 @@ static const struct inet6_protocol tunnel6_protocol = {static const struct inet6_protocol tunnel46_protocol = { .handler = tunnel46_rcv, - .err_handler = tunnel6_err, + .err_handler = tunnel46_err, .flags =INET6_PROTO_NOPOLICY |INET6_PROTO_FINAL , };
Signature · 1 line
1.9.1
PATCH 156/164 perf trace: Fix documentation for -i
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Feiner <[email protected]>
commit 956959f6b7a982b2e789a7a8fa1de437074a5eb9 upstream.
The -i flag was incorrectly listed as a short flag for --no-inherit. It should have only been listed as a short flag for --input.
This documentation error has existed since the --input flag was introduced in 6810fc915f7a89d8134edb3996dbbf8eac386c26 (perf trace: Add option to analyze events in a file versus live).
--- tools/perf/Documentation/perf-trace.txt | 1 - 1 file changed, 1 deletion(-)
tools/perf/Documentation/perf-trace.txt +0 -1
@@ -59,7 +59,6 @@ OPTIONS --verbose=:: Verbosity level. --i:: --no-inherit:: Child tasks do not inherit counters.
Signature · 1 line
1.9.1
PATCH 157/164 bonding: fix panic on non-ARPHRD_ETHER enslave failure
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Jay Vosburgh <[email protected]>
commit 40baec225765c54eefa870530dd613bad9829bb7 upstream.
Since commit 7d5cd2ce529b, when bond_enslave fails on devices that are not ARPHRD_ETHER, if needed, it resets the bonding device back to ARPHRD_ETHER by calling ether_setup.
Unfortunately, ether_setup clobbers dev->flags, clearing IFF_UP
if the bond device is up, leaving it in a quasi-down state without having actually gone through dev_close. For bonding, if any periodic work queue items are active (miimon, arp_interval, etc), those will remain running, as they are stopped by bond_close. At this point, if the bonding module is unloaded or the bond is deleted, the system will panic when the work function is called.
This panic is resolved by calling dev_close on the bond itself
prior to calling ether_setup.
--- drivers/net/bonding/bond_main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/bonding/bond_main.c +1 -0
@@ -1642,6 +1642,7 @@ err_undo_flags: slave_dev->dev_addr))eth_hw_addr_random (bond_dev);if (bond_dev->type !=ARPHRD_ETHER ) { +dev_close (bond_dev);ether_setup (bond_dev); bond_dev->flags |=IFF_MASTER ; bond_dev->priv_flags &= ~IFF_TX_SKB_SHARING ;
Signature · 1 line
1.9.1
PATCH 158/164 rtc: ds1307: Fix alarm programming for mcp794xx
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Tero Kristo <[email protected]>
commit 62c8c20af92ea312ecb22cec4e83082e5843076b upstream.
mcp794xx alarm registers must be written in BCD format. However, the alarm programming logic neglected this by adding one to the value after bin2bcd conversion has been already done, writing bad values to month register in case the alarm being set is in October. In this case, the alarm month value becomes 0x0a instead of the expected 0x10.
Fix by moving the +1 addition within the bin2bcd call also.
--- drivers/rtc/rtc-ds1307.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/rtc/rtc-ds1307.c +2 -2
@@ -734,9 +734,9 @@ static int mcp794xx_set_alarm(struct device *dev, struct rtc_wkalrm *t) regs[3 ] =bin2bcd (t->time.tm_sec); regs[4 ] =bin2bcd (t->time.tm_min); regs[5 ] =bin2bcd (t->time.tm_hour); - regs[6 ] =bin2bcd (t->time.tm_wday) +1 ; + regs[6 ] =bin2bcd (t->time.tm_wday +1 ); regs[7 ] =bin2bcd (t->time.tm_mday); - regs[8 ] =bin2bcd (t->time.tm_mon) +1 ; + regs[8 ] =bin2bcd (t->time.tm_mon +1 );/* Clear the alarm 0 interrupt flag. */ regs[6 ] &= ~MCP794XX_BIT_ALMX_IF ;
Signature · 1 line
1.9.1
PATCH 159/164 mac80211: fix driver RSSI event calculations
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 8ec6d97871f37e4743678ea4a455bd59580aa0f4 upstream.
The ifmgd->ave_beacon_signal value cannot be taken as is for comparisons, it must be divided by since it's represented like that for better accuracy of the EWMA calculations. This would lead to invalid driver RSSI events. Fix the used value.
--- net/mac80211/mlme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/mlme.c +1 -1
@@ -3271,7 +3271,7 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,if (ifmgd->rssi_min_thold != ifmgd->rssi_max_thold && ifmgd->count_beacon_signal >=IEEE80211_SIGNAL_AVE_MIN_COUNT ) { -int sig = ifmgd->ave_beacon_signal; +int sig = ifmgd->ave_beacon_signal /16 ;int last_sig = ifmgd->last_ave_beacon_signal;/*
Signature · 1 line
1.9.1
PATCH 160/164 packet: fix match_fanout_group()
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 161642e24fee40fba2c5bc2ceacc00d118a22d65 upstream.
Recent TCP listener patches exposed a prior af_packet bug :match_fanout_group() blindly assumes it is always safe to cast sk to a packet socket to compare fanout with af_packet_priv
But SYNACK packets can be sent while attached to request_sock, which are smaller than a "struct sock".
We can read non existent memory and crash.
--- net/packet/af_packet.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
net/packet/af_packet.c +3 -3
@@ -1405,10 +1405,10 @@ static void __fanout_unlink(struct sock *sk, struct packet_sock *po)static bool match_fanout_group (struct packet_type *ptype,struct sock *sk) { -if (ptype->af_packet_priv == (void *)((struct packet_sock *)sk)->fanout) -return true; +if (sk->sk_family !=PF_PACKET ) +return false; -return false; +return ptype->af_packet_priv ==pkt_sk (sk)->fanout; }static int fanout_add (struct sock *sk,u16 id,u16 type_flags)
Signature · 1 line
1.9.1
PATCH 161/164 tcp: apply Kern's check on RTTs used for congestion control
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Yuchung Cheng <[email protected]>
commit 9e45a3e36b363cc4c79c70f2b4f994e66543a219 upstream.
Currently ca_seq_rtt_us does not use Kern's check. Fix that by checking if any packet acked is a retransmit, for both RTT used for RTT estimation and congestion control.
--- net/ipv4/tcp_input.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-)
net/ipv4/tcp_input.c +1 -4
@@ -2907,9 +2907,6 @@ static inline bool tcp_ack_update_rtt(struct sock *sk, const int flag,* Karn's algorithm forbids taking RTT if some retransmitted data * is acked (RFC6298). */ -if (flag &FLAG_RETRANS_DATA_ACKED ) - seq_rtt_us =-1L ; -if (seq_rtt_us <0 ) seq_rtt_us = sack_rtt_us;
@@ -3151,7 +3148,7 @@ static int tcp_clean_rtx_queue(struct sock *sk, int prior_fackets, flag |=FLAG_SACK_RENEGING ;skb_mstamp_get (&now); -if (likely (first_ackt.v64)) { +if (likely (first_ackt.v64) && !(flag &FLAG_RETRANS_DATA_ACKED )) { seq_rtt_us =skb_mstamp_us_delta (&now, &first_ackt); ca_seq_rtt_us =skb_mstamp_us_delta (&now, &last_ackt); }
Signature · 1 line
1.9.1
PATCH 162/164 net: fix percpu memory leaks
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 1d6119baf0610f813eb9d9580eb4fd16de5b4ceb upstream.
This patch fixes following problems :
1) percpu_counter_init() can return an error, therefore init_frag_mem_limit() must propagate this error so that inet_frags_init_net() can do the same up to its callers.
2) If ip[46]_frags_ns_ctl_register() fail, we must unwind properly and free the percpu_counter.
Without this fix, we leave freed object in percpu_counters global list (if CONFIG_HOTPLUG_CPU) leading to crashes.
This bug was detected by KASAN and syzkaller tool
(http://github.com/google/syzkaller)
--- include/net/inet_frag.h | 15 +++++++++------ net/ieee802154/reassembly.c | 11 ++++++++--- net/ipv4/inet_fragment.c | 6 ------ net/ipv4/ip_fragment.c | 12 +++++++++--- net/ipv6/netfilter/nf_conntrack_reasm.c | 12 +++++++++--- net/ipv6/reassembly.c | 12 +++++++++--- 6 files changed, 44 insertions(+), 24 deletions(-)
include/net/inet_frag.h +9 -6
@@ -110,7 +110,15 @@ struct inet_frags {int inet_frags_init (struct inet_frags *);void inet_frags_fini (struct inet_frags *); -void inet_frags_init_net (struct netns_frags *nf); +static inline int inet_frags_init_net (struct netns_frags *nf) +{ +return percpu_counter_init (&nf->mem,0 ,GFP_KERNEL ); +} +static inline void inet_frags_uninit_net (struct netns_frags *nf) +{ +percpu_counter_destroy (&nf->mem); +} +void inet_frags_exit_net (struct netns_frags *nf,struct inet_frags *f);void inet_frag_kill (struct inet_frag_queue *q,struct inet_frags *f);
@@ -151,11 +159,6 @@ static inline void add_frag_mem_limit(struct inet_frag_queue *q, int i)__percpu_counter_add (&q->net->mem, i, frag_percpu_counter_batch); } -static inline void init_frag_mem_limit (struct netns_frags *nf) -{ -percpu_counter_init (&nf->mem,0 ,GFP_KERNEL ); -} -static inline unsigned int sum_frag_mem_limit (struct netns_frags *nf) {unsigned int res;
net/ieee802154/reassembly.c +8 -3
@@ -523,14 +523,19 @@ static int __net_init lowpan_frags_init_net(struct net *net) {struct netns_ieee802154_lowpan *ieee802154_lowpan =net_ieee802154_lowpan (net); +int res; ieee802154_lowpan->frags.high_thresh =IPV6_FRAG_HIGH_THRESH ; ieee802154_lowpan->frags.low_thresh =IPV6_FRAG_LOW_THRESH ; ieee802154_lowpan->frags.timeout =IPV6_FRAG_TIMEOUT ; -inet_frags_init_net (&ieee802154_lowpan->frags); - -return lowpan_frags_ns_sysctl_register (net); + res =inet_frags_init_net (&ieee802154_lowpan->frags); +if (res) +return res; + res =lowpan_frags_ns_sysctl_register (net); +if (res) +inet_frags_uninit_net (&ieee802154_lowpan->frags); +return res; } static void __net_exit lowpan_frags_exit_net(struct net *net)
net/ipv4/inet_fragment.c +0 -6
@@ -220,12 +220,6 @@ int inet_frags_init(struct inet_frags *f) }EXPORT_SYMBOL (inet_frags_init); -void inet_frags_init_net (struct netns_frags *nf) -{ -init_frag_mem_limit (nf); -} -EXPORT_SYMBOL (inet_frags_init_net); -void inet_frags_fini (struct inet_frags *f) {cancel_work_sync (&f->frags_work);
net/ipv4/ip_fragment.c +9 -3
@@ -816,6 +816,8 @@ static void __init ip4_frags_ctl_register(void)static int __net_init ipv4_frags_init_net (struct net *net) { +int res; +/* Fragment cache limits. * * The fragment memory accounting code, (tries to) account for
@@ -839,9 +841,13 @@ static int __net_init ipv4_frags_init_net(struct net *net)*/ net->ipv4.frags.timeout =IP_FRAG_TIME ; -inet_frags_init_net (&net->ipv4.frags); - -return ip4_frags_ns_ctl_register (net); + res =inet_frags_init_net (&net->ipv4.frags); +if (res) +return res; + res =ip4_frags_ns_ctl_register (net); +if (res) +inet_frags_uninit_net (&net->ipv4.frags); +return res; } static void __net_exit ipv4_frags_exit_net(struct net *net)
net/ipv6/netfilter/nf_conntrack_reasm.c +9 -3
@@ -648,12 +648,18 @@ void nf_ct_frag6_consume_orig(struct sk_buff *skb)static int nf_ct_net_init (struct net *net) { +int res; + net->nf_frag.frags.high_thresh =IPV6_FRAG_HIGH_THRESH ; net->nf_frag.frags.low_thresh =IPV6_FRAG_LOW_THRESH ; net->nf_frag.frags.timeout =IPV6_FRAG_TIMEOUT ; -inet_frags_init_net (&net->nf_frag.frags); - -return nf_ct_frag6_sysctl_register (net); + res =inet_frags_init_net (&net->nf_frag.frags); +if (res) +return res; + res =nf_ct_frag6_sysctl_register (net); +if (res) +inet_frags_uninit_net (&net->nf_frag.frags); +return res; }static void nf_ct_net_exit (struct net *net)
net/ipv6/reassembly.c +9 -3
@@ -706,13 +706,19 @@ static void ip6_frags_sysctl_unregister(void)static int __net_init ipv6_frags_init_net (struct net *net) { +int res; + net->ipv6.frags.high_thresh =IPV6_FRAG_HIGH_THRESH ; net->ipv6.frags.low_thresh =IPV6_FRAG_LOW_THRESH ; net->ipv6.frags.timeout =IPV6_FRAG_TIMEOUT ; -inet_frags_init_net (&net->ipv6.frags); - -return ip6_frags_ns_sysctl_register (net); + res =inet_frags_init_net (&net->ipv6.frags); +if (res) +return res; + res =ip6_frags_ns_sysctl_register (net); +if (res) +inet_frags_uninit_net (&net->ipv6.frags); +return res; } static void __net_exit ipv6_frags_exit_net(struct net *net)
Signature · 1 line
1.9.1
PATCH 163/164 TPM: Avoid reference to potentially freed memory
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Christophe JAILLET <[email protected]>
commit eb8ed1eb9a158c460d10205eaff71fd4ac67c160 upstream.
Reference to the 'np' node is dropped before dereferencing the 'sizep' and 'basep' pointers, which could by then point to junk if the node has been freed.
Refactor code to call 'of_node_put' later.
--- drivers/char/tpm/tpm_of.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/char/tpm/tpm_of.c +2 -1
@@ -53,17 +53,18 @@ int read_log(struct tpm_bios_log *log) goto cleanup_eio; } -of_node_put (np); log->bios_event_log =kmalloc (*sizep,GFP_KERNEL );if (!log->bios_event_log) {pr_err ("%s: ERROR - Not enough memory for BIOS measurements\n" , __func__); +of_node_put (np);return -ENOMEM ; } log->bios_event_log_end = log->bios_event_log + *sizep;memcpy (log->bios_event_log,__va (be64_to_cpup (basep)), *sizep); +of_node_put (np);return 0 ;
Signature · 1 line
1.9.1
PATCH 164/164 fib_rules: Fix dump_rules() not to exit early
In reply to Kamal Mostafa3.19.8-ckt11 -stable review patch. If anyone has any objections, please let me know.
------------------
From: Roland Dreier <[email protected]>
Backports of 41fc014332d9 ("fib_rules: fix fib rule dumps across multiple skbs") introduced a regression in "ip rule show" - it ends up dumping the first rule over and over and never exiting, because 3.19 and earlier are missing commit 053c095a82cf ("netlink: make nlmsg_end() and genlmsg_end() void"), so fib_nl_fill_rule() ends up returning skb->len (i.e. > 0) in the success case.
Fix this by checking the return code for < 0 instead of != 0.
--- net/core/fib_rules.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/core/fib_rules.c +1 -1
@@ -631,7 +631,7 @@ static int dump_rules(struct sk_buff *skb, struct netlink_callback *cb, err =fib_nl_fill_rule (skb, rule,NETLINK_CB (cb->skb).portid, cb->nlh->nlmsg_seq,RTM_NEWRULE ,NLM_F_MULTI , ops); -if (err) +if (err <0 )break ; skip: idx++;
Signature · 1 line
1.9.1