3.16.40-rc1 review
Subsystems (5)
PATCH 300/306 staging/android/ion : fix a race condition in the ion driver
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: EunTaik Lee <[email protected]>
commit 9590232bb4f4cc824f3425a6e1349afbe6d6d2b7 upstream.
There is a use-after-free problem in the ion driver. This is caused by a race condition in the ion_ioctl() function.
A handle has ref count of 1 and two tasks on different cpus calls ION_IOC_FREE simultaneously.
cpu 0 cpu 1
-------------------------------------------------------ion_handle_get_by_id()
(ref == 2)
ion_handle_get_by_id()
(ref == 3)ion_free()
(ref == 2)
ion_handle_put()
(ref == 1)
ion_free()
(ref == 0 so ion_handle_destroy() is called
and the handle is freed.)
ion_handle_put() is called and it decreases the slub's next free pointer
The problem is detected as an unaligned access in the spin lock functions since it uses load exclusive
instruction. In some cases it corrupts the slub's
free pointer which causes a mis-aligned access to the next free pointer.(kmalloc returns a pointer like ffffc0745b4580aa). And it causes lots of other hard-to-debug problems.
This symptom is caused since the first member in the ion_handle structure is the reference count and the ion driver decrements the reference after it has been freed.
To fix this problem client->lock mutex is extended to protect all the codes that uses the handle.
--- drivers/staging/android/ion/ion.c | 55 ++++++++++++++++++++++++++++++--------- 1 file changed, 42 insertions(+), 13 deletions(-) mode change 100644 => 100755 drivers/staging/android/ion/ion.c
drivers/staging/android/ion/ion.c +42 -13
@@ -389,13 +389,22 @@ static void ion_handle_get(struct ion_hakref_get (&handle->ref); } -static int ion_handle_put (struct ion_handle *handle) +static int ion_handle_put_nolock (struct ion_handle *handle) +{ +int ret; + + ret =kref_put (&handle->ref, ion_handle_destroy); + +return ret; +} + +int ion_handle_put (struct ion_handle *handle) {struct ion_client *client = handle->client;int ret;mutex_lock (&client->lock); - ret =kref_put (&handle->ref, ion_handle_destroy); + ret =ion_handle_put_nolock (handle);mutex_unlock (&client->lock);return ret;
@@ -419,20 +428,30 @@ static struct ion_handle *ion_handle_looreturn ERR_PTR (-EINVAL ); } -static struct ion_handle *ion_handle_get_by_id (struct ion_client *client, +static struct ion_handle *ion_handle_get_by_id_nolock (struct ion_client *client,int id) {struct ion_handle *handle; -mutex_lock (&client->lock); handle =idr_find (&client->idr, id);if (handle)ion_handle_get (handle); -mutex_unlock (&client->lock);return handle ? handle :ERR_PTR (-EINVAL ); } +struct ion_handle *ion_handle_get_by_id (struct ion_client *client, +int id) +{ +struct ion_handle *handle; + +mutex_lock (&client->lock); + handle =ion_handle_get_by_id_nolock (client, id); +mutex_unlock (&client->lock); + +return handle; +} +static bool ion_handle_validate (struct ion_client *client,struct ion_handle *handle) {
@@ -534,22 +553,28 @@ struct ion_handle *ion_alloc(struct ion_ }EXPORT_SYMBOL (ion_alloc); -void ion_free (struct ion_client *client,struct ion_handle *handle) +static void ion_free_nolock (struct ion_client *client,struct ion_handle *handle) {bool valid_handle;BUG_ON (client != handle->client); -mutex_lock (&client->lock); valid_handle =ion_handle_validate (client, handle);if (!valid_handle) {WARN (1 ,"%s: invalid handle passed to free.\n" , __func__); -mutex_unlock (&client->lock);return ; } +ion_handle_put_nolock (handle); +} + +void ion_free (struct ion_client *client,struct ion_handle *handle) +{ +BUG_ON (client != handle->client); + +mutex_lock (&client->lock); +ion_free_nolock (client, handle);mutex_unlock (&client->lock); -ion_handle_put (handle); }EXPORT_SYMBOL (ion_free);
@@ -1277,11 +1302,15 @@ static long ion_ioctl(struct file *filp, {struct ion_handle *handle; - handle =ion_handle_get_by_id (client, data.handle.handle); -if (IS_ERR (handle)) +mutex_lock (&client->lock); + handle =ion_handle_get_by_id_nolock (client, data.handle.handle); +if (IS_ERR (handle)) { +mutex_unlock (&client->lock);return PTR_ERR (handle); -ion_free (client, handle); -ion_handle_put (handle); + } +ion_free_nolock (client, handle); +ion_handle_put_nolock (handle); +mutex_unlock (&client->lock);break ; }case ION_IOC_SHARE :
PATCH 301/306 Fix potential infoleak in older kernels
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
Not upstream as it is not needed there.
So a patch something like this might be a safe way to fix the potential infoleak in older kernels.
THIS IS UNTESTED. It's a very obvious patch, though, so if it compiles it probably works. It just initializes the output variable with 0 in the inline asm description, instead of doing it in the exception handler.
It will generate slightly worse code (a few unnecessary ALU operations), but it doesn't have any interactions with the exception handler implementation.
--- arch/x86/include/asm/uaccess.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/x86/include/asm/uaccess.h +5 -5
@@ -329,7 +329,7 @@ do { \#define __get_user_asm_u64 (x, ptr, retval, errret) \ __get_user_asm(x, ptr, retval, "q", "", "=r", errret)#define __get_user_asm_ex_u64 (x, ptr) \ - __get_user_asm_ex(x, ptr, "q", "", "=r") + __get_user_asm_ex(x, ptr, "q", "", "=&r")#endif #define __get_user_size (x, ptr, size, retval, errret) \
@@ -372,13 +372,13 @@ do { \__chk_user_ptr (ptr); \switch (size) { \case 1 : \ -__get_user_asm_ex (x, ptr,"b" ,"b" ,"=q" ); \ +__get_user_asm_ex (x, ptr,"b" ,"b" ,"=&q" ); \break ; \case 2 : \ -__get_user_asm_ex (x, ptr,"w" ,"w" ,"=r" ); \ +__get_user_asm_ex (x, ptr,"w" ,"w" ,"=&r" ); \break ; \case 4 : \ -__get_user_asm_ex (x, ptr,"l" ,"k" ,"=r" ); \ +__get_user_asm_ex (x, ptr,"l" ,"k" ,"=&r" ); \break ; \case 8 : \__get_user_asm_ex_u64 (x, ptr); \
@@ -392,7 +392,7 @@ do { \ asm volatile("1: mov"itype" %1,%"rtype"0\n" \ "2:\n" \ _ASM_EXTABLE_EX(1b, 2b) \ - : ltype(x) : "m" (__m(addr))) + : ltype(x) : "m" (__m(addr)), "0" (0))#define __put_user_nocheck (x, ptr, size) \ ({ \
PATCH 302/306 sysctl: Drop reference added by grab_header in proc_sys_readdir
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Zhou Chengming <[email protected]>
commit 93362fa47fe98b62e4a34ab408c4a418432e7939 upstream.
Fixes CVE-2016-9191, proc_sys_readdir doesn't drop reference added by grab_header when return from !dir_emit_dots path. It can cause any path called unregister_sysctl_table will wait forever.
The calltrace of CVE-2016-9191:
[ 5535.960522] Call Trace: [ 5535.963265] [<ffffffff817cdaaf>] schedule+0x3f/0xa0 [ 5535.968817] [<ffffffff817d33fb>] schedule_timeout+0x3db/0x6f0 [ 5535.975346] [<ffffffff817cf055>] ? wait_for_completion+0x45/0x130 [ 5535.982256] [<ffffffff817cf0d3>] wait_for_completion+0xc3/0x130 [ 5535.988972] [<ffffffff810d1fd0>] ? wake_up_q+0x80/0x80 [ 5535.994804] [<ffffffff8130de64>] drop_sysctl_table+0xc4/0xe0 [ 5536.001227] [<ffffffff8130de17>] drop_sysctl_table+0x77/0xe0 [ 5536.007648] [<ffffffff8130decd>] unregister_sysctl_table+0x4d/0xa0 [ 5536.014654] [<ffffffff8130deff>] unregister_sysctl_table+0x7f/0xa0 [ 5536.021657] [<ffffffff810f57f5>] unregister_sched_domain_sysctl+0x15/0x40 [ 5536.029344] [<ffffffff810d7704>] partition_sched_domains+0x44/0x450 [ 5536.036447] [<ffffffff817d0761>] ? __mutex_unlock_slowpath+0x111/0x1f0 [ 5536.043844] [<ffffffff81167684>] rebuild_sched_domains_locked+0x64/0xb0 [ 5536.051336] [<ffffffff8116789d>] update_flag+0x11d/0x210 [ 5536.057373] [<ffffffff817cf61f>] ? mutex_lock_nested+0x2df/0x450 [ 5536.064186] [<ffffffff81167acb>] ? cpuset_css_offline+0x1b/0x60 [ 5536.070899] [<ffffffff810fce3d>] ? trace_hardirqs_on+0xd/0x10 [ 5536.077420] [<ffffffff817cf61f>] ? mutex_lock_nested+0x2df/0x450 [ 5536.084234] [<ffffffff8115a9f5>] ? css_killed_work_fn+0x25/0x220 [ 5536.091049] [<ffffffff81167ae5>] cpuset_css_offline+0x35/0x60 [ 5536.097571] [<ffffffff8115aa2c>] css_killed_work_fn+0x5c/0x220 [ 5536.104207] [<ffffffff810bc83f>] process_one_work+0x1df/0x710 [ 5536.110736] [<ffffffff810bc7c0>] ? process_one_work+0x160/0x710 [ 5536.117461] [<ffffffff810bce9b>] worker_thread+0x12b/0x4a0 [ 5536.123697] [<ffffffff810bcd70>] ? process_one_work+0x710/0x710 [ 5536.130426] [<ffffffff810c3f7e>] kthread+0xfe/0x120 [ 5536.135991] [<ffffffff817d4baf>] ret_from_fork+0x1f/0x40 [ 5536.142041] [<ffffffff810c3e80>] ? kthread_create_on_node+0x230/0x230
One cgroup maintainer mentioned that "cgroup is trying to offline a cpuset css, which takes place under cgroup_mutex. The offlining ends up trying to drain active usages of a sysctl table which apprently is not happening."
The real reason is that proc_sys_readdir doesn't drop reference added by grab_header when return from !dir_emit_dots path. So this cpuset offline path will wait here forever.
See here for details: http://www.openwall.com/lists/oss-security/2016/11/04/13
--- fs/proc/proc_sysctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/proc/proc_sysctl.c +2 -1
@@ -703,7 +703,7 @@ static int proc_sys_readdir(struct file ctl_dir = container_of(head, struct ctl_dir, header);if (!dir_emit_dots (file, ctx)) -return 0 ; + goto out; pos =2 ;
@@ -713,6 +713,7 @@ static int proc_sys_readdir(struct filebreak ; } } +out:sysctl_head_finish (head);return 0 ; }
PATCH 303/306 sctp: validate chunk len before actually using it
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Marcelo Ricardo Leitner <[email protected]>
commit bf911e985d6bbaa328c20c3e05f4eb03de11fdd6 upstream.
Andrey Konovalov reported that KASAN detected that SCTP was using a slab beyond the boundaries. It was caused because when handling out of the blue packets in function sctp_sf_ootb() it was checking the chunk len only after already processing the first chunk, validating only for the 2nd and subsequent ones.
The fix is to just move the check upwards so it's also validated for the 1st chunk.
--- net/sctp/sm_statefuns.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
net/sctp/sm_statefuns.c +6 -6
@@ -3426,6 +3426,12 @@ sctp_disposition_t sctp_sf_ootb(struct nreturn sctp_sf_violation_chunklen (net, ep, asoc, type, arg, commands); +/* Report violation if chunk len overflows */ + ch_end = ((__u8 *)ch) +WORD_ROUND (ntohs (ch->length)); +if (ch_end >skb_tail_pointer (skb)) +return sctp_sf_violation_chunklen (net, ep, asoc, type, arg, + commands); +/* Now that we know we at least have a chunk header, * do things that are type appropriate. */
@@ -3457,12 +3463,6 @@ sctp_disposition_t sctp_sf_ootb(struct n } } -/* Report violation if chunk len overflows */ - ch_end = ((__u8 *)ch) +WORD_ROUND (ntohs (ch->length)); -if (ch_end >skb_tail_pointer (skb)) -return sctp_sf_violation_chunklen (net, ep, asoc, type, arg, - commands); - ch = (sctp_chunkhdr_t *) ch_end; }while (ch_end <skb_tail_pointer (skb));
PATCH 304/306 sg_write()/bsg_write() is not fit to be called under KERNEL_DS
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit 128394eff343fc6d2f32172f03e24829539c5835 upstream.
Both damn things interpret userland pointers embedded into the payload; worse, they are actually traversing those. Leaving aside the bad API design, this is very much _not_ safe to call with KERNEL_DS. Bail out early if that happens.
--- block/bsg.c | 3 +++ drivers/scsi/sg.c | 3 +++ 2 files changed, 6 insertions(+)
block/bsg.c +3 -0
@@ -676,6 +676,9 @@ bsg_write(struct file *file, const chardprintk ("%s: write %Zd bytes\n" , bd->name, count); +if (unlikely (segment_eq (get_fs (),KERNEL_DS ))) +return -EINVAL ; +bsg_set_block (bd, file); bytes_written =0 ;
drivers/scsi/sg.c +3 -0
@@ -568,6 +568,9 @@ sg_write(struct file *filp, const char _sg_io_hdr_t *hp;unsigned char cmnd[MAX_COMMAND_SIZE ]; +if (unlikely (segment_eq (get_fs (),KERNEL_DS ))) +return -EINVAL ; +if ((!(sfp = (Sg_fd *) filp->private_data)) || (!(sdp = sfp->parentdp)))return -ENXIO ; SCSI_LOG_TIMEOUT(3, printk("sg_write: %s, count=%d\n",
PATCH 305/306 net: avoid signed overflows for SO_{SND|RCV}BUFFORCE
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
commit b98b0bc8c431e3ceb4b26b0dfc8db509518fb290 upstream.
CAP_NET_ADMIN users should not be allowed to set negative sk_sndbuf or sk_rcvbuf values, as it can lead to various memory corruptions, crashes, OOM...
Note that before commit 82981930125a ("net: cleanups in sock_setsockopt()"), the bug was even more serious, since SO_SNDBUF and SO_RCVBUF were vulnerable.
This needs to be backported to all known linux kernels.
Again, many thanks to syzkaller team for discovering this gem.
--- net/core/sock.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/core/sock.c +2 -2
@@ -749,7 +749,7 @@ int sock_setsockopt(struct socket *sock, val =min_t (u32, val, sysctl_wmem_max); set_sndbuf: sk->sk_userlocks |=SOCK_SNDBUF_LOCK ; - sk->sk_sndbuf =max_t (u32, val *2 ,SOCK_MIN_SNDBUF ); + sk->sk_sndbuf =max_t (int, val *2 ,SOCK_MIN_SNDBUF );/* Wake up sending tasks if we upped the value. */ sk->sk_write_space (sk);break ;
@@ -785,7 +785,7 @@ set_rcvbuf:* returning the value we actually used in getsockopt * is the most desirable behavior. */ - sk->sk_rcvbuf =max_t (u32, val *2 ,SOCK_MIN_RCVBUF ); + sk->sk_rcvbuf =max_t (int, val *2 ,SOCK_MIN_RCVBUF );break ;case SO_RCVBUFFORCE :
PATCH 306/306 ALSA: pcm : Call kill_fasync() in stream lock
In reply to Ben Hutchings3.16.40-rc1 review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 3aa02cb664c5fb1042958c8d1aa8c35055a2ebc4 upstream.
Currently kill_fasync() is called outside the stream lock in snd_pcm_period_elapsed(). This is potentially racy, since the stream may get released even during the irq handler is running. Although snd_pcm_release_substream() calls snd_pcm_drop(), this doesn't guarantee that the irq handler finishes, thus the kill_fasync() call outside the stream spin lock may be invoked after the substream is detached, as recently reported by KASAN.
As a quick workaround, move kill_fasync() call inside the stream lock. The fasync is rarely used interface, so this shouldn't have a big impact from the performance POV.
Ideally, we should implement some sync mechanism for the proper finish of stream and irq handler. But this oneliner should suffice for most cases, so far.
--- sound/core/pcm_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/core/pcm_lib.c +1 -1
@@ -1856,10 +1856,10 @@ void snd_pcm_period_elapsed(struct snd_pif (substream->timer_running)snd_timer_interrupt (substream->timer,1 ); _end: -snd_pcm_stream_unlock_irqrestore (substream, flags);if (runtime->transfer_ack_end) runtime->transfer_ack_end (substream);kill_fasync (&runtime->fasync,SIGIO ,POLL_IN ); +snd_pcm_stream_unlock_irqrestore (substream, flags); }EXPORT_SYMBOL (snd_pcm_period_elapsed);
This is the combined diff for 3.16.40-rc1 relative to 3.16.39.
Ben.
Signature · 3 lines
Ben Hutchings The most exhausting thing in life is being insincere. - Anne Morrow Lindberg
MAINTAINERS +4 -5
@@ -10057,12 +10057,11 @@ F: arch/x86/xen/*swiotlb* F: drivers/xen/*swiotlb* XFS FILESYSTEM -P: Silicon Graphics Inc M: Dave Chinner <[email protected]> -M: [email protected] -L: [email protected] -W: http://oss.sgi.com/projects/xfs -T: git git://oss.sgi.com/xfs/xfs.git +M: [email protected] +L: [email protected] +W: http://xfs.org/ +T: git git://git.kernel.org/pub/scm/linux/kernel/git/dgc/linux-xfs.git S: Supported F: Documentation/filesystems/xfs.txt F: fs/xfs/
Makefile +5 -4
@@ -1,7 +1,7 @@ VERSION = 3 PATCHLEVEL = 16 -SUBLEVEL = 39 -EXTRAVERSION = +SUBLEVEL = 40 +EXTRAVERSION = -rc1 NAME = Museum of Fishiegoodies # *DOCUMENTATION*
@@ -407,11 +407,12 @@ KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ -fno-strict-aliasing -fno-common \ -Werror-implicit-function-declaration \ -Wno-format-security \ - -std=gnu89 + -std=gnu89 $(call cc-option,-fno-PIE) + KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL := -KBUILD_AFLAGS := -D__ASSEMBLY__ +KBUILD_AFLAGS := -D__ASSEMBLY__ $(call cc-option,-fno-PIE) KBUILD_AFLAGS_MODULE := -DMODULE KBUILD_CFLAGS_MODULE := -DMODULE KBUILD_LDFLAGS_MODULE := -T $(srctree)/scripts/module-common.lds
arch/arc/kernel/signal.c +4 -3
@@ -80,11 +80,12 @@ static int restore_usr_regs(struct pt_regs *regs, struct rt_sigframe __user *sf)int err; err =__copy_from_user (&set, &sf->uc.uc_sigmask,sizeof (set)); -if (!err) -set_current_blocked (&set); - err |=__copy_from_user (regs, &(sf->uc.uc_mcontext.regs.scratch),sizeof (sf->uc.uc_mcontext.regs.scratch)); +if (err) +return err; + +set_current_blocked (&set);return err; }
arch/arm/boot/dts/exynos4210-pinctrl.dtsi +1 -1
@@ -647,7 +647,7 @@ sd4_bus8: sd4-bus-width8 { samsung,pins = "gpk1-3", "gpk1-4", "gpk1-5", "gpk1-6"; samsung,pin-function = <3>; - samsung,pin-pud = <4>; + samsung,pin-pud = <3>; samsung,pin-drv = <3>; };
arch/arm/mach-pxa/corgi_pm.c +4 -9
@@ -131,16 +131,11 @@ static int corgi_should_wakeup(unsigned int resume_on_alarm)return is_resume; } -static unsigned long corgi_charger_wakeup (void ) +static bool corgi_charger_wakeup (void ) { -unsigned long ret; - - ret = (!gpio_get_value (CORGI_GPIO_AC_IN ) <<GPIO_bit (CORGI_GPIO_AC_IN )) - | (!gpio_get_value (CORGI_GPIO_KEY_INT ) - <<GPIO_bit (CORGI_GPIO_KEY_INT )) - | (!gpio_get_value (CORGI_GPIO_WAKEUP ) - <<GPIO_bit (CORGI_GPIO_WAKEUP )); -return ret; +return !gpio_get_value (CORGI_GPIO_AC_IN ) || + !gpio_get_value (CORGI_GPIO_KEY_INT ) || + !gpio_get_value (CORGI_GPIO_WAKEUP ); }unsigned long corgipm_read_devdata (int type)
arch/arm/mach-pxa/include/mach/sharpsl_pm.h +1 -1
@@ -34,7 +34,7 @@ struct sharpsl_charger_machinfo {#define SHARPSL_STATUS_LOCK 5#define SHARPSL_STATUS_CHRGFULL 6#define SHARPSL_STATUS_FATAL 7 -unsigned long (*charger_wakeup)(void ); +bool (*charger_wakeup)(void );int (*should_wakeup)(unsigned int resume_on_alarm);void (*backlight_limit)(int );int (*backlight_get_status) (void );
arch/arm/mach-pxa/sharpsl_pm.c +1 -1
@@ -744,7 +744,7 @@ static int sharpsl_off_charge_battery(void) time =RCNR ;while (1 ) {/* Check if any wakeup event had occurred */ -if (sharpsl_pm.machinfo->charger_wakeup () !=0 ) +if (sharpsl_pm.machinfo->charger_wakeup ())return 0 ;/* Check for timeout */ if ((RCNR - time) >SHARPSL_WAIT_CO_TIME )
arch/arm/mach-pxa/spitz_pm.c +3 -6
@@ -165,13 +165,10 @@ static int spitz_should_wakeup(unsigned int resume_on_alarm)return is_resume; } -static unsigned long spitz_charger_wakeup (void ) +static bool spitz_charger_wakeup (void ) { -unsigned long ret; - ret = ((!gpio_get_value (SPITZ_GPIO_KEY_INT ) - <<GPIO_bit (SPITZ_GPIO_KEY_INT )) - |gpio_get_value (SPITZ_GPIO_SYNC )); -return ret; +return !gpio_get_value (SPITZ_GPIO_KEY_INT ) || +gpio_get_value (SPITZ_GPIO_SYNC ); }unsigned long spitzpm_read_devdata (int type)
arch/arm64/include/asm/kvm_emulate.h +6 -5
@@ -135,11 +135,6 @@ static inline bool kvm_vcpu_dabt_isvalid(const struct kvm_vcpu *vcpu)return !!(kvm_vcpu_get_hsr (vcpu) &ESR_EL2_ISV ); } -static inline bool kvm_vcpu_dabt_iswrite (const struct kvm_vcpu *vcpu) -{ -return !!(kvm_vcpu_get_hsr (vcpu) &ESR_EL2_WNR ); -} -static inline bool kvm_vcpu_dabt_issext (const struct kvm_vcpu *vcpu) {return !!(kvm_vcpu_get_hsr (vcpu) &ESR_EL2_SSE );
@@ -160,6 +155,12 @@ static inline bool kvm_vcpu_dabt_iss1tw(const struct kvm_vcpu *vcpu)return !!(kvm_vcpu_get_hsr (vcpu) &ESR_EL2_S1PTW ); } +static inline bool kvm_vcpu_dabt_iswrite (const struct kvm_vcpu *vcpu) +{ +return !!(kvm_vcpu_get_hsr (vcpu) &ESR_EL2_WNR ) || +kvm_vcpu_dabt_iss1tw (vcpu);/* AF/DBM update */ +} +static inline int kvm_vcpu_dabt_get_as (const struct kvm_vcpu *vcpu) {return 1 << ((kvm_vcpu_get_hsr (vcpu) &ESR_EL2_SAS ) >>ESR_EL2_SAS_SHIFT );
arch/arm64/kernel/debug-monitors.c +4 -2
@@ -427,8 +427,10 @@ int kernel_active_single_step(void)/* ptrace API */ void user_enable_single_step (struct task_struct *task) { -set_ti_thread_flag (task_thread_info (task),TIF_SINGLESTEP ); -set_regs_spsr_ss (task_pt_regs (task)); +struct thread_info *ti =task_thread_info (task); + +if (!test_and_set_ti_thread_flag (ti,TIF_SINGLESTEP )) +set_regs_spsr_ss (task_pt_regs (task)); }void user_disable_single_step (struct task_struct *task)
arch/arm64/kernel/head.S +2 -1
@@ -322,8 +322,9 @@ CPU_LE( movk x0, #0x30d0, lsl #16 ) // Clear EE and E0E on LE systems b.lt 4f // Skip if no PMU present mrs x0, pmcr_el0 // Disable debug access traps ubfx x0, x0, #11, #5 // to EL2 and allow access to - msr mdcr_el2, x0 // all PMU counters from EL1 4: + csel x0, xzr, x0, lt // all PMU counters from EL1 + msr mdcr_el2, x0 // (if they exist) /* Stage-2 translation */ msr vttbr_el2, xzr
arch/m68k/include/asm/delay.h +1 -1
@@ -114,6 +114,6 @@ static inline void __udelay(unsigned long usecs)*/ #define HZSCALE (268435456 / (1000000 / HZ)) -#define ndelay (n) __delay(DIV_ROUND_UP((n) * ((((HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6), 1000)); +#define ndelay (n) __delay(DIV_ROUND_UP((n) * ((((HZSCALE) >> 11) * (loops_per_jiffy >> 11)) >> 6), 1000))#endif /* defined(_M68K_DELAY_H) */
arch/metag/include/asm/atomic.h +1 -2
@@ -39,11 +39,10 @@#define atomic_dec (v) atomic_sub(1, (v))#define atomic_inc_not_zero (v) atomic_add_unless((v), 1, 0) +#define atomic_dec_if_positive (v) atomic_sub_if_positive(1, v)#endif -#define atomic_dec_if_positive (v) atomic_sub_if_positive(1, v) -#include <asm-generic/atomic64.h> #endif /* __ASM_METAG_ATOMIC_H */
arch/mips/cavium-octeon/setup.c +14 -0
@@ -247,6 +247,17 @@ static void octeon_crash_shutdown(struct pt_regs *regs) default_machine_crash_shutdown(regs); } +#ifdef CONFIG_SMP +void octeon_crash_smp_send_stop (void ) +{ +int cpu; + +/* disable watchdogs */ +for_each_online_cpu (cpu) +cvmx_write_csr (CVMX_CIU_WDOGX (cpu_logical_map (cpu)),0 ); +} +#endif +#endif /* CONFIG_KEXEC */ #ifdef CONFIG_CAVIUM_RESERVE32
@@ -827,6 +838,9 @@ void __init prom_init(void) _machine_kexec_shutdown = octeon_shutdown; _machine_crash_shutdown = octeon_crash_shutdown; _machine_kexec_prepare = octeon_kexec_prepare; +#ifdef CONFIG_SMP + _crash_smp_send_stop = octeon_crash_smp_send_stop; +#endif #endif octeon_user_io_init ();
arch/mips/include/asm/kexec.h +1 -0
@@ -45,6 +45,7 @@ extern const unsigned char kexec_smp_wait[];extern unsigned long secondary_kexec_args[4 ];extern void (*relocated_kexec_smp_wait) (void *);extern atomic_t kexec_ready_to_reboot; +extern void (*_crash_smp_send_stop)(void );#endif #endif
arch/mips/include/asm/kvm_host.h +4 -3
@@ -403,7 +403,10 @@ struct kvm_vcpu_arch {/* Host KSEG0 address of the EI/DI offset */ void *kseg0_commpage; -u32 io_gpr;/* GPR used as IO source/target */ +/* Resume PC after MMIO completion */ +unsigned long io_pc; +/* GPR used as IO source/target */ +u32 io_gpr;struct hrtimer comparecount_timer;/* Count timer control KVM register */
@@ -425,8 +428,6 @@ struct kvm_vcpu_arch {/* Bitmask of pending exceptions to be cleared */ unsigned long pending_exceptions_clr; -unsigned long pending_load_cause; -/* Save/Restore the entryhi register when are are preempted/scheduled back in */ unsigned long preempt_entryhi;
arch/mips/include/asm/ptrace.h +1 -1
@@ -70,7 +70,7 @@ static inline int is_syscall_success(struct pt_regs *regs)static inline long regs_return_value (struct pt_regs *regs) { -if (is_syscall_success (regs)) +if (is_syscall_success (regs) || !user_mode (regs))return regs->regs[2 ];else return -regs->regs[2 ];
arch/mips/kernel/crash.c +17 -1
@@ -37,9 +37,14 @@ static void crash_shutdown_secondary(void *ignore)static void crash_kexec_prepare_cpus (void ) { +static int cpus_stopped;unsigned int msecs; +unsigned int ncpus; -unsigned int ncpus =num_online_cpus () -1 ;/* Excluding the panic cpu */ +if (cpus_stopped) +return ; + + ncpus =num_online_cpus () -1 ;/* Excluding the panic cpu */ dump_send_ipi (crash_shutdown_secondary);smp_wmb ();
@@ -54,6 +59,17 @@ static void crash_kexec_prepare_cpus(void)cpu_relax (); mdelay(1); } + + cpus_stopped =1 ; +} + +/* Override the weak function in kernel/panic.c */ +void crash_smp_send_stop (void ) +{ +if (_crash_smp_send_stop) +_crash_smp_send_stop (); + +crash_kexec_prepare_cpus (); }#else /* !defined(CONFIG_SMP) */
arch/mips/kernel/machine_kexec.c +1 -0
@@ -25,6 +25,7 @@ void (*_machine_crash_shutdown)(struct pt_regs *regs) = NULL;#ifdef CONFIG_SMP void (*relocated_kexec_smp_wait) (void *);atomic_t kexec_ready_to_reboot =ATOMIC_INIT (0 ); +void (*_crash_smp_send_stop)(void ) =NULL ;#endif int
arch/mips/kvm/kvm_mips_emul.c +19 -20
@@ -761,15 +761,15 @@ enum emulation_result kvm_mips_emul_eret(struct kvm_vcpu *vcpu)struct mips_coproc *cop0 = vcpu->arch.cop0;enum emulation_result er =EMULATE_DONE ; -if (kvm_read_c0_guest_status (cop0) &ST0_EXL ) { +if (kvm_read_c0_guest_status (cop0) &ST0_ERL ) { +kvm_clear_c0_guest_status (cop0,ST0_ERL ); + vcpu->arch.pc =kvm_read_c0_guest_errorepc (cop0); + }else if (kvm_read_c0_guest_status (cop0) &ST0_EXL ) {kvm_debug ("[%#lx] ERET to %#lx\n" , vcpu->arch.pc,kvm_read_c0_guest_epc (cop0));kvm_clear_c0_guest_status (cop0,ST0_EXL ); vcpu->arch.pc =kvm_read_c0_guest_epc (cop0); - }else if (kvm_read_c0_guest_status (cop0) &ST0_ERL ) { -kvm_clear_c0_guest_status (cop0,ST0_ERL ); - vcpu->arch.pc =kvm_read_c0_guest_errorepc (cop0); }else {printk ("[%#lx] ERET when MIPS_SR_EXL|MIPS_SR_ERL == 0\n" , vcpu->arch.pc);
@@ -1328,6 +1328,7 @@ kvm_mips_emulate_load(uint32_t inst, uint32_t cause, struct kvm_run *run, struct kvm_vcpu *vcpu) { enum emulation_result er = EMULATE_DO_MMIO; +unsigned long curr_pc;int32_t op, base, rt, offset;uint32_t bytes;
@@ -1336,7 +1337,18 @@ kvm_mips_emulate_load(uint32_t inst, uint32_t cause, offset = inst &0xffff ; op = (inst >>26 ) &0x3f ; - vcpu->arch.pending_load_cause = cause; +/* +* Find the resume PC now while we have safe and easy access to the +* prior branch instruction, and save it for +* kvm_mips_complete_mmio_load() to restore later. +*/ + curr_pc = vcpu->arch.pc; + er =update_pc (vcpu, cause); +if (er ==EMULATE_FAIL ) +return er; + vcpu->arch.io_pc = vcpu->arch.pc; + vcpu->arch.pc = curr_pc; + vcpu->arch.io_gpr = rt;switch (op) {
@@ -2172,7 +2184,6 @@ kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu, struct kvm_run *run) {unsigned long *gpr = &vcpu->arch.gprs[vcpu->arch.io_gpr];enum emulation_result er =EMULATE_DONE ; -unsigned long curr_pc;if (run->mmio.len >sizeof (*gpr)) {printk ("Bad MMIO length: %d" , run->mmio.len);
@@ -2180,14 +2191,8 @@ kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu, struct kvm_run *run) goto done; } -/* -* Update PC and hold onto current PC in case there is -* an error and we want to rollback the PC -*/ - curr_pc = vcpu->arch.pc; - er =update_pc (vcpu, vcpu->arch.pending_load_cause); -if (er ==EMULATE_FAIL ) -return er; +/* Restore saved resume PC */ + vcpu->arch.pc = vcpu->arch.io_pc;switch (run->mmio.len) {case 4 :
@@ -2209,12 +2214,6 @@ kvm_mips_complete_mmio_load(struct kvm_vcpu *vcpu, struct kvm_run *run)break ; } -if (vcpu->arch.pending_load_cause &CAUSEF_BD ) -kvm_debug - ("[%#lx] Completing %d byte BD Load to gpr %d (0x%08lx) type %d\n" , - vcpu->arch.pc, run->mmio.len, vcpu->arch.io_gpr, *gpr, - vcpu->mmio_needed); - done:return er; }
arch/parisc/include/asm/pgtable.h +4 -4
@@ -48,8 +48,8 @@ extern void purge_tlb_entries(struct mm_struct *, unsigned long);do { \unsigned long flags; \spin_lock_irqsave (&pa_dbit_lock, flags); \ -set_pte (ptep, pteval); \purge_tlb_entries (mm, addr); \ +set_pte (ptep, pteval); \spin_unlock_irqrestore (&pa_dbit_lock, flags); \ }while (0 )
@@ -452,8 +452,8 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, unsignedspin_unlock_irqrestore (&pa_dbit_lock, flags);return 0 ; } -set_pte (ptep,pte_mkold (pte));purge_tlb_entries (vma->vm_mm, addr); +set_pte (ptep,pte_mkold (pte));spin_unlock_irqrestore (&pa_dbit_lock, flags);return 1 ; }
@@ -466,8 +466,8 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr,spin_lock_irqsave (&pa_dbit_lock, flags); old_pte = *ptep; -pte_clear (mm,addr,ptep);purge_tlb_entries (mm, addr); +pte_clear (mm,addr,ptep);spin_unlock_irqrestore (&pa_dbit_lock, flags);return old_pte;
@@ -477,8 +477,8 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addr, {unsigned long flags;spin_lock_irqsave (&pa_dbit_lock, flags); -set_pte (ptep,pte_wrprotect (*ptep));purge_tlb_entries (mm, addr); +set_pte (ptep,pte_wrprotect (*ptep));spin_unlock_irqrestore (&pa_dbit_lock, flags); }
arch/parisc/kernel/pacache.S +18 -31
111 lines not on this page · raw message
arch/parisc/kernel/pci-dma.c +1 -1
@@ -95,8 +95,8 @@ static inline int map_pte_uncached(pte_t * pte,if (!pte_none (*pte))printk (KERN_ERR "map_pte_uncached: page already exists\n" ); -set_pte (pte,__mk_pte (*paddr_ptr,PAGE_KERNEL_UNC ));purge_tlb_start (flags); +set_pte (pte,__mk_pte (*paddr_ptr,PAGE_KERNEL_UNC ));pdtlb_kernel (orig_vaddr);purge_tlb_end (flags); vaddr +=PAGE_SIZE ;
arch/parisc/kernel/syscall.S +9 -2
@@ -106,8 +106,6 @@ linux_gateway_entry: mtsp %r0,%sr4 /* get kernel space into sr4 */ mtsp %r0,%sr5 /* get kernel space into sr5 */ mtsp %r0,%sr6 /* get kernel space into sr6 */ - mfsp %sr7,%r1 /* save user sr7 */ - mtsp %r1,%sr3 /* and store it in sr3 */ #ifdef CONFIG_64BIT /* for now we can *always* set the W bit on entry to the syscall
@@ -133,6 +131,14 @@ linux_gateway_entry: depdi 0, 31, 32, %r21 1: #endif + + /* We use a rsm/ssm pair to prevent sr3 from being clobbered + * by external interrupts. + */ + mfsp %sr7,%r1 /* save user sr7 */ + rsm PSW_SM_I, %r0 /* disable interrupts */ + mtsp %r1,%sr3 /* and store it in sr3 */ + mfctl %cr30,%r1 xor %r1,%r30,%r30 /* ye olde xor trick */ xor %r1,%r30,%r1
@@ -147,6 +153,7 @@ linux_gateway_entry: */ mtsp %r0,%sr7 /* get kernel space into sr7 */ + ssm PSW_SM_I, %r0 /* enable interrupts */ STREGM %r1,FRAME_SIZE(%r30) /* save r1 (usp) here for now */ mfctl %cr30,%r1 /* get task ptr in %r1 */ LDREG TI_TASK(%r1),%r1
arch/powerpc/include/asm/kvm_book3s.h +1 -0
@@ -83,6 +83,7 @@ struct kvmppc_vcpu_book3s {u64 sdr1;u64 hior;u64 msr_mask; +u64 vtb;u64 purr_offset;u64 spurr_offset;#ifdef CONFIG_PPC_BOOK3S_32
arch/powerpc/include/asm/kvm_host.h +1 -1
@@ -305,6 +305,7 @@ struct kvmppc_vcore {u32 arch_compat;ulong pcr;ulong dpdes;/* doorbell state (POWER8) */ +ulong vtb;/* virtual timebase */ };#define VCORE_ENTRY_COUNT (vc) ((vc)->entry_exit_count & 0xff)
@@ -462,7 +463,6 @@ struct kvm_vcpu_arch {ulong purr;ulong spurr;ulong ic; -ulong vtb;ulong dscr;ulong amr;ulong uamor;
arch/powerpc/include/asm/reg.h +1 -0
@@ -705,6 +705,7 @@#define MMCR0_FCHV 0x00000001UL/* freeze conditions in hypervisor mode */ #define SPRN_MMCR1 798#define SPRN_MMCR2 785 +#define SPRN_UMMCR2 769#define SPRN_MMCRA 0x312#define MMCRA_SDSYNC 0x80000000UL/* SDAR synced with SIAR */ #define MMCRA_SDAR_DCACHE_MISS 0x40000000UL
arch/powerpc/kernel/asm-offsets.c +1 -1
@@ -506,7 +506,6 @@ int main(void) DEFINE(VCPU_PURR, offsetof(struct kvm_vcpu, arch.purr)); DEFINE(VCPU_SPURR, offsetof(struct kvm_vcpu, arch.spurr)); DEFINE(VCPU_IC, offsetof(struct kvm_vcpu, arch.ic)); - DEFINE(VCPU_VTB, offsetof(struct kvm_vcpu, arch.vtb)); DEFINE(VCPU_DSCR, offsetof(struct kvm_vcpu, arch.dscr)); DEFINE(VCPU_AMR, offsetof(struct kvm_vcpu, arch.amr)); DEFINE(VCPU_UAMOR, offsetof(struct kvm_vcpu, arch.uamor));
@@ -560,6 +559,7 @@ int main(void)DEFINE (VCORE_LPCR , offsetof(struct kvmppc_vcore , lpcr));DEFINE (VCORE_PCR , offsetof(struct kvmppc_vcore , pcr));DEFINE (VCORE_DPDES , offsetof(struct kvmppc_vcore , dpdes)); +DEFINE (VCORE_VTB , offsetof(struct kvmppc_vcore , vtb));DEFINE (VCPU_SLB_E , offsetof(struct kvmppc_slb , orige));DEFINE (VCPU_SLB_V , offsetof(struct kvmppc_slb , origv));DEFINE (VCPU_SLB_SIZE ,sizeof (struct kvmppc_slb ));
arch/powerpc/kernel/eeh_driver.c +11 -1
@@ -541,8 +541,10 @@ static int eeh_reset_device(struct eeh_pe *pe, struct pci_bus *bus)/* Clear frozen state */ rc =eeh_clear_pe_frozen_state (pe); -if (rc) +if (rc) { +pci_unlock_rescan_remove ();return rc; + }/* Give the system 5 seconds to finish running the user-space * hotplug shutdown scripts, e.g. ifdown for ethernet. Yes,
@@ -828,6 +830,14 @@ static void eeh_handle_special_event(void)/* Notify all devices to be down */ bus =eeh_pe_bus_get (phb_pe); +if (!bus) { +pr_err ("%s: Cannot find PCI bus for " +"PHB#%d-PE#%x\n" , + __func__, + pe->phb->global_number, + pe->addr); +break ; + }eeh_pe_dev_traverse (pe, eeh_report_failure,NULL );pcibios_remove_pci_devices (bus);
arch/powerpc/kernel/idle_power7.S +1 -1
@@ -28,7 +28,7 @@ std r0,0(r1); \ ptesync; \ ld r0,0(r1); \ -1: cmp cr0,r0,r0; \ +1: cmpd cr0,r0,r0; \ bne 1b; \ IDLE_INST; \ b .
arch/powerpc/kernel/nvram_64.c +3 -3
@@ -292,7 +292,7 @@ int __init nvram_remove_partition(const char *name, int sig,/* Make partition a free partition */ part->header.signature =NVRAM_SIG_FREE ; -strncpy (part->header.name,"wwwwwwwwwwww" ,12 ); +memset (part->header.name,'w' ,12 ); part->header.checksum =nvram_checksum (&part->header); rc =nvram_write_header (part);if (rc <=0 ) {
@@ -310,8 +310,8 @@ int __init nvram_remove_partition(const char *name, int sig, }if (prev) { prev->header.length += part->header.length; - prev->header.checksum =nvram_checksum (&part->header); - rc =nvram_write_header (part); + prev->header.checksum =nvram_checksum (&prev->header); + rc =nvram_write_header (prev);if (rc <=0 ) {printk (KERN_ERR "nvram_remove_partition: nvram_write failed (%d)\n" , rc);return rc;
arch/powerpc/kernel/vdso64/datapage.S +1 -1
@@ -57,7 +57,7 @@ V_FUNCTION_BEGIN(__kernel_get_syscall_map) bl V_LOCAL_FUNC(__get_datapage) mtlr r12 addi r3,r3,CFG_SYSCALL_MAP64 - cmpli cr0,r4,0 + cmpldi cr0,r4,0 crclr cr0*4+so beqlr li r0,__NR_syscalls
arch/powerpc/kernel/vdso64/gettimeofday.S +1 -1
@@ -145,7 +145,7 @@ V_FUNCTION_BEGIN(__kernel_clock_getres) bne cr0,99f li r3,0 - cmpli cr0,r4,0 + cmpldi cr0,r4,0 crclr cr0*4+so beqlr lis r5,CLOCK_REALTIME_RES@h
arch/powerpc/kvm/book3s_emulate.c +2 -0
@@ -503,6 +503,7 @@ int kvmppc_core_emulate_mtspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong spr_val)case SPRN_MMCR0 :case SPRN_MMCR1 :case SPRN_MMCR2 : +case SPRN_UMMCR2 :#endif break ; unprivileged:
@@ -633,6 +634,7 @@ int kvmppc_core_emulate_mfspr_pr(struct kvm_vcpu *vcpu, int sprn, ulong *spr_valcase SPRN_MMCR0 :case SPRN_MMCR1 :case SPRN_MMCR2 : +case SPRN_UMMCR2 :case SPRN_TIR :#endif *spr_val =0 ;
arch/powerpc/kvm/book3s_hv.c +2 -2
@@ -909,7 +909,7 @@ static int kvmppc_get_one_reg_hv(struct kvm_vcpu *vcpu, u64 id, *val =get_reg_val (id, vcpu->arch.ic);break ;case KVM_REG_PPC_VTB : - *val =get_reg_val (id, vcpu->arch.vtb); + *val =get_reg_val (id, vcpu->arch.vcore->vtb);break ;case KVM_REG_PPC_CSIGR : *val =get_reg_val (id, vcpu->arch.csigr);
@@ -1110,7 +1110,7 @@ static int kvmppc_set_one_reg_hv(struct kvm_vcpu *vcpu, u64 id, vcpu->arch.ic =set_reg_val (id, *val);break ;case KVM_REG_PPC_VTB : - vcpu->arch.vtb =set_reg_val (id, *val); + vcpu->arch.vcore->vtb =set_reg_val (id, *val);break ;case KVM_REG_PPC_CSIGR : vcpu->arch.csigr =set_reg_val (id, *val);
arch/powerpc/kvm/book3s_hv_rmhandlers.S +7 -7
@@ -457,9 +457,11 @@ ALT_FTR_SECTION_END_IFSET(CPU_FTR_ARCH_207S) 38: BEGIN_FTR_SECTION - /* DPDES is shared between threads */ + /* DPDES and VTB are shared between threads */ ld r8, VCORE_DPDES(r5) + ld r7, VCORE_VTB(r5) mtspr SPRN_DPDES, r8 + mtspr SPRN_VTB, r7 END_FTR_SECTION_IFSET(CPU_FTR_ARCH_207S) li r0,1
@@ -736,10 +738,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) mtspr SPRN_CIABR, r7 mtspr SPRN_TAR, r8 ld r5, VCPU_IC(r4) - ld r6, VCPU_VTB(r4) - mtspr SPRN_IC, r5 - mtspr SPRN_VTB, r6 ld r8, VCPU_EBBHR(r4) + mtspr SPRN_IC, r5 mtspr SPRN_EBBHR, r8 ld r5, VCPU_EBBRR(r4) ld r6, VCPU_BESCR(r4)
@@ -1147,10 +1147,8 @@ END_FTR_SECTION_IFCLR(CPU_FTR_ARCH_207S) stw r6, VCPU_PSPB(r9) std r7, VCPU_FSCR(r9) mfspr r5, SPRN_IC - mfspr r6, SPRN_VTB mfspr r7, SPRN_TAR std r5, VCPU_IC(r9) - std r6, VCPU_VTB(r9) std r7, VCPU_TAR(r9) mfspr r8, SPRN_EBBHR std r8, VCPU_EBBHR(r9)
@@ -1442,9 +1440,11 @@ secondary_too_late: isync BEGIN_FTR_SECTION - /* DPDES is shared between threads */ + /* DPDES and VTB are shared between threads */ mfspr r7, SPRN_DPDES + mfspr r8, SPRN_VTB std r7, VCORE_DPDES(r5) + std r8, VCORE_VTB(r5) /* clear DPDES so we don't get guest doorbells in the host */ li r8, 0 mtspr SPRN_DPDES, r8
arch/powerpc/kvm/book3s_pr.c +6 -0
@@ -1232,6 +1232,9 @@ static int kvmppc_get_one_reg_pr(struct kvm_vcpu *vcpu, u64 id,case KVM_REG_PPC_HIOR : *val =get_reg_val (id,to_book3s (vcpu)->hior);break ; +case KVM_REG_PPC_VTB : + *val =get_reg_val (id,to_book3s (vcpu)->vtb); +break ;case KVM_REG_PPC_LPCR :case KVM_REG_PPC_LPCR_64 :/*
@@ -1268,6 +1271,9 @@ static int kvmppc_set_one_reg_pr(struct kvm_vcpu *vcpu, u64 id,to_book3s (vcpu)->hior =set_reg_val (id, *val);to_book3s (vcpu)->hior_explicit = true;break ; +case KVM_REG_PPC_VTB : +to_book3s (vcpu)->vtb =set_reg_val (id, *val); +break ;case KVM_REG_PPC_LPCR :case KVM_REG_PPC_LPCR_64 :kvmppc_set_lpcr_pr (vcpu,set_reg_val (id, *val));
arch/powerpc/kvm/booke.c +1 -1
@@ -1841,7 +1841,7 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,if (type ==KVMPPC_DEBUG_NONE )continue ; -if (type & !(KVMPPC_DEBUG_WATCH_READ | +if (type & ~(KVMPPC_DEBUG_WATCH_READ |KVMPPC_DEBUG_WATCH_WRITE |KVMPPC_DEBUG_BREAKPOINT ))return -EINVAL ;
arch/powerpc/lib/copyuser_64.S +1 -1
@@ -359,6 +359,7 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) addi r3,r3,8 171: 177: +179: addi r3,r3,8 370: 372:
@@ -373,7 +374,6 @@ END_FTR_SECTION_IFCLR(CPU_FTR_UNALIGNED_LD_STD) 173: 174: 175: -179: 181: 184: 186:
arch/powerpc/platforms/powernv/eeh-ioda.c +5 -0
@@ -578,6 +578,11 @@ static int ioda_eeh_reset(struct eeh_pe *pe, int option) ret =ioda_eeh_phb_reset (hose, option); }else { bus =eeh_pe_bus_get (pe); +if (!bus) { +pr_err ("%s: Cannot find PCI bus for PHB#%d-PE#%x\n" , + __func__, pe->phb->global_number, pe->addr); +return -EIO ; + }if (pci_is_root_bus (bus) ||pci_is_root_bus (bus->parent)) ret =ioda_eeh_root_reset (hose, option);
arch/powerpc/platforms/powernv/pci.c +2 -2
@@ -189,8 +189,8 @@ static void pnv_pci_dump_p7ioc_diag_data(struct pci_controller *hose, data->dma1ErrorLog0, data->dma1ErrorLog1);for (i =0 ; i <OPAL_P7IOC_NUM_PEST_REGS ; i++) { -if ((data->pestA[i] >>63 ) ==0 && - (data->pestB[i] >>63 ) ==0 ) +if ((be64_to_cpu (data->pestA[i]) >>63 ) ==0 && + (be64_to_cpu (data->pestB[i]) >>63 ) ==0 )continue ; pr_info("PE[%3d] A/B: %016llx %016llx\n",
arch/powerpc/platforms/pseries/lpar.c +2 -2
@@ -391,7 +391,7 @@ static void __pSeries_lpar_hugepage_invalidate(unsigned long *slot, unsigned long *vpn, int count, int psize, int ssize) { - unsigned long param[8]; + unsigned long param[PLPAR_HCALL9_BUFSIZE];int i =0 , pix =0 , rc;unsigned long flags =0 ;int lock_tlbie = !mmu_has_feature (MMU_FTR_LOCKLESS_TLBIE );
@@ -508,7 +508,7 @@ static void pSeries_lpar_flush_hash_range(unsigned long number, int local)unsigned long flags =0 ;struct ppc64_tlb_batch *batch = &__get_cpu_var (ppc64_tlb_batch);int lock_tlbie = !mmu_has_feature (MMU_FTR_LOCKLESS_TLBIE ); -unsigned long param[9 ]; +unsigned long param[PLPAR_HCALL9_BUFSIZE ];unsigned long hash, index, shift, hidx, slot;real_pte_t pte;int psize, ssize;
arch/s390/hypfs/hypfs_diag.c +3 -3
@@ -517,11 +517,11 @@ static int diag224(void *ptr)static int diag224_get_name_table (void ) {/* memory must be below 2GB */ - diag224_cpu_names =kmalloc (PAGE_SIZE ,GFP_KERNEL |GFP_DMA ); + diag224_cpu_names = (char *)__get_free_page (GFP_KERNEL |GFP_DMA );if (!diag224_cpu_names)return -ENOMEM ;if (diag224 (diag224_cpu_names)) { -kfree (diag224_cpu_names); +free_page ((unsigned long ) diag224_cpu_names);return -EOPNOTSUPP ; }EBCASC (diag224_cpu_names +16 , (*diag224_cpu_names +1 ) *16 );
@@ -530,7 +530,7 @@ static int diag224_get_name_table(void)static void diag224_delete_name_table (void ) { -kfree (diag224_cpu_names); +free_page ((unsigned long ) diag224_cpu_names); }static int diag224_idx2name (int index,char *name)
arch/tile/kernel/time.c +2 -2
@@ -216,8 +216,8 @@ void do_timer_interrupt(struct pt_regs *regs, int fault_num)*/ unsigned long long sched_clock (void ) { -return clocksource_cyc2ns (get_cycles (), - sched_clock_mult,SCHED_CLOCK_SHIFT ); +return mult_frac (get_cycles (), + sched_clock_mult,1ULL <<SCHED_CLOCK_SHIFT ); }int setup_profiling_timer (unsigned int multiplier)
arch/x86/include/asm/kexec.h +1 -0
@@ -165,6 +165,7 @@ struct kimage_arch {typedef void crash_vmclear_fn (void );extern crash_vmclear_fn __rcu *crash_vmclear_loaded_vmcss; +extern void kdump_nmi_shootdown_cpus (void );#endif /* __ASSEMBLY__ */
arch/x86/include/asm/smp.h +1 -0
@@ -69,6 +69,7 @@ struct smp_ops {void (*smp_cpus_done)(unsigned max_cpus);void (*stop_other_cpus)(int wait); +void (*crash_stop_other_cpus)(void );void (*smp_send_reschedule)(int cpu);int (*cpu_up)(unsigned cpu,struct task_struct *tidle);
arch/x86/include/asm/uaccess.h +5 -5
@@ -329,7 +329,7 @@ do { \#define __get_user_asm_u64 (x, ptr, retval, errret) \ __get_user_asm(x, ptr, retval, "q", "", "=r", errret)#define __get_user_asm_ex_u64 (x, ptr) \ - __get_user_asm_ex(x, ptr, "q", "", "=r") + __get_user_asm_ex(x, ptr, "q", "", "=&r")#endif #define __get_user_size (x, ptr, size, retval, errret) \
@@ -372,13 +372,13 @@ do { \__chk_user_ptr (ptr); \switch (size) { \case 1 : \ -__get_user_asm_ex (x, ptr,"b" ,"b" ,"=q" ); \ +__get_user_asm_ex (x, ptr,"b" ,"b" ,"=&q" ); \break ; \case 2 : \ -__get_user_asm_ex (x, ptr,"w" ,"w" ,"=r" ); \ +__get_user_asm_ex (x, ptr,"w" ,"w" ,"=&r" ); \break ; \case 4 : \ -__get_user_asm_ex (x, ptr,"l" ,"k" ,"=r" ); \ +__get_user_asm_ex (x, ptr,"l" ,"k" ,"=&r" ); \break ; \case 8 : \__get_user_asm_ex_u64 (x, ptr); \
@@ -392,7 +392,7 @@ do { \ asm volatile("1: mov"itype" %1,%"rtype"0\n" \ "2:\n" \ _ASM_EXTABLE_EX(1b, 2b) \ - : ltype(x) : "m" (__m(addr))) + : ltype(x) : "m" (__m(addr)), "0" (0))#define __put_user_nocheck (x, ptr, size) \ ({ \
arch/x86/kernel/apic/x2apic_uv_x.c +2 -2
@@ -633,9 +633,9 @@ static __init void map_mmioh_high_uv3(int index, int min_pnode, int max_pnode) l = li; } addr1 = (base << shift) + - f * (unsigned long )(1 << m_io); + f * (1ULL << m_io); addr2 = (base << shift) + - (l +1 ) * (unsigned long )(1 << m_io); + (l +1 ) * (1ULL << m_io);pr_info ("UV: %s[%03d..%03d] NASID 0x%04x ADDR 0x%016lx - 0x%016lx\n" , id, fi, li, lnasid, addr1, addr2);if (max_io < l)
arch/x86/kernel/cpu/perf_event.c +1 -1
@@ -64,7 +64,7 @@ u64 x86_perf_event_update(struct perf_event *event)int shift =64 - x86_pmu.cntval_bits;u64 prev_raw_count, new_raw_count;int idx = hwc->idx; -s64 delta; +u64 delta;if (idx ==INTEL_PMC_IDX_FIXED_BTS )return 0 ;
arch/x86/kernel/cpu/perf_event_intel.c +1 -1
@@ -2669,7 +2669,7 @@ __init int intel_pmu_init(void)/* Support full width counters using alternative MSR range */ if (x86_pmu.intel_cap.full_width_write) { - x86_pmu.max_period = x86_pmu.cntval_mask; + x86_pmu.max_period = x86_pmu.cntval_mask >>1 ; x86_pmu.perfctr =MSR_IA32_PMC0 ;pr_cont ("full-width counters, " ); }
arch/x86/kernel/crash.c +19 -3
@@ -82,7 +82,7 @@ static void kdump_nmi_callback(int cpu, struct pt_regs *regs)disable_local_APIC (); } -static void kdump_nmi_shootdown_cpus (void ) +void kdump_nmi_shootdown_cpus (void ) { in_crash_kexec =1 ;nmi_shootdown_cpus (kdump_nmi_callback);
@@ -90,8 +90,24 @@ static void kdump_nmi_shootdown_cpus(void) disable_local_APIC(); } +/* Override the weak function in kernel/panic.c */ +void crash_smp_send_stop (void ) +{ +static int cpus_stopped; + +if (cpus_stopped) +return ; + +if (smp_ops.crash_stop_other_cpus) + smp_ops.crash_stop_other_cpus (); +else +smp_send_stop (); + + cpus_stopped =1 ; +} +#else -static void kdump_nmi_shootdown_cpus (void ) +void crash_smp_send_stop (void ) {/* There are no cpus to shootdown */ }
@@ -110,7 +126,7 @@ void native_machine_crash_shutdown(struct pt_regs *regs)/* The kernel is broken so disable interrupts */ local_irq_disable (); -kdump_nmi_shootdown_cpus (); +crash_smp_send_stop ();/* * VMCLEAR VMCSs loaded on this cpu if needed.
arch/x86/kernel/head_32.S +1 -1
@@ -564,7 +564,7 @@ early_idt_handler_common: movl %eax,%ds movl %eax,%es - cmpl $(__KERNEL_CS),32(%esp) + cmpw $(__KERNEL_CS),32(%esp) jne 10f leal 28(%esp),%eax # Pointer to %eip
arch/x86/kernel/ptrace.c +2 -2
@@ -190,8 +190,8 @@ unsigned long kernel_stack_pointer(struct pt_regs *regs)return sp; prev_esp = (u32 *)(context); -if (prev_esp) -return (unsigned long )prev_esp; +if (*prev_esp) +return (unsigned long )*prev_esp;return (unsigned long )regs; }
arch/x86/kernel/smp.c +5 -0
@@ -31,6 +31,8 @@#include <asm/apic.h> #include <asm/nmi.h> #include <asm/trace/irq_vectors.h> +#include <asm/kexec.h> +/* * Some notes on x86 processor bugs affecting SMP operation: *
@@ -347,6 +349,9 @@ struct smp_ops smp_ops = { .smp_cpus_done = native_smp_cpus_done, .stop_other_cpus = native_stop_other_cpus, +#if defined(CONFIG_KEXEC_CORE) + .crash_stop_other_cpus = kdump_nmi_shootdown_cpus, +#endif .smp_send_reschedule = native_smp_send_reschedule, .cpu_up = native_cpu_up,
arch/x86/kvm/emulate.c +11 -25
@@ -1981,16 +1981,10 @@ static int em_iret(struct x86_emulate_ctxt *ctxt)static int em_jmp_far (struct x86_emulate_ctxt *ctxt) {int rc; -unsigned short sel, old_sel; -struct desc_struct old_desc, new_desc; -const struct x86_emulate_ops *ops = ctxt->ops; +unsigned short sel; +struct desc_struct new_desc;u8 cpl = ctxt->ops->cpl (ctxt); -/* Assignment of RIP may only fail in 64-bit mode */ -if (ctxt->mode ==X86EMUL_MODE_PROT64 ) - ops->get_segment (ctxt, &old_sel, &old_desc,NULL , -VCPU_SREG_CS ); -memcpy (&sel, ctxt->src.valptr + ctxt->op_bytes,2 ); rc = __load_segment_descriptor(ctxt, sel, VCPU_SREG_CS, cpl, false,
@@ -1999,12 +1993,10 @@ static int em_jmp_far(struct x86_emulate_ctxt *ctxt)return rc; rc =assign_eip_far (ctxt, ctxt->src.val, new_desc.l); -if (rc !=X86EMUL_CONTINUE ) { -WARN_ON (ctxt->mode !=X86EMUL_MODE_PROT64 ); -/* assigning eip failed; restore the old cs */ - ops->set_segment (ctxt, old_sel, &old_desc,0 ,VCPU_SREG_CS ); -return rc; - } +/* Error handling is not implemented. */ +if (rc !=X86EMUL_CONTINUE ) +return X86EMUL_UNHANDLEABLE ; +return rc; }
@@ -2070,14 +2062,8 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt) {int rc;unsigned long eip, cs; -u16 old_cs;int cpl = ctxt->ops->cpl (ctxt); -struct desc_struct old_desc, new_desc; -const struct x86_emulate_ops *ops = ctxt->ops; - -if (ctxt->mode ==X86EMUL_MODE_PROT64 ) - ops->get_segment (ctxt, &old_cs, &old_desc,NULL , -VCPU_SREG_CS ); +struct desc_struct new_desc; rc =emulate_pop (ctxt, &eip, ctxt->op_bytes);if (rc !=X86EMUL_CONTINUE )
@@ -2093,10 +2079,10 @@ static int em_ret_far(struct x86_emulate_ctxt *ctxt)if (rc !=X86EMUL_CONTINUE )return rc; rc =assign_eip_far (ctxt, eip, new_desc.l); -if (rc !=X86EMUL_CONTINUE ) { -WARN_ON (ctxt->mode !=X86EMUL_MODE_PROT64 ); - ops->set_segment (ctxt, old_cs, &old_desc,0 ,VCPU_SREG_CS ); - } +/* Error handling is not implemented. */ +if (rc !=X86EMUL_CONTINUE ) +return X86EMUL_UNHANDLEABLE ; +return rc; }
arch/x86/kvm/x86.c +17 -3
@@ -180,7 +180,18 @@ static void kvm_on_user_return(struct user_return_notifier *urn)struct kvm_shared_msrs *locals = container_of(urn, struct kvm_shared_msrs, urn);struct kvm_shared_msr_values *values; +unsigned long flags; +/* +* Disabling irqs at this point since the following code could be +* interrupted and executed through kvm_arch_hardware_disable() +*/ +local_irq_save (flags); +if (locals->registered) { + locals->registered = false; +user_return_notifier_unregister (urn); + } +local_irq_restore (flags);for (slot =0 ; slot < shared_msrs_global.nr; ++slot) { values = &locals->values[slot];if (values->host != values->curr) {
@@ -188,8 +199,6 @@ static void kvm_on_user_return(struct user_return_notifier *urn) values->curr = values->host; } } - locals->registered = false; -user_return_notifier_unregister (urn); }static void shared_msr_update (unsigned slot,u32 msr)
@@ -3296,6 +3305,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp, };case KVM_SET_VAPIC_ADDR : {struct kvm_vapic_addr va; +int idx; r = -EINVAL ;if (!irqchip_in_kernel (vcpu->kvm))
@@ -3303,7 +3313,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp, r = -EFAULT ;if (copy_from_user (&va, argp,sizeof va)) goto out; + idx =srcu_read_lock (&vcpu->kvm->srcu); r =kvm_lapic_set_vapic_addr (vcpu, va.vapic_addr); +srcu_read_unlock (&vcpu->kvm->srcu, idx);break ; }case KVM_X86_SETUP_MCE : {
@@ -6809,11 +6821,13 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu)void kvm_arch_vcpu_free (struct kvm_vcpu *vcpu) { +void *wbinvd_dirty_mask = vcpu->arch.wbinvd_dirty_mask; +kvmclock_reset (vcpu); -free_cpumask_var (vcpu->arch.wbinvd_dirty_mask);fx_free (vcpu); kvm_x86_ops->vcpu_free (vcpu); +free_cpumask_var (wbinvd_dirty_mask); } struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
block/blk-cgroup.h +1 -1
@@ -47,7 +47,7 @@ struct blkcg {spinlock_t lock;struct radix_tree_root blkg_tree; -struct blkcg_gq *blkg_hint; +struct blkcg_gq __rcu *blkg_hint;struct hlist_head blkg_list;/* for policies to test whether associated blkcg has changed */
block/bsg.c +3 -0
@@ -676,6 +676,9 @@ bsg_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)dprintk ("%s: write %Zd bytes\n" , bd->name, count); +if (unlikely (segment_eq (get_fs (),KERNEL_DS ))) +return -EINVAL ; +bsg_set_block (bd, file); bytes_written =0 ;
crypto/async_tx/async_pq.c +4 -4
@@ -355,8 +355,6 @@ async_syndrome_val(struct page **blocks, unsigned int offset, int disks,dma_set_unmap (tx, unmap);async_tx_submit (chan, tx, submit); - -return tx; }else {struct page *p_src =P (blocks, disks);struct page *q_src =Q (blocks, disks);
@@ -411,9 +409,11 @@ async_syndrome_val(struct page **blocks, unsigned int offset, int disks, submit->cb_param = cb_param_orig; submit->flags = flags_orig;async_tx_sync_epilog (submit); - -return NULL ; + tx =NULL ; } +dmaengine_unmap_put (unmap); + +return tx; }EXPORT_SYMBOL_GPL (async_syndrome_val);
crypto/gcm.c +1 -1
@@ -109,7 +109,7 @@ static int crypto_gcm_setkey(struct crypto_aead *aead, const u8 *key,struct crypto_ablkcipher *ctr = ctx->ctr;struct {be128 hash; -u8 iv[8 ]; +u8 iv[16 ];struct crypto_gcm_setkey_result result;
drivers/acpi/apei/ghes.c +1 -1
@@ -679,7 +679,7 @@ static int ghes_proc(struct ghes *ghes)ghes_do_proc (ghes, ghes->estatus); out:ghes_clear_estatus (ghes); -return 0 ; +return rc; }static void ghes_add_timer (struct ghes *ghes)
drivers/base/platform.c +2 -2
@@ -93,7 +93,7 @@ int platform_get_irq(struct platform_device *dev, unsigned int num)int ret; ret =of_irq_get (dev->dev.of_node, num); -if (ret >=0 || ret == -EPROBE_DEFER ) +if (ret >0 || ret == -EPROBE_DEFER )return ret; }
@@ -142,7 +142,7 @@ int platform_get_irq_byname(struct platform_device *dev, const char *name)int ret; ret =of_irq_get_byname (dev->dev.of_node, name); -if (ret >=0 || ret == -EPROBE_DEFER ) +if (ret >0 || ret == -EPROBE_DEFER )return ret; }
drivers/base/power/main.c +4 -4
@@ -1014,6 +1014,8 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool achar *info =NULL ;int error =0 ; +dpm_wait_for_children (dev, async); +if (async_error) goto Complete;
@@ -1025,8 +1027,6 @@ static int __device_suspend_noirq(struct device *dev, pm_message_t state, bool aif (dev->power.syscore || dev->power.direct_complete) goto Complete; -dpm_wait_for_children (dev, async); -if (dev->pm_domain) { info ="noirq power domain " ; callback =pm_noirq_op (&dev->pm_domain->ops, state);
@@ -1155,6 +1155,8 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool as__pm_runtime_disable (dev, false); +dpm_wait_for_children (dev, async); +if (async_error) goto Complete;
@@ -1166,8 +1168,6 @@ static int __device_suspend_late(struct device *dev, pm_message_t state, bool asif (dev->power.syscore || dev->power.direct_complete) goto Complete; -dpm_wait_for_children (dev, async); -if (dev->pm_domain) { info ="late power domain " ; callback =pm_late_early_op (&dev->pm_domain->ops, state);
drivers/block/nvme-core.c +1 -5
@@ -2196,7 +2196,7 @@ static int nvme_setup_io_queues(struct nvme_dev *dev) result =queue_request_irq (dev, adminq, adminq->irqname);if (result) { adminq->q_suspended =1 ; - goto free_queues; +return result; }/* Free previously allocated queues that are no longer usable */
@@ -2204,10 +2204,6 @@ static int nvme_setup_io_queues(struct nvme_dev *dev)nvme_assign_io_queues (dev);return 0 ; - - free_queues: -nvme_free_queues (dev,1 ); -return result; }/*
drivers/char/hw_random/core.c +3 -3
@@ -65,12 +65,12 @@ static size_t rng_buffer_size(void)static void add_early_randomness (struct hwrng *rng) { -unsigned char bytes[16 ];int bytes_read; +size_t size =min_t (size_t,16 ,rng_buffer_size ()); - bytes_read =rng_get_data (rng, bytes,sizeof (bytes),1 ); + bytes_read =rng_get_data (rng, rng_buffer, size,1 );if (bytes_read >0 ) -add_device_randomness (bytes, bytes_read); +add_device_randomness (rng_buffer, bytes_read); }static inline int hwrng_init (struct hwrng *rng)
drivers/char/virtio_console.c +16 -6
@@ -1532,19 +1532,29 @@ static void remove_port_data(struct port *port)spin_lock_irq (&port->inbuf_lock);/* Remove unused data this port might have received. */ discard_port_data (port); +spin_unlock_irq (&port->inbuf_lock);/* Remove buffers we queued up for the Host to send us data in. */ -while ((buf =virtqueue_detach_unused_buf (port->in_vq))) -free_buf (buf, true); -spin_unlock_irq (&port->inbuf_lock); +do { +spin_lock_irq (&port->inbuf_lock); + buf =virtqueue_detach_unused_buf (port->in_vq); +spin_unlock_irq (&port->inbuf_lock); +if (buf) +free_buf (buf, true); + }while (buf);spin_lock_irq (&port->outvq_lock);reclaim_consumed_buffers (port); +spin_unlock_irq (&port->outvq_lock);/* Free pending buffers from the out-queue. */ -while ((buf =virtqueue_detach_unused_buf (port->out_vq))) -free_buf (buf, true); -spin_unlock_irq (&port->outvq_lock); +do { +spin_lock_irq (&port->outvq_lock); + buf =virtqueue_detach_unused_buf (port->out_vq); +spin_unlock_irq (&port->outvq_lock); +if (buf) +free_buf (buf, true); + }while (buf); }/*
drivers/clk/clk-divider.c +1 -1
@@ -263,7 +263,7 @@ static int clk_divider_bestdiv(struct clk_hw *hw, unsigned long rate,/* if read only, just return current value */ if (divider->flags &CLK_DIVIDER_READ_ONLY ) { - bestdiv =readl (divider->reg) >> divider->shift; + bestdiv =clk_readl (divider->reg) >> divider->shift; bestdiv &=div_mask (divider); bestdiv =_get_div (divider, bestdiv);return bestdiv;
drivers/firewire/net.c +4 -4
@@ -73,13 +73,13 @@ struct rfc2734_header {#define fwnet_get_hdr_lf (h) (((h)->w0 & 0xc0000000) >> 30)#define fwnet_get_hdr_ether_type (h) (((h)->w0 & 0x0000ffff)) -#define fwnet_get_hdr_dg_size (h) (((h)->w0 & 0x0fff0000) >> 16) +#define fwnet_get_hdr_dg_size (h) ((((h)->w0 & 0x0fff0000) >> 16) + 1)#define fwnet_get_hdr_fg_off (h) (((h)->w0 & 0x00000fff))#define fwnet_get_hdr_dgl (h) (((h)->w1 & 0xffff0000) >> 16) -#define fwnet_set_hdr_lf (lf) ((lf) << 30) +#define fwnet_set_hdr_lf (lf) ((lf) << 30)#define fwnet_set_hdr_ether_type (et) (et) -#define fwnet_set_hdr_dg_size (dgs) ((dgs) << 16) +#define fwnet_set_hdr_dg_size (dgs) (((dgs) - 1) << 16)#define fwnet_set_hdr_fg_off (fgo) (fgo)#define fwnet_set_hdr_dgl (dgl) ((dgl) << 16)
@@ -635,7 +635,7 @@ static int fwnet_incoming_packet(struct fwnet_device *dev, __be32 *buf, int len, fg_off =fwnet_get_hdr_fg_off (&hdr); } datagram_label =fwnet_get_hdr_dgl (&hdr); - dg_size =fwnet_get_hdr_dg_size (&hdr);/* ??? + 1 */ + dg_size =fwnet_get_hdr_dg_size (&hdr);if (fg_off + len > dg_size)return 0 ;
drivers/gpio/gpio-mvebu.c +47 -47
174 lines not on this page · raw message
drivers/gpu/drm/i915/intel_crt.c +5 -5
@@ -742,11 +742,11 @@ static int intel_crt_set_property(struct drm_connector *connector,return 0 ; } -static void intel_crt_reset (struct drm_connector *connector) +void intel_crt_reset (struct drm_encoder *encoder) { -struct drm_device *dev = connector->dev; +struct drm_device *dev = encoder->dev;struct drm_i915_private *dev_priv = dev->dev_private; -struct intel_crt *crt =intel_attached_crt (connector); +struct intel_crt *crt =intel_encoder_to_crt (to_intel_encoder (encoder));if (INTEL_INFO (dev)->gen >=5 ) {u32 adpa;
@@ -768,7 +768,6 @@ static void intel_crt_reset(struct drm_connector *connector)*/ static const struct drm_connector_funcs intel_crt_connector_funcs = { - .reset = intel_crt_reset, .dpms = intel_crt_dpms, .detect = intel_crt_detect, .fill_modes = drm_helper_probe_single_connector_modes,
@@ -783,6 +782,7 @@ static const struct drm_connector_helper_funcs intel_crt_connector_helper_funcs };static const struct drm_encoder_funcs intel_crt_enc_funcs = { + .reset = intel_crt_reset, .destroy = intel_encoder_destroy, };
@@ -902,5 +902,5 @@ void intel_crt_init(struct drm_device *dev) dev_priv->fdi_rx_config =I915_READ (_FDI_RXA_CTL) & fdi_config; } -intel_crt_reset (connector); +intel_crt_reset (&crt->base.base); }
drivers/gpu/drm/i915/intel_drv.h +1 -1
@@ -690,7 +690,7 @@ void i9xx_check_fifo_underruns(struct drm_device *dev);/* intel_crt.c */ void intel_crt_init (struct drm_device *dev); - +void intel_crt_reset (struct drm_encoder *encoder);/* intel_ddi.c */ void intel_prepare_ddi (struct drm_device *dev);
drivers/gpu/drm/i915/intel_pm.c +9 -0
@@ -5897,6 +5897,8 @@ static bool vlv_power_well_enabled(struct drm_i915_private *dev_priv,static void vlv_display_power_well_enable (struct drm_i915_private *dev_priv,struct i915_power_well *power_well) { +struct intel_encoder *encoder; +WARN_ON_ONCE (power_well->data !=PUNIT_POWER_WELL_DISP2D );vlv_set_power_well (dev_priv, power_well, true);
@@ -5914,6 +5916,13 @@ static void vlv_display_power_well_enable(struct drm_i915_private *dev_priv,intel_hpd_init (dev_priv->dev); +/* Re-enable the ADPA, if we have one */ +list_for_each_entry (encoder, &dev_priv->dev->mode_config.encoder_list, + base.head) { +if (encoder->type ==INTEL_OUTPUT_ANALOG ) +intel_crt_reset (&encoder->base); + } +i915_redisable_vga_power_on (dev_priv->dev); }
drivers/gpu/drm/radeon/ni.c +1 -3
@@ -1333,9 +1333,7 @@ static void cayman_pcie_gart_fini(struct radeon_device *rdev)void cayman_cp_int_cntl_setup (struct radeon_device *rdev,int ring,u32 cp_int_cntl) { -u32 srbm_gfx_cntl =RREG32 (SRBM_GFX_CNTL ) & ~3 ; - -WREG32 (SRBM_GFX_CNTL , srbm_gfx_cntl | (ring &3 )); +WREG32 (SRBM_GFX_CNTL ,RINGID (ring));WREG32 (CP_INT_CNTL , cp_int_cntl); }
drivers/gpu/drm/radeon/r600_dpm.c +8 -7
@@ -155,19 +155,20 @@ u32 r600_dpm_get_vblank_time(struct radeon_device *rdev)struct drm_device *dev = rdev->ddev;struct drm_crtc *crtc;struct radeon_crtc *radeon_crtc; -u32 line_time_us, vblank_lines; +u32 vblank_in_pixels;u32 vblank_time_us =0xffffffff ;/* if the displays are off, vblank time is max */ if (rdev->num_crtc && rdev->mode_info.mode_config_initialized) {list_for_each_entry (crtc, &dev->mode_config.crtc_list, head) { radeon_crtc =to_radeon_crtc (crtc);if (crtc->enabled && radeon_crtc->enabled && radeon_crtc->hw_mode.clock) { - line_time_us = (radeon_crtc->hw_mode.crtc_htotal *1000 ) / - radeon_crtc->hw_mode.clock; - vblank_lines = radeon_crtc->hw_mode.crtc_vblank_end - - radeon_crtc->hw_mode.crtc_vdisplay + - (radeon_crtc->v_border *2 ); - vblank_time_us = vblank_lines * line_time_us; + vblank_in_pixels = + radeon_crtc->hw_mode.crtc_htotal * + (radeon_crtc->hw_mode.crtc_vblank_end - + radeon_crtc->hw_mode.crtc_vdisplay + + (radeon_crtc->v_border *2 )); + + vblank_time_us = vblank_in_pixels *1000 / radeon_crtc->hw_mode.clock;break ; } }
drivers/gpu/drm/radeon/radeon_device.c +3 -2
@@ -629,8 +629,9 @@ bool radeon_card_posted(struct radeon_device *rdev) {uint32_t reg; -/* for pass through, always force asic_init */ -if (radeon_device_is_virtual ()) +/* for pass through, always force asic_init for CI */ +if (rdev->family >=CHIP_BONAIRE && +radeon_device_is_virtual ())return false;/* required for EFI mode on macbook2,1 which uses an r5xx asic */
drivers/gpu/drm/radeon/si_dpm.c +44 -11
73 lines not on this page · raw message
drivers/gpu/drm/radeon/sislands_smc.h +1 -0
@@ -194,6 +194,7 @@ typedef struct SISLANDS_SMC_SWSTATE SISLANDS_SMC_SWSTATE;#define SISLANDS_SMC_VOLTAGEMASK_VDDC 0#define SISLANDS_SMC_VOLTAGEMASK_MVDD 1#define SISLANDS_SMC_VOLTAGEMASK_VDDCI 2 +#define SISLANDS_SMC_VOLTAGEMASK_VDDC_PHASE_SHEDDING 3#define SISLANDS_SMC_VOLTAGEMASK_MAX 4struct SISLANDS_SMC_VOLTAGEMASKTABLE
drivers/hid/hid-core.c +3 -0
@@ -1208,6 +1208,7 @@ static void hid_input_field(struct hid_device *hid, struct hid_field *field,/* Ignore report if ErrorRollOver */ if (!(field->flags &HID_MAIN_ITEM_VARIABLE ) && value[n] >= min && value[n] <= max && + value[n] - min < field->maxusage && field->usage[value[n] - min].hid ==HID_UP_KEYBOARD +1 ) goto exit; }
@@ -1220,11 +1221,13 @@ static void hid_input_field(struct hid_device *hid, struct hid_field *field, }if (field->value[n] >= min && field->value[n] <= max + && field->value[n] - min < field->maxusage && field->usage[field->value[n] - min].hid &&search (value, field->value[n], count))hid_process_event (hid, field, &field->usage[field->value[n] - min],0 , interrupt);if (value[n] >= min && value[n] <= max + && value[n] - min < field->maxusage && field->usage[value[n] - min].hid &&search (field->value, value[n], count))hid_process_event (hid, field, &field->usage[value[n] - min],1 , interrupt);
drivers/hid/hid-ids.h +2 -0
@@ -164,6 +164,8 @@#define USB_DEVICE_ID_ATEN_2PORTKVM 0x2204#define USB_DEVICE_ID_ATEN_4PORTKVM 0x2205#define USB_DEVICE_ID_ATEN_4PORTKVMC 0x2208 +#define USB_DEVICE_ID_ATEN_CS682 0x2213 +#define USB_DEVICE_ID_ATEN_CS692 0x8021#define USB_VENDOR_ID_ATMEL 0x03eb#define USB_DEVICE_ID_ATMEL_MULTITOUCH 0x211c
drivers/hid/usbhid/hid-quirks.c +2 -0
@@ -61,6 +61,8 @@ static const struct hid_blacklist { { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_2PORTKVM, HID_QUIRK_NOGET }, { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVM, HID_QUIRK_NOGET }, { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_4PORTKVMC, HID_QUIRK_NOGET }, + { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS682, HID_QUIRK_NOGET }, + { USB_VENDOR_ID_ATEN, USB_DEVICE_ID_ATEN_CS692, HID_QUIRK_NOGET }, { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FIGHTERSTICK, HID_QUIRK_NOGET }, { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_COMBATSTICK, HID_QUIRK_NOGET }, { USB_VENDOR_ID_CH, USB_DEVICE_ID_CH_FLIGHT_SIM_ECLIPSE_YOKE, HID_QUIRK_NOGET },
drivers/hv/hv_util.c +7 -3
@@ -283,10 +283,14 @@ static void heartbeat_onchannelcallback(void *context)u8 *hbeat_txf_buf = util_heartbeat.recv_buffer;struct icmsg_negotiate *negop =NULL ; -vmbus_recvpacket (channel, hbeat_txf_buf, -PAGE_SIZE , &recvlen, &requestid); +while (1 ) { + +vmbus_recvpacket (channel, hbeat_txf_buf, +PAGE_SIZE , &recvlen, &requestid); + +if (!recvlen) +break ; -if (recvlen >0 ) { icmsghdrp = (struct icmsg_hdr *)&hbeat_txf_buf[sizeof (struct vmbuspipe_hdr )];
drivers/i2c/i2c-core.c +1 -1
@@ -1558,6 +1558,7 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)/* add the driver to the list of i2c drivers in the driver core */ driver->driver.owner = owner; driver->driver.bus = &i2c_bus_type; +INIT_LIST_HEAD (&driver->clients);/* When registration returns, the driver core * will have called probe() for all matching-but-unbound devices.
@@ -1576,7 +1577,6 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)pr_debug ("i2c-core: driver [%s] registered\n" , driver->driver.name); -INIT_LIST_HEAD (&driver->clients);/* Walk the adapters that are already present */ i2c_for_each_dev (driver, __process_new_driver);
drivers/iio/common/hid-sensors/hid-sensor-attributes.c +30 -30
128 lines not on this page · raw message
drivers/infiniband/core/cm.c +109 -16
268 lines not on this page · raw message
drivers/infiniband/core/umem.c +1 -1
@@ -156,7 +156,7 @@ struct ib_umem *ib_umem_get(struct ib_ucontext *context, unsigned long addr, cur_base = addr &PAGE_MASK ; -if (npages ==0 ) { +if (npages ==0 || npages >UINT_MAX ) { ret = -EINVAL ; goto out; }
drivers/infiniband/core/uverbs_main.c +2 -5
@@ -240,12 +240,9 @@ static int ib_uverbs_cleanup_ucontext(struct ib_uverbs_file *file, container_of(uobj, struct ib_uqp_object, uevent.uobject);idr_remove_uobj (&ib_uverbs_qp_idr, uobj); -if (qp != qp->real_qp) { -ib_close_qp (qp); - }else { +if (qp == qp->real_qp)ib_uverbs_detach_umcast (qp, uqp); -ib_destroy_qp (qp); - } +ib_destroy_qp (qp);ib_uverbs_release_uevent (file, &uqp->uevent);kfree (uqp); }
drivers/infiniband/hw/mlx4/cq.c +4 -1
@@ -239,11 +239,14 @@ struct ib_cq *mlx4_ib_create_cq(struct ib_device *ibdev, int entries, int vectorif (context)if (ib_copy_to_udata (udata, &cq->mcq.cqn,sizeof (__u32))) { err = -EFAULT ; - goto err_dbmap; + goto err_cq_free; }return &cq->ibcq; +err_cq_free: +mlx4_cq_free (dev->dev, &cq->mcq); + err_dbmap:if (context)mlx4_ib_db_unmap_user (to_mucontext (context), &cq->db);
drivers/infiniband/hw/mlx5/cq.c +1 -2
@@ -771,8 +771,7 @@ struct ib_cq *mlx5_ib_create_cq(struct ib_device *ibdev, int entries,if (err) goto err_create; }else { -/* for now choose 64 bytes till we have a proper interface */ - cqe_size =64 ; + cqe_size =cache_line_size () ==128 ?128 :64 ; err =create_cq_kernel (dev, cq, entries, cqe_size, &cqb, &index, &inlen);if (err)
drivers/infiniband/hw/mlx5/mlx5_ib.h +2 -0
@@ -376,6 +376,8 @@ struct mlx5_ib_dev {struct mlx5_ib_resources devr;struct mlx5_mr_cache cache;struct timer_list delay_timer; +/* Prevents soft lock on massive reg MRs */ +struct mutex slow_path_mutex;int fill_delay; };
drivers/infiniband/hw/mlx5/mr.c +5 -1
@@ -554,6 +554,7 @@ int mlx5_mr_cache_init(struct mlx5_ib_dev *dev)int err;int i; +mutex_init (&dev->slow_path_mutex); cache->wq =create_singlethread_workqueue ("mkey_cache" );if (!cache->wq) {mlx5_ib_warn (dev,"failed to create work queue\n" );
@@ -909,9 +910,12 @@ struct ib_mr *mlx5_ib_reg_user_mr(struct ib_pd *pd, u64 start, u64 length, } } -if (!mr) +if (!mr) { +mutex_lock (&dev->slow_path_mutex); mr =reg_create (pd, virt_addr, length, umem, ncont, page_shift, access_flags); +mutex_unlock (&dev->slow_path_mutex); + }if (IS_ERR (mr)) { err =PTR_ERR (mr);
drivers/infiniband/hw/mlx5/qp.c +3 -2
@@ -1205,8 +1205,9 @@ struct ib_qp *mlx5_ib_create_qp(struct ib_pd *pd, qp->ibqp.qp_num = qp->mqp.qpn;mlx5_ib_dbg (dev,"ib qpnum 0x%x, mlx qpn 0x%x, rcqn 0x%x, scqn 0x%x\n" , - qp->ibqp.qp_num, qp->mqp.qpn,to_mcq (init_attr->recv_cq)->mcq.cqn, -to_mcq (init_attr->send_cq)->mcq.cqn); + qp->ibqp.qp_num, qp->mqp.qpn, + init_attr->recv_cq ?to_mcq (init_attr->recv_cq)->mcq.cqn :-1 , + init_attr->send_cq ?to_mcq (init_attr->send_cq)->mcq.cqn :-1 ); qp->xrcdn = xrcdn;
drivers/infiniband/ulp/srp/ib_srp.c +5 -3
@@ -1310,7 +1310,9 @@ static int srp_map_sg_entry(struct srp_map_state *state,while (dma_len) {unsigned offset = dma_addr & ~dev->mr_page_mask; -if (state->npages == dev->max_pages_per_mr || offset !=0 ) { + +if (state->npages == dev->max_pages_per_mr || + (state->npages >0 && offset !=0 )) { ret =srp_finish_mapping (state, target);if (ret)return ret;
@@ -1329,12 +1331,12 @@ static int srp_map_sg_entry(struct srp_map_state *state, }/* -* If the last entry of the MR wasn't a full page, then we need to +* If the end of the MR is not on a page boundary then we need to * close it out and start a new one -- we can only merge at page * boundries. */ ret =0 ; -if (len != dev->mr_page_size) { +if ((dma_addr & ~dev->mr_page_mask) !=0 ) { ret =srp_finish_mapping (state, target);if (!ret)srp_map_update_start (state,NULL ,0 ,0 );
drivers/input/mouse/elantech.c +9 -2
@@ -1389,6 +1389,13 @@ static const struct dmi_system_id elantech_dmi_force_crc_enabled[] = { }, }, { +/* Fujitsu LIFEBOOK E544 does not work with crc_enabled == 0 */ + .matches = { +DMI_MATCH (DMI_SYS_VENDOR ,"FUJITSU" ), + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E544"), + }, + }, + {/* Fujitsu LIFEBOOK E554 does not work with crc_enabled == 0 */ .matches = { DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU"),
@@ -1396,10 +1403,10 @@ static const struct dmi_system_id elantech_dmi_force_crc_enabled[] = { }, }, { -/* Fujitsu LIFEBOOK E544 does not work with crc_enabled == 0 */ +/* Fujitsu LIFEBOOK E556 does not work with crc_enabled == 0 */ .matches = {DMI_MATCH (DMI_SYS_VENDOR ,"FUJITSU" ), - DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E544"), + DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E556"), }, }, {
drivers/input/serio/i8042-x86ia64io.h +7 -0
@@ -776,6 +776,13 @@ static const struct dmi_system_id __initconst i8042_dmi_kbdreset_table[] = { DMI_MATCH(DMI_PRODUCT_NAME, "P34"), }, }, + { + /* Schenker XMG C504 - Elantech touchpad */ + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "XMG"), + DMI_MATCH(DMI_PRODUCT_NAME, "C504"), + }, + }, { } };
drivers/iommu/amd_iommu.c +3 -0
@@ -2037,6 +2037,9 @@ static void dma_ops_domain_free(struct dma_ops_domain *dom)kfree (dom->aperture[i]); } +if (dom->domain.id) +domain_id_free (dom->domain.id); +kfree (dom); }
drivers/iommu/dmar.c +3 -1
@@ -299,7 +299,9 @@ static int dmar_pci_bus_notifier(struct notifier_block *nb,struct pci_dev *pdev =to_pci_dev (data);struct dmar_pci_notify_info *info; -/* Only care about add/remove events for physical functions */ +/* Only care about add/remove events for physical functions. +* For VFs we actually do the lookup based on the corresponding +* PF in device_to_iommu() anyway. */ if (pdev->is_virtfn)return NOTIFY_DONE ;if (action !=BUS_NOTIFY_ADD_DEVICE && action !=BUS_NOTIFY_DEL_DEVICE )
drivers/iommu/intel-iommu.c +13 -0
@@ -684,7 +684,13 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devfreturn NULL ;if (dev_is_pci (dev)) { +struct pci_dev *pf_pdev; + pdev =to_pci_dev (dev); +/* VFs aren't listed in scope tables; we need to look up +* the PF instead to find the IOMMU. */ + pf_pdev =pci_physfn (pdev); + dev = &pf_pdev->dev; segment =pci_domain_nr (pdev->bus); }else if (ACPI_COMPANION (dev)) dev = &ACPI_COMPANION (dev)->dev;
@@ -697,6 +703,13 @@ static struct intel_iommu *device_to_iommu(struct device *dev, u8 *bus, u8 *devffor_each_active_dev_scope (drhd->devices, drhd->devices_cnt, i, tmp) {if (tmp == dev) { +/* For a VF use its original BDF# not that of the PF +* which we used for the IOMMU lookup. Strictly speaking +* we could do this for all PCI devices; we only need to +* get the BDF# from the scope table for ACPI matches. */ +if (pdev->is_virtfn) + goto got_pdev; + *bus = drhd->devices[i].bus; *devfn = drhd->devices[i].devfn; goto out;
drivers/isdn/gigaset/ser-gigaset.c +3 -1
@@ -791,8 +791,10 @@ static int __init ser_gigaset_init(void) driver =gigaset_initdriver (GIGASET_MINOR ,GIGASET_MINORS ,GIGASET_MODULENAME ,GIGASET_DEVNAME , &ops,THIS_MODULE ); -if (!driver) +if (!driver) { + rc = -ENOMEM ; goto error; + } rc =tty_register_ldisc (N_GIGASET_M101 , &gigaset_ldisc);if (rc !=0 ) {
drivers/md/dm-mpath.c +3 -3
@@ -1196,10 +1196,10 @@ static void activate_path(struct work_struct *work) {struct pgpath *pgpath = container_of(work, struct pgpath, activate_path.work); +struct request_queue *q =bdev_get_queue (pgpath->path.dev->bdev); -if (pgpath->is_active) -scsi_dh_activate (bdev_get_queue (pgpath->path.dev->bdev), - pg_init_done, pgpath); +if (pgpath->is_active && !blk_queue_dying (q)) +scsi_dh_activate (q, pg_init_done, pgpath);else pg_init_done (pgpath,SCSI_DH_DEV_OFFLINED ); }
drivers/md/dm-table.c +9 -15
@@ -725,37 +725,32 @@ int dm_table_add_target(struct dm_table *t, const char *type, tgt->type =dm_get_target_type (type);if (!tgt->type) { -DMERR ("%s: %s: unknown target type" ,dm_device_name (t->md), - type); +DMERR ("%s: %s: unknown target type" ,dm_device_name (t->md), type);return -EINVAL ; }if (dm_target_needs_singleton (tgt->type)) {if (t->num_targets) { -DMERR ("%s: target type %s must appear alone in table" , -dm_device_name (t->md), type); -return -EINVAL ; + tgt->error ="singleton target type must appear alone in table" ; + goto bad; } t->singleton =1 ; }if (dm_target_always_writeable (tgt->type) && !(t->mode &FMODE_WRITE )) { -DMERR ("%s: target type %s may not be included in read-only tables" , -dm_device_name (t->md), type); -return -EINVAL ; + tgt->error ="target type may not be included in a read-only table" ; + goto bad; }if (t->immutable_target_type) {if (t->immutable_target_type != tgt->type) { -DMERR ("%s: immutable target type %s cannot be mixed with other target types" , -dm_device_name (t->md), t->immutable_target_type->name); -return -EINVAL ; + tgt->error ="immutable target type cannot be mixed with other target types" ; + goto bad; } }else if (dm_target_is_immutable (tgt->type)) {if (t->num_targets) { -DMERR ("%s: immutable target type %s cannot be mixed with other target types" , -dm_device_name (t->md), tgt->type->name); -return -EINVAL ; + tgt->error ="immutable target type cannot be mixed with other target types" ; + goto bad; } t->immutable_target_type = tgt->type; }
@@ -770,7 +765,6 @@ int dm_table_add_target(struct dm_table *t, const char *type,*/ if (!adjoin (t, tgt)) { tgt->error ="Gap in table" ; - r = -EINVAL ; goto bad; }
drivers/md/dm.c +5 -0
@@ -2407,6 +2407,7 @@ EXPORT_SYMBOL_GPL(dm_device_name);static void __dm_destroy (struct mapped_device *md,bool wait) { +struct request_queue *q = md->queue;struct dm_table *map;int srcu_idx;
@@ -2417,6 +2418,10 @@ static void __dm_destroy(struct mapped_device *md, bool wait)set_bit (DMF_FREEING , &md->flags);spin_unlock (&_minor_lock); +spin_lock_irq (q->queue_lock); +queue_flag_set (QUEUE_FLAG_DYING , q); +spin_unlock_irq (q->queue_lock); +/* * Take suspend_lock so that presuspend and postsuspend methods * do not race with internal suspend.
drivers/md/md.c +1 -1
@@ -7682,7 +7682,7 @@ void md_do_sync(struct md_thread *thread) mddev->pers->sync_request (mddev, max_sectors, &skipped,1 );if (!test_bit (MD_RECOVERY_CHECK , &mddev->recovery) && - mddev->curr_resync >2 ) { + mddev->curr_resync >3 ) {if (test_bit (MD_RECOVERY_SYNC , &mddev->recovery)) {if (test_bit (MD_RECOVERY_INTR , &mddev->recovery)) {if (mddev->curr_resync >= mddev->recovery_cp) {
drivers/media/dvb-frontends/mb86a20s.c +53 -51
156 lines not on this page · raw message
drivers/media/tuners/tuner-xc2028.c +16 -21
@@ -281,6 +281,14 @@ static void free_firmware(struct xc2028_data *priv)int i;tuner_dbg ("%s called\n" , __func__); +/* free allocated f/w string */ +if (priv->fname != firmware_name) +kfree (priv->fname); + priv->fname =NULL ; + + priv->state =XC2028_NO_FIRMWARE ; +memset (&priv->cur_fw,0 ,sizeof (priv->cur_fw)); +if (!priv->firm)return ;
@@ -291,9 +299,6 @@ static void free_firmware(struct xc2028_data *priv) priv->firm =NULL ; priv->firm_size =0 ; - priv->state =XC2028_NO_FIRMWARE ; - -memset (&priv->cur_fw,0 ,sizeof (priv->cur_fw)); } static int load_all_firmwares(struct dvb_frontend *fe,
@@ -884,9 +889,8 @@ read_not_reliable:return 0 ; fail: - priv->state =XC2028_NO_FIRMWARE ; +free_firmware (priv); -memset (&priv->cur_fw,0 ,sizeof (priv->cur_fw));if (retry_count <8 ) {msleep (50 ); retry_count++;
@@ -1332,11 +1336,8 @@ static int xc2028_dvb_release(struct dvb_frontend *fe)mutex_lock (&xc2028_list_mutex);/* only perform final cleanup if this is the last instance */ -if (hybrid_tuner_report_instance_count (priv) ==1 ) { +if (hybrid_tuner_report_instance_count (priv) ==1 )free_firmware (priv); -kfree (priv->ctrl.fname); - priv->ctrl.fname =NULL ; - }if (priv)hybrid_tuner_release_state (priv);
@@ -1399,19 +1400,8 @@ static int xc2028_set_config(struct dvb_frontend *fe, void *priv_cfg)/* * Copy the config data. -* For the firmware name, keep a local copy of the string, -* in order to avoid troubles during device release. */ -kfree (priv->ctrl.fname); - priv->ctrl.fname =NULL ;memcpy (&priv->ctrl, p,sizeof (priv->ctrl)); -if (p->fname) { - priv->ctrl.fname =kstrdup (p->fname,GFP_KERNEL ); -if (priv->ctrl.fname ==NULL ) { - rc = -ENOMEM ; - goto unlock; - } - }/* * If firmware name changed, frees firmware. As free_firmware will
@@ -1426,10 +1416,15 @@ static int xc2028_set_config(struct dvb_frontend *fe, void *priv_cfg)if (priv->state ==XC2028_NO_FIRMWARE ) {if (!firmware_name[0 ]) - priv->fname = priv->ctrl.fname; + priv->fname =kstrdup (p->fname,GFP_KERNEL );else priv->fname = firmware_name; +if (!priv->fname) { + rc = -ENOMEM ; + goto unlock; + } + rc = request_firmware_nowait(THIS_MODULE, 1, priv->fname, priv->i2c_props.adap->dev.parent,
drivers/media/usb/cx231xx/cx231xx-avcore.c +4 -1
@@ -1260,7 +1260,10 @@ int cx231xx_set_agc_analog_digital_mux_select(struct cx231xx *dev, dev->board.agc_analog_digital_select_gpio, analog_or_digital); -return status; +if (status <0 ) +return status; + +return 0 ; }int cx231xx_enable_i2c_port_3 (struct cx231xx *dev,bool is_port_3)
drivers/media/usb/cx231xx/cx231xx-cards.c +1 -1
@@ -489,7 +489,7 @@ struct cx231xx_board cx231xx_boards[] = { .output_mode = OUT_MODE_VIP11, .demod_xfer_mode = 0, .ctl_pin_status_mask = 0xFFFFFFC4, - .agc_analog_digital_select_gpio = 0x00, /* According with PV cxPolaris.inf file */ + .agc_analog_digital_select_gpio = 0x1c, .tuner_sif_gpio = -1, .tuner_scl_gpio = -1, .tuner_sda_gpio = -1,
drivers/media/usb/cx231xx/cx231xx-core.c +2 -1
@@ -723,6 +723,7 @@ int cx231xx_set_mode(struct cx231xx *dev, enum cx231xx_mode set_mode)break ;case CX231XX_BOARD_CNXT_RDE_253S :case CX231XX_BOARD_CNXT_RDU_253S : +case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID : errCode =cx231xx_set_agc_analog_digital_mux_select (dev,1 );break ;case CX231XX_BOARD_HAUPPAUGE_EXETER :
@@ -747,7 +748,7 @@ int cx231xx_set_mode(struct cx231xx *dev, enum cx231xx_mode set_mode)case CX231XX_BOARD_PV_PLAYTV_USB_HYBRID :case CX231XX_BOARD_HAUPPAUGE_USB2_FM_PAL :case CX231XX_BOARD_HAUPPAUGE_USB2_FM_NTSC : - errCode =cx231xx_set_agc_analog_digital_mux_select (dev,0 ); + errCode =cx231xx_set_agc_analog_digital_mux_select (dev,0 );break ;default :break ;
drivers/media/usb/dvb-usb/Kconfig +1 -0
@@ -34,6 +34,7 @@ config DVB_USB_DIBUSB_MB depends on DVB_USB select DVB_PLL if MEDIA_SUBDRV_AUTOSELECT select DVB_DIB3000MB + depends on DVB_DIB3000MC || !DVB_DIB3000MC select MEDIA_TUNER_MT2060 if MEDIA_SUBDRV_AUTOSELECT help Support for USB 1.1 and 2.0 DVB-T receivers based on reference designs made by
drivers/media/usb/dvb-usb/dib0700_core.c +3 -2
@@ -674,7 +674,7 @@ static void dib0700_rc_urb_completion(struct urb *purb) {struct dvb_usb_device *d = purb->context;struct dib0700_rc_response *poll_reply; -u32 uninitialized_var (keycode ); +u32 keycode;u8 toggle;deb_info ("%s()\n" , __func__);
@@ -713,7 +713,8 @@ static void dib0700_rc_urb_completion(struct urb *purb)if ((poll_reply->system ==0x00 ) && (poll_reply->data ==0x00 ) && (poll_reply->not_data ==0xff )) { poll_reply->data_state =2 ; -break ; +rc_repeat (d->rc_dev); + goto resubmit; }if ((poll_reply->system ^ poll_reply->not_system) !=0xff ) {
drivers/memstick/host/rtsx_usb_ms.c +6 -0
@@ -524,6 +524,7 @@ static void rtsx_usb_ms_handle_req(struct work_struct *work)int rc;if (!host->req) { +pm_runtime_get_sync (ms_dev (host)); do { rc = memstick_next_req(msh, &host->req); dev_dbg(ms_dev(host), "next req %d\n", rc);
@@ -544,6 +545,7 @@ static void rtsx_usb_ms_handle_req(struct work_struct *work) host->req->error); } }while (!rc); +pm_runtime_put (ms_dev (host)); } }
@@ -570,6 +572,7 @@ static int rtsx_usb_ms_set_param(struct memstick_host *msh,dev_dbg (ms_dev (host),"%s: param = %d, value = %d\n" , __func__, param, value); +pm_runtime_get_sync (ms_dev (host));mutex_lock (&ucr->dev_mutex); err =rtsx_usb_card_exclusive_check (ucr,RTSX_USB_MS_CARD );
@@ -635,6 +638,7 @@ static int rtsx_usb_ms_set_param(struct memstick_host *msh, } out:mutex_unlock (&ucr->dev_mutex); +pm_runtime_put (ms_dev (host));/* power-on delay */ if (param ==MEMSTICK_POWER && value ==MEMSTICK_POWER_ON )
@@ -681,6 +685,7 @@ static int rtsx_usb_detect_ms_card(void *__host)int err;for (;;) { +pm_runtime_get_sync (ms_dev (host));mutex_lock (&ucr->dev_mutex);/* Check pending MS card changes */
@@ -703,6 +708,7 @@ static int rtsx_usb_detect_ms_card(void *__host) } poll_again: +pm_runtime_put (ms_dev (host));if (host->eject)break ;
drivers/mfd/Kconfig +1 -0
@@ -1203,6 +1203,7 @@ config MFD_WM8350 config MFD_WM8350_I2C bool "Wolfson Microelectronics WM8350 with I2C" select MFD_WM8350 + select REGMAP_I2C depends on I2C=y help The WM8350 is an integrated audio and power management
drivers/mfd/mfd-core.c +2 -0
@@ -285,6 +285,8 @@ int mfd_clone_cell(const char *cell, const char **clones, size_t n_clones) clones[i]); } +put_device (dev); +return 0 ; }EXPORT_SYMBOL (mfd_clone_cell);
drivers/mfd/rtsx_usb.c +5 -5
@@ -46,9 +46,6 @@ static void rtsx_usb_sg_timed_out(unsigned long data)dev_dbg (&ucr->pusb_intf->dev,"%s: sg transfer timed out" , __func__);usb_sg_cancel (&ucr->current_sg); - -/* we know the cancellation is caused by time-out */ - ucr->current_sg.status = -ETIMEDOUT ; } static int rtsx_usb_bulk_transfer_sglist(struct rtsx_ucr *ucr,
@@ -67,12 +64,15 @@ static int rtsx_usb_bulk_transfer_sglist(struct rtsx_ucr *ucr, ucr->sg_timer.expires = jiffies +msecs_to_jiffies (timeout);add_timer (&ucr->sg_timer);usb_sg_wait (&ucr->current_sg); -del_timer_sync (&ucr->sg_timer); +if (!del_timer_sync (&ucr->sg_timer)) + ret = -ETIMEDOUT ; +else + ret = ucr->current_sg.status;if (act_len) *act_len = ucr->current_sg.bytes; -return ucr->current_sg.status; +return ret; } int rtsx_usb_transfer_data(struct rtsx_ucr *ucr, unsigned int pipe,
drivers/misc/genwqe/card_utils.c +11 -1
@@ -341,17 +341,27 @@ int genwqe_alloc_sync_sgl(struct genwqe_dev *cd, struct genwqe_sgl *sgl,if (copy_from_user (sgl->lpage, user_addr + user_size - sgl->lpage_size, sgl->lpage_size)) { rc = -EFAULT ; - goto err_out1; + goto err_out2; } }return 0 ; + err_out2: +__genwqe_free_consistent (cd,PAGE_SIZE , sgl->lpage, + sgl->lpage_dma_addr); + sgl->lpage =NULL ; + sgl->lpage_dma_addr =0 ; err_out1:__genwqe_free_consistent (cd,PAGE_SIZE , sgl->fpage, sgl->fpage_dma_addr); + sgl->fpage =NULL ; + sgl->fpage_dma_addr =0 ; err_out:__genwqe_free_consistent (cd, sgl->sgl_size, sgl->sgl, sgl->sgl_dma_addr); + sgl->sgl =NULL ; + sgl->sgl_dma_addr =0 ; + sgl->sgl_size =0 ;return -ENOMEM ; }
drivers/misc/mei/hw-txe.c +4 -2
@@ -876,11 +876,13 @@ static bool mei_txe_check_and_ack_intrs(struct mei_device *dev, bool do_ack) hisr =mei_txe_br_reg_read (hw,HISR_REG ); aliveness =mei_txe_aliveness_get (dev); -if (hhisr &IPC_HHIER_SEC && aliveness) +if (hhisr &IPC_HHIER_SEC && aliveness) { ipc_isr =mei_txe_sec_reg_read_silent (hw,SEC_IPC_HOST_INT_STATUS_REG ); -else + }else { ipc_isr =0 ; + hhisr &= ~IPC_HHIER_SEC ; + } generated = generated || (hisr & HISR_INT_STS_MSK) ||
drivers/misc/mei/nfc.c +1 -1
@@ -292,7 +292,7 @@ static int mei_nfc_if_version(struct mei_nfc_dev *ndev)return -ENOMEM ; bytes_recv =__mei_cl_recv (cl, (u8 *)reply, if_version_length); -if (bytes_recv <0 || bytes_recv <sizeof (struct mei_nfc_reply )) { +if (bytes_recv < if_version_length) {dev_err (&dev->pdev->dev,"Could not read IF version\n" ); ret = -EIO ; goto err;
drivers/mmc/card/block.c +3 -2
@@ -1647,7 +1647,7 @@ static void mmc_blk_packed_hdr_wrq_prep(struct mmc_queue_req *mqrq,struct mmc_blk_data *md = mq->data;struct mmc_packed *packed = mqrq->packed;bool do_rel_wr, do_data_tag; -u32 *packed_cmd_hdr; +__le32 *packed_cmd_hdr;u8 hdr_blocks;u8 i =1 ;
@@ -2170,7 +2170,8 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,set_capacity (md->disk, size);if (mmc_host_cmd23 (card->host)) { -if (mmc_card_mmc (card) || +if ((mmc_card_mmc (card) && + card->csd.mmca_vsn >=CSD_SPEC_VER_3 ) || (mmc_card_sd (card) && card->scr.cmds &SD_SCR_CMD23_SUPPORT )) md->flags |=MMC_BLK_CMD23 ;
drivers/mmc/card/queue.h +1 -1
@@ -24,7 +24,7 @@ enum mmc_packed_type {struct mmc_packed {struct list_head list; -u32 cmd_hdr[1024 ]; +__le32 cmd_hdr[1024 ];unsigned int blocks;u8 nr_entries;u8 retries;
drivers/mmc/host/moxart-mmc.c +3 -2
@@ -257,7 +257,7 @@ static void moxart_dma_complete(void *param)static void moxart_transfer_dma (struct mmc_data *data,struct moxart_host *host) {u32 len, dir_data, dir_slave; -unsigned long dma_time; +long dma_time;struct dma_async_tx_descriptor *desc =NULL ;struct dma_chan *dma_chan;
@@ -397,7 +397,8 @@ static void moxart_prepare_data(struct moxart_host *host)static void moxart_request (struct mmc_host *mmc,struct mmc_request *mrq) {struct moxart_host *host =mmc_priv (mmc); -unsigned long pio_time, flags; +long pio_time; +unsigned long flags;u32 status;spin_lock_irqsave (&host->lock, flags);
drivers/mmc/host/mxs-mmc.c +2 -2
@@ -658,13 +658,13 @@ static int mxs_mmc_probe(struct platform_device *pdev)platform_set_drvdata (pdev, mmc); +spin_lock_init (&host->lock); + ret =devm_request_irq (&pdev->dev, irq_err, mxs_mmc_irq_handler,0 ,DRIVER_NAME , host);if (ret) goto out_free_dma; -spin_lock_init (&host->lock); - ret =mmc_add_host (mmc);if (ret) goto out_free_dma;
drivers/mmc/host/rtsx_usb_sdmmc.c +2 -5
@@ -1138,11 +1138,6 @@ static void sdmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)dev_dbg (sdmmc_dev (host),"%s\n" , __func__);mutex_lock (&ucr->dev_mutex); -if (rtsx_usb_card_exclusive_check (ucr,RTSX_USB_SD_CARD )) { -mutex_unlock (&ucr->dev_mutex); -return ; - } -sd_set_power_mode (host, ios->power_mode);sd_set_bus_width (host, ios->bus_width);sd_set_timing (host, ios->timing, &host->ddr_mode);
@@ -1314,6 +1309,7 @@ static void rtsx_usb_update_led(struct work_struct *work) container_of(work, struct rtsx_usb_sdmmc, led_work);struct rtsx_ucr *ucr = host->ucr; +pm_runtime_get_sync (sdmmc_dev (host));mutex_lock (&ucr->dev_mutex);if (host->led.brightness ==LED_OFF )
@@ -1322,6 +1318,7 @@ static void rtsx_usb_update_led(struct work_struct *work)rtsx_usb_turn_on_led (ucr);mutex_unlock (&ucr->dev_mutex); + pm_runtime_put(sdmmc_dev(host)); }#endif
drivers/mmc/host/sdhci.c +1 -1
@@ -669,7 +669,7 @@ static u8 sdhci_calc_timeout(struct sdhci_host *host, struct mmc_command *cmd)* host->clock is in Hz. target_timeout is in us. * Hence, us = 1000000 * cycles / Hz. Round up. */ - val =1000000 * data->timeout_clks; + val =1000000ULL * data->timeout_clks;if (do_div (val, host->clock)) target_timeout++; target_timeout += val;
drivers/mtd/ubi/eba.c +2 -2
@@ -1021,6 +1021,8 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to,struct ubi_volume *vol;uint32_t crc; +ubi_assert (rwsem_is_locked (&ubi->fm_sem)); + vol_id =be32_to_cpu (vid_hdr->vol_id); lnum =be32_to_cpu (vid_hdr->lnum);
@@ -1189,9 +1191,7 @@ int ubi_eba_copy_leb(struct ubi_device *ubi, int from, int to, }ubi_assert (vol->eba_tbl[lnum] == from); -down_read (&ubi->fm_sem); vol->eba_tbl[lnum] = to; -up_read (&ubi->fm_sem); out_unlock_buf:mutex_unlock (&ubi->buf_mutex);
drivers/mtd/ubi/fastmap.c +15 -7
@@ -258,6 +258,7 @@ static int update_vol(struct ubi_device *ubi, struct ubi_attach_info *ai, aeb->pnum = new_aeb->pnum; aeb->copy_flag = new_vh->copy_flag; aeb->scrub = new_aeb->scrub; + aeb->sqnum = new_aeb->sqnum;kmem_cache_free (ai->aeb_slab_cache, new_aeb);/* new_aeb is older */
@@ -445,10 +446,11 @@ static int scan_pool(struct ubi_device *ubi, struct ubi_attach_info *ai,unsigned long long ec =be64_to_cpu (ech->ec);unmap_peb (ai, pnum);dbg_bld ("Adding PEB to free: %i" , pnum); +if (err ==UBI_IO_FF_BITFLIPS ) -add_aeb (ai, free, pnum, ec,1 ); -else -add_aeb (ai, free, pnum, ec,0 ); + scrub =1 ; + +add_aeb (ai, free, pnum, ec, scrub);continue ; }else if (err ==0 || err ==UBI_IO_BITFLIPS ) {dbg_bld ("Found non empty PEB:%i in pool" , pnum);
@@ -1412,22 +1414,30 @@ int ubi_update_fastmap(struct ubi_device *ubi)struct ubi_wl_entry *tmp_e;mutex_lock (&ubi->fm_mutex); +down_write (&ubi->work_sem); +down_write (&ubi->fm_sem);ubi_refill_pools (ubi);if (ubi->ro_mode || ubi->fm_disabled) { +up_write (&ubi->fm_sem); +up_write (&ubi->work_sem);mutex_unlock (&ubi->fm_mutex);return 0 ; } ret =ubi_ensure_anchor_pebs (ubi);if (ret) { +up_write (&ubi->fm_sem);
Lines of this file are not shown. View the raw message.
drivers/mtd/ubi/wl.c +36 -9
45 lines not on this page · raw message
drivers/net/can/usb/peak_usb/pcan_usb_core.c +4 -2
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/broadcom/bcmsysport.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/broadcom/genet/bcmgenet.c +7 -4
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/cirrus/ep93xx_eth.c +4 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/intel/i40e/i40e_main.c +6 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx4/cmd.c +17 -6
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx4/en_clock.c +4 -1
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx4/en_netdev.c +7 -0
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx4/en_port.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx4/en_rx.c +1 -1
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx4/mcg.c +6 -1
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx4/mlx4.h +4 -3
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx4/port.c +1 -12
Lines of this file are not shown. View the raw message.
drivers/net/ethernet/mellanox/mlx5/core/pagealloc.c +18 -8
Lines of this file are not shown. View the raw message.
drivers/net/wireless/mwifiex/cfg80211.c +7 -6
Lines of this file are not shown. View the raw message.
drivers/net/wireless/rtlwifi/regd.c +41 -4
45 lines not on this page · raw message
drivers/s390/scsi/zfcp_dbf.c +144 -18
162 lines not on this page · raw message
drivers/scsi/megaraid/megaraid_sas_base.c +5 -8
Lines of this file are not shown. View the raw message.
drivers/staging/android/ion/ion.c +42 -13
55 lines not on this page · raw message
drivers/staging/iio/impedance-analyzer/ad5933.c +10 -7
Lines of this file are not shown. View the raw message.
drivers/staging/rtl8188eu/os_dep/usb_intf.c +3 -1
Lines of this file are not shown. View the raw message.
drivers/target/target_core_transport.c +11 -0
Lines of this file are not shown. View the raw message.
fs/cifs/file.c +39 -27
66 lines not on this page · raw message
fs/fuse/dir.c +55 -7
62 lines not on this page · raw message
fs/pstore/ram_core.c +5 -44
49 lines not on this page · raw message
fs/xfs/xfs_iops.c +62 -34
96 lines not on this page · raw message
ipc/sem.c +97 -68
165 lines not on this page · raw message
ipc/shm.c +22 -20
42 lines not on this page · raw message
kernel/events/core.c +265 -57
322 lines not on this page · raw message
kernel/locking/rtmutex.c +66 -2
68 lines not on this page · raw message
kernel/panic.c +41 -7
48 lines not on this page · raw message
net/ipv4/igmp.c +35 -14
49 lines not on this page · raw message
net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +1 -1
Lines of this file are not shown. View the raw message.
net/sunrpc/xprtrdma/svc_rdma_transport.c +13 -7
Lines of this file are not shown. View the raw message.
net/wireless/scan.c +69 -0
69 lines not on this page · raw message
scripts/gcc-x86_64-has-stack-protector.sh +1 -1
Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.