3.16.50-rc1 review
Subsystems (4)
PATCH 156/294 l2tp: define parameters of l2tp_session_get*() as "const"
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit 9aaef50c44f132e040dcd7686c8e78a3390037c5 upstream.
Make l2tp_pernet()'s parameter constant, so that l2tp_session_get*() can declare their "net" variable as "const".
Also constify "ifname" in l2tp_session_get_by_ifname().
--- net/l2tp/l2tp_core.c | 7 ++++--- net/l2tp/l2tp_core.h | 5 +++-- 2 files changed, 7 insertions(+), 5 deletions(-)
net/l2tp/l2tp_core.c +4 -3
@@ -119,7 +119,7 @@ static inline struct l2tp_tunnel *l2tp_treturn sk->sk_user_data; } -static inline struct l2tp_net *l2tp_pernet (struct net *net) +static inline struct l2tp_net *l2tp_pernet (const struct net *net) {BUG_ON (!net);
@@ -280,7 +280,7 @@ EXPORT_SYMBOL_GPL(l2tp_session_find);/* Like l2tp_session_find() but takes a reference on the returned session. * Optionally calls session->ref() too if do_ref is true. */ -struct l2tp_session *l2tp_session_get (struct net *net, +struct l2tp_session *l2tp_session_get (const struct net *net,struct l2tp_tunnel *tunnel,u32 session_id,bool do_ref) {
@@ -355,7 +355,8 @@ EXPORT_SYMBOL_GPL(l2tp_session_get_nth);/* Lookup a session by interface name. * This is very inefficient but is only used by management interfaces. */ -struct l2tp_session *l2tp_session_get_by_ifname (struct net *net,char *ifname, +struct l2tp_session *l2tp_session_get_by_ifname (const struct net *net, +const char *ifname,bool do_ref) {struct l2tp_net *pn =l2tp_pernet (net);
net/l2tp/l2tp_core.h +3 -2
@@ -240,7 +240,7 @@ out:return tunnel; } -struct l2tp_session *l2tp_session_get (struct net *net, +struct l2tp_session *l2tp_session_get (const struct net *net,struct l2tp_tunnel *tunnel,u32 session_id,bool do_ref); struct l2tp_session *l2tp_session_find(struct net *net,
@@ -248,7 +248,8 @@ struct l2tp_session *l2tp_session_find(s u32 session_id);struct l2tp_session *l2tp_session_get_nth (struct l2tp_tunnel *tunnel,int nth,bool do_ref); -struct l2tp_session *l2tp_session_get_by_ifname (struct net *net,char *ifname, +struct l2tp_session *l2tp_session_get_by_ifname (const struct net *net, +const char *ifname,bool do_ref);struct l2tp_tunnel *l2tp_tunnel_find (struct net *net,u32 tunnel_id);struct l2tp_tunnel *l2tp_tunnel_find_nth (struct net *net,int nth);
PATCH 157/294 l2tp: hold tunnel while looking up sessions in l2tp_netlink
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit 54652eb12c1b72e9602d09cb2821d5760939190f upstream.
l2tp_tunnel_find() doesn't take a reference on the returned tunnel. Therefore, it's unsafe to use it because the returned tunnel can go away on us anytime.
Fix this by defining l2tp_tunnel_get(), which works like l2tp_tunnel_find(), but takes a reference on the returned tunnel. Caller then has to drop this reference using l2tp_tunnel_dec_refcount().
As l2tp_tunnel_dec_refcount() needs to be moved to l2tp_core.h, let's simplify the patch and not move the L2TP_REFCNT_DEBUG part. This code has been broken (not even compiling) in May 2012 by
commit a4ca44fa578c ("net: l2tp: Standardize logging styles") and fixed more than two years later by
commit 29abe2fda54f ("l2tp: fix missing line continuation"). So it doesn't appear to be used by anyone.
Same thing for l2tp_tunnel_free(); instead of moving it to l2tp_core.h, let's just simplify things and call kfree_rcu() directly in l2tp_tunnel_dec_refcount(). Extra assertions and debugging code provided by l2tp_tunnel_free() didn't help catching any of the reference counting and socket handling issues found while working on this series.
--- net/l2tp/l2tp_core.c | 66 ++++++++++++++++--------------------------------- net/l2tp/l2tp_core.h | 13 ++++++++++ net/l2tp/l2tp_netlink.c | 6 +++-- 3 files changed, 38 insertions(+), 47 deletions(-)
net/l2tp/l2tp_core.c +21 -45
@@ -112,7 +112,6 @@ struct l2tp_net {spinlock_t l2tp_session_hlist_lock; }; -static void l2tp_tunnel_free (struct l2tp_tunnel *tunnel);static inline struct l2tp_tunnel *l2tp_tunnel (struct sock *sk) {
@@ -126,39 +125,6 @@ static inline struct l2tp_net *l2tp_pernreturn net_generic (net, l2tp_net_id); } -/* Tunnel reference counts. Incremented per session that is added to -* the tunnel. -*/ -static inline void l2tp_tunnel_inc_refcount_1 (struct l2tp_tunnel *tunnel) -{ -atomic_inc (&tunnel->ref_count); -} - -static inline void l2tp_tunnel_dec_refcount_1 (struct l2tp_tunnel *tunnel) -{ -if (atomic_dec_and_test (&tunnel->ref_count)) -l2tp_tunnel_free (tunnel); -} -#ifdef L2TP_REFCNT_DEBUG -#define l2tp_tunnel_inc_refcount (_t) \ -do { \ - pr_debug("l2tp_tunnel_inc_refcount: %s:%d %s: cnt=%d\n", \ - __func__, __LINE__, (_t)->name, \ - atomic_read(&_t->ref_count)); \ - l2tp_tunnel_inc_refcount_1(_t); \ -} while (0) -#define l2tp_tunnel_dec_refcount (_t) -do { \ -pr_debug ("l2tp_tunnel_dec_refcount: %s:%d %s: cnt=%d\n" , \ - __func__, __LINE__, (_t)->name, \ -atomic_read (&_t->ref_count)); \ -l2tp_tunnel_dec_refcount_1 (_t); \ -} while (0) -#else -#define l2tp_tunnel_inc_refcount (t) l2tp_tunnel_inc_refcount_1(t) -#define l2tp_tunnel_dec_refcount (t) l2tp_tunnel_dec_refcount_1(t) -#endif -/* Session hash global list for L2TPv3. * The session_id SHOULD be random according to RFC3931, but several * L2TP implementations use incrementing session_ids. So we do a real
@@ -277,6 +243,27 @@ struct l2tp_session *l2tp_session_find(s }EXPORT_SYMBOL_GPL (l2tp_session_find); +/* Lookup a tunnel. A new reference is held on the returned tunnel. */ +struct l2tp_tunnel *l2tp_tunnel_get (const struct net *net,u32 tunnel_id) +{ +const struct l2tp_net *pn =l2tp_pernet (net); +struct l2tp_tunnel *tunnel; + +rcu_read_lock_bh (); +list_for_each_entry_rcu (tunnel, &pn->l2tp_tunnel_list, list) { +if (tunnel->tunnel_id == tunnel_id) { +l2tp_tunnel_inc_refcount (tunnel); +rcu_read_unlock_bh (); + +return tunnel; + } + } +rcu_read_unlock_bh (); + +return NULL ; +} +EXPORT_SYMBOL_GPL (l2tp_tunnel_get); +/* Like l2tp_session_find() but takes a reference on the returned session. * Optionally calls session->ref() too if do_ref is true. */
@@ -1396,17 +1383,6 @@ static void l2tp_udp_encap_destroy(struc } } -/* Really kill the tunnel. -* Come here only when all sessions have been cleared from the tunnel. -*/ -static void l2tp_tunnel_free (struct l2tp_tunnel *tunnel) -{ -BUG_ON (atomic_read (&tunnel->ref_count) !=0 ); -BUG_ON (tunnel->sock !=NULL ); -l2tp_info (tunnel,L2TP_MSG_CONTROL ,"%s: free...\n" , tunnel->name); -kfree_rcu (tunnel, rcu); -} -/* Workqueue tunnel deletion function */ static void l2tp_tunnel_del_work (struct work_struct *work) {
net/l2tp/l2tp_core.h +13 -0
@@ -240,6 +240,8 @@ out:return tunnel; } +struct l2tp_tunnel *l2tp_tunnel_get (const struct net *net,u32 tunnel_id); +struct l2tp_session *l2tp_session_get (const struct net *net,struct l2tp_tunnel *tunnel,u32 session_id,bool do_ref);
@@ -281,6 +283,17 @@ int l2tp_nl_register_ops(enum l2tp_pwtypvoid l2tp_nl_unregister_ops (enum l2tp_pwtype pw_type);int l2tp_ioctl (struct sock *sk,int cmd,unsigned long arg); +static inline void l2tp_tunnel_inc_refcount (struct l2tp_tunnel *tunnel) +{ +atomic_inc (&tunnel->ref_count); +} + +static inline void l2tp_tunnel_dec_refcount (struct l2tp_tunnel *tunnel) +{ +if (atomic_dec_and_test (&tunnel->ref_count)) +kfree_rcu (tunnel, rcu); +} +/* Session reference counts. Incremented when code obtains a reference * to a session. */
net/l2tp/l2tp_netlink.c +4 -2
@@ -60,10 +60,12 @@ static struct l2tp_session *l2tp_nl_sess (info->attrs[L2TP_ATTR_CONN_ID])) { tunnel_id =nla_get_u32 (info->attrs[L2TP_ATTR_CONN_ID ]); session_id =nla_get_u32 (info->attrs[L2TP_ATTR_SESSION_ID ]); - tunnel =l2tp_tunnel_find (net, tunnel_id); -if (tunnel) + tunnel =l2tp_tunnel_get (net, tunnel_id); +if (tunnel) { session =l2tp_session_get (net, tunnel, session_id, do_ref); +l2tp_tunnel_dec_refcount (tunnel); + } }return session;
PATCH 158/294 l2tp: hold tunnel while processing genl delete command
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit bb0a32ce4389e17e47e198d2cddaf141561581ad upstream.
l2tp_nl_cmd_tunnel_delete() needs to take a reference on the tunnel, to prevent it from being concurrently freed by l2tp_tunnel_destruct().
--- net/l2tp/l2tp_netlink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/l2tp/l2tp_netlink.c +4 -2
@@ -209,14 +209,16 @@ static int l2tp_nl_cmd_tunnel_delete(str } tunnel_id =nla_get_u32 (info->attrs[L2TP_ATTR_CONN_ID ]); - tunnel =l2tp_tunnel_find (net, tunnel_id); -if (tunnel ==NULL ) { + tunnel =l2tp_tunnel_get (net, tunnel_id); +if (!tunnel) { ret = -ENODEV ; goto out; } (void )l2tp_tunnel_delete (tunnel); +l2tp_tunnel_dec_refcount (tunnel); + out:return ret; }
PATCH 159/294 l2tp: hold tunnel while handling genl tunnel updates
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit 8c0e421525c9eb50d68e8f633f703ca31680b746 upstream.
We need to make sure the tunnel is not going to be destroyed by l2tp_tunnel_destruct() concurrently.
--- net/l2tp/l2tp_netlink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
net/l2tp/l2tp_netlink.c +4 -2
@@ -236,8 +236,8 @@ static int l2tp_nl_cmd_tunnel_modify(str } tunnel_id =nla_get_u32 (info->attrs[L2TP_ATTR_CONN_ID ]); - tunnel =l2tp_tunnel_find (net, tunnel_id); -if (tunnel ==NULL ) { + tunnel =l2tp_tunnel_get (net, tunnel_id); +if (!tunnel) { ret = -ENODEV ; goto out; }
@@ -245,6 +245,8 @@ static int l2tp_nl_cmd_tunnel_modify(strif (info->attrs[L2TP_ATTR_DEBUG ]) tunnel->debug =nla_get_u32 (info->attrs[L2TP_ATTR_DEBUG ]); +l2tp_tunnel_dec_refcount (tunnel); + out:return ret; }
PATCH 160/294 l2tp: hold tunnel while handling genl TUNNEL_GET commands
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit 4e4b21da3acc68a7ea55f850cacc13706b7480e9 upstream.
Use l2tp_tunnel_get() instead of l2tp_tunnel_find() so that we get a reference on the tunnel, preventing l2tp_tunnel_destruct() from freeing it from under us.
Also move l2tp_tunnel_get() below nlmsg_new() so that we only take the reference when needed.
--- net/l2tp/l2tp_netlink.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-)
net/l2tp/l2tp_netlink.c +15 -12
@@ -349,34 +349,37 @@ static int l2tp_nl_cmd_tunnel_get(structif (!info->attrs[L2TP_ATTR_CONN_ID ]) { ret = -EINVAL ; - goto out; + goto err; } tunnel_id =nla_get_u32 (info->attrs[L2TP_ATTR_CONN_ID ]); - tunnel =l2tp_tunnel_find (net, tunnel_id); -if (tunnel ==NULL ) { - ret = -ENODEV ; - goto out; - } - msg =nlmsg_new (NLMSG_DEFAULT_SIZE ,GFP_KERNEL );if (!msg) { ret = -ENOMEM ; - goto out; + goto err; + } + + tunnel =l2tp_tunnel_get (net, tunnel_id); +if (!tunnel) { + ret = -ENODEV ; + goto err_nlmsg; } ret =l2tp_nl_tunnel_send (msg, info->snd_portid, info->snd_seq,NLM_F_ACK , tunnel);if (ret <0 ) - goto err_out; + goto err_nlmsg_tunnel; + +l2tp_tunnel_dec_refcount (tunnel);return genlmsg_unicast (net, msg, info->snd_portid); -err_out: +err_nlmsg_tunnel: +l2tp_tunnel_dec_refcount (tunnel); +err_nlmsg:nlmsg_free (msg); - -out: +err:return ret; }
PATCH 161/294 l2tp: remove useless duplicate session detection in l2tp_netlink
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit af87ae465abdc070de0dc35d6c6a9e7a8cd82987 upstream.
There's no point in checking for duplicate sessions at the beginning of l2tp_nl_cmd_session_create(); the ->session_create() callbacks already return -EEXIST when the session already exists.
Furthermore, even if l2tp_session_find() returns NULL, a new session might be created right after the test. So relying on ->session_create() to avoid duplicate session is the only sane behaviour.
---
net/l2tp/l2tp_netlink.c +0 -6
@@ -415,7 +415,6 @@ static int l2tp_nl_cmd_session_create(stu32 peer_session_id;int ret =0 ;struct l2tp_tunnel *tunnel; -struct l2tp_session *session;struct l2tp_session_cfg cfg = {0 , };struct net *net =genl_info_net (info);
@@ -435,11 +434,6 @@ static int l2tp_nl_cmd_session_create(st goto out; } session_id =nla_get_u32 (info->attrs[L2TP_ATTR_SESSION_ID ]); - session =l2tp_session_find (net, tunnel, session_id); -if (session) { - ret = -EEXIST ; - goto out; - }if (!info->attrs[L2TP_ATTR_PEER_SESSION_ID ]) { ret = -EINVAL ;
PATCH 162/294 l2tp: hold tunnel used while creating sessions with netlink
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Guillaume Nault <[email protected]>
commit e702c1204eb57788ef189c839c8c779368267d70 upstream.
Use l2tp_tunnel_get() to retrieve tunnel, so that it can't go away on us. Otherwise l2tp_tunnel_destruct() might release the last reference count concurrently, thus freeing the tunnel while we're using it.
--- net/l2tp/l2tp_netlink.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-)
net/l2tp/l2tp_netlink.c +12 -9
@@ -422,8 +422,9 @@ static int l2tp_nl_cmd_session_create(st ret = -EINVAL ; goto out; } + tunnel_id =nla_get_u32 (info->attrs[L2TP_ATTR_CONN_ID ]); - tunnel =l2tp_tunnel_find (net, tunnel_id); + tunnel =l2tp_tunnel_get (net, tunnel_id);if (!tunnel) { ret = -ENODEV ; goto out;
@@ -431,24 +432,24 @@ static int l2tp_nl_cmd_session_create(stif (!info->attrs[L2TP_ATTR_SESSION_ID ]) { ret = -EINVAL ; - goto out; + goto out_tunnel; } session_id =nla_get_u32 (info->attrs[L2TP_ATTR_SESSION_ID ]);if (!info->attrs[L2TP_ATTR_PEER_SESSION_ID ]) { ret = -EINVAL ; - goto out; + goto out_tunnel; } peer_session_id =nla_get_u32 (info->attrs[L2TP_ATTR_PEER_SESSION_ID ]);if (!info->attrs[L2TP_ATTR_PW_TYPE ]) { ret = -EINVAL ; - goto out; + goto out_tunnel; } cfg.pw_type =nla_get_u16 (info->attrs[L2TP_ATTR_PW_TYPE ]);if (cfg.pw_type >= __L2TP_PWTYPE_MAX) { ret = -EINVAL ; - goto out; + goto out_tunnel; }if (tunnel->version >2 ) {
@@ -470,7 +471,7 @@ static int l2tp_nl_cmd_session_create(stu16 len =nla_len (info->attrs[L2TP_ATTR_COOKIE ]);if (len >8 ) { ret = -EINVAL ; - goto out; + goto out_tunnel; } cfg.cookie_len = len;memcpy (&cfg.cookie[0 ],nla_data (info->attrs[L2TP_ATTR_COOKIE ]), len);
@@ -479,7 +480,7 @@ static int l2tp_nl_cmd_session_create(stu16 len =nla_len (info->attrs[L2TP_ATTR_PEER_COOKIE ]);if (len >8 ) { ret = -EINVAL ; - goto out; + goto out_tunnel; } cfg.peer_cookie_len = len;memcpy (&cfg.peer_cookie[0 ],nla_data (info->attrs[L2TP_ATTR_PEER_COOKIE ]), len);
@@ -515,7 +516,7 @@ static int l2tp_nl_cmd_session_create(stif ((l2tp_nl_cmd_ops[cfg.pw_type] ==NULL ) || (l2tp_nl_cmd_ops[cfg.pw_type]->session_create ==NULL )) { ret = -EPROTONOSUPPORT ; - goto out; + goto out_tunnel; }/* Check that pseudowire-specific params are present */
@@ -525,7 +526,7 @@ static int l2tp_nl_cmd_session_create(stcase L2TP_PWTYPE_ETH_VLAN :if (!info->attrs[L2TP_ATTR_VLAN_ID ]) { ret = -EINVAL ; - goto out; + goto out_tunnel; }break ;case L2TP_PWTYPE_ETH :
@@ -544,6 +545,8 @@ static int l2tp_nl_cmd_session_create(st ret = (*l2tp_nl_cmd_ops[cfg.pw_type]->session_create)(net, tunnel_id, session_id, peer_session_id, &cfg); +out_tunnel: +l2tp_tunnel_dec_refcount (tunnel); out:return ret; }
PATCH 163/294 ipv6: fix sparse warning on rt6i_node
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Wei Wang <[email protected]>
commit 4e587ea71bf924f7dac621f1351653bd41e446cb upstream.
Commit c5cff8561d2d adds rcu grace period before freeing fib6_node. This generates a new sparse warning on rt->rt6i_node related code:
net/ipv6/route.c:1394:30: error: incompatible types in comparison expression (different address spaces) ./include/net/ip6_fib.h:187:14: error: incompatible types in comparison expression (different address spaces)
This commit adds "__rcu" tag for rt6i_node and makes sure corresponding rcu API is used for it.
After this fix, sparse no longer generates the above warning.
---
include/net/ip6_fib.h +1 -1
@@ -96,7 +96,7 @@ struct rt6_info {* the same cache line. */ struct fib6_table *rt6i_table; -struct fib6_node *rt6i_node; +struct fib6_node __rcu *rt6i_node;struct in6_addr rt6i_gateway;
net/ipv6/addrconf.c +1 -1
@@ -4737,7 +4737,7 @@ static void __ipv6_ifa_notify(int event,* our DAD process, so we don't need * to do it again */ -if (!(ifp->rt->rt6i_node)) +if (!rcu_access_pointer (ifp->rt->rt6i_node))ip6_ins_rt (ifp->rt);if (ifp->idev->cnf.forwarding)addrconf_join_anycast (ifp);
net/ipv6/ip6_fib.c +7 -4
@@ -836,7 +836,7 @@ add: } rt->dst.rt6_next = iter; *ins = rt; - rt->rt6i_node = fn; +rcu_assign_pointer (rt->rt6i_node, fn);atomic_inc (&rt->rt6i_ref);inet6_rt_notify (RTM_NEWROUTE , rt, info); info->nl_net->ipv6.rt6_stats->fib_rt_entries++;
@@ -861,7 +861,7 @@ add:return err; } *ins = rt; - rt->rt6i_node = fn; +rcu_assign_pointer (rt->rt6i_node, fn); rt->dst.rt6_next = iter->dst.rt6_next;atomic_inc (&rt->rt6i_ref);inet6_rt_notify (RTM_NEWROUTE , rt, info);
@@ -1413,8 +1413,9 @@ static void fib6_del_route(struct fib6_nint fib6_del (struct rt6_info *rt,struct nl_info *info) { +struct fib6_node *fn =rcu_dereference_protected (rt->rt6i_node, +lockdep_is_held (&rt->rt6i_table->tb6_lock));struct net *net = info->nl_net; -struct fib6_node *fn = rt->rt6i_node;struct rt6_info **rtp;#if RT6_DEBUG >=2
@@ -1593,7 +1594,9 @@ static int fib6_clean_node(struct fib6_wif (res) {#if RT6_DEBUG >=2 pr_debug ("%s: del failed: rt=%p@%p err=%d\n" , - __func__, rt, rt->rt6i_node, res); + __func__, rt, +rcu_access_pointer (rt->rt6i_node), + res);#endif continue ; }
PATCH 164/294 cpumask: fix spurious cpumask_of_node() on non-NUMA multi-node configs
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit b339752d054fb32863418452dff350a1086885b1 upstream.
When !NUMA, cpumask_of_node(@node) equals cpu_online_mask regardless of @node. The assumption seems that if !NUMA, there shouldn't be more than one node and thus reporting cpu_online_mask regardless of @node is correct. However, that assumption was broken years ago to support DISCONTIGMEM and whether a system has multiple nodes or not is separately controlled by NEED_MULTIPLE_NODES.
This means that, on a system with !NUMA && NEED_MULTIPLE_NODES, cpumask_of_node() will report cpu_online_mask for all possible nodes, indicating that the CPUs are associated with multiple nodes which is an impossible configuration.
This bug has been around forever but doesn't look like it has caused any noticeable symptoms. However, it triggers a WARN recently added to workqueue to verify NUMA affinity configuration.
Fix it by reporting empty cpumask on non-zero nodes if !NUMA.
--- include/asm-generic/topology.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
include/asm-generic/topology.h +5 -1
@@ -48,7 +48,11 @@#define parent_node (node) ((void)(node),0)#endif #ifndef cpumask_of_node -#define cpumask_of_node (node) ((void)node, cpu_online_mask) +#ifdef CONFIG_NEED_MULTIPLE_NODES +#define cpumask_of_node (node) ((node) == 0 ? cpu_online_mask : cpu_none_mask) +#else +#define cpumask_of_node (node) ((void)node, cpu_online_mask) +#endif #endif #ifndef pcibus_to_node#define pcibus_to_node (bus) ((void)(bus), -1)
PATCH 165/294 x86/ldt: Fix off by one in get_segment_base()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit eaa2f87c6b840b83827c40db6eb8481689570259 upstream.
ldt->entries[] is allocated in alloc_ldt_struct(). It has ldt->nr_entries elements and ldt->nr_entries is capped at LDT_ENTRIES. So if "idx" is = ldt->nr_entries then we're reading beyond the end of the buffer. It seems duplicative to have two limit checks when one would work just as well so I removed the check against LDT_ENTRIES.
The gdt_page.gdt[] array has GDT_ENTRIES entries.
--- arch/x86/kernel/cpu/perf_event.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
arch/x86/kernel/cpu/perf_event.c +2 -5
@@ -2009,17 +2009,14 @@ static unsigned long get_segment_base(unif ((segment &SEGMENT_TI_MASK ) =SEGMENT_LDT ) {struct ldt_struct *ldt; -if (idx >LDT_ENTRIES ) -return 0 ; -/* IRQs are off, so this synchronizes with smp_store_release */ ldt =lockless_dereference (current->active_mm->context.ldt); -if (!ldt || idx > ldt->size) +if (!ldt || idx >= ldt->size)return 0 ; desc = &ldt->entries[idx]; }else { -if (idx >GDT_ENTRIES ) +if (idx >=GDT_ENTRIES )return 0 ; desc =__this_cpu_ptr (&gdt_page.gdt[0 ]) + idx;
PATCH 166/294 alpha: uapi: Add support for __SANE_USERSPACE_TYPES__
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit cec80d82142ab25c71eee24b529cfeaf17c43062 upstream.
This fixes compiler errors in perf such as:
tests/attr.c: In function 'store_event':tests/attr.c:66:27: error: format '%llu' expects argument of type 'long long unsigned int', but argument 6 has type '__u64 {aka long unsigned int}' [-Werror=format=]
snprintf(path, PATH_MAX, "%s/event-%d-%llu-%d", dir,
^
--- arch/alpha/include/asm/types.h | 2 +- arch/alpha/include/uapi/asm/types.h | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-)
arch/alpha/include/asm/types.h +0 -1
@@ -1,7 +1,6 @@#ifndef _ALPHA_TYPES_H#define _ALPHA_TYPES_H -#include <asm-generic/int-ll64.h> #include <uapi/asm/types.h> #endif /* _ALPHA_TYPES_H */
arch/alpha/include/uapi/asm/types.h +11 -1
@@ -9,8 +9,18 @@* need to be careful to avoid a name clashes. */ -#ifndef __KERNEL__ +/* +* This is here because we used to use l64 for alpha +* and we don't want to impact user mode with our change to ll64 +* in the kernel. +* +* However, some user programs are fine with this. They can +* flag __SANE_USERSPACE_TYPES__ to get int-ll64.h here. +*/ +#if !defined(__SANE_USERSPACE_TYPES__) && !defined(__KERNEL__)#include <asm-generic/int-l64.h> +#else +#include <asm-generic/int-ll64.h> #endif #endif /* _UAPI_ALPHA_TYPES_H */
PATCH 167/294 i2c: ismt: Don't duplicate the receive length for block reads
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Douthit <[email protected]>
commit b6c159a9cb69c2cf0bf59d4e12c3a2da77e4d994 upstream.
According to Table 15-14 of the C2000 EDS (Intel doc #510524) the rx data pointed to by the descriptor dptr contains the byte count.
desc->rxbytes reports all bytes read on the wire, including the "byte count" byte. So if a device sends 4 bytes in response to a block read, on the wire and in the DMA buffer we see:
count data1 data2 data3 data4
0x04 0xde 0xad 0xbe 0xef
That's what we want to return in data->block to the next level.
Instead we were actually prefixing that with desc->rxbytes:
bad
count count data1 data2 data3 data4
0x05 0x04 0xde 0xad 0xbe 0xef
This was discovered while developing a BMC solution relying on the ipmi_ssif.c driver which was trying to interpret the bogus length field as part of the IPMI response.
--- drivers/i2c/busses/i2c-ismt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/i2c/busses/i2c-ismt.c +2 -2
@@ -344,8 +344,8 @@ static int ismt_process_desc(const strucbreak ;case I2C_SMBUS_BLOCK_DATA :case I2C_SMBUS_I2C_BLOCK_DATA : -memcpy (&data->block[1 ], dma_buffer, desc->rxbytes); - data->block[0 ] = desc->rxbytes; +memcpy (data->block, dma_buffer, desc->rxbytes); + data->block[0 ] = desc->rxbytes -1 ;break ; }return 0 ;
Re: [PATCH 3.16 167/294] i2c: ismt: Don't duplicate the receive length for block reads
Quoted 1 line · Ben Hutchings
3.16.50-rc1 review patch. If anyone has any objections, please let me know.
Pontus found that this patch trades one bug for another (fixes SMBus reads, breaks I2C reads) and provided a fix.
You'll also want c6ebcedbab7ca78984959386012a17b21183e1a3 from upstream.
-Steve
Quoted 51 lines
------------------
From: Stephen Douthit <[email protected]>
commit
b6c159a9cb69c2cf0bf59d4e12c3a2da77e4d994upstream.According to Table 15-14 of the C2000 EDS (Intel doc #510524) the rx data pointed to by the descriptor dptr contains the byte count.
desc->rxbytesreports all bytes read on the wire, including the "byte count" byte. So if a device sends 4 bytes in response to a block read, on the wire and in the DMA buffer we see:count data1 data2 data3 data4
0x040xde0xad0xbe0xefThat's what we want to return in
data->blockto the next level.Instead we were actually prefixing that with
desc->rxbytes:bad
count count data1 data2 data3 data4
0x050x040xde0xad0xbe0xefThis was discovered while developing a BMC solution relying on the
ipmi_ssif.cdriver which was trying to interpret the bogus length field as part of the IPMI response.Signed-off-by Stephen Douthit <[email protected]>Tested-by Dan Priamo <[email protected]>Acked-by Neil Horman <[email protected]>Signed-off-by Wolfram Sang <[email protected]>Signed-off-by Ben Hutchings <[email protected]>--- drivers/i2c/busses/i2c-ismt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)drivers/i2c/busses/i2c-ismt.c +2
-2@@ -344,8 +344,8 @@ static int ismt_process_desc(const strucbreak ;case I2C_SMBUS_BLOCK_DATA :case I2C_SMBUS_I2C_BLOCK_DATA : -memcpy (&data->block[1 ], dma_buffer, desc->rxbytes); - data->block[0 ] = desc->rxbytes; +memcpy (data->block, dma_buffer, desc->rxbytes); + data->block[0 ] = desc->rxbytes -1 ;break ; }return 0 ;
Re: [PATCH 3.16 167/294] i2c: ismt: Don't duplicate the receive length for block reads
Quoted 9 lines · Stephen Douthit
Quoted 2 lines · Ben Hutchings
3.16.50-rc1 review patch. If anyone has any objections, please let me know.
Pontus found that this patch trades one bug for another (fixes SMBus reads, breaks I2C reads) and provided a fix.
You'll also want
c6ebcedbab7ca78984959386012a17b21183e1a3from upstream.
[...]
Thanks, I've added this.
Ben.
Signature · 3 lines
Ben Hutchings Who are all these weirdos? - David Bowie, reading IRC for the first time
PATCH 168/294 i2c: ismt: Return EMSGSIZE for block reads with bogus length
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Douthit <[email protected]>
commit ba201c4f5ebe13d7819081756378777d8153f23e upstream.
Compare the number of bytes actually seen on the wire to the byte count field returned by the slave device.
Previously we just overwrote the byte count returned by the slave with the real byte count and let the caller figure out if the message was sane.
--- drivers/i2c/busses/i2c-ismt.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-ismt.c +3 -1
@@ -344,8 +344,10 @@ static int ismt_process_desc(const strucbreak ;case I2C_SMBUS_BLOCK_DATA :case I2C_SMBUS_I2C_BLOCK_DATA : +if (desc->rxbytes != dma_buffer[0 ] +1 ) +return -EMSGSIZE ; +memcpy (data->block, dma_buffer, desc->rxbytes); - data->block[0 ] = desc->rxbytes -1 ;break ; }return 0 ;
PATCH 169/294 CIFS: Fix maximum SMB2 header size
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Pavel Shilovsky <[email protected]>
commit 9e37b1784f2be9397a903307574ee565bbadfd75 upstream.
Currently the maximum size of SMB2/3 header is set incorrectly which leads to hanging of directory listing operations on encrypted SMB3 connections. Fix this by setting the maximum size to 170 bytes that is calculated as RFC1002 length field size (4) + transform header size (52) + SMB2 header size (64) + create response size (56).
--- fs/cifs/smb2pdu.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/cifs/smb2pdu.h +2 -2
@@ -82,8 +82,8 @@#define NUMBER_OF_SMB2_COMMANDS 0x0013 -/* BB FIXME - analyze following length BB */ -#define MAX_SMB2_HDR_SIZE 0x78/* 4 len + 64 hdr + (2*24 wct) + 2 bct + 2 pad */ +/* 4 len + 52 transform hdr + 64 hdr + 56 create rsp */ +#define MAX_SMB2_HDR_SIZE 0x00b0#define SMB2_PROTO_NUMBER __constant_cpu_to_le32(0x424d53fe)
PATCH 170/294 CIFS: remove endian related sparse warning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Steve French <[email protected]>
commit 6e3c1529c39e92ed64ca41d53abadabbaa1d5393 upstream.
Recent patch had an endian warning ie
cifs: return ENAMETOOLONG for overlong names in cifs_open()/cifs_lookup()
--- fs/cifs/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/cifs/dir.c +1 -1
@@ -194,7 +194,7 @@ check_name(struct dentry *direntry, struint i;if (unlikely (direntry->d_name.len > - tcon->fsAttrInfo.MaxPathNameComponentLength)) +le32_to_cpu (tcon->fsAttrInfo.MaxPathNameComponentLength)))return -ENAMETOOLONG ;if (!(cifs_sb->mnt_cifs_flags &CIFS_MOUNT_POSIX_PATHS )) {
PATCH 171/294 net_sched: fix error recovery at qdisc creation
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit 87b60cfacf9f17cf71933c6e33b66e68160af71d upstream.
Dmitry reported uses after free in qdisc code [1]
The problem here is that ops->init() can return an error.
qdisc_create_dflt() then call ops->destroy(),
while qdisc_create() does _not_ call it.
Four qdisc chose to call their own ops->destroy(), assuming their caller would not.
This patch makes sure qdisc_create() calls ops->destroy() and fixes the four qdisc to avoid double free.
[1]
BUG: KASAN: use-after-free in mq_destroy+0x242/0x290 net/sched/sch_mq.c:33 at addr ffff8801d415d440 Read of size 8 by task syz-executor2/5030 CPU: 0 PID: 5030 Comm: syz-executor2 Not tainted 4.3.5-smp-DEV #119 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 0000000000000046 ffff8801b435b870 ffffffff81bbbed4 ffff8801db000400 ffff8801d415d440 ffff8801d415dc40 ffff8801c4988510 ffff8801b435b898 ffffffff816682b1 ffff8801b435b928 ffff8801d415d440 ffff8801c49880c0 Call Trace: [<ffffffff81bbbed4>] __dump_stack lib/dump_stack.c:15 [inline] [<ffffffff81bbbed4>] dump_stack+0x6c/0x98 lib/dump_stack.c:51 [<ffffffff816682b1>] kasan_object_err+0x21/0x70 mm/kasan/report.c:158 [<ffffffff81668524>] print_address_description mm/kasan/report.c:196 [inline] [<ffffffff81668524>] kasan_report_error+0x1b4/0x4b0 mm/kasan/report.c:285 [<ffffffff81668953>] kasan_report mm/kasan/report.c:305 [inline] [<ffffffff81668953>] __asan_report_load8_noabort+0x43/0x50 mm/kasan/report.c:326 [<ffffffff82527b02>] mq_destroy+0x242/0x290 net/sched/sch_mq.c:33 [<ffffffff82524bdd>] qdisc_destroy+0x12d/0x290 net/sched/sch_generic.c:953 [<ffffffff82524e30>] qdisc_create_dflt+0xf0/0x120 net/sched/sch_generic.c:848 [<ffffffff8252550d>] attach_default_qdiscs net/sched/sch_generic.c:1029 [inline] [<ffffffff8252550d>] dev_activate+0x6ad/0x880 net/sched/sch_generic.c:1064 [<ffffffff824b1db1>] __dev_open+0x221/0x320 net/core/dev.c:1403 [<ffffffff824b24ce>] __dev_change_flags+0x15e/0x3e0 net/core/dev.c:6858 [<ffffffff824b27de>] dev_change_flags+0x8e/0x140 net/core/dev.c:6926 [<ffffffff824f5bf6>] dev_ifsioc+0x446/0x890 net/core/dev_ioctl.c:260 [<ffffffff824f61fa>] dev_ioctl+0x1ba/0xb80 net/core/dev_ioctl.c:546 [<ffffffff82430509>] sock_do_ioctl+0x99/0xb0 net/socket.c:879 [<ffffffff82430d30>] sock_ioctl+0x2a0/0x390 net/socket.c:958 [<ffffffff816f3b68>] vfs_ioctl fs/ioctl.c:44 [inline] [<ffffffff816f3b68>] do_vfs_ioctl+0x8a8/0xe50 fs/ioctl.c:611 [<ffffffff816f41a4>] SYSC_ioctl fs/ioctl.c:626 [inline] [<ffffffff816f41a4>] SyS_ioctl+0x94/0xc0 fs/ioctl.c:617 [<ffffffff8123e357>] entry_SYSCALL_64_fastpath+0x12/0x17
--- net/sched/sch_api.c | 2 ++ net/sched/sch_hhf.c | 8 ++++++-- net/sched/sch_mq.c | 10 +++------- net/sched/sch_mqprio.c | 19 ++++++------------- net/sched/sch_sfq.c | 3 ++- 5 files changed, 19 insertions(+), 23 deletions(-)
net/sched/sch_api.c +2 -0
@@ -978,6 +978,8 @@ qdisc_create(struct net_device *dev, strreturn sch; } +/* ops->init() failed, we call ->destroy() like qdisc_create_dflt() */ + ops->destroy (sch); err_out3:dev_put (dev);kfree ((char *) sch - sch->padded);
net/sched/sch_hhf.c +6 -2
@@ -644,7 +644,9 @@ static int hhf_init(struct Qdisc *sch, s q->hhf_arrays[i] =hhf_zalloc (HHF_ARRAYS_LEN *sizeof (u32));if (!q->hhf_arrays[i]) { -hhf_destroy (sch); +/* Note: hhf_destroy() will be called +* by our caller. +*/ return -ENOMEM ; } }
@@ -655,7 +657,9 @@ static int hhf_init(struct Qdisc *sch, s q->hhf_valid_bits[i] =hhf_zalloc (HHF_ARRAYS_LEN /BITS_PER_BYTE );if (!q->hhf_valid_bits[i]) { -hhf_destroy (sch); +/* Note: hhf_destroy() will be called +* by our caller. +*/ return -ENOMEM ; } }
net/sched/sch_mq.c +3 -7
@@ -52,7 +52,7 @@ static int mq_init(struct Qdisc *sch, st/* pre-allocate qdiscs, attachment can't fail */ priv->qdiscs =kcalloc (dev->num_tx_queues,sizeof (priv->qdiscs[0 ]),GFP_KERNEL ); -if (priv->qdiscs ==NULL ) +if (!priv->qdiscs)return -ENOMEM ;for (ntx =0 ; ntx < dev->num_tx_queues; ntx++) {
@@ -60,18 +60,14 @@ static int mq_init(struct Qdisc *sch, st qdisc =qdisc_create_dflt (dev_queue, default_qdisc_ops,TC_H_MAKE (TC_H_MAJ (sch->handle),TC_H_MIN (ntx +1 ))); -if (qdisc ==NULL ) - goto err; +if (!qdisc) +return -ENOMEM ; priv->qdiscs[ntx] = qdisc; qdisc->flags |=TCQ_F_ONETXQUEUE ; } sch->flags |=TCQ_F_MQROOT ;return 0 ; - -err: -mq_destroy (sch); -return -ENOMEM ; }static void mq_attach (struct Qdisc *sch)
net/sched/sch_mqprio.c +6 -13
@@ -117,20 +117,17 @@ static int mqprio_init(struct Qdisc *sch/* pre-allocate qdisc, attachment can't fail */ priv->qdiscs =kcalloc (dev->num_tx_queues,sizeof (priv->qdiscs[0 ]),GFP_KERNEL ); -if (priv->qdiscs ==NULL ) { - err = -ENOMEM ; - goto err; - } +if (!priv->qdiscs) +return -ENOMEM ;for (i =0 ; i < dev->num_tx_queues; i++) { dev_queue =netdev_get_tx_queue (dev, i); qdisc =qdisc_create_dflt (dev_queue, default_qdisc_ops,TC_H_MAKE (TC_H_MAJ (sch->handle),TC_H_MIN (i +1 ))); -if (qdisc ==NULL ) { - err = -ENOMEM ; - goto err; - } +if (!qdisc) +return -ENOMEM ; + priv->qdiscs[i] = qdisc; qdisc->flags |=TCQ_F_ONETXQUEUE ; }
@@ -143,7 +140,7 @@ static int mqprio_init(struct Qdisc *sch priv->hw_owned =1 ; err = dev->netdev_ops->ndo_setup_tc (dev, qopt->num_tc);if (err) - goto err; +return err; }else {netdev_set_num_tc (dev, qopt->num_tc);for (i =0 ; i < qopt->num_tc; i++)
@@ -157,10 +154,6 @@ static int mqprio_init(struct Qdisc *sch sch->flags |=TCQ_F_MQROOT ;return 0 ; - -err: -mqprio_destroy (sch); -return err; }static void mqprio_attach (struct Qdisc *sch)
net/sched/sch_sfq.c +2 -1
@@ -770,9 +770,10 @@ static int sfq_init(struct Qdisc *sch, s q->ht =sfq_alloc (sizeof (q->ht[0 ]) * q->divisor); q->slots =sfq_alloc (sizeof (q->slots[0 ]) * q->maxflows);if (!q->ht || !q->slots) { -sfq_destroy (sch); +/* Note: sfq_destroy() will be called by our caller */ return -ENOMEM ; } +for (i =0 ; i < q->divisor; i++) q->ht[i] =SFQ_EMPTY_SLOT ;
PATCH 172/294 sch_htb: fix crash on init failure
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
commit 88c2ace69dbef696edba77712882af03879abc9c upstream.
The commit below added a call to the ->destroy() callback for all qdiscs which failed in their ->init(), but some were not prepared for such change and can't handle partially initialized qdisc. HTB is one of them and if any error occurs before the qdisc watchdog timer and qdisc work are initialized then we can hit either a null ptr deref (timer->base) when canceling in ->destroy or lockdep error info about trying to register a non-static key and a stack dump. So to fix these two move the watchdog timer and workqueue init before anything that can err out.
To reproduce userspace needs to send broken htb qdisc create request, tested with a modified tc (q_htb.c).
Trace log:
[ 2710.897602] BUG: unable to handle kernel NULL pointer dereference at (null) [ 2710.897977] IP: hrtimer_active+0x17/0x8a [ 2710.898174] PGD 58fab067 [ 2710.898175] P4D 58fab067 [ 2710.898353] PUD 586c0067 [ 2710.898531] PMD 0 [ 2710.898710] [ 2710.899045] Oops: 0000 [#1] SMP [ 2710.899232] Modules linked in: [ 2710.899419] CPU: 1 PID: 950 Comm: tc Not tainted 4.13.0-rc6+ #54 [ 2710.899646] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014 [ 2710.900035] task: ffff880059ed2700 task.stack: ffff88005ad4c000 [ 2710.900262] RIP: 0010:hrtimer_active+0x17/0x8a [ 2710.900467] RSP: 0018:ffff88005ad4f960 EFLAGS: 00010246 [ 2710.900684] RAX: 0000000000000000 RBX: ffff88003701e298 RCX: 0000000000000000 [ 2710.900933] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff88003701e298 [ 2710.901177] RBP: ffff88005ad4f980 R08: 0000000000000001 R09: 0000000000000001 [ 2710.901419] R10: ffff88005ad4f800 R11: 0000000000000400 R12: 0000000000000000 [ 2710.901663] R13: ffff88003701e298 R14: ffffffff822a4540 R15: ffff88005ad4fac0 [ 2710.901907] FS: 00007f2f5e90f740(0000) GS:ffff88005d880000(0000) knlGS:0000000000000000 [ 2710.902277] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 2710.902500] CR2: 0000000000000000 CR3: 0000000058ca3000 CR4: 00000000000406e0 [ 2710.902744] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 2710.902977] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 2710.903180] Call Trace: [ 2710.903332] hrtimer_try_to_cancel+0x1a/0x93 [ 2710.903504] hrtimer_cancel+0x15/0x20 [ 2710.903667] qdisc_watchdog_cancel+0x12/0x14 [ 2710.903866] htb_destroy+0x2e/0xf7 [ 2710.904097] qdisc_create+0x377/0x3fd [ 2710.904330] tc_modify_qdisc+0x4d2/0x4fd [ 2710.904511] rtnetlink_rcv_msg+0x188/0x197 [ 2710.904682] ? rcu_read_unlock+0x3e/0x5f [ 2710.904849] ? rtnl_newlink+0x729/0x729 [ 2710.905017] netlink_rcv_skb+0x6c/0xce [ 2710.905183] rtnetlink_rcv+0x23/0x2a [ 2710.905345] netlink_unicast+0x103/0x181 [ 2710.905511] netlink_sendmsg+0x326/0x337 [ 2710.905679] sock_sendmsg_nosec+0x14/0x3f [ 2710.905847] sock_sendmsg+0x29/0x2e [ 2710.906010] ___sys_sendmsg+0x209/0x28b [ 2710.906176] ? do_raw_spin_unlock+0xcd/0xf8 [ 2710.906346] ? _raw_spin_unlock+0x27/0x31 [ 2710.906514] ? __handle_mm_fault+0x651/0xdb1 [ 2710.906685] ? check_chain_key+0xb0/0xfd [ 2710.906855] __sys_sendmsg+0x45/0x63 [ 2710.907018] ? __sys_sendmsg+0x45/0x63 [ 2710.907185] SyS_sendmsg+0x19/0x1b [ 2710.907344] entry_SYSCALL_64_fastpath+0x23/0xc2
Note that probably this bug goes further back because the default qdisc handling always calls ->destroy on init failure too.
--- net/sched/sch_htb.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/sched/sch_htb.c +3 -2
@@ -1025,6 +1025,9 @@ static int htb_init(struct Qdisc *sch, sint err;int i; +qdisc_watchdog_init (&q->watchdog, sch); +INIT_WORK (&q->work, htb_work_func); +if (!opt)return -EINVAL ;
@@ -1045,8 +1048,6 @@ static int htb_init(struct Qdisc *sch, sfor (i =0 ; i <TC_HTB_NUMPRIO ; i++)INIT_LIST_HEAD (q->drops + i); -qdisc_watchdog_init (&q->watchdog, sch); -INIT_WORK (&q->work, htb_work_func);skb_queue_head_init (&q->direct_queue);if (tb[TCA_HTB_DIRECT_QLEN ])
PATCH 173/294 sch_multiq: fix double free on init failure
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
commit e89d469e3be3ed3d7124a803211a463ff83d0964 upstream.
The below commit added a call to ->destroy() on init failure, but multiq still frees ->queues on error in init, but ->queues is also freed by ->destroy() thus we get double free and corrupted memory.
Very easy to reproduce (eth0 not multiqueue):
$ tc qdisc add dev eth0 root multiq RTNETLINK answers: Operation not supported $ ip l add dumdum type dummy (crash)
Trace log:
[ 3929.467747] general protection fault: 0000 [#1] SMP [ 3929.468083] Modules linked in: [ 3929.468302] CPU: 3 PID: 967 Comm: ip Not tainted 4.13.0-rc6+ #56 [ 3929.468625] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014 [ 3929.469124] task: ffff88003716a700 task.stack: ffff88005872c000 [ 3929.469449] RIP: 0010:__kmalloc_track_caller+0x117/0x1be [ 3929.469746] RSP: 0018:ffff88005872f6a0 EFLAGS: 00010246 [ 3929.470042] RAX: 00000000000002de RBX: 0000000058a59000 RCX: 00000000000002df [ 3929.470406] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffffffff821f7020 [ 3929.470770] RBP: ffff88005872f6e8 R08: 000000000001f010 R09: 0000000000000000 [ 3929.471133] R10: ffff88005872f730 R11: 0000000000008cdd R12: ff006d75646d7564 [ 3929.471496] R13: 00000000014000c0 R14: ffff88005b403c00 R15: ffff88005b403c00 [ 3929.471869] FS: 00007f0b70480740(0000) GS:ffff88005d980000(0000) knlGS:0000000000000000 [ 3929.472286] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 3929.472677] CR2: 00007ffcee4f3000 CR3: 0000000059d45000 CR4: 00000000000406e0 [ 3929.473209] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 3929.474109] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 3929.474873] Call Trace: [ 3929.475337] ? kstrdup_const+0x23/0x25 [ 3929.475863] kstrdup+0x2e/0x4b [ 3929.476338] kstrdup_const+0x23/0x25 [ 3929.478084] __kernfs_new_node+0x28/0xbc [ 3929.478478] kernfs_new_node+0x35/0x55 [ 3929.478929] kernfs_create_link+0x23/0x76 [ 3929.479478] sysfs_do_create_link_sd.isra.2+0x85/0xd7 [ 3929.480096] sysfs_create_link+0x33/0x35 [ 3929.480649] device_add+0x200/0x589 [ 3929.481184] netdev_register_kobject+0x7c/0x12f [ 3929.481711] register_netdevice+0x373/0x471 [ 3929.482174] rtnl_newlink+0x614/0x729 [ 3929.482610] ? rtnl_newlink+0x17f/0x729 [ 3929.483080] rtnetlink_rcv_msg+0x188/0x197 [ 3929.483533] ? rcu_read_unlock+0x3e/0x5f [ 3929.483984] ? rtnl_newlink+0x729/0x729 [ 3929.484420] netlink_rcv_skb+0x6c/0xce [ 3929.484858] rtnetlink_rcv+0x23/0x2a [ 3929.485291] netlink_unicast+0x103/0x181 [ 3929.485735] netlink_sendmsg+0x326/0x337 [ 3929.486181] sock_sendmsg_nosec+0x14/0x3f [ 3929.486614] sock_sendmsg+0x29/0x2e [ 3929.486973] ___sys_sendmsg+0x209/0x28b [ 3929.487340] ? do_raw_spin_unlock+0xcd/0xf8 [ 3929.487719] ? _raw_spin_unlock+0x27/0x31 [ 3929.488092] ? __handle_mm_fault+0x651/0xdb1 [ 3929.488471] ? check_chain_key+0xb0/0xfd [ 3929.488847] __sys_sendmsg+0x45/0x63 [ 3929.489206] ? __sys_sendmsg+0x45/0x63 [ 3929.489576] SyS_sendmsg+0x19/0x1b [ 3929.489901] entry_SYSCALL_64_fastpath+0x23/0xc2 [ 3929.490172] RIP: 0033:0x7f0b6fb93690 [ 3929.490423] RSP: 002b:00007ffcee4ed588 EFLAGS: 00000246 ORIG_RAX: 000000000000002e [ 3929.490881] RAX: ffffffffffffffda RBX: ffffffff810d278c RCX: 00007f0b6fb93690 [ 3929.491198] RDX: 0000000000000000 RSI: 00007ffcee4ed5d0 RDI: 0000000000000003 [ 3929.491521] RBP: ffff88005872ff98 R08: 0000000000000001 R09: 0000000000000000 [ 3929.491801] R10: 00007ffcee4ed350 R11: 0000000000000246 R12: 0000000000000002 [ 3929.492075] R13: 000000000066f1a0 R14: 00007ffcee4f5680 R15: 0000000000000000 [ 3929.492352] ? trace_hardirqs_off_caller+0xa7/0xcf [ 3929.492590] Code: 8b 45 c0 48 8b 45 b8 74 17 48 8b 4d c8 83 ca ff 44 89 ee 4c 89 f7 e8 83 ca ff ff 49 89 c4 eb 49 49 63 56 20 48 8d 48 01 4d 8b 06 <49> 8b 1c 14 48 89 c2 4c 89 e0 65 49 0f c7 08 0f 94 c0 83 f0 01 [ 3929.493335] RIP: __kmalloc_track_caller+0x117/0x1be RSP: ffff88005872f6a0
--- net/sched/sch_multiq.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-)
net/sched/sch_multiq.c +2 -7
@@ -250,7 +250,7 @@ static int multiq_tune(struct Qdisc *schstatic int multiq_init (struct Qdisc *sch,struct nlattr *opt) {struct multiq_sched_data *q =qdisc_priv (sch); -int i, err; +int i; q->queues =NULL ;
@@ -265,12 +265,7 @@ static int multiq_init(struct Qdisc *schfor (i =0 ; i < q->max_bands; i++) q->queues[i] = &noop_qdisc; - err =multiq_tune (sch, opt); - -if (err) -kfree (q->queues); - -return err; +return multiq_tune (sch, opt); }static int multiq_dump (struct Qdisc *sch,struct sk_buff *skb)
PATCH 174/294 sch_hhf: fix null pointer dereference on init failure
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
commit 32db864d33c21fd70a217ba53cb7224889354ffb upstream.
If sch_hhf fails in its ->init() function (either due to wrong user-space arguments as below or memory alloc failure of hh_flows) it will do a null pointer deref of q->hh_flows in its ->destroy() function.
To reproduce the crash:
$ tc qdisc add dev eth0 root hhf quantum 2000000 non_hh_weight 10000000
Crash log:
[ 690.654882] BUG: unable to handle kernel NULL pointer dereference at (null) [ 690.655565] IP: hhf_destroy+0x48/0xbc [ 690.655944] PGD 37345067 [ 690.655948] P4D 37345067 [ 690.656252] PUD 58402067 [ 690.656554] PMD 0 [ 690.656857] [ 690.657362] Oops: 0000 [#1] SMP [ 690.657696] Modules linked in: [ 690.658032] CPU: 3 PID: 920 Comm: tc Not tainted 4.13.0-rc6+ #57 [ 690.658525] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014 [ 690.659255] task: ffff880058578000 task.stack: ffff88005acbc000 [ 690.659747] RIP: 0010:hhf_destroy+0x48/0xbc [ 690.660146] RSP: 0018:ffff88005acbf9e0 EFLAGS: 00010246 [ 690.660601] RAX: 0000000000000000 RBX: 0000000000000020 RCX: 0000000000000000 [ 690.661155] RDX: 0000000000000000 RSI: 0000000000000001 RDI: ffffffff821f63f0 [ 690.661710] RBP: ffff88005acbfa08 R08: ffffffff81b10a90 R09: 0000000000000000 [ 690.662267] R10: 00000000f42b7019 R11: ffff880058578000 R12: 00000000ffffffea [ 690.662820] R13: ffff8800372f6400 R14: 0000000000000000 R15: 0000000000000000 [ 690.663769] FS: 00007f8ae5e8b740(0000) GS:ffff88005d980000(0000) knlGS:0000000000000000 [ 690.667069] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 690.667965] CR2: 0000000000000000 CR3: 0000000058523000 CR4: 00000000000406e0 [ 690.668918] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 690.669945] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 690.671003] Call Trace: [ 690.671743] qdisc_create+0x377/0x3fd [ 690.672534] tc_modify_qdisc+0x4d2/0x4fd [ 690.673324] rtnetlink_rcv_msg+0x188/0x197 [ 690.674204] ? rcu_read_unlock+0x3e/0x5f [ 690.675091] ? rtnl_newlink+0x729/0x729 [ 690.675877] netlink_rcv_skb+0x6c/0xce [ 690.676648] rtnetlink_rcv+0x23/0x2a [ 690.677405] netlink_unicast+0x103/0x181 [ 690.678179] netlink_sendmsg+0x326/0x337 [ 690.678958] sock_sendmsg_nosec+0x14/0x3f [ 690.679743] sock_sendmsg+0x29/0x2e [ 690.680506] ___sys_sendmsg+0x209/0x28b [ 690.681283] ? __handle_mm_fault+0xc7d/0xdb1 [ 690.681915] ? check_chain_key+0xb0/0xfd [ 690.682449] __sys_sendmsg+0x45/0x63 [ 690.682954] ? __sys_sendmsg+0x45/0x63 [ 690.683471] SyS_sendmsg+0x19/0x1b [ 690.683974] entry_SYSCALL_64_fastpath+0x23/0xc2 [ 690.684516] RIP: 0033:0x7f8ae529d690 [ 690.685016] RSP: 002b:00007fff26d2d6b8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e [ 690.685931] RAX: ffffffffffffffda RBX: ffffffff810d278c RCX: 00007f8ae529d690 [ 690.686573] RDX: 0000000000000000 RSI: 00007fff26d2d700 RDI: 0000000000000003 [ 690.687047] RBP: ffff88005acbff98 R08: 0000000000000001 R09: 0000000000000000 [ 690.687519] R10: 00007fff26d2d480 R11: 0000000000000246 R12: 0000000000000002 [ 690.687996] R13: 0000000001258070 R14: 0000000000000001 R15: 0000000000000000 [ 690.688475] ? trace_hardirqs_off_caller+0xa7/0xcf [ 690.688887] Code: 00 00 e8 2a 02 ae ff 49 8b bc 1d 60 02 00 00 48 83 c3 08 e8 19 02 ae ff 48 83 fb 20 75 dc 45 31 f6 4d 89 f7 4d 03 bd 20 02 00 00 <49> 8b 07 49 39 c7 75 24 49 83 c6 10 49 81 fe 00 40 00 00 75 e1 [ 690.690200] RIP: hhf_destroy+0x48/0xbc RSP: ffff88005acbf9e0 [ 690.690636] CR2: 0000000000000000
--- net/sched/sch_hhf.c | 3 +++ 1 file changed, 3 insertions(+)
net/sched/sch_hhf.c +3 -0
@@ -509,6 +509,9 @@ static void hhf_destroy(struct Qdisc *schhf_free (q->hhf_valid_bits[i]); } +if (!q->hh_flows) +return ; +for (i =0 ; i <HH_FLOWS_CNT ; i++) {struct hh_flow_state *flow, *next;struct list_head *head = &q->hh_flows[i];
PATCH 175/294 sch_hfsc: fix null pointer deref and double free on init failure
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
commit 3bdac362a2f89ed3e148fa6f38c5f5d858f50b1a upstream.
Depending on where ->init fails we can get a null pointer deref due to uninitialized hires timer (watchdog) or a double free of the qdisc hash because it is already freed by ->destroy().
---
net/sched/sch_hfsc.c +2 -2
@@ -1432,6 +1432,8 @@ hfsc_init_qdisc(struct Qdisc *sch, strucstruct tc_hfsc_qopt *qopt;int err; +qdisc_watchdog_init (&q->watchdog, sch); +if (opt ==NULL ||nla_len (opt) <sizeof (*qopt))return -EINVAL ; qopt =nla_data (opt);
@@ -1457,8 +1459,6 @@ hfsc_init_qdisc(struct Qdisc *sch, strucqdisc_class_hash_insert (&q->clhash, &q->root.cl_common);qdisc_class_hash_grow (sch, &q->clhash); -qdisc_watchdog_init (&q->watchdog, sch); -return 0 ; }
PATCH 176/294 sch_cbq: fix null pointer dereferences on init failure
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
commit 3501d059921246ff617b43e86250a719c140bd97 upstream.
CBQ can fail on ->init by wrong nl attributes or simply for missing any, f.e. if it's set as a default qdisc then TCA_OPTIONS (opt) will be NULL when it is activated. The first thing init does is parse opt but it will dereference a null pointer if used as a default qdisc, also since init failure at default qdisc invokes ->reset() which cancels all timers then we'll also dereference two more null pointers (timer->base) as they were never initialized.
To reproduce:
$ sysctl net.core.default_qdisc=cbq $ ip l set ethX up
Crash log of the first null ptr deref:
[44727.907454] BUG: unable to handle kernel NULL pointer dereference at (null) [44727.907600] IP: cbq_init+0x27/0x205 [44727.907676] PGD 59ff4067 [44727.907677] P4D 59ff4067 [44727.907742] PUD 59c70067 [44727.907807] PMD 0 [44727.907873] [44727.907982] Oops: 0000 [#1] SMP [44727.908054] Modules linked in: [44727.908126] CPU: 1 PID: 21312 Comm: ip Not tainted 4.13.0-rc6+ #60 [44727.908235] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014 [44727.908477] task: ffff88005ad42700 task.stack: ffff880037214000 [44727.908672] RIP: 0010:cbq_init+0x27/0x205 [44727.908838] RSP: 0018:ffff8800372175f0 EFLAGS: 00010286 [44727.909018] RAX: ffffffff816c3852 RBX: ffff880058c53800 RCX: 0000000000000000 [44727.909222] RDX: 0000000000000004 RSI: 0000000000000000 RDI: ffff8800372175f8 [44727.909427] RBP: ffff880037217650 R08: ffffffff81b0f380 R09: 0000000000000000 [44727.909631] R10: ffff880037217660 R11: 0000000000000020 R12: ffffffff822a44c0 [44727.909835] R13: ffff880058b92000 R14: 00000000ffffffff R15: 0000000000000001 [44727.910040] FS: 00007ff8bc583740(0000) GS:ffff88005d880000(0000) knlGS:0000000000000000 [44727.910339] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [44727.910525] CR2: 0000000000000000 CR3: 00000000371e5000 CR4: 00000000000406e0 [44727.910731] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [44727.910936] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [44727.911141] Call Trace: [44727.911291] ? lockdep_init_map+0xb6/0x1ba [44727.911461] ? qdisc_alloc+0x14e/0x187 [44727.911626] qdisc_create_dflt+0x7a/0x94 [44727.911794] ? dev_activate+0x129/0x129 [44727.911959] attach_one_default_qdisc+0x36/0x63 [44727.912132] netdev_for_each_tx_queue+0x3d/0x48 [44727.912305] dev_activate+0x4b/0x129 [44727.912468] __dev_open+0xe7/0x104 [44727.912631] __dev_change_flags+0xc6/0x15c [44727.912799] dev_change_flags+0x25/0x59 [44727.912966] do_setlink+0x30c/0xb3f [44727.913129] ? check_chain_key+0xb0/0xfd [44727.913294] ? check_chain_key+0xb0/0xfd [44727.913463] rtnl_newlink+0x3a4/0x729 [44727.913626] ? rtnl_newlink+0x117/0x729 [44727.913801] ? ns_capable_common+0xd/0xb1 [44727.913968] ? ns_capable+0x13/0x15 [44727.914131] rtnetlink_rcv_msg+0x188/0x197 [44727.914300] ? rcu_read_unlock+0x3e/0x5f [44727.914465] ? rtnl_newlink+0x729/0x729 [44727.914630] netlink_rcv_skb+0x6c/0xce [44727.914796] rtnetlink_rcv+0x23/0x2a [44727.914956] netlink_unicast+0x103/0x181 [44727.915122] netlink_sendmsg+0x326/0x337 [44727.915291] sock_sendmsg_nosec+0x14/0x3f [44727.915459] sock_sendmsg+0x29/0x2e [44727.915619] ___sys_sendmsg+0x209/0x28b [44727.915784] ? do_raw_spin_unlock+0xcd/0xf8 [44727.915954] ? _raw_spin_unlock+0x27/0x31 [44727.916121] ? __handle_mm_fault+0x651/0xdb1 [44727.916290] ? check_chain_key+0xb0/0xfd [44727.916461] __sys_sendmsg+0x45/0x63 [44727.916626] ? __sys_sendmsg+0x45/0x63 [44727.916792] SyS_sendmsg+0x19/0x1b [44727.916950] entry_SYSCALL_64_fastpath+0x23/0xc2 [44727.917125] RIP: 0033:0x7ff8bbc96690 [44727.917286] RSP: 002b:00007ffc360991e8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e [44727.917579] RAX: ffffffffffffffda RBX: ffffffff810d278c RCX: 00007ff8bbc96690 [44727.917783] RDX: 0000000000000000 RSI: 00007ffc36099230 RDI: 0000000000000003 [44727.917987] RBP: ffff880037217f98 R08: 0000000000000001 R09: 0000000000000003 [44727.918190] R10: 00007ffc36098fb0 R11: 0000000000000246 R12: 0000000000000006 [44727.918393] R13: 000000000066f1a0 R14: 00007ffc360a12e0 R15: 0000000000000000 [44727.918597] ? trace_hardirqs_off_caller+0xa7/0xcf [44727.918774] Code: 41 5f 5d c3 66 66 66 66 90 55 48 8d 56 04 45 31 c9 49 c7 c0 80 f3 b0 81 48 89 e5 41 55 41 54 53 48 89 fb 48 8d 7d a8 48 83 ec 48 <0f> b7 0e be 07 00 00 00 83 e9 04 e8 e6 f7 d8 ff 85 c0 0f 88 bb [44727.919332] RIP: cbq_init+0x27/0x205 RSP: ffff8800372175f0 [44727.919516] CR2: 0000000000000000
[bwh: Backported to 3.16:
- Keep using HRTIMER_MODE_ABS
- Adjust context]
--- net/sched/sch_cbq.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
net/sched/sch_cbq.c +7 -3
@@ -1364,6 +1364,13 @@ static int cbq_init(struct Qdisc *sch, sstruct tc_ratespec *r;int err; +qdisc_watchdog_init (&q->watchdog, sch); +hrtimer_init (&q->delay_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS_PINNED ); + q->delay_timer.function = cbq_undelay; + +if (!opt) +return -EINVAL ; + err =nla_parse_nested (tb,TCA_CBQ_MAX , opt, cbq_policy);if (err <0 )return err;
@@ -1402,9 +1409,6 @@ static int cbq_init(struct Qdisc *sch, s q->link.avpkt = q->link.allot/2 ; q->link.minidle =-0x7FFFFFFF ; -qdisc_watchdog_init (&q->watchdog, sch); -hrtimer_init (&q->delay_timer,CLOCK_MONOTONIC ,HRTIMER_MODE_ABS ); - q->delay_timer.function = cbq_undelay; q->toplevel =TC_CBQ_MAXLEVEL ; q->now =psched_get_time (); q->now_rt = q->now;
PATCH 177/294 sch_fq_codel: avoid double free on init failure
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
commit 30c31d746d0eb458ae327f522bc8e4c44cbea0f0 upstream.
It is very unlikely to happen but the backlogs memory allocation could fail and will free q->flows, but then ->destroy() will free q->flows too. For correctness remove the first free and let ->destroy clean up.
--- net/sched/sch_fq_codel.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
net/sched/sch_fq_codel.c +1 -3
@@ -411,10 +411,8 @@ static int fq_codel_init(struct Qdisc *sif (!q->flows)return -ENOMEM ; q->backlogs =fq_codel_zalloc (q->flows_cnt *sizeof (u32)); -if (!q->backlogs) { -fq_codel_free (q->flows); +if (!q->backlogs)return -ENOMEM ; - }for (i =0 ; i < q->flows_cnt; i++) {struct fq_codel_flow *flow = q->flows + i;
PATCH 178/294 sch_netem: avoid null pointer deref on init failure
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
commit 634576a1844dba15bc5e6fc61d72f37e13a21615 upstream.
netem can fail in ->init due to missing options (either not supplied by user-space or used as a default qdisc) causing a timer->base null pointer deref in its ->destroy() and ->reset() callbacks.
Reproduce:
$ sysctl net.core.default_qdisc=netem $ ip l set ethX up
Crash log:
[ 1814.846943] BUG: unable to handle kernel NULL pointer dereference at (null) [ 1814.847181] IP: hrtimer_active+0x17/0x8a [ 1814.847270] PGD 59c34067 [ 1814.847271] P4D 59c34067 [ 1814.847337] PUD 37374067 [ 1814.847403] PMD 0 [ 1814.847468] [ 1814.847582] Oops: 0000 [#1] SMP [ 1814.847655] Modules linked in: sch_netem(O) sch_fq_codel(O) [ 1814.847761] CPU: 3 PID: 1573 Comm: ip Tainted: G O 4.13.0-rc6+ #62 [ 1814.847884] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014 [ 1814.848043] task: ffff88003723a700 task.stack: ffff88005adc8000 [ 1814.848235] RIP: 0010:hrtimer_active+0x17/0x8a [ 1814.848407] RSP: 0018:ffff88005adcb590 EFLAGS: 00010246 [ 1814.848590] RAX: 0000000000000000 RBX: ffff880058e359d8 RCX: 0000000000000000 [ 1814.848793] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880058e359d8 [ 1814.848998] RBP: ffff88005adcb5b0 R08: 00000000014080c0 R09: 00000000ffffffff [ 1814.849204] R10: ffff88005adcb660 R11: 0000000000000020 R12: 0000000000000000 [ 1814.849410] R13: ffff880058e359d8 R14: 00000000ffffffff R15: 0000000000000001 [ 1814.849616] FS: 00007f733bbca740(0000) GS:ffff88005d980000(0000) knlGS:0000000000000000 [ 1814.849919] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 1814.850107] CR2: 0000000000000000 CR3: 0000000059f0d000 CR4: 00000000000406e0 [ 1814.850313] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 1814.850518] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 1814.850723] Call Trace: [ 1814.850875] hrtimer_try_to_cancel+0x1a/0x93 [ 1814.851047] hrtimer_cancel+0x15/0x20 [ 1814.851211] qdisc_watchdog_cancel+0x12/0x14 [ 1814.851383] netem_reset+0xe6/0xed [sch_netem] [ 1814.851561] qdisc_destroy+0x8b/0xe5 [ 1814.851723] qdisc_create_dflt+0x86/0x94 [ 1814.851890] ? dev_activate+0x129/0x129 [ 1814.852057] attach_one_default_qdisc+0x36/0x63 [ 1814.852232] netdev_for_each_tx_queue+0x3d/0x48 [ 1814.852406] dev_activate+0x4b/0x129 [ 1814.852569] __dev_open+0xe7/0x104 [ 1814.852730] __dev_change_flags+0xc6/0x15c [ 1814.852899] dev_change_flags+0x25/0x59 [ 1814.853064] do_setlink+0x30c/0xb3f [ 1814.853228] ? check_chain_key+0xb0/0xfd [ 1814.853396] ? check_chain_key+0xb0/0xfd [ 1814.853565] rtnl_newlink+0x3a4/0x729 [ 1814.853728] ? rtnl_newlink+0x117/0x729 [ 1814.853905] ? ns_capable_common+0xd/0xb1 [ 1814.854072] ? ns_capable+0x13/0x15 [ 1814.854234] rtnetlink_rcv_msg+0x188/0x197 [ 1814.854404] ? rcu_read_unlock+0x3e/0x5f [ 1814.854572] ? rtnl_newlink+0x729/0x729 [ 1814.854737] netlink_rcv_skb+0x6c/0xce [ 1814.854902] rtnetlink_rcv+0x23/0x2a [ 1814.855064] netlink_unicast+0x103/0x181 [ 1814.855230] netlink_sendmsg+0x326/0x337 [ 1814.855398] sock_sendmsg_nosec+0x14/0x3f [ 1814.855584] sock_sendmsg+0x29/0x2e [ 1814.855747] ___sys_sendmsg+0x209/0x28b [ 1814.855912] ? do_raw_spin_unlock+0xcd/0xf8 [ 1814.856082] ? _raw_spin_unlock+0x27/0x31 [ 1814.856251] ? __handle_mm_fault+0x651/0xdb1 [ 1814.856421] ? check_chain_key+0xb0/0xfd [ 1814.856592] __sys_sendmsg+0x45/0x63 [ 1814.856755] ? __sys_sendmsg+0x45/0x63 [ 1814.856923] SyS_sendmsg+0x19/0x1b [ 1814.857083] entry_SYSCALL_64_fastpath+0x23/0xc2 [ 1814.857256] RIP: 0033:0x7f733b2dd690 [ 1814.857419] RSP: 002b:00007ffe1d3387d8 EFLAGS: 00000246 ORIG_RAX: 000000000000002e [ 1814.858238] RAX: ffffffffffffffda RBX: ffffffff810d278c RCX: 00007f733b2dd690 [ 1814.858445] RDX: 0000000000000000 RSI: 00007ffe1d338820 RDI: 0000000000000003 [ 1814.858651] RBP: ffff88005adcbf98 R08: 0000000000000001 R09: 0000000000000003 [ 1814.858856] R10: 00007ffe1d3385a0 R11: 0000000000000246 R12: 0000000000000002 [ 1814.859060] R13: 000000000066f1a0 R14: 00007ffe1d3408d0 R15: 0000000000000000 [ 1814.859267] ? trace_hardirqs_off_caller+0xa7/0xcf [ 1814.859446] Code: 10 55 48 89 c7 48 89 e5 e8 45 a1 fb ff 31 c0 5d c3 31 c0 c3 66 66 66 66 90 55 48 89 e5 41 56 41 55 41 54 53 49 89 fd 49 8b 45 30 <4c> 8b 20 41 8b 5c 24 38 31 c9 31 d2 48 c7 c7 50 8e 1d 82 41 89 [ 1814.860022] RIP: hrtimer_active+0x17/0x8a RSP: ffff88005adcb590 [ 1814.860214] CR2: 0000000000000000
--- net/sched/sch_netem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/sched/sch_netem.c +2 -2
@@ -956,11 +956,11 @@ static int netem_init(struct Qdisc *sch,struct netem_sched_data *q =qdisc_priv (sch);int ret; +qdisc_watchdog_init (&q->watchdog, sch); +if (!opt)return -EINVAL ; -qdisc_watchdog_init (&q->watchdog, sch); - q->loss_model =CLG_RANDOM ; ret =netem_change (sch, opt);if (ret)
PATCH 179/294 sch_tbf: fix two null pointer dereferences on init failure
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nikolay Aleksandrov <[email protected]>
commit c2d6511e6a4f1f3673d711569c00c3849549e9b0 upstream.
sch_tbf calls qdisc_watchdog_cancel() in both its ->reset and ->destroy callbacks but it may fail before the timer is initialized due to missing options (either not supplied by user-space or set as a default qdisc), also q->qdisc is used by ->reset and ->destroy so we need it initialized.
Reproduce:
$ sysctl net.core.default_qdisc=tbf $ ip l set ethX up
Crash log:
[ 959.160172] BUG: unable to handle kernel NULL pointer dereference at 0000000000000018 [ 959.160323] IP: qdisc_reset+0xa/0x5c [ 959.160400] PGD 59cdb067 [ 959.160401] P4D 59cdb067 [ 959.160466] PUD 59ccb067 [ 959.160532] PMD 0 [ 959.160597] [ 959.160706] Oops: 0000 [#1] SMP [ 959.160778] Modules linked in: sch_tbf sch_sfb sch_prio sch_netem [ 959.160891] CPU: 2 PID: 1562 Comm: ip Not tainted 4.13.0-rc6+ #62 [ 959.160998] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.7.5-20140531_083030-gandalf 04/01/2014 [ 959.161157] task: ffff880059c9a700 task.stack: ffff8800376d0000 [ 959.161263] RIP: 0010:qdisc_reset+0xa/0x5c [ 959.161347] RSP: 0018:ffff8800376d3610 EFLAGS: 00010286 [ 959.161531] RAX: ffffffffa001b1dd RBX: ffff8800373a2800 RCX: 0000000000000000 [ 959.161733] RDX: ffffffff8215f160 RSI: ffffffff8215f160 RDI: 0000000000000000 [ 959.161939] RBP: ffff8800376d3618 R08: 00000000014080c0 R09: 00000000ffffffff [ 959.162141] R10: ffff8800376d3578 R11: 0000000000000020 R12: ffffffffa001d2c0 [ 959.162343] R13: ffff880037538000 R14: 00000000ffffffff R15: 0000000000000001 [ 959.162546] FS: 00007fcc5126b740(0000) GS:ffff88005d900000(0000) knlGS:0000000000000000 [ 959.162844] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 959.163030] CR2: 0000000000000018 CR3: 000000005abc4000 CR4: 00000000000406e0 [ 959.163233] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 [ 959.163436] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 [ 959.163638] Call Trace: [ 959.163788] tbf_reset+0x19/0x64 [sch_tbf] [ 959.163957] qdisc_destroy+0x8b/0xe5 [ 959.164119] qdisc_create_dflt+0x86/0x94 [ 959.164284] ? dev_activate+0x129/0x129 [ 959.164449] attach_one_default_qdisc+0x36/0x63 [ 959.164623] netdev_for_each_tx_queue+0x3d/0x48 [ 959.164795] dev_activate+0x4b/0x129 [ 959.164957] __dev_open+0xe7/0x104 [ 959.165118] __dev_change_flags+0xc6/0x15c [ 959.165287] dev_change_flags+0x25/0x59 [ 959.165451] do_setlink+0x30c/0xb3f [ 959.165613] ? check_chain_key+0xb0/0xfd [ 959.165782] rtnl_newlink+0x3a4/0x729 [ 959.165947] ? rtnl_newlink+0x117/0x729 [ 959.166121] ? ns_capable_common+0xd/0xb1 [ 959.166288] ? ns_capable+0x13/0x15 [ 959.166450] rtnetlink_rcv_msg+0x188/0x197 [ 959.166617] ? rcu_read_unlock+0x3e/0x5f [ 959.166783] ? rtnl_newlink+0x729/0x729 [ 959.166948] netlink_rcv_skb+0x6c/0xce [ 959.167113] rtnetlink_rcv+0x23/0x2a [ 959.167273] netlink_unicast+0x103/0x181 [ 959.167439] netlink_sendmsg+0x326/0x337 [ 959.167607] sock_sendmsg_nosec+0x14/0x3f [ 959.167772] sock_sendmsg+0x29/0x2e [ 959.167932] ___sys_sendmsg+0x209/0x28b [ 959.168098] ? do_raw_spin_unlock+0xcd/0xf8 [ 959.168267] ? _raw_spin_unlock+0x27/0x31 [ 959.168432] ? __handle_mm_fault+0x651/0xdb1 [ 959.168602] ? check_chain_key+0xb0/0xfd [ 959.168773] __sys_sendmsg+0x45/0x63 [ 959.168934] ? __sys_sendmsg+0x45/0x63 [ 959.169100] SyS_sendmsg+0x19/0x1b [ 959.169260] entry_SYSCALL_64_fastpath+0x23/0xc2 [ 959.169432] RIP: 0033:0x7fcc5097e690 [ 959.169592] RSP: 002b:00007ffd0d5c7b48 EFLAGS: 00000246 ORIG_RAX: 000000000000002e [ 959.169887] RAX: ffffffffffffffda RBX: ffffffff810d278c RCX: 00007fcc5097e690 [ 959.170089] RDX: 0000000000000000 RSI: 00007ffd0d5c7b90 RDI: 0000000000000003 [ 959.170292] RBP: ffff8800376d3f98 R08: 0000000000000001 R09: 0000000000000003 [ 959.170494] R10: 00007ffd0d5c7910 R11: 0000000000000246 R12: 0000000000000006 [ 959.170697] R13: 000000000066f1a0 R14: 00007ffd0d5cfc40 R15: 0000000000000000 [ 959.170900] ? trace_hardirqs_off_caller+0xa7/0xcf [ 959.171076] Code: 00 41 c7 84 24 14 01 00 00 00 00 00 00 41 c7 84 24 98 00 00 00 00 00 00 00 41 5c 41 5d 41 5e 5d c3 66 66 66 66 90 55 48 89 e5 53 <48> 8b 47 18 48 89 fb 48 8b 40 48 48 85 c0 74 02 ff d0 48 8b bb [ 959.171637] RIP: qdisc_reset+0xa/0x5c RSP: ffff8800376d3610 [ 959.171821] CR2: 0000000000000018
--- net/sched/sch_tbf.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
net/sched/sch_tbf.c +3 -2
@@ -431,12 +431,13 @@ static int tbf_init(struct Qdisc *sch, s {struct tbf_sched_data *q =qdisc_priv (sch); +qdisc_watchdog_init (&q->watchdog, sch); + q->qdisc = &noop_qdisc; +if (opt ==NULL )return -EINVAL ; q->t_c =ktime_to_ns (ktime_get ()); -qdisc_watchdog_init (&q->watchdog, sch); - q->qdisc = &noop_qdisc;return tbf_change (sch, opt); }
PATCH 180/294 wl1251: add a missing spin_lock_init()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Cong Wang <[email protected]>
commit f581a0dd744fe32b0a8805e279c59ec1ac676d60 upstream.
wl1251: add a missing spin_lock_init()
This fixes the following kernel warning:
[ 5668.771453] BUG: spinlock bad magic on CPU#0, kworker/u2:3/9745 [ 5668.771850] lock: 0xce63ef20, .magic: 00000000, .owner: <none>/-1, .owner_cpu: 0 [ 5668.772277] CPU: 0 PID: 9745 Comm: kworker/u2:3 Tainted: G W 4.12.0-03002-gec979a4-dirty #40 [ 5668.772796] Hardware name: Nokia RX-51 board [ 5668.773071] Workqueue: phy1 wl1251_irq_work [ 5668.773345] [<c010c9e4>] (unwind_backtrace) from [<c010a274>] (show_stack+0x10/0x14) [ 5668.773803] [<c010a274>] (show_stack) from [<c01545a4>] (do_raw_spin_lock+0x6c/0xa0) [ 5668.774230] [<c01545a4>] (do_raw_spin_lock) from [<c06ca578>] (_raw_spin_lock_irqsave+0x10/0x18) [ 5668.774658] [<c06ca578>] (_raw_spin_lock_irqsave) from [<c048c010>] (wl1251_op_tx+0x38/0x5c) [ 5668.775115] [<c048c010>] (wl1251_op_tx) from [<c06a12e8>] (ieee80211_tx_frags+0x188/0x1c0) [ 5668.775543] [<c06a12e8>] (ieee80211_tx_frags) from [<c06a138c>] (__ieee80211_tx+0x6c/0x130) [ 5668.775970] [<c06a138c>] (__ieee80211_tx) from [<c06a3dbc>] (ieee80211_tx+0xdc/0x104) [ 5668.776367] [<c06a3dbc>] (ieee80211_tx) from [<c06a4af0>] (__ieee80211_subif_start_xmit+0x454/0x8c8) [ 5668.776824] [<c06a4af0>] (__ieee80211_subif_start_xmit) from [<c06a4f94>] (ieee80211_subif_start_xmit+0x30/0x2fc) [ 5668.777343] [<c06a4f94>] (ieee80211_subif_start_xmit) from [<c0578848>] (dev_hard_start_xmit+0x80/0x118)
...
by adding the missing spin_lock_init().
--- drivers/net/wireless/ti/wl1251/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/ti/wl1251/main.c +1 -0
@@ -1571,6 +1571,7 @@ struct ieee80211_hw *wl1251_alloc_hw(voi wl->state =WL1251_STATE_OFF ;mutex_init (&wl->mutex); +spin_lock_init (&wl->wl_lock); wl->tx_mgmt_frm_rate =DEFAULT_HW_GEN_TX_RATE ; wl->tx_mgmt_frm_mod =DEFAULT_HW_GEN_MODULATION_TYPE ;
PATCH 181/294 epoll: fix race between ep_poll_callback(POLLFREE) and ep_free()/ep_remove()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit 138e4ad67afd5c6c318b056b4d17c17f2c0ca5c0 upstream.
The race was introduced by me in commit 971316f0503a ("epoll:ep_unregister_pollwait() can use the freed pwq->whead"). I did not realize that nothing can protect eventpoll after ep_poll_callback() sets ->whead = NULL, only whead->lock can save us from the race with ep_free() or ep_remove().
Move ->whead = NULL to the end of ep_poll_callback() and add the necessary barriers.
TODO: cleanup the ewake/EPOLLEXCLUSIVE logic, it was confusing even before this patch.
Hopefully this explains use-after-free reported by syzcaller:
BUG: KASAN: use-after-free in debug_spin_lock_before ... _raw_spin_lock_irqsave+0x4a/0x60 kernel/locking/spinlock.c:159 ep_poll_callback+0x29f/0xff0 fs/eventpoll.c:1148
this is spin_lock(eventpoll->lock),
... Freed by task 17774: ... kfree+0xe8/0x2c0 mm/slub.c:3883 ep_free+0x22c/0x2a0 fs/eventpoll.c:865
---
fs/eventpoll.c +23 -13
@@ -518,8 +518,13 @@ static void ep_remove_wait_queue(structwait_queue_head_t *whead;rcu_read_lock (); -/* If it is cleared by POLLFREE, it should be rcu-safe */ - whead =rcu_dereference (pwq->whead); +/* +* If it is cleared by POLLFREE, it should be rcu-safe. +* If we read NULL we need a barrier paired with +* smp_store_release() in ep_poll_callback(), otherwise +* we rely on whead->lock. +*/ + whead =smp_load_acquire (&pwq->whead);if (whead)remove_wait_queue (whead, &pwq->wait);rcu_read_unlock ();
@@ -1006,17 +1011,6 @@ static int ep_poll_callback(wait_queue_tstruct epitem *epi =ep_item_from_wait (wait);struct eventpoll *ep = epi->ep; -if ((unsigned long )key &POLLFREE ) { -ep_pwq_from_wait (wait)->whead =NULL ; -/* -* whead = NULL above can race with ep_remove_wait_queue() -* which can do another remove_wait_queue() after us, so we -* can't use __remove_wait_queue(). whead->lock is held by -* the caller. -*/ -list_del_init (&wait->task_list); - } -spin_lock_irqsave (&ep->lock, flags);/*
@@ -1081,6 +1075,22 @@ out_unlock:if (pwake)ep_poll_safewake (&ep->poll_wait); +if ((unsigned long )key &POLLFREE ) { +/* +* If we race with ep_remove_wait_queue() it can miss +* ->whead = NULL and do another remove_wait_queue() after +* us, so we can't use __remove_wait_queue(). +*/ +list_del_init (&wait->task_list); +/* +* ->whead != NULL protects us from the race with ep_free() +* or ep_remove(), ep_remove_wait_queue() takes whead->lock +* held by the caller. Once we nullify it, nothing protects +* ep/epi or even wait. +*/ +smp_store_release (&ep_pwq_from_wait (wait)->whead,NULL ); + } +return 1 ; }
PATCH 182/294 cifs: check MaxPathNameComponentLength != 0 before using it
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ronnie Sahlberg <[email protected]>
commit f74bc7c6679200a4a83156bb89cbf6c229fe8ec0 upstream.
And fix tcon leak in error path.
--- fs/cifs/dir.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
fs/cifs/dir.c +3 -2
@@ -193,7 +193,8 @@ check_name(struct dentry *direntry, strustruct cifs_sb_info *cifs_sb =CIFS_SB (direntry->d_sb);int i; -if (unlikely (direntry->d_name.len > +if (unlikely (tcon->fsAttrInfo.MaxPathNameComponentLength && + direntry->d_name.len >le32_to_cpu (tcon->fsAttrInfo.MaxPathNameComponentLength)))return -ENAMETOOLONG ;
@@ -509,7 +510,7 @@ cifs_atomic_open(struct inode *inode, st rc =check_name (direntry, tcon);if (rc) - goto out_free_xid; + goto out; server = tcon->ses->server;
PATCH 183/294 brcmfmac: add length check in brcmf_cfg80211_escan_handler()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arend Van Spriel <[email protected]>
commit 17df6453d4be17910456e99c5a85025aa1b7a246 upstream.
Upon handling the firmware notification for scans the length was checked properly and may result in corrupting kernel heap memory due to buffer overruns. This fix addresses CVE-2017-0786.
[bwh: Backported to 3.16:
- Use WL_ESCAN_BUF_SIZE instead of BRCMF_ESCAN_BUF_SIZE
- Adjust filename]
--- .../wireless/brcm80211/brcmfmac/wl_cfg80211.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c +15 -3
@@ -2692,6 +2692,7 @@ brcmf_cfg80211_escan_handler(struct brcms32 status;s32 err =0 ;struct brcmf_escan_result_le *escan_result_le; +u32 escan_buflen;struct brcmf_bss_info_le *bss_info_le;struct brcmf_bss_info_le *bss =NULL ;u32 bi_length;
@@ -2708,11 +2709,23 @@ brcmf_cfg80211_escan_handler(struct brcmif (status ==BRCMF_E_STATUS_PARTIAL ) {brcmf_dbg (SCAN ,"ESCAN Partial result\n" ); +if (e->datalen <sizeof (*escan_result_le)) { +brcmf_err ("invalid event data length\n" ); + goto exit; + } escan_result_le = (struct brcmf_escan_result_le *) data;if (!escan_result_le) {brcmf_err ("Invalid escan result (NULL pointer)\n" ); goto exit; } + escan_buflen =le32_to_cpu (escan_result_le->buflen); +if (escan_buflen >WL_ESCAN_BUF_SIZE || + escan_buflen > e->datalen || + escan_buflen <sizeof (*escan_result_le)) { +brcmf_err ("Invalid escan buffer length: %d\n" , + escan_buflen); + goto exit; + }if (le16_to_cpu (escan_result_le->bss_count) !=1 ) {brcmf_err ("Invalid bss_count %d: ignoring\n" , escan_result_le->bss_count);
@@ -2729,9 +2742,8 @@ brcmf_cfg80211_escan_handler(struct brcm } bi_length =le32_to_cpu (bss_info_le->length); -if (bi_length != (le32_to_cpu (escan_result_le->buflen) - -WL_ESCAN_RESULTS_FIXED_SIZE )) { -brcmf_err ("Invalid bss_info length %d: ignoring\n" , +if (bi_length != escan_buflen -WL_ESCAN_RESULTS_FIXED_SIZE ) { +brcmf_err ("Ignoring invalid bss_info length: %d\n" , bi_length); goto exit; }
PATCH 184/294 fix unbalanced page refcounting in bio_map_user_iov
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Vitaly Mayatskikh <[email protected]>
commit 95d78c28b5a85bacbc29b8dba7c04babb9b0d467 upstream.
bio_map_user_iov and bio_unmap_user do unbalanced pages refcounting if IO vector has small consecutive buffers belonging to the same page. bio_add_pc_page merges them into one, but the page reference is never dropped.
--- block/bio.c | 8 ++++++++ 1 file changed, 8 insertions(+)
block/bio.c +8 -0
@@ -1337,6 +1337,7 @@ static struct bio *__bio_map_user_iov(st offset = uaddr & ~PAGE_MASK ;for (j = cur_page; j < page_limit; j++) {unsigned int bytes =PAGE_SIZE - offset; +unsigned short prev_bi_vcnt = bio->bi_vcnt;if (len <=0 )break ;
@@ -1351,6 +1352,13 @@ static struct bio *__bio_map_user_iov(st bytes)break ; +/* +* check if vector was merged with previous +* drop page reference if needed +*/ +if (bio->bi_vcnt == prev_bi_vcnt) +put_page (pages[j]); + len -= bytes; offset =0 ; }
PATCH 185/294 KEYS: prevent KEYCTL_READ on negative key
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Biggers <[email protected]>
commit 37863c43b2c6464f252862bf2e9768264e961678 upstream.
Because keyctl_read_key() looks up the key with no permissions requested, it may find a negatively instantiated key. If the key is also possessed, we went ahead and called ->read() on the key. But the key payload will actually contain the ->reject_error rather than the normal payload. Thus, the kernel oopses trying to read the user_key_payload from memory address (int)-ENOKEY = 0x00000000ffffff82.
Fortunately the payload data is stored inline, so it shouldn't be possible to abuse this as an arbitrary memory read primitive...
Reproducer:
keyctl new_session
keyctl request2 user desc '' @s
keyctl read $(keyctl show | awk '/user: desc/ {print $1}')
It causes a crash like the following:
BUG: unable to handle kernel paging request at 00000000ffffff92
IP: user_read+0x33/0xa0
PGD 36a54067 P4D 36a54067 PUD 0
Oops: 0000 [#1] SMP
CPU: 0 PID: 211 Comm: keyctl Not tainted 4.14.0-rc1 #337
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-20170228_101828-anatol 04/01/2014
task: ffff90aa3b74c3c0 task.stack: ffff9878c0478000
RIP: 0010:user_read+0x33/0xa0
RSP: 0018:ffff9878c047bee8 EFLAGS: 00010246
RAX: 0000000000000001 RBX: ffff90aa3d7da340 RCX: 0000000000000017
RDX: 0000000000000000 RSI: 00000000ffffff82 RDI: ffff90aa3d7da340
RBP: ffff9878c047bf00 R08: 00000024f95da94f R09: 0000000000000000
R10: 0000000000000001 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
FS: 00007f58ece69740(0000) GS:ffff90aa3e200000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00000000ffffff92 CR3: 0000000036adc001 CR4: 00000000003606f0
Call Trace:
keyctl_read_key+0xac/0xe0
SyS_keyctl+0x99/0x120
entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x7f58ec787bb9
RSP: 002b:00007ffc8d401678 EFLAGS: 00000206 ORIG_RAX: 00000000000000fa
RAX: ffffffffffffffda RBX: 00007ffc8d402800 RCX: 00007f58ec787bb9
RDX: 0000000000000000 RSI: 00000000174a63ac RDI: 000000000000000b
RBP: 0000000000000004 R08: 00007ffc8d402809 R09: 0000000000000020
R10: 0000000000000000 R11: 0000000000000206 R12: 00007ffc8d402800
R13: 00007ffc8d4016e0 R14: 0000000000000000 R15: 0000000000000000
Code: e5 41 55 49 89 f5 41 54 49 89 d4 53 48 89 fb e8 a4 b4 ad ff 85 c0 74 09 80 3d b9 4c 96 00 00 74 43 48 8b b3 20 01 00 00 4d 85 ed <0f> b7 5e 10 74 29 4d 85 e4 74 24 4c 39 e3 4c 89 e2 4c 89 ef 48
RIP: user_read+0x33/0xa0 RSP: ffff9878c047bee8
CR2: 00000000ffffff92--- security/keys/keyctl.c | 5 +++++ 1 file changed, 5 insertions(+)
security/keys/keyctl.c +5 -0
@@ -735,6 +735,11 @@ long keyctl_read_key(key_serial_t keyid, key =key_ref_to_ptr (key_ref); +if (test_bit (KEY_FLAG_NEGATIVE , &key->flags)) { + ret = -ENOKEY ; + goto error2; + } +/* see if we can read it directly */ ret =key_permission (key_ref,KEY_NEED_READ );if (ret ==0 )
PATCH 186/294 assoc_array: Fix a buggy node-splitting case
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
commit ea6789980fdaa610d7eb63602c746bf6ec70cd2b upstream.
This fixes CVE-2017-12193.
Fix a case in the assoc_array implementation in which a new leaf is added that needs to go into a node that happens to be full, where the existing leaves in that node cluster together at that level to the exclusion of new leaf.
What needs to happen is that the existing leaves get moved out to a new node, N1, at level + 1 and the existing node needs replacing with one, N0, that has pointers to the new leaf and to N1.
The code that tries to do this gets this wrong in two ways:
(1) The pointer that should've pointed from N0 to N1 is set to point recursively to N0 instead.
(2) The backpointer from N0 needs to be set correctly in the case N0 is either the root node or reached through a shortcut.
Fix this by removing this path and using the split_node path instead, which achieves the same end, but in a more general way (thanks to Eric Biggers for spotting the redundancy).
The problem manifests itself as:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000010 IP: assoc_array_apply_edit+0x59/0xe5
--- lib/assoc_array.c | 51 +++++++++++++++++---------------------------------- 1 file changed, 17 insertions(+), 34 deletions(-)
lib/assoc_array.c +17 -34
@@ -597,21 +597,31 @@ static bool assoc_array_insert_into_termif ((edit->segment_cache[ASSOC_ARRAY_FAN_OUT ] ^ base_seg) ==0 ) goto all_leaves_cluster_together; -/* Otherwise we can just insert a new node ahead of the old -* one. +/* Otherwise all the old leaves cluster in the same slot, but +* the new leaf wants to go into a different slot - so we +* create a new node (n0) to hold the new leaf and a pointer to +* a new node (n1) holding all the old leaves. +* +* This can be done by falling through to the node splitting +* path. */ - goto present_leaves_cluster_but_not_new_leaf; +pr_devel ("present leaves cluster but not new leaf\n" ); } split_node:pr_devel ("split node\n" ); -/* We need to split the current node; we know that the node doesn't -* simply contain a full set of leaves that cluster together (it -* contains meta pointers and/or non-clustering leaves). +/* We need to split the current node. The node must contain anything +* from a single leaf (in the one leaf case, this leaf will cluster +* with the new leaf) and the rest meta-pointers, to all leaves, some +* of which may cluster. +* +* It won't contain the case in which all the current leaves plus the +* new leaves want to cluster in the same slot. * * We need to expel at least two leaves out of a set consisting of the -* leaves in the node and the new leaf. +* leaves in the node and the new leaf. The current meta pointers can +* just be copied as they shouldn't cluster with any of the leaves. * * We need a new node (n0) to replace the current one and a new node to * take the expelled nodes (n1).
@@ -716,33 +726,6 @@ found_slot_for_multiple_occupancy:pr_devel ("<--%s() = ok [split node]\n" , __func__);return true; -present_leaves_cluster_but_not_new_leaf: -/* All the old leaves cluster in the same slot, but the new leaf wants -* to go into a different slot, so we create a new node to hold the new -* leaf and a pointer to a new node holding all the old leaves. -*/ -pr_devel ("present leaves cluster but not new leaf\n" ); - - new_n0->back_pointer = node->back_pointer; - new_n0->parent_slot = node->parent_slot; - new_n0->nr_leaves_on_branch = node->nr_leaves_on_branch; - new_n1->back_pointer =assoc_array_node_to_ptr (new_n0); - new_n1->parent_slot = edit->segment_cache[0 ]; - new_n1->nr_leaves_on_branch = node->nr_leaves_on_branch; - edit->adjust_count_on = new_n0; - -for (i =0 ; i <ASSOC_ARRAY_FAN_OUT ; i++) - new_n1->slots[i] = node->slots[i]; - - new_n0->slots[edit->segment_cache[0 ]] =assoc_array_node_to_ptr (new_n0); - edit->leaf_p = &new_n0->slots[edit->segment_cache[ASSOC_ARRAY_FAN_OUT ]]; - - edit->set[0 ].ptr = &assoc_array_ptr_to_node (node->back_pointer)->slots[node->parent_slot]; - edit->set[0 ].to =assoc_array_node_to_ptr (new_n0); - edit->excised_meta[0 ] =assoc_array_node_to_ptr (node); -pr_devel ("<--%s() = ok [insert node before]\n" , __func__); -return true; - all_leaves_cluster_together:/* All the leaves, new and old, want to cluster together in this node * in the same slot, so we have to replace this node with a shortcut to
PATCH 187/294 mac80211: accept key reinstall without changing anything
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit fdf7cb4185b60c68e1a75e61691c4afdc15dea0e upstream.
When a key is reinstalled we can reset the replay counters etc. which can lead to nonce reuse and/or replay detection being impossible, breaking security properties, as described in the "KRACK attacks".
In particular, CVE-2017-13080 applies to GTK rekeying that happened in firmware while the host is in D3, with the second part of the attack being done after the host wakes up. In this case, the wpa_supplicant mitigation isn't sufficient since wpa_supplicant doesn't know the GTK material.
In case this happens, simply silently accept the new key coming from userspace but don't take any action on it since it's the same key; this keeps the PN replay counters intact.
--- net/mac80211/key.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-)
net/mac80211/key.c +17 -3
@@ -3,6 +3,7 @@* Copyright 2005-2006, Devicescape Software, Inc. * Copyright 2006-2007 Jiri Benc <[email protected]> * Copyright 2007-2008 Johannes Berg <[email protected]> +* Copyright 2017 Intel Deutschland GmbH * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as
@@ -487,9 +488,6 @@ int ieee80211_key_link(struct ieee80211_ pairwise = key->conf.flags &IEEE80211_KEY_FLAG_PAIRWISE ; idx = key->conf.keyidx; - key->local = sdata->local; - key->sdata = sdata; - key->sta = sta;mutex_lock (&sdata->local->key_mtx);
@@ -500,6 +498,21 @@ int ieee80211_key_link(struct ieee80211_else old_key =key_mtx_dereference (sdata->local, sdata->keys[idx]); +/* +* Silently accept key re-installation without really installing the +* new version of the key to avoid nonce reuse or replay issues. +*/ +if (old_key && key->conf.keylen == old_key->conf.keylen && + !memcmp (key->conf.key, old_key->conf.key, key->conf.keylen)) { +ieee80211_key_free_unused (key); + ret =0 ; + goto out; + } + + key->local = sdata->local; + key->sdata = sdata; + key->sta = sta; +increment_tailroom_need_count (sdata);ieee80211_key_replace (sdata, sta, pairwise, old_key, key);
@@ -515,6 +528,7 @@ int ieee80211_key_link(struct ieee80211_ ret =0 ; } + out:mutex_unlock (&sdata->local->key_mtx);return ret;
PATCH 188/294 ALSA: seq: Fix use-after-free at creating a port
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 71105998845fb012937332fe2e806d443c09e026 upstream.
There is a potential race window opened at creating and deleting a port via ioctl, as spotted by fuzzing. snd_seq_create_port() creates a port object and returns its pointer, but it doesn't take the refcount, thus it can be deleted immediately by another thread. Meanwhile, snd_seq_ioctl_create_port() still calls the function snd_seq_system_client_ev_port_start() with the created port object that is being deleted, and this triggers use-after-free like:
BUG: KASAN: use-after-free in snd_seq_ioctl_create_port+0x504/0x630 [snd_seq] at addr ffff8801f2241cb1 ============================================================================= BUG kmalloc-512 (Tainted: G B ): kasan: bad access detected ----------------------------------------------------------------------------- INFO: Allocated in snd_seq_create_port+0x94/0x9b0 [snd_seq] age=1 cpu=3 pid=4511 ___slab_alloc+0x425/0x460 __slab_alloc+0x20/0x40 kmem_cache_alloc_trace+0x150/0x190 snd_seq_create_port+0x94/0x9b0 [snd_seq] snd_seq_ioctl_create_port+0xd1/0x630 [snd_seq] snd_seq_do_ioctl+0x11c/0x190 [snd_seq] snd_seq_ioctl+0x40/0x80 [snd_seq] do_vfs_ioctl+0x54b/0xda0 SyS_ioctl+0x79/0x90 entry_SYSCALL_64_fastpath+0x16/0x75 INFO: Freed in port_delete+0x136/0x1a0 [snd_seq] age=1 cpu=2 pid=4717 __slab_free+0x204/0x310 kfree+0x15f/0x180 port_delete+0x136/0x1a0 [snd_seq] snd_seq_delete_port+0x235/0x350 [snd_seq] snd_seq_ioctl_delete_port+0xc8/0x180 [snd_seq] snd_seq_do_ioctl+0x11c/0x190 [snd_seq] snd_seq_ioctl+0x40/0x80 [snd_seq] do_vfs_ioctl+0x54b/0xda0 SyS_ioctl+0x79/0x90 entry_SYSCALL_64_fastpath+0x16/0x75 Call Trace: [<ffffffff81b03781>] dump_stack+0x63/0x82 [<ffffffff81531b3b>] print_trailer+0xfb/0x160 [<ffffffff81536db4>] object_err+0x34/0x40 [<ffffffff815392d3>] kasan_report.part.2+0x223/0x520 [<ffffffffa07aadf4>] ? snd_seq_ioctl_create_port+0x504/0x630 [snd_seq] [<ffffffff815395fe>] __asan_report_load1_noabort+0x2e/0x30 [<ffffffffa07aadf4>] snd_seq_ioctl_create_port+0x504/0x630 [snd_seq] [<ffffffffa07aa8f0>] ? snd_seq_ioctl_delete_port+0x180/0x180 [snd_seq] [<ffffffff8136be50>] ? taskstats_exit+0xbc0/0xbc0 [<ffffffffa07abc5c>] snd_seq_do_ioctl+0x11c/0x190 [snd_seq] [<ffffffffa07abd10>] snd_seq_ioctl+0x40/0x80 [snd_seq] [<ffffffff8136d433>] ? acct_account_cputime+0x63/0x80 [<ffffffff815b515b>] do_vfs_ioctl+0x54b/0xda0 .....
We may fix this in a few different ways, and in this patch, it's fixed simply by taking the refcount properly at snd_seq_create_port() and letting the caller unref the object after use. Also, there is another potential use-after-free by sprintf() call in snd_seq_create_port(), and this is moved inside the lock.
This fix covers CVE-2017-15265.
--- sound/core/seq/seq_clientmgr.c | 6 +++++- sound/core/seq/seq_ports.c | 7 +++++-- 2 files changed, 10 insertions(+), 3 deletions(-)
sound/core/seq/seq_clientmgr.c +5 -1
@@ -1260,6 +1260,7 @@ static int snd_seq_ioctl_create_port(strstruct snd_seq_client_port *port;struct snd_seq_port_info info;struct snd_seq_port_callback *callback; +int port_idx;if (copy_from_user (&info, arg,sizeof (info)))return -EFAULT ;
@@ -1273,7 +1274,9 @@ static int snd_seq_ioctl_create_port(strreturn -ENOMEM ;if (client->type ==USER_CLIENT && info.kernel) { -snd_seq_delete_port (client, port->addr.port); + port_idx = port->addr.port; +snd_seq_port_unlock (port); +snd_seq_delete_port (client, port_idx);return -EINVAL ; }if (client->type ==KERNEL_CLIENT ) {
@@ -1295,6 +1298,7 @@ static int snd_seq_ioctl_create_port(strsnd_seq_set_port_info (port, &info);snd_seq_system_client_ev_port_start (port->addr.client, port->addr.port); +snd_seq_port_unlock (port);if (copy_to_user (arg, &info,sizeof (info)))return -EFAULT ;
sound/core/seq/seq_ports.c +5 -2
@@ -122,7 +122,9 @@ static void port_subs_info_init(struct s } -/* create a port, port number is returned (-1 on failure) */ +/* create a port, port number is returned (-1 on failure); +* the caller needs to unref the port via snd_seq_port_unlock() appropriately +*/ struct snd_seq_client_port *snd_seq_create_port (struct snd_seq_client *client,int port) {
@@ -151,6 +153,7 @@ struct snd_seq_client_port *snd_seq_creasnd_use_lock_init (&new_port->use_lock);port_subs_info_init (&new_port->c_src);port_subs_info_init (&new_port->c_dest); +snd_use_lock_use (&new_port->use_lock); num = port >=0 ? port :0 ;mutex_lock (&client->ports_mutex);
@@ -165,9 +168,9 @@ struct snd_seq_client_port *snd_seq_crealist_add_tail (&new_port->list, &p->list); client->num_ports++; new_port->addr.port = num;/* store the port number in the port */ +sprintf (new_port->name,"port-%d" , num);write_unlock_irqrestore (&client->ports_lock, flags);mutex_unlock (&client->ports_mutex); -sprintf (new_port->name,"port-%d" , num);return new_port; }
PATCH 189/294 KEYS: don't let add_key() update an uninstantiated key
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
commit 60ff5b2f547af3828aebafd54daded44cfb0807a upstream.
Currently, when passed a key that already exists, add_key() will call the key's ->update() method if such exists. But this is heavily broken in the case where the key is uninstantiated because it doesn't call __key_instantiate_and_link(). Consequently, it doesn't do most of the things that are supposed to happen when the key is instantiated, such as setting the instantiation state, clearing KEY_FLAG_USER_CONSTRUCT and awakening tasks waiting on it, and incrementing key->user->nikeys.
It also never takes key_construction_mutex, which means that ->instantiate() can run concurrently with ->update() on the same key. In the case of the "user" and "logon" key types this causes a memory leak, at best. Maybe even worse, the ->update() methods of the "encrypted" and "trusted" key types actually just dereference a NULL pointer when passed an uninstantiated key.
Change key_create_or_update() to wait interruptibly for the key to finish construction before continuing.
This patch only affects *uninstantiated* keys. For now we still allow a negatively instantiated key to be updated (thereby positively instantiating it), although that's broken too (the next patch fixes it) and I'm not sure that anyone actually uses that functionality either.
Here is a simple reproducer for the bug using the "encrypted" key type (requires CONFIG_ENCRYPTED_KEYS=y), though as noted above the bug pertained to more than just the "encrypted" key type:
#include <stdlib.h>
#include <unistd.h>
#include <keyutils.h>
int main(void)
{
int ringid = keyctl_join_session_keyring(NULL);
if (fork()) {
for (;;) {
const char payload[] = "update user:foo 32";
usleep(rand() % 10000);
add_key("encrypted", "desc", payload, sizeof(payload), ringid);
keyctl_clear(ringid);
}
} else {
for (;;)
request_key("encrypted", "desc", "callout_info", ringid);
}
}It causes:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
IP: encrypted_update+0xb0/0x170
PGD 7a178067 P4D 7a178067 PUD 77269067 PMD 0
PREEMPT SMP
CPU: 0 PID: 340 Comm: reproduce Tainted: G D 4.14.0-rc1-00025-g428490e38b2e #796
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
task: ffff8a467a39a340 task.stack: ffffb15c40770000
RIP: 0010:encrypted_update+0xb0/0x170
RSP: 0018:ffffb15c40773de8 EFLAGS: 00010246
RAX: 0000000000000000 RBX: ffff8a467a275b00 RCX: 0000000000000000
RDX: 0000000000000005 RSI: ffff8a467a275b14 RDI: ffffffffb742f303
RBP: ffffb15c40773e20 R08: 0000000000000000 R09: ffff8a467a275b17
R10: 0000000000000020 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: ffff8a4677057180 R15: ffff8a467a275b0f
FS: 00007f5d7fb08700(0000) GS:ffff8a467f200000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000018 CR3: 0000000077262005 CR4: 00000000001606f0
Call Trace:
key_create_or_update+0x2bc/0x460
SyS_add_key+0x10c/0x1d0
entry_SYSCALL_64_fastpath+0x1f/0xbe
RIP: 0033:0x7f5d7f211259
RSP: 002b:00007ffed03904c8 EFLAGS: 00000246 ORIG_RAX: 00000000000000f8
RAX: ffffffffffffffda RBX: 000000003b2a7955 RCX: 00007f5d7f211259
RDX: 00000000004009e4 RSI: 00000000004009ff RDI: 0000000000400a04
RBP: 0000000068db8bad R08: 000000003b2a7955 R09: 0000000000000004
R10: 000000000000001a R11: 0000000000000246 R12: 0000000000400868
R13: 00007ffed03905d0 R14: 0000000000000000 R15: 0000000000000000
Code: 77 28 e8 64 34 1f 00 45 31 c0 31 c9 48 8d 55 c8 48 89 df 48 8d 75 d0 e8 ff f9 ff ff 85 c0 41 89 c4 0f 88 84 00 00 00 4c 8b 7d c8 <49> 8b 75 18 4c 89 ff e8 24 f8 ff ff 85 c0 41 89 c4 78 6d 49 8b
RIP: encrypted_update+0xb0/0x170 RSP: ffffb15c40773de8
CR2: 0000000000000018--- security/keys/key.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
security/keys/key.c +10 -0
@@ -901,6 +901,16 @@ error:*/ __key_link_end (keyring, &index_key, edit); + key =key_ref_to_ptr (key_ref); +if (test_bit (KEY_FLAG_USER_CONSTRUCT , &key->flags)) { + ret =wait_for_key_construction (key, true); +if (ret <0 ) { +key_ref_put (key_ref); + key_ref =ERR_PTR (ret); + goto error_free_prep; + } + } + key_ref =__key_update (key_ref, &prep); goto error_free_prep; }
PATCH 190/294 packet: hold bind lock when rebinding to fanout hook
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Willem de Bruijn <[email protected]>
commit 008ba2a13f2d04c947adc536d19debb8fe66f110 upstream.
Packet socket bind operations must hold the po->bind_lock. This keeps po->running consistent with whether the socket is actually on a ptype list to receive packets.
fanout_add unbinds a socket and its packet_rcv/tpacket_rcv call, then binds the fanout object to receive through packet_rcv_fanout.
Make it hold the po->bind_lock when testing po->running and rebinding. Else, it can race with other rebind operations, such as that in packet_set_ring from packet_rcv to tpacket_rcv. Concurrent updates can result in a socket being added to a fanout group twice, causing use-after-free KASAN bug reports, among others.
Reported independently by both trinity and syzkaller. Verified that the syzkaller reproducer passes after this patch.
--- net/packet/af_packet.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
net/packet/af_packet.c +11 -5
@@ -1459,10 +1459,6 @@ static int fanout_add(struct sock *sk, umutex_lock (&fanout_mutex); - err = -EINVAL ; -if (!po->running) - goto out; - err = -EALREADY ;if (po->fanout) goto out;
@@ -1499,7 +1495,10 @@ static int fanout_add(struct sock *sk, ulist_add (&match->list, &fanout_list); } err = -EINVAL ; -if (match->type == type && + +spin_lock (&po->bind_lock); +if (po->running && + match->type == type && match->prot_hook.type == po->prot_hook.type && match->prot_hook.dev == po->prot_hook.dev) { err = -ENOSPC ;
@@ -1511,6 +1510,13 @@ static int fanout_add(struct sock *sk, u err =0 ; } } +spin_unlock (&po->bind_lock); + +if (err && !atomic_read (&match->sk_ref)) { +list_del (&match->list); +kfree (match); + } + out:mutex_unlock (&fanout_mutex);return err;
PATCH 191/294 packet: in packet_do_bind, test fanout with bind_lock held
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Willem de Bruijn <[email protected]>
commit 4971613c1639d8e5f102c4e797c3bf8f83a5a69e upstream.
Once a socket has po->fanout set, it remains a member of the group until it is destroyed. The prot_hook must be constant and identical across sockets in the group.
If fanout_add races with packet_do_bind between the test of po->fanout and taking the lock, the bind call may make type or dev inconsistent with that of the fanout group.
Hold po->bind_lock when testing po->fanout to avoid this race.
I had to introduce artificial delay (local_bh_enable) to actually observe the race.
--- net/packet/af_packet.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
net/packet/af_packet.c +5 -3
@@ -2696,13 +2696,15 @@ static int packet_do_bind(struct sock *sint ret =0 ;bool unlisted = false; -if (po->fanout) -return -EINVAL ; -lock_sock (sk);spin_lock (&po->bind_lock);rcu_read_lock (); +if (po->fanout) { + ret = -EINVAL ; + goto out_unlock; + } +if (name) { dev =dev_get_by_name_rcu (sock_net (sk), name);if (!dev) {
PATCH 192/294 ALSA: usb-audio: Kill stray URB at exiting
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 124751d5e63c823092060074bd0abaae61aaa9c4 upstream.
USB-audio driver may leave a stray URB for the mixer interrupt when it exits by some error during probe. This leads to a use-after-free error as spotted by syzkaller like:
==================================================================
BUG: KASAN: use-after-free in snd_usb_mixer_interrupt+0x604/0x6f0 Call Trace: <IRQ> __dump_stack lib/dump_stack.c:16 dump_stack+0x292/0x395 lib/dump_stack.c:52 print_address_description+0x78/0x280 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 kasan_report+0x23d/0x350 mm/kasan/report.c:409 __asan_report_load8_noabort+0x19/0x20 mm/kasan/report.c:430 snd_usb_mixer_interrupt+0x604/0x6f0 sound/usb/mixer.c:2490 __usb_hcd_giveback_urb+0x2e0/0x650 drivers/usb/core/hcd.c:1779 .... Allocated by task 1484: save_stack_trace+0x1b/0x20 arch/x86/kernel/stacktrace.c:59 save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:551 kmem_cache_alloc_trace+0x11e/0x2d0 mm/slub.c:2772 kmalloc ./include/linux/slab.h:493 kzalloc ./include/linux/slab.h:666 snd_usb_create_mixer+0x145/0x1010 sound/usb/mixer.c:2540 create_standard_mixer_quirk+0x58/0x80 sound/usb/quirks.c:516 snd_usb_create_quirk+0x92/0x100 sound/usb/quirks.c:560 create_composite_quirk+0x1c4/0x3e0 sound/usb/quirks.c:59 snd_usb_create_quirk+0x92/0x100 sound/usb/quirks.c:560 usb_audio_probe+0x1040/0x2c10 sound/usb/card.c:618 .... Freed by task 1484: save_stack_trace+0x1b/0x20 arch/x86/kernel/stacktrace.c:59 save_stack+0x43/0xd0 mm/kasan/kasan.c:447 set_track mm/kasan/kasan.c:459 kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:524 slab_free_hook mm/slub.c:1390 slab_free_freelist_hook mm/slub.c:1412 slab_free mm/slub.c:2988 kfree+0xf6/0x2f0 mm/slub.c:3919 snd_usb_mixer_free+0x11a/0x160 sound/usb/mixer.c:2244 snd_usb_mixer_dev_free+0x36/0x50 sound/usb/mixer.c:2250 __snd_device_free+0x1ff/0x380 sound/core/device.c:91 snd_device_free_all+0x8f/0xe0 sound/core/device.c:244 snd_card_do_free sound/core/init.c:461 release_card_device+0x47/0x170 sound/core/init.c:181 device_release+0x13f/0x210 drivers/base/core.c:814 ....
Actually such a URB is killed properly at disconnection when the device gets probed successfully, and what we need is to apply it for the error-path, too.
In this patch, we apply snd_usb_mixer_disconnect() at releasing. Also introduce a new flag, disconnected, to struct usb_mixer_interface for not performing the disconnection procedure twice.
[bwh: Backported to 3.16: snd_usb_mixer_disconnect() takes a pointer to
usb_mixer_interface::list, not to usb_mixer_interface itself]
--- sound/usb/mixer.c | 12 ++++++++++-- sound/usb/mixer.h | 2 ++ 2 files changed, 12 insertions(+), 2 deletions(-)
sound/usb/mixer.c +10 -2
@@ -2158,6 +2158,9 @@ static int parse_audio_unit(struct mixerstatic void snd_usb_mixer_free (struct usb_mixer_interface *mixer) { +/* kill pending URBs */ +snd_usb_mixer_disconnect (&mixer->list); +kfree (mixer->id_elems);if (mixer->urb) {kfree (mixer->urb->transfer_buffer);
@@ -2494,8 +2497,13 @@ void snd_usb_mixer_disconnect(struct lisstruct usb_mixer_interface *mixer; mixer = list_entry(p, struct usb_mixer_interface, list); -usb_kill_urb (mixer->urb); -usb_kill_urb (mixer->rc_urb); +if (mixer->disconnected) +return ; +if (mixer->urb) +usb_kill_urb (mixer->urb); +if (mixer->rc_urb) +usb_kill_urb (mixer->rc_urb); + mixer->disconnected = true; }#ifdef CONFIG_PM
sound/usb/mixer.h +2 -0
@@ -23,6 +23,8 @@ struct usb_mixer_interface {u8 audigy2nx_leds[3 ];u8 xonar_u1_status; + +bool disconnected; };#define MAX_CHANNELS 16/* max logical channels */
PATCH 193/294 ALSA: usb-audio: Check out-of-bounds access by corrupted buffer descriptor
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit bfc81a8bc18e3c4ba0cbaa7666ff76be2f998991 upstream.
When a USB-audio device receives a maliciously adjusted or corrupted buffer descriptor, the USB-audio driver may access an out-of-bounce value at its parser. This was detected by syzkaller, something like:
BUG: KASAN: slab-out-of-bounds in usb_audio_probe+0x27b2/0x2ab0 Read of size 1 at addr ffff88006b83a9e8 by task kworker/0:1/24 CPU: 0 PID: 24 Comm: kworker/0:1 Not tainted 4.14.0-rc1-42251-gebb2c2437d80 #224 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Workqueue: usb_hub_wq hub_event Call Trace: __dump_stack lib/dump_stack.c:16 dump_stack+0x292/0x395 lib/dump_stack.c:52 print_address_description+0x78/0x280 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 kasan_report+0x22f/0x340 mm/kasan/report.c:409 __asan_report_load1_noabort+0x19/0x20 mm/kasan/report.c:427 snd_usb_create_streams sound/usb/card.c:248 usb_audio_probe+0x27b2/0x2ab0 sound/usb/card.c:605 usb_probe_interface+0x35d/0x8e0 drivers/usb/core/driver.c:361 really_probe drivers/base/dd.c:413 driver_probe_device+0x610/0xa00 drivers/base/dd.c:557 __device_attach_driver+0x230/0x290 drivers/base/dd.c:653 bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463 __device_attach+0x26e/0x3d0 drivers/base/dd.c:710 device_initial_probe+0x1f/0x30 drivers/base/dd.c:757 bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523 device_add+0xd0b/0x1660 drivers/base/core.c:1835 usb_set_configuration+0x104e/0x1870 drivers/usb/core/message.c:1932 generic_probe+0x73/0xe0 drivers/usb/core/generic.c:174 usb_probe_device+0xaf/0xe0 drivers/usb/core/driver.c:266 really_probe drivers/base/dd.c:413 driver_probe_device+0x610/0xa00 drivers/base/dd.c:557 __device_attach_driver+0x230/0x290 drivers/base/dd.c:653 bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463 __device_attach+0x26e/0x3d0 drivers/base/dd.c:710 device_initial_probe+0x1f/0x30 drivers/base/dd.c:757 bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523 device_add+0xd0b/0x1660 drivers/base/core.c:1835 usb_new_device+0x7b8/0x1020 drivers/usb/core/hub.c:2457 hub_port_connect drivers/usb/core/hub.c:4903 hub_port_connect_change drivers/usb/core/hub.c:5009 port_event drivers/usb/core/hub.c:5115 hub_event+0x194d/0x3740 drivers/usb/core/hub.c:5195 process_one_work+0xc7f/0x1db0 kernel/workqueue.c:2119 worker_thread+0x221/0x1850 kernel/workqueue.c:2253 kthread+0x3a1/0x470 kernel/kthread.c:231 ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431
This patch adds the checks of out-of-bounce accesses at appropriate places and bails out when it goes out of the given buffer.
--- sound/usb/card.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+)
sound/usb/card.c +20 -0
@@ -219,6 +219,7 @@ static int snd_usb_create_streams(structstruct usb_interface_descriptor *altsd;void *control_header;int i, protocol; +int rest_bytes;/* find audiocontrol interface */ host_iface = &usb_ifnum_to_if (dev, ctrlif)->altsetting[0 ];
@@ -233,6 +234,15 @@ static int snd_usb_create_streams(structreturn -EINVAL ; } + rest_bytes = (void *)(host_iface->extra + host_iface->extralen) - + control_header; + +/* just to be sure -- this shouldn't hit at all */ +if (rest_bytes <=0 ) { +dev_err (&dev->dev,"invalid control header\n" ); +return -EINVAL ; + } +switch (protocol) {default : dev_warn(&dev->dev,
@@ -243,11 +253,21 @@ static int snd_usb_create_streams(structcase UAC_VERSION_1 : {struct uac1_ac_header_descriptor *h1 = control_header; +if (rest_bytes <sizeof (*h1)) { +dev_err (&dev->dev,"too short v1 buffer descriptor\n" ); +return -EINVAL ; + } +if (!h1->bInCollection) {dev_info (&dev->dev,"skipping empty audio interface (v1)\n" );return -EINVAL ; } +if (rest_bytes < h1->bLength) { +dev_err (&dev->dev,"invalid buffer length (v1)\n" ); +return -EINVAL ; + } +if (h1->bLength <sizeof (*h1) + h1->bInCollection) {dev_err (&dev->dev,"invalid UAC_HEADER (v1)\n" );return -EINVAL ;
PATCH 194/294 USB: uas: fix bug in handling of alternate settings
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 786de92b3cb26012d3d0f00ee37adf14527f35c4 upstream.
The uas driver has a subtle bug in the way it handles alternate settings. The uas_find_uas_alt_setting() routine returns an altsetting value (the bAlternateSetting number in the descriptor), but uas_use_uas_driver() then treats that value as an index to the intf->altsetting array, which it isn't.
Normally this doesn't cause any problems because the various alternate settings have bAlternateSetting values 0, 1, 2, ..., so the value is equal to the index in the array. But this is not guaranteed, and Andrey Konovalov used the syzkaller fuzzer with KASAN to get a slab-out-of-bounds error by violating this assumption.
This patch fixes the bug by making uas_find_uas_alt_setting() return a pointer to the altsetting entry rather than either the value or the index. Pointers are less subject to misinterpretation.
--- drivers/usb/storage/uas-detect.h | 15 ++++++++------- drivers/usb/storage/uas.c | 10 +++++----- 2 files changed, 13 insertions(+), 12 deletions(-)
drivers/usb/storage/uas-detect.h +8 -7
@@ -9,7 +9,8 @@ static int uas_is_interface(struct usb_h intf->desc.bInterfaceProtocol == USB_PR_UAS); } -static int uas_find_uas_alt_setting (struct usb_interface *intf) +static struct usb_host_interface *uas_find_uas_alt_setting ( +struct usb_interface *intf) {int i;
@@ -17,10 +18,10 @@ static int uas_find_uas_alt_setting(strustruct usb_host_interface *alt = &intf->altsetting[i];if (uas_is_interface (alt)) -return alt->desc.bAlternateSetting; +return alt; } -return -ENODEV ; +return NULL ; } static int uas_find_endpoints(struct usb_host_interface *alt,
@@ -58,14 +59,14 @@ static int uas_use_uas_driver(struct usbstruct usb_device *udev =interface_to_usbdev (intf);struct usb_hcd *hcd =bus_to_hcd (udev->bus);unsigned long flags = id->driver_info; -int r, alt; - +struct usb_host_interface *alt; +int r; alt =uas_find_uas_alt_setting (intf); -if (alt <0 ) +if (!alt)return 0 ; - r =uas_find_endpoints (&intf->altsetting[alt], eps); + r =uas_find_endpoints (alt, eps);if (r <0 )return 0 ;
drivers/usb/storage/uas.c +5 -5
@@ -1034,14 +1034,14 @@ MODULE_DEVICE_TABLE(usb, uas_usb_ids);static int uas_switch_interface (struct usb_device *udev,struct usb_interface *intf) { -int alt; +struct usb_host_interface *alt; alt =uas_find_uas_alt_setting (intf); -if (alt <0 ) -return alt; +if (!alt) +return -ENODEV ; -return usb_set_interface (udev, - intf->altsetting[0 ].desc.bInterfaceNumber, alt); +return usb_set_interface (udev, alt->desc.bInterfaceNumber, + alt->desc.bAlternateSetting); }static int uas_configure_endpoints (struct uas_dev_info *devinfo)
PATCH 195/294 USB: fix out-of-bounds in usb_set_configuration
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Greg Kroah-Hartman <[email protected]>
commit bd7a3fe770ebd8391d1c7d072ff88e9e76d063eb upstream.
Andrey Konovalov reported a possible out-of-bounds problem for a USB interface association descriptor. He writes:
It seems there's no proper size check of a USB_DT_INTERFACE_ASSOCIATION descriptor. It's only checked that the size is >= 2 in usb_parse_configuration(), so find_iad() might do out-of-bounds access to intf_assoc->bInterfaceCount.
And he's right, we don't check for crazy descriptors of this type very well, so resolve this problem. Yet another issue found by syzkaller...
--- drivers/usb/core/config.c | 14 +++++++++++--- include/uapi/linux/usb/ch9.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/usb/core/config.c +11 -3
@@ -607,15 +607,23 @@ static int usb_parse_configuration(struc }else if (header->bDescriptorType ==USB_DT_INTERFACE_ASSOCIATION ) { +struct usb_interface_assoc_descriptor *d; + + d = (struct usb_interface_assoc_descriptor *)header; +if (d->bLength <USB_DT_INTERFACE_ASSOCIATION_SIZE ) { +dev_warn (ddev, +"config %d has an invalid interface association descriptor of length %d, skipping\n" , + cfgno, d->bLength); +continue ; + } +if (iad_num ==USB_MAXIADS ) {dev_warn (ddev,"found more Interface " "Association Descriptors " "than allocated for in " "configuration %d\n" , cfgno); }else { - config->intf_assoc[iad_num] = - (struct usb_interface_assoc_descriptor - *)header; + config->intf_assoc[iad_num] = d; iad_num++; }
include/uapi/linux/usb/ch9.h +1 -0
@@ -724,6 +724,7 @@ struct usb_interface_assoc_descriptor {__u8 iFunction; } __attribute__ ((packed)); +#define USB_DT_INTERFACE_ASSOCIATION_SIZE 8/*-------------------------------------------------------------------------*/
PATCH 196/294 usb: usbtest: fix NULL pointer dereference
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 7c80f9e4a588f1925b07134bb2e3689335f6c6d8 upstream.
If the usbtest driver encounters a device with an IN bulk endpoint but no OUT bulk endpoint, it will try to dereference a NULL pointer (out->desc.bEndpointAddress). The problem can be solved by adding a missing test.
--- drivers/usb/misc/usbtest.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/misc/usbtest.c +3 -2
@@ -164,12 +164,13 @@ found:return tmp; } -if (in) { +if (in) dev->in_pipe =usb_rcvbulkpipe (udev, in->desc.bEndpointAddress &USB_ENDPOINT_NUMBER_MASK ); +if (out) dev->out_pipe =usb_sndbulkpipe (udev, out->desc.bEndpointAddress &USB_ENDPOINT_NUMBER_MASK ); - } +if (iso_in) { dev->iso_in = &iso_in->desc; dev->in_iso_pipe = usb_rcvisocpipe(udev,
PATCH 197/294 HID: usbhid: fix out-of-bounds bug
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jaejoong Kim <[email protected]>
commit f043bfc98c193c284e2cd768fefabe18ac2fed9b upstream.
The hid descriptor identifies the length and type of subordinate descriptors for a device. If the received hid descriptor is smaller than the size of the struct hid_descriptor, it is possible to cause out-of-bounds.
In addition, if bNumDescriptors of the hid descriptor have an incorrect value, this can also cause out-of-bounds while approaching hdesc->desc[n].
So check the size of hid descriptor and bNumDescriptors.
BUG: KASAN: slab-out-of-bounds in usbhid_parse+0x9b1/0xa20 Read of size 1 at addr ffff88006c5f8edf by task kworker/1:2/1261 CPU: 1 PID: 1261 Comm: kworker/1:2 Not tainted 4.14.0-rc1-42251-gebb2c2437d80 #169 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011 Workqueue: usb_hub_wq hub_event Call Trace: __dump_stack lib/dump_stack.c:16 dump_stack+0x292/0x395 lib/dump_stack.c:52 print_address_description+0x78/0x280 mm/kasan/report.c:252 kasan_report_error mm/kasan/report.c:351 kasan_report+0x22f/0x340 mm/kasan/report.c:409 __asan_report_load1_noabort+0x19/0x20 mm/kasan/report.c:427 usbhid_parse+0x9b1/0xa20 drivers/hid/usbhid/hid-core.c:1004 hid_add_device+0x16b/0xb30 drivers/hid/hid-core.c:2944 usbhid_probe+0xc28/0x1100 drivers/hid/usbhid/hid-core.c:1369 usb_probe_interface+0x35d/0x8e0 drivers/usb/core/driver.c:361 really_probe drivers/base/dd.c:413 driver_probe_device+0x610/0xa00 drivers/base/dd.c:557 __device_attach_driver+0x230/0x290 drivers/base/dd.c:653 bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463 __device_attach+0x26e/0x3d0 drivers/base/dd.c:710 device_initial_probe+0x1f/0x30 drivers/base/dd.c:757 bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523 device_add+0xd0b/0x1660 drivers/base/core.c:1835 usb_set_configuration+0x104e/0x1870 drivers/usb/core/message.c:1932 generic_probe+0x73/0xe0 drivers/usb/core/generic.c:174 usb_probe_device+0xaf/0xe0 drivers/usb/core/driver.c:266 really_probe drivers/base/dd.c:413 driver_probe_device+0x610/0xa00 drivers/base/dd.c:557 __device_attach_driver+0x230/0x290 drivers/base/dd.c:653 bus_for_each_drv+0x161/0x210 drivers/base/bus.c:463 __device_attach+0x26e/0x3d0 drivers/base/dd.c:710 device_initial_probe+0x1f/0x30 drivers/base/dd.c:757 bus_probe_device+0x1eb/0x290 drivers/base/bus.c:523 device_add+0xd0b/0x1660 drivers/base/core.c:1835 usb_new_device+0x7b8/0x1020 drivers/usb/core/hub.c:2457 hub_port_connect drivers/usb/core/hub.c:4903 hub_port_connect_change drivers/usb/core/hub.c:5009 port_event drivers/usb/core/hub.c:5115 hub_event+0x194d/0x3740 drivers/usb/core/hub.c:5195 process_one_work+0xc7f/0x1db0 kernel/workqueue.c:2119 worker_thread+0x221/0x1850 kernel/workqueue.c:2253 kthread+0x3a1/0x470 kernel/kthread.c:231 ret_from_fork+0x2a/0x40 arch/x86/entry/entry_64.S:431
--- drivers/hid/usbhid/hid-core.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/hid/usbhid/hid-core.c +11 -1
@@ -975,6 +975,8 @@ static int usbhid_parse(struct hid_devicunsigned int rsize =0 ;char *rdesc;int ret, n; +int num_descriptors; +size_t offset = offsetof(struct hid_descriptor , desc); quirks =usbhid_lookup_quirk (le16_to_cpu (dev->descriptor.idVendor),le16_to_cpu (dev->descriptor.idProduct));
@@ -997,10 +999,18 @@ static int usbhid_parse(struct hid_devicreturn -ENODEV ; } +if (hdesc->bLength <sizeof (struct hid_descriptor )) { +dbg_hid ("hid descriptor is too short\n" ); +return -EINVAL ; + } + hid->version =le16_to_cpu (hdesc->bcdHID); hid->country = hdesc->bCountryCode; -for (n =0 ; n < hdesc->bNumDescriptors; n++) + num_descriptors =min_t (int, hdesc->bNumDescriptors, + (hdesc->bLength - offset) /sizeof (struct hid_class_descriptor )); + +for (n =0 ; n < num_descriptors; n++)if (hdesc->desc[n].bDescriptorType ==HID_DT_REPORT ) rsize =le16_to_cpu (hdesc->desc[n].wDescriptorLength);
PATCH 198/294 USB: core: fix out-of-bounds access bug in usb_get_bos_descriptor()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit 1c0edc3633b56000e18d82fc241e3995ca18a69e upstream.
Andrey used the syzkaller fuzzer to find an out-of-bounds memory access in usb_get_bos_descriptor(). The code wasn't checking that the next usb_dev_cap_header structure could fit into the remaining buffer space.
This patch fixes the error and also reduces the bNumDeviceCaps field in the header to match the actual number of capabilities found, in cases where there are fewer than expected.
--- drivers/usb/core/config.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/usb/core/config.c +4 -2
@@ -924,10 +924,12 @@ int usb_get_bos_descriptor(struct usb_defor (i =0 ; i < num; i++) { buffer += length; cap = (struct usb_dev_cap_header *)buffer; - length = cap->bLength; -if (total_len < length) +if (total_len <sizeof (*cap) || total_len < cap->bLength) { + dev->bos->desc->bNumDeviceCaps = i;break ; + } + length = cap->bLength; total_len -= length;if (cap->bDescriptorType !=USB_DT_DEVICE_CAPABILITY ) {
PATCH 199/294 ALSA: seq: Enable 'use' locking in all configurations
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit 8009d506a1dd00cf436b0c4cca0dcec130580a21 upstream.
The 'use' locking macros are no-ops if neither SMP or SND_DEBUG is enabled. This might once have been OK in non-preemptible configurations, but even in that case snd_seq_read() may sleep while relying on a 'use' lock. So always use the proper implementations.
--- sound/core/seq/seq_lock.c | 4 ---- sound/core/seq/seq_lock.h | 12 ------------ 2 files changed, 16 deletions(-)
sound/core/seq/seq_lock.c +0 -4
@@ -23,8 +23,6 @@#include <sound/core.h> #include "seq_lock.h" -#if defined(CONFIG_SMP ) || defined(CONFIG_SND_DEBUG ) -/* wait until all locks are released */ void snd_use_lock_sync_helper (snd_use_lock_t *lockp,const char *file,int line) {
@@ -42,5 +40,3 @@ void snd_use_lock_sync_helper(snd_use_lo }EXPORT_SYMBOL (snd_use_lock_sync_helper); - -#endif
sound/core/seq/seq_lock.h +0 -12
@@ -3,8 +3,6 @@#include <linux/sched.h> -#if defined(CONFIG_SMP ) || defined(CONFIG_SND_DEBUG ) -typedef atomic_t snd_use_lock_t ;/* initialize lock */
@@ -20,14 +18,4 @@ typedef atomic_t snd_use_lock_t;void snd_use_lock_sync_helper (snd_use_lock_t *lock,const char *file,int line);#define snd_use_lock_sync (lockp) snd_use_lock_sync_helper(lockp, __BASE_FILE__, __LINE__) -#else /* SMP || CONFIG_SND_DEBUG */ - -typedef spinlock_t snd_use_lock_t ;/* dummy */ -#define snd_use_lock_init (lockp)/**/ -#define snd_use_lock_use (lockp)/**/ -#define snd_use_lock_free (lockp)/**/ -#define snd_use_lock_sync (lockp)/**/ - -#endif /* SMP || CONFIG_SND_DEBUG */ -#endif /* __SND_SEQ_LOCK_H */
PATCH 200/294 nilfs2: fix gcc uninitialized-variable warnings in powerpc build
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ryusuke Konishi <[email protected]>
commit 4f05028f8d1af782cfd03d09e0a052e9745dc5ad upstream.
Some false positive warnings are reported for powerpc build.
The following warnings are reported in
http://kisskb.ellerman.id.au/kisskb/buildresult/12519703/
CC fs/nilfs2/super.o
fs/nilfs2/super.c: In function 'nilfs_resize_fs':
fs/nilfs2/super.c:376:2: warning: 'blocknr' may be used uninitialized in this function [-Wuninitialized] fs/nilfs2/super.c:362:11: note: 'blocknr' was declared here
CC fs/nilfs2/recovery.o
fs/nilfs2/recovery.c: In function 'nilfs_salvage_orphan_logs':
fs/nilfs2/recovery.c:631:21: warning: 'sum' may be used uninitialized in this function [-Wuninitialized] fs/nilfs2/recovery.c:585:32: note: 'sum' was declared here
fs/nilfs2/recovery.c: In function 'nilfs_search_super_root':
fs/nilfs2/recovery.c:873:11: warning: 'sum' may be used uninitialized in this function [-Wuninitialized]
Another similar warning is reported in
http://kisskb.ellerman.id.au/kisskb/buildresult/12520079/
CC fs/nilfs2/btree.o
fs/nilfs2/btree.c: In function 'nilfs_btree_convert_and_insert':
include/asm-generic/bitops/non-atomic.h:105:20: warning: 'bh' may be used uninitialized in this function [-Wuninitialized] fs/nilfs2/btree.c:1859:22: note: 'bh' was declared here
This cleans out these warnings by forcing the variables to be initialized.
--- fs/nilfs2/btree.c | 2 +- fs/nilfs2/recovery.c | 4 ++-- fs/nilfs2/super.c | 5 ++++- 3 files changed, 7 insertions(+), 4 deletions(-)
fs/nilfs2/btree.c +1 -1
@@ -1797,7 +1797,7 @@ int nilfs_btree_convert_and_insert(struc __u64 key, __u64 ptr, const __u64 *keys, const __u64 *ptrs, int n) { - struct buffer_head *bh; + struct buffer_head *bh = NULL;union nilfs_bmap_ptr_req dreq, nreq, *di, *ni;struct nilfs_bmap_stats stats;int ret;
fs/nilfs2/recovery.c +2 -2
@@ -582,7 +582,7 @@ static int nilfs_do_roll_forward(struct struct nilfs_recovery_info *ri) {struct buffer_head *bh_sum =NULL ; -struct nilfs_segment_summary *sum; +struct nilfs_segment_summary *sum =NULL ;sector_t pseg_start;sector_t seg_start, seg_end;/* Starting/ending DBN of full segment */ unsigned long nsalvaged_blocks =0 ;
@@ -814,7 +814,7 @@ int nilfs_search_super_root(struct the_n struct nilfs_recovery_info *ri) {struct buffer_head *bh_sum =NULL ; -struct nilfs_segment_summary *sum; +struct nilfs_segment_summary *sum =NULL ;sector_t pseg_start, pseg_end, sr_pseg_start =0 ;sector_t seg_start, seg_end;/* range of full segment (block number) */ sector_t b, end;
fs/nilfs2/super.c +4 -1
@@ -358,7 +358,7 @@ static int nilfs_move_2nd_super(struct sstruct nilfs_super_block *nsbp;sector_t blocknr, newblocknr;unsigned long offset; -int sb2i =-1 ;/* array index of the secondary superblock */ +int sb2i;/* array index of the secondary superblock */ int ret =0 ;/* nilfs->ns_sem must be locked by the caller. */
@@ -369,6 +369,9 @@ static int nilfs_move_2nd_super(struct s }else if (nilfs->ns_sbh[0 ]->b_blocknr > nilfs->ns_first_data_block) { sb2i =0 ; blocknr = nilfs->ns_sbh[0 ]->b_blocknr; + }else { + sb2i =-1 ; + blocknr =0 ; }if (sb2i >=0 && (u64 )blocknr << nilfs->ns_blocksize_bits == sb2off) goto out;/* super block location is unchanged */
PATCH 201/294 platform/x86: samsung-laptop: Initialize loca variable
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andy Shevchenko <[email protected]>
commit 0d2c95354a3b63256e92d9fb865c08902d2c9b0b upstream.
The variable is used uninitialized which might come into unexpected behaviour on some Samsung laptops.
Initialize it to 0xffff which seems a proper value for non-supported feature.
--- drivers/platform/x86/samsung-laptop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/platform/x86/samsung-laptop.c +1 -1
@@ -1347,9 +1347,9 @@ static int __init samsung_sabi_init(struconst struct sabi_config *config =NULL ;const struct sabi_commands *commands;unsigned int ifaceP; +int loca =0xffff ;int ret =0 ;int i; -int loca; samsung->f0000_segment =ioremap_nocache (0xf0000 ,0xffff );if (!samsung->f0000_segment) {
PATCH 202/294 mm/init: fix zone boundary creation
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Oliver O'Halloran <[email protected]>
commit 90cae1fe1c3540f791d5b8e025985fa5e699b2bb upstream.
As a part of memory initialisation the architecture passes an array to free_area_init_nodes() which specifies the max PFN of each memory zone. This array is not necessarily monotonic (due to unused zones) so this array is parsed to build monotonic lists of the min and max PFN for each zone. ZONE_MOVABLE is special cased here as its limits are managed by the mm subsystem rather than the architecture. Unfortunately, this special casing is broken when ZONE_MOVABLE is the not the last zone in the zone list. The core of the issue is:
if (i == ZONE_MOVABLE) continue; arch_zone_lowest_possible_pfn[i] = arch_zone_highest_possible_pfn[i-1];
As ZONE_MOVABLE is skipped the lowest_possible_pfn of the next zone will be set to zero. This patch fixes this bug by adding explicitly tracking where the next zone should start rather than relying on the contents arch_zone_highest_possible_pfn[].
Thie is low priority. To get bitten by this you need to enable a zone that appears after ZONE_MOVABLE in the zone_type enum. As far as I can tell this means running a kernel with ZONE_DEVICE or ZONE_CMA enabled, so I can't see this affecting too many people.
I only noticed this because I've been fiddling with ZONE_DEVICE on powerpc and 4.6 broke my test kernel. This bug, in conjunction with the changes in Taku Izumi's kernelcore=mirror patch (d91749c1dda71) and powerpc being the odd architecture which initialises max_zone_pfn[] to ~0ul instead of 0 caused all of system memory to be placed into ZONE_DEVICE at boot, followed a panic since device memory cannot be used for kernel allocations. I've already submitted a patch to fix the powerpc specific bits, but I figured this should be fixed too.
--- mm/page_alloc.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-)
mm/page_alloc.c +10 -7
@@ -5335,15 +5335,18 @@ void __init free_area_init_nodes(unsigne sizeof(arch_zone_lowest_possible_pfn));memset (arch_zone_highest_possible_pfn,0 ,sizeof (arch_zone_highest_possible_pfn)); - arch_zone_lowest_possible_pfn[0 ] =find_min_pfn_with_active_regions (); - arch_zone_highest_possible_pfn[0 ] = max_zone_pfn[0 ]; -for (i =1 ; i <MAX_NR_ZONES ; i++) { + + start_pfn =find_min_pfn_with_active_regions (); + +for (i =0 ; i <MAX_NR_ZONES ; i++) {if (i ==ZONE_MOVABLE )continue ; - arch_zone_lowest_possible_pfn[i] = - arch_zone_highest_possible_pfn[i-1 ]; - arch_zone_highest_possible_pfn[i] = -max (max_zone_pfn[i], arch_zone_lowest_possible_pfn[i]); + + end_pfn =max (max_zone_pfn[i], start_pfn); + arch_zone_lowest_possible_pfn[i] = start_pfn; + arch_zone_highest_possible_pfn[i] = end_pfn; + + start_pfn = end_pfn; } arch_zone_lowest_possible_pfn[ZONE_MOVABLE ] =0 ; arch_zone_highest_possible_pfn[ZONE_MOVABLE ] =0 ;
PATCH 203/294 Disable "frame-address" warning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
From: Linus Torvalds <[email protected]>
commit 124a3d88fa20e1869fc229d7d8c740cc81944264 upstream.
Newer versions of gcc warn about the use of __builtin_return_address() with a non-zero argument when "-Wall" is specified:
kernel/trace/trace_irqsoff.c: In function ‘stop_critical_timings’:
kernel/trace/trace_irqsoff.c:433:86: warning: calling ‘__builtin_return_address’ with a nonzero argument is unsafe [-Wframe-address]
stop_critical_timing(CALLER_ADDR0, CALLER_ADDR1);
[ .. repeats a few times for other similar cases .. ]
It is true that a non-zero argument is somewhat dangerous, and we do not actually have very many uses of that in the kernel - but the ftrace code does use it, and as Stephen Rostedt says:
"We are well aware of the danger of using __builtin_return_address() of
Quoted 1 line
0. In fact that's part of the reason for having the "thunk" code in
x86 (See arch/x86/entry/thunk_{64,32}.S). [..] it adds extra frames when tracking irqs off sections, to prevent __builtin_return_address() from accessing bad areas. In fact the thunk_32.S states: 'Trampoline to trace irqs off. (otherwise CALLER_ADDR1 might crash)'."
For now, __builtin_return_address() with a non-zero argument is the best we can do, and the warning is not helpful and can end up making people miss other warnings for real problems.
So disable the frame-address warning on compilers that need it.
--- Makefile | 1 + 1 file changed, 1 insertion(+)
Makefile +1 -0
@@ -616,6 +616,7 @@ all: vmlinux include $(srctree)/arch/$(SRCARCH)/Makefile KBUILD_CFLAGS += $(call cc-option,-fno-delete-null-pointer-checks,) +KBUILD_CFLAGS += $(call cc-disable-warning,frame-address,) ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE KBUILD_CFLAGS += -Os $(call cc-disable-warning,maybe-uninitialized,)
PATCH 204/294 modpost: expand pattern matching to support substring matches
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paul Gortmaker <[email protected]>
commit 09c20c032b0f753969ae778d9783d946f054d7fe upstream.
Currently the match() function supports a leading * to match any prefix and a trailing * to match any suffix. However there currently is not a combination of both that can be used to target matches of whole families of functions that share a common substring.
Here we expand the *foo and foo* match to also support *foo* with the goal of targeting compiler generated symbol names that contain strings like ".constprop." and ".isra."
--- scripts/mod/modpost.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
scripts/mod/modpost.c +11 -1
@@ -798,6 +798,7 @@ static int number_prefix(const char *sym* where the '1' can be any number including several digits. * The $ syntax is for sections where ld append a dot number * to make section name unique. +* "*foo*" will match a string that contains "foo" */ static int match (const char *sym,const char *const pat[]) {
@@ -806,8 +807,17 @@ static int match(const char *sym, const p = *pat++;const char *endp = p +strlen (p) -1 ; +/* "*foo*" */ +if (*p =='*' && *endp =='*' ) { +char *here, *bare =strndup (p +1 ,strlen (p) -2 ); + + here =strstr (sym, bare); +free (bare); +if (here !=NULL ) +return 1 ; + }/* "*foo" */ -if (*p =='*' ) { +else if (*p =='*' ) {if (strrcmp (sym, p +1 ) ==0 )return 1 ; }
PATCH 205/294 modpost: don't emit section mismatch warnings for compiler optimizations
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paul Gortmaker <[email protected]>
commit 4a3893d069b788f3570c19c12d9e986e8e15870f upstream.
Currently an allyesconfig build [gcc-4.9.1] can generate the following:
WARNING: vmlinux.o(.text.unlikely+0x3864): Section mismatch in reference from the function cpumask_empty.constprop.3() to the variable .init.data:nmi_ipi_mask
which comes from the cpumask_empty usage in arch/x86/kernel/nmi_selftest.c.
Normally we would not see a symbol entry for cpumask_empty since it is:
static inline bool cpumask_empty(const struct cpumask *srcp)
however in this case, the variant of the symbol gets emitted when GCC does constant propagation optimization.
Fix things up so that any locally optimized constprop variants don't warn when accessing variables that live in the __init sections.
[arnd: adapted text_sections definition to 3.18]
--- scripts/mod/modpost.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
scripts/mod/modpost.c +22 -0
@@ -930,6 +930,10 @@ static const char *init_sections[] = { Astatic const char *init_exit_sections[] = {ALL_INIT_SECTIONS ,ALL_EXIT_SECTIONS ,NULL }; +/* all text sections */ +static const char *const text_sections[] = {ALL_INIT_TEXT_SECTIONS , +ALL_EXIT_TEXT_SECTIONS ,TEXT_SECTIONS ,NULL }; +/* data section */ static const char *data_sections[] = {DATA_SECTIONS ,NULL };
@@ -948,6 +952,7 @@ static const char *data_sections[] = { Dstatic const char *head_sections[] = {".head.text*" ,NULL };static const char *linker_symbols[] = {"__init_begin" ,"_sinittext" ,"_einittext" ,NULL }; +static const char *const optim_symbols[] = {"*.constprop.*" ,NULL };enum mismatch {TEXT_TO_ANY_INIT ,
@@ -1105,6 +1110,17 @@ static const struct sectioncheck *sectio* This pattern is identified by * refsymname = __init_begin, _sinittext, _einittext * +* Pattern 5: +* GCC may optimize static inlines when fed constant arg(s) resulting +* in functions like cpumask_empty() -- generating an associated symbol +* cpumask_empty.constprop.3 that appears in the audit. If the const that +* is passed in comes from __init, like say nmi_ipi_mask, we get a +* meaningless section warning. May need to add isra symbols too... +* This pattern is identified by +* tosec = init section +* fromsec = text section +* refsymname = *.constprop.* +* **/ static int secref_whitelist(const struct sectioncheck *mismatch, const char *fromsec, const char *fromsym,
@@ -1137,6 +1153,12 @@ static int secref_whitelist(const structif (match (tosym, linker_symbols))return 0 ; +/* Check for pattern 5 */ +if (match (fromsec, text_sections) && +match (tosec, init_sections) && +match (fromsym, optim_symbols)) +return 0 ; +return 1 ; }
PATCH 206/294 ethernet: amd: fix pci device ids
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Varka Bhadram <[email protected]>
commit ba69a3d78e4f51e65933a86b8b107c86709bb2f5 upstream.
Normally any device ids will be above the corresponding device driver structure. This patch moves the pci device ids and MODULE_DEVICE_TABLE() above the pci driver structure.
--- drivers/net/ethernet/amd/amd8111e.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/net/ethernet/amd/amd8111e.c +11 -8
@@ -101,7 +101,6 @@ Revision History:MODULE_AUTHOR ("Advanced Micro Devices, Inc." );MODULE_DESCRIPTION ("AMD8111 based 10/100 Ethernet Controller. Driver Version " MODULE_VERS );MODULE_LICENSE ("GPL" ); -MODULE_DEVICE_TABLE (pci, amd8111e_pci_tbl);module_param_array (speed_duplex, int,NULL ,0 );MODULE_PARM_DESC (speed_duplex,"Set device speed and duplex modes, 0: Auto Negotiate, 1: 10Mbps Half Duplex, 2: 10Mbps Full Duplex, 3: 100Mbps Half Duplex, 4: 100Mbps Full Duplex" );module_param_array (coalesce, bool,NULL ,0 );
@@ -109,13 +108,6 @@ MODULE_PARM_DESC(coalesce, "Enable or Dimodule_param_array (dynamic_ipg, bool,NULL ,0 );MODULE_PARM_DESC (dynamic_ipg,"Enable or Disable dynamic IPG, 1: Enable, 0: Disable" ); -static DEFINE_PCI_DEVICE_TABLE (amd8111e_pci_tbl) = { - - {PCI_VENDOR_ID_AMD ,PCI_DEVICE_ID_AMD8111E_7462 , -PCI_ANY_ID ,PCI_ANY_ID ,0 ,0 ,0UL }, - {0 , } - -};/* This function will read the PHY registers. */
@@ -1970,6 +1962,17 @@ err_disable_pdev: } +static const struct pci_device_id amd8111e_pci_tbl[] = { + { + .vendor =PCI_VENDOR_ID_AMD , + .device =PCI_DEVICE_ID_AMD8111E_7462 , + }, + { + .vendor =0 , + } +}; +MODULE_DEVICE_TABLE (pci, amd8111e_pci_tbl); +static struct pci_driver amd8111e_driver = { .name =MODULE_NAME , .id_table = amd8111e_pci_tbl,
PATCH 207/294 MODULE_DEVICE_TABLE: fix some callsites
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andrew Morton <[email protected]>
commit 0f989f749b51ec1fd94bb5a42f8ad10c8b9f73cb upstream.
The patch "module: fix types of device tables aliases" newly requires that invocations of
MODULE_DEVICE_TABLE(type, name);
come *after* the definition of `name'. That is reasonable, but some drivers weren't doing this. Fix them.
--- Documentation/video4linux/v4l2-pci-skeleton.c | 2 +- drivers/net/ethernet/emulex/benet/be_main.c | 1 - drivers/scsi/be2iscsi/be_main.c | 1 - 3 files changed, 1 insertion(+), 3 deletions(-)
Documentation/video4linux/v4l2-pci-skeleton.c +1 -1
@@ -42,7 +42,6 @@MODULE_DESCRIPTION ("V4L2 PCI Skeleton Driver" );MODULE_AUTHOR ("Hans Verkuil" );MODULE_LICENSE ("GPL v2" ); -MODULE_DEVICE_TABLE (pci, skeleton_pci_tbl);/** * struct skeleton - All internal data for one instance of device
@@ -95,6 +94,7 @@ static const struct pci_device_id skelet/* { PCI_DEVICE(PCI_VENDOR_ID_, PCI_DEVICE_ID_) }, */ { 0, } }; +MODULE_DEVICE_TABLE (pci, skeleton_pci_tbl);/* * HDTV: this structure has the capabilities of the HDTV receiver.
drivers/net/ethernet/emulex/benet/be_main.c +0 -1
@@ -26,7 +26,6 @@#include <net/vxlan.h> MODULE_VERSION (DRV_VER ); -MODULE_DEVICE_TABLE (pci, be_dev_ids);MODULE_DESCRIPTION (DRV_DESC " " DRV_VER );MODULE_AUTHOR ("Emulex Corporation" );MODULE_LICENSE ("GPL" );
drivers/scsi/be2iscsi/be_main.c +0 -1
@@ -48,7 +48,6 @@ static unsigned int be_iopoll_budget = 1static unsigned int be_max_phys_size =64 ;static unsigned int enable_msix =1 ; -MODULE_DEVICE_TABLE (pci, beiscsi_pci_id_table);MODULE_DESCRIPTION (DRV_DESC " " BUILD_STR );MODULE_VERSION (BUILD_STR );MODULE_AUTHOR ("Emulex Corporation" );
PATCH 208/294 Input: gscps2 - fix MODULE_DEVICE_TABLE invocation
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 6c8afa88adce613c23f27e719f805cc2a6441b07 upstream.
The patch "module: fix types of device tables aliases" newly requires that invocations of
MODULE_DEVICE_TABLE(type, name);
come *after* the definition of `name'. That is reasonable, but gscps2 wasn't doing this. Fix it.
--- drivers/input/serio/gscps2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/serio/gscps2.c +1 -1
@@ -40,7 +40,6 @@MODULE_AUTHOR ("Laurent Canet <[email protected]>, Thibaut Varene <[email protected]>, Helge Deller <[email protected]>" );MODULE_DESCRIPTION ("HP GSC PS2 port driver" );MODULE_LICENSE ("GPL" ); -MODULE_DEVICE_TABLE (parisc, gscps2_device_tbl);#define PFX "gscps2.c: "
@@ -439,6 +438,7 @@ static struct parisc_device_id gscps2_de#endif { 0, } /* 0 terminated list */ }; +MODULE_DEVICE_TABLE (parisc, gscps2_device_tbl);static struct parisc_driver parisc_ps2_driver = { .name ="gsc_ps2" ,
PATCH 209/294 module: fix types of device tables aliases
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Andrey Ryabinin <[email protected]>
commit 6301939d97d079f0d3dbe71e750f4daf5d39fc33 upstream.
MODULE_DEVICE_TABLE() macro used to create aliases to device tables. Normally alias should have the same type as aliased symbol.
Device tables are arrays, so they have 'struct type##_device_id[x]' types. Alias created by MODULE_DEVICE_TABLE() will have non-array type -
'struct type##_device_id'.
This inconsistency confuses compiler, it could make a wrong assumption about variable's size which leads KASan to produce a false positive report about out of bounds access.
For every global variable compiler calls __asan_register_globals() passing information about global variable (address, size, size with redzone, name ...) __asan_register_globals() poison symbols redzone to detect possible out of bounds accesses.
When symbol has an alias __asan_register_globals() will be called as for symbol so for alias. Compiler determines size of variable by size of variable's type. Alias and symbol have the same address, so if alias have the wrong size part of memory that actually belongs to the symbol could be poisoned as redzone of alias symbol.
By fixing type of alias symbol we will fix size of it, so __asan_register_globals() will not poison valid memory.
--- include/linux/module.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/module.h +1 -1
@@ -135,7 +135,7 @@ void trim_init_extable(struct module *m)#ifdef MODULE /* Creates an alias so file2alias.c can find device table. */ #define MODULE_DEVICE_TABLE (type, name) \ - extern const struct type##_device_id __mod_##type##__##name##_device_table \ +extern const typeof(name) __mod_##type##__##name##_device_table \ __attribute__ ((unused, alias(__stringify(name))))#else /* !MODULE */ #define MODULE_DEVICE_TABLE (type, name)
PATCH 210/294 mm/hugetlb: improve locking in dissolve_free_huge_pages()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Gerald Schaefer <[email protected]>
commit eb03aa008561004257900983193d024e57abdd96 upstream.
For every pfn aligned to minimum_order, dissolve_free_huge_pages() will call dissolve_free_huge_page() which takes the hugetlb spinlock, even if the page is not huge at all or a hugepage that is in-use.
Improve this by doing the PageHuge() and page_count() checks already in dissolve_free_huge_pages() before calling dissolve_free_huge_page(). In dissolve_free_huge_page(), when holding the spinlock, those checks need to be revalidated.
--- mm/hugetlb.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-)
mm/hugetlb.c +9 -3
@@ -1105,14 +1105,20 @@ out:int dissolve_free_huge_pages (unsigned long start_pfn,unsigned long end_pfn) {unsigned long pfn; +struct page *page;int rc =0 ;if (!hugepages_supported ())return rc; -for (pfn = start_pfn; pfn < end_pfn; pfn +=1 << minimum_order) -if (rc =dissolve_free_huge_page (pfn_to_page (pfn))) -break ; +for (pfn = start_pfn; pfn < end_pfn; pfn +=1 << minimum_order) { + page =pfn_to_page (pfn); +if (PageHuge (page) && !page_count (page)) { + rc =dissolve_free_huge_page (page); +if (rc) +break ; + } + }return rc; }
PATCH 211/294 cpumask_set_cpu_local_first => cpumask_local_spread, lament
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Rusty Russell <[email protected]>
commit f36963c9d3f6f415732710da3acdd8608a9fa0e upstream.
da91309e0a7e (cpumask: Utility function to set n'th cpu...) created a genuinely weird function. I never saw it before, it went through DaveM. (He only does this to make us other maintainers feel better about our own mistakes.)
cpumask_set_cpu_local_first's purpose is say "I need to spread things across N online cpus, choose the ones on this numa node first"; you call it in a loop.
It can fail. One of the two callers ignores this, the other aborts and fails the device open.
It can fail in two ways: allocating the off-stack cpumask, or through a convoluted codepath which AFAICT can only occur if cpu_online_mask changes. Which shouldn't happen, because if cpu_online_mask can change while you call this, it could return a now-offline cpu anyway.
It contains a nonsensical test "!cpumask_of_node(numa_node)". This was drawn to my attention by Geert, who said this causes a warning on Sparc. It sets a single bit in a cpumask instead of returning a cpu number, because that's what the callers want.
It could be made more efficient by passing the previous cpu rather than an index, but that would be more invasive to the callers.
--- drivers/net/ethernet/mellanox/mlx4/en_netdev.c | 10 ++-- drivers/net/ethernet/mellanox/mlx4/en_tx.c | 6 +-- include/linux/cpumask.h | 6 +-- lib/cpumask.c | 74 +++++++++----------------- 4 files changed, 34 insertions(+), 62 deletions(-)
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +3 -7
@@ -1535,17 +1535,13 @@ static int mlx4_en_init_affinity_hint(st {struct mlx4_en_rx_ring *ring = priv->rx_ring[ring_idx];int numa_node = priv->mdev->dev->numa_node; -int ret =0 ;if (!zalloc_cpumask_var (&ring->affinity_mask,GFP_KERNEL ))return -ENOMEM ; - ret =cpumask_set_cpu_local_first (ring_idx, numa_node, - ring->affinity_mask); -if (ret) -free_cpumask_var (ring->affinity_mask); - -return ret; +cpumask_set_cpu (cpumask_local_spread (ring_idx, numa_node), + ring->affinity_mask); +return 0 ; }static void mlx4_en_free_affinity_hint (struct mlx4_en_priv *priv,int ring_idx)
drivers/net/ethernet/mellanox/mlx4/en_tx.c +3 -3
@@ -133,9 +133,9 @@ int mlx4_en_create_tx_ring(struct mlx4_e ring->queue_index = queue_index;if (queue_index < priv->num_tx_rings_p_up) -cpumask_set_cpu_local_first (queue_index, - priv->mdev->dev->numa_node, - &ring->affinity_mask); +cpumask_set_cpu (cpumask_local_spread (queue_index, + priv->mdev->dev->numa_node), + &ring->affinity_mask); *pring = ring;return 0 ;
include/linux/cpumask.h +2 -4
@@ -142,10 +142,8 @@ static inline unsigned int cpumask_any_breturn 1 ; } -static inline int cpumask_set_cpu_local_first (int i,int numa_node,cpumask_t *dstp) +static inline unsigned int cpumask_local_spread (unsigned int i,int node) { -set_bit (0 ,cpumask_bits (dstp)); -return 0 ; }
@@ -199,7 +197,7 @@ static inline unsigned int cpumask_next_int cpumask_next_and (int n,const struct cpumask *,const struct cpumask *);int cpumask_any_but (const struct cpumask *mask,unsigned int cpu); -int cpumask_set_cpu_local_first (int i,int numa_node,cpumask_t *dstp); +unsigned int cpumask_local_spread (unsigned int i,int node);/** * for_each_cpu - iterate over every cpu in a mask
lib/cpumask.c +25 -47
89 lines not on this page · raw message
PATCH 212/294 gfs2: remove IS_ERR_VALUE abuse
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
Picked from commit 287980e49ffc0f6d911601e7e352a812ed27768e ("remove lots of IS_ERR_VALUE abuses") upstream.
The original fix that was backported to 3.18 already addressed the warning in some configurations, but not in others, leaving us with the same output:
../fs/gfs2/dir.c: In function 'get_first_leaf':../fs/gfs2/dir.c:768:9: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized]
error = get_leaf(dip, leaf_no, bh_out);
^../fs/gfs2/dir.c: In function 'dir_split_leaf.isra.20':../fs/gfs2/dir.c:987:8: warning: 'leaf_no' may be used uninitialized in this function [-Wmaybe-uninitialized]
This takes the approach that we took in later versions in mainline, but does not backport the entire patch, as that would be too large for stable and IIRC caused regressions in other drivers.
--- fs/gfs2/dir.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
fs/gfs2/dir.c +7 -4
@@ -749,12 +749,15 @@ static int get_leaf_nr(struct gfs2_inode u64 *leaf_out) {__be64 *hash; +int error; hash =gfs2_dir_get_hash_table (dip); -if (IS_ERR (hash)) -return PTR_ERR (hash); - *leaf_out =be64_to_cpu (*(hash + index)); -return 0 ; + error =PTR_ERR_OR_ZERO (hash); + +if (!error) + *leaf_out =be64_to_cpu (*(hash + index)); + +return error; } static int get_first_leaf(struct gfs2_inode *dip, u32 index,
PATCH 213/294 iio: adc: fix building on 64-bit
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
On the 3.16 kernel, we get a harmless warning:
drivers/iio/adc/exynos_adc.c: In function 'exynos_adc_get_version':drivers/iio/adc/exynos_adc.c:112:9: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast]
Upstream commit e49d99e0ecc8 ("iio: adc: exynos_adc: Add exynos_adc_data structure to improve readability") in 3.17 removed the function, so we can't backport a fix from upstream, but changing the cast to use uintptr_t is the obvious fix.
--- drivers/iio/adc/exynos_adc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/iio/adc/exynos_adc.c +1 -1
@@ -109,7 +109,7 @@ static inline unsigned int exynos_adc_geconst struct of_device_id *match; match =of_match_node (exynos_adc_match, pdev->dev.of_node); -return (unsigned int )match->data; +return (uintptr_t )match->data; }static void exynos_adc_hw_init (struct exynos_adc *info)
PATCH 214/294 infiniband: mlx5: avoid a compile-time warning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 7835bfb5261501590a508b3de3379e2231cb4853 upstream.
The return type of find_first_bit() is architecture specific, on ARM it is 'unsigned int', while the asm-generic code used on x86 and a lot of other architectures returns 'unsigned long'.
When building the mlx5 driver on ARM, we get a warning about this:
infiniband/hw/mlx5/mem.c: In function 'mlx5_ib_cont_pages':infiniband/hw/mlx5/mem.c:84:143: warning: comparison of distinct pointer types lacks a cast
m = min(m, find_first_bit(&tmp, sizeof(tmp)));
This patch changes the driver to use min_t to make it behave the same way on all architectures.
--- drivers/infiniband/hw/mlx5/mem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/infiniband/hw/mlx5/mem.c +1 -1
@@ -68,7 +68,7 @@ void mlx5_ib_cont_pages(struct ib_umem *for (k =0 ; k < len; k++) {if (!(i & mask)) { tmp = (unsigned long )pfn; - m =min (m,find_first_bit (&tmp,sizeof (tmp))); + m = min_t(unsigned long, m, find_first_bit(&tmp, sizeof(tmp))); skip =1 << m; mask = skip -1 ; base = pfn;
PATCH 215/294 power/reset: xgene-reset: Fix prototype of xgene_restart()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit d3ed534cca703b2aaeee9277a5b8063ae6eab1d1 upstream.
The xgene-reset driver uses xgene_restart() as arm_pm_restart() but that function should take an enum reset_type as the first argument rather than a char. Fix this; the paramter is not referenced in the implementation.
--- drivers/power/reset/xgene-reboot.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/power/reset/xgene-reboot.c +1 -1
@@ -40,7 +40,7 @@ struct xgene_reboot_context {static struct xgene_reboot_context *xgene_restart_ctx; -static void xgene_restart (char str,const char *cmd) +static void xgene_restart (enum reboot_mode mode,const char *cmd) {struct xgene_reboot_context *ctx = xgene_restart_ctx;unsigned long timeout;
PATCH 216/294 mfd: arizona: Rid data size incompatibility warn when building for 64bit
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lee Jones <[email protected]>
commit 942786e6e647cef94cf96dcd836d343be55fc452 upstream.
Extinguishes:
../drivers/mfd/arizona-core.c: In function ‘arizona_of_get_type’:../drivers/mfd/arizona-core.c:505:10:
warning: cast from pointer to integer of different size
--- drivers/mfd/arizona-core.c | 4 ++-- drivers/mfd/arizona-i2c.c | 5 +++-- drivers/mfd/arizona-spi.c | 3 ++- drivers/mfd/arizona.h | 4 ++-- 4 files changed, 9 insertions(+), 7 deletions(-)
drivers/mfd/arizona-core.c +2 -2
@@ -497,12 +497,12 @@ const struct dev_pm_ops arizona_pm_ops =EXPORT_SYMBOL_GPL (arizona_pm_ops);#ifdef CONFIG_OF -int arizona_of_get_type (struct device *dev) +unsigned long arizona_of_get_type (struct device *dev) {const struct of_device_id *id =of_match_device (arizona_of_match, dev);if (id) -return (int )id->data; +return (unsigned long )id->data;else return 0 ; }
drivers/mfd/arizona-i2c.c +3 -2
@@ -24,11 +24,12 @@#include "arizona.h" static int arizona_i2c_probe (struct i2c_client *i2c, -const struct i2c_device_id *id) +const struct i2c_device_id *id) {struct arizona *arizona;const struct regmap_config *regmap_config; -int ret, type; +unsigned long type; +int ret;if (i2c->dev.of_node) type =arizona_of_get_type (&i2c->dev);
drivers/mfd/arizona-spi.c +2 -1
@@ -28,7 +28,8 @@ static int arizona_spi_probe(struct spi_const struct spi_device_id *id =spi_get_device_id (spi);struct arizona *arizona;const struct regmap_config *regmap_config; -int ret, type; +unsigned long type; +int ret;if (spi->dev.of_node) type =arizona_of_get_type (&spi->dev);
drivers/mfd/arizona.h +2 -2
@@ -46,9 +46,9 @@ int arizona_irq_init(struct arizona *ariint arizona_irq_exit (struct arizona *arizona);#ifdef CONFIG_OF -int arizona_of_get_type (struct device *dev); +unsigned long arizona_of_get_type (struct device *dev);#else -static inline int arizona_of_get_type (struct device *dev) +static inline unsigned long arizona_of_get_type (struct device *dev) {return 0 ; }
PATCH 217/294 Input: joystick - use get_cycles on ARMv8
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit a6b48699ae50ccce700506ced863ba1f5ce2af11 upstream.
As with ARM the ARMv8 architecture provides a cycle counter which can be used to provide a high resolution time for the joystick driver and silence the build warning that results from not having a precise timer on ARMv8, making allmodconfig and allyesconfig quieter.
--- drivers/input/joystick/analog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/joystick/analog.c +1 -1
@@ -158,7 +158,7 @@ static unsigned int get_time_pit(void)#define GET_TIME (x) rdtscl(x)#define DELTA (x,y) ((y)-(x))#define TIME_NAME "TSC" -#elif defined(__alpha__) || defined(CONFIG_MN10300 ) || defined(CONFIG_ARM ) || defined(CONFIG_TILE ) +#elif defined(__alpha__) || defined(CONFIG_MN10300 ) || defined(CONFIG_ARM ) || defined(CONFIG_ARM64 ) || defined(CONFIG_TILE )#define GET_TIME (x) do { x = get_cycles(); } while (0)#define DELTA (x,y) ((y)-(x))#define TIME_NAME "get_cycles"
PATCH 218/294 dma: pl08x: Use correct specifier for size_t values
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 6fc8ae787c589245ee3395630d2c428a1afab26c upstream.
When printing size_t values we should use the %zd or %zx format specifier in order to ensure the value is displayed correctly and avoid warnings from sparse.
--- drivers/dma/amba-pl08x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/dma/amba-pl08x.c +2 -2
@@ -1040,7 +1040,7 @@ static int pl08x_fill_llis_for_desc(struif (early_bytes) {dev_vdbg (&pl08x->adev->dev, -"%s byte width LLIs (remain 0x%08x)\n" , +"%s byte width LLIs (remain 0x%08zx)\n" , __func__, bd.remainder);prep_byte_width_lli (pl08x, &bd, &cctl, early_bytes, num_llis++, &total_bytes);
@@ -1662,7 +1662,7 @@ static struct dma_async_tx_descriptor *pdma_addr_t slave_addr;dev_dbg (&pl08x->adev->dev, -"%s prepare cyclic transaction of %d/%d bytes %s %s\n" , +"%s prepare cyclic transaction of %zd/%zd bytes %s %s\n" , __func__, period_len, buf_len, direction ==DMA_MEM_TO_DEV ?"to" :"from" , plchan->name);
PATCH 219/294 gpio: drop retval check enforcing from gpiochip_remove()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Linus Walleij <[email protected]>
commit 14c8a620ba436511b1347c592633befa49535176 upstream.
As we start to decomission the return value from gpiochip_remove() the compilers emit warnings due to the function being tagged __must_check. So drop this until we remove the return value altogether.
--- include/linux/gpio/driver.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/gpio/driver.h +1 -1
@@ -141,7 +141,7 @@ extern const char *gpiochip_is_requested/* add/remove chips */ extern int gpiochip_add (struct gpio_chip *chip); -extern int __must_check gpiochip_remove (struct gpio_chip *chip); +extern int gpiochip_remove (struct gpio_chip *chip);extern struct gpio_chip *gpiochip_find (void *data,int (*match)(struct gpio_chip *chip,void *data));
PATCH 220/294 ASoC: fsl-ssi: fix do_div build warning in fsl_ssi_set_bclk()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Timur Tabi <[email protected]>
commit acf2c60a60b3d6d7080854b9483f37d99ded9b23 upstream.
do_div() requires that the first parameter is a 64-bit integer, which but clkrate was defined as an unsigned long. This caused the following warnings:
CC sound/soc/fsl/fsl_ssi.osound/soc/fsl/fsl_ssi.c: In function 'fsl_ssi_set_bclk':sound/soc/fsl/fsl_ssi.c:593:3: warning: comparison of distinct pointer types lacks a cast sound/soc/fsl/fsl_ssi.c:593:3: warning: right shift count >= width of type sound/soc/fsl/fsl_ssi.c:593:3: warning: passing argument 1 of '__div64_32' from incompatible pointer type include/asm-generic/div64.h:35:17: note: expected 'uint64_t *' but argument is of type 'long unsigned int *'
--- sound/soc/fsl/fsl_ssi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/fsl/fsl_ssi.c +2 -2
@@ -590,8 +590,8 @@ static int fsl_ssi_set_bclk(struct snd_pelse clkrate =clk_round_rate (ssi_private->baudclk, tmprate); -do_div (clkrate, factor); - afreq = (u32 )clkrate / (i +1 ); + clkrate /= factor; + afreq = clkrate / (i +1 );if (freq == afreq) sub =0 ;
PATCH 221/294 ASoC: imx-audmux: Use uintptr_t for port numbers
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit e5f89768e9bc1f441d18e2299518a2907e5017c9 upstream.
Since we pass the port number through file private data for debugfs we cast it to and from a pointer so use uintptr_t in order to ensure that the types are compatible, avoiding warnings on 64 bit platforms where pointers are 64 bit and unsigned integers 32 bit.
--- sound/soc/fsl/imx-audmux.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/fsl/imx-audmux.c +4 -4
@@ -67,7 +67,7 @@ static ssize_t audmux_read_file(struct f {ssize_t ret;char *buf; -int port = (int )file->private_data; +uintptr_t port = (uintptr_t )file->private_data;u32 pdcr, ptcr;if (audmux_clk) {
@@ -147,7 +147,7 @@ static const struct file_operations audmstatic void audmux_debugfs_init (void ) { -int i; +uintptr_t i;char buf[20 ]; audmux_debugfs_root =debugfs_create_dir ("audmux" ,NULL );
@@ -157,10 +157,10 @@ static void audmux_debugfs_init(void) }for (i =0 ; i <MX31_AUDMUX_PORT7_SSI_PINS_7 +1 ; i++) { -snprintf (buf,sizeof (buf),"ssi%d" , i); +snprintf (buf,sizeof (buf),"ssi%lu" , i);if (!debugfs_create_file (buf,0444 , audmux_debugfs_root, (void *)i, &audmux_debugfs_fops)) -pr_warning ("Failed to create AUDMUX port %d debugfs file\n" , +pr_warning ("Failed to create AUDMUX port %lu debugfs file\n" , i); } }
PATCH 222/294 ASoC: fsl_sai: Set SYNC bit of TCR2 to Asynchronous Mode
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Nicolin Chen <[email protected]>
commit 855675f6e6a65688a7f4cf45b9b5a98cf6c6f5c3 upstream.
There is one design rule according to SAI's reference manual:
If the transmitter bit clock and frame sync are to be used by both transmitter and receiver, the transmitter must be configured for asynchronous operation and the receiver for synchronous operation.
And SYNC of TCR2 is a 2-width control bit:
00 Asynchronous mode.
01 Synchronous with receiver.
10 Synchronous with another SAI transmitter.
11 Synchronous with another SAI receiver.
So the driver should have set SYNC bit of TCR2 to 0x0, and meanwhile set SYNC bit of RCR2 to 0x1 (Synchronous with transmitter).
--- sound/soc/fsl/fsl_sai.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
sound/soc/fsl/fsl_sai.c +1 -2
@@ -333,8 +333,7 @@ static int fsl_sai_trigger(struct snd_pc* The transmitter bit clock and frame sync are to be * used by both the transmitter and receiver. */ -regmap_update_bits (sai->regmap,FSL_SAI_TCR2 ,FSL_SAI_CR2_SYNC , - ~FSL_SAI_CR2_SYNC ); +regmap_update_bits (sai->regmap,FSL_SAI_TCR2 ,FSL_SAI_CR2_SYNC ,0 );regmap_update_bits (sai->regmap,FSL_SAI_RCR2 ,FSL_SAI_CR2_SYNC ,FSL_SAI_CR2_SYNC );
PATCH 223/294 ASoC: adau1977: Fix truncation warning on 64 bit architectures
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit d8df26bb57d2a86365de46a5421b97417401e39a upstream.
Negating ADAU1977_BLOCK_POWER_SAI_LDO_EN creates an unsigned long constant with all bits set which on 64 bit architectures needs to be truncated to an unsigned int, generating a warning. Add an explicit cast since we know this is OK.
--- sound/soc/codecs/adau1977.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/adau1977.c +1 -1
@@ -968,7 +968,7 @@ int adau1977_probe(struct device *dev, sif (adau1977->dvdd_reg) power_off_mask = ~0 ;else - power_off_mask = ~ADAU1977_BLOCK_POWER_SAI_LDO_EN ; + power_off_mask = (unsigned int )~ADAU1977_BLOCK_POWER_SAI_LDO_EN ; ret =regmap_update_bits (adau1977->regmap,ADAU1977_REG_BLOCK_POWER_SAI , power_off_mask,0x00 );
PATCH 224/294 ata: hpt366: fix constant cast warning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 6ec0a86c645be3fce7ade42f165a6a417c3503b1 upstream.
gcc-5.x warns about a preexisting problem in the hpt36x pata driver:
drivers/ata/pata_hpt366.c: In function 'hpt36x_init_one':drivers/ata/pata_hpt366.c:376:9: warning: assignment discards 'const' qualifier from pointer target type [-Wdiscarded-array-qualifiers]
Other ata drivers have the same problem, as ata_pci_bmdma_init_one takes a non-const pointer, and they solve it by using a cast to turn that pointer into a normal non-const pointer.
I also tried to change the ata core code to make host->private_data a const pointer, but that quickly got out of hand, as some other drivers expect it to be writable, so I ended up using the same hack as the others here.
--- drivers/ata/pata_hpt366.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/ata/pata_hpt366.c +2 -2
@@ -352,7 +352,7 @@ static int hpt36x_init_one(struct pci_de };const struct ata_port_info *ppi[] = { &info_hpt366,NULL }; -void *hpriv =NULL ; +const void *hpriv =NULL ;u32 reg1;int rc;
@@ -383,7 +383,7 @@ static int hpt36x_init_one(struct pci_debreak ; }/* Now kick off ATA set up */ -return ata_pci_bmdma_init_one (dev, ppi, &hpt36x_sht, hpriv,0 ); +return ata_pci_bmdma_init_one (dev, ppi, &hpt36x_sht, (void *)hpriv,0 ); }#ifdef CONFIG_PM_SLEEP
PATCH 225/294 clk/efm32gg: fix dt init prototype
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
commit 8ce8ebeb572d70e672a8d158e93ffaac80ea7576 upstream.
Since commit 54196ccbe0ba (of: consolidate linker section OF match table declarations) which went into 3.16-rc1 the following compiler warning is generated:
In file included from drivers/clk/clk-efm32gg.c:12:0: include/linux/of.h:772:20: warning: comparison of distinct pointer types lacks a cast [enabled by default] .data = (fn == (fn_type)NULL) ? fn : fn } ^ include/linux/of.h:785:3: note: in expansion of macro '_OF_DECLARE' _OF_DECLARE(table, name, compat, fn, of_init_fn_1) ^ include/linux/clk-provider.h:545:42: note: in expansion of macro 'OF_DECLARE_1' #define CLK_OF_DECLARE(name, compat, fn) OF_DECLARE_1(clk, name, compat, fn) ^ drivers/clk/clk-efm32gg.c:81:1: note: in expansion of macro 'CLK_OF_DECLARE' CLK_OF_DECLARE(efm32ggcmu, "efm32gg,cmu", efm32gg_cmu_init); ^
Fix it by making efm32gg_cmu_init return void.
--- drivers/clk/clk-efm32gg.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/clk/clk-efm32gg.c +3 -3
@@ -22,7 +22,7 @@ static struct clk_onecell_data clk_data .clk_num = ARRAY_SIZE(clk), }; -static int __init efm32gg_cmu_init (struct device_node *np) +static void __init efm32gg_cmu_init (struct device_node *np) {int i;void __iomem *base;
@@ -33,7 +33,7 @@ static int __init efm32gg_cmu_init(struc base =of_iomap (np,0 );if (!base) {pr_warn ("Failed to map address range for efm32gg,cmu node\n" ); -return -EADDRNOTAVAIL ; +return ; } clk[clk_HFXO] = clk_register_fixed_rate(NULL, "HFXO", NULL,
@@ -76,6 +76,6 @@ static int __init efm32gg_cmu_init(struc clk[clk_HFPERCLKDAC0] =clk_register_gate (NULL ,"HFPERCLK.DAC0" ,"HFXO" ,0 , base +CMU_HFPERCLKEN0 ,17 ,0 ,NULL ); -return of_clk_add_provider (np, of_clk_src_onecell_get, &clk_data); +of_clk_add_provider (np, of_clk_src_onecell_get, &clk_data); }CLK_OF_DECLARE (efm32ggcmu,"efm32gg,cmu" , efm32gg_cmu_init);
PATCH 226/294 spi: rspi: Remove unused variable in rspi_rz_transfer_one()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Geert Uytterhoeven <[email protected]>
commit 95029a00886f0c8d79e700cb8983b881c75af0f1 upstream.
Introduced by commit 8b983e90ea1a3dd82070f96c062ad521a06b7cc0 ("spi: rspi:
Extract rspi_common_transfer()"), which removed its users.
--- drivers/spi/spi-rspi.c | 1 - 1 file changed, 1 deletion(-)
drivers/spi/spi-rspi.c +0 -1
@@ -630,7 +630,6 @@ static int rspi_rz_transfer_one(struct s struct spi_transfer *xfer) {struct rspi_data *rspi =spi_master_get_devdata (master); -int ret;rspi_rz_receive_init (rspi);
PATCH 227/294 spi/atmel: Fix pointer to int conversion warnings on 64 bit builds
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 67f08d690aa90e47a0e793fc63e2ecbe95d29839 upstream.
On 64 bit systems integers are generally still 32 bit but long values and pointers are usually 64 bit. GCC warns when casting a 64 bit pointer into a 32 bit integer so cast to a long instead in order to avoid warnings.
--- drivers/spi/spi-atmel.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/spi/spi-atmel.c +2 -2
@@ -1020,7 +1020,7 @@ static int atmel_spi_setup(struct spi_de csr |=SPI_BF (DLYBCT ,0 );/* chipselect must have been muxed as GPIO (e.g. in board setup) */ - npcs_pin = (unsigned int )spi->controller_data; + npcs_pin = (unsigned long )spi->controller_data;if (gpio_is_valid (spi->cs_gpio)) npcs_pin = spi->cs_gpio;
@@ -1255,7 +1255,7 @@ msg_done:static void atmel_spi_cleanup (struct spi_device *spi) {struct atmel_spi_device *asd = spi->controller_state; -unsigned gpio = (unsigned ) spi->controller_data; +unsigned gpio = (unsigned long ) spi->controller_data;if (!asd)return ;
PATCH 228/294 spi/pl022: Explicitly truncate large bitmask
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit d555ea05f9d8ebf567eaa6b4e4cb5776aacf2940 upstream.
When building on 64 bit architectures the use of bitwise negation generates constants larger than 32 bits which won't fit in u32s used to represent 32 bit register values on the device. Explicitly cast to let the compiler know that the higher bits are not significant and can be discarded.
--- drivers/spi/spi-pl022.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/spi/spi-pl022.c +1 -1
@@ -1417,7 +1417,7 @@ static void do_interrupt_dma_transfer(st* Default is to enable all interrupts except RX - * this will be enabled once TX is complete */ -u32 irqflags =ENABLE_ALL_INTERRUPTS & ~SSP_IMSC_MASK_RXIM ; +u32 irqflags = (u32)(ENABLE_ALL_INTERRUPTS & ~SSP_IMSC_MASK_RXIM );/* Enable target chip, if not already active */ if (!pl022->next_msg_cs_active)
PATCH 229/294 tty: nozomi: avoid a harmless gcc warning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit a4f642a8a3c2838ad09fe8313d45db46600e1478 upstream.
The nozomi wireless data driver has its own helper function to transfer data from a FIFO, doing an extra byte swap on big-endian architectures, presumably to bring the data back into byte-serial order after readw() or readl() perform their implicit byteswap.
This helper function is used in the receive_data() function to first read the length into a 32-bit variable, which causes a compile-time warning:
drivers/tty/nozomi.c: In function 'receive_data':drivers/tty/nozomi.c:857:9: warning: 'size' may be used uninitialized in this function [-Wmaybe-uninitialized]
The problem is that gcc is unsure whether the data was actually read or not. We know that it is at this point, so we can replace it with a single readl() to shut up that warning.
I am leaving the byteswap in there, to preserve the existing behavior, even though this seems fishy: Reading the length of the data into a cpu-endian variable should normally not use a second byteswap on big-endian systems, unless the hardware is aware of the CPU endianess.
There appears to be a lot more confusion about endianess in this driver, so it probably has not worked on big-endian systems in a long time, if ever, and I have no way to test it. It's well possible that this driver has not been used by anyone in a while, the last patch that looks like it was tested on the hardware is from 2008.
--- drivers/tty/nozomi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/nozomi.c +1 -1
@@ -823,7 +823,7 @@ static int receive_data(enum port_type istruct tty_struct *tty =tty_port_tty_get (&port->port);int i, ret; -read_mem32 ((u32 *) &size, addr,4 ); + size =__le32_to_cpu (readl (addr));/* DBG1( "%d bytes port: %d", size, index); */ if (tty &&test_bit (TTY_THROTTLED , &tty->flags)) {
PATCH 230/294 tty/isicom: fix big-endian compile warning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit f3e2d56dce47dbd0bb3f69f84741b439542fef37 upstream.
Building an arm allmodconfig kernel triggers a lengthy but harmless warning in the isicom driver:
drvers/tty/isicom.c: In function 'isicom_send_break':uapi/linux/swab.h:13:15: warning: integer overflow in expression [-Woverflow]
(((__u16)(x) & (__u16)0x00ffU) << 8) | \
^uapi/linux/swab.h:107:2: note: in expansion of macro '___constant_swab16'
___constant_swab16(x) : \
^uapi/linux/byteorder/big_endian.h:34:43: note: in expansion of macro '__swab16'
#define __cpu_to_le16(x) ((__force __le16)__swab16((x)))
^
linux/byteorder/generic.h:89:21: note: in expansion of macro '__cpu_to_le16'
#define cpu_to_le16 __cpu_to_le16
^
include/asm/io.h:270:6: note: in expansion of macro 'cpu_to_le16'
cpu_to_le16(v),__io(p)); })
^drivers/tty/isicom.c:1058:2: note: in expansion of macro 'outw'
outw((length & 0xff00), base);
^
Apparently, the problem is related to the fact that the value 0xff00, when used as a 16-bit number, is negative and passed into bitwise operands of the generic byte swapping code.
Marking the input argument as unsigned in both technically correct and avoids the warning.
--- drivers/tty/isicom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/tty/isicom.c +1 -1
@@ -1055,7 +1055,7 @@ static int isicom_send_break(struct tty_outw (0x8000 | ((port->channel) << (card->shift_count)) |0x3 , base);outw ((length &0xff ) <<8 |0x00 , base); -outw ((length &0xff00 ), base); +outw ((length &0xff00u ), base);InterruptTheCard (base);unlock_card (card);
PATCH 231/294 i2o: hide unsafe ioctl on 64-bit
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
We get a warning about a broken pointer conversion on 64-bit architectures:
drivers/message/i2o/i2o_config.c: In function 'i2o_cfg_passthru':drivers/message/i2o/i2o_config.c:893:19: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
(p->virt, (void __user *)sg[i].addr_bus,
^
drivers/message/i2o/i2o_config.c:953:10: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
((void __user *)sg[j].addr_bus, sg_list[j].virt,
^This has clearly never worked right, so we can add an #ifdef around the code. The driver was moved to staging in linux-4.0 and finally removed in 4.2, so upstream does not have a fix for it.
The driver originally got this mostly right, though probably by accident.
--- drivers/message/i2o/i2o_config.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/message/i2o/i2o_config.c +2 -2
@@ -772,7 +772,7 @@ static long i2o_cfg_compat_ioctl(struct#endif -#ifdef CONFIG_I2O_EXT_ADAPTEC +#if defined(CONFIG_I2O_EXT_ADAPTEC ) && !defined(CONFIG_64BIT )static int i2o_cfg_passthru (unsigned long arg) { struct i2o_cmd_passthru __user *cmd =
@@ -1045,7 +1045,7 @@ static long i2o_cfg_ioctl(struct file *f ret =i2o_cfg_evt_get (arg, fp);break ; -#ifdef CONFIG_I2O_EXT_ADAPTEC +#if defined(CONFIG_I2O_EXT_ADAPTEC ) && !defined(CONFIG_64BIT )case I2OPASSTHRU : ret =i2o_cfg_passthru (arg);break ;
PATCH 232/294 dm bufio: hide bogus warning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
mips-gcc-5.3 warns about correct code on linux-3.18 and earlier:
In file included from ../include/linux/blkdev.h:4:0,
from ../drivers/md/dm-bufio.h:12,
from ../drivers/md/dm-bufio.c:9:
../drivers/md/dm-bufio.c: In function 'alloc_buffer':
../include/linux/sched.h:1975:56: warning: 'noio_flag' may be used uninitialized in this function [-Wmaybe-uninitialized]
current->flags = (current->flags & ~PF_MEMALLOC_NOIO) | flags;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~../drivers/md/dm-bufio.c:325:11: note: 'noio_flag' was declared here
The warning disappeared on later kernels with this commit: be0c37c985ed ("MIPS: Rearrange PTE bits into fixed positions.") I assume this only happened because it changed some inlining decisions.
On 3.18.y, we can shut up the warning by adding an extra initialization.
--- drivers/md/dm-bufio.c | 1 + 1 file changed, 1 insertion(+)
drivers/md/dm-bufio.c +1 -0
@@ -349,6 +349,7 @@ static void *alloc_buffer_data(struct dm* as if GFP_NOIO was specified. */ + noio_flag =0 ;if (gfp_mask & __GFP_NORETRY) noio_flag =memalloc_noio_save ();
PATCH 233/294 scsi-tgt: fix type conversion warning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
In 3.16-stable, we get this warning:
drivers/scsi/scsi_tgt_if.c:289:36: warning: passing argument 1 of 'virt_to_phys' makes pointer from integer without a cast [-Wint-conversion]
The driver was removed in 3.17, so the bug was never fixed, but the code works correctly and is only lacking a cast to build cleanly on all architectures.
--- drivers/scsi/scsi_tgt_if.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/scsi_tgt_if.c +1 -1
@@ -286,7 +286,7 @@ static int uspace_ring_map(struct vm_areint i, err;for (i =0 ; i <TGT_RING_PAGES ; i++) { -struct page *page =virt_to_page (ring->tr_pages[i]); +struct page *page =virt_to_page ((void *)ring->tr_pages[i]); err =vm_insert_page (vma, addr, page);if (err)return err;
PATCH 234/294 ips: remove pointless #warning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: James Bottomley <[email protected]>
commit e03c2da6574223081b786960e39c1e5ecf5d492d upstream.
non-x86 builds want the #warning in the IPS code about compiling on the wrong architecture removed because it keeps triggering on their platforms build farms. Transform from a compile time warning into a runtime one with taint to preserve the original intent of the authors.
--- drivers/scsi/ips.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/scsi/ips.c +5 -4
@@ -206,10 +206,6 @@ module_param(ips, charp, 0);#define IPS_VERSION_HIGH IPS_VER_MAJOR_STRING "." IPS_VER_MINOR_STRING#define IPS_VERSION_LOW "." IPS_VER_BUILD_STRING " " -#if !defined(__i386__) && !defined(__ia64__) && !defined(__x86_64__) -#warning "This driver has only been tested on the x86/ia64/x86_64 platforms" -#endif -#define IPS_DMA_DIR (scb) ((!scb->scsi_cmd || ips_is_passthru(scb->scsi_cmd) || \ DMA_NONE == scb->scsi_cmd->sc_data_direction) ? \ PCI_DMA_BIDIRECTIONAL : \
@@ -6789,6 +6785,11 @@ ips_remove_device(struct pci_dev *pci_destatic int __init ips_module_init (void ) { +#if !defined(__i386__) && !defined(__ia64__) && !defined(__x86_64__) +printk (KERN_ERR "ips: This driver has only been tested on the x86/ia64/x86_64 platforms\n" ); +add_taint (TAINT_CPU_OUT_OF_SPEC ,LOCKDEP_STILL_OK ); +#endif +if (pci_register_driver (&ips_pci_driver) <0 )return -ENODEV ; ips_driver_template.module =THIS_MODULE ;
PATCH 235/294 scsi: advansys: remove #warning message
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
The advansys driver was converted to the proper DMA API in linux-4.2, but the 3.18-stable kernel still warns about this:
drivers/scsi/advansys.c:71:2: warning: #warning this driver is still not properly converted to the DMA API [-Wcpp]
The warning clearly is not helpful in 3.18 any more, it just clutters up the build log. This removes the warning instead, and clarifies the comment above it.
--- drivers/scsi/advansys.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/scsi/advansys.c +1 -2
@@ -49,7 +49,7 @@#include <scsi/scsi.h> #include <scsi/scsi_host.h> -/* FIXME: +/* Fixed in linux-4.2, not backported to 3.16: * * 1. Although all of the necessary command mapping places have the * appropriate dma_map.. APIs, the driver still processes its internal
@@ -68,7 +68,6 @@* 7. advansys_info is not safe against multiple simultaneous callers * 8. Add module_param to override ISA/VLB ioport array */ -#warning this driver is still not properly converted to the DMA API/* Enable driver /proc statistics. */ #define ADVANSYS_STATS
PATCH 236/294 bfa: Fix indentation
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Anil Gurumurthy <[email protected]>
commit b7f4d6343820af5c2dc3979e91d85e71e638cd3d upstream.
--- drivers/scsi/bfa/bfa_ioc.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
drivers/scsi/bfa/bfa_ioc.c +11 -11
@@ -3665,19 +3665,19 @@ bfa_cb_sfp_state_query(struct bfa_sfp_sif (sfp->state_query_cbfn) sfp->state_query_cbfn (sfp->state_query_cbarg, sfp->status); - sfp->media =NULL ; - } + sfp->media =NULL ; + } -if (sfp->portspeed) { - sfp->status =bfa_sfp_speed_valid (sfp, sfp->portspeed); -if (sfp->state_query_cbfn) - sfp->state_query_cbfn (sfp->state_query_cbarg, - sfp->status); - sfp->portspeed =BFA_PORT_SPEED_UNKNOWN ; - } +if (sfp->portspeed) { + sfp->status =bfa_sfp_speed_valid (sfp, sfp->portspeed); +if (sfp->state_query_cbfn) + sfp->state_query_cbfn (sfp->state_query_cbarg, + sfp->status); + sfp->portspeed =BFA_PORT_SPEED_UNKNOWN ; + } - sfp->state_query_lock =0 ; - sfp->state_query_cbfn =NULL ; + sfp->state_query_lock =0 ; + sfp->state_query_cbfn =NULL ; }/*
PATCH 237/294 be2iscsi: Fix bogus WARN_ON length check
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tim Gardner <[email protected]>
commit dd29dae00d39186890a5eaa2fe4ad8768bfd41a9 upstream.
drivers/scsi/be2iscsi/be_main.c: In function 'be_sgl_create_contiguous':drivers/scsi/be2iscsi/be_main.c:3187:18: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
WARN_ON(!length > 0);
gcc version 5.2.1
--- drivers/scsi/be2iscsi/be_main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/be2iscsi/be_main.c +1 -1
@@ -3152,7 +3152,7 @@ be_sgl_create_contiguous(void *virtual_a {WARN_ON (!virtual_address);WARN_ON (!physical_address); -WARN_ON (!length >0 ); +WARN_ON (!length);WARN_ON (!sgl); sgl->va = virtual_address;
PATCH 238/294 mvsas: fix misleading indentation
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Luis de Bethencourt <[email protected]>
commit 7789cd39274c51bf475411fe22a8ee7255082809 upstream.
Fix a smatch warning:drivers/scsi/mvsas/mv_sas.c:740 mvs_task_prep() warn: curly braces intended?
The code is correct, the indention is misleading. When the device is not ready we want to return SAS_PHY_DOWN. But current indentation makes it look like we only do so in the else branch of if (mvi_dev).
--- drivers/scsi/mvsas/mv_sas.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/scsi/mvsas/mv_sas.c +2 -2
@@ -737,8 +737,8 @@ static int mvs_task_prep(struct sas_taskmv_dprintk ("device %016llx not ready.\n" ,SAS_ADDR (dev->sas_addr)); - rc =SAS_PHY_DOWN ; -return rc; + rc =SAS_PHY_DOWN ; +return rc; } tei.port = dev->port->lldd_port;if (tei.port && !tei.port->port_attached && !tmf) {
PATCH 239/294 paride: fix the "verbose" module param
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 946e87981942552e526aca9cb6204f02a6c847cb upstream.
The verbose module parameter can be set to 2 for extremely verbose messages so the type should be int instead of bool.
--- drivers/block/paride/pg.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/block/paride/pg.c +2 -2
@@ -137,7 +137,7 @@*/ -static bool verbose =0 ; +static int verbose;static int major =PG_MAJOR ;static char *name =PG_NAME ;static int disable =0 ;
@@ -168,7 +168,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV,#include <asm/uaccess.h> -module_param (verbose, bool,0644 ); +module_param (verbose, int,0644 );module_param (major, int,0 );module_param (name, charp,0 );module_param_array (drive0, int,NULL ,0 );
PATCH 240/294 aic94xx: Skip reading user settings if flash is not found
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Hannes Reinecke <[email protected]>
commit 36dd5acd196574d41de3e81d8264df475bbb7123 upstream.
If no user settings are found it's pointless trying to
read them from flash. So skip that step.
This also fixes a compilation warning about uninitialized variables in aic94xx.
--- drivers/scsi/aic94xx/aic94xx_sds.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/scsi/aic94xx/aic94xx_sds.c +3 -2
@@ -983,7 +983,7 @@ static int asd_process_ctrl_a_user(struc {int err, i;u32 offs, size; -struct asd_ll_el *el; +struct asd_ll_el *el =NULL ;struct asd_ctrla_phy_settings *ps;struct asd_ctrla_phy_settings dflt_ps;
@@ -1004,6 +1004,7 @@ static int asd_process_ctrl_a_user(struc size =sizeof (struct asd_ctrla_phy_settings ); ps = &dflt_ps; + goto out_process; }if (size ==0 )
@@ -1028,7 +1029,7 @@ static int asd_process_ctrl_a_user(strucASD_DPRINTK ("couldn't find ctrla phy settings struct\n" ); goto out2; } - +out_process: err =asd_process_ctrla_phy_settings (asd_ha, ps);if (err) {ASD_DPRINTK ("couldn't process ctrla phy settings\n" );
PATCH 241/294 mtd: pmcmsp: use kstrndup instead of kmalloc+strncpy
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 906b268477bc03daaa04f739844c120fe4dbc991 upstream.
kernelci.org reports a warning for this driver, as it copies a local variable into a 'const char *' string:
drivers/mtd/maps/pmcmsp-flash.c:149:30: warning: passing argument 1 of 'strncpy' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
Using kstrndup() simplifies the code and avoids the warning.
--- drivers/mtd/maps/pmcmsp-flash.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/mtd/maps/pmcmsp-flash.c +1 -3
@@ -139,15 +139,13 @@ static int __init init_msp_flash(void) } msp_maps[i].bankwidth =1 ; - msp_maps[i].name =kmalloc (7 ,GFP_KERNEL ); + msp_maps[i].name =kstrndup (flash_name,7 ,GFP_KERNEL );if (!msp_maps[i].name) {iounmap (msp_maps[i].virt);kfree (msp_parts[i]); goto cleanup_loop; } - msp_maps[i].name =strncpy (msp_maps[i].name, flash_name,7 ); -for (j =0 ; j < pcnt; j++) { part_name[5 ] ='0' + i; part_name[7 ] ='0' + j;
PATCH 242/294 mtd: maps: rbtx4939-flash: delete an unused variable in rbtx4939_flash_remove
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Atsushi Nemoto <[email protected]>
commit e4c4c9c15ebe8ec03b7f5bf36e079052cc88217c upstream.
--- drivers/mtd/maps/rbtx4939-flash.c | 2 -- 1 file changed, 2 deletions(-)
drivers/mtd/maps/rbtx4939-flash.c +0 -2
@@ -35,8 +35,6 @@ static int rbtx4939_flash_remove(structreturn 0 ;if (info->mtd) { -struct rbtx4939_flash_data *pdata =dev_get_platdata (&dev->dev); -mtd_device_unregister (info->mtd);map_destroy (info->mtd); }
PATCH 243/294 xilinx: Fix compiler warning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Manuel Schölling <[email protected]>
commit 9f8b93cb32e088d3377c86fabb666b884bac0f12 upstream.
The time comparsion functions require arguments of type unsigned long instead of (signed) long.
--- drivers/net/ethernet/xilinx/ll_temac_main.c | 2 +- drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c | 2 +- drivers/net/ethernet/xilinx/xilinx_emaclite.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/xilinx/ll_temac_main.c +1 -1
@@ -72,7 +72,7 @@ void temac_iow(struct temac_local *lp, iint temac_indirect_busywait (struct temac_local *lp) { -long end = jiffies +2 ; +unsigned long end = jiffies +2 ;while (!(temac_ior (lp,XTE_RDY0_OFFSET ) &XTE_RDY0_HARD_ACS_RDY_MASK )) {if (time_before_eq (end, jiffies)) {
drivers/net/ethernet/xilinx/xilinx_axienet_mdio.c +1 -1
@@ -19,7 +19,7 @@/* Wait till MDIO interface is ready to accept a new transaction.*/ int axienet_mdio_wait_until_ready (struct axienet_local *lp) { -long end = jiffies +2 ; +unsigned long end = jiffies +2 ;while (!(axienet_ior (lp,XAE_MDIO_MCR_OFFSET ) &XAE_MDIO_MCR_READY_MASK )) {if (time_before_eq (end, jiffies)) {
drivers/net/ethernet/xilinx/xilinx_emaclite.c +1 -1
@@ -707,7 +707,7 @@ static irqreturn_t xemaclite_interrupt(istatic int xemaclite_mdio_wait (struct net_local *lp) { -long end = jiffies +2 ; +unsigned long end = jiffies +2 ;/* wait for the MDIO interface to not be busy or timeout after some time.
PATCH 244/294 i40e: Reduce stack in i40e_dbg_dump_desc
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Joe Perches <[email protected]>
commit e6c97234d1b18d4751671df15d52e29daa8a7ba8 upstream.
Reduce stack use by using kmemdup and not using a very large struct on stack.
In function ‘i40e_dbg_dump_desc’:
warning: the frame size of 8192 bytes is larger than 2048 bytes [-Wframe-larger-than=]
--- drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 30 +++++++++++++++----------- 1 file changed, 17 insertions(+), 13 deletions(-)
drivers/net/ethernet/intel/i40e/i40e_debugfs.c +17 -13
@@ -754,7 +754,7 @@ static void i40e_dbg_dump_desc(int cnt, {struct i40e_tx_desc *txd;union i40e_rx_desc *rxd; -struct i40e_ring ring; +struct i40e_ring *ring;struct i40e_vsi *vsi;int i;
@@ -773,29 +773,32 @@ static void i40e_dbg_dump_desc(int cnt, vsi_seid);return ; } -if (is_rx_ring) - ring = *vsi->rx_rings[ring_id]; -else - ring = *vsi->tx_rings[ring_id]; + + ring =kmemdup (is_rx_ring + ? vsi->rx_rings[ring_id] : vsi->tx_rings[ring_id], +sizeof (*ring),GFP_KERNEL ); +if (!ring) +return ; +if (cnt ==2 ) {dev_info (&pf->pdev->dev,"vsi = %02i %s ring = %02i\n" , vsi_seid, is_rx_ring ?"rx" :"tx" , ring_id); -for (i =0 ; i < ring.count; i++) { +for (i =0 ; i < ring->count; i++) {if (!is_rx_ring) { - txd =I40E_TX_DESC (&ring, i); + txd =I40E_TX_DESC (ring, i);dev_info (&pf->pdev->dev," d[%03i] = 0x%016llx 0x%016llx\n" , i, txd->buffer_addr, txd->cmd_type_offset_bsz); }else if (sizeof (union i40e_rx_desc ) ==sizeof (union i40e_16byte_rx_desc )) { - rxd =I40E_RX_DESC (&ring, i); + rxd =I40E_RX_DESC (ring, i);dev_info (&pf->pdev->dev," d[%03i] = 0x%016llx 0x%016llx\n" , i, rxd->read.pkt_addr, rxd->read.hdr_addr); }else { - rxd =I40E_RX_DESC (&ring, i); + rxd =I40E_RX_DESC (ring, i); dev_info(&pf->pdev->dev, " d[%03i] = 0x%016llx 0x%016llx 0x%016llx 0x%016llx\n", i, rxd->read.pkt_addr,
@@ -804,26 +807,26 @@ static void i40e_dbg_dump_desc(int cnt, } } }else if (cnt ==3 ) { -if (desc_n >= ring.count || desc_n <0 ) { +if (desc_n >= ring->count || desc_n <0 ) {dev_info (&pf->pdev->dev,"descriptor %d not found\n" , desc_n);return ; }if (!is_rx_ring) { - txd =I40E_TX_DESC (&ring, desc_n); + txd =I40E_TX_DESC (ring, desc_n);dev_info (&pf->pdev->dev,"vsi = %02i tx ring = %02i d[%03i] = 0x%016llx 0x%016llx\n" , vsi_seid, ring_id, desc_n, txd->buffer_addr, txd->cmd_type_offset_bsz); }else if (sizeof (union i40e_rx_desc ) ==sizeof (union i40e_16byte_rx_desc )) { - rxd =I40E_RX_DESC (&ring, desc_n); + rxd =I40E_RX_DESC (ring, desc_n);dev_info (&pf->pdev->dev,"vsi = %02i rx ring = %02i d[%03i] = 0x%016llx 0x%016llx\n" , vsi_seid, ring_id, desc_n, rxd->read.pkt_addr, rxd->read.hdr_addr); }else { - rxd =I40E_RX_DESC (&ring, desc_n); + rxd =I40E_RX_DESC (ring, desc_n); dev_info(&pf->pdev->dev, "vsi = %02i rx ring = %02i d[%03i] = 0x%016llx 0x%016llx 0x%016llx 0x%016llx\n", vsi_seid, ring_id, desc_n,
@@ -833,6 +836,7 @@ static void i40e_dbg_dump_desc(int cnt, }else {dev_info (&pf->pdev->dev,"dump desc rx/tx <vsi_seid> <ring_id> [<desc_n>]\n" ); } +kfree (ring); }/**
PATCH 245/294 mlx5: avoid build warnings on 32-bit
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 065bd8c28ba37d04c9a5b732173c1508954b1f58 upstream.
The mlx5 driver passes a string pointer in through a 'u64' variable, which on 32-bit machines causes a build warning:
drivers/net/ethernet/mellanox/mlx5/core/debugfs.c: In function 'qp_read_field':drivers/net/ethernet/mellanox/mlx5/core/debugfs.c:303:11: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
The code is in fact safe, so we can shut up the warning by adding extra type casts.
--- drivers/net/ethernet/mellanox/mlx5/core/debugfs.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/ethernet/mellanox/mlx5/core/debugfs.c +3 -3
@@ -300,11 +300,11 @@ static u64 qp_read_field(struct mlx5_cor param = qp->pid;break ;case QP_STATE : - param = (u64 )mlx5_qp_state_str (be32_to_cpu (ctx->flags) >>28 ); + param = (unsigned long )mlx5_qp_state_str (be32_to_cpu (ctx->flags) >>28 ); *is_str =1 ;break ;case QP_XPORT : - param = (u64 )mlx5_qp_type_str ((be32_to_cpu (ctx->flags) >>16 ) &0xff ); + param = (unsigned long )mlx5_qp_type_str ((be32_to_cpu (ctx->flags) >>16 ) &0xff ); *is_str =1 ;break ;case QP_MTU :
@@ -464,7 +464,7 @@ static ssize_t dbg_read(struct file *filif (is_str) - ret =snprintf (tbuf,sizeof (tbuf),"%s\n" , (const char *)field); + ret =snprintf (tbuf,sizeof (tbuf),"%s\n" , (const char *)(unsigned long )field);else ret =snprintf (tbuf,sizeof (tbuf),"0x%llx\n" , field);
PATCH 246/294 mISDN: avoid arch specific __builtin_return_address call
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 3e7a8716e20b759eec0ad88145255bb33174f0c8 upstream.
Not all architectures are able to call __builtin_return_address(). On ARM, the mISDN code produces this warning:
hardware/mISDN/w6692.c: In function 'w6692_dctrl':hardware/mISDN/w6692.c:1181:75: warning: unsupported argument to '__builtin_return_address'
pr_debug("%s: %s dev(%d) open from %p\n", card->name, __func__,
^
hardware/mISDN/mISDNipac.c: In function 'open_dchannel':
hardware/mISDN/mISDNipac.c:759:75: warning: unsupported argument to '__builtin_return_address'
pr_debug("%s: %s dev(%d) open from %p\n", isac->name, __func__,
^In a lot of cases, this is relatively easy to work around by passing the value of __builtin_return_address(0) from the callers into the functions that want it. One exception is the indirect 'open' function call in struct isac_hw. While it would be possible to fix this as well, this patch only addresses the other callers properly and lets this one return the direct parent function, which should be good enough.
--- drivers/isdn/hardware/mISDN/mISDNipac.c | 12 +++++++++--- drivers/isdn/hardware/mISDN/w6692.c | 6 +++--- 2 files changed, 12 insertions(+), 6 deletions(-)
drivers/isdn/hardware/mISDN/mISDNipac.c +9 -3
@@ -754,10 +754,10 @@ dbusy_timer_handler(struct isac_hw *isac }static int -open_dchannel (struct isac_hw *isac,struct channel_req *rq) +open_dchannel_caller (struct isac_hw *isac,struct channel_req *rq,void *caller) {pr_debug ("%s: %s dev(%d) open from %p\n" , isac->name, __func__, - isac->dch.dev.id,__builtin_return_address (1 )); + isac->dch.dev.id, caller);if (rq->protocol !=ISDN_P_TE_S0 )return -EINVAL ;if (rq->adr.channel ==1 )
@@ -771,6 +771,12 @@ open_dchannel(struct isac_hw *isac, strureturn 0 ; } +static int +open_dchannel (struct isac_hw *isac,struct channel_req *rq) +{ +return open_dchannel_caller (isac, rq,__builtin_return_address (0 )); +} +static const char *ISACVer[] = {"2086/2186 V1.1" ,"2085 B1" ,"2085 B2" ,"2085 V2.3" };
@@ -1547,7 +1553,7 @@ ipac_dctrl(struct mISDNchannel *ch, u32case OPEN_CHANNEL : rq = arg;if (rq->protocol ==ISDN_P_TE_S0 ) - err =open_dchannel (isac, rq); + err =open_dchannel_caller (isac, rq,__builtin_return_address (0 ));else err =open_bchannel (ipac, rq);if (err)
drivers/isdn/hardware/mISDN/w6692.c +3 -3
@@ -1176,10 +1176,10 @@ w6692_l1callback(struct dchannel *dch, u }static int -open_dchannel (struct w6692_hw *card,struct channel_req *rq) +open_dchannel (struct w6692_hw *card,struct channel_req *rq,void *caller) {pr_debug ("%s: %s dev(%d) open from %p\n" , card->name, __func__, - card->dch.dev.id,__builtin_return_address (1 )); + card->dch.dev.id, caller);if (rq->protocol !=ISDN_P_TE_S0 )return -EINVAL ;if (rq->adr.channel ==1 )
@@ -1207,7 +1207,7 @@ w6692_dctrl(struct mISDNchannel *ch, u32case OPEN_CHANNEL : rq = arg;if (rq->protocol ==ISDN_P_TE_S0 ) - err =open_dchannel (card, rq); + err =open_dchannel (card, rq,__builtin_return_address (0 ));else err =open_bchannel (card, rq);if (err)
PATCH 247/294 cpmac: remove hopeless #warning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit d43e6fb4ac4abfe4ef7c102833ed02330ad701e0 upstream.
The #warning was present 10 years ago when the driver first got merged. As the platform is rather obsolete by now, it seems very unlikely that the warning will cause anyone to fix the code properly.
kernelci.org reports the warning for every build in the meantime, so I think it's better to just turn it into a code comment to reduce noise.
--- drivers/net/ethernet/ti/cpmac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/ti/cpmac.c +1 -1
@@ -1226,7 +1226,7 @@ int cpmac_init(void) goto fail_alloc; } -#warning FIXME: unhardcode gpio&reset bits +/* FIXME: unhardcode gpio&reset bits */ ar7_gpio_disable (26 );ar7_gpio_disable (27 );ar7_device_reset (AR7_RESET_BIT_CPMAC_LO );
PATCH 248/294 net: caif: fix misleading indentation
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 8e0cc8c326d99e41468c96fea9785ab78883a281 upstream.
gcc points out code that is not indented the way it is interpreted:
net/caif/cfpkt_skbuff.c: In function 'cfpkt_setlen':net/caif/cfpkt_skbuff.c:289:4: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
return cfpkt_getlen(pkt);
^~~~~~net/caif/cfpkt_skbuff.c:286:3: note: ...this 'else' clause, but it is not
else
^~~~
It is clear from the context that not returning here would be a bug, as we'd end up passing a negative length into a function that takes a u16 length, so it is not missing curly braces here, and I'm assuming that the indentation is the only part that's wrong about it.
--- net/caif/cfpkt_skbuff.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/caif/cfpkt_skbuff.c +1 -1
@@ -286,7 +286,7 @@ int cfpkt_setlen(struct cfpkt *pkt, u16else skb_trim (skb, len); -return cfpkt_getlen (pkt); +return cfpkt_getlen (pkt); }/* Need to expand SKB */
PATCH 249/294 net: am2150: fix nmclan_cs.c shared interrupt handling
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 96a30175f927facfb421655ef08b7a0fe546fbed upstream.
A recent patch tried to work around a valid warning for the use of a deprecated interface by blindly changing from the old pcmcia_request_exclusive_irq() interface to pcmcia_request_irq().
This driver has an interrupt handler that is not currently aware of shared interrupts, but can be easily converted to be. At the moment, the driver reads the interrupt status register repeatedly until it contains only zeroes in the interesting bits, and handles each bit individually.
This patch adds the missing part of returning IRQ_NONE in case none of the bits are set to start with, so we can move on to the next interrupt source.
--- drivers/net/ethernet/amd/nmclan_cs.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/net/ethernet/amd/nmclan_cs.c +2 -0
@@ -952,6 +952,8 @@ static irqreturn_t mace_interrupt(int ir do { /* WARNING: MACE_IR is a READ/CLEAR port! */ status = inb(ioaddr + AM2150_MACE_BASE + MACE_IR); + if (!(status & ~MACE_IMR_DEFAULT) && IntrCnt == MACE_MAX_IR_ITERATIONS) + return IRQ_NONE; pr_debug("mace_interrupt: irq 0x%X status 0x%X.\n", irq, status);
PATCH 250/294 am2150: Update nmclan_cs.c to use update PCMCIA API
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Kirsher <[email protected]>
commit 5f5316fcd08ef74b282adf6774956431fac62663 upstream.
Resolves compile warning about use of a deprecated function call:drivers/net/ethernet/amd/nmclan_cs.c: In function ‘nmclan_config’:drivers/net/ethernet/amd/nmclan_cs.c:624:3: warning: ‘pcmcia_request_exclusive_irq’ is deprecated (declared at include/pcmcia/ds.h:213) [-Wdeprecated-declarations]
ret = pcmcia_request_exclusive_irq(link, mace_interrupt);
Updates pcmcia_request_exclusive_irq() to pcmcia_request_irq().
--- drivers/net/ethernet/amd/nmclan_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/amd/nmclan_cs.c +1 -1
@@ -621,7 +621,7 @@ static int nmclan_config(struct pcmcia_d ret =pcmcia_request_io (link);if (ret) goto failed; - ret =pcmcia_request_exclusive_irq (link, mace_interrupt); + ret =pcmcia_request_irq (link, mace_interrupt);if (ret) goto failed; ret =pcmcia_enable_device (link);
PATCH 251/294 net: tulip: turn compile-time warning into dev_warn()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit de92718883ddbcd11b738d36ffcf57617b97fa12 upstream.
The tulip driver causes annoying build-time warnings for allmodconfig builds for all recent architectures:
dec/tulip/winbond-840.c:910:2: warning: #warning Processor architecture undefined dec/tulip/tulip_core.c:101:2: warning: #warning Processor architecture undefined!
This is the last remaining warning for arm64, and I'd like to get rid of it. We don't really know the cache line size, architecturally it would be at least 16 bytes, but all implementations I found have 64 or 128 bytes. Configuring tulip for 32-byte lines as we do on ARM32 seems to be the safe but slow default, and nobody who cares about performance these days would use a tulip chip anyway, so we can just use that.
To save the next person the job of trying to find out what this is for and picking a default for their architecture just to kill off the warning, I'm now removing the preprocessor #warning and turning it into a pr_warn or dev_warn that prints the equivalent information when the driver gets loaded.
--- drivers/net/ethernet/dec/tulip/tulip_core.c | 9 +++++++-- drivers/net/ethernet/dec/tulip/winbond-840.c | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-)
drivers/net/ethernet/dec/tulip/tulip_core.c +7 -2
@@ -98,8 +98,7 @@ static int csr0 = 0x01A00000 | 0x4800;#elif defined(__mips__)static int csr0 =0x00200000 |0x4000 ;#else -#warning Processor architecture undefined! -static int csr0 =0x00A00000 |0x4800 ; +static int csr0;#endif /* Operational parameters that usually are not changed. */
@@ -1982,6 +1981,12 @@ static int __init tulip_init (void)pr_info ("%s" , version);#endif +if (!csr0) { +pr_warn ("tulip: unknown CPU architecture, using default csr0\n" ); +/* default to 8 longword cache line alignment */ + csr0 =0x00A00000 |0x4800 ; + } +/* copy module parms into globals */ tulip_rx_copybreak = rx_copybreak; tulip_max_interrupt_work = max_interrupt_work;
drivers/net/ethernet/dec/tulip/winbond-840.c +1 -1
@@ -907,7 +907,7 @@ static void init_registers(struct net_de#elif defined(CONFIG_SPARC ) || defined (CONFIG_PARISC ) i |=0x4800 ;#else -#warning Processor architecture undefined +dev_warn (&dev->dev,"unknown CPU architecture, using default csr0 setting\n" ); i |=0x4800 ;#endif iowrite32 (i, ioaddr + PCIBusCfg);
PATCH 252/294 net: vxge: avoid unused function warnings
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 57e7c8cef224af166b8ec932b5e383641418c005 upstream.
When CONFIG_PCI_MSI is disabled, we get warnings about unused functions in the vxge driver:
drivers/net/ethernet/neterion/vxge/vxge-main.c:2121:13: warning: 'adaptive_coalesce_tx_interrupts' defined but not used [-Wunused-function] drivers/net/ethernet/neterion/vxge/vxge-main.c:2149:13: warning: 'adaptive_coalesce_rx_interrupts' defined but not used [-Wunused-function]
We could add another #ifdef here, but it's nicer to avoid those warnings for good by converting the existing #ifdef to if(IS_ENABLED()), which has the same effect but provides better compile-time coverage in general, and lets the compiler understand better when the function is intentionally unused.
--- drivers/net/ethernet/neterion/vxge/vxge-main.c | 31 ++++++++++---------------- 1 file changed, 12 insertions(+), 19 deletions(-)
drivers/net/ethernet/neterion/vxge/vxge-main.c +12 -19
@@ -2224,8 +2224,6 @@ static irqreturn_t vxge_isr_napi(int irqreturn IRQ_NONE ; } -#ifdef CONFIG_PCI_MSI -static irqreturn_t vxge_tx_msix_handle (int irq,void *dev_id) {struct vxge_fifo *fifo = (struct vxge_fifo *)dev_id;
@@ -2443,16 +2441,13 @@ static void vxge_rem_msix_isr(struct vxgif (vdev->config.intr_type ==MSI_X )pci_disable_msix (vdev->pdev); } -#endif static void vxge_rem_isr (struct vxgedev *vdev) { -#ifdef CONFIG_PCI_MSI -if (vdev->config.intr_type ==MSI_X ) { +if (IS_ENABLED (CONFIG_PCI_MSI ) && + vdev->config.intr_type ==MSI_X ) {vxge_rem_msix_isr (vdev); - } else -#endif -if (vdev->config.intr_type ==INTA ) { + }else if (vdev->config.intr_type ==INTA ) {synchronize_irq (vdev->pdev->irq);free_irq (vdev->pdev->irq, vdev); }
@@ -2461,11 +2456,10 @@ static void vxge_rem_isr(struct vxgedevstatic int vxge_add_isr (struct vxgedev *vdev) {int ret =0 ; -#ifdef CONFIG_PCI_MSI int vp_idx =0 , intr_idx =0 , intr_cnt =0 , msix_idx =0 , irq_req =0 ;int pci_fun =PCI_FUNC (vdev->pdev->devfn); -if (vdev->config.intr_type ==MSI_X ) +if (IS_ENABLED (CONFIG_PCI_MSI ) && vdev->config.intr_type ==MSI_X ) ret =vxge_enable_msix (vdev);if (ret) {
@@ -2476,7 +2470,7 @@ static int vxge_add_isr(struct vxgedev * vdev->config.intr_type =INTA ; } -if (vdev->config.intr_type ==MSI_X ) { +if (IS_ENABLED (CONFIG_PCI_MSI ) && vdev->config.intr_type ==MSI_X ) {for (intr_idx =0 ; intr_idx < (vdev->no_of_vpath *VXGE_HW_VPATH_MSIX_ACTIVE ); intr_idx++) {
@@ -2577,9 +2571,8 @@ static int vxge_add_isr(struct vxgedev * vdev->vxge_entries[intr_cnt].in_use =1 ; vdev->vxge_entries[intr_cnt].arg = &vdev->vpaths[0 ]; } -INTA_MODE: -#endif +INTA_MODE:if (vdev->config.intr_type ==INTA ) {snprintf (vdev->desc[0 ],VXGE_INTR_STRLEN ,"%s:vxge:INTA" , vdev->ndev->name);
@@ -3890,12 +3883,12 @@ static void vxge_device_config_init(struif (max_mac_vpath >VXGE_MAX_MAC_ADDR_COUNT ) max_mac_vpath =VXGE_MAX_MAC_ADDR_COUNT ; -#ifndef CONFIG_PCI_MSI -vxge_debug_init (VXGE_ERR , -"%s: This Kernel does not support " -"MSI-X. Defaulting to INTA" ,VXGE_DRIVER_NAME ); - *intr_type =INTA ; -#endif +if (!IS_ENABLED (CONFIG_PCI_MSI )) { +vxge_debug_init (VXGE_ERR , +"%s: This Kernel does not support " +"MSI-X. Defaulting to INTA" ,VXGE_DRIVER_NAME ); + *intr_type =INTA ; + }/* Configure whether MSI-X or IRQL. */ switch (*intr_type) {
PATCH 253/294 drivers/net/ethernet/dec/tulip/uli526x.c: fix misleading indentation in uli526x_timer
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: David Malcolm <[email protected]>
commit e1395a321eab1a7833d82e952eb8255e0a1f03cb upstream.
This code in drivers/net/ethernet/dec/tulip/uli526x.c function "uli526x_timer":
1086 } else
1087 if ((tmp_cr12 & 0x3) && db->link_failed) {
[...snip...]
1109 }
1110 else if(!(tmp_cr12 & 0x3) && db->link_failed)
1111 {
[...snip...]
1117 }
1118 db->init=0;is misleadingly indented: the
db->init=0
is indented as if part of the else clause at line 1086, but it is independent of it (no braces before the "if" at line 1087).
This patch fixes the indentation to reflect the actual meaning of the code, though is it actually meant to be part of the "else" clause? (I'm a compiler developer, not a kernel person). It also adds spaces around the assignment, to placate checkpatch.pl.
Seen via an experimental new gcc warning I'm working on for gcc 6, -Wmisleading-indentation, using gcc r223098 adding -Werror=misleading-indentation to KBUILD_CFLAGS in Makefile. The experimental GCC emits this warning (as an error), rightly IMHO:
drivers/net/ethernet/dec/tulip/uli526x.c: In function ‘uli526x_timer’:drivers/net/ethernet/dec/tulip/uli526x.c:1118:3: error: statement is indented as if it were guarded by... [-Werror=misleading-indentation]
db->init=0;
^
drivers/net/ethernet/dec/tulip/uli526x.c:1086:4: note: ...this ‘else’
clause, but it is not
} else
^Hope this is helpful
Dave
--- drivers/net/ethernet/dec/tulip/uli526x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/dec/tulip/uli526x.c +1 -1
@@ -1115,7 +1115,7 @@ static void uli526x_timer(unsigned longnetif_carrier_off (dev); } } - db->init=0 ; + db->init =0 ;/* Timer active again */ db->timer.expires =ULI526X_TIMER_WUT ;
PATCH 254/294 hostap: avoid uninitialized variable use in hfa384x_get_rid
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 48dc5fb3ba53b20418de8514700f63d88c5de3a3 upstream.
The driver reads a value from hfa384x_from_bap(), which may fail, and then assigns the value to a local variable. gcc detects that in in the failure case, the 'rlen' variable now contains uninitialized data:
In file included from ../drivers/net/wireless/intersil/hostap/hostap_pci.c:220:0:drivers/net/wireless/intersil/hostap/hostap_hw.c: In function 'hfa384x_get_rid':drivers/net/wireless/intersil/hostap/hostap_hw.c:842:5: warning: 'rec' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (le16_to_cpu(rec.len) == 0) {
This restructures the function as suggested by Russell King, to make it more readable and get more reliable error handling, by handling each failure mode using a goto.
--- drivers/net/wireless/hostap/hostap_hw.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/net/wireless/hostap/hostap_hw.c +10 -5
@@ -836,25 +836,30 @@ static int hfa384x_get_rid(struct net_despin_lock_bh (&local->baplock); res =hfa384x_setup_bap (dev,BAP0 , rid,0 ); -if (!res) - res =hfa384x_from_bap (dev,BAP0 , &rec,sizeof (rec)); +if (res) + goto unlock; + + res =hfa384x_from_bap (dev,BAP0 , &rec,sizeof (rec)); +if (res) + goto unlock;if (le16_to_cpu (rec.len) ==0 ) {/* RID not available */ res = -ENODATA ; + goto unlock; } rlen = (le16_to_cpu (rec.len) -1 ) *2 ; -if (!res && exact_len && rlen != len) { +if (exact_len && rlen != len) {printk (KERN_DEBUG "%s: hfa384x_get_rid - RID len mismatch: " "rid=0x%04x, len=%d (expected %d)\n" , dev->name, rid, rlen, len); res = -ENODATA ; } -if (!res) - res =hfa384x_from_bap (dev,BAP0 , buf, len); + res =hfa384x_from_bap (dev,BAP0 , buf, len); +unlock:spin_unlock_bh (&local->baplock);mutex_unlock (&local->rid_bap_mtx);
PATCH 255/294 iwlegacy: avoid warning about missing braces
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 2cce76c3fab410520610a7d2f52faebc3cfcf843 upstream.
gcc-6 warns about code in il3945_hw_txq_ctx_free() being somewhat ambiguous:
drivers/net/wireless/intel/iwlegacy/3945.c:1022:5: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]
This adds a set of curly braces to avoid the warning.
--- drivers/net/wireless/iwlegacy/3945.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/iwlegacy/3945.c +2 -1
@@ -1019,12 +1019,13 @@ il3945_hw_txq_ctx_free(struct il_priv *iint txq_id;/* Tx queues */ -if (il->txq) +if (il->txq) {for (txq_id =0 ; txq_id < il->hw_params.max_txq_num; txq_id++)if (txq_id ==IL39_CMD_QUEUE_NUM )il_cmd_queue_free (il);else il_tx_queue_free (il, txq_id); + }/* free tx queue structure */ il_free_txq_mem (il);
PATCH 256/294 brcmfmac: avoid gcc-5.1 warning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 22f44150aad7a1d6b074ab6cf59abee61c7187c6 upstream.
gcc-5.0 gained a new warning in the fwsignal portion of the brcmfmac driver:
drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c: In function 'brcmf_fws_txs_process':drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c:1478:8: warning: 'skb' may be used uninitialized in this function [-Wmaybe-uninitialized]
This is a false positive, and marking the brcmf_fws_hanger_poppkt function as 'static inline' makes the warning go away. I have checked the object file output and while a little code gets moved around, the size of the binary remains identical.
--- drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c +1 -1
@@ -607,7 +607,7 @@ static int brcmf_fws_hanger_pushpkt(strureturn 0 ; } -static int brcmf_fws_hanger_poppkt (struct brcmf_fws_hanger *h, +static inline int brcmf_fws_hanger_poppkt (struct brcmf_fws_hanger *h,u32 slot_id,struct sk_buff **pktout,bool remove_item) {
PATCH 257/294 netfilter: Fix switch statement warnings with recent gcc.
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: David Miller <[email protected]>
commit c1f866767777d1c6abae0ec57effffcb72017c00 upstream.
More recent GCC warns about two kinds of switch statement uses:
1) Switching on an enumeration, but not having an explicit case statement for all members of the enumeration. To show the compiler this is intentional, we simply add a default case with nothing more than a break statement.
2) Switching on a boolean value. I think this warning is dumb but nevertheless you get it wholesale with -Wswitch.
This patch cures all such warnings in netfilter.
--- net/ipv4/netfilter/nft_reject_ipv4.c | 2 ++ net/ipv6/netfilter/nft_reject_ipv6.c | 2 ++ net/netfilter/nft_compat.c | 6 +++--- net/netfilter/nft_ct.c | 8 ++++++++ 4 files changed, 15 insertions(+), 3 deletions(-)
net/ipv4/netfilter/nft_reject_ipv4.c +2 -0
@@ -33,6 +33,8 @@ void nft_reject_ipv4_eval(const struct ncase NFT_REJECT_TCP_RST :nf_send_reset (pkt->skb, pkt->ops->hooknum);break ; +default : +break ; } data[NFT_REG_VERDICT ].verdict =NF_DROP ;
net/ipv6/netfilter/nft_reject_ipv6.c +2 -0
@@ -34,6 +34,8 @@ void nft_reject_ipv6_eval(const struct ncase NFT_REJECT_TCP_RST :nf_send_reset6 (net, pkt->skb, pkt->ops->hooknum);break ; +default : +break ; } data[NFT_REG_VERDICT ].verdict =NF_DROP ;
net/netfilter/nft_compat.c +3 -3
@@ -295,11 +295,11 @@ static void nft_match_eval(const structreturn ; } -switch (ret) { -case true: +switch (ret ?1 :0 ) { +case 1 : data[NFT_REG_VERDICT ].verdict =NFT_CONTINUE ;break ; -case false: +case 0 : data[NFT_REG_VERDICT ].verdict =NFT_BREAK ;break ; }
net/netfilter/nft_ct.c +8 -0
@@ -56,6 +56,8 @@ static void nft_ct_get_eval(const struct state =NF_CT_STATE_BIT (ctinfo); dest->data[0 ] = state;return ; +default : +break ; }if (ct ==NULL )
@@ -117,6 +119,8 @@ static void nft_ct_get_eval(const struct return; }#endif +default : +break ; } tuple = &ct->tuplehash[priv->dir].tuple;
@@ -141,6 +145,8 @@ static void nft_ct_get_eval(const structcase NFT_CT_PROTO_DST : dest->data[0 ] = (__force __u16 )tuple->dst.u.all;return ; +default : +break ; }return ; err:
@@ -172,6 +178,8 @@ static void nft_ct_set_eval(const struct }break ;#endif +default : +break ; } }
PATCH 258/294 netfilter; Add some missing default cases to switch statements in nft_reject.
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "David S. Miller" <[email protected]>
commit 129d23a56623eea0947a05288158d76dc7f2f0ac upstream.
This fixes:
====================net/netfilter/nft_reject.c: In function ‘nft_reject_dump’:net/netfilter/nft_reject.c:61:2: warning: enumeration value ‘NFT_REJECT_TCP_RST’ not handled in switch [-Wswitch]
switch (priv->type) {
^net/netfilter/nft_reject.c:61:2: warning: enumeration value ‘NFT_REJECT_ICMPX_UNREACH’ not handled in switch [-Wswi\
tch]net/netfilter/nft_reject_inet.c: In function ‘nft_reject_inet_dump’:net/netfilter/nft_reject_inet.c:105:2: warning: enumeration value ‘NFT_REJECT_TCP_RST’ not handled in switch [-Wswi\
tch]
switch (priv->type) {
^
====================
--- net/netfilter/nft_reject.c | 2 ++ 1 file changed, 2 insertions(+)
net/netfilter/nft_reject.c +2 -0
@@ -61,6 +61,8 @@ int nft_reject_dump(struct sk_buff *skb,if (nla_put_u8 (skb,NFTA_REJECT_ICMP_CODE , priv->icmp_code)) goto nla_put_failure;break ; +default : +break ; }return 0 ;
PATCH 259/294 drm/i915: cleanup some indenting
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit ba0635ffb7665d76715b43ae8144e014a90c1e63 upstream.
Static checkers complain that we should probably add curly braces because, from the indenting, it looks like seq_printf() should be inside the list_for_each_entry() loop. But the code is actually correct, it's just the indenting which is off.
Besides fixing the indenting on seq_printf(), I did add curly braces, because generally mult-line indents should have curly braces to make them more readable.
The unintended indent was left behind and not unindented in
commit d7f46fc4e7323887494db13f063a8e59861fefb0
Author: Ben Widawsky <[email protected]> Date: Fri Dec 6 14:10:55 2013 -0800
drm/i915: Make pin count per VMA
--- drivers/gpu/drm/i915/i915_debugfs.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +3 -2
@@ -141,10 +141,11 @@ describe_obj(struct seq_file *m, struct obj->madv == I915_MADV_DONTNEED ? " purgeable" : "");if (obj->base.name)seq_printf (m," (name: %d)" , obj->base.name); -list_for_each_entry (vma, &obj->vma_list, vma_link) +list_for_each_entry (vma, &obj->vma_list, vma_link) {if (vma->pin_count >0 ) pin_count++; -seq_printf (m," (pinned x %d)" , pin_count); + } +seq_printf (m," (pinned x %d)" , pin_count);if (obj->pin_display)seq_printf (m," (display)" );if (obj->fence_reg !=I915_FENCE_REG_NONE )
PATCH 260/294 video: mx3fb: always enable BACKLIGHT_LCD_SUPPORT
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 9c8ee3c7341393811d5be5eb61b815e76f92c799 upstream.
Commit 7edaa761ee81b ("video: mx3fb: Add backlight control support") changed the mx3fb driver so it always selects the BACKLIGHT_CLASS_DEVICE symbol, but that is hidden behind BACKLIGHT_LCD_SUPPORT in Kconfig, so we get a Kconfig warning for multi_v5_defconfig, which doesn't have that:
Warning: (DRM_RADEON && DRM_NOUVEAU && DRM_I915 && DRM_GMA500 && DRM_SHMOBILE && DRM_TILCDC && FB_BACKLIGHT && FB_MX3 && USB_APPLEDISPLAY && FB_OLPC_DCON && ASUS_LAPTOP && SONY_LAPTOP && THINKPAD_ACPI && EEEPC_LAPTOP && ACPI_CMPC && SAMSUNG_Q10) selects BACKLIGHT_CLASS_DEVICE which has unmet direct dependencies (HAS_IOMEM && BACKLIGHT_LCD_SUPPORT)
This makes sure we always enable both symbols together for mx3fb, like we do for the other drivers that can't be built without backlight support. Note that a better solution would be to ensure the driver can work with or without backlight support.
--- drivers/video/fbdev/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/video/fbdev/Kconfig +2 -1
@@ -2330,10 +2330,11 @@ config FB_MSM config FB_MX3 tristate "MX3 Framebuffer support" depends on FB && MX3_IPU + select BACKLIGHT_CLASS_DEVICE + select BACKLIGHT_LCD_SUPPORT select FB_CFB_FILLRECT select FB_CFB_COPYAREA select FB_CFB_IMAGEBLIT - select BACKLIGHT_CLASS_DEVICE default y help This is a framebuffer device for the i.MX31 LCD Controller. So
PATCH 261/294 staging: bcm: add 32-bit host dependency
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
The driver uses a 32-bit variable to store a pointer, causing a couple of warnings:
../drivers/staging/bcm/CmHost.c: In function 'StoreCmControlResponseMessage':../drivers/staging/bcm/CmHost.c:1503:3: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
(struct bcm_connect_mgr_params *) ntohl(
^../drivers/staging/bcm/CmHost.c:1546:3: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
(struct bcm_connect_mgr_params *) ntohl(
^../drivers/staging/bcm/CmHost.c:1564:3: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast]
(struct bcm_connect_mgr_params *) ntohl(
I fixed other warnings in an earlier commit 9f1c75ac2dba ("staging/bcm: fix most build warnings"), but couldn't figure out what was the intended behavior on 64-bit machines here.
The driver was removed in linux-3.19, commit d09e9b160fc1 ("staging: bcm: remove driver") which explains that it never worked on 64-bit machines. This adds a Kconfig dependency instead to prevent it from being built in the known broken configuration. This workaround applies to v2.6.37 or higher.
--- drivers/staging/bcm/Kconfig | 1 + 1 file changed, 1 insertion(+)
drivers/staging/bcm/Kconfig +1 -0
@@ -1,6 +1,7 @@ config BCM_WIMAX tristate "Beceem BCS200/BCS220-3 and BCSM250 wimax support" depends on USB && NET + depends on !64BIT help This is an experimental driver for the Beceem WIMAX chipset used by Sprint 4G.
PATCH 262/294 staging: imx-drm: fix indentation warning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
gcc-6 produces a harmless warning:
drivers/staging/imx-drm/imx-hdmi.c: In function 'hdmi_config_AVI':drivers/staging/imx-drm/imx-hdmi.c:967:2: error: this 'else' clause does not guard... [-Werror=misleading-indentation]
Commit d083c312cba2 ("drm: bridge/dw_hdmi: simplify hdmi_config_AVI() a little") in linux-4.3 fixes this with a larger rewrite that is not applicable here. After that rewrite, the variable that gets assigned here no longer exists.
The assignment is rather pointless here, as we just set a variable to zero that is later added into another variable using a bitwise or operator, and that has no effect, so I'm just changing the indentation here to shut up the warning.
The driver was originally merged in linux-3.13, and the fix applies to all versions between that and 4.2.
--- drivers/staging/imx-drm/imx-hdmi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/imx-drm/imx-hdmi.c +1 -1
@@ -968,7 +968,7 @@ static void hdmi_config_AVI(struct imx_helse pix_fmt =HDMI_FC_AVICONF0_PIX_FMT_RGB ; - under_scan =HDMI_FC_AVICONF0_SCAN_INFO_NODATA ; + under_scan =HDMI_FC_AVICONF0_SCAN_INFO_NODATA ;/* * Active format identification data is present in the AVI InfoFrame.
PATCH 263/294 staging: vt6655: fix overly large stack usage
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
We get a warning for the large stack usage in some configurations:
drivers/staging/vt6655/device_main.c: In function 'device_ioctl':drivers/staging/vt6655/device_main.c:2974:1: warning: the frame size of 1304 bytes is larger than 1024 bytes [-Wframe-larger-than=]
This is addressed in linux-3.19 with commit 67013f2c0e58 ("staging: vt6655:
mac80211 conversion add main mac80211 functions"), which obsoletes the device_ioctl() function, but as that does not apply to stable kernels, this picks an easier way out by using dynamic allocation.
The driver was merged in 2.6.31, and the fix applies to all versions before 3.19.
--- drivers/staging/vt6655/device_main.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
drivers/staging/vt6655/device_main.c +6 -4
@@ -2933,11 +2933,13 @@ static int device_ioctl(struct net_deviDBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO " SIOCSIWSENS \n" ); rc = -EOPNOTSUPP ;break ; -case SIOCGIWAPLIST : { -char buffer[IW_MAX_AP * (sizeof (struct sockaddr ) +sizeof (struct iw_quality ))]; +char *buffer =kzalloc (IW_MAX_AP * (sizeof (struct sockaddr ) + +sizeof (struct iw_quality )),GFP_KERNEL ); -if (wrq->u.data.pointer) { +if (!buffer) { + rc = -ENOMEM ; + }else if (wrq->u.data.pointer) { rc =iwctl_giwaplist (dev,NULL , &(wrq->u.data), buffer);if (rc ==0 ) { if (copy_to_user(wrq->u.data.pointer,
@@ -2947,6 +2949,7 @@ static int device_ioctl(struct net_devi rc = -EFAULT ; } } +kfree (buffer); }break ;
@@ -2993,7 +2996,6 @@ static int device_ioctl(struct net_deviDBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO " SIOCGIWGENIE \n" ); rc =iwctl_giwgenie (dev,NULL , &(wrq->u.data), wrq->u.data.pointer);break ; -case SIOCSIWENCODEEXT : {char extra[sizeof (struct iw_encode_ext )+MAX_KEY_LEN +1 ];DBG_PRT (MSG_LEVEL_DEBUG ,KERN_INFO " SIOCSIWENCODEEXT \n" );
PATCH 264/294 Staging: iio: adc: fix indent on break statement
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit b6acb0cfc21293a1bfc283e9217f58f7474ef728 upstream.
Fix indent warning when building with gcc 6:drivers/staging/iio/adc/ad7192.c:239:4: warning: statement is indented
as if it were guarded by... [-Wmisleading-indentation]
--- drivers/staging/iio/adc/ad7192.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/iio/adc/ad7192.c +1 -1
@@ -236,7 +236,7 @@ static int ad7192_setup(struct ad7192_st st->mclk = pdata->ext_clk_Hz; else st->mclk = AD7192_INT_FREQ_MHz; -break ; +break ;default : ret = -EINVAL ; goto out;
PATCH 265/294 Staging: lustre: missing curly braces in ll_setattr_raw()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 53bd4a004ee5ff0f71a858de78faac98924b4a87 upstream.
Quoted 1 line
Quoted 1 line
From the indenting, it looks like curly braces were intended here.
--- drivers/staging/lustre/lustre/llite/llite_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/staging/lustre/lustre/llite/llite_lib.c +2 -1
@@ -1489,7 +1489,7 @@ int ll_setattr_raw(struct dentry *dentryif (attr->ia_valid & (ATTR_SIZE |ATTR_ATIME |ATTR_ATIME_SET | -ATTR_MTIME |ATTR_MTIME_SET )) +ATTR_MTIME |ATTR_MTIME_SET )) {/* For truncate and utimes sending attributes to OSTs, setting * mtime/atime to the past will be performed under PW [0:EOF] * extent lock (new_size:EOF for truncate). It may seem
@@ -1501,6 +1501,7 @@ int ll_setattr_raw(struct dentry *dentry rc =ll_setattr_ost (inode, attr);if (attr->ia_valid &ATTR_SIZE )up_write (&lli->lli_trunc_sem); + } out:if (op_data) {if (op_data->op_ioepoch) {
PATCH 266/294 staging: rtl8723au: core: rtw_wlan_util: fix misleading indentation
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Luis de Bethencourt <[email protected]>
commit 8c182ae20791d638c07ff499709c4a1d4697bd7c upstream.
For loop is outside of the else branch of the above conditional statement. Fixing misleading indentation.
Fix a smatch warning:drivers/staging/rtl8723au/core/rtw_wlan_util.c:528 WMMOnAssocRsp23a() warn: curly braces intended?
--- drivers/staging/rtl8723au/core/rtw_wlan_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/rtl8723au/core/rtw_wlan_util.c +1 -1
@@ -546,7 +546,7 @@ void WMMOnAssocRsp23a(struct rtw_adapterelse aSifsTime =16 ; -for (i =0 ; i <4 ; i++) { +for (i =0 ; i <4 ; i++) {ACI = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >>5 ) &0x03 ;ACM = (pmlmeinfo->WMM_param.ac_param[i].ACI_AIFSN >>4 ) &0x01 ;
PATCH 267/294 Staging: wlan-ng: fix sparse warning in prism2fw.c
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: A Raghavendra Rao <[email protected]>
commit 41cb65c4854e14f12b1cbb8215e509d8ad4d0c88 upstream.
Fix the following sparse warning :
In file included from drivers/staging/wlan-ng/prism2usb.c:5:0:drivers/staging/wlan-ng/prism2fw.c: In function ‘read_cardpda.constprop.43’:drivers/staging/wlan-ng/prism2fw.c:792:1: warning: the frame size of 1068 bytes is larger than 1024 bytes [-Wframe-larger-than=]
The variable to 'struct p80211msg_p2req_readpda' was previously being created on the stack, which inturn exeeded the frame size limit, resulting in a sparse warning. This patch alloctes the memory to the structure dynamically and the operations are left unchanged.
--- drivers/staging/wlan-ng/prism2fw.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-)
drivers/staging/wlan-ng/prism2fw.c +18 -13
@@ -763,30 +763,35 @@ static int plugimage(struct imgchunk *fcstatic int read_cardpda (struct pda *pda,wlandevice_t *wlandev) {int result =0 ; -struct p80211msg_p2req_readpda msg; +struct p80211msg_p2req_readpda *msg; + + msg =kzalloc (sizeof (*msg),GFP_KERNEL ); +if (!msg) +return -ENOMEM ;/* set up the msg */ - msg.msgcode = DIDmsg_p2req_readpda; - msg.msglen =sizeof (msg); -strcpy (msg.devname, wlandev->name); - msg.pda.did = DIDmsg_p2req_readpda_pda; - msg.pda.len = HFA384x_PDA_LEN_MAX; - msg.pda.status = P80211ENUM_msgitem_status_no_value; - msg.resultcode.did = DIDmsg_p2req_readpda_resultcode; - msg.resultcode.len =sizeof (u32); - msg.resultcode.status = P80211ENUM_msgitem_status_no_value; + msg->msgcode = DIDmsg_p2req_readpda; + msg->msglen =sizeof (msg); +strcpy (msg->devname, wlandev->name); + msg->pda.did = DIDmsg_p2req_readpda_pda; + msg->pda.len = HFA384x_PDA_LEN_MAX; + msg->pda.status = P80211ENUM_msgitem_status_no_value; + msg->resultcode.did = DIDmsg_p2req_readpda_resultcode; + msg->resultcode.len =sizeof (u32); + msg->resultcode.status = P80211ENUM_msgitem_status_no_value; -if (prism2mgmt_readpda (wlandev, &msg) !=0 ) { +if (prism2mgmt_readpda (wlandev, msg) !=0 ) {/* prism2mgmt_readpda prints an errno if appropriate */ result =-1 ; - }else if (msg.resultcode.data == P80211ENUM_resultcode_success) { -memcpy (pda->buf, msg.pda.data, HFA384x_PDA_LEN_MAX); + }else if (msg->resultcode.data == P80211ENUM_resultcode_success) { +memcpy (pda->buf, msg->pda.data, HFA384x_PDA_LEN_MAX); result =mkpdrlist (pda); }else {/* resultcode must've been something other than success */ result =-1 ; } +kfree (msg);return result; }
PATCH 268/294 staging: dgnc: Fix frame size is larger than 1024B
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Konrad Zapalowicz <[email protected]>
commit ea6e9dea2e72a7abd146a2c5bab726b27f34b36c upstream.
This comit fixes the following sparse warnign:
drivers/staging/dgnc/dgnc_tty.c:572:1:
warning: the frame size of 1060 bytes is larger than 1024 bytes [-Wframe-larger-than=]
This was caused by having buffer as an automatic variable. This commit moves it from the stack to the heap.
--- drivers/staging/dgnc/dgnc_tty.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-)
drivers/staging/dgnc/dgnc_tty.c +12 -4
@@ -481,13 +481,18 @@ void dgnc_sniff_nowait_nolock(struct chaint nbuf;int i;int tmpbuflen; -char tmpbuf[TMPBUFLEN ]; -char *p = tmpbuf; +char *tmpbuf; +char *p;int too_much_data; + tmpbuf =kzalloc (TMPBUFLEN ,GFP_KERNEL ); +if (!tmpbuf) +return ; + p = tmpbuf; +/* Leave if sniff not open */ if (!(ch->ch_sniff_flags &SNIFF_OPEN )) -return ; + goto exit;do_gettimeofday (&tv);
@@ -534,7 +539,7 @@ void dgnc_sniff_nowait_nolock(struct cha* function was probably called by the interrupt/timer routines! */ if (n ==0 ) -return ; + goto exit;/* * Copy as much data as will fit.
@@ -579,6 +584,9 @@ void dgnc_sniff_nowait_nolock(struct cha } }while (too_much_data); + +exit: +kfree (tmpbuf); }
PATCH 269/294 x86/xen: fix upper bound of pmd loop in xen_cleanhighmap()
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Juergen Gross <[email protected]>
commit 1cf38741308c64d08553602b3374fb39224eeb5a upstream.
xen_cleanhighmap() is operating on level2_kernel_pgt only. The upper bound of the loop setting non-kernel-image entries to zero should not exceed the size of level2_kernel_pgt.
--- arch/x86/xen/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/xen/mmu.c +1 -1
@@ -1187,7 +1187,7 @@ static void __init xen_cleanhighmap(unsi/* NOTE: The loop is more greedy than the cleanup_highmap variant. * We include the PMD passed in on _both_ boundaries. */ -for (; vaddr <= vaddr_end && (pmd < (level2_kernel_pgt +PAGE_SIZE )); +for (; vaddr <= vaddr_end && (pmd < (level2_kernel_pgt +PTRS_PER_PMD )); pmd++, vaddr +=PMD_SIZE ) {if (pmd_none (*pmd))continue ;
PATCH 270/294 x86/boot: Add CONFIG_PARAVIRT_SPINLOCKS quirk to arch/x86/boot/compressed/misc.h
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ingo Molnar <[email protected]>
commit 927392d73a97d8d235bb65400e2e3c7f0bec2b6f upstream.
Linus reported the following new warning on x86 allmodconfig with GCC 5.1:
Quoted 5 lines
./arch/x86/include/asm/spinlock.h: In function ‘arch_spin_lock’:./arch/x86/include/asm/spinlock.h:119:3: warning: implicit declaration of function ‘__ticket_lock_spinning’ [-Wimplicit-function-declaration]__ticket_lock_spinning(lock, inc.tail); ^
This warning triggers because of these hacks in misc.h:
/*
* we have to be careful, because no indirections are allowed here, and
* paravirt_ops is a kind of one. As it will only run in baremetal anyway,
* we just keep it from happening
*/
#undef CONFIG_PARAVIRT
#undef CONFIG_KASAN
But these hacks were not updated when CONFIG_PARAVIRT_SPINLOCKS was added, and eventually (with the introduction of queued paravirt spinlocks in recent kernels) this created an invalid Kconfig combination and broke the build.
So add a CONFIG_PARAVIRT_SPINLOCKS #undef line as well.
Also remove the _ASM_X86_DESC_H quirk: that undocumented quirk was originally added ages ago, in:
099e1377269a ("x86: use ELF format in compressed images.")
and I went back to that kernel (and fixed up the main Makefile which didn't build anymore) and checked what failure it
avoided: it avoided an include file dependencies related build failure related to our old x86-platforms code.
That old code is long gone, the header dependencies got cleaned up, and the build does not fail anymore with the totality of asm/desc.h included - so remove the quirk.
--- arch/x86/boot/compressed/misc.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
arch/x86/boot/compressed/misc.h +5 -6
@@ -2,14 +2,13 @@#define BOOT_COMPRESSED_MISC_H /* -* we have to be careful, because no indirections are allowed here, and -* paravirt_ops is a kind of one. As it will only run in baremetal anyway, -* we just keep it from happening +* Special hack: we have to be careful, because no indirections are allowed here, +* and paravirt_ops is a kind of one. As it will only run in baremetal anyway, +* we just keep it from happening. (This list needs to be extended when new +* paravirt and debugging variants are added.) */ #undef CONFIG_PARAVIRT -#ifdef CONFIG_X86_32 -#define _ASM_X86_DESC_H 1 -#endif +#undef CONFIG_PARAVIRT_SPINLOCKS#include <linux/linkage.h> #include <linux/screen_info.h>
PATCH 271/294 ARM: cns3xxx: shut up frame size warning
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
This shuts up a warning in the 3.18-stable series that has been fixed in newer kernels with commit 498a92d42596 ("ARM: cns3xxx: pci: avoid potential stack overflow"):
arch/arm/mach-cns3xxx/pcie.c: In function 'cns3xxx_pcie_hw_init':arch/arm/mach-cns3xxx/pcie.c:313:1: error: the frame size of 1080 bytes is larger than 1024 bytes [-Werror=frame-larger-than=]
The fix that went into v4.4 is known to be buggy and was later fixed again with commit 88e9da9a2a70 ("CNS3xxx: Fix PCI cns3xxx_write_config()"). While we could backport both to 3.18, they are fairly invasive and the warning is definitely harmless here as the call chain is known to not overflow the stack of the init task.
This simply adds a Makefile flag to extend the limit for this one file.
---
We do want 88e9da9a2a70 ("CNS3xxx: Fix PCI cns3xxx_write_config()") backported into v4.4 though.
--- arch/arm/mach-cns3xxx/Makefile | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-cns3xxx/Makefile +1 -0
@@ -2,4 +2,5 @@ obj-$(CONFIG_ARCH_CNS3XXX) += cns3xxx.o cns3xxx-y += core.o pm.o cns3xxx-$(CONFIG_ATAGS) += devices.o cns3xxx-$(CONFIG_PCI) += pcie.o +CFLAGS_pcie.o += -Wframe-larger-than=1536 # override default 1024, this is safe here cns3xxx-$(CONFIG_MACH_CNS3420VB) += cns3420vb.o
PATCH 272/294 ARM: 8221/1: PJ4: allow building in Thumb-2 mode
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit 13d1b9575ac2c2da143cd2236b6cf0fc314570f8 upstream.
Two files that get included when building the multi_v7_defconfig target fail to build when selecting THUMB2_KERNEL for this configuration.
In both cases, we can just build the file as ARM code, as none of its symbols are exported to modules, so there are no interworking concerns. In the iwmmxt.S case, add ENDPROC() declarations so the symbols are annotated as functions, resulting in the linker to emit the appropriate mode switches.
--- arch/arm/kernel/Makefile | 1 + arch/arm/kernel/iwmmxt.S | 13 +++++++++++++ 2 files changed, 14 insertions(+)
arch/arm/kernel/Makefile +1 -0
@@ -84,6 +84,7 @@ obj-$(CONFIG_CPU_PJ4B) += pj4-cp0.o obj-$(CONFIG_IWMMXT) += iwmmxt.o obj-$(CONFIG_PERF_EVENTS) += perf_regs.o obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o perf_event_cpu.o +CFLAGS_pj4-cp0.o := -marm AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o
arch/arm/kernel/iwmmxt.S +13 -0
@@ -58,6 +58,7 @@ #define MMX_SIZE (0x98) .text + .arm /* * Lazy switching of Concan coprocessor context
@@ -182,6 +183,8 @@ concan_load: tmcr wCon, r2 mov pc, lr +ENDPROC(iwmmxt_task_enable) + /* * Back up Concan regs to save area and disable access to them * (mainly for gdb or sleep mode usage)
@@ -232,6 +235,8 @@ ENTRY(iwmmxt_task_disable) 1: msr cpsr_c, ip @ restore interrupt mode ldmfd sp!, {r4, pc} +ENDPROC(iwmmxt_task_disable) + /* * Copy Concan state to given memory address *
@@ -268,6 +273,8 @@ ENTRY(iwmmxt_task_copy) msr cpsr_c, ip @ restore interrupt mode mov pc, r3 +ENDPROC(iwmmxt_task_copy) + /* * Restore Concan state from given memory address *
@@ -304,6 +311,8 @@ ENTRY(iwmmxt_task_restore) msr cpsr_c, ip @ restore interrupt mode mov pc, r3 +ENDPROC(iwmmxt_task_restore) + /* * Concan handling on task switch *
@@ -335,6 +344,8 @@ ENTRY(iwmmxt_task_switch) mrc p15, 0, r1, c2, c0, 0 sub pc, lr, r1, lsr #32 @ cpwait and return +ENDPROC(iwmmxt_task_switch) + /* * Remove Concan ownership of given task *
@@ -353,6 +364,8 @@ ENTRY(iwmmxt_task_release) msr cpsr_c, r2 @ restore interrupts mov pc, lr +ENDPROC(iwmmxt_task_release) + .data concan_owner: .word 0
PATCH 273/294 ARM: 8452/3: PJ4: make coprocessor access sequences buildable in Thumb2 mode
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ard Biesheuvel <[email protected]>
commit 5008efc83bf85b647aa1cbc44718b1675bbb7444 upstream.
The PJ4 inline asm sequence to write to cp15 cannot be built in Thumb-2 mode, due to the way it performs arithmetic on the program counter, so it is built in ARM mode instead. However, building C files in ARM mode under CONFIG_THUMB2_KERNEL is problematic, since the instrumentation performed by subsystems like ftrace does not expect having to deal with interworking branches.
Since the sequence in question is simply a poor man's ISB instruction, let's use a straight 'isb' instead when building in Thumb2 mode. Thumb2 implies V7, so 'isb' should always be supported in that case.
--- arch/arm/kernel/Makefile | 1 - arch/arm/kernel/pj4-cp0.c | 4 ++++ 2 files changed, 4 insertions(+), 1 deletion(-)
arch/arm/kernel/Makefile +0 -1
@@ -84,7 +84,6 @@ obj-$(CONFIG_CPU_PJ4B) += pj4-cp0.o obj-$(CONFIG_IWMMXT) += iwmmxt.o obj-$(CONFIG_PERF_EVENTS) += perf_regs.o obj-$(CONFIG_HW_PERF_EVENTS) += perf_event.o perf_event_cpu.o -CFLAGS_pj4-cp0.o := -marm AFLAGS_iwmmxt.o := -Wa,-mcpu=iwmmxt obj-$(CONFIG_ARM_CPU_TOPOLOGY) += topology.o
arch/arm/kernel/pj4-cp0.c +4 -0
@@ -66,9 +66,13 @@ static void __init pj4_cp_access_write(u __asm__ __volatile__ ( "mcr p15, 0, %1, c1, c0, 2\n\t" +#ifdef CONFIG_THUMB2_KERNEL + "isb\n\t" +#else"mrc p15, 0, %0, c1, c0, 2\n\t" "mov %0, %0\n\t" "sub pc, pc, #4\n\t" +#endif :"=r" (temp) :"r" (value)); }
PATCH 274/294 ARM: OMAP: Fix Kconfig warning for omap1
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Tony Lindgren <[email protected]>
commit 52aaac5ae52ad9a7016410ffeedbaf24b722f3a2 upstream.
Commit 21278aeafbfa ("ARM: use menuconfig for sub-arch menus") improved the sub-arch menus, but accidentally caused new warnings for omap1. This was because the commit added a menu entry around config ARCH_OMAP bool entry where the menu had depends on ARCH_MULTI_V6 || ARCH_MULTI_V7.
As ARCH_OMAP is shared between omap1 and omap2plus, let's fix the issue by defining ARCH_OMAP in the shared plat-omap/Kconfig.
--- arch/arm/mach-omap2/Kconfig | 3 --- arch/arm/plat-omap/Kconfig | 3 +++ 2 files changed, 3 insertions(+), 3 deletions(-)
arch/arm/mach-omap2/Kconfig +0 -3
@@ -1,9 +1,6 @@ menu "TI OMAP/AM/DM/DRA Family" depends on ARCH_MULTI_V6 || ARCH_MULTI_V7 -config ARCH_OMAP - bool - config ARCH_OMAP2 bool "TI OMAP2" depends on ARCH_MULTI_V6
arch/arm/plat-omap/Kconfig +3 -0
@@ -1,3 +1,6 @@ +config ARCH_OMAP + bool + if ARCH_OMAP menu "TI OMAP Common Features"
PATCH 275/294 ARM: 8160/1: drop warning about return_address not using unwind tables
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Uwe Kleine-König <[email protected]>
commit e16343c47e4276f5ebc77ca16feb5e50ca1918f9 upstream.
The warning was introduced in 2009 (commit 4bf1fa5a34aa ([ARM] 5613/1:
implement CALLER_ADDRESSx)). The only "problem" here is that CALLER_ADDRESSx for x > 1 returns NULL which doesn't do much harm.
The drawback of implementing a fix (i.e. use unwind tables to implement CALLER_ADDRESSx) is that much of the unwinder code would need to be marked as not traceable.
--- arch/arm/kernel/return_address.c | 4 ---- 1 file changed, 4 deletions(-)
arch/arm/kernel/return_address.c +0 -4
@@ -59,10 +59,6 @@ void *return_address(unsigned int level)#else /* if defined(CONFIG_FRAME_POINTER) && !defined(CONFIG_ARM_UNWIND) */ -#if defined(CONFIG_ARM_UNWIND ) -#warning "TODO: return_address should use unwind tables" -#endif -void *return_address (unsigned int level) {return NULL ;
PATCH 276/294 ARM: 8296/1: cache-l2x0: clean up aurora cache handling
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 20e783e39e55c2615fb61d1b3d139ee9edcf6772 upstream.
The aurora cache controller is the only remaining user of a couple of functions in this file and are completely unused when that is disabled, leading to build warnings:
arch/arm/mm/cache-l2x0.c:167:13: warning: 'l2x0_cache_sync' defined but not used [-Wunused-function] arch/arm/mm/cache-l2x0.c:184:13: warning: 'l2x0_flush_all' defined but not used [-Wunused-function] arch/arm/mm/cache-l2x0.c:194:13: warning: 'l2x0_disable' defined but not used [-Wunused-function]
With the knowledge that the code is now aurora-specific, we can simplify it noticeably:
- The pl310 errata workarounds are not needed on aurora and can be removed
- As confirmed by Thomas Petazzoni from the data sheet, the cache_wait() macro is never needed.
- No need to hold the lock across atomic cache sync
- We can load the l2x0_base into a local variable across operations
There should be no functional change in this patch, but readability and the generated object code improves, along with avoiding the warnings.
(on Armada 370 RD and Armada XP GP, boot tested, plus a little bit of DMA traffic by reading data from a SD card)
--- arch/arm/mm/cache-l2x0.c | 111 ++++++++++++++++------------------------------- 1 file changed, 38 insertions(+), 73 deletions(-)
arch/arm/mm/cache-l2x0.c +38 -73
@@ -135,73 +135,6 @@ static void l2c_disable(void)dsb (st); } -#ifdef CONFIG_CACHE_PL310 -static inline void cache_wait (void __iomem *reg,unsigned long mask) -{ -/* cache operations by line are atomic on PL310 */ -} -#else -#define cache_wait l2c_wait_mask -#endif - -static inline void cache_sync (void ) -{ -void __iomem *base = l2x0_base; - -writel_relaxed (0 , base + sync_reg_offset); -cache_wait (base +L2X0_CACHE_SYNC ,1 ); -} - -#if defined(CONFIG_PL310_ERRATA_588369 ) || defined(CONFIG_PL310_ERRATA_727915 ) -static inline void debug_writel (unsigned long val) -{ -l2c_set_debug (l2x0_base, val); -} -#else -/* Optimised out for non-errata case */ -static inline void debug_writel (unsigned long val) -{ -} -#endif - -static void l2x0_cache_sync (void ) -{ -unsigned long flags; - -raw_spin_lock_irqsave (&l2x0_lock, flags); -cache_sync (); -raw_spin_unlock_irqrestore (&l2x0_lock, flags); -} - -static void __l2x0_flush_all (void ) -{ -debug_writel (0x03 ); -__l2c_op_way (l2x0_base +L2X0_CLEAN_INV_WAY ); -cache_sync (); -debug_writel (0x00 ); -} - -static void l2x0_flush_all (void ) -{ -unsigned long flags; - -/* clean all ways */ -raw_spin_lock_irqsave (&l2x0_lock, flags); -__l2x0_flush_all (); -raw_spin_unlock_irqrestore (&l2x0_lock, flags); -} - -static void l2x0_disable (void ) -{ -unsigned long flags; - -raw_spin_lock_irqsave (&l2x0_lock, flags); -__l2x0_flush_all (); -l2c_write_sec (0 , l2x0_base,L2X0_CTRL ); -dsb (st); -raw_spin_unlock_irqrestore (&l2x0_lock, flags); -} -static void l2c_save (void __iomem *base) { l2x0_saved_regs.aux_ctrl =readl_relaxed (l2x0_base +L2X0_AUX_CTRL );
@@ -1126,14 +1059,15 @@ static unsigned long calc_range_end(unsistatic void aurora_pa_range (unsigned long start,unsigned long end,unsigned long offset) { +void __iomem *base = l2x0_base;unsigned long flags;raw_spin_lock_irqsave (&l2x0_lock, flags); -writel_relaxed (start, l2x0_base +AURORA_RANGE_BASE_ADDR_REG ); -writel_relaxed (end, l2x0_base + offset); +writel_relaxed (start, base +AURORA_RANGE_BASE_ADDR_REG ); +writel_relaxed (end, base + offset);raw_spin_unlock_irqrestore (&l2x0_lock, flags); -cache_sync (); +writel_relaxed (0 , base +AURORA_SYNC_REG ); }static void aurora_inv_range (unsigned long start,unsigned long end)
@@ -1193,6 +1127,37 @@ static void aurora_flush_range(unsigned } } +static void aurora_flush_all (void ) +{ +void __iomem *base = l2x0_base; +unsigned long flags; + +/* clean all ways */ +raw_spin_lock_irqsave (&l2x0_lock, flags); +__l2c_op_way (base +L2X0_CLEAN_INV_WAY ); +raw_spin_unlock_irqrestore (&l2x0_lock, flags); + +writel_relaxed (0 , base +AURORA_SYNC_REG ); +} + +static void aurora_cache_sync (void ) +{ +writel_relaxed (0 , l2x0_base +AURORA_SYNC_REG ); +} + +static void aurora_disable (void ) +{ +void __iomem *base = l2x0_base; +unsigned long flags; + +raw_spin_lock_irqsave (&l2x0_lock, flags); +__l2c_op_way (base +L2X0_CLEAN_INV_WAY ); +writel_relaxed (0 , base +AURORA_SYNC_REG ); +l2c_write_sec (0 , base,L2X0_CTRL ); +dsb (st); +raw_spin_unlock_irqrestore (&l2x0_lock, flags); +} +static void aurora_save (void __iomem *base) { l2x0_saved_regs.ctrl =readl_relaxed (base +L2X0_CTRL );
@@ -1267,9 +1232,9 @@ static const struct l2c_init_data of_aur .inv_range = aurora_inv_range, .clean_range = aurora_clean_range, .flush_range = aurora_flush_range, - .flush_all = l2x0_flush_all, - .disable = l2x0_disable, - .sync = l2x0_cache_sync, + .flush_all = aurora_flush_all, + .disable = aurora_disable, + .sync = aurora_cache_sync, .resume = aurora_resume, }, };
PATCH 277/294 MIPS: BMIPS: Fix ".previous without corresponding .section" warnings
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Cernekee <[email protected]>
commit 4ec8f9e9b08451303253249e4e302f10ee23d565 upstream.
Commit 078a55fc824c1 ("Delete __cpuinit/__CPUINIT usage from MIPS code") removed our __CPUINIT directives, so now the ".previous" directives are superfluous. Remove them.
Patchwork: https://patchwork.linux-mips.org/patch/8156/
--- arch/mips/kernel/bmips_vec.S | 3 --- 1 file changed, 3 deletions(-)
arch/mips/kernel/bmips_vec.S +0 -3
@@ -211,7 +211,6 @@ bmips_reset_nmi_vec_end: END(bmips_reset_nmi_vec) .set pop - .previous /*********************************************************************** * CPU1 warm restart vector (used for second and subsequent boots).
@@ -286,5 +285,3 @@ LEAF(bmips_enable_xks01) jr ra END(bmips_enable_xks01) - - .previous
PATCH 278/294 MIPS: DEC: Avoid la pseudo-instruction in delay slots
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ralf Baechle <[email protected]>
commit 3021773c7c3e75e20b693931a19362681e744ea9 upstream.
When expanding the la or dla pseudo-instruction in a delay slot the GNU assembler will complain should the pseudo-instruction expand to multiple actual instructions, since only the first of them will be in the delay slot leading to the pseudo-instruction being only partially executed if the branch is taken. Use of PTR_LA in the dec int-handler.S leads to such warnings:
arch/mips/dec/int-handler.S: Assembler messages:
arch/mips/dec/int-handler.S:149: Warning: macro instruction expanded into multiple instructions in a branch delay slot arch/mips/dec/int-handler.S:198: Warning: macro instruction expanded into multiple instructions in a branch delay slot
Avoid this by open coding the PTR_LA macros.
--- arch/mips/dec/int-handler.S | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)
arch/mips/dec/int-handler.S +38 -2
@@ -146,7 +146,25 @@ /* * Find irq with highest priority */ - PTR_LA t1,cpu_mask_nr_tbl + # open coded PTR_LA t1, cpu_mask_nr_tbl +#if (_MIPS_SZPTR == 32) + # open coded la t1, cpu_mask_nr_tbl + lui t1, %hi(cpu_mask_nr_tbl) + addiu t1, %lo(cpu_mask_nr_tbl) + +#endif +#if (_MIPS_SZPTR == 64) + # open coded dla t1, cpu_mask_nr_tbl + .set push + .set noat + lui t1, %highest(cpu_mask_nr_tbl) + lui AT, %hi(cpu_mask_nr_tbl) + daddiu t1, t1, %higher(cpu_mask_nr_tbl) + daddiu AT, AT, %lo(cpu_mask_nr_tbl) + dsll t1, 32 + daddu t1, t1, AT + .set pop +#endif 1: lw t2,(t1) nop and t2,t0
@@ -195,7 +213,25 @@ /* * Find irq with highest priority */ - PTR_LA t1,asic_mask_nr_tbl + # open coded PTR_LA t1,asic_mask_nr_tbl +#if (_MIPS_SZPTR == 32) + # open coded la t1, asic_mask_nr_tbl + lui t1, %hi(asic_mask_nr_tbl) + addiu t1, %lo(asic_mask_nr_tbl) + +#endif +#if (_MIPS_SZPTR == 64) + # open coded dla t1, asic_mask_nr_tbl + .set push + .set noat + lui t1, %highest(asic_mask_nr_tbl) + lui AT, %hi(asic_mask_nr_tbl) + daddiu t1, t1, %higher(asic_mask_nr_tbl) + daddiu AT, AT, %lo(asic_mask_nr_tbl) + dsll t1, 32 + daddu t1, t1, AT + .set pop +#endif 2: lw t2,(t1) nop and t2,t0
PATCH 279/294 MIPS: DEC: Fix an int-handler.S CPU_DADDI_WORKAROUNDS regression
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Maciej W. Rozycki" <[email protected]>
commit 68fe55680d0f3342969f49412fceabb90bdfadba upstream.
Fix a commit 3021773c7c3e ("MIPS: DEC: Avoid la pseudo-instruction in delay slots") regression and remove assembly errors:
arch/mips/dec/int-handler.S: Assembler messages:arch/mips/dec/int-handler.S:162: Error: Macro used $at after ".set noat" arch/mips/dec/int-handler.S:163: Error: Macro used $at after ".set noat" arch/mips/dec/int-handler.S:229: Error: Macro used $at after ".set noat" arch/mips/dec/int-handler.S:230: Error: Macro used $at after ".set noat"
triggering with with the CPU_DADDI_WORKAROUNDS option set and the DADDIU instruction. This is because with that option in place the instruction becomes a macro, which expands to an LI/DADDU (or actually ADDIU/DADDU) sequence that uses $at as a temporary register.
With CPU_DADDI_WORKAROUNDS we only support `-msym32' compilation though, and this is already enforced in arch/mips/Makefile, so choose the 32-bit expansion variant for the supported configurations and then replace the 64-bit variant with #error just in case.
Patchwork: https://patchwork.linux-mips.org/patch/16893/
--- arch/mips/dec/int-handler.S | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-)
arch/mips/dec/int-handler.S +6 -28
@@ -147,23 +147,12 @@ * Find irq with highest priority */ # open coded PTR_LA t1, cpu_mask_nr_tbl -#if (_MIPS_SZPTR == 32) +#if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32) # open coded la t1, cpu_mask_nr_tbl lui t1, %hi(cpu_mask_nr_tbl) addiu t1, %lo(cpu_mask_nr_tbl) - -#endif -#if (_MIPS_SZPTR == 64) - # open coded dla t1, cpu_mask_nr_tbl - .set push - .set noat - lui t1, %highest(cpu_mask_nr_tbl) - lui AT, %hi(cpu_mask_nr_tbl) - daddiu t1, t1, %higher(cpu_mask_nr_tbl) - daddiu AT, AT, %lo(cpu_mask_nr_tbl) - dsll t1, 32 - daddu t1, t1, AT - .set pop +#else +#error GCC `-msym32' option required for 64-bit DECstation builds #endif 1: lw t2,(t1) nop
@@ -214,23 +203,12 @@ * Find irq with highest priority */ # open coded PTR_LA t1,asic_mask_nr_tbl -#if (_MIPS_SZPTR == 32) +#if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32) # open coded la t1, asic_mask_nr_tbl lui t1, %hi(asic_mask_nr_tbl) addiu t1, %lo(asic_mask_nr_tbl) - -#endif -#if (_MIPS_SZPTR == 64) - # open coded dla t1, asic_mask_nr_tbl - .set push - .set noat - lui t1, %highest(asic_mask_nr_tbl) - lui AT, %hi(asic_mask_nr_tbl) - daddiu t1, t1, %higher(asic_mask_nr_tbl) - daddiu AT, AT, %lo(asic_mask_nr_tbl) - dsll t1, 32 - daddu t1, t1, AT - .set pop +#else +#error GCC `-msym32' option required for 64-bit DECstation builds #endif 2: lw t2,(t1) nop
PATCH 280/294 MIPS: ip22: Fix ip28 build for modern gcc
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit 23ca9b522383d3b9b7991d8586db30118992af4a upstream.
kernelci reports a failure of the ip28_defconfig build after upgrading its gcc version:
arch/mips/sgi-ip22/Platform:29: *** gcc doesn't support needed option -mr10k-cache-barrier=store. Stop.
The problem apparently is that the -mr10k-cache-barrier=store option is now rejected for CPUs other than r10k. Explicitly including the CPU in the check fixes this and is safe because both options were introduced in gcc-4.4.
Patchwork: https://patchwork.linux-mips.org/patch/15049/
--- arch/mips/sgi-ip22/Platform | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/mips/sgi-ip22/Platform +1 -1
@@ -25,7 +25,7 @@ endif # Simplified: what IP22 does at 128MB+ in ksegN, IP28 does at 512MB+ in xkphys # ifdef CONFIG_SGI_IP28 - ifeq ($(call cc-option-yn,-mr10k-cache-barrier=store), n) + ifeq ($(call cc-option-yn,-march=r10000 -mr10k-cache-barrier=store), n) $(error gcc doesn't support needed option -mr10k-cache-barrier=store) endif endif
PATCH 281/294 MIPS: MSP71xx: remove odd locking in PCI config space access code
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Sergey Ryazanov <[email protected]>
commit c4a305374bbf36414515d2ae00d588c67051e67d upstream.
Caller (generic PCI code) already do proper locking so no need to add another one here.
Patchwork: https://patchwork.linux-mips.org/patch/7601/
--- arch/mips/pci/ops-pmcmsp.c | 12 ------------ 1 file changed, 12 deletions(-)
arch/mips/pci/ops-pmcmsp.c +0 -12
@@ -193,8 +193,6 @@ static void pci_proc_init(void) }#endif /* CONFIG_PROC_FS && PCI_COUNTERS */ -static DEFINE_SPINLOCK (bpci_lock); -/***************************************************************************** * * STRUCT: pci_io_resource
@@ -368,7 +366,6 @@ int msp_pcibios_config_access(unsigned cstruct msp_pci_regs *preg = (void *)PCI_BASE_REG ;unsigned char bus_num = bus->number;unsigned char dev_fn = (unsigned char )devfn; -unsigned long flags;unsigned long intr;unsigned long value;static char pciirqflag;
@@ -401,10 +398,7 @@ int msp_pcibios_config_access(unsigned c }#if defined(CONFIG_PMC_MSP7120_GW ) || defined(CONFIG_PMC_MSP7120_EVAL ) -local_irq_save (flags); vpe_status =dvpe (); -#else -spin_lock_irqsave (&bpci_lock, flags);#endif /*
@@ -457,9 +451,6 @@ int msp_pcibios_config_access(unsigned c#if defined(CONFIG_PMC_MSP7120_GW ) || defined(CONFIG_PMC_MSP7120_EVAL )evpe (vpe_status); -local_irq_restore (flags); -#else -spin_unlock_irqrestore (&bpci_lock, flags);#endif return -1 ;
@@ -467,9 +458,6 @@ int msp_pcibios_config_access(unsigned c#if defined(CONFIG_PMC_MSP7120_GW ) || defined(CONFIG_PMC_MSP7120_EVAL )evpe (vpe_status); -local_irq_restore (flags); -#else -spin_unlock_irqrestore (&bpci_lock, flags);#endif return PCIBIOS_SUCCESSFUL ;
PATCH 282/294 MIPS: Fix the build on jz4740 after removing the custom gpio.h
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Alban Bedel <[email protected]>
commit 5b235dc2647e4977b17b5c41d959d0f455831c3f upstream.
Somehow the wrong version of the patch to remove the use of custom gpio.h on mips has been merged. This patch add the missing fixes for a build error on jz4740 because linux/gpio.h doesn't provide any machine specfics definitions anymore.
Patchwork: https://patchwork.linux-mips.org/patch/11089/
--- arch/mips/jz4740/board-qi_lb60.c | 1 + arch/mips/jz4740/gpio.c | 1 + 2 files changed, 2 insertions(+)
arch/mips/jz4740/board-qi_lb60.c +1 -0
@@ -25,6 +25,7 @@#include <linux/power/jz4740-battery.h> #include <linux/power/gpio-charger.h> +#include <asm/mach-jz4740/gpio.h> #include <asm/mach-jz4740/jz4740_fb.h> #include <asm/mach-jz4740/jz4740_mmc.h> #include <asm/mach-jz4740/jz4740_nand.h>
arch/mips/jz4740/gpio.c +1 -0
@@ -27,6 +27,7 @@#include <linux/seq_file.h> #include <asm/mach-jz4740/base.h> +#include <asm/mach-jz4740/gpio.h> #include "irq.h"
PATCH 283/294 MIPS: TXx9: Delete an unused variable in tx4927_pcibios_setup
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Atsushi Nemoto <[email protected]>
commit 1bc2d3e38e5bf90af4e9d64e1696f2d39757355a upstream.
Patchwork: https://patchwork.linux-mips.org/patch/7216/
--- arch/mips/pci/ops-tx4927.c | 2 -- 1 file changed, 2 deletions(-)
arch/mips/pci/ops-tx4927.c +0 -2
@@ -199,8 +199,6 @@ static struct {char *tx4927_pcibios_setup (char *str) { -unsigned long val; -if (!strncmp (str,"trdyto=" ,7 )) {u8 val =0 ;if (kstrtou8 (str +7 ,0 , &val) ==0 )
PATCH 284/294 MIPS: elf2ecoff: Fix warning due to dead code.
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ralf Baechle <[email protected]>
commit 2d76e9633b572ae5a64150b638eed77f4afc12db upstream.
HOSTCC arch/mips/boot/elf2ecoffarch/mips/boot/elf2ecoff.c: In function ‘main’:arch/mips/boot/elf2ecoff.c:271:8: warning: variable ‘shstrtab’ set but not used [-Wunused-but-set-variable]
char *shstrtab;
--- arch/mips/boot/elf2ecoff.c | 4 ---- 1 file changed, 4 deletions(-)
arch/mips/boot/elf2ecoff.c +0 -4
@@ -267,7 +267,6 @@ int main(int argc, char *argv[])Elf32_Ehdr ex;Elf32_Phdr *ph;Elf32_Shdr *sh; -char *shstrtab;int i, pad;struct sect text, data, bss;struct filehdr efh;
@@ -335,9 +334,6 @@ int main(int argc, char *argv[]) "sh");if (must_convert_endian)convert_elf_shdrs (sh, ex.e_shnum); -/* Read in the section string table. */ - shstrtab =saveRead (infile, sh[ex.e_shstrndx].sh_offset, - sh[ex.e_shstrndx].sh_size,"shstrtab" );/* Figure out if we can cram the program header into an ECOFF header... Basically, we can't handle anything but loadable
PATCH 285/294 staging: r8192ee: prorperly format warning message
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
In stable/linux-3.16.y, we get a warning for 64-bit architectures:
drivers/staging/rtl8192ee/pci.c: In function '_rtl_pci_rx_interrupt':include/linux/kern_levels.h:4:18: warning: format '%d' expects argument of type 'int', but argument 2 has type 'sk_buff_data_t {aka unsigned char *}' [-Wformat=] include/linux/kern_levels.h:4:18: warning: format '%d' expects argument of type 'int', but argument 3 has type 'sk_buff_data_t {aka unsigned char *}' [-Wformat=]
The driver was removed in 3.18 before this was fixed, so there is no workaround to backport, but it's easy enough to avoid the problem by changing the printk message to something similar that uses proper accessors for the skb fields.
--- drivers/staging/rtl8192ee/pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/rtl8192ee/pci.c +2 -2
@@ -882,8 +882,8 @@ static void _rtl_pci_rx_interrupt(struct }else {if (err_count++ <10 ) { -pr_info ("skb->end (%d) - skb->tail (%d) > len (%d)\n" , - skb->end, skb->tail, len); +pr_info ("skb end: %d) - tailroom (%d) > len (%d)\n" , +skb_end_offset (skb),skb_tailroom (skb), len);RT_PRINT_DATA (rtlpriv,COMP_CMD ,DBG_EMERG ,"RX desc\n" , (u8 *)pdesc,32 );
PATCH 286/294 mtd: cfi: reduce stack size
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
commit d09957fbb4d0b059b3176b510540df69048ad170 upstream.
The cfi_staa_write_buffers function uses a large amount of kernel stack whenever CONFIG_MTD_MAP_BANK_WIDTH_32 is set, and that results in a warning on ARM allmodconfig builds:
drivers/mtd/chips/cfi_cmdset_0020.c: In function 'cfi_staa_write_buffers':drivers/mtd/chips/cfi_cmdset_0020.c:651:1: warning: the frame size of 1208 bytes is larger than 1024 bytes [-Wframe-larger-than=]
It turns out that this is largely a result of a suboptimal implementation of map_word_andequal(). Replacing this function with a straightforward one reduces the stack size in this function by exactly 200 bytes, shrinks the .text segment for this file from 27648 bytes to 26608 bytes, and makes the warning go away.
--- include/linux/mtd/map.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
include/linux/mtd/map.h +11 -1
@@ -317,7 +317,17 @@ static inline map_word map_word_or(strucreturn r; } -#define map_word_andequal (m, a, b, z) map_word_equal(m, z, map_word_and(m, a, b)) +static inline int map_word_andequal (struct map_info *map,map_word val1,map_word val2,map_word val3) +{ +int i; + +for (i =0 ; i <map_words (map); i++) { +if ((val1.x[i] & val2.x[i]) != val3.x[i]) +return 0 ; + } + +return 1 ; +}static inline int map_word_bitsset (struct map_info *map,map_word val1,map_word val2) {
PATCH 287/294 drbd: avoid redefinition of BITS_PER_PAGE
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Lars Ellenberg <[email protected]>
commit 2630628b2dbc3fc320aafaf84836119e4e3d62f1 upstream.
Apparently we now implicitly get definitions for BITS_PER_PAGE and BITS_PER_PAGE_MASK from the pid_namespace.h
Instead of renaming our defines, I chose to define only if not yet defined, but to double check the value if already defined.
--- drivers/block/drbd/drbd_bitmap.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/block/drbd/drbd_bitmap.c +6 -0
@@ -478,8 +478,14 @@ void drbd_bm_cleanup(struct drbd_device* this masks out the remaining bits. * Returns the number of bits cleared. */ +#ifndef BITS_PER_PAGE #define BITS_PER_PAGE (1UL << (PAGE_SHIFT + 3))#define BITS_PER_PAGE_MASK (BITS_PER_PAGE - 1) +#else +# if BITS_PER_PAGE != (1UL << (PAGE_SHIFT +3 )) +# error "ambiguous BITS_PER_PAGE" +# endif +#endif #define BITS_PER_LONG_MASK (BITS_PER_LONG - 1)static int bm_clear_surplus (struct drbd_bitmap *b) {
PATCH 288/294 perf: Avoid horrible stack usage
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: "Peter Zijlstra (Intel)" <[email protected]>
commit 86038c5ea81b519a8a1fcfcd5e4599aab0cdd119 upstream.
Both Linus (most recent) and Steve (a while ago) reported that perf related callbacks have massive stack bloat.
The problem is that software events need a pt_regs in order to properly report the event location and unwind stack. And because we could not assume one was present we allocated one on stack and filled it with minimal bits required for operation.
Now, pt_regs is quite large, so this is undesirable. Furthermore it turns out that most sites actually have a pt_regs pointer available, making this even more onerous, as the stack space is pointless waste.
This patch addresses the problem by observing that software events have well defined nesting semantics, therefore we can use static per-cpu storage instead of on-stack.
Linus made the further observation that all but the scheduler callers of perf_sw_event() have a pt_regs available, so we change the regular perf_sw_event() to require a valid pt_regs (where it used to be optional) and add perf_sw_event_sched() for the scheduler.
We have a scheduler specific call instead of a more generic _noregs() like construct because we can assume non-recursion from the scheduler and thereby simplify the code further (_noregs would have to put the recursion context call inline in order to assertain which __perf_regs element to use).
One last note on the implementation of perf_trace_buf_prepare(); we allow .regs = NULL for those cases where we already have a pt_regs pointer available and do not need another.
--- include/linux/ftrace_event.h | 2 +- include/linux/perf_event.h | 28 +++++++++++++++++++++------- include/trace/ftrace.h | 7 ++++--- kernel/events/core.c | 23 +++++++++++++++++------ kernel/sched/core.c | 2 +- kernel/trace/trace_event_perf.c | 4 +++- kernel/trace/trace_kprobe.c | 4 ++-- kernel/trace/trace_syscalls.c | 4 ++-- kernel/trace/trace_uprobe.c | 2 +- 9 files changed, 52 insertions(+), 24 deletions(-)
include/linux/ftrace_event.h +1 -1
@@ -621,7 +621,7 @@ extern int ftrace_profile_set_filter(st char *filter_str);extern void ftrace_profile_free_filter (struct perf_event *event);extern void *perf_trace_buf_prepare (int size,unsigned short type, -struct pt_regs *regs,int *rctxp); +struct pt_regs **regs,int *rctxp); static inline void perf_trace_buf_submit(void *raw_data, int size, int rctx, u64 addr,
include/linux/perf_event.h +21 -7
@@ -642,6 +642,7 @@ static inline int is_software_event(struextern struct static_key perf_swevent_enabled[PERF_COUNT_SW_MAX ]; +extern void ___perf_sw_event (u32 ,u64 ,struct pt_regs *,u64 );extern void __perf_sw_event (u32 ,u64 ,struct pt_regs *,u64 );#ifndef perf_arch_fetch_caller_regs
@@ -666,14 +667,25 @@ static inline void perf_fetch_caller_reg static __always_inline voidperf_sw_event (u32 event_id,u64 nr,struct pt_regs *regs,u64 addr) { -struct pt_regs hot_regs; +if (static_key_false (&perf_swevent_enabled[event_id])) +__perf_sw_event (event_id, nr, regs, addr); +} + +DECLARE_PER_CPU(struct pt_regs, __perf_regs[4]); +/* +* 'Special' version for the scheduler, it hard assumes no recursion, +* which is guaranteed by us not actually scheduling inside other swevents +* because those disable preemption. +*/ +static __always_inline void +perf_sw_event_sched (u32 event_id,u64 nr,u64 addr) +{if (static_key_false (&perf_swevent_enabled[event_id])) { -if (!regs) { -perf_fetch_caller_regs (&hot_regs); - regs = &hot_regs; - } -__perf_sw_event (event_id, nr, regs, addr); +struct pt_regs *regs =this_cpu_ptr (&__perf_regs[0 ]); + +perf_fetch_caller_regs (regs); +___perf_sw_event (event_id, nr, regs, addr); } }
@@ -689,7 +701,7 @@ static inline void perf_event_task_schedstatic inline void perf_event_task_sched_out (struct task_struct *prev,struct task_struct *next) { -perf_sw_event (PERF_COUNT_SW_CONTEXT_SWITCHES ,1 ,NULL ,0 ); +perf_sw_event_sched (PERF_COUNT_SW_CONTEXT_SWITCHES ,1 ,0 );if (static_key_false (&perf_sched_events.key))__perf_event_task_sched_out (prev, next);
@@ -800,6 +812,8 @@ static inline int perf_event_refresh(strstatic inline void perf_sw_event (u32 event_id,u64 nr,struct pt_regs *regs,u64 addr) { }static inline void +perf_sw_event_sched (u32 event_id,u64 nr,u64 addr) { } +static inline void perf_bp_event (struct perf_event *event,void *data) { }static inline int perf_register_guest_info_callbacks
include/trace/ftrace.h +4 -3
@@ -765,7 +765,7 @@ perf_trace_##call(void *__data, proto)struct ftrace_event_call *event_call = __data; \ struct ftrace_data_offsets_##call __maybe_unused __data_offsets;\ struct ftrace_raw_##call *entry; \ - struct pt_regs __regs; \ + struct pt_regs *__regs; \ u64 __addr = 0, __count = 1; \ struct task_struct *__task = NULL; \ struct hlist_head *head; \
@@ -784,18 +784,19 @@ perf_trace_##call(void *__data, proto) sizeof(u64)); \ __entry_size -=sizeof (u32); \ \ -perf_fetch_caller_regs (&__regs); \ entry =perf_trace_buf_prepare (__entry_size, \ event_call->event.type, &__regs, &rctx); \if (!entry) \return ; \ \ +perf_fetch_caller_regs (__regs); \ + \ tstruct \ \ { assign; } \ \perf_trace_buf_submit (entry, __entry_size, rctx, __addr, \ - __count, &__regs, head, __task); \ + __count, __regs, head, __task); \ }/*
kernel/events/core.c +17 -6
@@ -5965,6 +5965,8 @@ end:rcu_read_unlock (); } +DEFINE_PER_CPU(struct pt_regs, __perf_regs[4]); +int perf_swevent_get_recursion_context (void ) {struct swevent_htable *swhash = &__get_cpu_var (swevent_htable);
@@ -5980,21 +5982,30 @@ inline void perf_swevent_put_recursion_cput_recursion_context (swhash->recursion, rctx); } -void __perf_sw_event (u32 event_id,u64 nr,struct pt_regs *regs,u64 addr) +void ___perf_sw_event (u32 event_id,u64 nr,struct pt_regs *regs,u64 addr) {struct perf_sample_data data; -int rctx; -preempt_disable_notrace (); - rctx =perf_swevent_get_recursion_context (); -if (rctx <0 ) +if (WARN_ON_ONCE (!regs))return ;perf_sample_data_init (&data, addr,0 ); -do_perf_sw_event (PERF_TYPE_SOFTWARE , event_id, nr, &data, regs); +} + +void __perf_sw_event (u32 event_id,u64 nr,struct pt_regs *regs,u64 addr) +{ +int rctx; + +preempt_disable_notrace (); + rctx =perf_swevent_get_recursion_context (); +if (unlikely (rctx <0 )) + goto fail; + +___perf_sw_event (event_id, nr, regs, addr);perf_swevent_put_recursion_context (rctx); +fail:preempt_enable_notrace (); }
kernel/sched/core.c +1 -1
@@ -1083,7 +1083,7 @@ void set_task_cpu(struct task_struct *p,if (p->sched_class->migrate_task_rq) p->sched_class->migrate_task_rq (p, new_cpu); p->se.nr_migrations++; -perf_sw_event (PERF_COUNT_SW_CPU_MIGRATIONS ,1 ,NULL ,0 ); +perf_sw_event_sched (PERF_COUNT_SW_CPU_MIGRATIONS ,1 ,0 ); tmn.task = p; tmn.from_cpu =task_cpu (p);
kernel/trace/trace_event_perf.c +3 -1
@@ -249,7 +249,7 @@ void perf_trace_del(struct perf_event *p }void *perf_trace_buf_prepare (int size,unsigned short type, -struct pt_regs *regs,int *rctxp) +struct pt_regs **regs,int *rctxp) {struct trace_entry *entry;unsigned long flags;
@@ -268,6 +268,8 @@ void *perf_trace_buf_prepare(int size, uif (*rctxp <0 )return NULL ; +if (regs) + *regs =this_cpu_ptr (&__perf_regs[*rctxp]); raw_data =this_cpu_ptr (perf_trace_buf[*rctxp]);/* zero the dead bytes from align to not leak stack to user */
kernel/trace/trace_kprobe.c +2 -2
@@ -1155,7 +1155,7 @@ kprobe_perf_func(struct trace_kprobe *tk size =ALIGN (__size +sizeof (u32),sizeof (u64)); size -=sizeof (u32); - entry =perf_trace_buf_prepare (size, call->event.type, regs, &rctx); + entry =perf_trace_buf_prepare (size, call->event.type,NULL , &rctx);if (!entry)return ;
@@ -1186,7 +1186,7 @@ kretprobe_perf_func(struct trace_kprobe size =ALIGN (__size +sizeof (u32),sizeof (u64)); size -=sizeof (u32); - entry =perf_trace_buf_prepare (size, call->event.type, regs, &rctx); + entry =perf_trace_buf_prepare (size, call->event.type,NULL , &rctx);if (!entry)return ;
kernel/trace/trace_syscalls.c +2 -2
@@ -586,7 +586,7 @@ static void perf_syscall_enter(void *ign size -=sizeof (u32); rec = (struct syscall_trace_enter *)perf_trace_buf_prepare (size, - sys_data->enter_event->event.type, regs, &rctx); + sys_data->enter_event->event.type,NULL , &rctx);if (!rec)return ;
@@ -659,7 +659,7 @@ static void perf_syscall_exit(void *igno size -=sizeof (u32); rec = (struct syscall_trace_exit *)perf_trace_buf_prepare (size, - sys_data->exit_event->event.type, regs, &rctx); + sys_data->exit_event->event.type,NULL , &rctx);if (!rec)return ;
kernel/trace/trace_uprobe.c +1 -1
@@ -1116,7 +1116,7 @@ static void __uprobe_perf_func(struct trif (hlist_empty (head)) goto out; - entry =perf_trace_buf_prepare (size, call->event.type, regs, &rctx); + entry =perf_trace_buf_prepare (size, call->event.type,NULL , &rctx);if (!entry) goto out;
PATCH 289/294 MIPS: jz4740: fix build error in irq.h
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
kernelci found build error on the 3.16 and 3.18 stable trees that don't show up in later versions:
arch/mips/jz4740/irq.h:21:38: error: 'struct irq_data' declared inside parameter list will not be visible outside of this definition or declaration [-Werror] arch/mips/jz4740/irq.h:20:39: error: 'struct irq_data' declared inside parameter list will not be visible outside of this definition or declaration [-Werror] include/linux/irqdesc.h:92:33: error: 'NR_IRQS' undeclared here (not in a function)arch/mips/jz4740/irq.c:91:41: error: 'JZ4740_IRQ_BASE' undeclared (first use in this function)arch/mips/jz4740/irq.c:68:6: error: conflicting types for 'jz4740_irq_resume'arch/mips/jz4740/irq.c:62:6: error: conflicting types for 'jz4740_irq_suspend'arch/mips/jz4740/irq.c:49:39: error: 'JZ4740_IRQ_BASE' undeclared (first use in this function)arch/mips/jz4740/gpio.c:47:32: error: initializer element is not constantarch/mips/jz4740/gpio.c:46:32: error: initializer element is not constantarch/mips/jz4740/gpio.c:45:32: error: initializer element is not constantarch/mips/jz4740/gpio.c:44:32: error: initializer element is not constantarch/mips/jz4740/gpio.c:447:22: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types] arch/mips/jz4740/gpio.c:446:23: error: assignment from incompatible pointer type [-Werror=incompatible-pointer-types] arch/mips/jz4740/gpio.c:427:14: error: implicit declaration of function 'JZ4740_IRQ_INTC_GPIO' [-Werror=implicit-function-declaration] arch/mips/jz4740/gpio.c:269:9: error: implicit declaration of function 'JZ4740_IRQ_GPIO' [-Werror=implicit-function-declaration]
The problem seems to be caused by commit 83bc76920080 ("MIPS: JZ4740: Use generic irq chip") from linux-3.2, but only showed up in a defconfig build when qi_lb60_defconfig was added in linux-3.13 and that configuration never successfully built.
The code has changed in a number of ways before 4.4, which builds fine. While I did not bisect the problem to a specific change, I found a simple fix by including the obviously missing header.
--- arch/mips/jz4740/irq.h | 2 ++ 1 file changed, 2 insertions(+)
arch/mips/jz4740/irq.h +2 -0
@@ -16,7 +16,9 @@#define __MIPS_JZ4740_IRQ_H__#include <linux/irq.h> +#include <asm/mach-jz4740/irq.h> +struct irq_data ;extern void jz4740_irq_suspend (struct irq_data *data);extern void jz4740_irq_resume (struct irq_data *data);
PATCH 290/294 MIPS: elf2ecoff: Ignore PT_MIPS_ABIFLAGS program headers.
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Ralf Baechle <[email protected]>
commit 26f7c4bd05cf34e63a4a794150ab66a40a5a84a9 upstream.
These are generated by very recent toolchains and result in an error message when attenpting to convert a kernel from ELF to ECOFF.
--- arch/mips/boot/elf2ecoff.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/mips/boot/elf2ecoff.c +4 -2
@@ -49,7 +49,8 @@/* * Some extra ELF definitions */ -#define PT_MIPS_REGINFO 0x70000000/* Register usage information */ +#define PT_MIPS_REGINFO 0x70000000/* Register usage information */ +#define PT_MIPS_ABIFLAGS 0x70000003/* Records ABI related flags */ /* -------------------------------------------------------------------- */
@@ -347,7 +348,8 @@ int main(int argc, char *argv[])/* Section types we can ignore... */ if (ph[i].p_type ==PT_NULL || ph[i].p_type ==PT_NOTE || ph[i].p_type ==PT_PHDR - || ph[i].p_type ==PT_MIPS_REGINFO ) + || ph[i].p_type ==PT_MIPS_REGINFO + || ph[i].p_type ==PT_MIPS_ABIFLAGS )continue ;/* Section types we can't handle... */ else if (ph[i].p_type !=PT_LOAD ) {
PATCH 291/294 net: ti: cpmac: Fix compiler warning due to type confusion
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Paul Burton <[email protected]>
commit 2f5281ba2a8feaf6f0aee93356f350855bb530fc upstream.
cpmac_start_xmit() used the max() macro on skb->len (an unsigned int) and ETH_ZLEN (a signed int literal). This led to the following compiler warning:
In file included from include/linux/list.h:8:0,
from include/linux/module.h:9,
from drivers/net/ethernet/ti/cpmac.c:19:
drivers/net/ethernet/ti/cpmac.c: In function 'cpmac_start_xmit':
include/linux/kernel.h:748:17: warning: comparison of distinct pointer types lacks a cast
(void) (&_max1 == &_max2); \
^
drivers/net/ethernet/ti/cpmac.c:560:8: note: in expansion of macro 'max'
len = max(skb->len, ETH_ZLEN);
^On top of this, it assigned the result of the max() macro to a signed integer whilst all further uses of it result in it being cast to varying widths of unsigned integer.
Fix this up by using max_t to ensure the comparison is performed as unsigned integers, and for consistency change the type of the len variable to unsigned int.
--- drivers/net/ethernet/ti/cpmac.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/ethernet/ti/cpmac.c +3 -2
@@ -543,7 +543,8 @@ fatal_error:static int cpmac_start_xmit (struct sk_buff *skb,struct net_device *dev) { -int queue, len; +int queue; +unsigned int len;struct cpmac_desc *desc;struct cpmac_priv *priv =netdev_priv (dev);
@@ -553,7 +554,7 @@ static int cpmac_start_xmit(struct sk_buif (unlikely (skb_padto (skb,ETH_ZLEN )))return NETDEV_TX_OK ; - len =max (skb->len,ETH_ZLEN ); + len = max_t(unsigned int, skb->len, ETH_ZLEN); queue =skb_get_queue_mapping (skb);netif_stop_subqueue (dev, queue);
PATCH 292/294 e1000e: fix call to do_div() to use u64 arg
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Kirsher <[email protected]>
commit 30544af5483755b11bb5924736e9e0b45ef0644a upstream.
We were using s64 for lat_ns (latency nano-second value) since in our calculations a negative value could be a resultant. For negative values, we then assign lat_ns to be zero, so the value passed to do_div() was never negative, but do_div() expects the argument type to be u64, so do a cast to resolve a compile warning seen on PowerPC.
--- drivers/net/ethernet/intel/e1000e/ich8lan.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/e1000e/ich8lan.c +7 -6
@@ -984,7 +984,7 @@ static s32 e1000_platform_pm_pch_lpt(stru16 max_snoop, max_nosnoop;u16 max_ltr_enc;/* max LTR latency encoded */ s64 lat_ns;/* latency (ns) */ -s64 value; +u64 value;u32 rxa;if (!hw->adapter->max_frame_size) {
@@ -1011,12 +1011,13 @@ static s32 e1000_platform_pm_pch_lpt(str*/ lat_ns = ((s64 )rxa *1024 - (2 * (s64 )hw->adapter->max_frame_size)) *8 *1000 ; -if (lat_ns <0 ) - lat_ns =0 ; -else -do_div (lat_ns, speed); +if (lat_ns <0 ) { + value =0 ; + }else { + value = lat_ns; +do_div (value, speed); + } - value = lat_ns;while (value >PCI_LTR_VALUE_MASK ) { scale++; value =DIV_ROUND_UP (value, (1 <<5 ));
PATCH 293/294 MIPS: Fix a warning for virt_to_page
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Zubair Lutfullah Kakakhel <[email protected]>
commit 4d5b3bdc0ecb0cf5b1e1598eeaaac4b5cb33868d upstream.
Compiling mm/highmem.c gives a warning: passing argument 1 of 'virt_to_phys' makes pointer from integer without a cast
Fixed by casting to void*
Patchwork: https://patchwork.linux-mips.org/patch/7337/
--- arch/mips/include/asm/page.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/mips/include/asm/page.h +2 -1
@@ -223,7 +223,8 @@ static inline int pfn_valid(unsigned lon#endif -#define virt_to_page (kaddr) pfn_to_page(PFN_DOWN(virt_to_phys(kaddr))) +#define virt_to_page (kaddr) pfn_to_page(PFN_DOWN(virt_to_phys((void *) \ + (kaddr))))extern int __virt_addr_valid (const volatile void *kaddr);#define virt_addr_valid (kaddr) \
PATCH 294/294 net/xen-netback: disable on 64KB page granularity
In reply to Ben Hutchings3.16.50-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Arnd Bergmann <[email protected]>
Building the linux-3.16 stable branch, I ran into this warning that shows a serious problem in the xen-netback driver:
drivers/net/xen-netback/netback.c: In function 'xenvif_dealloc_kthread':drivers/net/xen-netback/netback.c:2002:1: error: the frame size of 16384 bytes is larger than 2048 bytes [-Werror=frame-larger-than=]
The bug was fixed in linux-4.4, but for any older stable kernel we either need to backport that fix, or not use the driver when the page size is set to 64KB. As the proper fix is way bigger than the usual limit for stable backport patches, this adds a Kconfig dependency.
--- drivers/net/Kconfig | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/Kconfig +3 -0
@@ -331,6 +331,9 @@ config XEN_NETDEV_FRONTEND config XEN_NETDEV_BACKEND tristate "Xen backend network device" depends on XEN_BACKEND + depends on !(PAGE_SIZE_64KB || ARM64_64K_PAGES || \ + IA64_PAGE_SIZE_64KB || MICROBLAZE_64K_PAGES || \ + PARISC_PAGE_SIZE_64KB || PPC_64K_PAGES) help This driver allows the kernel to act as a Xen network driver domain which exports paravirtual network devices to other
Quoted 8 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.16.50 release. There are 294 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Nov 08 18:00:00 UTC 2017. Anything received after that time might be too late.
Build results:
total: 136 pass: 136 fail: 0 Qemu test results: total: 108 pass: 108 fail: 0
Details are available at http://kerneltests.org/builders.
Guenter
Quoted 11 lines · Guenter Roeck
Quoted 8 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.16.50 release. There are 294 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Nov 08 18:00:00 UTC 2017. Anything received after that time might be too late.
Quoted 6 lines
Build results:
total: 136 pass: 136 fail: 0 Qemu test results: total: 108 pass: 108 fail: 0Details are available at http://kerneltests.org/builders.
Thanks for checking these.
Ben.
Signature · 3 lines
Ben Hutchings It is impossible to make anything foolproof because fools are so ingenious.
Quoted 10 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.16.50 release. There are 294 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Nov 08 18:00:00 UTC 2017. Anything received after that time might be too late.
A combined patch relative to 3.16.49 will be posted as an additional response to this. A shortlog and diffstat can be found below.
I haven'tr tried building the proposed patches so far, as I was waiting for the kernelci builds.
However, I see that the stable-rc/linux-3.16.y doesn't have the current set, it still points to the old 3.16.35 release from last year.
I think if you upload the branch to the stable-rc git, that should produce the automated build and boot results via email or via the
https://kernelci.org/job/ interface. Once there are some results there, I'll go through the list once more to see what warnings and failures remain.
I'm not in a hurry to fix the old warnings, and can do that pass after the 3.16 release is out on git and in kernelci, but it would help to see if the bots has caught any regressions.
Arnd
Quoted 9 lines · Arnd Bergmann
Quoted 8 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.16.50 release. There are 294 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Nov 08 18:00:00 UTC 2017. Anything received after that time might be too late.
Quoted 8 lines
Quoted 2 lines
A combined patch relative to 3.16.49 will be posted as an additional response to this. A shortlog and diffstat can be found below.
I haven'tr tried building the proposed patches so far, as I was waiting for the kernelci builds.
However, I see that the stable-rc/linux-3.16.y doesn't have the current set, it still points to the old 3.16.35 release from last year.
That's because I don't always update the stable-rc tree for other people's releases. I can start doing that, just never have in the past.
Quoted 5 lines
I think if you upload the branch to the stable-rc git, that should produce the automated build and boot results via email or via the
https://kernelci.org/job/ interface. Once there are some results there, I'll go through the list once more to see what warnings and failures remain.
I don't know of a way to have others push to that tree/branch at the moment :(
I'll go update that branch now...
greg k-h
Quoted 13 lines · Greg KH
Quoted 12 lines · Arnd Bergmann
Quoted 10 lines · Ben Hutchings
This is the start of the stable review cycle for the 3.16.50 release. There are 294 patches in this series, which will be posted as responses to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Fri Nov 08 18:00:00 UTC 2017. Anything received after that time might be too late.
A combined patch relative to 3.16.49 will be posted as an additional response to this. A shortlog and diffstat can be found below.
Quoted 8 lines
Quoted 5 lines
I haven'tr tried building the proposed patches so far, as I was waiting for the kernelci builds.
However, I see that the stable-rc/linux-3.16.y doesn't have the current set, it still points to the old 3.16.35 release from last year.
That's because I don't always update the stable-rc tree for other people's releases. I can start doing that, just never have in the past.
I hadn't realized that you are the only one pushing to that git tree, I simply assumed that all owners of stable kernels had write access to all the branches.
Quoted 10 lines
Quoted 5 lines
I think if you upload the branch to the stable-rc git, that should produce the automated build and boot results via email or via the
https://kernelci.org/job/ interface. Once there are some results there, I'll go through the list once more to see what warnings and failures remain.I don't know of a way to have others push to that tree/branch at the moment :(
I'll go update that branch now...
Thanks!
With the arm-soc tree, we simply have a shared group-id on gitolite.kernel.org and everyone in that group can push to it.
If that is the only thing you need, it should be trivial to let Ben and Sasha push to /pub/scm/linux/kernel/git/stable/*.git as well, I'm sure [email protected] can arrange that. Of course if you are worried about having multiple accounts with write access to all the branches, then that wouldn't be enough.
Arnd
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Greg KH
On Thu, Nov 09, 2017 at 12:55:30PM +0100, Arnd Bergmann wrote:
[...]
Quoted 13 lines
Quoted 10 lines
Quoted 5 lines
I think if you upload the branch to the stable-rc git, that should produce the automated build and boot results via email or via the
https://kernelci.org/job/ interface. Once there are some results there, I'll go through the list once more to see what warnings and failures remain.I don't know of a way to have others push to that tree/branch at the moment :(
I'll go update that branch now...
Thanks!
Quoted 8 lines
With the arm-soc tree, we simply have a shared group-id on gitolite.kernel.org and everyone in that group can push to it.
If that is the only thing you need, it should be trivial to let Ben and Sasha push to /pub/scm/linux/kernel/git/stable/*.git as well, I'm sure [email protected] can arrange that. Of course if you are worried about having multiple accounts with write access to all the branches, then that wouldn't be enough.
I think I'd rather send a pull request to Greg at the start of the review period.
Ben.
Signature · 2 lines
Ben Hutchings 73.46% of all statistics are made up.
Quoted 20 lines · Ben Hutchings
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Greg KH
On Thu, Nov 09, 2017 at 12:55:30PM +0100, Arnd Bergmann wrote:
[...]
Quoted 16 lines
Quoted 10 lines
Quoted 5 lines
I think if you upload the branch to the stable-rc git, that should produce the automated build and boot results via email or via the
https://kernelci.org/job/ interface. Once there are some results there, I'll go through the list once more to see what warnings and failures remain.I don't know of a way to have others push to that tree/branch at the moment :(
I'll go update that branch now...
Thanks!
With the arm-soc tree, we simply have a shared group-id on gitolite.kernel.org and everyone in that group can push to it.
Quoted 8 lines
Quoted 5 lines
If that is the only thing you need, it should be trivial to let Ben and Sasha push to /pub/scm/linux/kernel/git/stable/*.git as well, I'm sure [email protected] can arrange that. Of course if you are worried about having multiple accounts with write access to all the branches, then that wouldn't be enough.
I think I'd rather send a pull request to Greg at the start of the review period.
That works for me!
Quoted 27 lines · Greg KH
Quoted 26 lines · Ben Hutchings
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Greg KH
On Thu, Nov 09, 2017 at 12:55:30PM +0100, Arnd Bergmann wrote:
[...]
Quoted 21 lines
Quoted 10 lines
Quoted 5 lines
I think if you upload the branch to the stable-rc git, that should produce the automated build and boot results via email or via the
https://kernelci.org/job/ interface. Once there are some results there, I'll go through the list once more to see what warnings and failures remain.I don't know of a way to have others push to that tree/branch at the moment :(
I'll go update that branch now...
Thanks!
With the arm-soc tree, we simply have a shared group-id on gitolite.kernel.org and everyone in that group can push to it.
If that is the only thing you need, it should be trivial to let Ben and Sasha push to /pub/scm/linux/kernel/git/stable/*.git as well, I'm sure [email protected] can arrange that. Of course if you are worried about having multiple accounts with write access to all the branches, then that wouldn't be enough.
Quoted 4 lines
Quoted 2 lines
I think I'd rather send a pull request to Greg at the start of the review period.
That works for me!
We just discussed this on the #kernelci IRC channel. Since kernelci has a whitelist of branches and 3.16 isn't currently on it, how about just adding a different git tree for Ben's 3.2-rc and 3.16-rc releases?
Ben, do you have a git URL that we can add to kernelci, and and an email address you want to see the build results at?
Arnd
Quoted 31 lines · Arnd Bergmann
Quoted 30 lines · Greg KH
Quoted 28 lines · Ben Hutchings
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Greg KH
On Thu, Nov 09, 2017 at 12:55:30PM +0100, Arnd Bergmann wrote:
[...]
Quoted 13 lines
Quoted 10 lines
Quoted 5 lines
I think if you upload the branch to the stable-rc git, that should produce the automated build and boot results via email or via the
https://kernelci.org/job/ interface. Once there are some results there, I'll go through the list once more to see what warnings and failures remain.I don't know of a way to have others push to that tree/branch at the moment :(
I'll go update that branch now...
Thanks!
Quoted 8 lines
With the arm-soc tree, we simply have a shared group-id on gitolite.kernel.org and everyone in that group can push to it.
If that is the only thing you need, it should be trivial to let Ben and Sasha push to /pub/scm/linux/kernel/git/stable/*.git as well, I'm sure [email protected] can arrange that. Of course if you are worried about having multiple accounts with write access to all the branches, then that wouldn't be enough.
I think I'd rather send a pull request to Greg at the start of the review period.
Quoted 9 lines
Quoted 1 line
That works for me!
We just discussed this on the #kernelci IRC channel. Since kernelci has a whitelist of branches and 3.16 isn't currently on it, how about just adding a different git tree for Ben's 3.2-rc and 3.16-rc releases?
Ben, do you have a git URL that we can add to kernelci, and and an email address you want to see the build results at?
Would be great. Maybe I can then finally shut down kerneltests.org as redundant.
Guenter
Quoted 28 lines · Arnd Bergmann
Quoted 27 lines · Greg KH
Quoted 26 lines · Ben Hutchings
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Greg KH
On Thu, Nov 09, 2017 at 12:55:30PM +0100, Arnd Bergmann wrote:
[...]
Quoted 21 lines
Quoted 10 lines
Quoted 5 lines
I think if you upload the branch to the stable-rc git, that should produce the automated build and boot results via email or via the
https://kernelci.org/job/ interface. Once there are some results there, I'll go through the list once more to see what warnings and failures remain.I don't know of a way to have others push to that tree/branch at the moment :(
I'll go update that branch now...
Thanks!
With the arm-soc tree, we simply have a shared group-id on gitolite.kernel.org and everyone in that group can push to it.
If that is the only thing you need, it should be trivial to let Ben and Sasha push to /pub/scm/linux/kernel/git/stable/*.git as well, I'm sure [email protected] can arrange that. Of course if you are worried about having multiple accounts with write access to all the branches, then that wouldn't be enough.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
I think I'd rather send a pull request to Greg at the start of the review period.
That works for me!
We just discussed this on the #kernelci IRC channel. Since kernelci has a whitelist of branches and 3.16 isn't currently on it, how about just adding a different git tree for Ben's 3.2-rc and 3.16-rc releases?
We are currently reaching the limits of our current build capacity, so want to understand the users before adding more trees.
That being said, it seems Ben is now pushing to Greg's stable-rc, so we can pretty easily add linux-3.16.y to our list of stable-rc branches if there is enough interest. Also, we would much prefer monitoring a git branch, since kernelci does not currently deal with git + quilt (and we have no time, and less motivation to add it) :)
Kevin
Quoted 38 lines · Kevin Hilman
Quoted 28 lines · Arnd Bergmann
Quoted 27 lines · Greg KH
Quoted 26 lines · Ben Hutchings
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Greg KH
On Thu, Nov 09, 2017 at 12:55:30PM +0100, Arnd Bergmann wrote:
[...]
Quoted 21 lines
Quoted 10 lines
Quoted 5 lines
I think if you upload the branch to the stable-rc git, that should produce the automated build and boot results via email or via the
https://kernelci.org/job/ interface. Once there are some results there, I'll go through the list once more to see what warnings and failures remain.I don't know of a way to have others push to that tree/branch at the moment :(
I'll go update that branch now...
Thanks!
With the arm-soc tree, we simply have a shared group-id on gitolite.kernel.org and everyone in that group can push to it.
If that is the only thing you need, it should be trivial to let Ben and Sasha push to /pub/scm/linux/kernel/git/stable/*.git as well, I'm sure [email protected] can arrange that. Of course if you are worried about having multiple accounts with write access to all the branches, then that wouldn't be enough.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
I think I'd rather send a pull request to Greg at the start of the review period.
That works for me!
We just discussed this on the #kernelci IRC channel. Since kernelci has a whitelist of branches and 3.16 isn't currently on it, how about just adding a different git tree for Ben's 3.2-rc and 3.16-rc releases?
Quoted 8 lines
We are currently reaching the limits of our current build capacity, so want to understand the users before adding more trees.
That being said, it seems Ben is now pushing to Greg's stable-rc, so we can pretty easily add linux-3.16.y to our list of stable-rc branches if there is enough interest. Also, we would much prefer monitoring a git branch, since kernelci does not currently deal with git + quilt (and we have no time, and less motivation to add it) :)
Ben does not push to Greg's stable-rc, that was a mistake on my side, but he does now have a git tree at
https://git.kernel.org/pub/scm/linux/kernel/git/bwh/linux-stable-rc.git
that he said he'd push to in order to trigger build bots. It's not git+quilt, so I'd assume it's still very easy to add, and the releases are rare enough that I would not expect too much additional work for kernelci.
Arnd
Quoted 42 lines · Arnd Bergmann
Quoted 41 lines · Kevin Hilman
Quoted 28 lines · Arnd Bergmann
Quoted 27 lines · Greg KH
Quoted 26 lines · Ben Hutchings
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Greg KH
On Thu, Nov 09, 2017 at 12:55:30PM +0100, Arnd Bergmann wrote:
[...]
Quoted 21 lines
Quoted 10 lines
Quoted 5 lines
I think if you upload the branch to the stable-rc git, that should produce the automated build and boot results via email or via the
https://kernelci.org/job/ interface. Once there are some results there, I'll go through the list once more to see what warnings and failures remain.I don't know of a way to have others push to that tree/branch at the moment :(
I'll go update that branch now...
Thanks!
With the arm-soc tree, we simply have a shared group-id on gitolite.kernel.org and everyone in that group can push to it.
If that is the only thing you need, it should be trivial to let Ben and Sasha push to /pub/scm/linux/kernel/git/stable/*.git as well, I'm sure [email protected] can arrange that. Of course if you are worried about having multiple accounts with write access to all the branches, then that wouldn't be enough.
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
I think I'd rather send a pull request to Greg at the start of the review period.
That works for me!
We just discussed this on the #kernelci IRC channel. Since kernelci has a whitelist of branches and 3.16 isn't currently on it, how about just adding a different git tree for Ben's 3.2-rc and 3.16-rc releases?
We are currently reaching the limits of our current build capacity, so want to understand the users before adding more trees.
Quoted 8 lines
Quoted 5 lines
That being said, it seems Ben is now pushing to Greg's stable-rc, so we can pretty easily add linux-3.16.y to our list of stable-rc branches if there is enough interest. Also, we would much prefer monitoring a git branch, since kernelci does not currently deal with git + quilt (and we have no time, and less motivation to add it) :)
Ben does not push to Greg's stable-rc, that was a mistake on my side,
Any reason not to push to Greg's stable-rc (or have Greg pull)?
It would be a lot simpler from our side if we didn't have to track the various stable tree maintainers.
Kevin
Quoted 20 lines · Ben Hutchings
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Greg KH
On Thu, Nov 09, 2017 at 12:55:30PM +0100, Arnd Bergmann wrote:
[...]
Quoted 16 lines
Quoted 10 lines
Quoted 5 lines
I think if you upload the branch to the stable-rc git, that should produce the automated build and boot results via email or via the
https://kernelci.org/job/ interface. Once there are some results there, I'll go through the list once more to see what warnings and failures remain.I don't know of a way to have others push to that tree/branch at the moment :(
I'll go update that branch now...
Thanks!
With the arm-soc tree, we simply have a shared group-id on gitolite.kernel.org and everyone in that group can push to it.
Quoted 9 lines
Quoted 5 lines
If that is the only thing you need, it should be trivial to let Ben and Sasha push to /pub/scm/linux/kernel/git/stable/*.git as well, I'm sure [email protected] can arrange that. Of course if you are worried about having multiple accounts with write access to all the branches, then that wouldn't be enough.
I think I'd rather send a pull request to Greg at the start of the review period.
If you change the trees I am supposed to pull from for my builders, please let me know.
Guenter
Quoted 28 lines · Guenter Roeck
Quoted 27 lines · Ben Hutchings
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Greg KH
On Thu, Nov 09, 2017 at 12:55:30PM +0100, Arnd Bergmann wrote:
[...]
Quoted 21 lines
Quoted 10 lines
Quoted 5 lines
I think if you upload the branch to the stable-rc git, that should produce the automated build and boot results via email or via the
https://kernelci.org/job/ interface. Once there are some results there, I'll go through the list once more to see what warnings and failures remain.I don't know of a way to have others push to that tree/branch at the moment :(
I'll go update that branch now...
Thanks!
With the arm-soc tree, we simply have a shared group-id on gitolite.kernel.org and everyone in that group can push to it.
If that is the only thing you need, it should be trivial to let Ben and Sasha push to /pub/scm/linux/kernel/git/stable/*.git as well, I'm sure [email protected] can arrange that. Of course if you are worried about having multiple accounts with write access to all the branches, then that wouldn't be enough.
Quoted 6 lines
Quoted 3 lines
I think I'd rather send a pull request to Greg at the start of the review period.
If you change the trees I am supposed to pull from for my builders, please let me know.
If you're happy to keep supporting quilt-in-git then there's no change. I check your builders page and try to fix up build failures before even making a release candidate.
Ben.
Signature · 2 lines
Ben Hutchings 73.46% of all statistics are made up.
Quoted 33 lines · Ben Hutchings
Quoted 32 lines · Guenter Roeck
Quoted 30 lines · Ben Hutchings
Quoted 2 lines · Arnd Bergmann
Quoted 1 line · Greg KH
On Thu, Nov 09, 2017 at 12:55:30PM +0100, Arnd Bergmann wrote:
[...]
Quoted 13 lines
Quoted 10 lines
Quoted 5 lines
I think if you upload the branch to the stable-rc git, that should produce the automated build and boot results via email or via the
https://kernelci.org/job/ interface. Once there are some results there, I'll go through the list once more to see what warnings and failures remain.I don't know of a way to have others push to that tree/branch at the moment :(
I'll go update that branch now...
Thanks!
Quoted 8 lines
With the arm-soc tree, we simply have a shared group-id on gitolite.kernel.org and everyone in that group can push to it.
If that is the only thing you need, it should be trivial to let Ben and Sasha push to /pub/scm/linux/kernel/git/stable/*.git as well, I'm sure [email protected] can arrange that. Of course if you are worried about having multiple accounts with write access to all the branches, then that wouldn't be enough.
I think I'd rather send a pull request to Greg at the start of the review period.
Quoted 7 lines
Quoted 2 lines
If you change the trees I am supposed to pull from for my builders, please let me know.
If you're happy to keep supporting quilt-in-git then there's no change. I check your builders page and try to fix up build failures before even making a release candidate.
Ah yes, kernelci won't pick that up. No problem to keep kerneltests going as long as it adds value.
Guenter