3.0.21-stable review
Subsystems (55)
Greg KH
maintainercover 3.0.21-stable review
#include <stable/formletter.h>
#define RELEASE 3.0.21-rc1 #define NUM_PATCHES 55 #define RESPONSE_DATE "Mon Feb 13 22:00:00 UTC 2012" #define LOCATION kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.0.21-rc1.gz
diffstat below.
greg k-h
Makefile | 4 +- arch/arm/kernel/ptrace.c | 8 +- arch/arm/kernel/signal.c | 5 +- arch/arm/mach-omap2/gpmc.c | 6 + drivers/cpufreq/powernow-k8.c | 30 ++++-- drivers/dma/at_hdmac.c | 4 +- drivers/dma/at_hdmac_regs.h | 17 ++-- drivers/firewire/ohci.c | 6 +- drivers/gpu/drm/i915/i915_drv.h | 2 + drivers/gpu/drm/i915/i915_irq.c | 13 ++- drivers/gpu/drm/i915/i915_suspend.c | 4 + drivers/gpu/drm/i915/intel_dp.c | 1 + drivers/gpu/drm/i915/intel_hdmi.c | 8 +- drivers/gpu/drm/i915/intel_tv.c | 16 ++-- drivers/gpu/drm/nouveau/nouveau_gem.c | 23 ++++- drivers/gpu/drm/radeon/atombios_crtc.c | 4 +- drivers/gpu/drm/radeon/radeon_device.c | 4 + drivers/hwmon/w83627ehf.c | 26 ++++- drivers/infiniband/core/addr.c | 16 ++- drivers/infiniband/hw/cxgb3/iwch_cm.c | 16 ++- drivers/infiniband/hw/cxgb4/cm.c | 46 +++++---- drivers/infiniband/hw/mlx4/mad.c | 7 +- drivers/infiniband/hw/mlx4/qp.c | 2 +- drivers/infiniband/hw/nes/nes_cm.c | 8 +- drivers/infiniband/ulp/ipoib/ipoib_main.c | 59 +++++++---- drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 24 +++-- drivers/misc/cb710/core.c | 1 + drivers/net/cxgb3/cxgb3_offload.c | 8 +- drivers/pcmcia/ds.c | 4 +- drivers/s390/net/qeth_l3_main.c | 25 ++++-- drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 2 +- drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 2 +- drivers/scsi/cxgbi/libcxgbi.c | 4 +- drivers/staging/asus_oled/asus_oled.c | 13 ++- drivers/staging/rtl8712/usb_intf.c | 1 + drivers/target/target_core_pr.c | 5 +- drivers/target/target_core_transport.c | 8 +- drivers/tty/vt/vt_ioctl.c | 1 - drivers/usb/gadget/f_loopback.c | 2 +- drivers/usb/host/pci-quirks.c | 6 + drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 7 ++ drivers/usb/serial/option.c | 129 +++++++++++++++++++++++- drivers/video/atmel_lcdfb.c | 2 +- fs/cifs/sess.c | 7 +- fs/ecryptfs/read_write.c | 4 +- fs/proc/base.c | 106 +++++++++----------- fs/udf/super.c | 6 + include/net/arp.h | 1 + include/net/dst.h | 27 +++++- kernel/kprobes.c | 6 +- kernel/panic.c | 12 ++- kernel/sched_rt.c | 5 + mm/compaction.c | 24 ++++- mm/filemap.c | 8 +- mm/filemap_xip.c | 7 +- mm/huge_memory.c | 4 +- mm/swap.c | 2 +- net/atm/clip.c | 16 ++- net/bridge/br_netfilter.c | 6 +- net/core/dst.c | 15 ++- net/core/neighbour.c | 19 ++-- net/decnet/dn_neigh.c | 8 +- net/decnet/dn_route.c | 18 ++-- net/ipv4/arp.c | 28 +++-- net/ipv4/ip_gre.c | 2 +- net/ipv4/ip_output.c | 22 ++++- net/ipv4/route.c | 31 ++++-- net/ipv6/addrconf.c | 2 +- net/ipv6/ip6_fib.c | 2 +- net/ipv6/ip6_output.c | 40 ++++++-- net/ipv6/ndisc.c | 4 +- net/ipv6/route.c | 59 +++++++---- net/ipv6/sit.c | 4 +- net/sched/sch_teql.c | 31 ++++-- net/xfrm/xfrm_policy.c | 2 +- sound/pci/hda/hda_codec.c | 2 +- sound/soc/codecs/wm8962.c | 6 +- sound/soc/codecs/wm_hubs.c | 18 ++- sound/soc/soc-core.c | 18 +++- 80 files changed, 798 insertions(+), 354 deletions(-)
Greg KH
maintainerPATCH 1/55 readahead: fix pipeline break caused by block plug
3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shaohua Li <[email protected]>
commit 3deaa7190a8da38453c4fabd9dec7f66d17fff67 upstream.
Herbert Poetzl reported a performance regression since 2.6.39. The test is a simple dd read, but with big block size. The reason is:
T1: ra (A, A+128k), (A+128k, A+256k)
T2: lock_page for page A, submit the 256k
T3: hit page A+128K, ra (A+256k, A+384). the range isn't submitted because of plug and there isn't any lock_page till we hit page A+256k because all pages from A to A+256k is in memory
T4: hit page A+256k, ra (A+384, A+ 512). Because of plug, the range isn't submitted again.
T5: lock_page A+256k, so (A+256k, A+512k) will be submitted. The task is waitting for (A+256k, A+512k) finish.
There is no request to disk in T3 and T4, so readahead pipeline breaks.
We really don't need block plug for generic_file_aio_read() for buffered I/O. The readahead already has plug and has fine grained control when I/O should be submitted. Deleting plug for buffered I/O fixes the regression.
One side effect is plug makes the request size 256k, the size is 128k without it. This is because default ra size is 128k and not a reason we need plug here.
Vivek said:
: We submit some readahead IO to device request queue but because of nested : plug, queue never gets unplugged. When read logic reaches a page which is : not in page cache, it waits for page to be read from the disk : (lock_page_killable()) and that time we flush the plug list.
:
: So effectively read ahead logic is kind of broken in parts because of : nested plugging. Removing top level plug (generic_file_aio_read()) for : buffered reads, will allow unplugging queue earlier for readahead.
--- mm/filemap.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
mm/filemap.c +4 -4
@@ -1379,15 +1379,12 @@ generic_file_aio_read(struct kiocb *iocbunsigned long seg =0 ;size_t count;loff_t *ppos = &iocb->ki_pos; -struct blk_plug plug; count =0 ; retval =generic_segment_checks (iov, &nr_segs, &count,VERIFY_WRITE );if (retval)return retval; -blk_start_plug (&plug); -/* coalesce the iovecs and go direct-to-BIO for O_DIRECT */ if (filp->f_flags &O_DIRECT ) {loff_t size;
@@ -1403,8 +1400,12 @@ generic_file_aio_read(struct kiocb *iocb retval =filemap_write_and_wait_range (mapping, pos, pos +iov_length (iov, nr_segs) -1 );if (!retval) { +struct blk_plug plug; + +blk_start_plug (&plug); retval = mapping->a_ops->direct_IO (READ , iocb, iov, pos, nr_segs); +blk_finish_plug (&plug); }if (retval >0 ) { *ppos = pos + retval;
@@ -1460,7 +1461,6 @@ generic_file_aio_read(struct kiocb *iocbbreak ; } out: -blk_finish_plug (&plug);return retval; }EXPORT_SYMBOL (generic_file_aio_read);
Greg KH
maintainerPATCH 2/55 ALSA: HDA: Fix duplicated output to more than one codec
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Henningsson <[email protected]>
commit 54c2a89f60fd71b924d0f848ac892442951401a6 upstream.
This typo caused the wrong codec's nid to be checked for wcaps type. As a result, sometimes speakers would duplicate the output sent to HDMI output.
--- sound/pci/hda/hda_codec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/hda_codec.c +1 -1
@@ -1328,7 +1328,7 @@ void snd_hda_codec_setup_stream(struct hfor (i =0 ; i < c->cvt_setups.used; i++) { p =snd_array_elem (&c->cvt_setups, i);if (!p->active && p->stream_tag == stream_tag && -get_wcaps_type (get_wcaps (codec, p->nid)) == type) +get_wcaps_type (get_wcaps (c, p->nid)) == type) p->dirty =1 ; } }
Greg KH
maintainerPATCH 3/55 ASoC: wm_hubs: Enable line out VMID buffer for single ended line outputs
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 77231abe55433aa17eca712718745275853fa66d upstream.
For optimal performance the single ended line outputs require that the line output VMID buffer be enabled.
--- sound/soc/codecs/wm_hubs.c | 6 ++++++ 1 file changed, 6 insertions(+)
sound/soc/codecs/wm_hubs.c +6 -0
@@ -589,6 +589,8 @@ SND_SOC_DAPM_INPUT("IN2RP:VXRP"),SND_SOC_DAPM_MICBIAS ("MICBIAS2" ,WM8993_POWER_MANAGEMENT_1 ,5 ,0 ),SND_SOC_DAPM_MICBIAS ("MICBIAS1" ,WM8993_POWER_MANAGEMENT_1 ,4 ,0 ), +SND_SOC_DAPM_SUPPLY ("LINEOUT_VMID_BUF" ,WM8993_ANTIPOP1 ,7 ,0 ,NULL ,0 ), +SND_SOC_DAPM_MIXER ("IN1L PGA" ,WM8993_POWER_MANAGEMENT_2 ,6 ,0 , in1l_pga,ARRAY_SIZE (in1l_pga)), SND_SOC_DAPM_MIXER("IN1R PGA", WM8993_POWER_MANAGEMENT_2, 4, 0,
@@ -794,9 +796,11 @@ static const struct snd_soc_dapm_route l };static const struct snd_soc_dapm_route lineout1_se_routes[] = { + {"LINEOUT1N Mixer" ,NULL ,"LINEOUT_VMID_BUF" }, {"LINEOUT1N Mixer" ,"Left Output Switch" ,"Left Output PGA" }, {"LINEOUT1N Mixer" ,"Right Output Switch" ,"Right Output PGA" }, + {"LINEOUT1P Mixer" ,NULL ,"LINEOUT_VMID_BUF" }, {"LINEOUT1P Mixer" ,"Left Output Switch" ,"Left Output PGA" }, {"LINEOUT1N Driver" ,NULL ,"LINEOUT1N Mixer" },
@@ -813,9 +817,11 @@ static const struct snd_soc_dapm_route l };static const struct snd_soc_dapm_route lineout2_se_routes[] = { + {"LINEOUT2N Mixer" ,NULL ,"LINEOUT_VMID_BUF" }, {"LINEOUT2N Mixer" ,"Left Output Switch" ,"Left Output PGA" }, {"LINEOUT2N Mixer" ,"Right Output Switch" ,"Right Output PGA" }, + {"LINEOUT2P Mixer" ,NULL ,"LINEOUT_VMID_BUF" }, {"LINEOUT2P Mixer" ,"Right Output Switch" ,"Right Output PGA" }, {"LINEOUT2N Driver" ,NULL ,"LINEOUT2N Mixer" },
Greg KH
maintainerPATCH 4/55 ASoC: wm_hubs: fix wrong bits for LINEOUT2 N/P mixer
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: UK KIM <[email protected]>
commit 114395c61ad2eb5a7a5cd163fcadb2414e48245a upstream.
--- sound/soc/codecs/wm_hubs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/wm_hubs.c +2 -2
@@ -568,8 +568,8 @@ SOC_DAPM_SINGLE("Output Switch", WM8993_ };static const struct snd_kcontrol_new line2n_mix[] = { -SOC_DAPM_SINGLE ("Left Output Switch" ,WM8993_LINE_MIXER2 ,6 ,1 ,0 ), -SOC_DAPM_SINGLE ("Right Output Switch" ,WM8993_LINE_MIXER2 ,5 ,1 ,0 ), +SOC_DAPM_SINGLE ("Left Output Switch" ,WM8993_LINE_MIXER2 ,5 ,1 ,0 ), +SOC_DAPM_SINGLE ("Right Output Switch" ,WM8993_LINE_MIXER2 ,6 ,1 ,0 ), };static const struct snd_kcontrol_new line2p_mix[] = {
Greg KH
maintainerPATCH 5/55 ARM: 7306/1: vfp: flush thread hwstate before restoring context from sigframe
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 2af276dfb1722e97b190bd2e646b079a2aa674db upstream.
Following execution of a signal handler, we currently restore the VFP context from the ucontext in the signal frame. This involves copying from the user stack into the current thread's vfp_hard_struct and then flushing the new data out to the hardware registers.
This is problematic when using a preemptible kernel because we could be context switched whilst updating the vfp_hard_struct. If the current thread has made use of VFP since the last context switch, the VFP notifier will copy from the hardware registers into the vfp_hard_struct, overwriting any data that had been partially copied by the signal code.
Disabling preemption across copy_from_user calls is a terrible idea, so instead we move the VFP thread flush *before* we update the vfp_hard_struct. Since the flushing is performed lazily, this has the effect of disabling VFP and clearing the CPU's VFP state pointer, therefore preventing the thread from being updated with stale data on the next context switch.
--- arch/arm/kernel/signal.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
arch/arm/kernel/signal.c +2 -3
@@ -227,6 +227,8 @@ static int restore_vfp_context(struct vfif (magic !=VFP_MAGIC || size !=VFP_STORAGE_SIZE )return -EINVAL ; +vfp_flush_hwstate (thread); +/* * Copy the floating point registers. There can be unused * registers see asm/hwcap.h for details.
@@ -251,9 +253,6 @@ static int restore_vfp_context(struct vf__get_user_error (h->fpinst, &frame->ufp_exc.fpinst, err);__get_user_error (h->fpinst2, &frame->ufp_exc.fpinst2, err); -if (!err) -vfp_flush_hwstate (thread); -return err ? -EFAULT :0 ; }
Greg KH
maintainerPATCH 6/55 ARM: 7307/1: vfp: fix ptrace regset modification race
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Martin <[email protected]>
commit 247f4993a5974e6759606c4d380748eecfd273ff upstream.
In a preemptible kernel, vfp_set() can be preempted, causing the hardware VFP context to be switched while the thread vfp state is being read and modified. This leads to a race condition which can cause the thread vfp state to become corrupted if lazy VFP context save occurs due to preemption in between the time thread->vfpstate is read and the time the modified state is written back.
This may occur if preemption occurs during the execution of a ptrace() call which modifies the VFP register state of a thread. Such instances should be very rare in most realistic scenarios -- none has been reported, so far as I am aware. Only uniprocessor systems should be affected, since VFP context save is not currently lazy in SMP kernels.
The problem was introduced by my earlier patch migrating to use regsets to implement ptrace.
This patch does a vfp_sync_hwstate() before reading thread->vfpstate, to make sure that the thread's VFP state is not live in the hardware registers while the registers are modified.
Thanks to Will Deacon for spotting this.
--- arch/arm/kernel/ptrace.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/arm/kernel/ptrace.c +4 -2
@@ -719,10 +719,13 @@ static int vfp_set(struct task_struct *t {int ret;struct thread_info *thread =task_thread_info (target); -struct vfp_hard_struct new_vfp = thread->vfpstate.hard; +struct vfp_hard_struct new_vfp;const size_t user_fpregs_offset = offsetof(struct user_vfp , fpregs);const size_t user_fpscr_offset = offsetof(struct user_vfp , fpscr); +vfp_sync_hwstate (thread); + new_vfp = thread->vfpstate.hard; + ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &new_vfp.fpregs, user_fpregs_offset,
@@ -743,7 +746,6 @@ static int vfp_set(struct task_struct *tif (ret)return ret; -vfp_sync_hwstate (thread); thread->vfpstate.hard = new_vfp;vfp_flush_hwstate (thread);
Greg KH
maintainerPATCH 7/55 ARM: 7308/1: vfp: flush thread hwstate before copying ptrace registers
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 8130b9d7b9d858aa04ce67805e8951e3cb6e9b2f upstream.
If we are context switched whilst copying into a thread's vfp_hard_struct then the partial copy may be corrupted by the VFP context switching code (see "ARM: vfp: flush thread hwstate before restoring context from sigframe").
This patch updates the ptrace VFP set code so that the thread state is flushed before the copy, therefore disabling VFP and preventing corruption from occurring.
--- arch/arm/kernel/ptrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kernel/ptrace.c +1 -1
@@ -746,8 +746,8 @@ static int vfp_set(struct task_struct *tif (ret)return ret; - thread->vfpstate.hard = new_vfp;vfp_flush_hwstate (thread); + thread->vfpstate.hard = new_vfp;return 0 ; }
Greg KH
maintainerPATCH 8/55 ARM: OMAP2+: GPMC: fix device size setup
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Yegor Yefremov <[email protected]>
commit 8ef5d844cc3a644ea6f7665932a4307e9fad01fa upstream.
following statement can only change device size from 8-bit(0) to 16-bit(1), but not vice versa:
regval |= GPMC_CONFIG1_DEVICESIZE(wval);
so as this field has 1 reserved bit, that could be used in future, just clear both bits and then OR with the desired value
--- arch/arm/mach-omap2/gpmc.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/mach-omap2/gpmc.c +6 -0
@@ -528,7 +528,13 @@ int gpmc_cs_configure(int cs, int cmd, icase GPMC_CONFIG_DEV_SIZE : regval =gpmc_cs_read_reg (cs,GPMC_CS_CONFIG1 ); + +/* clear 2 target bits */ + regval &= ~GPMC_CONFIG1_DEVICESIZE (3 ); + +/* set the proper value */ regval |=GPMC_CONFIG1_DEVICESIZE (wval); +gpmc_cs_write_reg (cs,GPMC_CS_CONFIG1 , regval);break ;
Greg KH
maintainerPATCH 9/55 drivers/tty/vt/vt_ioctl.c: fix KDFONTOP 32bit compatibility layer
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Samuel Thibault <[email protected]>
commit cbcb8346054073d000ecac324763372d6abd44ac upstream.
KDFONTOP(GET) currently fails with EIO when being run in a 32bit userland with a 64bit kernel if the font width is not 8.
This is because of the setting of the KD_FONT_FLAG_OLD flag, which makes con_font_get return EIO in such case.
This flag should *not* be set for KDFONTOP, since it's actually the whole point of this flag (see comment in con_font_set for instance).
--- drivers/tty/vt/vt_ioctl.c | 1 - 1 file changed, 1 deletion(-)
drivers/tty/vt/vt_ioctl.c +0 -1
@@ -1463,7 +1463,6 @@ compat_kdfontop_ioctl(struct compat_consif (!perm && op->op !=KD_FONT_OP_GET )return -EPERM ; op->data =compat_ptr (((struct compat_console_font_op *)op)->data); - op->flags |=KD_FONT_FLAG_OLD ; i =con_font_op (vc, op);if (i)return i;
Greg KH
maintainerPATCH 10/55 proc: mem_release() should check mm != NULL
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit 71879d3cb3dd8f2dfdefb252775c1b3ea04a3dd4 upstream.
mem_release() can hit mm == NULL, add the necessary check.
--- fs/proc/base.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/proc/base.c +2 -2
@@ -886,8 +886,8 @@ loff_t mem_lseek(struct file *file, loffstatic int mem_release (struct inode *inode,struct file *file) {struct mm_struct *mm = file->private_data; - -mmput (mm); +if (mm) +mmput (mm);return 0 ; }
Greg KH
maintainerPATCH 11/55 proc: unify mem_read() and mem_write()
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit 572d34b946bae070debd42db1143034d9687e13f upstream.
No functional changes, cleanup and preparation.
mem_read() and mem_write() are very similar. Move this code into the new common helper, mem_rw(), which takes the additional "int write" argument.
--- fs/proc/base.c | 90 ++++++++++++++++++++------------------------------------- 1 file changed, 32 insertions(+), 58 deletions(-)
fs/proc/base.c +32 -58
@@ -782,57 +782,13 @@ static int mem_open(struct inode* inode,return 0 ; } -static ssize_t mem_read (struct file * file,char __user * buf, -size_t count,loff_t *ppos) +static ssize_t mem_rw (struct file *file,char __user *buf, +size_t count,loff_t *ppos,int write) { -int ret; -char *page; -unsigned long src = *ppos;struct mm_struct *mm = file->private_data; - -if (!mm) -return 0 ; - - page = (char *)__get_free_page (GFP_TEMPORARY ); -if (!page) -return -ENOMEM ; - - ret =0 ; - -while (count >0 ) { -int this_len, retval; - - this_len = (count >PAGE_SIZE ) ?PAGE_SIZE : count; - retval =access_remote_vm (mm, src, page, this_len,0 ); -if (!retval) { -if (!ret) - ret = -EIO ; -break ; - } - -if (copy_to_user (buf, page, retval)) { - ret = -EFAULT ; -break ; - } - - ret += retval; - src += retval; - buf += retval; - count -= retval; - } - *ppos = src; - -free_page ((unsigned long ) page); -return ret; -} - -static ssize_t mem_write (struct file * file,const char __user *buf, -size_t count,loff_t *ppos) -{ -int copied; +unsigned long addr = *ppos; +ssize_t copied;char *page; -unsigned long dst = *ppos; -struct mm_struct *mm = file->private_data;if (!mm)return 0 ;
@@ -843,30 +799,48 @@ static ssize_t mem_write(struct file * f copied =0 ;while (count >0 ) { -int this_len, retval; +int this_len =min_t (int, count,PAGE_SIZE ); - this_len = (count >PAGE_SIZE ) ?PAGE_SIZE : count; -if (copy_from_user (page, buf, this_len)) { +if (write &©_from_user (page, buf, this_len)) { copied = -EFAULT ;break ; } - retval =access_remote_vm (mm, dst, page, this_len,1 ); -if (!retval) { + + this_len =access_remote_vm (mm, addr, page, this_len, write); +if (!this_len) {if (!copied) copied = -EIO ;break ; } - copied += retval; - buf += retval; - dst += retval; - count -= retval; + +if (!write &©_to_user (buf, page, this_len)) { + copied = -EFAULT ; +break ; + } + + buf += this_len; + addr += this_len; + copied += this_len; + count -= this_len; } - *ppos = dst; + *ppos = addr;free_page ((unsigned long ) page);return copied; } +static ssize_t mem_read (struct file *file,char __user *buf, +size_t count,loff_t *ppos) +{ +return mem_rw (file, buf, count, ppos,0 ); +} + +static ssize_t mem_write (struct file *file,const char __user *buf, +size_t count,loff_t *ppos) +{ +return mem_rw (file, (char __user *)buf, count, ppos,1 ); +} +loff_t mem_lseek (struct file *file,loff_t offset,int orig) {switch (orig) {
Greg KH
maintainerPATCH 12/55 proc: make sure mem_open() doesnt pin the targets memory
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Oleg Nesterov <[email protected]>
commit 6d08f2c7139790c268820a2e590795cb8333181a upstream.
Once /proc/pid/mem is opened, the memory can't be released until mem_release() even if its owner exits.
Change mem_open() to do atomic_inc(mm_count) + mmput(), this only pins mm_struct. Change mem_rw() to do atomic_inc_not_zero(mm_count) before access_remote_vm(), this verifies that this mm is still alive.
I am not sure what should mem_rw() return if atomic_inc_not_zero() fails. With this patch it returns zero to match the "mm == NULL" case, may be it should return -EINVAL like it did before e268337d.
Perhaps it makes sense to add the additional fatal_signal_pending() check into the main loop, to ensure we do not hold this memory if the target task was oom-killed.
--- fs/proc/base.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-)
fs/proc/base.c +13 -1
@@ -775,6 +775,13 @@ static int mem_open(struct inode* inode,if (IS_ERR (mm))return PTR_ERR (mm); +if (mm) { +/* ensure this mm_struct can't be freed */ +atomic_inc (&mm->mm_count); +/* but do not pin its memory */ +mmput (mm); + } +/* OK to pass negative loff_t, we can catch out-of-range */ file->f_mode |=FMODE_UNSIGNED_OFFSET ; file->private_data = mm;
@@ -798,6 +805,9 @@ static ssize_t mem_rw(struct file *file,return -ENOMEM ; copied =0 ; +if (!atomic_inc_not_zero (&mm->mm_users)) + goto free; +while (count >0 ) {int this_len =min_t (int, count,PAGE_SIZE );
@@ -825,6 +835,8 @@ static ssize_t mem_rw(struct file *file, } *ppos = addr; +mmput (mm); +free:free_page ((unsigned long ) page);return copied; }
@@ -861,7 +873,7 @@ static int mem_release(struct inode *ino {struct mm_struct *mm = file->private_data;if (mm) -mmput (mm); +mmdrop (mm);return 0 ; }
Greg KH
maintainerPATCH 13/55 firewire: ohci: add reset packet quirk for SB Audigy
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Clemens Ladisch <[email protected]>
commit d1bb399ad03c11e792f6dea198d3b1e23061f094 upstream.
The Audigy's SB1394 controller is actually from Texas Instruments and has the same bus reset packet generation bug, so it needs the same quirk entry.
--- drivers/firewire/ohci.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/firewire/ohci.c +4 -0
@@ -262,6 +262,7 @@ static inline struct fw_ohci *fw_ohci(ststatic char ohci_driver_name[] =KBUILD_MODNAME ;#define PCI_DEVICE_ID_AGERE_FW643 0x5901 +#define PCI_DEVICE_ID_CREATIVE_SB1394 0x4001#define PCI_DEVICE_ID_JMICRON_JMB38X_FW 0x2380#define PCI_DEVICE_ID_TI_TSB12LV22 0x8009#define PCI_VENDOR_ID_PINNACLE_SYSTEMS 0x11bd
@@ -285,6 +286,9 @@ static const struct { {PCI_VENDOR_ID_ATT ,PCI_DEVICE_ID_AGERE_FW643 ,6 , QUIRK_NO_MSI}, + {PCI_VENDOR_ID_CREATIVE, PCI_DEVICE_ID_CREATIVE_SB1394, PCI_ANY_ID, + QUIRK_RESET_PACKET}, + {PCI_VENDOR_ID_JMICRON, PCI_DEVICE_ID_JMICRON_JMB38X_FW, PCI_ANY_ID, QUIRK_NO_MSI},
Greg KH
maintainerPATCH 14/55 firewire: ohci: disable MSI on Ricoh controllers
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Richter <[email protected]>
commit 320cfa6ce0b3dc794fedfa4bae54c0f65077234d upstream.
The PCIe device
FireWire (IEEE 1394) [0c00]: Ricoh Co Ltd FireWire Host Controller [1180:e832] (prog-if 10 [OHCI])
is unable to access attached FireWire devices when MSI is enabled but works if MSI is disabled.
http://www.mail-archive.com/[email protected]/msg28251.html
Hence add the "disable MSI" quirks flag for this device, or in fact for safety and simplicity for all current (R5U230, R5U231, R5U240) and future Ricoh PCIe 1394 controllers.
--- drivers/firewire/ohci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/firewire/ohci.c +1 -1
@@ -299,7 +299,7 @@ static const struct { QUIRK_NO_MSI}, {PCI_VENDOR_ID_RICOH ,PCI_ANY_ID ,PCI_ANY_ID , - QUIRK_CYCLE_TIMER}, + QUIRK_CYCLE_TIMER | QUIRK_NO_MSI}, {PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_TSB12LV22, PCI_ANY_ID, QUIRK_CYCLE_TIMER | QUIRK_RESET_PACKET | QUIRK_NO_1394A},
Greg KH
maintainerPATCH 15/55 IB/mlx4: pass SMP vendor-specific attribute MADs to firmware
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jack Morgenstein <[email protected]>
commit a6f7feae6d19e84253918d88b04153af09d3a243 upstream.
In the current code, vendor-specific MADs (e.g with the FDR-10 attribute) are silently dropped by the driver, resulting in timeouts at the sending side and inability to query/configure the relevant feature. However, the ConnectX firmware is able to handle such MADs. For unsupported attributes, the firmware returns a GET_RESPONSE MAD containing an error status.
For example, for a FDR-10 node with LID 11:
# ibstat mlx4_0 1
CA: 'mlx4_0'
Port 1:
State: Active
Physical state: LinkUp
Rate: 40 (FDR10)
Base lid: 11
LMC: 0
SM lid: 24
Capability mask: 0x02514868
Port GUID: 0x0002c903002e65d1
Link layer: InfiniBandExtended Port Query (EPI) vendor mad timeouts before the patch:
# smpquery MEPI 11 -d
ibwarn: [4196] smp_query_via: attr 0xff90 mod 0x0 route Lid 11
ibwarn: [4196] _do_madrpc: retry 1 (timeout 1000 ms)
ibwarn: [4196] _do_madrpc: retry 2 (timeout 1000 ms)
ibwarn: [4196] _do_madrpc: timeout after 3 retries, 3000 ms
ibwarn: [4196] mad_rpc: _do_madrpc failed; dport (Lid 11)
smpquery: iberror: [pid 4196] main: failed: operation EPI: ext port info query failedEPI query works OK with the patch:
# smpquery MEPI 11 -d
ibwarn: [6548] smp_query_via: attr 0xff90 mod 0x0 route Lid 11
ibwarn: [6548] mad_rpc: data offs 64 sz 64
mad data
0000 0000 0000 0001 0000 0001 0000 0001
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
0000 0000 0000 0000 0000 0000 0000 0000
# Ext Port info: Lid 11 port 0
StateChangeEnable:...............0x00
LinkSpeedSupported:..............0x01
LinkSpeedEnabled:................0x01
LinkSpeedActive:.................0x01--- drivers/infiniband/hw/mlx4/mad.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-)
drivers/infiniband/hw/mlx4/mad.c +2 -5
@@ -255,12 +255,9 @@ int mlx4_ib_process_mad(struct ib_devicereturn IB_MAD_RESULT_SUCCESS ;/* -* Don't process SMInfo queries or vendor-specific -* MADs -- the SMA can't handle them. +* Don't process SMInfo queries -- the SMA can't handle them. */ -if (in_mad->mad_hdr.attr_id ==IB_SMP_ATTR_SM_INFO || - ((in_mad->mad_hdr.attr_id &IB_SMP_ATTR_VENDOR_MASK ) == -IB_SMP_ATTR_VENDOR_MASK )) +if (in_mad->mad_hdr.attr_id ==IB_SMP_ATTR_SM_INFO )return IB_MAD_RESULT_SUCCESS ; } else if (in_mad->mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT || in_mad->mad_hdr.mgmt_class == MLX4_IB_VENDOR_CLASS1 ||
Greg KH
maintainerPATCH 16/55 kprobes: fix a memory leak in function pre_handler_kretprobe()
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiang Liu <[email protected]>
commit 55ca6140e9bb307efc97a9301a4f501de02a6fd6 upstream.
In function pre_handler_kretprobe(), the allocated kretprobe_instance object will get leaked if the entry_handler callback returns non-zero. This may cause all the preallocated kretprobe_instance objects exhausted.
This issue can be reproduced by changing samples/kprobes/kretprobe_example.c to probe "mutex_unlock". And the fix is straightforward: just put the allocated kretprobe_instance object back onto the free_instances list.
--- kernel/kprobes.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
kernel/kprobes.c +5 -1
@@ -1660,8 +1660,12 @@ static int __kprobes pre_handler_kretpro ri->rp = rp; ri->task = current; -if (rp->entry_handler && rp->entry_handler (ri, regs)) +if (rp->entry_handler && rp->entry_handler (ri, regs)) { +raw_spin_lock_irqsave (&rp->lock, flags); +hlist_add_head (&ri->hlist, &rp->free_instances); +raw_spin_unlock_irqrestore (&rp->lock, flags);return 0 ; + }arch_prepare_kretprobe (ri, regs);
Greg KH
maintainerPATCH 17/55 at_hdmac: bugfix for enabling channel irq
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nikolaus Voss <[email protected]>
commit bda3a47c886664e86ee14eb79e9072b9e341f575 upstream.
commit 463894705e4089d0ff69e7d877312d496ac70e5b deleted redundant chan_id and chancnt initialization in dma drivers as this is done in dma_async_device_register().
However, atc_enable_irq() relied on chan_id set before registering the device, what left only channel 0 functional for this driver.
This patch introduces atc_enable/disable_chan_irq() as a variant of atc_enable/disable_irq() with the channel as explicit argument.
--- drivers/dma/at_hdmac.c | 4 ++-- drivers/dma/at_hdmac_regs.h | 17 ++++++++--------- 2 files changed, 10 insertions(+), 11 deletions(-)
drivers/dma/at_hdmac.c +2 -2
@@ -1279,7 +1279,7 @@ static int __init at_dma_probe(struct pltasklet_init (&atchan->tasklet, atc_tasklet, (unsigned long )atchan); -atc_enable_irq (atchan); +atc_enable_chan_irq (atdma, i); }/* set base routines */
@@ -1348,7 +1348,7 @@ static int __exit at_dma_remove(struct pstruct at_dma_chan *atchan =to_at_dma_chan (chan);/* Disable interrupts */ -atc_disable_irq (atchan); +atc_disable_chan_irq (atdma, chan->chan_id);tasklet_disable (&atchan->tasklet);tasklet_kill (&atchan->tasklet);
drivers/dma/at_hdmac_regs.h +8 -9
@@ -319,28 +319,27 @@ static void atc_dump_lli(struct at_dma_c } -static void atc_setup_irq (struct at_dma_chan *atchan,int on) +static void atc_setup_irq (struct at_dma *atdma,int chan_id,int on) { -struct at_dma *atdma =to_at_dma (atchan->chan_common.device); -u32 ebci; +u32 ebci;/* enable interrupts on buffer transfer completion & error */ - ebci =AT_DMA_BTC (atchan->chan_common.chan_id) - |AT_DMA_ERR (atchan->chan_common.chan_id); + ebci =AT_DMA_BTC (chan_id) + |AT_DMA_ERR (chan_id);if (on)dma_writel (atdma,EBCIER , ebci);else dma_writel (atdma,EBCIDR , ebci); } -static inline void atc_enable_irq (struct at_dma_chan *atchan) +static void atc_enable_chan_irq (struct at_dma *atdma,int chan_id) { -atc_setup_irq (atchan,1 ); +atc_setup_irq (atdma, chan_id,1 ); } -static inline void atc_disable_irq (struct at_dma_chan *atchan) +static void atc_disable_chan_irq (struct at_dma *atdma,int chan_id) { -atc_setup_irq (atchan,0 ); +atc_setup_irq (atdma, chan_id,0 ); }
Greg KH
maintainerPATCH 18/55 mm/filemap_xip.c: fix race condition in xip_file_fault()
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carsten Otte <[email protected]>
commit 99f02ef1f18631eb0a4e0ea0a3d56878dbcb4b90 upstream.
Fix a race condition that shows in conjunction with xip_file_fault() when two threads of the same user process fault on the same memory page.
In this case, the race winner will install the page table entry and the unlucky loser will cause an oops: xip_file_fault calls vm_insert_pfn (via vm_insert_mixed) which drops out at this check:
retval = -EBUSY; if (!pte_none(*pte)) goto out_unlock;
The resulting -EBUSY return value will trigger a BUG_ON() in xip_file_fault.
This fix simply considers the fault as fixed in this case, because the race winner has successfully installed the pte.
--- mm/filemap_xip.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
mm/filemap_xip.c +6 -1
@@ -263,7 +263,12 @@ found: xip_pfn);if (err == -ENOMEM )return VM_FAULT_OOM ; -BUG_ON (err); +/* +* err == -EBUSY is fine, we've raced against another thread +* that faulted-in the same page +*/ +if (err != -EBUSY ) +BUG_ON (err);return VM_FAULT_NOPAGE ; }else {int err, ret =VM_FAULT_OOM ;
Greg KH
maintainerPATCH 19/55 mm: compaction: check pfn_valid when entering a new MAX_ORDER_NR_PAGES block during isolation for migration
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mel Gorman <[email protected]>
commit 0bf380bc70ecba68cb4d74dc656cc2fa8c4d801a upstream.
When isolating for migration, migration starts at the start of a zone which is not necessarily pageblock aligned. Further, it stops isolating when COMPACT_CLUSTER_MAX pages are isolated so migrate_pfn is generally not aligned. This allows isolate_migratepages() to call pfn_to_page() on an invalid PFN which can result in a crash. This was originally reported against a 3.0-based kernel with the following trace in a crash dump.
PID: 9902 TASK: d47aecd0 CPU: 0 COMMAND: "memcg_process_s"
#0 [d72d3ad0] crash_kexec at c028cfdb
#1 [d72d3b24] oops_end at c05c5322
#2 [d72d3b38] __bad_area_nosemaphore at c0227e60 #3 [d72d3bec] bad_area at c0227fb6
#4 [d72d3c00] do_page_fault at c05c72ec
#5 [d72d3c80] error_code (via page_fault) at c05c47a4
EAX: 00000000 EBX: 000c0000 ECX: 00000001 EDX: 00000807 EBP: 000c0000
DS: 007b ESI: 00000001 ES: 007b EDI: f3000a80 GS: 6f50
CS: 0060 EIP: c030b15a ERR: ffffffff EFLAGS: 00010002 #6 [d72d3cb4] isolate_migratepages at c030b15a #7 [d72d3d14] zone_watermark_ok at c02d26cb #8 [d72d3d2c] compact_zone at c030b8de
#9 [d72d3d68] compact_zone_order at c030bba1
#10 [d72d3db4] try_to_compact_pages at c030bc84 #11 [d72d3ddc] __alloc_pages_direct_compact at c02d61e7 #12 [d72d3e08] __alloc_pages_slowpath at c02d66c7 #13 [d72d3e78] __alloc_pages_nodemask at c02d6a97 #14 [d72d3eb8] alloc_pages_vma at c030a845
#15 [d72d3ed4] do_huge_pmd_anonymous_page at c03178eb #16 [d72d3f00] handle_mm_fault at c02f36c6
#17 [d72d3f30] do_page_fault at c05c70ed
#18 [d72d3fb0] error_code (via page_fault) at c05c47a4
EAX: b71ff000 EBX: 00000001 ECX: 00001600 EDX: 00000431
DS: 007b ESI: 08048950 ES: 007b EDI: bfaa3788
SS: 007b ESP: bfaa36e0 EBP: bfaa3828 GS: 6f50
CS: 0073 EIP: 080487c8 ERR: ffffffff EFLAGS: 00010202It was also reported by Herbert van den Bergh against 3.1-based kernel with the following snippet from the console log.
BUG: unable to handle kernel paging request at 01c00008 IP: [<c0522399>] isolate_migratepages+0x119/0x390
*pdpt = 000000002f7ce001 *pde = 0000000000000000
It is expected that it also affects 3.2.x and current mainline.
The problem is that pfn_valid is only called on the first PFN being checked and that PFN is not necessarily aligned. Lets say we have a case like this
H = MAX_ORDER_NR_PAGES boundary
| = pageblock boundary
m = cc->migrate_pfn
f = cc->free_pfn
o = memory hole
H------|------H------|----m-Hoooooo|ooooooH-f----|------H
The migrate_pfn is just below a memory hole and the free scanner is beyond the hole. When isolate_migratepages started, it scans from migrate_pfn to migrate_pfn+pageblock_nr_pages which is now in a memory hole. It checks pfn_valid() on the first PFN but then scans into the hole where there are not necessarily valid struct pages.
This patch ensures that isolate_migratepages calls pfn_valid when necessary.
--- mm/compaction.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
mm/compaction.c +13 -0
@@ -320,6 +320,19 @@ static isolate_migrate_t isolate_migrate }else if (!locked)spin_lock_irq (&zone->lru_lock); +/* +* migrate_pfn does not necessarily start aligned to a +* pageblock. Ensure that pfn_valid is called when moving +* into a new MAX_ORDER_NR_PAGES range in case of large +* memory holes within the zone +*/ +if ((low_pfn & (MAX_ORDER_NR_PAGES -1 )) ==0 ) { +if (!pfn_valid (low_pfn)) { + low_pfn +=MAX_ORDER_NR_PAGES -1 ; +continue ; + } + } +if (!pfn_valid_within (low_pfn))continue ; nr_scanned++;
Greg KH
maintainerPATCH 20/55 drm/radeon: Set DESKTOP_HEIGHT register to the framebuffer (not mode) height.
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: =?UTF-8?q?Michel=20D=C3=A4nzer?= <[email protected]>
commit 1b61925061660009f5b8047f93c5297e04541273 upstream.
The value of this register is transferred to the V_COUNTER register at the beginning of vertical blank. V_COUNTER is the reference for VLINE waits and goes from VIEWPORT_Y_START to VIEWPORT_Y_START+VIEWPORT_HEIGHT during scanout, so if VIEWPORT_Y_START is not 0, V_COUNTER actually went backwards at the beginning of vertical blank, and VLINE waits excluding the whole scanout area could never finish (possibly only if VIEWPORT_Y_START is larger than the length of vertical blank in scanlines). Setting DESKTOP_HEIGHT to the framebuffer height should prevent this for any kind of VLINE wait.
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=45329 .
--- drivers/gpu/drm/radeon/atombios_crtc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/atombios_crtc.c +2 -2
@@ -1173,7 +1173,7 @@ static int dce4_crtc_do_set_base(structWREG32 (EVERGREEN_GRPH_ENABLE + radeon_crtc->crtc_offset,1 );WREG32 (EVERGREEN_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, - crtc->mode.vdisplay); + target_fb->height); x &= ~3 ; y &= ~1 ; WREG32(EVERGREEN_VIEWPORT_START + radeon_crtc->crtc_offset,
@@ -1342,7 +1342,7 @@ static int avivo_crtc_do_set_base(structWREG32 (AVIVO_D1GRPH_ENABLE + radeon_crtc->crtc_offset,1 );WREG32 (AVIVO_D1MODE_DESKTOP_HEIGHT + radeon_crtc->crtc_offset, - crtc->mode.vdisplay); + target_fb->height); x &= ~3 ; y &= ~1 ; WREG32(AVIVO_D1MODE_VIEWPORT_START + radeon_crtc->crtc_offset,
Greg KH
maintainerPATCH 21/55 drm/nouveau/gem: fix fence_sync race / oops
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Skeggs <[email protected]>
commit 525895ba388c949aa906f26e3ec5cb1ab041f56b upstream.
Due to a race it was possible for a fence to be destroyed while another thread was trying to synchronise with it. If this happened in the fallback non-semaphore path, it lead to the following oops due to fence->channel being NULL.
BUG: unable to handle kernel NULL pointer dereference at (null) IP: [<fa9632ce>] nouveau_fence_update+0xe/0xe0 [nouveau] *pde = a649c067 SMP Modules linked in: fuse nouveau(O) ttm(O) drm_kms_helper(O) drm(O) mxm_wmi video wmi netconsole configfs lockd bnep bluetooth rfkill ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack ip6table_filter ip6_tables snd_hda_codec_realtek snd_hda_intel snd_hda_cobinfmt_misc uinput ata_generic pata_acpi pata_aet2c_algo_bit i2c_core [last unloaded: wmi]
Pid: 2255, comm: gnome-shell Tainted: G O 3.2.0-0.rc5.git0.1.fc17.i686 #1 System manufacturer System Product Name/M2A-VM
EIP: 0060:[<fa9632ce>] EFLAGS: 00010296 CPU: 1
EIP is at nouveau_fence_update+0xe/0xe0 [nouveau]
EAX: 00000000 EBX: ddfc6dd0 ECX: dd111580 EDX: 00000000
ESI: 00003e80 EDI: dd111580 EBP: dd121d00 ESP: dd121ce8
DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
Process gnome-shell (pid: 2255, ti=dd120000 task=dd111580 task.ti=dd120000)
Stack: 7dc86c76 00000000 00003e80 ddfc6dd0 00003e80 dd111580 dd121d0c fa96371f 00000000 dd121d3c fa963773 dd111580 01000246 000ec53d 00000000 ddfc6dd0 00001f40 00000000 ddfc6dd0 00000010 dc7df840 dd121d6c fa9639a0 00000000 Call Trace: [<fa96371f>] __nouveau_fence_signalled+0x1f/0x30 [nouveau] [<fa963773>] __nouveau_fence_wait+0x43/0xd0 [nouveau] [<fa9639a0>] nouveau_fence_sync+0x1a0/0x1c0 [nouveau] [<fa964046>] validate_list+0x176/0x300 [nouveau] [<f7d9c9c0>] ? ttm_bo_mem_put+0x30/0x30 [ttm] [<fa964b8a>] nouveau_gem_ioctl_pushbuf+0x48a/0xfd0 [nouveau] [<c0406481>] ? die+0x31/0x80 [<f7c93d98>] drm_ioctl+0x388/0x490 [drm] [<c0406481>] ? die+0x31/0x80 [<fa964700>] ? nouveau_gem_ioctl_new+0x150/0x150 [nouveau] [<c0635c7b>] ? file_has_perm+0xcb/0xe0 [<f7c93a10>] ? drm_copy_field+0x80/0x80 [drm] [<c0564f56>] do_vfs_ioctl+0x86/0x5b0 [<c0406481>] ? die+0x31/0x80 [<c0635f22>] ? selinux_file_ioctl+0x62/0x130 [<c0554f30>] ? fget_light+0x30/0x340 [<c05654ef>] sys_ioctl+0x6f/0x80 [<c099e3a4>] syscall_call+0x7/0xb [<c0406481>] ? die+0x31/0x80 [<c0406481>] ? die+0x31/0x80
--- drivers/gpu/drm/nouveau/nouveau_gem.c | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-)
drivers/gpu/drm/nouveau/nouveau_gem.c +21 -2
@@ -315,6 +315,25 @@ retry: }static int +validate_sync (struct nouveau_channel *chan,struct nouveau_bo *nvbo) +{ +struct nouveau_fence *fence =NULL ; +int ret =0 ; + +spin_lock (&nvbo->bo.bdev->fence_lock); +if (nvbo->bo.sync_obj) + fence =nouveau_fence_ref (nvbo->bo.sync_obj); +spin_unlock (&nvbo->bo.bdev->fence_lock); + +if (fence) { + ret =nouveau_fence_sync (fence, chan); +nouveau_fence_unref (&fence); + } + +return ret; +} + +static int validate_list (struct nouveau_channel *chan,struct list_head *list,struct drm_nouveau_gem_pushbuf_bo *pbbo,uint64_t user_pbbo_ptr) {
@@ -327,7 +346,7 @@ validate_list(struct nouveau_channel *chlist_for_each_entry (nvbo, list, entry) {struct drm_nouveau_gem_pushbuf_bo *b = &pbbo[nvbo->pbbo_index]; - ret =nouveau_fence_sync (nvbo->bo.sync_obj, chan); + ret =validate_sync (chan, nvbo);if (unlikely (ret)) {NV_ERROR (dev,"fail pre-validate sync\n" );return ret;
@@ -350,7 +369,7 @@ validate_list(struct nouveau_channel *chreturn ret; } - ret =nouveau_fence_sync (nvbo->bo.sync_obj, chan); + ret =validate_sync (chan, nvbo);if (unlikely (ret)) {NV_ERROR (dev,"fail post-validate sync\n" );return ret;
Greg KH
maintainerPATCH 22/55 drm/radeon/kms: disable output polling when suspended
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Seth Forshee <[email protected]>
commit 86698c20f71d488b32c49ed4687fb3cf8a88a5ca upstream.
Polling the outputs when the device is suspended can result in erroneous status updates. Disable output polling during suspend to prevent this from happening.
--- drivers/gpu/drm/radeon/radeon_device.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/radeon/radeon_device.c +4 -0
@@ -857,6 +857,8 @@ int radeon_suspend_kms(struct drm_deviceif (dev->switch_power_state ==DRM_SWITCH_POWER_OFF )return 0 ; +drm_kms_helper_poll_disable (dev); +/* turn off display hw */ list_for_each_entry (connector, &dev->mode_config.connector_list, head) {drm_helper_connector_dpms (connector,DRM_MODE_DPMS_OFF );
@@ -943,6 +945,8 @@ int radeon_resume_kms(struct drm_devicelist_for_each_entry (connector, &dev->mode_config.connector_list, head) {drm_helper_connector_dpms (connector,DRM_MODE_DPMS_ON ); } + +drm_kms_helper_poll_enable (dev);return 0 ; }
Greg KH
maintainerPATCH 23/55 sched/rt: Fix task stack corruption under __ARCH_WANT_INTERRUPTS_ON_CTXSW
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chanho Min <[email protected]>
commit cb297a3e433dbdcf7ad81e0564e7b804c941ff0d upstream.
This issue happens under the following conditions:
1. preemption is off
2. __ARCH_WANT_INTERRUPTS_ON_CTXSW is defined
3. RT scheduling class
4. SMP system
Sequence is as follows:
1.suppose current task is A. start schedule() 2.task A is enqueued pushable task at the entry of schedule()
__schedule
prev = rq->curr;
...
put_prev_task
put_prev_task_rt
enqueue_pushable_task
4.pick the task B as next task.
next = pick_next_task(rq);
3.rq->curr set to task B and context_switch is started.
rq->curr = next;
4.At the entry of context_swtich, release this cpu's rq->lock.
context_switch
prepare_task_switch
prepare_lock_switch
raw_spin_unlock_irq(&rq->lock);
5.Shortly after rq->lock is released, interrupt is occurred and start IRQ context
6.try_to_wake_up() which called by ISR acquires rq->lock
try_to_wake_up
ttwu_remote
rq = __task_rq_lock(p)
ttwu_do_wakeup(rq, p, wake_flags);
task_woken_rt
7.push_rt_task picks the task A which is enqueued before.
task_woken_rt
push_rt_tasks(rq)
next_task = pick_next_pushable_task(rq)
8.At find_lock_lowest_rq(), If double_lock_balance() returns 0,
lowest_rq can be the remote rq.
(But,If preemption is on, double_lock_balance always return 1 and it
does't happen.)
push_rt_task
find_lock_lowest_rq
if (double_lock_balance(rq, lowest_rq))..
9.find_lock_lowest_rq return the available rq. task A is migrated to
the remote cpu/rq.
push_rt_task
...
deactivate_task(rq, next_task, 0);
set_task_cpu(next_task, lowest_rq->cpu);
activate_task(lowest_rq, next_task, 0); 10. But, task A is on irq context at this cpu.
So, task A is scheduled by two cpus at the same time until restore from IRQ. Task A's stack is corrupted.
To fix it, don't migrate an RT task if it's still running.
--- kernel/sched_rt.c | 5 +++++ 1 file changed, 5 insertions(+)
kernel/sched_rt.c +5 -0
@@ -1390,6 +1390,11 @@ static int push_rt_task(struct rq *rq)if (!next_task)return 0 ; +#ifdef __ARCH_WANT_INTERRUPTS_ON_CTXSW +if (unlikely (task_running (rq, next_task))) +return 0 ; +#endif + retry:if (unlikely (next_task == rq->curr)) {WARN_ON (1 );
Greg KH
maintainerPATCH 24/55 ASoC: Ensure we generate a driver name
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit f0e8ed858edb327802ee65fd695cc1538286226f upstream.
Commit 873bd4c (ASoC: Don't set invalid name string to snd_card->driver field) broke generation of a driver name for all ASoC cards relying on the automatic generation of one. Fix this by using the old default with spaces replaced by underscores.
--- sound/soc/soc-core.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-)
sound/soc/soc-core.c +15 -3
@@ -30,6 +30,7 @@#include <linux/bitops.h> #include <linux/debugfs.h> #include <linux/platform_device.h> +#include <linux/ctype.h> #include <linux/slab.h> #include <sound/ac97_codec.h> #include <sound/core.h>
@@ -1931,9 +1932,20 @@ static void snd_soc_instantiate_card(str "%s", card->name);snprintf (card->snd_card->longname,sizeof (card->snd_card->longname),"%s" , card->long_name ? card->long_name : card->name); -if (card->driver_name) -strlcpy (card->snd_card->driver, card->driver_name, -sizeof (card->snd_card->driver)); +snprintf (card->snd_card->driver,sizeof (card->snd_card->driver), +"%s" , card->driver_name ? card->driver_name : card->name); +for (i =0 ; i <ARRAY_SIZE (card->snd_card->driver); i++) { +switch (card->snd_card->driver[i]) { +case '_' : +case '-' : +case '\0' : +break ; +default : +if (!isalnum (card->snd_card->driver[i])) + card->snd_card->driver[i] ='_' ; +break ; + } + }if (card->late_probe) { ret = card->late_probe (card);
Greg KH
maintainerPATCH 25/55 udf: Mark LVID buffer as uptodate before marking it dirty
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 853a0c25baf96b028de1654bea1e0c8857eadf3d upstream.
When we hit EIO while writing LVID, the buffer uptodate bit is cleared. This then results in an anoying warning from mark_buffer_dirty() when we write the buffer again. So just set uptodate flag unconditionally.
--- fs/udf/super.c | 6 ++++++ 1 file changed, 6 insertions(+)
fs/udf/super.c +6 -0
@@ -1830,6 +1830,12 @@ static void udf_close_lvid(struct super_ le16_to_cpu(lvid->descTag.descCRCLength))); lvid->descTag.tagChecksum =udf_tag_checksum (&lvid->descTag); +/* +* We set buffer uptodate unconditionally here to avoid spurious +* warnings from mark_buffer_dirty() when previous EIO has marked +* the buffer as !uptodate +*/ +set_buffer_uptodate (bh);mark_buffer_dirty (bh); sbi->s_lvid_dirty =0 ;mutex_unlock (&sbi->s_alloc_mutex);
Greg KH
maintainerPATCH 26/55 drm/i915: HDMI hot remove notification to audio driver
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wu Fengguang <[email protected]>
commit 2deed761188d7480eb5f7efbfe7aa77f09322ed8 upstream.
On HDMI monitor hot remove, clear SDVO_AUDIO_ENABLE accordingly, so that the audio driver will receive hot plug events and take action to refresh its device state and ELD contents.
The cleared SDVO_AUDIO_ENABLE bit needs to be restored to prevent losing HDMI audio after DPMS on.
--- drivers/gpu/drm/i915/intel_hdmi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_hdmi.c +6 -2
@@ -158,6 +158,10 @@ static void intel_hdmi_dpms(struct drm_estruct drm_i915_private *dev_priv = dev->dev_private;struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (encoder);u32 temp; +u32 enable_bits =SDVO_ENABLE ; + +if (intel_hdmi->has_audio) + enable_bits |=SDVO_AUDIO_ENABLE ; temp =I915_READ (intel_hdmi->sdvox_reg);
@@ -170,9 +174,9 @@ static void intel_hdmi_dpms(struct drm_e }if (mode !=DRM_MODE_DPMS_ON ) { - temp &= ~SDVO_ENABLE ; + temp &= ~enable_bits; }else { - temp |=SDVO_ENABLE ; + temp |= enable_bits; }I915_WRITE (intel_hdmi->sdvox_reg, temp);
Greg KH
maintainerPATCH 27/55 drm/i915: DisplayPort hot remove notification to audio driver
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wu Fengguang <[email protected]>
commit 832afda6a7d7235ef0e09f4ec46736861540da6d upstream.
On DP monitor hot remove, clear DP_AUDIO_OUTPUT_ENABLE accordingly, so that the audio driver will receive hot plug events and take action to refresh its device state and ELD contents.
Note that the DP_AUDIO_OUTPUT_ENABLE bit may be enabled or disabled only when the link training is complete and set to "Normal".
Tested OK for both hot plug/remove and DPMS on/off.
--- drivers/gpu/drm/i915/intel_dp.c | 1 + 1 file changed, 1 insertion(+)
drivers/gpu/drm/i915/intel_dp.c +1 -0
@@ -1554,6 +1554,7 @@ intel_dp_link_down(struct intel_dp *inteintel_wait_for_vblank (dev,to_intel_crtc (crtc)->pipe); } +DP &= ~DP_AUDIO_OUTPUT_ENABLE ;I915_WRITE (intel_dp->output_reg,DP & ~DP_PORT_EN );POSTING_READ (intel_dp->output_reg); }
Greg KH
maintainerPATCH 28/55 drm/i915: check ACTHD of all rings
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 097354eb14fa94d31a09c64d640643f58e4a5a9a upstream.
Otherwise hangcheck spuriously fires when running blitter/bsd-only workloads.
Contrary to a similar patch by Ben Widawsky this does not check INSTDONE of the other rings. Chris Wilson implied that in a failure to detect a hang, most likely because INSTDONE was fluctuating. Thus only check ACTHD, which as far as I know is rather reliable. Also, blitter and bsd rings can't launch complex tasks from a single instruction (like 3D_PRIM on the render with complex or even infinite shaders).
This fixes spurious gpu hang detection when running tests/gem_hangcheck_forcewake on snb/ivb.
--- drivers/gpu/drm/i915/i915_drv.h | 2 ++ drivers/gpu/drm/i915/i915_irq.c | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/i915_drv.h +2 -0
@@ -325,6 +325,8 @@ typedef struct drm_i915_private {struct timer_list hangcheck_timer;int hangcheck_count;uint32_t last_acthd; +uint32_t last_acthd_bsd; +uint32_t last_acthd_blt;uint32_t last_instdone;uint32_t last_instdone1;
drivers/gpu/drm/i915/i915_irq.c +10 -3
@@ -1665,7 +1665,7 @@ void i915_hangcheck_elapsed(unsigned lon {struct drm_device *dev = (struct drm_device *)data;drm_i915_private_t *dev_priv = dev->dev_private; -uint32_t acthd, instdone, instdone1; +uint32_t acthd, instdone, instdone1, acthd_bsd, acthd_blt;bool err = false;/* If all work is done then ACTHD clearly hasn't advanced. */
@@ -1679,16 +1679,21 @@ void i915_hangcheck_elapsed(unsigned lon }if (INTEL_INFO (dev)->gen <4 ) { - acthd =I915_READ (ACTHD ); instdone =I915_READ (INSTDONE ); instdone1 =0 ; }else { - acthd =I915_READ (ACTHD_I965 ); instdone =I915_READ (INSTDONE_I965 ); instdone1 =I915_READ (INSTDONE1 ); } + acthd =intel_ring_get_active_head (&dev_priv->ring[RCS ]); + acthd_bsd =HAS_BSD (dev) ? +intel_ring_get_active_head (&dev_priv->ring[VCS ]) :0 ; + acthd_blt =HAS_BLT (dev) ? +intel_ring_get_active_head (&dev_priv->ring[BCS ]) :0 ;if (dev_priv->last_acthd == acthd && + dev_priv->last_acthd_bsd == acthd_bsd && + dev_priv->last_acthd_blt == acthd_blt && dev_priv->last_instdone == instdone && dev_priv->last_instdone1 == instdone1) {if (dev_priv->hangcheck_count++ >1 ) {
@@ -1720,6 +1725,8 @@ void i915_hangcheck_elapsed(unsigned lon dev_priv->hangcheck_count =0 ; dev_priv->last_acthd = acthd; + dev_priv->last_acthd_bsd = acthd_bsd; + dev_priv->last_acthd_blt = acthd_blt; dev_priv->last_instdone = instdone; dev_priv->last_instdone1 = instdone1; }
Greg KH
maintainerPATCH 29/55 drm/i915: Fix TV Out refresh rate.
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rodrigo Vivi <[email protected]>
commit 23bd15ec662344dc10e9918fdd0dbc58bc71526d upstream.
TV Out refresh rate was half of the specification for almost all modes. Due to this reason pixel clock was so low for some modes causing flickering screen.
--- drivers/gpu/drm/i915/intel_tv.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
drivers/gpu/drm/i915/intel_tv.c +8 -8
@@ -417,7 +417,7 @@ static const struct tv_mode tv_modes[] = { .name = "NTSC-M", .clock = 108000, - .refresh = 29970, + .refresh = 59940, .oversample = TV_OVERSAMPLE_8X, .component_only = 0,/* 525 Lines, 60 Fields, 15.734KHz line, Sub-Carrier 3.580MHz */
@@ -460,7 +460,7 @@ static const struct tv_mode tv_modes[] = { .name = "NTSC-443", .clock = 108000, - .refresh = 29970, + .refresh = 59940, .oversample = TV_OVERSAMPLE_8X, .component_only = 0,/* 525 Lines, 60 Fields, 15.734KHz line, Sub-Carrier 4.43MHz */
@@ -502,7 +502,7 @@ static const struct tv_mode tv_modes[] = { .name = "NTSC-J", .clock = 108000, - .refresh = 29970, + .refresh = 59940, .oversample = TV_OVERSAMPLE_8X, .component_only = 0,
@@ -545,7 +545,7 @@ static const struct tv_mode tv_modes[] = { .name = "PAL-M", .clock = 108000, - .refresh = 29970, + .refresh = 59940, .oversample = TV_OVERSAMPLE_8X, .component_only = 0,
@@ -589,7 +589,7 @@ static const struct tv_mode tv_modes[] =/* 625 Lines, 50 Fields, 15.625KHz line, Sub-Carrier 4.434MHz */ .name = "PAL-N", .clock = 108000, - .refresh = 25000, + .refresh = 50000, .oversample = TV_OVERSAMPLE_8X, .component_only = 0,
@@ -634,7 +634,7 @@ static const struct tv_mode tv_modes[] =/* 625 Lines, 50 Fields, 15.625KHz line, Sub-Carrier 4.434MHz */ .name = "PAL", .clock = 108000, - .refresh = 25000, + .refresh = 50000, .oversample = TV_OVERSAMPLE_8X, .component_only = 0,
@@ -821,7 +821,7 @@ static const struct tv_mode tv_modes[] = { .name = "1080i@50Hz", .clock = 148800, - .refresh = 25000, + .refresh = 50000, .oversample = TV_OVERSAMPLE_2X, .component_only = 1,
@@ -847,7 +847,7 @@ static const struct tv_mode tv_modes[] = { .name = "1080i@60Hz", .clock = 148800, - .refresh = 30000, + .refresh = 60000, .oversample = TV_OVERSAMPLE_2X, .component_only = 1,
Greg KH
maintainerPATCH 30/55 drm/i915: handle 3rd pipe
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eugeni Dodonov <[email protected]>
commit 07c1e8c1462fa7324de4c36ae9e55da2abd79cee upstream.
We don't need to check 3rd pipe specifically, as it shares PLL with some other one.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=41977
--- drivers/gpu/drm/i915/i915_suspend.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/i915_suspend.c +4 -0
@@ -34,6 +34,10 @@ static bool i915_pipe_enabled(struct drmstruct drm_i915_private *dev_priv = dev->dev_private;u32 dpll_reg; +/* On IVB, 3rd pipe shares PLL with another one */ +if (pipe >1 ) +return false; +if (HAS_PCH_SPLIT (dev)) dpll_reg = (pipe ==PIPE_A ) ? _PCH_DPLL_A : _PCH_DPLL_B;else
Greg KH
maintainerPATCH 31/55 eCryptfs: Infinite loop due to overflow in ecryptfs_write()
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Li Wang <[email protected]>
commit 684a3ff7e69acc7c678d1a1394fe9e757993fd34 upstream.
ecryptfs_write() can enter an infinite loop when truncating a file to a size larger than 4G. This only happens on architectures where size_t is represented by 32 bits.
This was caused by a size_t overflow due to it incorrectly being used to store the result of a calculation which uses potentially large values of type loff_t.
--- fs/ecryptfs/read_write.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/ecryptfs/read_write.c +2 -2
@@ -130,7 +130,7 @@ int ecryptfs_write(struct inode *ecryptfpgoff_t ecryptfs_page_idx = (pos >>PAGE_CACHE_SHIFT );size_t start_offset_in_page = (pos & ~PAGE_CACHE_MASK );size_t num_bytes = (PAGE_CACHE_SIZE - start_offset_in_page); -size_t total_remaining_bytes = ((offset + size) - pos); +loff_t total_remaining_bytes = ((offset + size) - pos);if (fatal_signal_pending (current)) { rc = -EINTR ;
@@ -141,7 +141,7 @@ int ecryptfs_write(struct inode *ecryptf num_bytes = total_remaining_bytes;if (pos < offset) {/* remaining zeros to write, up to destination offset */ -size_t total_remaining_zeros = (offset - pos); +loff_t total_remaining_zeros = (offset - pos);if (num_bytes > total_remaining_zeros) num_bytes = total_remaining_zeros;
Greg KH
maintainerPATCH 32/55 cifs: Fix oops in session setup code for null user mounts
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Shirish Pargaonkar <[email protected]>
commit de47a4176c532ef5961b8a46a2d541a3517412d3 upstream.
For null user mounts, do not invoke string length function during session setup.
--- fs/cifs/sess.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
fs/cifs/sess.c +3 -4
@@ -244,16 +244,15 @@ static void ascii_ssetup_strings(char **/* copy user */ /* BB what about null user mounts - check that we do this BB */ /* copy user */ -if (ses->user_name !=NULL ) +if (ses->user_name !=NULL ) {strncpy (bcc_ptr, ses->user_name,MAX_USERNAME_SIZE ); + bcc_ptr +=strnlen (ses->user_name,MAX_USERNAME_SIZE ); + }/* else null user mount */ - - bcc_ptr +=strnlen (ses->user_name,MAX_USERNAME_SIZE ); *bcc_ptr =0 ; bcc_ptr++;/* account for null termination */ /* copy domain */ -if (ses->domainName !=NULL ) {strncpy (bcc_ptr, ses->domainName,256 ); bcc_ptr +=strnlen (ses->domainName,256 );
Greg KH
maintainerPATCH 33/55 atmel_lcdfb: fix usage of CONTRAST_CTR in suspend/resume
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hubert Feurstein <[email protected]>
commit 9f1065032ceb7e86c7c9f16bb86518857e88a172 upstream.
An error was existing in the saving of CONTRAST_CTR register across suspend/resume.
--- drivers/video/atmel_lcdfb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/video/atmel_lcdfb.c +1 -1
@@ -1085,7 +1085,7 @@ static int atmel_lcdfb_suspend(struct pl*/ lcdc_writel (sinfo,ATMEL_LCDC_IDR , ~0UL ); - sinfo->saved_lcdcon =lcdc_readl (sinfo,ATMEL_LCDC_CONTRAST_VAL ); + sinfo->saved_lcdcon =lcdc_readl (sinfo,ATMEL_LCDC_CONTRAST_CTR );lcdc_writel (sinfo,ATMEL_LCDC_CONTRAST_CTR ,0 );if (sinfo->atmel_lcdfb_power_control) sinfo->atmel_lcdfb_power_control (0 );
Greg KH
maintainerPATCH 34/55 lockdep, bug: Exclude TAINT_FIRMWARE_WORKAROUND from disabling lockdep
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Zijlstra <[email protected]>
commit df754e6af2f237a6c020c0daff55a1a609338e31 upstream.
It's unlikely that TAINT_FIRMWARE_WORKAROUND causes false lockdep messages, so do not disable lockdep in that case. We still want to keep lockdep disabled in the TAINT_OOT_MODULE case:
- bin-only modules can cause various instabilities in their and in unrelated kernel code
- they are impossible to debug for kernel developers
- they also typically do not have the copyright license permission to link to the GPL-ed lockdep code.
--- kernel/panic.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
kernel/panic.c +10 -2
@@ -236,8 +236,16 @@ void add_taint(unsigned flag)* Also we want to keep up lockdep for staging development and * post-warning case. */ -if (flag !=TAINT_CRAP && flag !=TAINT_WARN &&__debug_locks_off ()) -printk (KERN_WARNING "Disabling lock debugging due to kernel taint\n" ); +switch (flag) { +case TAINT_CRAP : +case TAINT_WARN : +case TAINT_FIRMWARE_WORKAROUND : +break ; + +default : +if (__debug_locks_off ()) +printk (KERN_WARNING "Disabling lock debugging due to kernel taint\n" ); + }set_bit (flag, &tainted_mask); }
Greg KH
maintainerPATCH 35/55 hwmon: (w83627ehf) Fix number of fans for NCT6776F
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit 585c0fd8216e0c9f98e2434092af7ec0f999522d upstream.
NCT6776F can select fan input pins for fans 3 to 5 with a secondary set of chip register bits. Check that second set of bits in addition to the first set to detect if fans 3..5 are monitored.
--- drivers/hwmon/w83627ehf.c | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-)
drivers/hwmon/w83627ehf.c +23 -3
@@ -2104,9 +2104,29 @@ static int __devinit w83627ehf_probe(str fan4min =0 ; fan5pin =0 ; }else if (sio_data->kind == nct6776) { - fan3pin = !(superio_inb (sio_data->sioreg,0x24 ) &0x40 ); - fan4pin = !!(superio_inb (sio_data->sioreg,0x1C ) &0x01 ); - fan5pin = !!(superio_inb (sio_data->sioreg,0x1C ) &0x02 ); +bool gpok =superio_inb (sio_data->sioreg,0x27 ) &0x80 ; +u8 regval; + +superio_select (sio_data->sioreg,W83627EHF_LD_HWM ); + regval =superio_inb (sio_data->sioreg,SIO_REG_ENABLE ); + +if (regval &0x80 ) + fan3pin = gpok; +else + fan3pin = !(superio_inb (sio_data->sioreg,0x24 ) &0x40 ); + +if (regval &0x40 ) + fan4pin = gpok; +else + fan4pin = !!(superio_inb (sio_data->sioreg,0x1C ) + &0x01 ); + +if (regval &0x20 ) + fan5pin = gpok; +else + fan5pin = !!(superio_inb (sio_data->sioreg,0x1C ) + &0x02 ); + fan4min = fan4pin; }else if (sio_data->kind == w83667hg || sio_data->kind == w83667hg_b) { fan3pin =1 ;
Greg KH
maintainerPATCH 36/55 ASoC: wm_hubs: Fix routing of input PGAs to line output mixer
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit ee76744c51ec342df9822b4a85dbbfc3887b6d60 upstream.
IN1L/R is routed to both line output mixers, we don't route IN1 to LINEOUT1 and IN2 to LINEOUT2.
--- sound/soc/codecs/wm_hubs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
sound/soc/codecs/wm_hubs.c +4 -4
@@ -562,8 +562,8 @@ SOC_DAPM_SINGLE("Left Output Switch", WM };static const struct snd_kcontrol_new line2_mix[] = { -SOC_DAPM_SINGLE ("IN2R Switch" ,WM8993_LINE_MIXER2 ,2 ,1 ,0 ), -SOC_DAPM_SINGLE ("IN2L Switch" ,WM8993_LINE_MIXER2 ,1 ,1 ,0 ), +SOC_DAPM_SINGLE ("IN1R Switch" ,WM8993_LINE_MIXER2 ,2 ,1 ,0 ), +SOC_DAPM_SINGLE ("IN1L Switch" ,WM8993_LINE_MIXER2 ,1 ,1 ,0 ),SOC_DAPM_SINGLE ("Output Switch" ,WM8993_LINE_MIXER2 ,0 ,1 ,0 ), };
@@ -808,8 +808,8 @@ static const struct snd_soc_dapm_route l };static const struct snd_soc_dapm_route lineout2_diff_routes[] = { - {"LINEOUT2 Mixer" ,"IN2L Switch" ,"IN2L PGA" }, - {"LINEOUT2 Mixer" ,"IN2R Switch" ,"IN2R PGA" }, + {"LINEOUT2 Mixer" ,"IN1L Switch" ,"IN1L PGA" }, + {"LINEOUT2 Mixer" ,"IN1R Switch" ,"IN1R PGA" }, {"LINEOUT2 Mixer" ,"Output Switch" ,"Right Output PGA" }, {"LINEOUT2N Driver" ,NULL ,"LINEOUT2 Mixer" },
Greg KH
maintainerPATCH 37/55 ASoC: wm_hubs: Correct line input to line output 2 paths
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 43b6cec27e1e50a1de3eff47e66e502f3fe7e66e upstream.
The second line output mixer has the controls for the line input bypasses in the opposite order.
--- sound/soc/codecs/wm_hubs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/wm_hubs.c +2 -2
@@ -562,8 +562,8 @@ SOC_DAPM_SINGLE("Left Output Switch", WM };static const struct snd_kcontrol_new line2_mix[] = { -SOC_DAPM_SINGLE ("IN1R Switch" ,WM8993_LINE_MIXER2 ,2 ,1 ,0 ), -SOC_DAPM_SINGLE ("IN1L Switch" ,WM8993_LINE_MIXER2 ,1 ,1 ,0 ), +SOC_DAPM_SINGLE ("IN1L Switch" ,WM8993_LINE_MIXER2 ,2 ,1 ,0 ), +SOC_DAPM_SINGLE ("IN1R Switch" ,WM8993_LINE_MIXER2 ,1 ,1 ,0 ),SOC_DAPM_SINGLE ("Output Switch" ,WM8993_LINE_MIXER2 ,0 ,1 ,0 ), };
Greg KH
maintainerPATCH 38/55 ASoC: wm8962: Fix word length configuration
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Susan Gao <[email protected]>
commit 2b6712b19531e22455e7fa18371c5ba9eec76699 upstream.
--- sound/soc/codecs/wm8962.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
sound/soc/codecs/wm8962.c +3 -3
@@ -2975,13 +2975,13 @@ static int wm8962_hw_params(struct snd_pcase SNDRV_PCM_FORMAT_S16_LE :break ;case SNDRV_PCM_FORMAT_S20_3LE : - aif0 |=0x40 ; + aif0 |=0x4 ;break ;case SNDRV_PCM_FORMAT_S24_LE : - aif0 |=0x80 ; + aif0 |=0x8 ;break ;case SNDRV_PCM_FORMAT_S32_LE : - aif0 |=0xc0 ; + aif0 |=0xc ;break ;default :return -EINVAL ;
Greg KH
maintainerPATCH 39/55 pcmcia: fix socket refcount decrementing on each resume
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russell King <[email protected]>
commit 025e4ab3db07fcbf62c01e4f30d1012234beb980 upstream.
This fixes a memory-corrupting bug: not only does it cause the warning, but as a result of dropping the refcount to zero, it causes the pcmcia_socket0 device structure to be freed while it still has references, causing slab caches corruption. A fatal oops quickly follows this warning - often even just a 'dmesg' following the warning causes the kernel to oops.
While testing suspend/resume on an ARM device with PCMCIA support, and a CF card inserted, I found that after five suspend and resumes, the kernel would complain, and shortly die after with slab corruption.
WARNING: at include/linux/kref.h:41 kobject_get+0x28/0x50()
As the message doesn't give a clue about which kobject, and the built-in debugging in drivers/base/power/main.c happens too late, this was added right before each get_device():
printk("%s: %p [%s] %u\n", __func__, dev, kobject_name(&dev->kobj), atomic_read(&dev->kobj.kref.refcount));and on the 3rd s2ram cycle, the following behaviour observed:
On the 3rd suspend/resume cycle:
dpm_prepare: c1a0d998 [pcmcia_socket0] 3
dpm_suspend: c1a0d998 [pcmcia_socket0] 3
dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 3
dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 3
dpm_resume: c1a0d998 [pcmcia_socket0] 3
dpm_complete: c1a0d998 [pcmcia_socket0] 2
4th:
dpm_prepare: c1a0d998 [pcmcia_socket0] 2
dpm_suspend: c1a0d998 [pcmcia_socket0] 2
dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 2
dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 2
dpm_resume: c1a0d998 [pcmcia_socket0] 2
dpm_complete: c1a0d998 [pcmcia_socket0] 1
5th:
dpm_prepare: c1a0d998 [pcmcia_socket0] 1
dpm_suspend: c1a0d998 [pcmcia_socket0] 1
dpm_suspend_noirq: c1a0d998 [pcmcia_socket0] 1
dpm_resume_noirq: c1a0d998 [pcmcia_socket0] 1
dpm_resume: c1a0d998 [pcmcia_socket0] 1
dpm_complete: c1a0d998 [pcmcia_socket0] 0
------------[ cut here ]------------ WARNING: at include/linux/kref.h:41 kobject_get+0x28/0x50() Modules linked in: ucb1x00_core Backtrace: [<c0212090>] (dump_backtrace+0x0/0x110) from [<c04799dc>] (dump_stack+0x18/0x1c) [<c04799c4>] (dump_stack+0x0/0x1c) from [<c021cba0>] (warn_slowpath_common+0x50/0x68) [<c021cb50>] (warn_slowpath_common+0x0/0x68) from [<c021cbdc>] (warn_slowpath_null+0x24/0x28) [<c021cbb8>] (warn_slowpath_null+0x0/0x28) from [<c0335374>] (kobject_get+0x28/0x50) [<c033534c>] (kobject_get+0x0/0x50) from [<c03804f4>] (get_device+0x1c/0x24) [<c0388c90>] (dpm_complete+0x0/0x1a0) from [<c0389cc0>] (dpm_resume_end+0x1c/0x20) ...
[changelog edited to make quilt mail happy...]
As can be seen, the original function called pcmcia_get_socket() and pcmcia_put_socket() around the guts, whereas the replacement code calls pcmcia_put_socket() only in one path. This creates an imbalance in the refcounting.
Testing with pcmcia_put_socket() put removed shows that the bug is gone:
dpm_suspend: c1a10998 [pcmcia_socket0] 5
dpm_suspend_noirq: c1a10998 [pcmcia_socket0] 5
dpm_resume_noirq: c1a10998 [pcmcia_socket0] 5
dpm_resume: c1a10998 [pcmcia_socket0] 5
dpm_complete: c1a10998 [pcmcia_socket0] 5
--- drivers/pcmcia/ds.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/pcmcia/ds.c +1 -3
@@ -1269,10 +1269,8 @@ static int pcmcia_bus_add(struct pcmcia_static int pcmcia_bus_early_resume (struct pcmcia_socket *skt) { -if (!verify_cis_cache (skt)) { -pcmcia_put_socket (skt); +if (!verify_cis_cache (skt))return 0 ; - }dev_dbg (&skt->dev,"cis mismatch - different card\n" );
Greg KH
maintainerPATCH 40/55 mm: compaction: check for overlapping nodes during isolation for migration
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mel Gorman <[email protected]>
commit dc9086004b3d5db75997a645b3fe08d9138b7ad0 upstream.
When isolating pages for migration, migration starts at the start of a zone while the free scanner starts at the end of the zone. Migration avoids entering a new zone by never going beyond the free scanned.
Unfortunately, in very rare cases nodes can overlap. When this happens, migration isolates pages without the LRU lock held, corrupting lists which will trigger errors in reclaim or during page free such as in the following oops
BUG: unable to handle kernel NULL pointer dereference at 0000000000000008
IP: [<ffffffff810f795c>] free_pcppages_bulk+0xcc/0x450
PGD 1dda554067 PUD 1e1cb58067 PMD 0
Oops: 0000 [#1] SMP
CPU 37
Pid: 17088, comm: memcg_process_s Tainted: G X
RIP: free_pcppages_bulk+0xcc/0x450
Process memcg_process_s (pid: 17088, threadinfo ffff881c2926e000, task ffff881c2926c0c0)
Call Trace:
free_hot_cold_page+0x17e/0x1f0
__pagevec_free+0x90/0xb0
release_pages+0x22a/0x260
pagevec_lru_move_fn+0xf3/0x110
putback_lru_page+0x66/0xe0
unmap_and_move+0x156/0x180
migrate_pages+0x9e/0x1b0
compact_zone+0x1f3/0x2f0
compact_zone_order+0xa2/0xe0
try_to_compact_pages+0xdf/0x110
__alloc_pages_direct_compact+0xee/0x1c0
__alloc_pages_slowpath+0x370/0x830
__alloc_pages_nodemask+0x1b1/0x1c0
alloc_pages_vma+0x9b/0x160
do_huge_pmd_anonymous_page+0x160/0x270
do_page_fault+0x207/0x4c0
page_fault+0x25/0x30The "X" in the taint flag means that external modules were loaded but but is unrelated to the bug triggering. The real problem was because the PFN layout looks like this
Zone PFN ranges:
DMA 0x00000010 -> 0x00001000
DMA32 0x00001000 -> 0x00100000
Normal 0x00100000 -> 0x01e80000
Movable zone start PFN for each node
early_node_map[14] active PFN ranges
0: 0x00000010 -> 0x0000009b
0: 0x00000100 -> 0x0007a1ec
0: 0x0007a354 -> 0x0007a379
0: 0x0007f7ff -> 0x0007f800
0: 0x00100000 -> 0x00680000
1: 0x00680000 -> 0x00e80000
0: 0x00e80000 -> 0x01080000
1: 0x01080000 -> 0x01280000
0: 0x01280000 -> 0x01480000
1: 0x01480000 -> 0x01680000
0: 0x01680000 -> 0x01880000
1: 0x01880000 -> 0x01a80000
0: 0x01a80000 -> 0x01c80000
1: 0x01c80000 -> 0x01e80000The fix is straight-forward. isolate_migratepages() has to make a similar check to isolate_freepage to ensure that it never isolates pages from a zone it does not hold the LRU lock for.
This was discovered in a 3.0-based kernel but it affects 3.1.x, 3.2.x and current mainline.
--- mm/compaction.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
mm/compaction.c +10 -1
@@ -337,8 +337,17 @@ static isolate_migrate_t isolate_migratecontinue ; nr_scanned++; -/* Get the page and skip if free */ +/* +* Get the page and ensure the page is within the same zone. +* See the comment in isolate_freepages about overlapping +* nodes. It is deliberate that the new zone lock is not taken +* as memory compaction should not move pages between nodes. +*/ page =pfn_to_page (low_pfn); +if (page_zone (page) != zone) +continue ; + +/* Skip if free */ if (PageBuddy (page))continue ;
Greg KH
maintainerPATCH 41/55 mm: fix UP THP spin_is_locked BUGs
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hugh Dickins <[email protected]>
commit b9980cdcf2524c5fe15d8cbae9c97b3ed6385563 upstream.
Fix CONFIG_TRANSPARENT_HUGEPAGE=y CONFIG_SMP=n CONFIG_DEBUG_VM=y CONFIG_DEBUG_SPINLOCK=n kernel: spin_is_locked() is then always false, and so triggers some BUGs in Transparent HugePage codepaths.
asm-generic/bug.h mentions this problem, and provides a WARN_ON_SMP(x); but being too lazy to add VM_BUG_ON_SMP, BUG_ON_SMP, WARN_ON_SMP_ONCE, VM_WARN_ON_SMP_ONCE, just test NR_CPUS != 1 in the existing VM_BUG_ONs.
--- mm/huge_memory.c | 4 ++-- mm/swap.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-)
mm/huge_memory.c +2 -2
@@ -2020,7 +2020,7 @@ static void collect_mm_slot(struct mm_sl {struct mm_struct *mm = mm_slot->mm; -VM_BUG_ON (!spin_is_locked (&khugepaged_mm_lock)); +VM_BUG_ON (NR_CPUS !=1 && !spin_is_locked (&khugepaged_mm_lock));if (khugepaged_test_exit (mm)) {/* free mm_slot */
@@ -2048,7 +2048,7 @@ static unsigned int khugepaged_scan_mm_sint progress =0 ;VM_BUG_ON (!pages); -VM_BUG_ON (!spin_is_locked (&khugepaged_mm_lock)); +VM_BUG_ON (NR_CPUS !=1 && !spin_is_locked (&khugepaged_mm_lock));if (khugepaged_scan.mm_slot) mm_slot = khugepaged_scan.mm_slot;
mm/swap.c +1 -1
@@ -667,7 +667,7 @@ void lru_add_page_tail(struct zone* zoneVM_BUG_ON (!PageHead (page));VM_BUG_ON (PageCompound (page_tail));VM_BUG_ON (PageLRU (page_tail)); -VM_BUG_ON (!spin_is_locked (&zone->lru_lock)); +VM_BUG_ON (NR_CPUS !=1 && !spin_is_locked (&zone->lru_lock));SetPageLRU (page_tail);
Greg KH
maintainerPATCH 42/55 target: Use correct preempted registration sense code
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Sanvido <[email protected]>
commit 9e08e34e3735ae057eb3834da3570995811b7eb9 upstream.
The comments quote the right parts of the spec:
* d) Establish a unit attention condition for the
* initiator port associated with every I_T nexus * that lost its registration other than the I_T * nexus on which the PERSISTENT RESERVE OUT command * was received, with the additional sense code set * to REGISTRATIONS PREEMPTED.
and
* e) Establish a unit attention condition for the initiator
* port associated with every I_T nexus that lost its * persistent reservation and/or registration, with the * additional sense code set to REGISTRATIONS PREEMPTED;
but the actual code accidentally uses ASCQ_2AH_RESERVATIONS_PREEMPTED instead of ASCQ_2AH_REGISTRATIONS_PREEMPTED. Fix this.
--- drivers/target/target_core_pr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/target/target_core_pr.c +2 -2
@@ -3079,7 +3079,7 @@ static int core_scsi3_pro_preempt(if (!(calling_it_nexus))core_scsi3_ua_allocate (pr_reg_nacl, pr_res_mapped_lun,0x2A , -ASCQ_2AH_RESERVATIONS_PREEMPTED ); +ASCQ_2AH_REGISTRATIONS_PREEMPTED ); }spin_unlock (&pr_tmpl->registration_lock);/*
@@ -3191,7 +3191,7 @@ static int core_scsi3_pro_preempt(* additional sense code set to REGISTRATIONS PREEMPTED; */ core_scsi3_ua_allocate (pr_reg_nacl, pr_res_mapped_lun,0x2A , -ASCQ_2AH_RESERVATIONS_PREEMPTED ); +ASCQ_2AH_REGISTRATIONS_PREEMPTED ); }spin_unlock (&pr_tmpl->registration_lock);/*
Greg KH
maintainerPATCH 43/55 target: Allow PERSISTENT RESERVE IN for non-reservation holder
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marco Sanvido <[email protected]>
commit 6816966a8418b980481b4dced7eddd1796b145e8 upstream.
Initiators that aren't the active reservation holder should be able to do a PERSISTENT RESERVE IN command in all cases, so add it to the list of allowed CDBs in core_scsi3_pr_seq_non_holder().
--- drivers/target/target_core_pr.c | 1 + 1 file changed, 1 insertion(+)
drivers/target/target_core_pr.c +1 -0
@@ -471,6 +471,7 @@ static int core_scsi3_pr_seq_non_holder(case READ_MEDIA_SERIAL_NUMBER :case REPORT_LUNS :case REQUEST_SENSE : +case PERSISTENT_RESERVE_IN : ret =0 ;/*/ Allowed CDBs */ break ;default :
Greg KH
maintainerPATCH 44/55 target: Correct sense key for INVALID FIELD IN {PARAMETER LIST,CDB}
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roland Dreier <[email protected]>
commit 9fbc8909876a2160044e71d376848973b9bfdc3f upstream.
According to SPC-4, the sense key for commands that are failed with INVALID FIELD IN PARAMETER LIST and INVALID FIELD IN CDB should be ILLEGAL REQUEST (5h) rather than ABORTED COMMAND (Bh). Without this patch, a tcm_loop LUN incorrectly gives:
# sg_raw -r 1 -v /dev/sda 3 1 0 0 ff 0
Sense Information:
Fixed format, current; Sense key: Aborted Command
Additional sense: Invalid field in cdb
Raw sense data (in hex):
70 00 0b 00 00 00 00 0a 00 00 00 00 24 00 00 00
00 00While a real SCSI disk gives:
Sense Information:
Fixed format, current; Sense key: Illegal Request Additional sense: Invalid field in cdb
Raw sense data (in hex):
70 00 05 00 00 00 00 18 00 00 00 00 24 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
with the main point being that the real disk gives a sense key of ILLEGAL REQUEST (5h).
--- drivers/target/target_core_transport.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/target/target_core_transport.c +4 -4
@@ -5709,8 +5709,8 @@ int transport_send_check_condition_and_s/* CURRENT ERROR */ buffer[offset] =0x70 ; buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ; -/* ABORTED COMMAND */ - buffer[offset+SPC_SENSE_KEY_OFFSET ] =ABORTED_COMMAND ; +/* ILLEGAL REQUEST */ + buffer[offset+SPC_SENSE_KEY_OFFSET ] =ILLEGAL_REQUEST ;/* INVALID FIELD IN CDB */ buffer[offset+SPC_ASC_KEY_OFFSET ] =0x24 ;break ;
@@ -5718,8 +5718,8 @@ int transport_send_check_condition_and_s/* CURRENT ERROR */ buffer[offset] =0x70 ; buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ; -/* ABORTED COMMAND */ - buffer[offset+SPC_SENSE_KEY_OFFSET ] =ABORTED_COMMAND ; +/* ILLEGAL REQUEST */ + buffer[offset+SPC_SENSE_KEY_OFFSET ] =ILLEGAL_REQUEST ;/* INVALID FIELD IN PARAMETER LIST */ buffer[offset+SPC_ASC_KEY_OFFSET ] =0x26 ;break ;
Greg KH
maintainerPATCH 45/55 Staging: asus_oled: fix image processing
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pekka Paalanen <[email protected]>
commit 635032cb397b396241372fa0ff36ae758e658b23 upstream.
Programming an image was broken, because odev->buf_offs was not advanced for val == 0 in append_values(). This regression was introduced in:
commit 1ff12a4aa354bed093a0240d5e6347b1e27601bc
Author: Kevin A. Granade <[email protected]>
Date: Sat Sep 5 01:03:39 2009 -0500
Staging: asus_oled: Cleaned up checkpatch issues.
Fix the image processing by special-casing val == 0.
I have tested this change on an Asus G50V laptop only.
--- drivers/staging/asus_oled/asus_oled.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/staging/asus_oled/asus_oled.c +8 -2
@@ -355,7 +355,14 @@ static void send_data(struct asus_oled_dstatic int append_values (struct asus_oled_dev *odev,uint8_t val,size_t count) { -while (count-- >0 && val) { + odev->last_val = val; + +if (val ==0 ) { + odev->buf_offs += count; +return 0 ; + } + +while (count-- >0 ) {size_t x = odev->buf_offs % odev->width;size_t y = odev->buf_offs / odev->width;size_t i;
@@ -406,7 +413,6 @@ static int append_values(struct asus_ole ; } - odev->last_val = val; odev->buf_offs++; }
Greg KH
maintainerPATCH 46/55 Staging: asus_oled: fix NULL-ptr crash on unloading
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Pekka Paalanen <[email protected]>
commit 3589e74595a4332ebf77b5ed006f3c6686071ecd upstream.
Asus_oled triggers the following bug on module unloading:
usbcore: deregistering interface driver asus-oled
BUG: unable to handle kernel NULL pointer dereference at 0000000000000038 IP: [<ffffffff8111292b>] sysfs_delete_link+0x30/0x66 Call Trace: [<ffffffff81225373>] device_remove_class_symlinks+0x6b/0x70 [<ffffffff812256a8>] device_del+0x9f/0x1ab [<ffffffff812257c5>] device_unregister+0x11/0x1e [<ffffffffa000cb82>] asus_oled_disconnect+0x4f/0x9e [asus_oled] [<ffffffff81277430>] usb_unbind_interface+0x54/0x103 [<ffffffff812276c4>] __device_release_driver+0xa2/0xeb [<ffffffff81227794>] driver_detach+0x87/0xad [<ffffffff812269e9>] bus_remove_driver+0x91/0xc1 [<ffffffff81227fb4>] driver_unregister+0x66/0x6e [<ffffffff812771ed>] usb_deregister+0xbb/0xc4 [<ffffffffa000ce87>] asus_oled_exit+0x2f/0x31 [asus_oled] [<ffffffff81068365>] sys_delete_module+0x1b8/0x21b [<ffffffff810ae3de>] ? do_munmap+0x2ef/0x313 [<ffffffff813699bb>] system_call_fastpath+0x16/0x1b
This is due to an incorrect destruction sequence in asus_oled_exit().
Fix the order, fixes the bug. Tested on an Asus G50V laptop only.
--- drivers/staging/asus_oled/asus_oled.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/asus_oled/asus_oled.c +1 -2
@@ -811,10 +811,9 @@ error: static void __exit asus_oled_exit(void) { +usb_deregister (&oled_driver);class_remove_file (oled_class, &class_attr_version.attr);class_destroy (oled_class); - -usb_deregister (&oled_driver); }module_init (asus_oled_init);
Greg KH
maintainerPATCH 47/55 staging: r8712u: Add new Sitecom UsB ID
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 1793bf1deddc8ce25dc41925d5dbe64536c841b6 upstream.
Add USB ID for SITECOM WLA-1000 V1 001 WLAN
--- drivers/staging/rtl8712/usb_intf.c | 1 + 1 file changed, 1 insertion(+)
drivers/staging/rtl8712/usb_intf.c +1 -0
@@ -86,6 +86,7 @@ static struct usb_device_id rtl871x_usb_ {USB_DEVICE(0x0DF6, 0x0045)}, {USB_DEVICE(0x0DF6, 0x0059)}, /* 11n mode disable */ {USB_DEVICE(0x0DF6, 0x004B)}, + {USB_DEVICE(0x0DF6, 0x005B)}, {USB_DEVICE(0x0DF6, 0x005D)}, {USB_DEVICE(0x0DF6, 0x0063)},/* Sweex */
Greg KH
maintainerPATCH 48/55 usb: gadget: zero: fix bug in loopback autoresume handling
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timo Juhani Lindfors <[email protected]>
commit 683da59d7b8ae04891636d4b59893cd4e9b0b7e5 upstream.
ab943a2e125b (USB: gadget: gadget zero uses new suspend/resume hooks) introduced a copy-paste error where f_loopback.c writes to a variable declared in f_sourcesink.c. This prevents one from creating gadgets that only have a loopback function.
--- drivers/usb/gadget/f_loopback.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/gadget/f_loopback.c +1 -1
@@ -373,7 +373,7 @@ int __init loopback_add(struct usb_compo/* support autoresume for remote wakeup testing */ if (autoresume) - sourcesink_driver.bmAttributes |=USB_CONFIG_ATT_WAKEUP ; + loopback_driver.bmAttributes |=USB_CONFIG_ATT_WAKEUP ;/* support OTG systems */ if (gadget_is_otg (cdev->gadget)) {
Greg KH
maintainerPATCH 49/55 usb: Skip PCI USB quirk handling for Netlogic XLP
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jayachandran C <[email protected]>
commit e4436a7c17ac2b5e138f93f83a541cba9b311685 upstream.
The Netlogic XLP SoC's on-chip USB controller appears as a PCI USB device, but does not need the EHCI/OHCI handoff done in usb/host/pci-quirks.c.
The pci-quirks.c is enabled for all vendors and devices, and is enabled if USB and PCI are configured.
If we do not skip the qurik handling on XLP, the readb() call in ehci_bios_handoff() will cause a crash since byte access is not supported for EHCI registers in XLP.
--- drivers/usb/host/pci-quirks.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/usb/host/pci-quirks.c +6 -0
@@ -866,6 +866,12 @@ hc_init:static void __devinit quirk_usb_early_handoff (struct pci_dev *pdev) { +/* Skip Netlogic mips SoC's internal PCI USB controller. +* This device does not need/support EHCI/OHCI handoff +*/ +if (pdev->vendor ==0x184e )/* vendor Netlogic */ +return ; +if (pdev->class ==PCI_CLASS_SERIAL_USB_UHCI )quirk_usb_handoff_uhci (pdev);else if (pdev->class ==PCI_CLASS_SERIAL_USB_OHCI )
Greg KH
maintainerPATCH 50/55 USB: usbserial: add new PID number (0xa951) to the ftdi driver
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Milan Kocian <[email protected]>
commit 90451e6973a5da155c6f315a409ca0a8d3ce6b76 upstream.
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 7 +++++++ 2 files changed, 8 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -838,6 +838,7 @@ static struct usb_device_id id_table_com { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LOGBOOKML_PID) }, { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_LS_LOGBOOK_PID) }, { USB_DEVICE(FTDI_VID, FTDI_SCIENCESCOPE_HS_LOGBOOK_PID) }, + { USB_DEVICE(FTDI_VID, FTDI_CINTERION_MC55I_PID) }, { USB_DEVICE(FTDI_VID, FTDI_DOTEC_PID) }, { USB_DEVICE(QIHARDWARE_VID, MILKYMISTONE_JTAGSERIAL_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
drivers/usb/serial/ftdi_sio_ids.h +7 -0
@@ -1187,3 +1187,10 @@*/ /* ZigBee controller */ #define FTDI_RF_R106 0x8A28 + +/* +* Product: HCP HIT GPRS modem +* Manufacturer: HCP d.o.o. +* ATI command output: Cinterion MC55i +*/ +#define FTDI_CINTERION_MC55I_PID 0xA951
Greg KH
maintainerPATCH 51/55 USB: add new zte 3g-dongles pid to option.c
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rui li <[email protected]>
commit 1608ea5f4b5d6262cd6e808839491cfb2a67405a upstream.
As ZTE have and will use more pid for new products this year, so we need to add some new zte 3g-dongle's pid on option.c , and delete one pid 0x0154 because it use for mass-storage port.
--- drivers/usb/serial/option.c | 129 +++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 128 insertions(+), 1 deletion(-)
drivers/usb/serial/option.c +128 -1
@@ -855,6 +855,18 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0083, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0086, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0087, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0088, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0089, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0090, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0091, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0092, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0093, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0094, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0095, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0096, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0097, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0098, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0099, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0104, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0105, 0xff, 0xff, 0xff) },
@@ -883,7 +895,6 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0151, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0152, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0153, 0xff, 0xff, 0xff) }, - { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0154, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0155, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0156, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0157, 0xff, 0xff, 0xff) },
@@ -892,6 +903,12 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0160, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0161, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0162, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0164, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0168, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0170, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0176, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0178, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1012, 0xff, 0xff, 0xff) },
@@ -1066,6 +1083,116 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1298, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1299, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1300, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1401, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1402, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1403, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1404, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1405, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1406, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1407, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1408, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1409, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1410, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1411, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1412, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1413, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1414, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1415, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1416, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1417, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1418, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1419, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1420, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1421, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1422, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1423, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1424, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1425, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1426, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1427, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1428, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1429, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1430, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1431, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1432, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1433, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1434, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1435, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1436, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1437, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1438, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1439, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1440, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1441, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1442, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1443, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1444, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1445, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1446, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1447, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1448, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1449, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1450, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1451, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1452, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1453, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1454, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1455, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1456, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1457, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1458, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1459, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1460, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1461, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1462, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1463, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1464, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1465, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1466, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1467, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1468, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1469, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1470, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1471, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1472, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1473, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1474, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1475, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1476, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1477, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1478, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1479, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1480, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1481, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1482, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1483, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1484, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1485, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1486, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1487, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1488, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1489, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1490, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1491, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1492, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1493, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1494, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1495, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1496, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1497, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1498, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1499, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1500, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1501, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1502, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1503, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1504, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1505, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1506, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1507, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1508, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1509, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1510, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0014, 0xff, 0xff, 0xff) }, /* ZTE CDMA products */ { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0027, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0059, 0xff, 0xff, 0xff) },
Greg KH
maintainerPATCH 52/55 mmc: cb710 core: Add missing spin_lock_init for irq_lock of struct cb710_chip
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Axel Lin <[email protected]>
commit b5266ea675c5a041e2852c7ccec4cf2d4f5e0cf4 upstream.
--- drivers/misc/cb710/core.c | 1 + 1 file changed, 1 insertion(+)
drivers/misc/cb710/core.c +1 -0
@@ -244,6 +244,7 @@ static int __devinit cb710_probe(structif (err)return err; +spin_lock_init (&chip->irq_lock); chip->pdev = pdev; chip->iobase =pcim_iomap_table (pdev)[0 ];
Greg KH
maintainerPATCH 53/55 powernow-k8: Avoid Pstate MSR accesses on systems supporting CPB
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Herrmann <[email protected]>
commit 201bf0f129e1715a33568d1563d9a75b840ab4d3 upstream.
Due to CPB we can't directly map SW Pstates to Pstate MSRs. Get rid of the paranoia check. (assuming that the ACPI Pstate information is correct.)
--- drivers/cpufreq/powernow-k8.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-)
drivers/cpufreq/powernow-k8.c +10 -9
@@ -926,23 +926,24 @@ static int fill_powernow_table_pstate(stinvalidate_entry (powernow_table, i);continue ; } -rdmsr (MSR_PSTATE_DEF_BASE + index, lo, hi); -if (!(hi &HW_PSTATE_VALID_MASK )) { -pr_debug ("invalid pstate %d, ignoring\n" , index); -invalidate_entry (powernow_table, i); -continue ; - } - - powernow_table[i].index = index; -/* Frequency may be rounded for these */ if ((boot_cpu_data.x86 ==0x10 && boot_cpu_data.x86_model <10 ) || boot_cpu_data.x86 ==0x11 ) { + +rdmsr (MSR_PSTATE_DEF_BASE + index, lo, hi); +if (!(hi &HW_PSTATE_VALID_MASK )) { +pr_debug ("invalid pstate %d, ignoring\n" , index); +invalidate_entry (powernow_table, i); +continue ; + } + powernow_table[i].frequency =freq_from_fid_did (lo &0x3f , (lo >>6 ) &7 ); }else powernow_table[i].frequency = data->acpi_data.states[i].core_frequency *1000 ; + + powernow_table[i].index = index; }return 0 ; }
Greg KH
maintainerPATCH 54/55 powernow-k8: Fix indexing issue
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Herrmann <[email protected]>
commit a8eb28480e9b637cc78b9aa5e08612ba97e1317a upstream.
The driver uses the pstate number from the status register as index in its table of ACPI pstates (powernow_table). This is wrong as this is not a 1-to-1 mapping.
For example we can have _PSS information to just utilize Pstate 0 and Pstate 4, ie.
powernow-k8: Core Performance Boosting: on.
powernow-k8: 0 : pstate 0 (2200 MHz)
powernow-k8: 1 : pstate 4 (1400 MHz)
In this example the driver's powernow_table has just 2 entries. Using the pstate number (4) as index into this table is just plain wrong.
--- drivers/cpufreq/powernow-k8.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
drivers/cpufreq/powernow-k8.c +11 -4
@@ -54,6 +54,9 @@ static DEFINE_PER_CPU(struct powernow_k8static int cpu_family =CPU_OPTERON ; +/* array to map SW pstate number to acpi state */ +static u32 ps_to_as[8 ]; +/* core performance boost */ static bool cpb_capable, cpb_enabled;static struct msr __percpu *msrs;
@@ -80,9 +83,9 @@ static u32 find_khz_freq_from_fid(u32 fi }static u32 find_khz_freq_from_pstate (struct cpufreq_frequency_table *data, -u32 pstate) +u32 pstate) { -return data[pstate].frequency; +return data[ps_to_as[pstate]].frequency; }/* Return the vco fid for an input fid
@@ -926,6 +929,9 @@ static int fill_powernow_table_pstate(stinvalidate_entry (powernow_table, i);continue ; } + + ps_to_as[index] = i; +/* Frequency may be rounded for these */ if ((boot_cpu_data.x86 ==0x10 && boot_cpu_data.x86_model <10 ) || boot_cpu_data.x86 ==0x11 ) {
@@ -1190,7 +1196,8 @@ static int powernowk8_target(struct cpufpowernow_k8_acpi_pst_values (data, newstate);if (cpu_family ==CPU_HW_PSTATE ) - ret =transition_frequency_pstate (data, newstate); + ret =transition_frequency_pstate (data, + data->powernow_table[newstate].index);else ret =transition_frequency_fidvid (data, newstate);if (ret) {
@@ -1203,7 +1210,7 @@ static int powernowk8_target(struct cpufif (cpu_family ==CPU_HW_PSTATE ) pol->cur =find_khz_freq_from_pstate (data->powernow_table, - newstate); + data->powernow_table[newstate].index);else pol->cur =find_khz_freq_from_fid (data->currfid); ret =0 ;
Greg KH
maintainerPATCH 55/55 net: fix NULL dereferences in check_peer_redir()
In reply to Greg KH3.0-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit d3aaeb38c40e5a6c08dd31a1b64da65c4352be36, along
with dependent backports of commits:
69cce1d1404968f78b177a0314f5822d5afdbbfb
9de79c127cccecb11ae6a21ab1499e87aa222880
218fa90f072e4aeff9003d57e390857f4f35513e
580da35a31f91a594f3090b7a2c39b85cb051a12
f7e57044eeb1841847c24aa06766c8290c202583
e049f28883126c689cf95859480d9ee4ab23b7fa ]Gergely Kalman reported crashes in check_peer_redir().
It appears commit f39925dbde778 (ipv4: Cache learned redirect information in inetpeer.) added a race, leading to possible NULL ptr dereference.
Since we can now change dst neighbour, we should make sure a reader can safely use a neighbour.
Add RCU protection to dst neighbour, and make sure check_peer_redir() can be called safely by different cpus in parallel.
As neighbours are already freed after one RCU grace period, this patch should not add typical RCU penalty (cache cold effects)
Many thanks to Gergely for providing a pretty report pointing to the bug.
--- drivers/infiniband/core/addr.c | 16 ++++-- drivers/infiniband/hw/cxgb3/iwch_cm.c | 16 +++++- drivers/infiniband/hw/cxgb4/cm.c | 46 ++++++++++--------- drivers/infiniband/hw/mlx4/qp.c | 2 drivers/infiniband/hw/nes/nes_cm.c | 8 ++- drivers/infiniband/ulp/ipoib/ipoib_main.c | 59 ++++++++++++++++--------- drivers/infiniband/ulp/ipoib/ipoib_multicast.c | 24 ++++++---- drivers/net/cxgb3/cxgb3_offload.c | 8 +-- drivers/s390/net/qeth_l3_main.c | 23 +++++++-- drivers/scsi/cxgbi/cxgb3i/cxgb3i.c | 2 drivers/scsi/cxgbi/cxgb4i/cxgb4i.c | 2 drivers/scsi/cxgbi/libcxgbi.c | 4 - include/net/arp.h | 1 include/net/dst.h | 27 ++++++++++- net/atm/clip.c | 16 ++++-- net/bridge/br_netfilter.c | 6 +- net/core/dst.c | 15 ++++-- net/core/neighbour.c | 19 +++++--- net/decnet/dn_neigh.c | 8 +-- net/decnet/dn_route.c | 18 ++++--- net/ipv4/arp.c | 28 +++++++---- net/ipv4/ip_gre.c | 2 net/ipv4/ip_output.c | 22 +++++++-- net/ipv4/route.c | 31 ++++++++----- net/ipv6/addrconf.c | 2 net/ipv6/ip6_fib.c | 2 net/ipv6/ip6_output.c | 40 +++++++++++++--- net/ipv6/ndisc.c | 4 - net/ipv6/route.c | 59 +++++++++++++++---------- net/ipv6/sit.c | 4 - net/sched/sch_teql.c | 31 ++++++++----- net/xfrm/xfrm_policy.c | 2 32 files changed, 358 insertions(+), 189 deletions(-)
drivers/infiniband/core/addr.c +10 -6
@@ -215,7 +215,9 @@ static int addr4_resolve(struct sockaddr neigh =neigh_lookup (&arp_tbl, &rt->rt_gateway, rt->dst.dev);if (!neigh || !(neigh->nud_state &NUD_VALID )) { -neigh_event_send (rt->dst.neighbour,NULL ); +rcu_read_lock (); +neigh_event_send (dst_get_neighbour (&rt->dst),NULL ); +rcu_read_unlock (); ret = -ENODATA ;if (neigh) goto release;
@@ -273,14 +275,16 @@ static int addr6_resolve(struct sockaddr goto put; } - neigh = dst->neighbour; +rcu_read_lock (); + neigh =dst_get_neighbour (dst);if (!neigh || !(neigh->nud_state &NUD_VALID )) { -neigh_event_send (dst->neighbour,NULL ); +if (neigh) +neigh_event_send (neigh,NULL ); ret = -ENODATA ; - goto put; + }else { + ret =rdma_copy_addr (addr, dst->dev, neigh->ha); } - - ret =rdma_copy_addr (addr, dst->dev, neigh->ha); +rcu_read_unlock (); put:dst_release (dst);return ret;
drivers/infiniband/hw/cxgb3/iwch_cm.c +12 -4
@@ -1328,6 +1328,7 @@ static int pass_accept_req(struct t3cdevstruct iwch_ep *child_ep, *parent_ep = ctx;struct cpl_pass_accept_req *req =cplhdr (skb);unsigned int hwtid =GET_TID (req); +struct neighbour *neigh;struct dst_entry *dst;struct l2t_entry *l2t;struct rtable *rt;
@@ -1364,7 +1365,10 @@ static int pass_accept_req(struct t3cdev goto reject; } dst = &rt->dst; - l2t =t3_l2t_get (tdev, dst->neighbour, dst->neighbour->dev); +rcu_read_lock (); + neigh =dst_get_neighbour (dst); + l2t =t3_l2t_get (tdev, neigh, neigh->dev); +rcu_read_unlock ();if (!l2t) { printk(KERN_ERR MOD "%s - failed to allocate l2t entry!\n", __func__);
@@ -1874,10 +1878,11 @@ static int is_loopback_dst(struct iw_cm_int iwch_connect (struct iw_cm_id *cm_id,struct iw_cm_conn_param *conn_param) { -int err =0 ;struct iwch_dev *h =to_iwch_dev (cm_id->device); +struct neighbour *neigh;struct iwch_ep *ep;struct rtable *rt; +int err =0 ;if (is_loopback_dst (cm_id)) { err = -ENOSYS ;
@@ -1933,9 +1938,12 @@ int iwch_connect(struct iw_cm_id *cm_id, } ep->dst = &rt->dst; +rcu_read_lock (); + neigh =dst_get_neighbour (ep->dst); +/* get a l2t entry */ - ep->l2t =t3_l2t_get (ep->com.tdev, ep->dst->neighbour, - ep->dst->neighbour->dev); + ep->l2t =t3_l2t_get (ep->com.tdev, neigh, neigh->dev); +rcu_read_unlock ();if (!ep->l2t) { printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__); err = -ENOMEM ;
drivers/infiniband/hw/cxgb4/cm.c +25 -21
101 lines not on this page · raw message
drivers/infiniband/hw/mlx4/qp.c +1 -1
@@ -1301,7 +1301,7 @@ static int build_mlx_header(struct mlx4_int is_eth;int is_vlan =0 ;int is_grh; -u16 vlan; +u16 vlan =0 ; send_size =0 ;for (i =0 ; i < wr->num_sge; ++i)
drivers/infiniband/hw/nes/nes_cm.c +5 -3
@@ -1150,9 +1150,11 @@ static int nes_addr_resolve_neigh(structneigh_release (neigh); } -if ((neigh ==NULL ) || (!(neigh->nud_state &NUD_VALID ))) -neigh_event_send (rt->dst.neighbour,NULL ); - +if ((neigh ==NULL ) || (!(neigh->nud_state &NUD_VALID ))) { +rcu_read_lock (); +neigh_event_send (dst_get_neighbour (&rt->dst),NULL ); +rcu_read_unlock (); + }ip_rt_put (rt);return rc; }
drivers/infiniband/ulp/ipoib/ipoib_main.c +39 -20
150 lines not on this page · raw message
drivers/infiniband/ulp/ipoib/ipoib_multicast.c +16 -8
@@ -258,11 +258,15 @@ static int ipoib_mcast_join_finish(strucnetif_tx_lock_bh (dev);while (!skb_queue_empty (&mcast->pkt_queue)) {struct sk_buff *skb =skb_dequeue (&mcast->pkt_queue); +struct dst_entry *dst =skb_dst (skb); +struct neighbour *n =NULL ; +netif_tx_unlock_bh (dev); skb->dev = dev; - -if (!skb_dst (skb) || !skb_dst (skb)->neighbour) { +if (dst) + n =dst_get_neighbour_raw (dst); +if (!dst || !n) {/* put pseudoheader back on for next time */ skb_push (skb,sizeof (struct ipoib_pseudoheader )); }
@@ -715,11 +719,15 @@ void ipoib_mcast_send(struct net_device out:if (mcast && mcast->ah) { -if (skb_dst (skb) && -skb_dst (skb)->neighbour && - !*to_ipoib_neigh (skb_dst (skb)->neighbour)) { -struct ipoib_neigh *neigh =ipoib_neigh_alloc (skb_dst (skb)->neighbour, - skb->dev); +struct dst_entry *dst =skb_dst (skb); +struct neighbour *n =NULL ; + +rcu_read_lock (); +if (dst) + n =dst_get_neighbour (dst); +if (n && !*to_ipoib_neigh (n)) { +struct ipoib_neigh *neigh =ipoib_neigh_alloc (n, + skb->dev);if (neigh) {kref_get (&mcast->ah->ref);
@@ -727,7 +735,7 @@ out:list_add_tail (&neigh->list, &mcast->neigh_list); } } - +rcu_read_unlock ();spin_unlock_irqrestore (&priv->lock, flags);ipoib_send (dev, skb, mcast->ah,IB_MULTICAST_QPN );return ;
drivers/net/cxgb3/cxgb3_offload.c +4 -4
@@ -971,7 +971,7 @@ static int nb_callback(struct notifier_bcase (NETEVENT_REDIRECT ):{struct netevent_redirect *nr = ctx;cxgb_redirect (nr->old, nr->new); -cxgb_neigh_update (nr->new->neighbour); +cxgb_neigh_update (dst_get_neighbour (nr->new));break ; }default :
@@ -1116,8 +1116,8 @@ static void cxgb_redirect(struct dst_entstruct l2t_entry *e;struct t3c_tid_entry *te; - olddev = old->neighbour->dev; - newdev = new->neighbour->dev; + olddev =dst_get_neighbour (old)->dev; + newdev =dst_get_neighbour (new)->dev;if (!is_offloading (olddev))return ;if (!is_offloading (newdev)) {
@@ -1134,7 +1134,7 @@ static void cxgb_redirect(struct dst_ent }/* Add new L2T entry */ - e =t3_l2t_get (tdev, new->neighbour, newdev); + e =t3_l2t_get (tdev,dst_get_neighbour (new), newdev);if (!e) {printk (KERN_ERR "%s: couldn't allocate new l2t entry!\n" , __func__);
drivers/s390/net/qeth_l3_main.c +17 -6
@@ -2742,9 +2742,14 @@ static int qeth_l3_do_ioctl(struct net_dint inline qeth_l3_get_cast_type (struct qeth_card *card,struct sk_buff *skb) {int cast_type =RTN_UNSPEC ; +struct neighbour *n =NULL ; +struct dst_entry *dst; -if (skb_dst (skb) &&skb_dst (skb)->neighbour) { - cast_type =skb_dst (skb)->neighbour->type; + dst =skb_dst (skb); +if (dst) + n =dst_get_neighbour (dst); +if (n) { + cast_type = n->type;if ((cast_type ==RTN_BROADCAST ) || (cast_type ==RTN_MULTICAST ) || (cast_type ==RTN_ANYCAST ))
@@ -2787,6 +2792,9 @@ int inline qeth_l3_get_cast_type(structstatic void qeth_l3_fill_header (struct qeth_card *card,struct qeth_hdr *hdr,struct sk_buff *skb,int ipv,int cast_type) { +struct neighbour *n =NULL ; +struct dst_entry *dst; +memset (hdr,0 ,sizeof (struct qeth_hdr )); hdr->hdr.l3.id =QETH_HEADER_TYPE_LAYER3 ; hdr->hdr.l3.ext_flags =0 ;
@@ -2804,13 +2812,16 @@ static void qeth_l3_fill_header(struct q } hdr->hdr.l3.length = skb->len -sizeof (struct qeth_hdr ); + dst =skb_dst (skb); +if (dst) + n =dst_get_neighbour (dst);if (ipv ==4 ) {/* IPv4 */ hdr->hdr.l3.flags =qeth_l3_get_qeth_hdr_flags4 (cast_type);memset (hdr->hdr.l3.dest_addr,0 ,12 ); -if ((skb_dst (skb)) && (skb_dst (skb)->neighbour)) { +if (n) { *((u32 *) (&hdr->hdr.l3.dest_addr[12 ])) = - *((u32 *)skb_dst (skb)->neighbour->primary_key); + *((u32 *) n->primary_key); }else {/* fill in destination address used in ip header */ *((u32 *) (&hdr->hdr.l3.dest_addr[12])) =
@@ -2821,9 +2832,9 @@ static void qeth_l3_fill_header(struct q hdr->hdr.l3.flags =qeth_l3_get_qeth_hdr_flags6 (cast_type);if (card->info.type ==QETH_CARD_TYPE_IQD ) hdr->hdr.l3.flags &= ~QETH_HDR_PASSTHRU ; -if ((skb_dst (skb)) && (skb_dst (skb)->neighbour)) { +if (n) {memcpy (hdr->hdr.l3.dest_addr, -skb_dst (skb)->neighbour->primary_key,16 ); + n->primary_key,16 ); }else {/* fill in destination address used in ip header */ memcpy(hdr->hdr.l3.dest_addr,
drivers/scsi/cxgbi/cxgb3i/cxgb3i.c +1 -1
@@ -985,7 +985,7 @@ static int init_act_open(struct cxgbi_so csk->saddr.sin_addr.s_addr = chba->ipv4addr; csk->rss_qid =0 ; - csk->l2t =t3_l2t_get (t3dev, dst->neighbour, ndev); + csk->l2t =t3_l2t_get (t3dev,dst_get_neighbour (dst), ndev);if (!csk->l2t) {pr_err ("NO l2t available.\n" );return -EINVAL ;
drivers/scsi/cxgbi/cxgb4i/cxgb4i.c +1 -1
@@ -1160,7 +1160,7 @@ static int init_act_open(struct cxgbi_socxgbi_sock_set_flag (csk,CTPF_HAS_ATID );cxgbi_sock_get (csk); - csk->l2t =cxgb4_l2t_get (lldi->l2t, csk->dst->neighbour, ndev,0 ); + csk->l2t =cxgb4_l2t_get (lldi->l2t,dst_get_neighbour (csk->dst), ndev,0 );if (!csk->l2t) {pr_err ("%s, cannot alloc l2t.\n" , ndev->name); goto rel_resource;
drivers/scsi/cxgbi/libcxgbi.c +2 -2
@@ -492,7 +492,7 @@ static struct cxgbi_sock *cxgbi_check_ro goto err_out; } dst = &rt->dst; - ndev = dst->neighbour->dev; + ndev =dst_get_neighbour (dst)->dev;if (rt->rt_flags & (RTCF_MULTICAST |RTCF_BROADCAST )) { pr_info("multi-cast route %pI4, port %u, dev %s.\n",
@@ -506,7 +506,7 @@ static struct cxgbi_sock *cxgbi_check_ro ndev =ip_dev_find (&init_net, daddr->sin_addr.s_addr); mtu = ndev->mtu;pr_info ("rt dev %s, loopback -> %s, mtu %u.\n" , - dst->neighbour->dev->name, ndev->name, mtu); +dst_get_neighbour (dst)->dev->name, ndev->name, mtu); } cdev =cxgbi_device_find_by_netdev (ndev, &port);
include/net/arp.h +1 -0
@@ -16,6 +16,7 @@ extern void arp_send(int type, int pconst unsigned char *dest_hw, const unsigned char *src_hw, const unsigned char *th);extern int arp_bind_neighbour (struct dst_entry *dst); +extern struct neighbour *__arp_bind_neighbour (struct dst_entry *dst,__be32 nexthop);extern int arp_mc_map (__be32 addr,u8 *haddr,struct net_device *dev,int dir);extern void arp_ifdown (struct net_device *dev);
include/net/dst.h +24 -3
@@ -37,7 +37,7 @@ struct dst_entry {unsigned long _metrics;unsigned long expires;struct dst_entry *path; -struct neighbour *neighbour; +struct neighbour __rcu *_neighbour;struct hh_cache *hh;#ifdef CONFIG_XFRM struct xfrm_state *xfrm;
@@ -86,6 +86,21 @@ struct dst_entry { }; }; +static inline struct neighbour *dst_get_neighbour (struct dst_entry *dst) +{ +return rcu_dereference (dst->_neighbour); +} + +static inline struct neighbour *dst_get_neighbour_raw (struct dst_entry *dst) +{ +return rcu_dereference_raw (dst->_neighbour); +} + +static inline void dst_set_neighbour (struct dst_entry *dst,struct neighbour *neigh) +{ +rcu_assign_pointer (dst->_neighbour, neigh); +} +extern u32 *dst_cow_metrics_generic (struct dst_entry *dst,unsigned long old);extern const u32 dst_default_metrics[RTAX_MAX ];
@@ -371,8 +386,14 @@ static inline void dst_rcu_free(struct rstatic inline void dst_confirm (struct dst_entry *dst) { -if (dst) -neigh_confirm (dst->neighbour); +if (dst) { +struct neighbour *n; + +rcu_read_lock (); + n =dst_get_neighbour (dst); +neigh_confirm (n); +rcu_read_unlock (); + } }static inline void dst_link_failure (struct sk_buff *skb)
net/atm/clip.c +10 -6
@@ -364,33 +364,37 @@ static netdev_tx_t clip_start_xmit(struc struct net_device *dev) {struct clip_priv *clip_priv =PRIV (dev); +struct dst_entry *dst =skb_dst (skb);struct atmarp_entry *entry; +struct neighbour *n;struct atm_vcc *vcc;int old;unsigned long flags;pr_debug ("(skb %p)\n" , skb); -if (!skb_dst (skb)) { +if (!dst) {pr_err ("skb_dst(skb) == NULL\n" );dev_kfree_skb (skb); dev->stats.tx_dropped++;return NETDEV_TX_OK ; } -if (!skb_dst (skb)->neighbour) { + n =dst_get_neighbour (dst); +if (!n) {#if 0 -skb_dst (skb)->neighbour =clip_find_neighbour (skb_dst (skb),1 ); -if (!skb_dst (skb)->neighbour) { + n =clip_find_neighbour (skb_dst (skb),1 ); +if (!n) {dev_kfree_skb (skb);/* lost that one */ dev->stats.tx_dropped++;return 0 ; } +dst_set_neighbour (dst, n);#endif pr_err ("NO NEIGHBOUR !\n" );dev_kfree_skb (skb); dev->stats.tx_dropped++;return NETDEV_TX_OK ; } - entry =NEIGH2ENTRY (skb_dst (skb)->neighbour); + entry =NEIGH2ENTRY (n);if (!entry->vccs) {if (time_after (jiffies, entry->expires)) {/* should be resolved */
@@ -407,7 +411,7 @@ static netdev_tx_t clip_start_xmit(struc }pr_debug ("neigh %p, vccs %p\n" , entry, entry->vccs);ATM_SKB (skb)->vcc = vcc = entry->vccs->vcc; -pr_debug ("using neighbour %p, vcc %p\n" ,skb_dst (skb)->neighbour, vcc); +pr_debug ("using neighbour %p, vcc %p\n" , n, vcc);if (entry->vccs->encap) {void *here;
net/bridge/br_netfilter.c +4 -2
@@ -343,24 +343,26 @@ static int br_nf_pre_routing_finish_ipv6static int br_nf_pre_routing_finish_bridge (struct sk_buff *skb) {struct nf_bridge_info *nf_bridge = skb->nf_bridge; +struct neighbour *neigh;struct dst_entry *dst; skb->dev =bridge_parent (skb->dev);if (!skb->dev) goto free_skb; dst =skb_dst (skb); + neigh =dst_get_neighbour (dst);if (dst->hh) {neigh_hh_bridge (dst->hh, skb); skb->dev = nf_bridge->physindev;return br_handle_frame_finish (skb); - }else if (dst->neighbour) { + }else if (neigh) {/* the neighbour function below overwrites the complete * MAC header, so we save the Ethernet source address and * protocol number. */ skb_copy_from_linear_data_offset (skb, -(ETH_HLEN -ETH_ALEN ), skb->nf_bridge->data,ETH_HLEN -ETH_ALEN );/* tell br_dev_xmit to continue with forwarding */ nf_bridge->mask |=BRNF_BRIDGED_DNAT ; -return dst->neighbour->output (skb); +return neigh->output (skb); } free_skb:kfree_skb (skb);
net/core/dst.c +10 -5
@@ -171,7 +171,7 @@ void *dst_alloc(struct dst_ops *ops, strdst_init_metrics (dst, dst_default_metrics, true); dst->expires =0UL ; dst->path = dst; - dst->neighbour =NULL ; +RCU_INIT_POINTER (dst->_neighbour,NULL ); dst->hh =NULL ;#ifdef CONFIG_XFRM dst->xfrm =NULL ;
@@ -231,7 +231,7 @@ struct dst_entry *dst_destroy(struct dstsmp_rmb (); again: - neigh = dst->neighbour; + neigh =rcu_dereference_protected (dst->_neighbour,1 ); hh = dst->hh; child = dst->child;
@@ -240,7 +240,7 @@ again:hh_cache_put (hh);if (neigh) { - dst->neighbour =NULL ; +RCU_INIT_POINTER (dst->_neighbour,NULL );neigh_release (neigh); }
@@ -367,14 +367,19 @@ static void dst_ifdown(struct dst_entryif (!unregister) { dst->input = dst->output = dst_discard; }else { +struct neighbour *neigh; + dst->dev =dev_net (dst->dev)->loopback_dev;dev_hold (dst->dev);dev_put (dev); -if (dst->neighbour && dst->neighbour->dev == dev) { - dst->neighbour->dev = dst->dev; +rcu_read_lock (); + neigh =dst_get_neighbour (dst); +if (neigh && neigh->dev == dev) { + neigh->dev = dst->dev;dev_hold (dst->dev);dev_put (dev); } +rcu_read_unlock (); } }
net/core/neighbour.c +12 -7
@@ -1173,12 +1173,17 @@ int neigh_update(struct neighbour *neighwhile (neigh->nud_state &NUD_VALID && (skb =__skb_dequeue (&neigh->arp_queue)) !=NULL ) { -struct neighbour *n1 = neigh; +struct dst_entry *dst =skb_dst (skb); +struct neighbour *n2, *n1 = neigh;write_unlock_bh (&neigh->lock); + +rcu_read_lock ();/* On shaper/eql skb->dst->neighbour != neigh :( */ -if (skb_dst (skb) &&skb_dst (skb)->neighbour) - n1 =skb_dst (skb)->neighbour; +if (dst && (n2 =dst_get_neighbour (dst)) !=NULL ) + n1 = n2; n1->output (skb); +rcu_read_unlock (); +write_lock_bh (&neigh->lock); }skb_queue_purge (&neigh->arp_queue);
@@ -1300,10 +1305,10 @@ EXPORT_SYMBOL(neigh_compat_output);int neigh_resolve_output (struct sk_buff *skb) {struct dst_entry *dst =skb_dst (skb); -struct neighbour *neigh; +struct neighbour *neigh =dst_get_neighbour (dst);int rc =0 ; -if (!dst || !(neigh = dst->neighbour)) +if (!dst) goto discard;__skb_pull (skb,skb_network_offset (skb));
@@ -1333,7 +1338,7 @@ out:return rc; discard:NEIGH_PRINTK1 ("neigh_resolve_output: dst=%p neigh=%p\n" , - dst, dst ? dst->neighbour :NULL ); + dst, neigh); out_kfree_skb: rc = -EINVAL ;kfree_skb (skb);
@@ -1347,7 +1352,7 @@ int neigh_connected_output(struct sk_buf {int err;struct dst_entry *dst =skb_dst (skb); -struct neighbour *neigh = dst->neighbour; +struct neighbour *neigh =dst_get_neighbour (dst);struct net_device *dev = neigh->dev;unsigned int seq;
net/decnet/dn_neigh.c +4 -4
@@ -208,7 +208,7 @@ static int dn_neigh_output_packet(struct {struct dst_entry *dst =skb_dst (skb);struct dn_route *rt = (struct dn_route *)dst; -struct neighbour *neigh = dst->neighbour; +struct neighbour *neigh =dst_get_neighbour (dst);struct net_device *dev = neigh->dev;char mac_addr[ETH_ALEN ];
@@ -227,7 +227,7 @@ static int dn_neigh_output_packet(structstatic int dn_long_output (struct sk_buff *skb) {struct dst_entry *dst =skb_dst (skb); -struct neighbour *neigh = dst->neighbour; +struct neighbour *neigh =dst_get_neighbour (dst);struct net_device *dev = neigh->dev;int headroom = dev->hard_header_len +sizeof (struct dn_long_packet ) +3 ;unsigned char *data;
@@ -274,7 +274,7 @@ static int dn_long_output(struct sk_buffstatic int dn_short_output (struct sk_buff *skb) {struct dst_entry *dst =skb_dst (skb); -struct neighbour *neigh = dst->neighbour; +struct neighbour *neigh =dst_get_neighbour (dst);struct net_device *dev = neigh->dev;int headroom = dev->hard_header_len +sizeof (struct dn_short_packet ) +2 ;struct dn_short_packet *sp;
@@ -318,7 +318,7 @@ static int dn_short_output(struct sk_bufstatic int dn_phase3_output (struct sk_buff *skb) {struct dst_entry *dst =skb_dst (skb); -struct neighbour *neigh = dst->neighbour; +struct neighbour *neigh =dst_get_neighbour (dst);struct net_device *dev = neigh->dev;int headroom = dev->hard_header_len +sizeof (struct dn_short_packet ) +2 ;struct dn_short_packet *sp;
net/decnet/dn_route.c +10 -8
@@ -241,9 +241,11 @@ static int dn_dst_gc(struct dst_ops *ops*/ static void dn_dst_update_pmtu (struct dst_entry *dst,u32 mtu) { +struct neighbour *n =dst_get_neighbour (dst);u32 min_mtu =230 ; -struct dn_dev *dn = dst->neighbour ? -rcu_dereference_raw (dst->neighbour->dev->dn_ptr) :NULL ; +struct dn_dev *dn; + + dn = n ?rcu_dereference_raw (n->dev->dn_ptr) :NULL ;if (dn && dn->use_long ==0 ) min_mtu -=6 ;
@@ -715,7 +717,7 @@ static int dn_output(struct sk_buff *skbint err = -EINVAL ; -if ((neigh = dst->neighbour) ==NULL ) +if ((neigh =dst_get_neighbour (dst)) ==NULL ) goto error; skb->dev = dev;
@@ -750,7 +752,7 @@ static int dn_forward(struct sk_buff *skstruct dst_entry *dst =skb_dst (skb);struct dn_dev *dn_db =rcu_dereference (dst->dev->dn_ptr);struct dn_route *rt; -struct neighbour *neigh = dst->neighbour; +struct neighbour *neigh =dst_get_neighbour (dst);int header_len;#ifdef CONFIG_NETFILTER struct net_device *dev = skb->dev;
@@ -833,11 +835,11 @@ static int dn_rt_set_next_hop(struct dn_ } rt->rt_type = res->type; -if (dev !=NULL && rt->dst.neighbour ==NULL ) { +if (dev !=NULL &&dst_get_neighbour (&rt->dst) ==NULL ) { n =__neigh_lookup_errno (&dn_neigh_table, &rt->rt_gateway, dev);if (IS_ERR (n))return PTR_ERR (n); - rt->dst.neighbour = n; +dst_set_neighbour (&rt->dst, n); }if (dst_metric (&rt->dst,RTAX_MTU ) > rt->dst.dev->mtu)
@@ -1144,7 +1146,7 @@ make_route: rt->rt_dst_map = fld.daddr; rt->rt_src_map = fld.saddr; - rt->dst.neighbour = neigh; +dst_set_neighbour (&rt->dst, neigh); neigh =NULL ; rt->dst.lastuse = jiffies;
@@ -1416,7 +1418,7 @@ make_route: rt->fld.flowidn_iif = in_dev->ifindex; rt->fld.flowidn_mark = fld.flowidn_mark; - rt->dst.neighbour = neigh; +dst_set_neighbour (&rt->dst, neigh); rt->dst.lastuse = jiffies; rt->dst.output = dn_rt_bug;switch (res.type) {
net/ipv4/arp.c +17 -11
@@ -518,26 +518,32 @@ EXPORT_SYMBOL(arp_find);/* END OF OBSOLETE FUNCTIONS */ +struct neighbour *__arp_bind_neighbour (struct dst_entry *dst,__be32 nexthop) +{ +struct net_device *dev = dst->dev; + +if (dev->flags & (IFF_LOOPBACK |IFF_POINTOPOINT )) + nexthop =0 ; + return __neigh_lookup_errno( +#if defined(CONFIG_ATM_CLIP ) || defined(CONFIG_ATM_CLIP_MODULE ) + dev->type ==ARPHRD_ATM ? + clip_tbl_hook : +#endif + &arp_tbl, &nexthop, dev); +} +int arp_bind_neighbour (struct dst_entry *dst) {struct net_device *dev = dst->dev; -struct neighbour *n = dst->neighbour; +struct neighbour *n =dst_get_neighbour (dst);if (dev ==NULL )return -EINVAL ;if (n ==NULL ) { -__be32 nexthop = ((struct rtable *)dst)->rt_gateway; -if (dev->flags & (IFF_LOOPBACK |IFF_POINTOPOINT )) - nexthop =0 ; - n = __neigh_lookup_errno( -#if defined(CONFIG_ATM_CLIP ) || defined(CONFIG_ATM_CLIP_MODULE ) - dev->type ==ARPHRD_ATM ? - clip_tbl_hook : -#endif - &arp_tbl, &nexthop, dev); + n =__arp_bind_neighbour (dst, ((struct rtable *)dst)->rt_gateway);if (IS_ERR (n))return PTR_ERR (n); - dst->neighbour = n; +dst_set_neighbour (dst, n); }return 0 ; }
net/ipv4/ip_gre.c +1 -1
@@ -731,9 +731,9 @@ static netdev_tx_t ipgre_tunnel_xmit(str }#if defined(CONFIG_IPV6 ) || defined(CONFIG_IPV6_MODULE ) else if (skb->protocol == htons(ETH_P_IPV6)) { +struct neighbour *neigh =dst_get_neighbour (skb_dst (skb));const struct in6_addr *addr6;int addr_type; -struct neighbour *neigh =skb_dst (skb)->neighbour;if (neigh ==NULL ) goto tx_error;
net/ipv4/ip_output.c +18 -4
@@ -182,6 +182,8 @@ static inline int ip_finish_output2(strustruct rtable *rt = (struct rtable *)dst;struct net_device *dev = dst->dev;unsigned int hh_len =LL_RESERVED_SPACE (dev); +struct neighbour *neigh; +int res;if (rt->rt_type ==RTN_MULTICAST ) {IP_UPD_PO_STATS (dev_net (dev),IPSTATS_MIB_OUTMCAST , skb->len);
@@ -202,11 +204,23 @@ static inline int ip_finish_output2(strukfree_skb (skb); skb = skb2; } + +rcu_read_lock (); +if (dst->hh) { +int res =neigh_hh_output (dst->hh, skb); -if (dst->hh) -return neigh_hh_output (dst->hh, skb); -else if (dst->neighbour) -return dst->neighbour->output (skb); +rcu_read_unlock (); +return res; + }else { + neigh =dst_get_neighbour (dst); +if (neigh) { + res = neigh->output (skb); + +rcu_read_unlock (); +return res; + } +rcu_read_unlock (); + }if (net_ratelimit ())printk (KERN_DEBUG "ip_finish_output2: No header cache and no neighbour!\n" );
net/ipv4/route.c +19 -12
@@ -416,7 +416,13 @@ static int rt_cache_seq_show(struct seq_ "HHUptod\tSpecDst"); else {struct rtable *r = v; -int len; +struct neighbour *n; +int len, HHUptod; + +rcu_read_lock (); + n =dst_get_neighbour (&r->dst); + HHUptod = (n && (n->nud_state &NUD_CONNECTED )) ?1 :0 ; +rcu_read_unlock (); seq_printf(seq, "%s\t%08X\t%08X\t%8X\t%d\t%u\t%d\t" "%08X\t%d\t%u\t%u\t%02X\t%d\t%1d\t%08X%n",
@@ -431,8 +437,7 @@ static int rt_cache_seq_show(struct seq_ dst_metric(&r->dst, RTAX_RTTVAR)), r->rt_key_tos, r->dst.hh ?atomic_read (&r->dst.hh->hh_refcnt) :-1 , - r->dst.hh ? (r->dst.hh->hh_output == - dev_queue_xmit) :0 , + HHUptod, r->rt_spec_dst, &len);seq_printf (seq,"%*s\n" ,127 - len,"" );
@@ -1688,23 +1693,25 @@ static int check_peer_redir(struct dst_e {struct rtable *rt = (struct rtable *) dst;__be32 orig_gw = rt->rt_gateway; +struct neighbour *n, *old_n;dst_confirm (&rt->dst); -neigh_release (rt->dst.neighbour); - rt->dst.neighbour =NULL ; - rt->rt_gateway = peer->redirect_learned.a4; -if (arp_bind_neighbour (&rt->dst) || - !(rt->dst.neighbour->nud_state &NUD_VALID )) { -if (rt->dst.neighbour) -neigh_event_send (rt->dst.neighbour,NULL ); + n =__arp_bind_neighbour (&rt->dst, rt->rt_gateway); +if (IS_ERR (n)) +return PTR_ERR (n); + old_n =xchg (&rt->dst._neighbour, n); +if (old_n) +neigh_release (old_n); +if (!n || !(n->nud_state &NUD_VALID )) { +if (n) +neigh_event_send (n,NULL ); rt->rt_gateway = orig_gw;return -EAGAIN ; }else { rt->rt_flags |=RTCF_REDIRECTED ; -call_netevent_notifiers (NETEVENT_NEIGH_UPDATE , - rt->dst.neighbour); +call_netevent_notifiers (NETEVENT_NEIGH_UPDATE , n); }return 0 ; }
net/ipv6/addrconf.c +1 -1
@@ -656,7 +656,7 @@ ipv6_add_addr(struct inet6_dev *idev, co* layer address of our nexhop router */ -if (rt->rt6i_nexthop ==NULL ) +if (dst_get_neighbour_raw (&rt->dst) ==NULL ) ifa->flags &= ~IFA_F_OPTIMISTIC ; ifa->idev = idev;
net/ipv6/ip6_fib.c +1 -1
@@ -1455,7 +1455,7 @@ static int fib6_age(struct rt6_info *rt,RT6_TRACE ("aging clone %p\n" , rt);return -1 ; }else if ((rt->rt6i_flags &RTF_GATEWAY ) && - (!(rt->rt6i_nexthop->flags &NTF_ROUTER ))) { + (!(dst_get_neighbour_raw (&rt->dst)->flags &NTF_ROUTER ))) {RT6_TRACE ("purging route %p via non-router but gateway\n" , rt);return -1 ;
net/ipv6/ip6_output.c +31 -9
@@ -100,6 +100,8 @@ static int ip6_finish_output2(struct sk_ {struct dst_entry *dst =skb_dst (skb);struct net_device *dev = dst->dev; +struct neighbour *neigh; +int res; skb->protocol =htons (ETH_P_IPV6 ); skb->dev = dev;
@@ -134,10 +136,22 @@ static int ip6_finish_output2(struct sk_ skb->len); } -if (dst->hh) -return neigh_hh_output (dst->hh, skb); -else if (dst->neighbour) -return dst->neighbour->output (skb); +rcu_read_lock (); +if (dst->hh) { + res =neigh_hh_output (dst->hh, skb); + +rcu_read_unlock (); +return res; + }else { + neigh =dst_get_neighbour (dst); +if (neigh) { + res = neigh->output (skb); + +rcu_read_unlock (); +return res; + } +rcu_read_unlock (); + }IP6_INC_STATS_BH (dev_net (dst->dev),ip6_dst_idev (dst),IPSTATS_MIB_OUTNOROUTES );
@@ -385,6 +399,7 @@ int ip6_forward(struct sk_buff *skb)struct ipv6hdr *hdr =ipv6_hdr (skb);struct inet6_skb_parm *opt =IP6CB (skb);struct net *net =dev_net (dst->dev); +struct neighbour *n;u32 mtu;if (net->ipv6.devconf_all->forwarding ==0 )
@@ -459,11 +474,10 @@ int ip6_forward(struct sk_buff *skb)send redirects to source routed frames. We don't send redirects to frames decapsulated from IPsec. */ -if (skb->dev == dst->dev && dst->neighbour && opt->srcrt ==0 && - !skb_sec_path (skb)) { + n =dst_get_neighbour (dst); +if (skb->dev == dst->dev && n && opt->srcrt ==0 && !skb_sec_path (skb)) {struct in6_addr *target =NULL ;struct rt6_info *rt; -struct neighbour *n = dst->neighbour;/* * incoming and outgoing devices are the same
@@ -949,8 +963,11 @@ out:static int ip6_dst_lookup_tail (struct sock *sk,struct dst_entry **dst,struct flowi6 *fl6) { -int err;struct net *net =sock_net (sk); +#ifdef CONFIG_IPV6_OPTIMISTIC_DAD +struct neighbour *n; +#endif +int err;if (*dst ==NULL ) *dst =ip6_route_output (net, sk, fl6);
@@ -976,11 +993,14 @@ static int ip6_dst_lookup_tail(struct so* dst entry and replace it instead with the * dst entry of the nexthop router */ -if ((*dst)->neighbour && !((*dst)->neighbour->nud_state &NUD_VALID )) { +rcu_read_lock (); + n =dst_get_neighbour (*dst); +if (n && !(n->nud_state &NUD_VALID )) {struct inet6_ifaddr *ifp;struct flowi6 fl_gw6;int redirect; +rcu_read_unlock (); ifp =ipv6_get_ifaddr (net, &fl6->saddr, (*dst)->dev,1 );
@@ -1000,6 +1020,8 @@ static int ip6_dst_lookup_tail(struct soif ((err = (*dst)->error)) goto out_err_release; } + }else { +rcu_read_unlock (); }#endif
net/ipv6/ndisc.c +2 -2
@@ -1244,7 +1244,7 @@ static void ndisc_router_discovery(struc rt =rt6_get_dflt_router (&ipv6_hdr (skb)->saddr, skb->dev);if (rt) - neigh = rt->rt6i_nexthop; + neigh =dst_get_neighbour (&rt->dst);if (rt && lifetime ==0 ) {neigh_clone (neigh);
@@ -1265,7 +1265,7 @@ static void ndisc_router_discovery(strucreturn ; } - neigh = rt->rt6i_nexthop; + neigh =dst_get_neighbour (&rt->dst);if (neigh ==NULL ) { ND_PRINTK0(KERN_ERR "ICMPv6 RA: %s() got default router without neighbour.\n",
net/ipv6/route.c +37 -22
175 lines not on this page · raw message
net/ipv6/sit.c +2 -2
@@ -679,7 +679,7 @@ static netdev_tx_t ipip6_tunnel_xmit(strstruct neighbour *neigh =NULL ;if (skb_dst (skb)) - neigh =skb_dst (skb)->neighbour; + neigh =dst_get_neighbour (skb_dst (skb));if (neigh ==NULL ) {if (net_ratelimit ())
@@ -704,7 +704,7 @@ static netdev_tx_t ipip6_tunnel_xmit(strstruct neighbour *neigh =NULL ;if (skb_dst (skb)) - neigh =skb_dst (skb)->neighbour; + neigh =dst_get_neighbour (skb_dst (skb));if (neigh ==NULL ) {if (net_ratelimit ())
net/sched/sch_teql.c +20 -11
@@ -225,11 +225,11 @@ static int teql_qdisc_init(struct Qdiscstatic int -__teql_resolve (struct sk_buff *skb,struct sk_buff *skb_res,struct net_device *dev) +__teql_resolve (struct sk_buff *skb,struct sk_buff *skb_res, +struct net_device *dev,struct netdev_queue *txq, +struct neighbour *mn) { -struct netdev_queue *dev_queue =netdev_get_tx_queue (dev,0 ); -struct teql_sched_data *q =qdisc_priv (dev_queue->qdisc); -struct neighbour *mn =skb_dst (skb)->neighbour; +struct teql_sched_data *q =qdisc_priv (txq->qdisc);struct neighbour *n = q->ncache;if (mn->tbl ==NULL )
@@ -262,17 +262,26 @@ __teql_resolve(struct sk_buff *skb, stru }static inline int teql_resolve (struct sk_buff *skb, -struct sk_buff *skb_res,struct net_device *dev) +struct sk_buff *skb_res, +struct net_device *dev, +struct netdev_queue *txq) { -struct netdev_queue *txq =netdev_get_tx_queue (dev,0 ); +struct dst_entry *dst =skb_dst (skb); +struct neighbour *mn; +int res; +if (txq->qdisc == &noop_qdisc)return -ENODEV ; -if (dev->header_ops ==NULL || -skb_dst (skb) ==NULL || -skb_dst (skb)->neighbour ==NULL ) +if (!dev->header_ops || !dst)return 0 ; -return __teql_resolve (skb, skb_res, dev); + +rcu_read_lock (); + mn =dst_get_neighbour (dst); + res = mn ?__teql_resolve (skb, skb_res, dev, txq, mn) :0 ; +rcu_read_unlock (); + +return res; }static netdev_tx_t teql_master_xmit (struct sk_buff *skb,struct net_device *dev)
@@ -307,7 +316,7 @@ restart:continue ; } -switch (teql_resolve (skb, skb_res, slave)) { +switch (teql_resolve (skb, skb_res, slave, slave_txq)) {case 0 :if (__netif_tx_trylock (slave_txq)) {unsigned int length =qdisc_pkt_len (skb);
net/xfrm/xfrm_policy.c +1 -1
@@ -1497,7 +1497,7 @@ static struct dst_entry *xfrm_bundle_cre goto free_dst;/* Copy neighbour for reachability confirmation */ - dst0->neighbour =neigh_clone (dst->neighbour); +dst_set_neighbour (dst0,neigh_clone (dst_get_neighbour (dst)));xfrm_init_path ((struct xfrm_dst *)dst0, dst, nfheader_len);xfrm_init_pmtu (dst_prev);