netfilter: nfnetlink_cthelper: Remove 'const' and '&' to avoid warnings
Subsystems (2)
PATCH 1/1 netfilter: nfnetlink_cthelper: Remove 'const' and '&' to avoid warnings
From: Chen Gang <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit b18c5d15e8714336365d9d51782d5b53afa0443c upstream.
The related code can be simplified, and also can avoid related warnings (with allmodconfig under parisc):
CC [M] net/netfilter/nfnetlink_cthelper.o
net/netfilter/nfnetlink_cthelper.c: In function ‘nfnl_cthelper_from_nlattr’:
net/netfilter/nfnetlink_cthelper.c:97:9: warning: passing argument 1 o ‘memcpy’ discards ‘const’ qualifier from pointer target type [-Wdiscarded-array-qualifiers]
memcpy(&help->data, nla_data(attr), help->helper->data_len);
^
In file included from include/linux/string.h:17:0,
from include/uapi/linux/uuid.h:25,
from include/linux/uuid.h:23,
from include/linux/mod_devicetable.h:12,
from ./arch/parisc/include/asm/hardware.h:4,
from ./arch/parisc/include/asm/processor.h:15,
from ./arch/parisc/include/asm/spinlock.h:6,
from ./arch/parisc/include/asm/atomic.h:21,
from include/linux/atomic.h:4,
from ./arch/parisc/include/asm/bitops.h:12,
from include/linux/bitops.h:36,
from include/linux/kernel.h:10,
from include/linux/list.h:8,
from include/linux/module.h:9,
from net/netfilter/nfnetlink_cthelper.c:11:
./arch/parisc/include/asm/string.h:8:8: note: expected ‘void *’ but argument is of type ‘const char (*)[]’
void * memcpy(void * dest,const void *src,size_t count);
^--- net/netfilter/nfnetlink_cthelper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/netfilter/nfnetlink_cthelper.c +2 -2
@@ -89,7 +89,7 @@ nfnl_cthelper_parse_tuple(struct nf_conntrack_tuple *tuple,static int nfnl_cthelper_from_nlattr (struct nlattr *attr,struct nf_conn *ct) { -const struct nf_conn_help *help =nfct_help (ct); +struct nf_conn_help *help =nfct_help (ct);if (attr ==NULL )return -EINVAL ;
@@ -97,7 +97,7 @@ nfnl_cthelper_from_nlattr(struct nlattr *attr, struct nf_conn *ct)if (help->helper->data_len ==0 )return -EINVAL ; -memcpy (&help->data,nla_data (attr), help->helper->data_len); +memcpy (help->data,nla_data (attr), help->helper->data_len);return 0 ; }
Signature · 1 line
2.4.6
PATCH 1/1 MIPS: Fix KVM guest fixmap address
From: James Hogan <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 8e748c8d09a9314eedb5c6367d9acfaacddcdc88 upstream.
KVM guest kernels for trap & emulate run in user mode, with a modified set of kernel memory segments. However the fixmap address is still in the normal KSeg3 region at 0xfffe0000 regardless, causing problems when cache alias handling makes use of them when handling copy on write.
Therefore define FIXADDR_TOP as 0x7ffe0000 in the guest kernel mapped region when CONFIG_KVM_GUEST is defined.
Patchwork: https://patchwork.linux-mips.org/patch/9887/
--- arch/mips/include/asm/mach-generic/spaces.h | 4 ++++ 1 file changed, 4 insertions(+)
arch/mips/include/asm/mach-generic/spaces.h +4 -0
@@ -94,7 +94,11 @@#endif #ifndef FIXADDR_TOP +#ifdef CONFIG_KVM_GUEST +#define FIXADDR_TOP ((unsigned long)(long)(int)0x7ffe0000) +#else #define FIXADDR_TOP ((unsigned long)(long)(int)0xfffe0000)#endif +#endif #endif /* __ASM_MACH_GENERIC_SPACES_H */
Signature · 1 line
2.4.6
PATCH 1/1 revert "softirq: Add support for triggering softirq work on softirqs"
In reply to Jiri SlabyFrom: Christoph Hellwig <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit fc21c0cff2f425891b28ff6fb6b03b325c977428 upstream.
This commit was incomplete in that code to remove items from the per-cpu lists was missing and never acquired a user in the 5 years it has been in the tree. We're going to implement what it seems to try to archive in a simpler way, and this code is in the way of doing so.
--- include/linux/interrupt.h | 22 -------- kernel/softirq.c | 131 ---------------------------------------------- 2 files changed, 153 deletions(-)
include/linux/interrupt.h +0 -22
@@ -11,8 +11,6 @@#include <linux/irqnr.h> #include <linux/hardirq.h> #include <linux/irqflags.h> -#include <linux/smp.h> -#include <linux/percpu.h> #include <linux/hrtimer.h> #include <linux/kref.h> #include <linux/workqueue.h>
@@ -419,15 +417,6 @@ extern void __raise_softirq_irqoff(unsigned int nr);extern void raise_softirq_irqoff (unsigned int nr);extern void raise_softirq (unsigned int nr); -/* This is the worklist that queues up per-cpu softirq work. -* -* send_remote_sendirq() adds work to these lists, and -* the softirq handler itself dequeues from them. The queues -* are protected by disabling local cpu interrupts and they must -* only be accessed by the local cpu that they are for. -*/ -DECLARE_PER_CPU(struct list_head [NR_SOFTIRQS], softirq_work_list); - DECLARE_PER_CPU(struct task_struct *, ksoftirqd);static inline struct task_struct *this_cpu_ksoftirqd (void )
@@ -435,17 +424,6 @@ static inline struct task_struct *this_cpu_ksoftirqd(void)return this_cpu_read (ksoftirqd); } -/* Try to send a softirq to a remote cpu. If this cannot be done, the -* work will be queued to the local cpu. -*/ -extern void send_remote_softirq (struct call_single_data *cp,int cpu,int softirq); - -/* Like send_remote_softirq(), but the caller must disable local cpu interrupts -* and compute the current cpu, passed in as 'this_cpu'. -*/ -extern void __send_remote_softirq (struct call_single_data *cp,int cpu, -int this_cpu,int softirq); -/* Tasklets --- multithreaded analogue of BHs. Main feature differing them of generic softirqs: tasklet
kernel/softirq.c +0 -131
154 lines not on this page · raw message
Signature · 1 line
2.4.6
Re: [patch added to the 3.12 stable tree] revert "softirq: Add support for triggering softirq work on softirqs"
Quoted 4 lines · Jiri Slaby
From: Christoph Hellwig <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
How is reverting dead code -stable material?
.
Re: [patch added to the 3.12 stable tree] revert "softirq: Add support for triggering softirq work on softirqs"
Quoted 7 lines · Christoph Hellwig
Quoted 4 lines · Jiri Slaby
From: Christoph Hellwig <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
How is reverting dead code -stable material?
PLease see
http://www.spinics.net/lists/stable/msg95573.html
thanks,
Signature · 2 lines
js suse labs
Re: [patch added to the 3.12 stable tree] revert "softirq: Add support for triggering softirq work on softirqs"
Quoted 11 lines · Jiri Slaby
Quoted 7 lines · Christoph Hellwig
Quoted 4 lines · Jiri Slaby
From: Christoph Hellwig <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
How is reverting dead code -stable material?
Ok, after proper investigation, I dropped the patch as it does not makes sense to do the revert when there are no users.
Thanks for pointing out.
Signature · 2 lines
js suse labs
PATCH 1/1 ARM: clk-imx6q: refine sata's parent
In reply to Jiri SlabyFrom: Sebastien Szymanski <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit da946aeaeadcd24ff0cda9984c6fb8ed2bfd462a upstream.
According to IMX6D/Q RM, table 18-3, sata clock's parent is ahb, not ipg.
--- arch/arm/mach-imx/clk-imx6q.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-imx/clk-imx6q.c +1 -1
@@ -535,7 +535,7 @@ static void __init imx6q_clocks_init(struct device_node *ccm_node) clk[gpmi_io] =imx_clk_gate2 ("gpmi_io" ,"enfc" , base +0x78 ,28 ); clk[gpmi_apb] =imx_clk_gate2 ("gpmi_apb" ,"usdhc3" , base +0x78 ,30 ); clk[rom] =imx_clk_gate2 ("rom" ,"ahb" , base +0x7c ,0 ); - clk[sata] =imx_clk_gate2 ("sata" ,"ipg" , base +0x7c ,4 ); + clk[sata] =imx_clk_gate2 ("sata" ,"ahb" , base +0x7c ,4 ); clk[sdma] =imx_clk_gate2 ("sdma" ,"ahb" , base +0x7c ,6 ); clk[spba] =imx_clk_gate2 ("spba" ,"ipg" , base +0x7c ,12 ); clk[spdif] =imx_clk_gate2 ("spdif" ,"spdif_podf" , base +0x7c ,14 );
Signature · 1 line
2.4.6
PATCH 1/1 Btrfs: make xattr replace operations atomic
In reply to Jiri SlabyFrom: Filipe Manana <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 5f5bc6b1e2d5a6f827bc860ef2dc5b6f365d1339 upstream.
Replacing a xattr consists of doing a lookup for its existing value, delete the current value from the respective leaf, release the search path and then finally insert the new value. This leaves a time window where readers (getxattr, listxattrs) won't see any value for the xattr. Xattrs are used to store ACLs, so this has security implications.
This change also fixes 2 other existing issues which were:
*) Deleting the old xattr value without verifying first if the new xattr will
fit in the existing leaf item (in case multiple xattrs are packed in the same item due to name hash collision);
*) Returning -EEXIST when the flag XATTR_CREATE is given and the xattr doesn't
exist but we have have an existing item that packs muliple xattrs with the same name hash as the input xattr. In this case we should return ENOSPC.
A test case for xfstests follows soon.
Thanks to Alexandre Oliva for reporting the non-atomicity of the xattr replace implementation.
--- fs/btrfs/ctree.c | 2 +- fs/btrfs/ctree.h | 5 ++ fs/btrfs/dir-item.c | 10 ++-- fs/btrfs/xattr.c | 150 ++++++++++++++++++++++++++++++++-------------------- 4 files changed, 102 insertions(+), 65 deletions(-)
fs/btrfs/ctree.c +1 -1
@@ -2926,7 +2926,7 @@ done:*/ if (!p->leave_spinning)btrfs_set_path_blocking (p); -if (ret <0 ) +if (ret <0 && !p->skip_release_on_error)btrfs_release_path (p);return ret; }
fs/btrfs/ctree.h +5 -0
@@ -591,6 +591,7 @@ struct btrfs_path { unsigned int skip_locking:1; unsigned int leave_spinning:1; unsigned int search_commit_root:1; + unsigned int skip_release_on_error:1; };/*
@@ -3546,6 +3547,10 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,int verify_dir_item (struct btrfs_root *root,struct extent_buffer *leaf,struct btrfs_dir_item *dir_item); +struct btrfs_dir_item *btrfs_match_dir_item_name (struct btrfs_root *root, +struct btrfs_path *path, +const char *name, +int name_len);/* orphan.c */ int btrfs_insert_orphan_item(struct btrfs_trans_handle *trans,
fs/btrfs/dir-item.c +3 -7
@@ -21,10 +21,6 @@#include "hash.h" #include "transaction.h" -static struct btrfs_dir_item *btrfs_match_dir_item_name (struct btrfs_root *root, -struct btrfs_path *path, -const char *name,int name_len); -/* * insert a name into a directory, doing overflow properly if there is a hash * collision. data_size indicates how big the item inserted should be. On
@@ -383,9 +379,9 @@ struct btrfs_dir_item *btrfs_lookup_xattr(struct btrfs_trans_handle *trans,* this walks through all the entries in a dir item and finds one * for a specific name. */ -static struct btrfs_dir_item *btrfs_match_dir_item_name (struct btrfs_root *root, -struct btrfs_path *path, -const char *name,int name_len) +struct btrfs_dir_item *btrfs_match_dir_item_name (struct btrfs_root *root, +struct btrfs_path *path, +const char *name,int name_len) {struct btrfs_dir_item *dir_item;unsigned long name_ptr;
fs/btrfs/xattr.c +93 -57
190 lines not on this page · raw message
Signature · 1 line
2.4.6
PATCH 1/1 xfrm: release dst_orig in case of error in xfrm_lookup()
In reply to Jiri SlabyFrom: huaibin Wang <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit ac37e2515c1a89c477459a2020b6bfdedabdb91b upstream.
dst_orig should be released on error. Function like __xfrm_route_forward() expects that behavior.
Since a recent commit, xfrm_lookup() may also be called by xfrm_lookup_route(), which expects the opposite.
Let's introduce a new flag (XFRM_LOOKUP_KEEP_DST_REF) to tell what should be done in case of error.
--- include/net/dst.h | 1 + net/xfrm/xfrm_policy.c | 12 ++++++------ 2 files changed, 7 insertions(+), 6 deletions(-)
include/net/dst.h +1 -0
@@ -469,6 +469,7 @@ extern void dst_init(void);enum {XFRM_LOOKUP_ICMP =1 <<0 ,XFRM_LOOKUP_QUEUE =1 <<1 , +XFRM_LOOKUP_KEEP_DST_REF =1 <<2 , };struct flowi ;
net/xfrm/xfrm_policy.c +6 -6
@@ -2154,11 +2154,9 @@ restart:* have the xfrm_state's. We need to wait for KM to * negotiate new SA's or bail out with error.*/ if (net->xfrm.sysctl_larval_drop) { -dst_release (dst); -xfrm_pols_put (pols, drop_pols);XFRM_INC_STATS (net,LINUX_MIB_XFRMOUTNOSTATES ); - -return ERR_PTR (-EREMOTE ); + err = -EREMOTE ; + goto error; }if (fl->flowi_flags &FLOWI_FLAG_CAN_SLEEP ) {DECLARE_WAITQUEUE (wait, current);
@@ -2224,7 +2222,8 @@ nopol: error:dst_release (dst); dropdst: -dst_release (dst_orig); +if (!(flags &XFRM_LOOKUP_KEEP_DST_REF )) +dst_release (dst_orig);xfrm_pols_put (pols, drop_pols);return ERR_PTR (err); }
@@ -2238,7 +2237,8 @@ struct dst_entry *xfrm_lookup_route(struct net *net, struct dst_entry *dst_orig, struct sock *sk, int flags) {struct dst_entry *dst =xfrm_lookup (net, dst_orig, fl, sk, - flags |XFRM_LOOKUP_QUEUE ); + flags |XFRM_LOOKUP_QUEUE | +XFRM_LOOKUP_KEEP_DST_REF );if (IS_ERR (dst) &&PTR_ERR (dst) == -EREMOTE )return make_blackhole (net, dst_orig->ops->family, dst_orig);
Signature · 1 line
2.4.6
PATCH 1/1 uninline destroy_super(), consolidate alloc_super()
In reply to Jiri SlabyFrom: Al Viro <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 7eb5e8826911f2792179f99e77e75fbb7ef53a4a upstream.
--- fs/super.c | 206 ++++++++++++++++++++++++++----------------------------------- 1 file changed, 86 insertions(+), 120 deletions(-)
fs/super.c +86 -120
@@ -135,33 +135,27 @@ static unsigned long super_cache_count(struct shrinker *shrink,return total_objects; } -static int init_sb_writers (struct super_block *s,struct file_system_type *type) -{ -int err; -int i; - -for (i =0 ; i <SB_FREEZE_LEVELS ; i++) { - err =percpu_counter_init (&s->s_writers.counter[i],0 ); -if (err <0 ) - goto err_out; -lockdep_init_map (&s->s_writers.lock_map[i], sb_writers_name[i], - &type->s_writers_key[i],0 ); - } -init_waitqueue_head (&s->s_writers.wait); -init_waitqueue_head (&s->s_writers.wait_unfrozen); -return 0 ; -err_out: -while (--i >=0 ) -percpu_counter_destroy (&s->s_writers.counter[i]); -return err; -} - -static void destroy_sb_writers (struct super_block *s) +/** +* destroy_super - frees a superblock +* @s: superblock to free +* +* Frees a superblock. +*/ +static void destroy_super (struct super_block *s) {int i; - +list_lru_destroy (&s->s_dentry_lru); +list_lru_destroy (&s->s_inode_lru); +#ifdef CONFIG_SMP +free_percpu (s->s_files); +#endif for (i =0 ; i <SB_FREEZE_LEVELS ; i++)percpu_counter_destroy (&s->s_writers.counter[i]); +security_sb_free (s); +WARN_ON (!list_empty (&s->s_mounts)); +kfree (s->s_subtype); +kfree (s->s_options); +kfree (s); }/**
@@ -176,111 +170,83 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags) {struct super_block *s =kzalloc (sizeof (struct super_block ),GFP_USER );static const struct super_operations default_op; +int i; + +if (!s) +return NULL ; -if (s) { -if (security_sb_alloc (s)) - goto out_free_sb; +if (security_sb_alloc (s)) + goto fail;#ifdef CONFIG_SMP - s->s_files = alloc_percpu(struct list_head); -if (!s->s_files) - goto err_out; -else { -int i; - -for_each_possible_cpu (i) -INIT_LIST_HEAD (per_cpu_ptr (s->s_files, i)); - } + s->s_files = alloc_percpu(struct list_head); +if (!s->s_files) + goto fail; +for_each_possible_cpu (i) +INIT_LIST_HEAD (per_cpu_ptr (s->s_files, i));#else -INIT_LIST_HEAD (&s->s_files); +INIT_LIST_HEAD (&s->s_files);#endif -if (init_sb_writers (s, type)) - goto err_out; - s->s_flags = flags; - s->s_bdi = &default_backing_dev_info; -INIT_HLIST_NODE (&s->s_instances); -INIT_HLIST_BL_HEAD (&s->s_anon); -INIT_LIST_HEAD (&s->s_inodes); - -if (list_lru_init (&s->s_dentry_lru)) - goto err_out; -if (list_lru_init (&s->s_inode_lru)) - goto err_out_dentry_lru; - -INIT_LIST_HEAD (&s->s_mounts); -init_rwsem (&s->s_umount); -lockdep_set_class (&s->s_umount, &type->s_umount_key); -/* -* sget() can have s_umount recursion. -* -* When it cannot find a suitable sb, it allocates a new -* one (this one), and tries again to find a suitable old -* one. -* -* In case that succeeds, it will acquire the s_umount -* lock of the old one. Since these are clearly distrinct -* locks, and this object isn't exposed yet, there's no -* risk of deadlocks. -* -* Annotate this by putting this lock in a different -* subclass. -*/ -down_write_nested (&s->s_umount,SINGLE_DEPTH_NESTING ); - s->s_count =1 ; -atomic_set (&s->s_active,1 ); -mutex_init (&s->s_vfs_rename_mutex); -lockdep_set_class (&s->s_vfs_rename_mutex, &type->s_vfs_rename_key); -mutex_init (&s->s_dquot.dqio_mutex); -mutex_init (&s->s_dquot.dqonoff_mutex); -init_rwsem (&s->s_dquot.dqptr_sem); - s->s_maxbytes =MAX_NON_LFS ; - s->s_op = &default_op; - s->s_time_gran =1000000000 ; - s->cleancache_poolid =-1 ; - - s->s_shrink.seeks =DEFAULT_SEEKS ; - s->s_shrink.scan_objects = super_cache_scan; - s->s_shrink.count_objects = super_cache_count; - s->s_shrink.batch =1024 ; - s->s_shrink.flags =SHRINKER_NUMA_AWARE ; +for (i =0 ; i <SB_FREEZE_LEVELS ; i++) { +if (percpu_counter_init (&s->s_writers.counter[i],0 ) <0 ) + goto fail; +lockdep_init_map (&s->s_writers.lock_map[i], sb_writers_name[i], + &type->s_writers_key[i],0 ); } -out: +init_waitqueue_head (&s->s_writers.wait); +init_waitqueue_head (&s->s_writers.wait_unfrozen); + s->s_flags = flags; + s->s_bdi = &default_backing_dev_info; +INIT_HLIST_NODE (&s->s_instances); +INIT_HLIST_BL_HEAD (&s->s_anon); +INIT_LIST_HEAD (&s->s_inodes); + +if (list_lru_init (&s->s_dentry_lru)) + goto fail; +if (list_lru_init (&s->s_inode_lru)) + goto fail; + +INIT_LIST_HEAD (&s->s_mounts); +init_rwsem (&s->s_umount); +lockdep_set_class (&s->s_umount, &type->s_umount_key); +/* +* sget() can have s_umount recursion. +* +* When it cannot find a suitable sb, it allocates a new +* one (this one), and tries again to find a suitable old +* one. +* +* In case that succeeds, it will acquire the s_umount +* lock of the old one. Since these are clearly distrinct +* locks, and this object isn't exposed yet, there's no +* risk of deadlocks. +* +* Annotate this by putting this lock in a different +* subclass. +*/ +down_write_nested (&s->s_umount,SINGLE_DEPTH_NESTING ); + s->s_count =1 ; +atomic_set (&s->s_active,1 ); +mutex_init (&s->s_vfs_rename_mutex); +lockdep_set_class (&s->s_vfs_rename_mutex, &type->s_vfs_rename_key); +mutex_init (&s->s_dquot.dqio_mutex); +mutex_init (&s->s_dquot.dqonoff_mutex); +init_rwsem (&s->s_dquot.dqptr_sem); + s->s_maxbytes =MAX_NON_LFS ; + s->s_op = &default_op; + s->s_time_gran =1000000000 ; + s->cleancache_poolid =-1 ; + + s->s_shrink.seeks =DEFAULT_SEEKS ; + s->s_shrink.scan_objects = super_cache_scan; + s->s_shrink.count_objects = super_cache_count; + s->s_shrink.batch =1024 ; + s->s_shrink.flags =SHRINKER_NUMA_AWARE ;return s; -err_out_dentry_lru: -list_lru_destroy (&s->s_dentry_lru); -err_out: -security_sb_free (s); -#ifdef CONFIG_SMP -if (s->s_files) -free_percpu (s->s_files); -#endif -destroy_sb_writers (s); -out_free_sb: -kfree (s); - s =NULL ; - goto out; -} - -/** -* destroy_super - frees a superblock -* @s: superblock to free -* -* Frees a superblock. -*/ -static inline void destroy_super (struct super_block *s) -{ -list_lru_destroy (&s->s_dentry_lru); -list_lru_destroy (&s->s_inode_lru); -#ifdef CONFIG_SMP -free_percpu (s->s_files); -#endif -destroy_sb_writers (s); -security_sb_free (s); -WARN_ON (!list_empty (&s->s_mounts)); -kfree (s->s_subtype); -kfree (s->s_options); -kfree (s); +fail: +destroy_super (s); +return NULL ; }/* Superblock refcounting */
Signature · 1 line
2.4.6
PATCH 1/1 get rid of s_files and files_lock
In reply to Jiri SlabyFrom: Al Viro <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit eee5cc2702929fd41cce28058dc6d6717f723f87 upstream.
The only thing we need it for is alt-sysrq-r (emergency remount r/o) and these days we can do just as well without going through the list of files.
--- fs/file_table.c | 125 ----------------------------------------------------- fs/internal.h | 3 -- fs/open.c | 2 - fs/super.c | 15 +------ include/linux/fs.h | 13 ------ 5 files changed, 2 insertions(+), 156 deletions(-)
fs/file_table.c +0 -125
@@ -36,8 +36,6 @@ struct files_stat_struct files_stat = { .max_files = NR_FILE }; -DEFINE_STATIC_LGLOCK (files_lglock); -/* SLAB cache for file structures */ static struct kmem_cache *filp_cachep__read_mostly ;
@@ -134,7 +132,6 @@ struct file *get_empty_filp(void)return ERR_PTR (error); } -INIT_LIST_HEAD (&f->f_u.fu_list);atomic_long_set (&f->f_count,1 );rwlock_init (&f->f_owner.lock);spin_lock_init (&f->f_lock);
@@ -304,7 +301,6 @@ void fput(struct file *file)if (atomic_long_dec_and_test (&file->f_count)) {struct task_struct *task = current; -file_sb_list_del (file);if (likely (!in_interrupt () && !(task->flags &PF_KTHREAD ))) {init_task_work (&file->f_u.fu_rcuhead, ____fput);if (!task_work_add (task, &file->f_u.fu_rcuhead, true))
@@ -333,7 +329,6 @@ void __fput_sync(struct file *file) {if (atomic_long_dec_and_test (&file->f_count)) {struct task_struct *task = current; -file_sb_list_del (file);BUG_ON (!(task->flags &PF_KTHREAD ));__fput (file); }
@@ -345,129 +340,10 @@ void put_filp(struct file *file) {if (atomic_long_dec_and_test (&file->f_count)) {security_file_free (file); -file_sb_list_del (file);file_free (file); } } -static inline int file_list_cpu (struct file *file) -{ -#ifdef CONFIG_SMP -return file->f_sb_list_cpu; -#else -return smp_processor_id (); -#endif -} - -/* helper for file_sb_list_add to reduce ifdefs */ -static inline void __file_sb_list_add (struct file *file,struct super_block *sb) -{ -struct list_head *list; -#ifdef CONFIG_SMP -int cpu; - cpu =smp_processor_id (); - file->f_sb_list_cpu = cpu; - list =per_cpu_ptr (sb->s_files, cpu); -#else - list = &sb->s_files; -#endif -list_add (&file->f_u.fu_list, list); -} - -/** -* file_sb_list_add - add a file to the sb's file list -* @file: file to add -* @sb: sb to add it to -* -* Use this function to associate a file with the superblock of the inode it -* refers to. -*/ -void file_sb_list_add (struct file *file,struct super_block *sb) -{ -if (likely (!(file->f_mode &FMODE_WRITE ))) -return ; -if (!S_ISREG (file_inode (file)->i_mode)) -return ; -lg_local_lock (&files_lglock); -__file_sb_list_add (file, sb); -lg_local_unlock (&files_lglock); -} - -/** -* file_sb_list_del - remove a file from the sb's file list -* @file: file to remove -* @sb: sb to remove it from -* -* Use this function to remove a file from its superblock. -*/ -void file_sb_list_del (struct file *file) -{ -if (!list_empty (&file->f_u.fu_list)) { -lg_local_lock_cpu (&files_lglock,file_list_cpu (file)); -list_del_init (&file->f_u.fu_list); -lg_local_unlock_cpu (&files_lglock,file_list_cpu (file)); - } -} - -#ifdef CONFIG_SMP - -/* -* These macros iterate all files on all CPUs for a given superblock. -* files_lglock must be held globally. -*/ -#define do_file_list_for_each_entry (__sb, __file) \ -{ \ - int i; \ - for_each_possible_cpu(i) { \ - struct list_head *list; \ - list = per_cpu_ptr((__sb)->s_files, i); \ - list_for_each_entry((__file), list, f_u.fu_list) - -#define while_file_list_for_each_entry \ - } \ -} - -#else - -#define do_file_list_for_each_entry (__sb, __file) \ -{ \ - struct list_head *list; \ - list = &(sb)->s_files; \ - list_for_each_entry((__file), list, f_u.fu_list) - -#define while_file_list_for_each_entry \ -} - -#endif - -/** -* mark_files_ro - mark all files read-only -* @sb: superblock in question -* -* All files are marked read-only. We don't care about pending -* delete files so this should be used in 'force' mode only. -*/ -void mark_files_ro (struct super_block *sb) -{ -struct file *f; - -lg_global_lock (&files_lglock); -do_file_list_for_each_entry (sb, f) { -if (!file_count (f)) -continue ; -if (!(f->f_mode &FMODE_WRITE )) -continue ; -spin_lock (&f->f_lock); - f->f_mode &= ~FMODE_WRITE ; -spin_unlock (&f->f_lock); -if (file_check_writeable (f) !=0 ) -continue ; -__mnt_drop_write (f->f_path.mnt); -file_release_write (f); - } while_file_list_for_each_entry; -lg_global_unlock (&files_lglock); -} -void __init files_init (unsigned long mempages) {unsigned long n;
@@ -483,6 +359,5 @@ void __init files_init(unsigned long mempages) n = (mempages * (PAGE_SIZE /1024 )) /10 ; files_stat.max_files = max_t(unsigned long, n, NR_FILE);files_defer_init (); -lg_lock_init (&files_lglock,"files_lglock" );percpu_counter_init (&nr_files,0 ); }
fs/internal.h +0 -3
@@ -77,9 +77,6 @@ extern void chroot_fs_refs(const struct path *, const struct path *);/* * file_table.c */ -extern void file_sb_list_add (struct file *f,struct super_block *sb); -extern void file_sb_list_del (struct file *f); -extern void mark_files_ro (struct super_block *);extern struct file *get_empty_filp (void );/*
fs/open.c +0 -2
@@ -673,7 +673,6 @@ static int do_dentry_open(struct file *f, } f->f_mapping = inode->i_mapping; -file_sb_list_add (f, inode->i_sb);if (unlikely (f->f_mode &FMODE_PATH )) { f->f_op = &empty_fops;
@@ -708,7 +707,6 @@ static int do_dentry_open(struct file *f, cleanup_all:fops_put (f->f_op); -file_sb_list_del (f);if (f->f_mode &FMODE_WRITE ) {if (!special_file (inode->i_mode)) {/*
fs/super.c +2 -13
@@ -146,9 +146,6 @@ static void destroy_super(struct super_block *s)int i;list_lru_destroy (&s->s_dentry_lru);list_lru_destroy (&s->s_inode_lru); -#ifdef CONFIG_SMP -free_percpu (s->s_files); -#endif for (i =0 ; i <SB_FREEZE_LEVELS ; i++)percpu_counter_destroy (&s->s_writers.counter[i]);security_sb_free (s);
@@ -178,15 +175,6 @@ static struct super_block *alloc_super(struct file_system_type *type, int flags)if (security_sb_alloc (s)) goto fail; -#ifdef CONFIG_SMP - s->s_files = alloc_percpu(struct list_head); -if (!s->s_files) - goto fail; -for_each_possible_cpu (i) -INIT_LIST_HEAD (per_cpu_ptr (s->s_files, i)); -#else -INIT_LIST_HEAD (&s->s_files); -#endif for (i =0 ; i <SB_FREEZE_LEVELS ; i++) {if (percpu_counter_init (&s->s_writers.counter[i],0 ) <0 ) goto fail;
@@ -726,7 +714,8 @@ int do_remount_sb(struct super_block *sb, int flags, void *data, int force)make sure there are no rw files opened */ if (remount_ro) {if (force) { -mark_files_ro (sb); + sb->s_readonly_remount =1 ; +smp_wmb (); }else { retval =sb_prepare_remount_readonly (sb);if (retval)
include/linux/fs.h +0 -13
@@ -764,12 +764,7 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index)#define FILE_MNT_WRITE_RELEASED 2struct file { -/* -* fu_list becomes invalid after file_free is called and queued via -* fu_rcuhead for RCU freeing -*/ union { -struct list_head fu_list;struct llist_node fu_llist;struct rcu_head fu_rcuhead; } f_u;
@@ -783,9 +778,6 @@ struct file {* Must not be taken from IRQ context. */ spinlock_t f_lock; -#ifdef CONFIG_SMP -int f_sb_list_cpu; -#endif atomic_long_t f_count;unsigned int f_flags;fmode_t f_mode;
@@ -1264,11 +1256,6 @@ struct super_block {struct list_head s_inodes;/* all inodes */ struct hlist_bl_head s_anon;/* anonymous dentries for (nfs) exporting */ -#ifdef CONFIG_SMP -struct list_head __percpu *s_files; -#else -struct list_head s_files; -#endif struct list_head s_mounts;/* list of mounts; _not_ for fs use */ struct block_device *s_bdev;struct backing_dev_info *s_bdi;
Signature · 1 line
2.4.6
PATCH 1/1 net: don't wait for order-3 page allocation
In reply to Jiri SlabyFrom: Shaohua Li <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit fb05e7a89f500cfc06ae277bdc911b281928995d ]
We saw excessive direct memory compaction triggered by skb_page_frag_refill. This causes performance issues and add latency. Commit 5640f7685831e0 introduces the order-3 allocation. According to the changelog, the order-3 allocation isn't a must-have but to improve performance. But direct memory compaction has high overhead. The benefit of order-3 allocation can't compensate the overhead of direct memory compaction.
This patch makes the order-3 page allocation atomic. If there is no memory pressure and memory isn't fragmented, the alloction will still success, so we don't sacrifice the order-3 benefit here. If the atomic allocation fails, direct memory compaction will not be triggered, skb_page_frag_refill will fallback to order-0 immediately, hence the direct memory compaction overhead is avoided. In the allocation failure case, kswapd is waken up and doing compaction, so chances are allocation could success next time.
alloc_skb_with_frags is the same.
The mellanox driver does similar thing, if this is accepted, we must fix the driver too.
V3: fix the same issue in alloc_skb_with_frags as pointed out by Eric
V2: make the changelog clearer
--- net/core/skbuff.c | 4 +++- net/core/sock.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-)
net/core/skbuff.c +3 -1
@@ -367,9 +367,11 @@ refill:for (order =NETDEV_FRAG_PAGE_MAX_ORDER ; ;) {gfp_t gfp = gfp_mask; -if (order) +if (order) { gfp |= __GFP_COMP | __GFP_NOWARN | __GFP_NOMEMALLOC; + gfp &= ~__GFP_WAIT; + } nc->frag.page =alloc_pages (gfp, order);if (likely (nc->frag.page))break ;
net/core/sock.c +3 -1
@@ -1907,8 +1907,10 @@ bool sk_page_frag_refill(struct sock *sk, struct page_frag *pfrag) do { gfp_t gfp = sk->sk_allocation; - if (order) + if (order) { gfp |= __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY; + gfp &= ~__GFP_WAIT; + } pfrag->page = alloc_pages(gfp, order); if (likely(pfrag->page)) { pfrag->offset = 0;
Signature · 1 line
2.4.6
PATCH 1/1 KVM: nSVM: Check for NRIPS support before updating control field
In reply to Jiri SlabyFrom: Bandan Das <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit f104765b4f81fd74d69e0eb161e89096deade2db upstream.
If hardware doesn't support DecodeAssist - a feature that provides more information about the intercept in the VMCB, KVM decodes the instruction and then updates the next_rip vmcb control field. However, NRIP support itself depends on cpuid Fn8000_000A_EDX[NRIPS]. Since skip_emulated_instruction() doesn't verify nrip support before accepting control.next_rip as valid, avoid writing this field if support isn't present.
--- arch/x86/kvm/svm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/x86/kvm/svm.c +6 -2
@@ -495,8 +495,10 @@ static void skip_emulated_instruction(struct kvm_vcpu *vcpu) {struct vcpu_svm *svm =to_svm (vcpu); -if (svm->vmcb->control.next_rip !=0 ) +if (svm->vmcb->control.next_rip !=0 ) { +WARN_ON (!static_cpu_has (X86_FEATURE_NRIPS )); svm->next_rip = svm->vmcb->control.next_rip; + }if (!svm->next_rip) { if (emulate_instruction(vcpu, EMULTYPE_SKIP) !=
@@ -4237,7 +4239,9 @@ static int svm_check_intercept(struct kvm_vcpu *vcpu,break ; } - vmcb->control.next_rip = info->next_rip; +/* TODO: Advertise NRIPS to guest hypervisor unconditionally */ +if (static_cpu_has (X86_FEATURE_NRIPS )) + vmcb->control.next_rip = info->next_rip; vmcb->control.exit_code = icpt_info.exit_code; vmexit =nested_svm_exit_handled (svm);
Signature · 1 line
2.4.6
PATCH 1/1 arm64/mm: Remove hack in mmap randomize layout
In reply to Jiri SlabyFrom: Yann Droneaud <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit d6c763afab142a85e4770b4bc2a5f40f256d5c5d upstream.
Since commit 8a0a9bd4db63 ('random: make get_random_int() more random'), get_random_int() returns a random value for each call, so comment and hack introduced in mmap_rnd() as part of commit 1d18c47c735e ('arm64: MMU fault handling and page table management') are incorrects.
Commit 1d18c47c735e seems to use the same hack introduced by commit a5adc91a4b44 ('powerpc: Ensure random space between stack and mmaps'), latter copied in commit 5a0efea09f42 ('sparc64: Sharpen address space randomization calculations.').
But both architectures were cleaned up as part of commit fa8cbaaf5a68 ('powerpc+sparc64/mm: Remove hack in mmap randomize layout') as hack is no more needed since commit 8a0a9bd4db63.
So the present patch removes the comment and the hack around get_random_int() on AArch64's mmap_rnd().
--- arch/arm64/mm/mmap.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-)
arch/arm64/mm/mmap.c +2 -10
@@ -47,22 +47,14 @@ static int mmap_is_legacy(void)return sysctl_legacy_va_layout; } -/* -* Since get_random_int() returns the same value within a 1 jiffy window, we -* will almost always get the same randomisation for the stack and mmap -* region. This will mean the relative distance between stack and mmap will be -* the same. -* -* To avoid this we can shift the randomness by 1 bit. -*/ static unsigned long mmap_rnd (void ) {unsigned long rnd =0 ;if (current->flags &PF_RANDOMIZE ) - rnd = (long )get_random_int () & (STACK_RND_MASK >>1 ); + rnd = (long )get_random_int () &STACK_RND_MASK ; -return rnd << (PAGE_SHIFT +1 ); +return rnd <<PAGE_SHIFT ; }static unsigned long mmap_base (void )
Signature · 1 line
2.4.6
PATCH 1/1 sctp: fix ASCONF list handling
In reply to Jiri SlabyFrom: Marcelo Ricardo Leitner <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 2d45a02d0166caf2627fe91897c6ffc3b19514c4 ]
->auto_asconf_splist is per namespace and mangled by functions like sctp_setsockopt_auto_asconf() which doesn't guarantee any serialization.
Also, the call to inet_sk_copy_descendant() was backuping ->auto_asconf_list through the copy but was not honoring ->do_auto_asconf, which could lead to list corruption if it was different between both sockets.
This commit thus fixes the list handling by using ->addr_wq_lock spinlock to protect the list. A special handling is done upon socket creation and destruction for that. Error handlig on sctp_init_sock() will never return an error after having initialized asconf, so sctp_destroy_sock() can be called without addrq_wq_lock. The lock now will be take on sctp_close_sock(), before locking the socket, so we don't do it in inverse order compared to sctp_addr_wq_timeout_handler().
Instead of taking the lock on sctp_sock_migrate() for copying and restoring the list values, it's preferred to avoid rewritting it by implementing sctp_copy_descendant().
Issue was found with a test application that kept flipping sysctl default_auto_asconf on and off, but one could trigger it by issuing simultaneous setsockopt() calls on multiple sockets or by creating/destroying sockets fast enough. This is only triggerable locally.
--- include/net/netns/sctp.h | 1 + include/net/sctp/structs.h | 4 ++++ net/sctp/socket.c | 43 ++++++++++++++++++++++++++++++++----------- 3 files changed, 37 insertions(+), 11 deletions(-)
include/net/netns/sctp.h +1 -0
@@ -31,6 +31,7 @@ struct netns_sctp {struct list_head addr_waitq;struct timer_list addr_wq_timer;struct list_head auto_asconf_splist; +/* Lock that protects both addr_waitq and auto_asconf_splist */ spinlock_t addr_wq_lock;/* Lock that protects the local_addr_list writers */
include/net/sctp/structs.h +4 -0
@@ -220,6 +220,10 @@ struct sctp_sock {atomic_t pd_mode;/* Receive to here while partial delivery is in effect. */ struct sk_buff_head pd_lobby; + +/* These must be the last fields, as they will skipped on copies, +* like on accept and peeloff operations +*/ struct list_head auto_asconf_list;int do_auto_asconf; };
net/sctp/socket.c +32 -11
102 lines not on this page · raw message
Signature · 1 line
2.4.6
PATCH 1/1 bridge: fix br_stp_set_bridge_priority race conditions
In reply to Jiri SlabyFrom: Nikolay Aleksandrov <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 2dab80a8b486f02222a69daca6859519e05781d9 ]
After the ->set() spinlocks were removed br_stp_set_bridge_priority was left running without any protection when used via sysfs. It can race with port add/del and could result in use-after-free cases and corrupted lists. Tested by running port add/del in a loop with stp enabled while setting priority in a loop, crashes are easily reproducible.
The spinlocks around sysfs ->set() were removed in commit:14f98f258f19 ("bridge: range check STP parameters")
There's also a race condition in the netlink priority support that is fixed by this change, but it was introduced recently and the fixes tag covers it, just in case it's needed the commit is:af615762e972 ("bridge: add ageing_time, stp_state, priority over netlink")
--- net/bridge/br_ioctl.c | 2 -- net/bridge/br_stp_if.c | 4 +++- 2 files changed, 3 insertions(+), 3 deletions(-)
net/bridge/br_ioctl.c +0 -2
@@ -247,9 +247,7 @@ static int old_dev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)if (!ns_capable (dev_net (dev)->user_ns,CAP_NET_ADMIN ))return -EPERM ; -spin_lock_bh (&br->lock);br_stp_set_bridge_priority (br, args[1 ]); -spin_unlock_bh (&br->lock);return 0 ;case BRCTL_SET_PORT_PRIORITY :
net/bridge/br_stp_if.c +3 -1
@@ -241,12 +241,13 @@ bool br_stp_recalculate_bridge_id(struct net_bridge *br)return true; } -/* called under bridge lock */ +/* Acquires and releases bridge lock */ void br_stp_set_bridge_priority (struct net_bridge *br,u16 newprio) {struct net_bridge_port *p;int wasroot; +spin_lock_bh (&br->lock); wasroot =br_is_root_bridge (br);list_for_each_entry (p, &br->port_list, list) {
@@ -264,6 +265,7 @@ void br_stp_set_bridge_priority(struct net_bridge *br, u16 newprio)br_port_state_selection (br);if (br_is_root_bridge (br) && !wasroot)br_become_root_bridge (br); +spin_unlock_bh (&br->lock); }/* called under bridge lock */
Signature · 1 line
2.4.6
PATCH 1/1 PCI: pciehp: Add hotplug_lock to serialize hotplug events
In reply to Jiri SlabyFrom: Rajat Jain <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 50b52fdee050745935d92e7026373edea2647e60 upstream.
Today it is there is no protection around pciehp_enable_slot() and pciehp_disable_slot() to ensure that they complete before another hot-plug operation can be done on that particular slot.
This patch introduces the slot->hotplug_lock to ensure that any hotplug operations (add / remove) complete before another hotplug event can begin processing on that particular slot.
--- drivers/pci/hotplug/pciehp.h | 1 + drivers/pci/hotplug/pciehp_core.c | 7 ++++++- drivers/pci/hotplug/pciehp_ctrl.c | 17 +++++++++++++++-- drivers/pci/hotplug/pciehp_hpc.c | 1 + 4 files changed, 23 insertions(+), 3 deletions(-)
drivers/pci/hotplug/pciehp.h +1 -0
@@ -77,6 +77,7 @@ struct slot {struct hotplug_slot *hotplug_slot;struct delayed_work work;/* work for button event */ struct mutex lock; +struct mutex hotplug_lock;struct workqueue_struct *wq; };
drivers/pci/hotplug/pciehp_core.c +6 -1
@@ -278,8 +278,11 @@ static int pciehp_probe(struct pcie_device *dev) slot = ctrl->slot;pciehp_get_adapter_status (slot, &occupied);pciehp_get_power_status (slot, &poweron); -if (occupied && pciehp_force) +if (occupied && pciehp_force) { +mutex_lock (&slot->hotplug_lock);pciehp_enable_slot (slot); +mutex_unlock (&slot->hotplug_lock); + }/* If empty slot's power status is on, turn power off */ if (!occupied && poweron &&POWER_CTRL (ctrl))pciehp_power_off_slot (slot);
@@ -323,10 +326,12 @@ static int pciehp_resume (struct pcie_device *dev)/* Check if slot is occupied */ pciehp_get_adapter_status (slot, &status); +mutex_lock (&slot->hotplug_lock);if (status)pciehp_enable_slot (slot);else pciehp_disable_slot (slot); +mutex_unlock (&slot->hotplug_lock); return 0; }#endif /* PM */
drivers/pci/hotplug/pciehp_ctrl.c +15 -2
@@ -290,6 +290,7 @@ static void pciehp_power_thread(struct work_struct *work)struct power_work_info *info = container_of(work, struct power_work_info, work);struct slot *p_slot = info->p_slot; +int ret;mutex_lock (&p_slot->lock);switch (p_slot->state) {
@@ -299,13 +300,18 @@ static void pciehp_power_thread(struct work_struct *work)"Disabling domain:bus:device=%04x:%02x:00\n" ,pci_domain_nr (p_slot->ctrl->pcie->port->subordinate), p_slot->ctrl->pcie->port->subordinate->number); +mutex_lock (&p_slot->hotplug_lock);pciehp_disable_slot (p_slot); +mutex_unlock (&p_slot->hotplug_lock);mutex_lock (&p_slot->lock); p_slot->state =STATIC_STATE ;break ;case POWERON_STATE :mutex_unlock (&p_slot->lock); -if (pciehp_enable_slot (p_slot) &&PWR_LED (p_slot->ctrl)) +mutex_lock (&p_slot->hotplug_lock); + ret =pciehp_enable_slot (p_slot); +mutex_unlock (&p_slot->hotplug_lock); +if (ret &&PWR_LED (p_slot->ctrl))pciehp_green_led_off (p_slot);mutex_lock (&p_slot->lock); p_slot->state =STATIC_STATE ;
@@ -476,6 +482,9 @@ static void interrupt_event_handler(struct work_struct *work)kfree (info); } +/* +* Note: This function must be called with slot->hotplug_lock held +*/ int pciehp_enable_slot (struct slot *p_slot) {u8 getstatus =0 ;
@@ -514,7 +523,9 @@ int pciehp_enable_slot(struct slot *p_slot)return rc; } - +/* +* Note: This function must be called with slot->hotplug_lock held +*/ int pciehp_disable_slot (struct slot *p_slot) {u8 getstatus =0 ;
@@ -566,7 +577,9 @@ int pciehp_sysfs_enable_slot(struct slot *p_slot)case STATIC_STATE : p_slot->state =POWERON_STATE ;mutex_unlock (&p_slot->lock); +mutex_lock (&p_slot->hotplug_lock); retval =pciehp_enable_slot (p_slot); +mutex_unlock (&p_slot->hotplug_lock);mutex_lock (&p_slot->lock); p_slot->state =STATIC_STATE ;break ;
drivers/pci/hotplug/pciehp_hpc.c +1 -0
@@ -815,6 +815,7 @@ static int pcie_init_slot(struct controller *ctrl) slot->ctrl = ctrl;mutex_init (&slot->lock); +mutex_init (&slot->hotplug_lock);INIT_DELAYED_WORK (&slot->work, pciehp_queue_pushbutton_work); ctrl->slot = slot;return 0 ;
Signature · 1 line
2.4.6
PATCH 1/1 crypto: talitos - avoid memleak in talitos_alg_alloc()
In reply to Jiri SlabyFrom: Horia Geant? <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 5fa7dadc898567ce14d6d6d427e7bd8ce6eb5d39 upstream.
--- drivers/crypto/talitos.c | 1 + 1 file changed, 1 insertion(+)
drivers/crypto/talitos.c +1 -0
@@ -2563,6 +2563,7 @@ static struct talitos_crypto_alg *talitos_alg_alloc(struct device *dev,break ;default :dev_err (dev,"unknown algorithm type %d\n" , t_alg->algt.type); +kfree (t_alg);return ERR_PTR (-EINVAL ); }
Signature · 1 line
2.4.6
PATCH 1/1 iommu/amd: Handle large pages correctly in free_pagetable
In reply to Jiri SlabyFrom: Joerg Roedel <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 0b3fff54bc01e8e6064d222a33e6fa7adabd94cd upstream.
Make sure that we are skipping over large PTEs while walking the page-table tree.
--- drivers/iommu/amd_iommu.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/iommu/amd_iommu.c +6 -0
@@ -1915,9 +1915,15 @@ static void free_pt_##LVL (unsigned long __pt) \ pt = (u64 *)__pt; \ \for (i =0 ; i <512 ; ++i) { \ +/* PTE present? */ \if (!IOMMU_PTE_PRESENT (pt[i])) \continue ; \ \ +/* Large PTE? */ \ +if (PM_PTE_LEVEL (pt[i]) ==0 || \ +PM_PTE_LEVEL (pt[i]) ==7 ) \ +continue ; \ + \ p = (unsigned long )IOMMU_PTE_PAGE (pt[i]); \FN (p); \ } \
Signature · 1 line
2.4.6
PATCH 1/1 packet: avoid out of bounds read in round robin fanout
In reply to Jiri SlabyFrom: Willem de Bruijn <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 468479e6043c84f5a65299cc07cb08a22a28c2b1 ]
PACKET_FANOUT_LB computes f->rr_cur such that it is modulo f->num_members. It returns the old value unconditionally, but f->num_members may have changed since the last store. Ensure that the return value is always < num.
When modifying the logic, simplify it further by replacing the loop with an unconditional atomic increment.
--- net/packet/af_packet.c | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-)
net/packet/af_packet.c +2 -16
@@ -1150,16 +1150,6 @@ static void packet_sock_destruct(struct sock *sk)sk_refcnt_debug_dec (sk); } -static int fanout_rr_next (struct packet_fanout *f,unsigned int num) -{ -int x =atomic_read (&f->rr_cur) +1 ; - -if (x >= num) - x =0 ; - -return x; -} -static unsigned int fanout_demux_hash (struct packet_fanout *f,struct sk_buff *skb,unsigned int num)
@@ -1171,13 +1161,9 @@ static unsigned int fanout_demux_lb(struct packet_fanout *f, struct sk_buff *skb, unsigned int num) { - int cur, old; +unsigned int val =atomic_inc_return (&f->rr_cur); - cur =atomic_read (&f->rr_cur); -while ((old =atomic_cmpxchg (&f->rr_cur, cur, -fanout_rr_next (f, num))) != cur) - cur = old; -return cur; +return val % num; } static unsigned int fanout_demux_cpu(struct packet_fanout *f,
Signature · 1 line
2.4.6
PATCH 1/1 neigh: do not modify unlinked entries
In reply to Jiri SlabyFrom: Julian Anastasov <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 2c51a97f76d20ebf1f50fef908b986cb051fdff9 ]
The lockless lookups can return entry that is unlinked. Sometimes they get reference before last neigh_cleanup_and_release, sometimes they do not need reference. Later, any modification attempts may result in the following problems:
1. entry is not destroyed immediately because neigh_update can start the timer for dead entry, eg. on change to NUD_REACHABLE state. As result, entry lives for some time but is invisible and out of control.
2. __neigh_event_send can run in parallel with neigh_destroy while refcnt=0 but if timer is started and expired refcnt can reach 0 for second time leading to second neigh_destroy and possible crash.
Thanks to Eric Dumazet and Ying Xue for their work and analyze on the __neigh_event_send change.
--- net/core/neighbour.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
net/core/neighbour.c +11 -0
@@ -971,6 +971,8 @@ int __neigh_event_send(struct neighbour *neigh, struct sk_buff *skb) rc =0 ;if (neigh->nud_state & (NUD_CONNECTED |NUD_DELAY |NUD_PROBE )) goto out_unlock_bh; +if (neigh->dead) + goto out_dead;if (!(neigh->nud_state & (NUD_STALE |NUD_INCOMPLETE ))) {if (neigh->parms->mcast_probes + neigh->parms->app_probes) {
@@ -1024,6 +1026,13 @@ out_unlock_bh:write_unlock (&neigh->lock);local_bh_enable ();return rc; + +out_dead: +if (neigh->nud_state &NUD_STALE ) + goto out_unlock_bh; +write_unlock_bh (&neigh->lock); +kfree_skb (skb); +return 1 ; }EXPORT_SYMBOL (__neigh_event_send);
@@ -1087,6 +1096,8 @@ int neigh_update(struct neighbour *neigh, const u8 *lladdr, u8 new,if (!(flags &NEIGH_UPDATE_F_ADMIN ) && (old & (NUD_NOARP |NUD_PERMANENT ))) goto out; +if (neigh->dead) + goto out;if (!(new &NUD_VALID )) {neigh_del_timer (neigh);
Signature · 1 line
2.4.6
PATCH 1/1 sctp: Fix race between OOTB responce and route removal
In reply to Jiri SlabyFrom: Alexander Sverdlin <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 29c4afc4e98f4dc0ea9df22c631841f9c220b944 ]
There is NULL pointer dereference possible during statistics update if the route used for OOTB responce is removed at unfortunate time. If the route exists when we receive OOTB packet and we finally jump into sctp_packet_transmit() to send ABORT, but in the meantime route is removed under our feet, we take "no_route" path and try to update stats with IP_INC_STATS(sock_net(asoc->base.sk), ...).
But sctp_ootb_pkt_new() used to prepare responce packet doesn't call sctp_transport_set_owner() and therefore there is no asoc associated with this packet. Probably temporary asoc just for OOTB responces is overkill, so just introduce a check like in all other places in sctp_packet_transmit(), where "asoc" is dereferenced.
To reproduce this, one needs to
0. ensure that sctp module is loaded (otherwise ABORT is not generated)
1. remove default route on the machine
2. while true; do
ip route del [interface-specific route]
ip route add [interface-specific route]
done
3. send enough OOTB packets (i.e. HB REQs) from another host to trigger ABORT responce
On x86_64 the crash looks like this:
BUG: unable to handle kernel NULL pointer dereference at 0000000000000020 IP: [<ffffffffa05ec9ac>] sctp_packet_transmit+0x63c/0x730 [sctp] PGD 0 Oops: 0000 [#1] PREEMPT SMP Modules linked in: ... CPU: 0 PID: 0 Comm: swapper/0 Tainted: G O 4.0.5-1-ARCH #1 Hardware name: ... task: ffffffff818124c0 ti: ffffffff81800000 task.ti: ffffffff81800000 RIP: 0010:[<ffffffffa05ec9ac>] [<ffffffffa05ec9ac>] sctp_packet_transmit+0x63c/0x730 [sctp] RSP: 0018:ffff880127c037b8 EFLAGS: 00010296 RAX: 0000000000000000 RBX: 0000000000000000 RCX: 00000015ff66b480 RDX: 00000015ff66b400 RSI: ffff880127c17200 RDI: ffff880123403700 RBP: ffff880127c03888 R08: 0000000000017200 R09: ffffffff814625af R10: ffffea00047e4680 R11: 00000000ffffff80 R12: ffff8800b0d38a28 R13: ffff8800b0d38a28 R14: ffff8800b3e88000 R15: ffffffffa05f24e0 FS: 0000000000000000(0000) GS:ffff880127c00000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 0000000000000020 CR3: 00000000c855b000 CR4: 00000000000007f0 Stack: ffff880127c03910 ffff8800b0d38a28 ffffffff8189d240 ffff88011f91b400 ffff880127c03828 ffffffffa05c94c5 0000000000000000 ffff8800baa1c520 0000000000000000 0000000000000001 0000000000000000 0000000000000000 Call Trace: <IRQ> [<ffffffffa05c94c5>] ? sctp_sf_tabort_8_4_8.isra.20+0x85/0x140 [sctp] [<ffffffffa05d6b42>] ? sctp_transport_put+0x52/0x80 [sctp] [<ffffffffa05d0bfc>] sctp_do_sm+0xb8c/0x19a0 [sctp] [<ffffffff810b0e00>] ? trigger_load_balance+0x90/0x210 [<ffffffff810e0329>] ? update_process_times+0x59/0x60 [<ffffffff812c7a40>] ? timerqueue_add+0x60/0xb0 [<ffffffff810e0549>] ? enqueue_hrtimer+0x29/0xa0 [<ffffffff8101f599>] ? read_tsc+0x9/0x10 [<ffffffff8116d4b5>] ? put_page+0x55/0x60 [<ffffffff810ee1ad>] ? clockevents_program_event+0x6d/0x100 [<ffffffff81462b68>] ? skb_free_head+0x58/0x80 [<ffffffffa029a10b>] ? chksum_update+0x1b/0x27 [crc32c_generic] [<ffffffff81283f3e>] ? crypto_shash_update+0xce/0xf0 [<ffffffffa05d3993>] sctp_endpoint_bh_rcv+0x113/0x280 [sctp] [<ffffffffa05dd4e6>] sctp_inq_push+0x46/0x60 [sctp] [<ffffffffa05ed7a0>] sctp_rcv+0x880/0x910 [sctp] [<ffffffffa05ecb50>] ? sctp_packet_transmit_chunk+0xb0/0xb0 [sctp] [<ffffffffa05ecb70>] ? sctp_csum_update+0x20/0x20 [sctp] [<ffffffff814b05a5>] ? ip_route_input_noref+0x235/0xd30 [<ffffffff81051d6b>] ? ack_ioapic_level+0x7b/0x150 [<ffffffff814b27be>] ip_local_deliver_finish+0xae/0x210 [<ffffffff814b2e15>] ip_local_deliver+0x35/0x90 [<ffffffff814b2a15>] ip_rcv_finish+0xf5/0x370 [<ffffffff814b3128>] ip_rcv+0x2b8/0x3a0 [<ffffffff81474193>] __netif_receive_skb_core+0x763/0xa50 [<ffffffff81476c28>] __netif_receive_skb+0x18/0x60 [<ffffffff81476cb0>] netif_receive_skb_internal+0x40/0xd0 [<ffffffff814776c8>] napi_gro_receive+0xe8/0x120 [<ffffffffa03946aa>] rtl8169_poll+0x2da/0x660 [r8169] [<ffffffff8147896a>] net_rx_action+0x21a/0x360 [<ffffffff81078dc1>] __do_softirq+0xe1/0x2d0 [<ffffffff8107912d>] irq_exit+0xad/0xb0 [<ffffffff8157d158>] do_IRQ+0x58/0xf0 [<ffffffff8157b06d>] common_interrupt+0x6d/0x6d <EOI> [<ffffffff810e1218>] ? hrtimer_start+0x18/0x20 [<ffffffffa05d65f9>] ? sctp_transport_destroy_rcu+0x29/0x30 [sctp] [<ffffffff81020c50>] ? mwait_idle+0x60/0xa0 [<ffffffff810216ef>] arch_cpu_idle+0xf/0x20 [<ffffffff810b731c>] cpu_startup_entry+0x3ec/0x480 [<ffffffff8156b365>] rest_init+0x85/0x90 [<ffffffff818eb035>] start_kernel+0x48b/0x4ac [<ffffffff818ea120>] ? early_idt_handlers+0x120/0x120 [<ffffffff818ea339>] x86_64_start_reservations+0x2a/0x2c [<ffffffff818ea49c>] x86_64_start_kernel+0x161/0x184 Code: 90 48 8b 80 b8 00 00 00 48 89 85 70 ff ff ff 48 83 bd 70 ff ff ff 00 0f 85 cd fa ff ff 48 89 df 31 db e8 18 63 e7 e0 48 8b 45 80 <48> 8b 40 20 48 8b 40 30 48 8b 80 68 01 00 00 65 48 ff 40 78 e9 RIP [<ffffffffa05ec9ac>] sctp_packet_transmit+0x63c/0x730 [sctp] RSP <ffff880127c037b8> CR2: 0000000000000020 ---[ end trace 5aec7fd2dc983574 ]--- Kernel panic - not syncing: Fatal exception in interrupt Kernel Offset: 0x0 from 0xffffffff81000000 (relocation range: 0xffffffff80000000-0xffffffff9fffffff) drm_kms_helper: panic occurred, switching back to text console ---[ end Kernel panic - not syncing: Fatal exception in interrupt
--- net/sctp/output.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/sctp/output.c +3 -1
@@ -606,7 +606,9 @@ out:return err; no_route:kfree_skb (nskb); -IP_INC_STATS (sock_net (asoc->base.sk),IPSTATS_MIB_OUTNOROUTES ); + +if (asoc) +IP_INC_STATS (sock_net (asoc->base.sk),IPSTATS_MIB_OUTNOROUTES );/* FIXME: Returning the 'err' will effect all the associations * associated with a socket, although only one of the paths of the
Signature · 1 line
2.4.6
PATCH 1/1 x86/PCI: Use host bridge _CRS info on Foxconn K8M890-8237A
In reply to Jiri SlabyFrom: Bjorn Helgaas <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 1dace0116d0b05c967d94644fc4dfe96be2ecd3d upstream.
The Foxconn K8M890-8237A has two PCI host bridges, and we can't assign resources correctly without the information from _CRS that tells us which address ranges are claimed by which bridge. In the bugs mentioned below, we incorrectly assign a sound card address (this example is from 1033299):
bus: 00 index 2 [mem 0x80000000-0xfcffffffff]
ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-7f])
pci_root PNP0A08:00: host bridge window [mem 0x80000000-0xbfefffff] (ignored)
pci_root PNP0A08:00: host bridge window [mem 0xc0000000-0xdfffffff] (ignored)
pci_root PNP0A08:00: host bridge window [mem 0xf0000000-0xfebfffff] (ignored)
ACPI: PCI Root Bridge [PCI1] (domain 0000 [bus 80-ff])
pci_root PNP0A08:01: host bridge window [mem 0xbff00000-0xbfffffff] (ignored)
pci 0000:80:01.0: [1106:3288] type 0 class 0x000403
pci 0000:80:01.0: reg 10: [mem 0xbfffc000-0xbfffffff 64bit]
pci 0000:80:01.0: address space collision: [mem 0xbfffc000-0xbfffffff 64bit] conflicts with PCI Bus #00 [mem 0x80000000-0xfcffffffff] pci 0000:80:01.0: BAR 0: assigned [mem 0xfd00000000-0xfd00003fff 64bit]
BUG: unable to handle kernel paging request at ffffc90000378000 IP: [<ffffffffa0345f63>] azx_create+0x37c/0x822 [snd_hda_intel]
We assigned 0xfd_0000_0000, but that is not in any of the host bridge windows, and the sound card doesn't work.
Turn on pci=use_crs automatically for this system.
--- arch/x86/pci/acpi.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
arch/x86/pci/acpi.c +11 -0
@@ -84,6 +84,17 @@ static const struct dmi_system_id pci_crs_quirks[] __initconst = { DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"), }, }, +/* https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/931368 */ +/* https://bugs.launchpad.net/ubuntu/+source/alsa-driver/+bug/1033299 */ + { + .callback = set_use_crs, + .ident = "Foxconn K8M890-8237A", + .matches = { + DMI_MATCH(DMI_BOARD_VENDOR, "Foxconn"), + DMI_MATCH(DMI_BOARD_NAME, "K8M890-8237A"), + DMI_MATCH(DMI_BIOS_VENDOR, "Phoenix Technologies, LTD"), + }, + }, /* Now for the blacklist.. */
Signature · 1 line
2.4.6
PATCH 1/1 bridge: fix multicast router rlist endless loop
In reply to Jiri SlabyFrom: Nikolay Aleksandrov <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit 1a040eaca1a22f8da8285ceda6b5e4a2cb704867 ]
Since the addition of sysfs multicast router support if one set multicast_router to "2" more than once, then the port would be added to the hlist every time and could end up linking to itself and thus causing an endless loop for rlist walkers.
So to reproduce just do:
echo 2 > multicast_router; echo 2 > multicast_router;
in a bridge port and let some igmp traffic flow, for me it hangs up in br_multicast_flood().
Fix this by adding a check in br_multicast_add_router() if the port is already linked.
The reason this didn't happen before the addition of multicast_router sysfs entries is because there's a !hlist_unhashed check that prevents it.
--- net/bridge/br_multicast.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
net/bridge/br_multicast.c +3 -4
@@ -1088,6 +1088,9 @@ static void br_multicast_add_router(struct net_bridge *br,struct net_bridge_port *p;struct hlist_node *slot =NULL ; +if (!hlist_unhashed (&port->rlist)) +return ; +hlist_for_each_entry (p, &br->router_list, rlist) {if ((unsigned long ) port >= (unsigned long ) p)break ;
@@ -1115,12 +1118,8 @@ static void br_multicast_mark_router(struct net_bridge *br,if (port->multicast_router !=1 )return ; -if (!hlist_unhashed (&port->rlist)) - goto timer; -br_multicast_add_router (br, port); -timer:mod_timer (&port->multicast_router_timer, now + br->multicast_querier_interval); }
Signature · 1 line
2.4.6
PATCH 1/1 Revert "crypto: talitos - convert to use be16_add_cpu()"
In reply to Jiri SlabyFrom: Horia Geant? <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 69d9cd8c592f1abce820dbce7181bbbf6812cfbd upstream.
This reverts commit 7291a932c6e27d9768e374e9d648086636daf61c.
The conversion to be16_add_cpu() is incorrect in case cryptlen is negative due to premature (i.e. before addition / subtraction) implicit conversion of cryptlen (int -> u16) leading to sign loss.
--- drivers/crypto/talitos.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/crypto/talitos.c +2 -1
@@ -935,7 +935,8 @@ static int sg_to_link_tbl(struct scatterlist *sg, int sg_count, sg_count--; link_tbl_ptr--; } -be16_add_cpu (&link_tbl_ptr->len, cryptlen); + link_tbl_ptr->len =cpu_to_be16 (be16_to_cpu (link_tbl_ptr->len) + + cryptlen);/* tag end of link table */ link_tbl_ptr->j_extent =DESC_PTR_LNKTBL_RETURN ;
Signature · 1 line
2.4.6
PATCH 1/1 arm: KVM: force execution of HCPTR access on VM exit
In reply to Jiri SlabyFrom: Marc Zyngier <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 85e84ba31039595995dae80b277378213602891b upstream.
On VM entry, we disable access to the VFP registers in order to perform a lazy save/restore of these registers.
On VM exit, we restore access, test if we did enable them before, and save/restore the guest/host registers if necessary. In this sequence, the FPEXC register is always accessed, irrespective of the trapping configuration.
If the guest didn't touch the VFP registers, then the HCPTR access has now enabled such access, but we're missing a barrier to ensure architectural execution of the new HCPTR configuration. If the HCPTR access has been delayed/reordered, the subsequent access to FPEXC will cause a trap, which we aren't prepared to handle at all.
The same condition exists when trapping to enable VFP for the guest.
The fix is to introduce a barrier after enabling VFP access. In the vmexit case, it can be relaxed to only takes place if the guest hasn't accessed its view of the VFP registers, making the access to FPEXC safe.
The set_hcptr macro is modified to deal with both vmenter/vmexit and vmtrap operations, and now takes an optional label that is branched to when the guest hasn't touched the VFP registers.
--- arch/arm/kvm/interrupts.S | 10 ++++------ arch/arm/kvm/interrupts_head.S | 20 ++++++++++++++++++-- 2 files changed, 22 insertions(+), 8 deletions(-)
arch/arm/kvm/interrupts.S +4 -6
@@ -159,13 +159,9 @@ __kvm_vcpu_return: @ Don't trap coprocessor accesses for host kernel set_hstr vmexit set_hdcr vmexit - set_hcptr vmexit, (HCPTR_TTA | HCPTR_TCP(10) | HCPTR_TCP(11)) + set_hcptr vmexit, (HCPTR_TTA | HCPTR_TCP(10) | HCPTR_TCP(11)), after_vfp_restore #ifdef CONFIG_VFPv3 - @ Save floating point registers we if let guest use them. - tst r2, #(HCPTR_TCP(10) | HCPTR_TCP(11)) - bne after_vfp_restore - @ Switch VFP/NEON hardware state to the host's add r7, vcpu, #VCPU_VFP_GUEST store_vfp_state r7
@@ -177,6 +173,8 @@ after_vfp_restore: @ Restore FPEXC_EN which we clobbered on entry pop {r2} VFPFMXR FPEXC, r2 +#else +after_vfp_restore: #endif @ Reset Hyp-role
@@ -467,7 +465,7 @@ switch_to_guest_vfp: push {r3-r7} @ NEON/VFP used. Turn on VFP access. - set_hcptr vmexit, (HCPTR_TCP(10) | HCPTR_TCP(11)) + set_hcptr vmtrap, (HCPTR_TCP(10) | HCPTR_TCP(11)) @ Switch VFP/NEON hardware state to the guest's add r7, r0, #VCPU_VFP_HOST
arch/arm/kvm/interrupts_head.S +18 -2
@@ -578,8 +578,13 @@ vcpu .req r0 @ vcpu pointer always in r0 .endm /* Configures the HCPTR (Hyp Coprocessor Trap Register) on entry/return - * (hardware reset value is 0). Keep previous value in r2. */ -.macro set_hcptr operation, mask + * (hardware reset value is 0). Keep previous value in r2. + * An ISB is emited on vmexit/vmtrap, but executed on vmexit only if + * VFP wasn't already enabled (always executed on vmtrap). + * If a label is specified with vmexit, it is branched to if VFP wasn't + * enabled. + */ +.macro set_hcptr operation, mask, label = none mrc p15, 4, r2, c1, c1, 2 ldr r3, =\mask .if \operation == vmentry
@@ -588,6 +593,17 @@ vcpu .req r0 @ vcpu pointer always in r0 bic r3, r2, r3 @ Don't trap defined coproc-accesses .endif mcr p15, 4, r3, c1, c1, 2 + .if \operation != vmentry + .if \operation == vmexit + tst r2, #(HCPTR_TCP(10) | HCPTR_TCP(11)) + beq 1f + .endif + isb + .if \label != none + b \label + .endif +1: + .endif .endm /* Configures the HDCR (Hyp Debug Configuration Register) on entry/return
Signature · 1 line
2.4.6
PATCH 1/1 powerpc/perf: Fix book3s kernel to userspace backtraces
In reply to Jiri SlabyFrom: Anton Blanchard <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 72e349f1124a114435e599479c9b8d14bfd1ebcd upstream.
When we take a PMU exception or a software event we call perf_read_regs(). This overloads regs->result with a boolean that describes if we should use the sampled instruction address register (SIAR) or the regs.
If the exception is in kernel, we start with the kernel regs and backtrace through the kernel stack. At this point we switch to the userspace regs and backtrace the user stack with perf_callchain_user().
Unfortunately these regs have not got the perf_read_regs() treatment, so regs->result could be anything. If it is non zero, perf_instruction_pointer() decides to use the SIAR, and we get issues like this:
0.11% qemu-system-ppc [kernel.kallsyms] [k] _raw_spin_lock_irqsave
|
---_raw_spin_lock_irqsave
|
|--52.35%-- 0
| |
| |--46.39%-- __hrtimer_start_range_ns
| | kvmppc_run_core
| | kvmppc_vcpu_run_hv
| | kvmppc_vcpu_run
| | kvm_arch_vcpu_ioctl_run
| | kvm_vcpu_ioctl
| | do_vfs_ioctl
| | sys_ioctl
| | system_call
| | |
| | |--67.08%-- _raw_spin_lock_irqsave <--- hi mum
| | | |
| | | --100.00%-- 0x7e714
| | | 0x7e714
Notice the bogus _raw_spin_irqsave when we transition from kernel (system_call) to userspace (0x7e714). We inserted what was in the SIAR.
Add a check in regs_use_siar() to check that the regs in question are from a PMU exception. With this fix the backtrace makes sense:
0.47% qemu-system-ppc [kernel.vmlinux] [k] _raw_spin_lock_irqsave
|
---_raw_spin_lock_irqsave
|
|--53.83%-- 0
| |
| |--44.73%-- hrtimer_try_to_cancel
| | kvmppc_start_thread
| | kvmppc_run_core
| | kvmppc_vcpu_run_hv
| | kvmppc_vcpu_run
| | kvm_arch_vcpu_ioctl_run
| | kvm_vcpu_ioctl
| | do_vfs_ioctl
| | sys_ioctl
| | system_call
| | __ioctl
| | 0x7e714
| | 0x7e714
--- arch/powerpc/perf/core-book3s.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
arch/powerpc/perf/core-book3s.c +10 -1
@@ -124,7 +124,16 @@ static inline void power_pmu_bhrb_read(struct cpu_hw_events *cpuhw) {}static bool regs_use_siar (struct pt_regs *regs) { -return !!regs->result; +/* +* When we take a performance monitor exception the regs are setup +* using perf_read_regs() which overloads some fields, in particular +* regs->result to tell us whether to use SIAR. +* +* However if the regs are from another exception, eg. a syscall, then +* they have not been setup using perf_read_regs() and so regs->result +* is something random. +*/ +return ((TRAP (regs) ==0xf00 ) && regs->result); }/*
Signature · 1 line
2.4.6
PATCH 1/1 sparc: Use GFP_ATOMIC in ldc_alloc_exp_dring() as it can be called in softirq context
In reply to Jiri SlabyFrom: Sowmini Varadhan <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 0edfad5959df7379c9e554fbe8ba264ae232d321 upstream.
Since it is possible for vnet_event_napi to end up doing vnet_control_pkt_engine -> ... -> vnet_send_attr -> vnet_port_alloc_tx_ring -> ldc_alloc_exp_dring -> kzalloc() (i.e., in softirq context), kzalloc() should be called with GFP_ATOMIC from ldc_alloc_exp_dring.
--- arch/sparc/kernel/ldc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/sparc/kernel/ldc.c +1 -1
@@ -2307,7 +2307,7 @@ void *ldc_alloc_exp_dring(struct ldc_channel *lp, unsigned int len,if (len & (8UL -1 ))return ERR_PTR (-EINVAL ); - buf =kzalloc (len,GFP_KERNEL ); + buf =kzalloc (len,GFP_ATOMIC );if (!buf)return ERR_PTR (-ENOMEM );
Signature · 1 line
2.4.6
PATCH 1/1 rcu: Correctly handle non-empty Tiny RCU callback list with none ready
In reply to Jiri SlabyFrom: "Paul E. McKenney" <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 6e91f8cb138625be96070b778d9ba71ce520ea7e upstream.
If, at the time __rcu_process_callbacks() is invoked, there are callbacks in Tiny RCU's callback list, but none of them are ready to be invoked, the current list-management code will knit the non-ready callbacks out of the list. This can result in hangs and possibly worse. This commit therefore inserts a check for there being no callbacks that can be invoked immediately.
This bug is unlikely to occur -- you have to get a new callback between the time rcu_sched_qs() or rcu_bh_qs() was called, but before we get to __rcu_process_callbacks(). It was detected by the addition of RCU-bh testing to rcutorture, which in turn was instigated by Iftekhar Ahmed's mutation testing. Although this bug was made much more likely by 915e8a4fe45e (rcu: Remove fastpath from __rcu_process_callbacks()), this
did not cause the bug, but rather made it much more probable. That
said, it takes more than 40 hours of rcutorture testing, on average, for this bug to appear, so this fix cannot be considered an emergency.
--- kernel/rcutiny.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/rcutiny.c +5 -0
@@ -282,6 +282,11 @@ static void __rcu_process_callbacks(struct rcu_ctrlblk *rcp)/* Move the ready-to-invoke callbacks to a local list. */ local_irq_save (flags); +if (rcp->donetail == &rcp->rcucblist) { +/* No callbacks ready, so just leave. */ +local_irq_restore (flags); +return ; + }RCU_TRACE (trace_rcu_batch_start (rcp->name,0 , rcp->qlen,-1 )); list = rcp->rcucblist; rcp->rcucblist = *rcp->donetail;
Signature · 1 line
2.4.6
PATCH 1/1 packet: read num_members once in packet_rcv_fanout()
In reply to Jiri SlabyFrom: Eric Dumazet <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
[ Upstream commit f98f4514d07871da7a113dd9e3e330743fd70ae4 ]
We need to tell compiler it must not read f->num_members multiple times. Otherwise testing if num is not zero is flaky, and we could attempt an invalid divide by 0 in fanout_demux_cpu()
Note bug was present in packet_rcv_fanout_hash() and packet_rcv_fanout_lb() but final 3.1 had a simple location after commit 95ec3eb417115fb ("packet: Add 'cpu' fanout policy.")
--- net/packet/af_packet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/packet/af_packet.c +1 -1
@@ -1224,7 +1224,7 @@ static int packet_rcv_fanout(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) { struct packet_fanout *f = pt->af_packet_priv; -unsigned int num = f->num_members; +unsigned int num =ACCESS_ONCE (f->num_members);struct packet_sock *po;unsigned int idx;
Signature · 1 line
2.4.6
PATCH 1/1 vfs: Remove incorrect debugging WARN in prepend_path
In reply to Jiri SlabyFrom: "Eric W. Biederman" <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 93e3bce6287e1fb3e60d3324ed08555b5bbafa89 upstream.
The warning message in prepend_path is unclear and outdated. It was added as a warning that the mechanism for generating names of pseudo files had been removed from prepend_path and d_dname should be used instead. Unfortunately the warning reads like a general warning, making it unclear what to do with it.
Remove the warning. The transition it was added to warn about is long over, and I added code several years ago which in rare cases causes the warning to fire on legitimate code, and the warning is now firing and scaring people for no good reason.
--- fs/dcache.c | 11 ----------- 1 file changed, 11 deletions(-)
fs/dcache.c +0 -11
@@ -2812,17 +2812,6 @@ restart: vfsmnt = &mnt->mnt;continue ; } -/* -* Filesystems needing to implement special "root names" -* should do so with ->d_dname() -*/ -if (IS_ROOT (dentry) && - (dentry->d_name.len !=1 || - dentry->d_name.name[0 ] !='/' )) { -WARN (1 ,"Root dentry has weird name <%.*s>\n" , - (int ) dentry->d_name.len, - dentry->d_name.name); - }if (!error) error =is_mounted (vfsmnt) ?1 :2 ;break ;
Signature · 1 line
2.4.6
PATCH 1/1 ALSA: hda - Fix the dock headphone output on Fujitsu Lifebook E780
In reply to Jiri SlabyFrom: Takashi Iwai <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 4df3fd1700abbb53bd874143dfd1f9ac9e7cbf4b upstream.
Fujitsu Lifebook E780 sets the sequence number 0x0f to only only of the two headphones, thus the driver tries to assign another as the line-out, and this results in the inconsistent mapping between the created jack ctl and the actual I/O. Due to this, PulseAudio doesn't handle it properly and gets the silent output.
The fix is to ignore the non-HP sequencer checks.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=99681
--- sound/pci/hda/patch_realtek.c | 6 ++++++ 1 file changed, 6 insertions(+)
sound/pci/hda/patch_realtek.c +6 -0
@@ -3712,6 +3712,7 @@ enum {ALC269_FIXUP_LIFEBOOK ,ALC269_FIXUP_LIFEBOOK_EXTMIC ,ALC269_FIXUP_LIFEBOOK_HP_PIN , +ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT ,ALC269_FIXUP_AMIC ,ALC269_FIXUP_DMIC , ALC269VB_FIXUP_AMIC,
@@ -3844,6 +3845,10 @@ static const struct hda_fixup alc269_fixups[] = { { } }, }, + [ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT] = { + .type = HDA_FIXUP_FUNC, + .v.func = alc269_fixup_pincfg_no_hp_to_lineout, + }, [ALC269_FIXUP_AMIC] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl[]) {
@@ -4154,6 +4159,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x104d ,0x9084 ,"Sony VAIO" ,ALC275_FIXUP_SONY_HWEQ ),SND_PCI_QUIRK_VENDOR (0x104d ,"Sony VAIO" ,ALC269_FIXUP_SONY_VAIO ),SND_PCI_QUIRK (0x10cf ,0x1475 ,"Lifebook" ,ALC269_FIXUP_LIFEBOOK ), +SND_PCI_QUIRK (0x10cf ,0x159f ,"Lifebook E780" ,ALC269_FIXUP_LIFEBOOK_NO_HP_TO_LINEOUT ),SND_PCI_QUIRK (0x10cf ,0x15dc ,"Lifebook T731" ,ALC269_FIXUP_LIFEBOOK_HP_PIN ),SND_PCI_QUIRK (0x10cf ,0x1757 ,"Lifebook E752" ,ALC269_FIXUP_LIFEBOOK_HP_PIN ), SND_PCI_QUIRK(0x10cf, 0x1845, "Lifebook U904", ALC269_FIXUP_LIFEBOOK_EXTMIC),
Signature · 1 line
2.4.6
PATCH 1/1 KVM: x86: make vapics_in_nmi_mode atomic
In reply to Jiri SlabyFrom: Radim Krčmář <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 42720138b06301cc8a7ee8a495a6d021c4b6a9bc upstream.
Writes were a bit racy, but hard to turn into a bug at the same time. (Particularly because modern Linux doesn't use this feature anymore.)
[Actually the next patch makes it much, much easier to trigger the race
so I'm including this one for stable@ as well. - Paolo]
--- arch/x86/include/asm/kvm_host.h | 2 +- arch/x86/kvm/i8254.c | 2 +- arch/x86/kvm/lapic.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
arch/x86/include/asm/kvm_host.h +1 -1
@@ -562,7 +562,7 @@ struct kvm_arch {struct kvm_pic *vpic;struct kvm_ioapic *vioapic;struct kvm_pit *vpit; -int vapics_in_nmi_mode; +atomic_t vapics_in_nmi_mode;struct mutex apic_map_lock;struct kvm_apic_map *apic_map;
arch/x86/kvm/i8254.c +1 -1
@@ -305,7 +305,7 @@ static void pit_do_work(struct kthread_work *work)* LVT0 to NMI delivery. Other PIC interrupts are just sent to * VCPU0, and only if its LVT0 is in EXTINT mode. */ -if (kvm->arch.vapics_in_nmi_mode >0 ) +if (atomic_read (&kvm->arch.vapics_in_nmi_mode) >0 )kvm_for_each_vcpu (i, vcpu, kvm)kvm_apic_nmi_wd_deliver (vcpu); }
arch/x86/kvm/lapic.c +2 -2
@@ -1088,10 +1088,10 @@ static void apic_manage_nmi_watchdog(struct kvm_lapic *apic, u32 lvt0_val)if (!nmi_wd_enabled) {apic_debug ("Receive NMI setting on APIC_LVT0 " "for cpu %d\n" , apic->vcpu->vcpu_id); - apic->vcpu->kvm->arch.vapics_in_nmi_mode++; +atomic_inc (&apic->vcpu->kvm->arch.vapics_in_nmi_mode); } }else if (nmi_wd_enabled) - apic->vcpu->kvm->arch.vapics_in_nmi_mode--; +atomic_dec (&apic->vcpu->kvm->arch.vapics_in_nmi_mode); }static int apic_reg_write (struct kvm_lapic *apic,u32 reg,u32 val)
Signature · 1 line
2.4.6
PATCH 1/1 fs: Fix S_NOSEC handling
In reply to Jiri SlabyFrom: Jan Kara <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 2426f3910069ed47c0cc58559a6d088af7920201 upstream.
file_remove_suid() could mistakenly set S_NOSEC inode bit when root was modifying the file. As a result following writes to the file by ordinary user would avoid clearing suid or sgid bits.
Fix the bug by checking actual mode bits before setting S_NOSEC.
--- fs/inode.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/inode.c +2 -2
@@ -1599,8 +1599,8 @@ int file_remove_suid(struct file *file) error =security_inode_killpriv (dentry);if (!error && killsuid) error =__remove_suid (dentry, killsuid); -if (!error && (inode->i_sb->s_flags &MS_NOSEC )) - inode->i_flags |=S_NOSEC ; +if (!error) +inode_has_no_xattr (inode);return error; }
Signature · 1 line
2.4.6
PATCH 1/1 ipr: Increase default adapter init stage change timeout
In reply to Jiri SlabyFrom: Brian King <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 45c44b5ff9caa743ed9c2bfd44307c536c9caf1e upstream.
Increase the default init stage change timeout from 15 seconds to 30 seconds. This resolves issues we have seen with some adapters not transitioning to the first init stage within 15 seconds, which results in adapter initialization failures.
--- drivers/scsi/ipr.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/ipr.h +1 -1
@@ -267,7 +267,7 @@#define IPR_RUNTIME_RESET 0x40000000#define IPR_IPL_INIT_MIN_STAGE_TIME 5 -#define IPR_IPL_INIT_DEFAULT_STAGE_TIME 15 +#define IPR_IPL_INIT_DEFAULT_STAGE_TIME 30#define IPR_IPL_INIT_STAGE_UNKNOWN 0x0#define IPR_IPL_INIT_STAGE_TRANSOP 0xB0000000#define IPR_IPL_INIT_STAGE_MASK 0xff000000
Signature · 1 line
2.4.6
PATCH 1/1 Disable write buffering on Toshiba ToPIC95
In reply to Jiri SlabyFrom: Ryan Underwood <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 2fb22a8042fe96b4220843f79241c116d90922c4 upstream.
Disable write buffering on the Toshiba ToPIC95 if it is enabled by somebody (it is not supposed to be a power-on default according to the datasheet). On the ToPIC95, practically no 32-bit Cardbus card will work under heavy load without locking up the whole system if this is left enabled. I tried about a dozen. It does not affect 16-bit cards. This is similar to the O2 bugs in early controller revisions it seems.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=55961
--- drivers/pcmcia/topic.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
drivers/pcmcia/topic.h +16 -0
@@ -104,6 +104,9 @@#define TOPIC_EXCA_IF_CONTROL 0x3e/* 8 bit */ #define TOPIC_EXCA_IFC_33V_ENA 0x01 +#define TOPIC_PCI_CFG_PPBCN 0x3e/* 16-bit */ +#define TOPIC_PCI_CFG_PPBCN_WBEN 0x0400 +static void topic97_zoom_video (struct pcmcia_socket *sock,int onoff) { struct yenta_socket *socket = container_of(sock, struct yenta_socket, socket);
@@ -138,6 +141,7 @@ static int topic97_override(struct yenta_socket *socket)static int topic95_override (struct yenta_socket *socket) {u8 fctrl; +u16 ppbcn;/* enable 3.3V support for 16bit cards */ fctrl =exca_readb (socket,TOPIC_EXCA_IF_CONTROL );
@@ -146,6 +150,18 @@ static int topic95_override(struct yenta_socket *socket)/* tell yenta to use exca registers to power 16bit cards */ socket->flags |=YENTA_16BIT_POWER_EXCA |YENTA_16BIT_POWER_DF ; +/* Disable write buffers to prevent lockups under load with numerous +Cardbus cards, observed on Tecra 500CDT and reported elsewhere on the +net. This is not a power-on default according to the datasheet +but some BIOSes seem to set it. */ +if (pci_read_config_word (socket->dev,TOPIC_PCI_CFG_PPBCN , &ppbcn) ==0 + && socket->dev->revision <=7 + && (ppbcn &TOPIC_PCI_CFG_PPBCN_WBEN )) { + ppbcn &= ~TOPIC_PCI_CFG_PPBCN_WBEN ; +pci_write_config_word (socket->dev,TOPIC_PCI_CFG_PPBCN , ppbcn); +dev_info (&socket->dev->dev,"Disabled ToPIC95 Cardbus write buffers.\n" ); + } +return 0 ; }
Signature · 1 line
2.4.6
PATCH 1/1 ALSA: hda - Add headset support to Acer Aspire V5
In reply to Jiri SlabyFrom: Takashi Iwai <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 7819717b11346b8a5420b223b46600e394049c66 upstream.
Acer Aspire V5 with ALC282 codec needs the similar quirk like Dell laptops to support the headset mic. The headset mic pin is 0x19 and it's not exposed by BIOS, thus we need to fix the pincfg as well.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=96201
--- sound/pci/hda/patch_realtek.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
sound/pci/hda/patch_realtek.c +12 -0
@@ -3730,6 +3730,7 @@ enum {ALC269_FIXUP_DELL3_MIC_NO_PRESENCE ,ALC269_FIXUP_HEADSET_MODE ,ALC269_FIXUP_HEADSET_MODE_NO_HP_MIC , +ALC269_FIXUP_ASPIRE_HEADSET_MIC ,ALC269_FIXUP_ASUS_X101_FUNC ,ALC269_FIXUP_ASUS_X101_VERB , ALC269_FIXUP_ASUS_X101,
@@ -3959,6 +3960,15 @@ static const struct hda_fixup alc269_fixups[] = { .type = HDA_FIXUP_FUNC, .v.func = alc_fixup_headset_mode_no_hp_mic, }, + [ALC269_FIXUP_ASPIRE_HEADSET_MIC] = { + .type = HDA_FIXUP_PINS, + .v.pins = (const struct hda_pintbl []) { + {0x19 ,0x01a1913c },/* headset mic w/o jack detect */ + { } + }, + .chained = true, + .chain_id = ALC269_FIXUP_HEADSET_MODE, + }, [ALC286_FIXUP_SONY_MIC_NO_PRESENCE] = { .type = HDA_FIXUP_PINS, .v.pins = (const struct hda_pintbl []) {
@@ -4071,6 +4081,8 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {SND_PCI_QUIRK (0x1025 ,0x029b ,"Acer 1810TZ" ,ALC269_FIXUP_INV_DMIC ),SND_PCI_QUIRK (0x1025 ,0x0349 ,"Acer AOD260" ,ALC269_FIXUP_INV_DMIC ),SND_PCI_QUIRK (0x1025 ,0x047c ,"Acer AC700" ,ALC269_FIXUP_ACER_AC700 ), +SND_PCI_QUIRK (0x1025 ,0x072d ,"Acer Aspire V5-571G" ,ALC269_FIXUP_ASPIRE_HEADSET_MIC ), +SND_PCI_QUIRK (0x1025 ,0x080d ,"Acer Aspire V5-122P" ,ALC269_FIXUP_ASPIRE_HEADSET_MIC ),SND_PCI_QUIRK (0x1025 ,0x0740 ,"Acer AO725" ,ALC271_FIXUP_HP_GATE_MIC_JACK ),SND_PCI_QUIRK (0x1025 ,0x0742 ,"Acer AO756" ,ALC271_FIXUP_HP_GATE_MIC_JACK ), SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
Signature · 1 line
2.4.6
PATCH 1/1 x86/PCI: Use host bridge _CRS info on systems with >32 bit addressing
In reply to Jiri SlabyFrom: Bjorn Helgaas <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 3d9fecf6bfb8b12bc2f9a4c7109895a2a2bb9436 upstream.
We enable _CRS on all systems from 2008 and later. On older systems, we ignore _CRS and assume the whole physical address space (excluding RAM and other devices) is available for PCI devices, but on systems that support physical address spaces larger than 4GB, it's doubtful that the area above 4GB is really available for PCI.
After d56dbf5bab8c ("PCI: Allocate 64-bit BARs above 4G when possible"), we try to use that space above 4GB *first*, so we're more likely to put a device there.
On Juan's Toshiba Satellite Pro U200, BIOS left the graphics, sound, 1394, and card reader devices unassigned (but only after Windows had been booted). Only the sound device had a 64-bit BAR, so it was the only device placed above 4GB, and hence the only device that didn't work.
Keep _CRS enabled even on pre-2008 systems if they support physical address space larger than 4GB.
--- arch/x86/pci/acpi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/x86/pci/acpi.c +4 -2
@@ -135,8 +135,10 @@ void __init pci_acpi_crs_quirks(void) {int year; -if (dmi_get_date (DMI_BIOS_DATE , &year,NULL ,NULL ) && year <2008 ) - pci_use_crs = false; +if (dmi_get_date (DMI_BIOS_DATE , &year,NULL ,NULL ) && year <2008 ) { +if (iomem_resource.end <=0xffffffff ) + pci_use_crs = false; + }dmi_check_system (pci_crs_quirks);
Signature · 1 line
2.4.6
PATCH 1/1 vfs: Ignore unlocked mounts in fs_fully_visible
In reply to Jiri SlabyFrom: "Eric W. Biederman" <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit ceeb0e5d39fcdf4dca2c997bf225c7fc49200b37 upstream.
Limit the mounts fs_fully_visible considers to locked mounts. Unlocked can always be unmounted so considering them adds hassle but no security benefit.
--- fs/namespace.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
fs/namespace.c +6 -2
@@ -2939,11 +2939,15 @@ bool fs_fully_visible(struct file_system_type *type)if (mnt->mnt.mnt_root != mnt->mnt.mnt_sb->s_root)continue ; -/* This mount is not fully visible if there are any child mounts -* that cover anything except for empty directories. +/* This mount is not fully visible if there are any +* locked child mounts that cover anything except for +* empty directories. */ list_for_each_entry (child, &mnt->mnt_mounts, mnt_child) {struct inode *inode = child->mnt_mountpoint->d_inode; +/* Only worry about locked mounts */ +if (!(mnt->mnt.mnt_flags &MNT_LOCKED )) +continue ;if (!S_ISDIR (inode->i_mode)) goto next;if (inode->i_nlink >2 )
Signature · 1 line
2.4.6
PATCH 1/1 ARC: add compiler barrier to LLSC based cmpxchg
In reply to Jiri SlabyFrom: Vineet Gupta <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit d57f727264f1425a94689bafc7e99e502cb135b5 upstream.
When auditing cmpxchg call sites, Chuck noted that gcc was optimizing away some of the desired LDs.
| do {
| new = old = *ipi_data_ptr;
| new |= 1U << msg;
| } while (cmpxchg(ipi_data_ptr, old, new) != old);was generating to below
| 8015cef8: ld r2,[r4,0] <-- First LD | 8015cefc: bset r1,r2,r1 | | 8015cf00: llock r3,[r4] <-- atomic op | 8015cf04: brne r3,r2,8015cf10 | 8015cf08: scond r1,[r4] | 8015cf0c: bnz 8015cf00 | | 8015cf10: brne r3,r2,8015cf00 <-- Branch doesn't go to orig LD
Although this was fixed by adding a ACCESS_ONCE in this call site, it seems safer (for now at least) to add compiler barrier to LLSC based cmpxchg
--- arch/arc/include/asm/cmpxchg.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
arch/arc/include/asm/cmpxchg.h +5 -4
@@ -25,10 +25,11 @@ __cmpxchg(volatile void *ptr, unsigned long expected, unsigned long new)" scond %3, [%1] \n" " bnz 1b \n" "2: \n" - : "=&r"(prev) - : "r"(ptr), "ir"(expected), -" r"(new) /* can't be " ir". scond can't take limm for " b" */ - : "cc"); + : "=&r"(prev) /* Early clobber, to prevent reg reuse */ + : "r"(ptr), /* Not "m": llock only supports reg direct addr mode */ +" ir"(expected), +" r"(new) /* can't be " ir". scond can't take LIMM for " b" */ + : "cc", "memory"); /* so that gcc knows memory is being written here */ return prev; }
Signature · 1 line
2.4.6
PATCH 1/1 arm64: vdso: work-around broken ELF toolchains in Makefile
In reply to Jiri SlabyFrom: Will Deacon <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 6f1a6ae87c0c60d7c462ef8fd071f291aa7a9abb upstream.
When building the kernel with a bare-metal (ELF) toolchain, the -shared option may not be passed down to collect2, resulting in silent corruption of the vDSO image (in particular, the DYNAMIC section is omitted).
The effect of this corruption is that the dynamic linker fails to find the vDSO symbols and libc is instead used for the syscalls that we intended to optimise (e.g. gettimeofday). Functionally, there is no issue as the sigreturn trampoline is still intact and located by the kernel.
This patch fixes the problem by explicitly passing -shared to the linker when building the vDSO.
--- arch/arm64/kernel/vdso/Makefile | 4 ++++ 1 file changed, 4 insertions(+)
arch/arm64/kernel/vdso/Makefile +4 -0
@@ -15,6 +15,10 @@ ccflags-y := -shared -fno-common -fno-builtin ccflags-y += -nostdlib -Wl,-soname=linux-vdso.so.1 \ $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) +# Workaround for bare-metal (ELF) toolchains that neglect to pass -shared +# down to collect2, resulting in silent corruption of the vDSO image. +ccflags-y += -Wl,-shared + obj-y += vdso.o extra-y += vdso.lds vdso-offsets.h CPPFLAGS_vdso.lds += -P -C -U$(ARCH)
Signature · 1 line
2.4.6
PATCH 1/1 regulator: core: fix constraints output buffer
In reply to Jiri SlabyFrom: Stefan Wahren <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit a7068e3932eee8268c4ce4e080a338ee7b8a27bf upstream.
The buffer for condtraints debug isn't big enough to hold the output in all cases. So fix this issue by increasing the buffer.
--- drivers/regulator/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/core.c +1 -1
@@ -773,7 +773,7 @@ static int suspend_prepare(struct regulator_dev *rdev, suspend_state_t state)static void print_constraints (struct regulator_dev *rdev) {struct regulation_constraints *constraints = rdev->constraints; -char buf[80 ] ="" ; +char buf[160 ] ="" ;int count =0 ;int ret;
Signature · 1 line
2.4.6
PATCH 1/1 regmap: Fix regmap_bulk_read in BE mode
In reply to Jiri SlabyFrom: Arun Chandran <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 15b8d2c41fe5839582029f65c5f7004db451cc2b upstream.
In big endian mode regmap_bulk_read gives incorrect data for byte reads.
This is because memcpy of a single byte from an address after full word read gives different results when endianness differs. ie. we get little-end in LE and big-end in BE.
--- drivers/base/regmap/regmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/base/regmap/regmap.c +1 -1
@@ -1736,7 +1736,7 @@ int regmap_bulk_read(struct regmap *map, unsigned int reg, void *val, &ival);if (ret !=0 )return ret; -memcpy (val + (i * val_bytes), &ival, val_bytes); + map->format.format_val (val + (i * val_bytes), ival,0 ); } }
Signature · 1 line
2.4.6
PATCH 1/1 regmap: Fix possible shift overflow in regmap_field_init()
In reply to Jiri SlabyFrom: Maxime Coquelin <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 921cc29473a0d7c109105c1876ddb432f4a4be7d upstream.
The way the mask is generated in regmap_field_init() is wrong. Indeed, a field initialized with msb = 31 and lsb = 0 provokes a shift overflow while calculating the mask field.
On some 32 bits architectures, such as x86, the generated mask is 0, instead of the expected 0xffffffff.
This patch uses GENMASK() to fix the problem, as this macro is already safe regarding shift overflow.
[-js: in 3.12, we do not have GENMASK for general access. Define locally as RM_GENMASK.]
--- drivers/base/regmap/regmap.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/base/regmap/regmap.c +4 -2
@@ -813,14 +813,16 @@ struct regmap *devm_regmap_init(struct device *dev, }EXPORT_SYMBOL_GPL (devm_regmap_init); +#define RM_GENMASK (h, l) \ + (((~0UL) << (l)) & (~0UL >> (BITS_PER_LONG - 1 - (h)))) +static void regmap_field_init (struct regmap_field *rm_field,struct regmap *regmap,struct reg_field reg_field) { -int field_bits = reg_field.msb - reg_field.lsb +1 ; rm_field->regmap = regmap; rm_field->reg = reg_field.reg; rm_field->shift = reg_field.lsb; - rm_field->mask = ((BIT (field_bits) -1 ) << reg_field.lsb); + rm_field->mask =RM_GENMASK (reg_field.msb, reg_field.lsb); }/**
Signature · 1 line
2.4.6
PATCH 1/1 leds / PM: fix hibernation on arm when gpio-led used with CPU led trigger
In reply to Jiri SlabyFrom: Grygorii Strashko <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 084609bf727981c7a2e6e69aefe0052c9d793300 upstream.
Setting a dev_pm_ops suspend/resume pair of callbacks but not a set of hibernation callbacks means those pm functions will not be called upon hibernation - that leads to system crash on ARM during freezing if gpio-led is used in combination with CPU led trigger. It may happen after freeze_noirq stage (GPIO is suspended) and before syscore_suspend stage (CPU led trigger is suspended)
- usually when disable_nonboot_cpus() is called.
Log:
PM: noirq freeze of devices complete after 1.425 msecs Disabling non-boot CPUs ...
^ system may crash or stuck here with message (TI AM572x)
WARNING: CPU: 0 PID: 3100 at drivers/bus/omap_l3_noc.c:148 l3_interrupt_handler+0x22c/0x370() 44000000.ocp:L3 Custom Error: MASTER MPU TARGET L4_PER1_P3 (Idle): Data Access in Supervisor mode during Functional access
CPU1: shutdown
^ or here
Fix this by using SIMPLE_DEV_PM_OPS, which appropriately assigns the suspend and hibernation callbacks and move led_suspend/led_resume under CONFIG_PM_SLEEP to avoid build warnings.
--- drivers/leds/led-class.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/leds/led-class.c +3 -4
@@ -178,6 +178,7 @@ void led_classdev_resume(struct led_classdev *led_cdev) }EXPORT_SYMBOL_GPL (led_classdev_resume); +#ifdef CONFIG_PM_SLEEP static int led_suspend (struct device *dev) {struct led_classdev *led_cdev =dev_get_drvdata (dev);
@@ -197,11 +198,9 @@ static int led_resume(struct device *dev)return 0 ; } +#endif -static const struct dev_pm_ops leds_class_dev_pm_ops = { - .suspend = led_suspend, - .resume = led_resume, -}; +static SIMPLE_DEV_PM_OPS(leds_class_dev_pm_ops, led_suspend, led_resume);/** * led_classdev_register - register a new object of led_classdev class.
Signature · 1 line
2.4.6
PATCH 1/1 arm64: Do not attempt to use init_mm in reset_context()
In reply to Jiri SlabyFrom: Catalin Marinas <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 565630d503ef24e44c252bed55571b3a0d68455f upstream.
After secondary CPU boot or hotplug, the active_mm of the idle thread is &init_mm. The init_mm.pgd (swapper_pg_dir) is only meant for TTBR1_EL1 and must not be set in TTBR0_EL1. Since when active_mm == &init_mm the TTBR0_EL1 is already set to the reserved value, there is no need to perform any context reset.
--- arch/arm64/mm/context.c | 8 ++++++++ 1 file changed, 8 insertions(+)
arch/arm64/mm/context.c +8 -0
@@ -92,6 +92,14 @@ static void reset_context(void *info)unsigned int cpu =smp_processor_id ();struct mm_struct *mm = current->active_mm; +/* +* current->active_mm could be init_mm for the idle thread immediately +* after secondary CPU boot or hotplug. TTBR0_EL1 is already set to +* the reserved value, so no need to reset any context. +*/ +if (mm == &init_mm) +return ; +smp_rmb (); asid = cpu_last_asid + cpu;
Signature · 1 line
2.4.6
PATCH 1/1 arm64: mm: Fix freeing of the wrong memmap entries with !SPARSEMEM_VMEMMAP
In reply to Jiri SlabyFrom: Dave P Martin <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit b9bcc919931611498e856eae9bf66337330d04cc upstream.
The memmap freeing code in free_unused_memmap() computes the end of each memblock by adding the memblock size onto the base. However, if SPARSEMEM is enabled then the value (start) used for the base may already have been rounded downwards to work out which memmap entries to free after the previous memblock.
This may cause memmap entries that are in use to get freed.
In general, you're not likely to hit this problem unless there are at least 2 memblocks and one of them is not aligned to a sparsemem section boundary. Note that carve-outs can increase the number of memblocks by splitting the regions listed in the device tree.
This problem doesn't occur with SPARSEMEM_VMEMMAP, because the vmemmap code deals with freeing the unused regions of the memmap instead of requiring the arch code to do it.
This patch gets the memblock base out of the memblock directly when computing the block end address to ensure the correct value is used.
--- arch/arm64/mm/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm64/mm/init.c +1 -1
@@ -253,7 +253,7 @@ static void __init free_unused_memmap(void)* memmap entries are valid from the bank end aligned to * MAX_ORDER_NR_PAGES. */ - prev_end =ALIGN (start +__phys_to_pfn (reg->size), + prev_end =ALIGN (__phys_to_pfn (reg->base + reg->size),MAX_ORDER_NR_PAGES ); }
Signature · 1 line
2.4.6
PATCH 1/1 cpuidle / menu: Return (-1) if there are no suitable states
In reply to Jiri SlabyFrom: "Rafael J. Wysocki" <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 3836785a1bdcd6706c68ad46bf53adc0b057b310 upstream.
If there is a PM QoS latency limit and all of the sufficiently shallow C-states are disabled, the cpuidle menu governor returns 0 which on some systems is CPUIDLE_DRIVER_STATE_START and shouldn't be returned if that C-state has been disabled.
Fix the issue by modifying the menu governor to return (-1) in such situations.
[shilpab: Backport to 3.10.y
- adjust context
- add a check if 'next_state' is less than 0 in 'cpuidle_idle_call()', this ensures that we exit 'cpuidle_idle_call()' if governor->select() returns negative value]
--- drivers/cpuidle/cpuidle.c | 3 +++ drivers/cpuidle/governors/menu.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/cpuidle/cpuidle.c +3 -0
@@ -133,6 +133,9 @@ int cpuidle_idle_call(void)/* ask the governor for the next state */ next_state = cpuidle_curr_governor->select (drv, dev); +if (next_state <0 ) +return -EBUSY ; +if (need_resched ()) { dev->last_residency =0 ;/* give the governor an opportunity to reflect on the outcome */
drivers/cpuidle/governors/menu.c +1 -1
@@ -297,7 +297,7 @@ static int menu_select(struct cpuidle_driver *drv, struct cpuidle_device *dev) data->needs_update =0 ; } - data->last_state_idx =0 ; + data->last_state_idx =CPUIDLE_DRIVER_STATE_START -1 ; data->exit_us =0 ;/* Special case when user has set very strict latency requirement */
Signature · 1 line
2.4.6
PATCH 1/1 spi: pl022: Specify 'num-cs' property as required in devicetree binding
In reply to Jiri SlabyFrom: Ezequiel Garcia <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit ea6055c46eda1e19e02209814955e13f334bbe1b upstream.
Since commit 39a6ac11df65 ("spi/pl022: Devicetree support w/o platform data") the 'num-cs' parameter cannot be passed through platform data when probing with devicetree. Instead, it's a required devicetree property.
Fix the binding documentation so the property is properly specified.
--- Documentation/devicetree/bindings/spi/spi_pl022.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Documentation/devicetree/bindings/spi/spi_pl022.txt +1 -1
@@ -4,9 +4,9 @@ Required properties: - compatible : "arm,pl022", "arm,primecell" - reg : Offset and length of the register set for the device - interrupts : Should contain SPI controller interrupt +- num-cs : total number of chipselects Optional properties: -- num-cs : total number of chipselects - cs-gpios : should specify GPIOs used for chipselects. The gpios will be referred to as reg = <index> in the SPI child nodes. If unspecified, a single SPI device without a chip select can be used.
Signature · 1 line
2.4.6
PATCH 1/1 mtd: fix: avoid race condition when accessing mtd->usecount
In reply to Jiri SlabyFrom: Brian Norris <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 073db4a51ee43ccb827f54a4261c0583b028d5ab upstream.
On A MIPS 32-cores machine a BUG_ON was triggered because some acesses to mtd->usecount were done without taking mtd_table_mutex.
kernel: Call Trace:
kernel: [<ffffffff80401818>] __put_mtd_device+0x20/0x50
kernel: [<ffffffff804086f4>] blktrans_release+0x8c/0xd8
kernel: [<ffffffff802577e0>] __blkdev_put+0x1a8/0x200
kernel: [<ffffffff802579a4>] blkdev_close+0x1c/0x30
kernel: [<ffffffff8022006c>] __fput+0xac/0x250
kernel: [<ffffffff80171208>] task_work_run+0xd8/0x120
kernel: [<ffffffff8012c23c>] work_notifysig+0x10/0x18
kernel:
kernel:
Code: 2442ffff ac8202d8 000217fe <00020336> dc820128 10400003
00000000 0040f809 00000000kernel: ---[ end trace 080fbb4579b47a73 ]---
Fixed by taking the mutex in blktrans_open and blktrans_release.
Note that this locking is already suggested ininclude/linux/mtd/blktrans.h:
struct mtd_blktrans_ops {
...
/* Called with mtd_table_mutex held; no race with add/remove */ int (*open)(struct mtd_blktrans_dev *dev); void (*release)(struct mtd_blktrans_dev *dev);
...
};
But we weren't following it.
Originally reported by (and patched by) Zhang and Giuseppe, independently. Improved and rewritten.
--- drivers/mtd/mtd_blkdevs.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/mtd/mtd_blkdevs.c +5 -0
@@ -199,6 +199,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode)return -ERESTARTSYS ;/* FIXME: busy loop! -arnd*/ mutex_lock (&dev->lock); +mutex_lock (&mtd_table_mutex);if (dev->open) goto unlock;
@@ -222,6 +223,7 @@ static int blktrans_open(struct block_device *bdev, fmode_t mode) unlock: dev->open++; +mutex_unlock (&mtd_table_mutex);mutex_unlock (&dev->lock);blktrans_dev_put (dev);return ret;
@@ -232,6 +234,7 @@ error_release: error_put:module_put (dev->tr->owner);kref_put (&dev->ref, blktrans_dev_release); +mutex_unlock (&mtd_table_mutex);mutex_unlock (&dev->lock);blktrans_dev_put (dev);return ret;
@@ -245,6 +248,7 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode)return ;mutex_lock (&dev->lock); +mutex_lock (&mtd_table_mutex);if (--dev->open) goto unlock;
@@ -258,6 +262,7 @@ static void blktrans_release(struct gendisk *disk, fmode_t mode)__put_mtd_device (dev->mtd); } unlock: +mutex_unlock (&mtd_table_mutex);mutex_unlock (&dev->lock);blktrans_dev_put (dev); }
Signature · 1 line
2.4.6
PATCH 1/1 mtd: dc21285: use raw spinlock functions for nw_gpio_lock
In reply to Jiri SlabyFrom: Uwe Kleine-König <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit e5babdf928e5d0c432a8d4b99f20421ce14d1ab6 upstream.
Since commit bd31b85960a7 (which is in 3.2-rc1) nw_gpio_lock is a raw spinlock that needs usage of the corresponding raw functions.
This fixes:
drivers/mtd/maps/dc21285.c: In function 'nw_en_write':
drivers/mtd/maps/dc21285.c:41:340: warning: passing argument 1 of 'spinlock_check' from incompatible pointer type
spin_lock_irqsave(&nw_gpio_lock, flags);
In file included from include/linux/seqlock.h:35:0,
from include/linux/time.h:5,
from include/linux/stat.h:18,
from include/linux/module.h:10,
from drivers/mtd/maps/dc21285.c:8:
include/linux/spinlock.h:299:102: note: expected 'struct spinlock_t *' but argument is of type 'struct raw_spinlock_t *'
static inline raw_spinlock_t *spinlock_check(spinlock_t *lock)
^
drivers/mtd/maps/dc21285.c:43:25: warning: passing argument 1 of 'spin_unlock_irqrestore' from incompatible pointer type
spin_unlock_irqrestore(&nw_gpio_lock, flags);
^
In file included from include/linux/seqlock.h:35:0,
from include/linux/time.h:5,
from include/linux/stat.h:18,
from include/linux/module.h:10,
from drivers/mtd/maps/dc21285.c:8: include/linux/spinlock.h:370:91: note: expected 'struct spinlock_t *' but argument is of type 'struct raw_spinlock_t *'
static inline void spin_unlock_irqrestore(spinlock_t *lock, unsigned long flags)
--- drivers/mtd/maps/dc21285.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/mtd/maps/dc21285.c +2 -2
@@ -38,9 +38,9 @@ static void nw_en_write(void)* we want to write a bit pattern XXX1 to Xilinx to enable * the write gate, which will be open for about the next 2ms. */ -spin_lock_irqsave (&nw_gpio_lock, flags); +raw_spin_lock_irqsave (&nw_gpio_lock, flags);nw_cpld_modify (CPLD_FLASH_WR_ENABLE ,CPLD_FLASH_WR_ENABLE ); -spin_unlock_irqrestore (&nw_gpio_lock, flags); +raw_spin_unlock_irqrestore (&nw_gpio_lock, flags);/* * let the ISA bus to catch on...
Signature · 1 line
2.4.6
PATCH 1/1 thermal: step_wise: fix: Prevent from binary overflow when trend is dropping
In reply to Jiri SlabyFrom: Lukasz Majewski <[email protected]>
This patch has been added to the 3.12 stable tree. If you have any objections, please let us know.
===============
commit 26bb0e9a1a938ec98ee07aa76533f1a711fba706 upstream.
It turns out that some boards can have instance->lower greater than 0 and when thermal trend is dropping it results with next_target equal to -1.
Since the next_target is defined as unsigned long it is interpreted as 0xFFFFFFFF and larger than instance->upper.
As a result the next_target is set to instance->upper which ramps up to maximal cooling device target when the temperature is steadily decreasing.
--- drivers/thermal/step_wise.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/thermal/step_wise.c +1 -1
@@ -75,7 +75,7 @@ static unsigned long get_target_state(struct thermal_instance *instance, next_target = instance->upper;break ;case THERMAL_TREND_DROPPING : -if (cur_state == instance->lower) { +if (cur_state <= instance->lower) {if (!throttle) next_target =THERMAL_NO_TARGET ; }else {
Signature · 1 line
2.4.6