2.6.32.28-longterm review
Subsystems (22)
cover 2.6.32.28-longterm review
This is the start of the longterm review cycle for the 2.6.32.28 release. There are 49 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by Friday, January 7, 2011, 22:00:00 UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v2.6/longterm-review/patch-2.6.32.28-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
Makefile | 2 +- arch/x86/include/asm/processor.h | 23 -------- arch/x86/kernel/apic/apic.c | 8 +++ arch/x86/kernel/apic/io_apic.c | 1 + arch/x86/kernel/apic/probe_64.c | 7 -- arch/x86/kernel/cpu/amd.c | 3 +- arch/x86/kernel/smpboot.c | 85 ++++++++++++++++++++++++++++- arch/x86/vdso/Makefile | 4 +- block/blk-merge.c | 6 +- block/blk-settings.c | 24 +------- drivers/acpi/acpica/dswexec.c | 19 ++++++- drivers/acpi/ec.c | 3 + drivers/char/hvc_console.c | 27 ++++++--- drivers/char/tty_ldisc.c | 1 + drivers/dma/mv_xor.c | 2 +- drivers/edac/amd64_edac.c | 2 +- drivers/gpu/drm/drm_crtc.c | 8 +- drivers/hid/hidraw.c | 11 +++- drivers/hwmon/adm1026.c | 20 +++--- drivers/infiniband/core/uverbs_cmd.c | 101 +++++++++++++++++++--------------- drivers/md/dm-table.c | 5 -- drivers/md/md.c | 10 ++-- drivers/net/igb/igb_main.c | 2 +- drivers/net/wireless/orinoco/main.c | 6 ++ drivers/net/wireless/orinoco/wext.c | 4 +- drivers/net/wireless/p54/p54usb.c | 6 ++ drivers/pci/dmar.c | 5 ++ drivers/pci/quirks.c | 23 ++++++++ drivers/scsi/bfa/bfa_core.c | 22 +++++++ drivers/scsi/scsi_lib.c | 3 +- drivers/usb/misc/uss720.c | 4 +- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 5 ++ drivers/usb/storage/unusual_devs.h | 7 ++ fs/exec.c | 5 ++ fs/fuse/file.c | 72 ++++++++++++++++++++++-- fs/nfs/file.c | 2 + fs/nfs/mount_clnt.c | 4 +- fs/nfsd/nfs3xdr.c | 6 +- include/linux/blkdev.h | 9 ++- include/linux/nfsd/xdr4.h | 21 +++---- include/net/sctp/sm.h | 1 + include/net/sctp/structs.h | 3 + kernel/exit.c | 8 +++ kernel/power/user.c | 2 +- kernel/printk.c | 2 + kernel/timer.c | 6 ++ kernel/trace/trace.c | 10 +++- mm/mmap.c | 16 ++++- net/core/dev.c | 8 +++ net/sctp/input.c | 22 ++++++- net/sctp/sm_sideeffect.c | 35 ++++++++++++ net/sctp/transport.c | 2 + net/sunrpc/svc_xprt.c | 9 +++- security/integrity/ima/ima_policy.c | 2 + sound/oss/soundcard.c | 4 +- sound/pci/hda/hda_intel.c | 2 + sound/pci/hda/patch_realtek.c | 1 + 58 files changed, 523 insertions(+), 189 deletions(-)
PATCH 1/49 TTY: Fix error return from tty_ldisc_open()
2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
The backported version of "TTY: ldisc, fix open flag handling" in 2.6.32.27 causes tty_ldisc_open() to return 0 on error. Fix that.
--- drivers/char/tty_ldisc.c | 1 + 1 file changed, 1 insertion(+)
drivers/char/tty_ldisc.c +1 -0
@@ -451,6 +451,7 @@ static int tty_ldisc_open(struct tty_str ret = ld->ops->open (tty);if (ret)clear_bit (TTY_LDISC_OPEN , &tty->flags); +return ret; }return 0 ; }
cover 2.6.32.28-longterm review
In reply to Greg KHThis is the start of the longterm review cycle for the 2.6.32.28 release. There are 49 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by Friday, January 7, 2011, 22:00:00 UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v2.6/longterm-review/patch-2.6.32.28-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
Makefile | 2 +- arch/x86/include/asm/processor.h | 23 -------- arch/x86/kernel/apic/apic.c | 8 +++ arch/x86/kernel/apic/io_apic.c | 1 + arch/x86/kernel/apic/probe_64.c | 7 -- arch/x86/kernel/cpu/amd.c | 3 +- arch/x86/kernel/smpboot.c | 85 ++++++++++++++++++++++++++++- arch/x86/vdso/Makefile | 4 +- block/blk-merge.c | 6 +- block/blk-settings.c | 24 +------- drivers/acpi/acpica/dswexec.c | 19 ++++++- drivers/acpi/ec.c | 3 + drivers/char/hvc_console.c | 27 ++++++--- drivers/char/tty_ldisc.c | 1 + drivers/dma/mv_xor.c | 2 +- drivers/edac/amd64_edac.c | 2 +- drivers/gpu/drm/drm_crtc.c | 8 +- drivers/hid/hidraw.c | 11 +++- drivers/hwmon/adm1026.c | 20 +++--- drivers/infiniband/core/uverbs_cmd.c | 101 +++++++++++++++++++--------------- drivers/md/dm-table.c | 5 -- drivers/md/md.c | 10 ++-- drivers/net/igb/igb_main.c | 2 +- drivers/net/wireless/orinoco/main.c | 6 ++ drivers/net/wireless/orinoco/wext.c | 4 +- drivers/net/wireless/p54/p54usb.c | 6 ++ drivers/pci/dmar.c | 5 ++ drivers/pci/quirks.c | 23 ++++++++ drivers/scsi/bfa/bfa_core.c | 22 +++++++ drivers/scsi/scsi_lib.c | 3 +- drivers/usb/misc/uss720.c | 4 +- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 5 ++ drivers/usb/storage/unusual_devs.h | 7 ++ fs/exec.c | 5 ++ fs/fuse/file.c | 72 ++++++++++++++++++++++-- fs/nfs/file.c | 2 + fs/nfs/mount_clnt.c | 4 +- fs/nfsd/nfs3xdr.c | 6 +- include/linux/blkdev.h | 9 ++- include/linux/nfsd/xdr4.h | 21 +++---- include/net/sctp/sm.h | 1 + include/net/sctp/structs.h | 3 + kernel/exit.c | 8 +++ kernel/power/user.c | 2 +- kernel/printk.c | 2 + kernel/timer.c | 6 ++ kernel/trace/trace.c | 10 +++- mm/mmap.c | 16 ++++- net/core/dev.c | 8 +++ net/sctp/input.c | 22 ++++++- net/sctp/sm_sideeffect.c | 35 ++++++++++++ net/sctp/transport.c | 2 + net/sunrpc/svc_xprt.c | 9 +++- security/integrity/ima/ima_policy.c | 2 + sound/oss/soundcard.c | 4 +- sound/pci/hda/hda_intel.c | 2 + sound/pci/hda/patch_realtek.c | 1 + 58 files changed, 523 insertions(+), 189 deletions(-)
PATCH 2/49 x86, hotplug: Use mwait to offline a processor, fix the legacy case
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: H. Peter Anvin <[email protected]>
upstream ea53069231f9317062910d6e772cca4ce93de8c8
x86, hotplug: Use mwait to offline a processor, fix the legacy case
Here included also some small follow-on patches to the same code:
upstream a68e5c94f7d3dd64fef34dd5d97e365cae4bb42a x86, hotplug: Move WBINVD back outside the play_dead loop
upstream ce5f68246bf2385d6174856708d0b746dc378f20
x86, hotplug: In the MWAIT case of play_dead, CLFLUSH the cache line
https://bugzilla.kernel.org/show_bug.cgi?id=5471
--- arch/x86/include/asm/processor.h | 23 ---------- arch/x86/kernel/smpboot.c | 85 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 84 insertions(+), 24 deletions(-)
arch/x86/include/asm/processor.h +0 -23
@@ -765,29 +765,6 @@ extern unsigned long boot_option_idle_oextern unsigned long idle_halt;extern unsigned long idle_nomwait; -/* -* on systems with caches, caches must be flashed as the absolute -* last instruction before going into a suspended halt. Otherwise, -* dirty data can linger in the cache and become stale on resume, -* leading to strange errors. -* -* perform a variety of operations to guarantee that the compiler -* will not reorder instructions. wbinvd itself is serializing -* so the processor will not reorder. -* -* Systems without cache can just go into halt. -*/ -static inline void wbinvd_halt (void ) -{ -mb (); -/* check for clflush to determine if wbinvd is legal */ -if (cpu_has_clflush) - asmvolatile ("cli; wbinvd; 1: hlt; jmp 1b" : : :"memory" ); -else -while (1 ) -halt (); -} -extern void enable_sep_cpu (void );extern int sysenter_setup (void );
arch/x86/kernel/smpboot.c +84 -1
95 lines not on this page · raw message
PATCH 2/49 x86, hotplug: Use mwait to offline a processor, fix the legacy case
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: H. Peter Anvin <[email protected]>
upstream ea53069231f9317062910d6e772cca4ce93de8c8
x86, hotplug: Use mwait to offline a processor, fix the legacy case
Here included also some small follow-on patches to the same code:
upstream a68e5c94f7d3dd64fef34dd5d97e365cae4bb42a x86, hotplug: Move WBINVD back outside the play_dead loop
upstream ce5f68246bf2385d6174856708d0b746dc378f20
x86, hotplug: In the MWAIT case of play_dead, CLFLUSH the cache line
https://bugzilla.kernel.org/show_bug.cgi?id=5471
--- arch/x86/include/asm/processor.h | 23 ---------- arch/x86/kernel/smpboot.c | 85 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 84 insertions(+), 24 deletions(-)
arch/x86/include/asm/processor.h +0 -23
@@ -765,29 +765,6 @@ extern unsigned long boot_option_idle_oextern unsigned long idle_halt;extern unsigned long idle_nomwait; -/* -* on systems with caches, caches must be flashed as the absolute -* last instruction before going into a suspended halt. Otherwise, -* dirty data can linger in the cache and become stale on resume, -* leading to strange errors. -* -* perform a variety of operations to guarantee that the compiler -* will not reorder instructions. wbinvd itself is serializing -* so the processor will not reorder. -* -* Systems without cache can just go into halt. -*/ -static inline void wbinvd_halt (void ) -{ -mb (); -/* check for clflush to determine if wbinvd is legal */ -if (cpu_has_clflush) - asmvolatile ("cli; wbinvd; 1: hlt; jmp 1b" : : :"memory" ); -else -while (1 ) -halt (); -} -extern void enable_sep_cpu (void );extern int sysenter_setup (void );
arch/x86/kernel/smpboot.c +84 -1
95 lines not on this page · raw message
PATCH 3/49 fuse: verify ioctl retries
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Miklos Szeredi <[email protected]>
commit 7572777eef78ebdee1ecb7c258c0ef94d35bad16 upstream.
Verify that the total length of the iovec returned in FUSE_IOCTL_RETRY doesn't overflow iov_length().
--- fs/fuse/file.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
fs/fuse/file.c +22 -0
@@ -1619,6 +1619,20 @@ static int fuse_ioctl_copy_user(struct preturn 0 ; } +/* Make sure iov_length() won't overflow */ +static int fuse_verify_ioctl_iov (struct iovec *iov,size_t count) +{ +size_t n; +u32 max =FUSE_MAX_PAGES_PER_REQ <<PAGE_SHIFT ; + +for (n =0 ; n < count; n++) { +if (iov->iov_len > (size_t ) max) +return -ENOMEM ; + max -= iov->iov_len; + } +return 0 ; +} +/* * For ioctls, there is no generic way to determine how much memory * needs to be read and/or written. Furthermore, ioctls are allowed
@@ -1812,6 +1826,14 @@ long fuse_do_ioctl(struct file *file, un in_iov =page_address (iov_page); out_iov = in_iov + in_iovs; + err =fuse_verify_ioctl_iov (in_iov, in_iovs); +if (err) + goto out; + + err =fuse_verify_ioctl_iov (out_iov, out_iovs); +if (err) + goto out; + goto retry; }
PATCH 4/49 fuse: fix ioctl when server is 32bit
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Miklos Szeredi <[email protected]>
commit d9d318d39dd5cb686660504a3565aac453709ccc upstream.
If a 32bit CUSE server is run on 64bit this results in EIO being returned to the caller.
The reason is that FUSE_IOCTL_RETRY reply was defined to use 'struct iovec', which is different on 32bit and 64bit archs.
Work around this by looking at the size of the reply to determine which struct was used. This is only needed if CONFIG_COMPAT is defined.
A more permanent fix for the interface will be to use the same struct on both 32bit and 64bit.
--- fs/fuse/file.c | 50 ++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 44 insertions(+), 6 deletions(-)
fs/fuse/file.c +44 -6
@@ -13,6 +13,7 @@#include <linux/kernel.h> #include <linux/sched.h> #include <linux/module.h> +#include <linux/compat.h> static const struct file_operations fuse_direct_io_file_operations;
@@ -1634,6 +1635,44 @@ static int fuse_verify_ioctl_iov(struct }/* +* CUSE servers compiled on 32bit broke on 64bit kernels because the +* ABI was defined to be 'struct iovec' which is different on 32bit +* and 64bit. Fortunately we can determine which structure the server +* used from the size of the reply. +*/ +static int fuse_copy_ioctl_iovec (struct iovec *dst,void *src, +size_t transferred,unsigned count, +bool is_compat) +{ +#ifdef CONFIG_COMPAT +if (count *sizeof (struct compat_iovec ) == transferred) { +struct compat_iovec *ciov = src; +unsigned i; + +/* +* With this interface a 32bit server cannot support +* non-compat (i.e. ones coming from 64bit apps) ioctl +* requests +*/ +if (!is_compat) +return -EINVAL ; + +for (i =0 ; i < count; i++) { + dst[i].iov_base =compat_ptr (ciov[i].iov_base); + dst[i].iov_len = ciov[i].iov_len; + } +return 0 ; + } +#endif + +if (count *sizeof (struct iovec ) != transferred) +return -EIO ; + +memcpy (dst, src, transferred); +return 0 ; +} + +/* * For ioctls, there is no generic way to determine how much memory * needs to be read and/or written. Furthermore, ioctls are allowed * to dereference the passed pointer, so the parameter requires deep
@@ -1814,14 +1853,13 @@ long fuse_do_ioctl(struct file *file, un in_iovs + out_iovs > FUSE_IOCTL_MAX_IOV) goto out; - err = -EIO ; -if ((in_iovs + out_iovs) *sizeof (struct iovec ) != transferred) - goto out; - -/* okay, copy in iovs and retry */ vaddr =kmap_atomic (pages[0 ],KM_USER0 ); -memcpy (page_address (iov_page), vaddr, transferred); + err =fuse_copy_ioctl_iovec (page_address (iov_page), vaddr, + transferred, in_iovs + out_iovs, + (flags &FUSE_IOCTL_COMPAT ) !=0 );kunmap_atomic (vaddr,KM_USER0 ); +if (err) + goto out; in_iov =page_address (iov_page); out_iov = in_iov + in_iovs;
PATCH 5/49 ALSA: hda: Use model=lg quirk for LG P1 Express to enable playback and capture
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Daniel T Chen <[email protected]>
commit 77c4d5cdb81d25a45fbdfb84dd3348121219a072 upstream.
The original reporter states that audible playback from the internal speaker is inaudible despite the hardware being properly detected. To work around this symptom, he uses the model=lg quirk to properly enable both playback, capture, and jack sense. Another user corroborates this workaround on separate hardware. Add this PCI SSID to the quirk table to enable it for further LG P1 Expresses.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -3975,6 +3975,7 @@ static struct snd_pci_quirk alc880_cfg_tSND_PCI_QUIRK (0x1734 ,0x10b0 ,"Fujitsu" ,ALC880_FUJITSU ),SND_PCI_QUIRK (0x1854 ,0x0018 ,"LG LW20" ,ALC880_LG_LW ),SND_PCI_QUIRK (0x1854 ,0x003b ,"LG" ,ALC880_LG ), +SND_PCI_QUIRK (0x1854 ,0x005f ,"LG P1 Express" ,ALC880_LG ),SND_PCI_QUIRK (0x1854 ,0x0068 ,"LG w1" ,ALC880_LG ),SND_PCI_QUIRK (0x1854 ,0x0077 ,"LG LW25" ,ALC880_LG_LW ), SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
PATCH 6/49 drm/kms: remove spaces from connector names (v2)
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit e76116ca9671e2e5239054a40303b94feab585ad upstream.
Grub doesn't parse spaces in parameters correctly, so this makes it impossible to force video= parameters for kms on the grub kernel command line.
v2: shorten the names to make them easier to type.
--- drivers/gpu/drm/drm_crtc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_crtc.c +4 -4
@@ -144,10 +144,10 @@ static struct drm_conn_prop_enum_list dr { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO", 0 }, { DRM_MODE_CONNECTOR_LVDS, "LVDS", 0 }, { DRM_MODE_CONNECTOR_Component, "Component", 0 }, - { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN", 0 }, - { DRM_MODE_CONNECTOR_DisplayPort, "DisplayPort", 0 }, - { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 }, - { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 }, + { DRM_MODE_CONNECTOR_9PinDIN, "DIN", 0 }, + { DRM_MODE_CONNECTOR_DisplayPort, "DP", 0 }, + { DRM_MODE_CONNECTOR_HDMIA, "HDMI-A", 0 }, + { DRM_MODE_CONNECTOR_HDMIB, "HDMI-B", 0 }, { DRM_MODE_CONNECTOR_TV, "TV", 0 }, };
Re: [Stable-review] [06/49] drm/kms: remove spaces from connector names (v2)
Quoted 13 lines · Greg KH
2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit
e76116ca9671e2e5239054a40303b94feab585adupstream.Grub doesn't parse spaces in parameters correctly, so this makes it impossible to force video= parameters for kms on the grub kernel command line.
v2: shorten the names to make them easier to type.
[...]
drivers/gpu/drm/drm_crtc.c static struct drm_conn_prop_enum_list dr · line 148
Quoted 12 lines
drivers/gpu/drm/drm_crtc.c +2
-4@@ -144,10 +144,10 @@ static struct drm_conn_prop_enum_list dr { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO", 0 }, { DRM_MODE_CONNECTOR_LVDS, "LVDS", 0 }, { DRM_MODE_CONNECTOR_Component, "Component", 0 }, - { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN", 0 }, - { DRM_MODE_CONNECTOR_DisplayPort, "DisplayPort", 0 }, - { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 }, - { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 }, + { DRM_MODE_CONNECTOR_9PinDIN, "DIN", 0 }, + { DRM_MODE_CONNECTOR_DisplayPort, "DP", 0 },
[...]
Why change 'DisplayPort', which doesn't have a space in it? This might break a previously working kernel command line.
Ben.
Signature · 2 lines
Ben Hutchings Once a job is fouled up, anything done to improve it makes it worse.
Re: [Stable-review] [06/49] drm/kms: remove spaces from connector names (v2)
Quoted 29 lines · Ben Hutchings
Quoted 13 lines · Greg KH
2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit
e76116ca9671e2e5239054a40303b94feab585adupstream.Grub doesn't parse spaces in parameters correctly, so this makes it impossible to force video= parameters for kms on the grub kernel command line.
v2: shorten the names to make them easier to type.
[...]
Quoted 12 lines
drivers/gpu/drm/drm_crtc.c +2
-4@@ -144,10 +144,10 @@ static struct drm_conn_prop_enum_list dr { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO", 0 }, { DRM_MODE_CONNECTOR_LVDS, "LVDS", 0 }, { DRM_MODE_CONNECTOR_Component, "Component", 0 }, - { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN", 0 }, - { DRM_MODE_CONNECTOR_DisplayPort, "DisplayPort", 0 }, - { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 }, - { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 }, + { DRM_MODE_CONNECTOR_9PinDIN, "DIN", 0 }, + { DRM_MODE_CONNECTOR_DisplayPort, "DP", 0 },[...]
Quoted 2 lines
Why change 'DisplayPort', which doesn't have a space in it? This might break a previously working kernel command line.
That's what happened in Linus's tree, I just mirror it :)
thanks,
greg k-h
Re: [Stable-review] [06/49] drm/kms: remove spaces from connector names (v2)
Quoted 30 lines · Greg KH
Quoted 29 lines · Ben Hutchings
Quoted 13 lines · Greg KH
2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit
e76116ca9671e2e5239054a40303b94feab585adupstream.Grub doesn't parse spaces in parameters correctly, so this makes it impossible to force video= parameters for kms on the grub kernel command line.
v2: shorten the names to make them easier to type.
[...]
Quoted 12 lines
drivers/gpu/drm/drm_crtc.c +2
-4@@ -144,10 +144,10 @@ static struct drm_conn_prop_enum_list dr { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO", 0 }, { DRM_MODE_CONNECTOR_LVDS, "LVDS", 0 }, { DRM_MODE_CONNECTOR_Component, "Component", 0 }, - { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN", 0 }, - { DRM_MODE_CONNECTOR_DisplayPort, "DisplayPort", 0 }, - { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 }, - { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 }, + { DRM_MODE_CONNECTOR_9PinDIN, "DIN", 0 }, + { DRM_MODE_CONNECTOR_DisplayPort, "DP", 0 },[...]
Quoted 4 lines
Quoted 2 lines
Why change 'DisplayPort', which doesn't have a space in it? This might break a previously working kernel command line.
That's what happened in Linus's tree, I just mirror it :)
Yeah, sorry, that was really directed at Alex.
Ben.
Signature · 2 lines
Ben Hutchings Once a job is fouled up, anything done to improve it makes it worse.
Re: [Stable-review] [06/49] drm/kms: remove spaces from connector names (v2)
Quoted 31 lines · Ben Hutchings
Quoted 30 lines · Greg KH
Quoted 29 lines · Ben Hutchings
Quoted 13 lines · Greg KH
2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Alex Deucher <[email protected]>
commit
e76116ca9671e2e5239054a40303b94feab585adupstream.Grub doesn't parse spaces in parameters correctly, so this makes it impossible to force video= parameters for kms on the grub kernel command line.
v2: shorten the names to make them easier to type.
[...]
Quoted 12 lines
drivers/gpu/drm/drm_crtc.c +2
-4@@ -144,10 +144,10 @@ static struct drm_conn_prop_enum_list dr { DRM_MODE_CONNECTOR_SVIDEO, "SVIDEO", 0 }, { DRM_MODE_CONNECTOR_LVDS, "LVDS", 0 }, { DRM_MODE_CONNECTOR_Component, "Component", 0 }, - { DRM_MODE_CONNECTOR_9PinDIN, "9-pin DIN", 0 }, - { DRM_MODE_CONNECTOR_DisplayPort, "DisplayPort", 0 }, - { DRM_MODE_CONNECTOR_HDMIA, "HDMI Type A", 0 }, - { DRM_MODE_CONNECTOR_HDMIB, "HDMI Type B", 0 }, + { DRM_MODE_CONNECTOR_9PinDIN, "DIN", 0 }, + { DRM_MODE_CONNECTOR_DisplayPort, "DP", 0 },[...]
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Why change 'DisplayPort', which doesn't have a space in it? This might break a previously working kernel command line.
That's what happened in Linus's tree, I just mirror it :)
Yeah, sorry, that was really directed at Alex.
We wanted to make them shorter so as to be easier to type on the command line. I don't think anyone uses these much at the moment. Also, you can't force displayport on like other encoders, so if it's not detected, you are out of luck.
Alex
Quoted 7 lines
Ben.
--
Ben Hutchings
Once a job is fouled up, anything done to improve it makes it worse.
PATCH 7/49 nohz: Fix printk_needs_cpu() return value on offline cpus
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Heiko Carstens <[email protected]>
commit 61ab25447ad6334a74e32f60efb135a3467223f8 upstream.
This patch fixes a hang observed with 2.6.32 kernels where timers got enqueued on offline cpus.
printk_needs_cpu() may return 1 if called on offline cpus. When a cpu gets offlined it schedules the idle process which, before killing its own cpu, will call tick_nohz_stop_sched_tick(). That function in turn will call printk_needs_cpu() in order to check if the local tick can be disabled. On offline cpus this function should naturally return 0 since regardless if the tick gets disabled or not the cpu will be dead short after. That is besides the fact that __cpu_disable() should already have made sure that no interrupts on the offlined cpu will be delivered anyway.
In this case it prevents tick_nohz_stop_sched_tick() to call select_nohz_load_balancer(). No idea if that really is a problem. However what made me debug this is that on 2.6.32 the function get_nohz_load_balancer() is used within __mod_timer() to select a cpu on which a timer gets enqueued. If printk_needs_cpu() returns 1 then the nohz_load_balancer cpu doesn't get updated when a cpu gets offlined. It may contain the cpu number of an offline cpu. In turn timers get enqueued on an offline cpu and not very surprisingly they never expire and cause system hangs.
This has been observed 2.6.32 kernels. On current kernels __mod_timer() uses get_nohz_timer_target() which doesn't have that problem. However there might be other problems because of the too early exit tick_nohz_stop_sched_tick() in case a cpu goes offline.
Easiest way to fix this is just to test if the current cpu is offline and call printk_tick() directly which clears the condition.
Alternatively I tried a cpu hotplug notifier which would clear the condition, however between calling the notifier function and printk_needs_cpu() something could have called printk() again and the problem is back again. This seems to be the safest fix.
LKML-Reference: <[email protected]>
--- kernel/printk.c | 2 ++ 1 file changed, 2 insertions(+)
kernel/printk.c +2 -0
@@ -1014,6 +1014,8 @@ void printk_tick(void)int printk_needs_cpu (int cpu) { +if (unlikely (cpu_is_offline (cpu))) +printk_tick ();return per_cpu (printk_pending, cpu); }
PATCH 8/49 nohz: Fix get_next_timer_interrupt() vs cpu hotplug
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Heiko Carstens <[email protected]>
commit dbd87b5af055a0cc9bba17795c9a2b0d17795389 upstream.
This fixes a bug as seen on 2.6.32 based kernels where timers got enqueued on offline cpus.
If a cpu goes offline it might still have pending timers. These will be migrated during CPU_DEAD handling after the cpu is offline. However while the cpu is going offline it will schedule the idle task which will then call tick_nohz_stop_sched_tick().
That function in turn will call get_next_timer_intterupt() to figure out if the tick of the cpu can be stopped or not. If it turns out that the next tick is just one jiffy off (delta_jiffies == 1) tick_nohz_stop_sched_tick() incorrectly assumes that the tick should not stop and takes an early exit and thus it won't update the load balancer cpu.
Just afterwards the cpu will be killed and the load balancer cpu could be the offline cpu.
On 2.6.32 based kernel get_nohz_load_balancer() gets called to decide on which cpu a timer should be enqueued (see __mod_timer()). Which leads to the possibility that timers get enqueued on an offline cpu. These will never expire and can cause a system hang.
This has been observed 2.6.32 kernels. On current kernels __mod_timer() uses get_nohz_timer_target() which doesn't have that problem. However there might be other problems because of the too early exit tick_nohz_stop_sched_tick() in case a cpu goes offline.
The easiest and probably safest fix seems to be to let get_next_timer_interrupt() just lie and let it say there isn't any pending timer if the current cpu is offline.
I also thought of moving migrate_[hr]timers() from CPU_DEAD to CPU_DYING, but seeing that there already have been fixes at least in the hrtimer code in this area I'm afraid that this could add new subtle bugs.
LKML-Reference: <[email protected]>
--- kernel/timer.c | 6 ++++++ 1 file changed, 6 insertions(+)
kernel/timer.c +6 -0
@@ -1173,6 +1173,12 @@ unsigned long get_next_timer_interrupt(ustruct tvec_base *base =__get_cpu_var (tvec_bases);unsigned long expires; +/* +* Pretend that there is no timer pending if the cpu is offline. +* Possible pending timers will be migrated later to an active cpu. +*/ +if (cpu_is_offline (smp_processor_id ())) +return now +NEXT_TIMER_MAX_DELTA ;spin_lock (&base->lock);if (time_before_eq (base->next_timer, base->timer_jiffies)) base->next_timer =__next_timer_interrupt (base);
PATCH 9/49 NFS: Fix panic after nfs_umount()
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Chuck Lever <[email protected]>
commit 5b362ac3799ff4225c40935500f520cad4d7ed66 upstream.
After a few unsuccessful NFS mount attempts in which the client and server cannot agree on an authentication flavor both support, the client panics. nfs_umount() is invoked in the kernel in this case.
Turns out nfs_umount()'s UMNT RPC invocation causes the RPC client to write off the end of the rpc_clnt's iostat array. This is because the mount client's nrprocs field is initialized with the count of defined procedures (two: MNT and UMNT), rather than the size of the client's proc array (four).
The fix is to use the same initialization technique used by most other upper layer clients in the kernel.
Introduced by commit 0b524123, which failed to update nrprocs when support was added for UMNT in the kernel.
--- fs/nfs/mount_clnt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfs/mount_clnt.c +2 -2
@@ -503,13 +503,13 @@ static struct rpc_procinfo mnt3_procedurstatic struct rpc_version mnt_version1 = { .number =1 , - .nrprocs =2 , + .nrprocs =ARRAY_SIZE (mnt_procedures), .procs = mnt_procedures, };static struct rpc_version mnt_version3 = { .number =3 , - .nrprocs =2 , + .nrprocs =ARRAY_SIZE (mnt3_procedures), .procs = mnt3_procedures, };
PATCH 10/49 nfsd: Fix possible BUG_ON firing in set_change_info
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Neil Brown <[email protected]>
commit c1ac3ffcd0bc7e9617f62be8c7043d53ab84deac upstream.
If vfs_getattr in fill_post_wcc returns an error, we don't set fh_post_change.
For NFSv4, this can result in set_change_info triggering a BUG_ON. i.e. fh_post_saved being zero isn't really a bug.
So:
- instead of BUGging when fh_post_saved is zero, just clear ->atomic.
- if vfs_getattr fails in fill_post_wcc, take a copy of i_ctime anyway. This will be used i seg_change_info, but not overly trusted.
- While we are there, remove the pointless 'if' statements in set_change_info. There is no harm setting all the values.
--- fs/nfsd/nfs3xdr.c | 6 ++++-- include/linux/nfsd/xdr4.h | 21 ++++++++++----------- 2 files changed, 14 insertions(+), 13 deletions(-)
fs/nfsd/nfs3xdr.c +4 -2
@@ -273,9 +273,11 @@ void fill_post_wcc(struct svc_fh *fhp) err =vfs_getattr (fhp->fh_export->ex_path.mnt, fhp->fh_dentry, &fhp->fh_post_attr); fhp->fh_post_change = fhp->fh_dentry->d_inode->i_version; -if (err) +if (err) { fhp->fh_post_saved =0 ; -else +/* Grab the ctime anyway - set_change_info might use it */ + fhp->fh_post_attr.ctime = fhp->fh_dentry->d_inode->i_ctime; + }else fhp->fh_post_saved =1 ; }
include/linux/nfsd/xdr4.h +10 -11
@@ -480,18 +480,17 @@ static inline bool nfsd4_not_cached(strustatic inline void set_change_info (struct nfsd4_change_info *cinfo,struct svc_fh *fhp) { -BUG_ON (!fhp->fh_pre_saved || !fhp->fh_post_saved); - cinfo->atomic =1 ; +BUG_ON (!fhp->fh_pre_saved); + cinfo->atomic = fhp->fh_post_saved; cinfo->change_supported =IS_I_VERSION (fhp->fh_dentry->d_inode); -if (cinfo->change_supported) { - cinfo->before_change = fhp->fh_pre_change; - cinfo->after_change = fhp->fh_post_change; - }else { - cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec; - cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec; - cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec; - cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec; - } + + cinfo->before_change = fhp->fh_pre_change; + cinfo->after_change = fhp->fh_post_change; + cinfo->before_ctime_sec = fhp->fh_pre_ctime.tv_sec; + cinfo->before_ctime_nsec = fhp->fh_pre_ctime.tv_nsec; + cinfo->after_ctime_sec = fhp->fh_post_attr.ctime.tv_sec; + cinfo->after_ctime_nsec = fhp->fh_post_attr.ctime.tv_nsec; + }int nfs4svc_encode_voidres (struct svc_rqst *,__be32 *,void *);
PATCH 11/49 NFS: Fix fcntl F_GETLK not reporting some conflicts
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Sergey Vlasov <[email protected]>
commit 21ac19d484a8ffb66f64487846c8d53afef04d2b upstream.
The commit 129a84de2347002f09721cda3155ccfd19fade40 (locks: fix F_GETLK regression (failure to find conflicts)) fixed the posix_test_lock() function by itself, however, its usage in NFS changed by the commit 9d6a8c5c213e34c475e72b245a8eb709258e968c (locks: give posix_test_lock same interface as ->lock) remained broken - subsequent NFS-specific locking code received F_UNLCK instead of the user-specified lock type. To fix the problem, fl->fl_type needs to be saved before the posix_test_lock() call and restored if no local conflicts were reported.
Reference: https://bugzilla.kernel.org/show_bug.cgi?id=23892
--- fs/nfs/file.c | 2 ++ 1 file changed, 2 insertions(+)
fs/nfs/file.c +2 -0
@@ -680,6 +680,7 @@ static int do_getlk(struct file *filp, i {struct inode *inode = filp->f_mapping->host;int status =0 ; +unsigned int saved_type = fl->fl_type;/* Try local locking first */ posix_test_lock (filp, fl);
@@ -687,6 +688,7 @@ static int do_getlk(struct file *filp, i/* found a conflict */ goto out; } + fl->fl_type = saved_type;if (nfs_have_delegation (inode,FMODE_READ )) goto out_noconflict;
PATCH 12/49 sunrpc: prevent use-after-free on clearing XPT_BUSY
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: NeilBrown <[email protected]>
commit ed2849d3ecfa339435818eeff28f6c3424300cec upstream.
When an xprt is created, it has a refcount of 1, and XPT_BUSY is set. The refcount is *not* owned by the thread that created the xprt (as is clear from the fact that creators never put the reference). Rather, it is owned by the absence of XPT_DEAD. Once XPT_DEAD is set, (And XPT_BUSY is clear) that initial reference is dropped and the xprt can be freed.
So when a creator clears XPT_BUSY it is dropping its only reference and so must not touch the xprt again.
However svc_recv, after calling ->xpo_accept (and so getting an XPT_BUSY reference on a new xprt), calls svc_xprt_recieved. This clears XPT_BUSY and then svc_xprt_enqueue - this last without owning a reference. This is dangerous and has been seen to leave svc_xprt_enqueue working with an xprt containing garbage.
So we need to hold an extra counted reference over that call to svc_xprt_received.
For safety, any time we clear XPT_BUSY and then use the xprt again, we first get a reference, and the put it again afterwards.
Note that svc_close_all does not need this extra protection as there are no threads running, and the final free can only be called asynchronously from such a thread.
--- net/sunrpc/svc_xprt.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
net/sunrpc/svc_xprt.c +8 -1
@@ -209,6 +209,7 @@ int svc_create_xprt(struct svc_serv *serspin_lock (&svc_xprt_class_lock);list_for_each_entry (xcl, &svc_xprt_class_list, xcl_list) {struct svc_xprt *newxprt; +unsigned short newport;if (strcmp (xprt_name, xcl->xcl_name))continue ;
@@ -227,8 +228,9 @@ int svc_create_xprt(struct svc_serv *serspin_lock_bh (&serv->sv_lock);list_add (&newxprt->xpt_list, &serv->sv_permsocks);spin_unlock_bh (&serv->sv_lock); + newport =svc_xprt_local_port (newxprt);clear_bit (XPT_BUSY , &newxprt->xpt_flags); -return svc_xprt_local_port (newxprt); +return newport; } err:spin_unlock (&svc_xprt_class_lock);
@@ -430,8 +432,13 @@ void svc_xprt_received(struct svc_xprt * {BUG_ON (!test_bit (XPT_BUSY , &xprt->xpt_flags)); xprt->xpt_pool =NULL ; +/* As soon as we clear busy, the xprt could be closed and +* 'put', so we need a reference to call svc_xprt_enqueue with: +*/ +svc_xprt_get (xprt);clear_bit (XPT_BUSY , &xprt->xpt_flags);svc_xprt_enqueue (xprt); +svc_xprt_put (xprt); }EXPORT_SYMBOL_GPL (svc_xprt_received);
PATCH 13/49 hwmon: (adm1026) Allow 1 as a valid divider value
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Gabriele Gorla <[email protected]>
commit 8b0f1840a46449e1946fc88860ef3ec8d6b1c2c7 upstream.
Allow 1 as a valid div value as specified in the ADM1026 datasheet.
--- drivers/hwmon/adm1026.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/hwmon/adm1026.c +1 -3
@@ -923,9 +923,7 @@ static ssize_t set_fan_div(struct device val =simple_strtol (buf,NULL ,10 ); new_div =DIV_TO_REG (val); -if (new_div ==0 ) { -return -EINVAL ; - } +mutex_lock (&data->update_lock); orig_div = data->fan_div[nr]; data->fan_div[nr] =DIV_FROM_REG (new_div);
PATCH 14/49 hwmon: (adm1026) Fix setting fan_div
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Gabriele Gorla <[email protected]>
commit 52bc9802ce849d0d287cc5fe76d06b0daa3986ca upstream.
Prevent setting fan_div from stomping on other fans that share the same I2C register.
--- drivers/hwmon/adm1026.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/hwmon/adm1026.c +9 -7
@@ -919,7 +919,7 @@ static ssize_t set_fan_div(struct deviceint nr = sensor_attr->index;struct i2c_client *client =to_i2c_client (dev);struct adm1026_data *data =i2c_get_clientdata (client); -int val, orig_div, new_div, shift; +int val, orig_div, new_div; val =simple_strtol (buf,NULL ,10 ); new_div =DIV_TO_REG (val);
@@ -929,15 +929,17 @@ static ssize_t set_fan_div(struct device data->fan_div[nr] =DIV_FROM_REG (new_div);if (nr <4 ) {/* 0 <= nr < 4 */ - shift =2 * nr;adm1026_write_value (client,ADM1026_REG_FAN_DIV_0_3 , - ((DIV_TO_REG (orig_div) & (~(0x03 << shift))) | - (new_div << shift))); + (DIV_TO_REG (data->fan_div[0 ]) <<0 ) | + (DIV_TO_REG (data->fan_div[1 ]) <<2 ) | + (DIV_TO_REG (data->fan_div[2 ]) <<4 ) | + (DIV_TO_REG (data->fan_div[3 ]) <<6 )); }else {/* 3 < nr < 8 */ - shift =2 * (nr -4 );adm1026_write_value (client,ADM1026_REG_FAN_DIV_4_7 , - ((DIV_TO_REG (orig_div) & (~(0x03 << (2 * shift)))) | - (new_div << shift))); + (DIV_TO_REG (data->fan_div[4 ]) <<0 ) | + (DIV_TO_REG (data->fan_div[5 ]) <<2 ) | + (DIV_TO_REG (data->fan_div[6 ]) <<4 ) | + (DIV_TO_REG (data->fan_div[7 ]) <<6 )); }if (data->fan_div[nr] != orig_div) {
PATCH 15/49 amd64_edac: Fix interleaving check
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Borislav Petkov <[email protected]>
commit e726f3c368e7c1919a7166ec09c5705759f1a69d upstream.
When matching error address to the range contained by one memory node, we're in valid range when node interleaving
1. is disabled, or
2. enabled and when the address bits we interleave on match the interleave selector on this node (see the "Node Interleaving" section in the BKDG for an enlightening example).
Thus, when we early-exit, we need to reverse the compound logic statement properly.
--- drivers/edac/amd64_edac.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/edac/amd64_edac.c +1 -1
@@ -1628,7 +1628,7 @@ static int f10_match_to_this_node(structdebugf1 (" HoleOffset=0x%x HoleValid=0x%x IntlvSel=0x%x\n" , hole_off, hole_valid, intlv_sel); -if (intlv_en || +if (intlv_en && (intlv_sel != ((sys_addr >>12 ) & intlv_en)))return -EINVAL ;
PATCH 16/49 IB/uverbs: Handle large number of entries in poll CQ
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Dan Carpenter <[email protected]>
commit 7182afea8d1afd432a17c18162cc3fd441d0da93 upstream.
In ib_uverbs_poll_cq() code there is a potential integer overflow if userspace passes in a large cmd.ne. The calls to kmalloc() would allocate smaller buffers than intended, leading to memory corruption. There iss also an information leak if resp wasn't all used. Unprivileged userspace may call this function, although only if an RDMA device that uses this function is present.
Fix this by copying CQ entries one at a time, which avoids the allocation entirely, and also by moving this copying into a function that makes sure to initialize all memory copied to userspace.
Special thanks to Jason Gunthorpe <[email protected]> for his help and advice.
[ Monkey around with things a bit to avoid bad code generation by gcc
when designated initializers are used. - Roland ]
--- drivers/infiniband/core/uverbs_cmd.c | 101 +++++++++++++++++++---------------- 1 file changed, 57 insertions(+), 44 deletions(-)
drivers/infiniband/core/uverbs_cmd.c +57 -44
@@ -875,68 +875,81 @@ out:return ret ? ret : in_len; } +static int copy_wc_to_user (void __user *dest,struct ib_wc *wc) +{ +struct ib_uverbs_wc tmp; + + tmp.wr_id = wc->wr_id; + tmp.status = wc->status; + tmp.opcode = wc->opcode; + tmp.vendor_err = wc->vendor_err; + tmp.byte_len = wc->byte_len; + tmp.ex.imm_data = (__u32 __force ) wc->ex.imm_data; + tmp.qp_num = wc->qp->qp_num; + tmp.src_qp = wc->src_qp; + tmp.wc_flags = wc->wc_flags; + tmp.pkey_index = wc->pkey_index; + tmp.slid = wc->slid; + tmp.sl = wc->sl; + tmp.dlid_path_bits = wc->dlid_path_bits; + tmp.port_num = wc->port_num; + tmp.reserved =0 ; + +if (copy_to_user (dest, &tmp,sizeof tmp)) +return -EFAULT ; + +return 0 ; +} +ssize_t ib_uverbs_poll_cq (struct ib_uverbs_file *file,const char __user *buf,int in_len,int out_len) {struct ib_uverbs_poll_cq cmd; -struct ib_uverbs_poll_cq_resp *resp; +struct ib_uverbs_poll_cq_resp resp; +u8 __user *header_ptr; +u8 __user *data_ptr;struct ib_cq *cq; -struct ib_wc *wc; -int ret =0 ; -int i; -int rsize; +struct ib_wc wc; +int ret;if (copy_from_user (&cmd, buf,sizeof cmd))return -EFAULT ; - wc =kmalloc (cmd.ne *sizeof *wc,GFP_KERNEL ); -if (!wc) -return -ENOMEM ; - - rsize =sizeof *resp + cmd.ne *sizeof (struct ib_uverbs_wc ); - resp =kmalloc (rsize,GFP_KERNEL ); -if (!resp) { - ret = -ENOMEM ; - goto out_wc; - } - cq =idr_read_cq (cmd.cq_handle, file->ucontext,0 ); -if (!cq) { - ret = -EINVAL ; - goto out; - } +if (!cq) +return -EINVAL ; - resp->count =ib_poll_cq (cq, cmd.ne, wc); - -put_cq_read (cq); +/* we copy a struct ib_uverbs_poll_cq_resp to user space */ + header_ptr = (void __user *)(unsigned long ) cmd.response; + data_ptr = header_ptr +sizeof resp; + +memset (&resp,0 ,sizeof resp); +while (resp.count < cmd.ne) { + ret =ib_poll_cq (cq,1 , &wc); +if (ret <0 ) + goto out_put; +if (!ret) +break ; + + ret =copy_wc_to_user (data_ptr, &wc); +if (ret) + goto out_put; -for (i =0 ; i < resp->count; i++) { - resp->wc[i].wr_id = wc[i].wr_id; - resp->wc[i].status = wc[i].status; - resp->wc[i].opcode = wc[i].opcode; - resp->wc[i].vendor_err = wc[i].vendor_err; - resp->wc[i].byte_len = wc[i].byte_len; - resp->wc[i].ex.imm_data = (__u32 __force ) wc[i].ex.imm_data; - resp->wc[i].qp_num = wc[i].qp->qp_num; - resp->wc[i].src_qp = wc[i].src_qp; - resp->wc[i].wc_flags = wc[i].wc_flags; - resp->wc[i].pkey_index = wc[i].pkey_index; - resp->wc[i].slid = wc[i].slid; - resp->wc[i].sl = wc[i].sl; - resp->wc[i].dlid_path_bits = wc[i].dlid_path_bits; - resp->wc[i].port_num = wc[i].port_num; + data_ptr +=sizeof (struct ib_uverbs_wc ); + ++resp.count; } -if (copy_to_user ((void __user *) (unsigned long ) cmd.response, resp, rsize)) +if (copy_to_user (header_ptr, &resp,sizeof resp)) { ret = -EFAULT ; + goto out_put; + } -out: -kfree (resp); + ret = in_len; -out_wc: -kfree (wc); -return ret ? ret : in_len; +out_put: +put_cq_read (cq); +return ret; } ssize_t ib_uverbs_req_notify_cq(struct ib_uverbs_file *file,
PATCH 17/49 PM / Hibernate: Fix PM_POST_* notification with user-space suspend
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Takashi Iwai <[email protected]>
commit 1497dd1d29c6a53fcd3c80f7ac8d0e0239e7389e upstream.
The user-space hibernation sends a wrong notification after the image restoration because of thinko for the file flag check. RDONLY corresponds to hibernation and WRONLY to restoration, confusingly.
--- kernel/power/user.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/power/user.c +1 -1
@@ -137,7 +137,7 @@ static int snapshot_release(struct inodefree_all_swap_pages (data->swap);if (data->frozen)thaw_processes (); -pm_notifier_call_chain (data->mode ==O_WRONLY ? +pm_notifier_call_chain (data->mode ==O_RDONLY ?PM_POST_HIBERNATION :PM_POST_RESTORE );atomic_inc (&snapshot_device_available);
PATCH 18/49 ACPICA: Fix Scope() op in module level code
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Bob Moore <[email protected]>
commit 8df3fc981dc12d9fdcaef4100a2193b605024d7a upstream.
Some Panasonic Toughbooks create nodes in module level code. Module level code is the executable AML code outside of control method, for example, below AML code creates a node \_SB.PCI0.GFX0.DD02.CUBL
If (\_OSI ("Windows 2006"))
{
Scope (\_SB.PCI0.GFX0.DD02)
{
Name (CUBL, Ones)
...
}
}Scope() op does not actually create a new object, it refers to an existing object(\_SB.PCI0.GFX0.DD02 in above example). However, for Scope(), we want to indeed open a new scope, so the child nodes(CUBL in above example) can be created correctly under it.
https://bugzilla.kernel.org/show_bug.cgi?id=19462
--- drivers/acpi/acpica/dswexec.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-)
drivers/acpi/acpica/dswexec.c +17 -2
@@ -300,10 +300,25 @@ acpi_ds_exec_begin_op(struct acpi_walk_s* we must enter this object into the namespace. The created * object is temporary and will be deleted upon completion of * the execution of this method. +* +* Note 10/2010: Except for the Scope() op. This opcode does +* not actually create a new object, it refers to an existing +* object. However, for Scope(), we want to indeed open a +* new scope. */ - status =acpi_ds_load2_begin_op (walk_state,NULL ); +if (op->common.aml_opcode !=AML_SCOPE_OP ) { + status = +acpi_ds_load2_begin_op (walk_state,NULL ); + }else { + status = +acpi_ds_scope_stack_push (op->named.node, + op->named.node-> + type, walk_state); +if (ACPI_FAILURE (status)) { +return_ACPI_STATUS (status); + } + } } -break ;case AML_CLASS_EXECUTE :
PATCH 19/49 ACPI: EC: Add another dmi match entry for MSI hardware
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Alexey Starikovskiy <[email protected]>
commit a5dc4f898c2a0f66e2cefada6c687db82ba2fcbc upstream.
http://bugzilla.kernel.org/show_bug.cgi?id=15418
--- drivers/acpi/ec.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/acpi/ec.c +3 -0
@@ -953,6 +953,9 @@ static struct dmi_system_id __initdata e ec_flag_msi, "MSI hardware", { DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-Star")}, NULL}, { + ec_flag_msi, "MSI hardware", { + DMI_MATCH(DMI_CHASSIS_VENDOR, "MICRO-STAR")}, NULL}, + { ec_validate_ecdt, "ASUS hardware", { DMI_MATCH(DMI_BIOS_VENDOR, "ASUS") }, NULL}, {},
PATCH 20/49 orinoco: fix TKIP countermeasure behaviour
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: David Kilroy <[email protected]>
commit 0a54917c3fc295cb61f3fb52373c173fd3b69f48 upstream.
Enable the port when disabling countermeasures, and disable it on enabling countermeasures.
This bug causes the response of the system to certain attacks to be ineffective.
It also prevents wpa_supplicant from getting scan results, as wpa_supplicant disables countermeasures on startup - preventing the hardware from scanning.
wpa_supplicant works with ap_mode=2 despite this bug because the commit handler re-enables the port.
The log tends to look like:
State: DISCONNECTED -> SCANNING
Starting AP scan for wildcard SSID
Scan requested (ret=0) - scan timeout 5 seconds
EAPOL: disable timer tick
EAPOL: Supplicant port status: Unauthorized
Scan timeout - try to get results
Failed to get scan results
Failed to get scan results - try scanning again
Setting scan request: 1 sec 0 usec
Starting AP scan for wildcard SSID
Scan requested (ret=-1) - scan timeout 5 seconds
Failed to initiate AP scan.
Reported by: Giacomo Comes <[email protected]> Signed-off by: David Kilroy <[email protected]>
--- drivers/net/wireless/orinoco/wext.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/orinoco/wext.c +2 -2
@@ -1022,10 +1022,10 @@ static int orinoco_ioctl_set_auth(struct*/ if (param->value) { priv->tkip_cm_active =1 ; - ret =hermes_enable_port (hw,0 ); + ret =hermes_disable_port (hw,0 ); }else { priv->tkip_cm_active =0 ; - ret =hermes_disable_port (hw,0 ); + ret =hermes_enable_port (hw,0 ); }break ;
PATCH 21/49 orinoco: clear countermeasure setting on commit
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: David Kilroy <[email protected]>
commit ba34fcee476d11e7c9df95932787a22a96ff6e68 upstream.
... and interface up.
In these situations, you are usually trying to connect to a new AP, so keeping TKIP countermeasures active is confusing. This is already how the driver behaves (inadvertently). However, querying SIOCGIWAUTH may tell userspace that countermeasures are active when they aren't.
Clear the setting so that the reporting matches what the driver has done..
Signed-off by: David Kilroy <[email protected]>
--- drivers/net/wireless/orinoco/main.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/wireless/orinoco/main.c +6 -0
@@ -1767,6 +1767,12 @@ static int __orinoco_commit(struct orinostruct net_device *dev = priv->ndev;int err =0 ; +/* If we've called commit, we are reconfiguring or bringing the +* interface up. Maintaining countermeasures across this would +* be confusing, so note that we've disabled them. The port will +* be enabled later in orinoco_commit or __orinoco_up. */ + priv->tkip_cm_active =0 ; + err =orinoco_hw_program_rids (priv);/* FIXME: what about netif_tx_lock */
PATCH 22/49 x86, amd: Fix panic on AMD CPU family 0x15
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Andreas Herrmann <[email protected]>
[The mainline kernel doesn't have this problem. Commit "(23588c3) x86,
amd: Add support for CPUID topology extension of AMD CPUs" removed the family check. But 2.6.32.y needs to be fixed.]
This CPU family check is not required -- existence of the NodeId MSR is indicated by a CPUID feature flag which is already checked in amd_fixup_dcm() -- and it needlessly prevents amd_fixup_dcm() to be called for newer AMD CPUs.
In worst case this can lead to a panic in the scheduler code for AMD family 0x15 multi-node AMD CPUs. I just have a picture of VGA console output so I can't copy-and-paste it herein, but the call stack of such a panic looked like:
do_divide_error
...
find_busiest_group
run_rebalance_domains
...
apic_timer_interrupt
...
cpu_idle
The mainline kernel doesn't have this problem. Commit "(23588c3) x86,
amd: Add support for CPUID topology extension of AMD CPUs" removed the family check. But 2.6.32.y needs to be fixed.
--- arch/x86/kernel/cpu/amd.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/cpu/amd.c +1 -2
@@ -305,8 +305,7 @@ static void __cpuinit amd_detect_cmp(str/* use socket ID also for last level cache */ per_cpu (cpu_llc_id, cpu) = c->phys_proc_id;/* fixup topology information on multi-node processors */ -if ((c->x86 ==0x10 ) && (c->x86_model ==9 )) -amd_fixup_dcm (c); +amd_fixup_dcm (c);#endif }
PATCH 23/49 md: fix bug with re-adding of partially recovered device.
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: NeilBrown <[email protected]>
commit 1a855a0606653d2d82506281e2c686bacb4b2f45 upstream.
With v0.90 metadata, a hot-spare does not become a full member of the array until recovery is complete. So if we re-add such a device to the array, we know that all of it is as up-to-date as the event count would suggest, and so it a bitmap-based recovery is possible.
However with v1.x metadata, the hot-spare immediately becomes a full member of the array, but it record how much of the device has been recovered. If the array is stopped and re-assembled recovery starts from this point.
When such a device is hot-added to an array we currently lose the 'how much is recovered' information and incorrectly included it as a full in-sync member (after bitmap-based fixup).
This is wrong and unsafe and could corrupt data.
So be more careful about setting saved_raid_disk - which is what guides the re-adding of devices back into an array. The new code matches the code in slot_store which does a similar thing, which is encouraging.
This is suitable for any -stable kernel.
--- drivers/md/md.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/md/md.c +5 -2
@@ -4802,7 +4802,7 @@ static int add_new_disk(mddev_t * mddev, PTR_ERR(rdev));return PTR_ERR (rdev); } -/* set save_raid_disk if appropriate */ +/* set saved_raid_disk if appropriate */ if (!mddev->persistent) {if (info->state & (1 <<MD_DISK_SYNC ) && info->raid_disk < mddev->raid_disks)
@@ -4812,7 +4812,10 @@ static int add_new_disk(mddev_t * mddev, }else super_types[mddev->major_version].validate_super (mddev, rdev); - rdev->saved_raid_disk = rdev->raid_disk; +if (test_bit (In_sync, &rdev->flags)) + rdev->saved_raid_disk = rdev->raid_disk; +else + rdev->saved_raid_disk =-1 ;clear_bit (In_sync, &rdev->flags);/* just to be sure */ if (info->state & (1 <<MD_DISK_WRITEMOSTLY ))
PATCH 24/49 tracing: Fix panic when lseek() called on "trace" opened for writing
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Slava Pestov <[email protected]>
commit 364829b1263b44aa60383824e4c1289d83d78ca7 upstream.
The file_ops struct for the "trace" special file defined llseek as seq_lseek(). However, if the file was opened for writing only, seq_open() was not called, and the seek would dereference a null pointer, file->private_data.
This patch introduces a new wrapper for seq_lseek() which checks if the file descriptor is opened for reading first. If not, it does nothing.
LKML-Reference: <[email protected]>
--- kernel/trace/trace.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
kernel/trace/trace.c +9 -1
@@ -2199,11 +2199,19 @@ tracing_write_stub(struct file *filp, coreturn count; } +static loff_t tracing_seek (struct file *file,loff_t offset,int origin) +{ +if (file->f_mode &FMODE_READ ) +return seq_lseek (file, offset, origin); +else +return 0 ; +} +static const struct file_operations tracing_fops = { .open = tracing_open, .read = seq_read, .write = tracing_write_stub, - .llseek = seq_lseek, + .llseek = tracing_seek, .release = tracing_release, };
PATCH 25/49 x86, gcc-4.6: Use gcc -m options when building vdso
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: H. Peter Anvin <[email protected]>
commit de2a8cf98ecdde25231d6c5e7901e2cffaf32af9 upstream.
The vdso Makefile passes linker-style -m options not to the linker but to gcc. This happens to work with earlier gcc, but fails with gcc 4.6. Pass gcc-style -m options, instead.
Note: all currently supported versions of gcc supports -m32, so there is no reason to conditionalize it any more.
LKML-Reference: <tip-*@git.kernel.org>
arch/x86/vdso/Makefile +2 -2
@@ -25,7 +25,7 @@ targets += vdso.so vdso.so.dbg vdso.lds $(vobjs-y) export CPPFLAGS_vdso.lds += -P -C -VDSO_LDFLAGS_vdso.lds = -m elf_x86_64 -Wl,-soname=linux-vdso.so.1 \ +VDSO_LDFLAGS_vdso.lds = -m64 -Wl,-soname=linux-vdso.so.1 \ -Wl,-z,max-page-size=4096 -Wl,-z,common-page-size=4096 $(obj)/vdso.o: $(src)/vdso.S $(obj)/vdso.so
@@ -69,7 +69,7 @@ vdso32.so-$(VDSO32-y) += sysenter vdso32-images = $(vdso32.so-y:%=vdso32-%.so) CPPFLAGS_vdso32.lds = $(CPPFLAGS_vdso.lds) -VDSO_LDFLAGS_vdso32.lds = -m elf_i386 -Wl,-soname=linux-gate.so.1 +VDSO_LDFLAGS_vdso32.lds = -m32 -Wl,-soname=linux-gate.so.1 # This makes sure the $(obj) subdirectory exists even though vdso32/ # is not a kbuild sub-make subdirectory.
PATCH 26/49 x86: Enable the intr-remap fault handling after local APIC setup
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Kenji Kaneshige <[email protected]>
commit 7f7fbf45c6b748074546f7f16b9488ca71de99c1 upstream.
Interrupt-remapping gets enabled very early in the boot, as it determines the apic mode that the processor can use. And the current code enables the vt-d fault handling before the setup_local_APIC(). And hence the APIC LDR registers and data structure in the memory may not be initialized. So the vt-d fault handling in logical xapic/x2apic modes were broken.
Fix this by enabling the vt-d fault handling in the end_local_APIC_setup()
A cleaner fix of enabling fault handling while enabling intr-remapping will be addressed for v2.6.38. [ Enabling intr-remapping determines the usage of x2apic mode and the apic mode determines the fault-handling configuration. ]
LKML-Reference: <[email protected]>
--- arch/x86/kernel/apic/apic.c | 8 ++++++++ arch/x86/kernel/apic/probe_64.c | 7 ------- 2 files changed, 8 insertions(+), 7 deletions(-)
arch/x86/kernel/apic/apic.c +8 -0
@@ -1361,6 +1361,14 @@ void __cpuinit end_local_APIC_setup(voidsetup_apic_nmi_watchdog (NULL );apic_pm_activate (); + +/* +* Now that local APIC setup is completed for BP, configure the fault +* handling for interrupt remapping. +*/ +if (!smp_processor_id () && intr_remapping_enabled) +enable_drhd_fault_handling (); + }#ifdef CONFIG_X86_X2APIC
arch/x86/kernel/apic/probe_64.c +0 -7
@@ -76,13 +76,6 @@ void __init default_setup_apic_routing(v/* need to update phys_pkg_id */ apic->phys_pkg_id = apicid_phys_pkg_id; } - -/* -* Now that apic routing model is selected, configure the -* fault handling for intr remapping. -*/ -if (intr_remapping_enabled) -enable_drhd_fault_handling (); }/* Same for both flat and physical. */
PATCH 27/49 x86, vt-d: Handle previous faults after enabling fault handling
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Suresh Siddha <[email protected]>
commit 7f99d946e71e71d484b7543b49e990508e70d0c0 upstream.
Fault handling is getting enabled after enabling the interrupt-remapping (as the success of interrupt-remapping can affect the apic mode and hence the fault handling mode).
Hence there can potentially be some faults between the window of enabling interrupt-remapping in the vt-d and the fault-handling of the vt-d units.
Handle any previous faults after enabling the vt-d fault handling.
For v2.6.38 cleanup, need to check if we can remove the dmar_fault() in the enable_intr_remapping() and see if we can enable fault handling along with enabling intr-remapping.
LKML-Reference: <[email protected]>
--- drivers/pci/dmar.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/pci/dmar.c +5 -0
@@ -1380,6 +1380,11 @@ int __init enable_drhd_fault_handling(vo (unsigned long long)drhd->reg_base_addr, ret);return -1 ; } + +/* +* Clear any previous faults. +*/ +dmar_fault (iommu->irq, iommu); }return 0 ;
PATCH 28/49 x86, vt-d: Fix the vt-d fault handling irq migration in the x2apic mode
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Kenji Kaneshige <[email protected]>
commit 086e8ced65d9bcc4a8e8f1cd39b09640f2883f90 upstream.
In x2apic mode, we need to set the upper address register of the fault handling interrupt register of the vt-d hardware. Without this irq migration of the vt-d fault handling interrupt is broken.
LKML-Reference: <1291225233.2648.39.camel@sbsiddha-MOBL3>
--- arch/x86/kernel/apic/io_apic.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/kernel/apic/io_apic.c +1 -0
@@ -3567,6 +3567,7 @@ static int dmar_msi_set_affinity(unsigne msg.data |=MSI_DATA_VECTOR (cfg->vector); msg.address_lo &= ~MSI_ADDR_DEST_ID_MASK ; msg.address_lo |=MSI_ADDR_DEST_ID (dest); + msg.address_hi =MSI_ADDR_BASE_HI |MSI_ADDR_EXT_DEST_ID (dest);dmar_msi_write (irq, &msg);
PATCH 29/49 x86, vt-d: Quirk for masking vtd spec errors to platform error handling logic
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Suresh Siddha <[email protected]>
commit 254e42006c893f45bca48f313536fcba12206418 upstream.
On platforms with Intel 7500 chipset, there were some reports of system hang/NMI's during kexec/kdump in the presence of interrupt-remapping enabled.
During kdump, there is a window where the devices might be still using old kernel's interrupt information, while the kdump kernel is coming up. This can cause vt-d faults as the interrupt configuration from the old kernel map to null IRTE entries in the new kernel etc. (with out interrupt-remapping enabled, we still have the same issue but in this case we will see benign spurious interrupt hit the new kernel).
Based on platform config settings, these platforms seem to generate NMI/SMI when a vt-d fault happens and there were reports that the resulting SMI causes the system to hang.
Fix it by masking vt-d spec defined errors to platform error reporting logic. VT-d spec related errors are already handled by the VT-d OS code, so need to report the same error through other channels.
LKML-Reference: <[email protected]>
--- drivers/pci/quirks.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+)
drivers/pci/quirks.c +23 -0
@@ -2575,6 +2575,29 @@ extern struct pci_fixup __end_pci_fixupsextern struct pci_fixup __start_pci_fixups_suspend[];extern struct pci_fixup __end_pci_fixups_suspend[]; +#if defined(CONFIG_DMAR ) || defined(CONFIG_INTR_REMAP ) +#define VTUNCERRMSK_REG 0x1ac +#define VTD_MSK_SPEC_ERRORS (1 << 31) +/* +* This is a quirk for masking vt-d spec defined errors to platform error +* handling logic. With out this, platforms using Intel 7500, 5500 chipsets +* (and the derivative chipsets like X58 etc) seem to generate NMI/SMI (based +* on the RAS config settings of the platform) when a vt-d fault happens. +* The resulting SMI caused the system to hang. +* +* VT-d spec related errors are already handled by the VT-d OS code, so no +* need to report the same error through other channels. +*/ +static void vtd_mask_spec_errors (struct pci_dev *dev) +{ +u32 word; + +pci_read_config_dword (dev,VTUNCERRMSK_REG , &word); +pci_write_config_dword (dev,VTUNCERRMSK_REG , word |VTD_MSK_SPEC_ERRORS ); +} +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x342e , vtd_mask_spec_errors); +DECLARE_PCI_FIXUP_EARLY (PCI_VENDOR_ID_INTEL ,0x3c28 , vtd_mask_spec_errors); +#endif void pci_fixup_device (enum pci_fixup_pass pass,struct pci_dev *dev) {
PATCH 30/49 hvc_console: Fix race between hvc_close and hvc_remove
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Amit Shah <[email protected]>
commit e74d098c66543d0731de62eb747ccd5b636a6f4c upstream.
Alan pointed out a race in the code where hvc_remove is invoked. The recent virtio_console work is the first user of hvc_remove().
Alan describes it thus:
The hvc_console assumes that a close and remove call can't occur at the same time.
In addition tty_hangup(tty) is problematic as tty_hangup is asynchronous itself....
So this can happen
hvc_close hvc_remove
hung up ? - no
lock
tty = hp->tty unlock
lock
hp->tty = NULL
unlock
notify del
kref_put the hvc struct
close completes
tty is destroyed
tty_hangup dead tty tty->ops will be NULL NULL->...
This patch adds some tty krefs and also converts to using tty_vhangup().
--- drivers/char/hvc_console.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-)
drivers/char/hvc_console.c +21 -10
@@ -312,6 +312,7 @@ static int hvc_open(struct tty_struct *tspin_lock_irqsave (&hp->lock, flags);/* Check and then increment for fast path open. */ if (hp->count++ >0 ) { +tty_kref_get (tty);spin_unlock_irqrestore (&hp->lock, flags);hvc_kick ();return 0 ;
@@ -319,7 +320,7 @@ static int hvc_open(struct tty_struct *t tty->driver_data = hp; - hp->tty = tty; + hp->tty =tty_kref_get (tty);spin_unlock_irqrestore (&hp->lock, flags);
@@ -336,6 +337,7 @@ static int hvc_open(struct tty_struct *tspin_lock_irqsave (&hp->lock, flags); hp->tty =NULL ;spin_unlock_irqrestore (&hp->lock, flags); +tty_kref_put (tty); tty->driver_data =NULL ;kref_put (&hp->kref, destroy_hvc_struct);printk (KERN_ERR "hvc_open: request_irq failed with rc %d.\n" , rc);
@@ -363,13 +365,18 @@ static void hvc_close(struct tty_structreturn ; hp = tty->driver_data; +spin_lock_irqsave (&hp->lock, flags); +tty_kref_get (tty);if (--hp->count ==0 ) {/* We are done with the tty pointer now. */ hp->tty =NULL ;spin_unlock_irqrestore (&hp->lock, flags); +/* Put the ref obtained in hvc_open() */ +tty_kref_put (tty); +if (hp->ops->notifier_del) hp->ops->notifier_del (hp, hp->data);
@@ -389,6 +396,7 @@ static void hvc_close(struct tty_structspin_unlock_irqrestore (&hp->lock, flags); } +tty_kref_put (tty);kref_put (&hp->kref, destroy_hvc_struct); }
@@ -424,10 +432,11 @@ static void hvc_hangup(struct tty_structspin_unlock_irqrestore (&hp->lock, flags);if (hp->ops->notifier_hangup) - hp->ops->notifier_hangup (hp, hp->data); + hp->ops->notifier_hangup (hp, hp->data);while (temp_open_count) { --temp_open_count; +tty_kref_put (tty);kref_put (&hp->kref, destroy_hvc_struct); } }
@@ -592,7 +601,7 @@ int hvc_poll(struct hvc_struct *hp) }/* No tty attached, just skip */ - tty = hp->tty; + tty =tty_kref_get (hp->tty);if (tty ==NULL ) goto bail;
@@ -672,6 +681,8 @@ int hvc_poll(struct hvc_struct *hp)tty_flip_buffer_push (tty); } +if (tty) +tty_kref_put (tty);return poll_mask; }
@@ -806,7 +817,7 @@ int hvc_remove(struct hvc_struct *hp)struct tty_struct *tty;spin_lock_irqsave (&hp->lock, flags); - tty = hp->tty; + tty =tty_kref_get (hp->tty);if (hp->index <MAX_NR_HVC_CONSOLES ) vtermnos[hp->index] =-1 ;
@@ -818,18 +829,18 @@ int hvc_remove(struct hvc_struct *hp)/* * We 'put' the instance that was grabbed when the kref instance * was initialized using kref_init(). Let the last holder of this -* kref cause it to be removed, which will probably be the tty_hangup +* kref cause it to be removed, which will probably be the tty_vhangup * below. */ kref_put (&hp->kref, destroy_hvc_struct);/* -* This function call will auto chain call hvc_hangup. The tty should -* always be valid at this time unless a simultaneous tty close already -* cleaned up the hvc_struct. +* This function call will auto chain call hvc_hangup. */ -if (tty) -tty_hangup (tty); +if (tty) { +tty_vhangup (tty); +tty_kref_put (tty); + }return 0 ; }
PATCH 31/49 hvc_console: Fix race between hvc_close and hvc_remove, again
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Anton Blanchard <[email protected]>
commit 320718ee074acce5ffced6506cb51af1388942aa upstream.
I don't claim to understand the tty layer, but it seems like hvc_open and hvc_close should be balanced in their kref reference counting.
Right now we get a kref every call to hvc_open:
if (hp->count++ > 0) {
tty_kref_get(tty); <----- here
spin_unlock_irqrestore(&hp->lock, flags);
hvc_kick();
return 0;
} /* else count == 0 */
tty->driver_data = hp;
hp->tty = tty_kref_get(tty); <------ or here if hp->count was 0But hvc_close has:
tty_kref_get(tty);
if (--hp->count == 0) {
...
/* Put the ref obtained in hvc_open() */
tty_kref_put(tty);
...
}
tty_kref_put(tty);Since the outside kref get/put balance we only do a single kref_put when count reaches 0.
The patch below changes things to call tty_kref_put once for every hvc_close call, and with that my machine boots fine.
--- drivers/char/hvc_console.c | 4 ---- 1 file changed, 4 deletions(-)
drivers/char/hvc_console.c +0 -4
@@ -367,16 +367,12 @@ static void hvc_close(struct tty_struct hp = tty->driver_data;spin_lock_irqsave (&hp->lock, flags); -tty_kref_get (tty);if (--hp->count ==0 ) {/* We are done with the tty pointer now. */ hp->tty =NULL ;spin_unlock_irqrestore (&hp->lock, flags); -/* Put the ref obtained in hvc_open() */ -tty_kref_put (tty); -if (hp->ops->notifier_del) hp->ops->notifier_del (hp, hp->data);
PATCH 32/49 HID: hidraw: fix window in hidraw_release
In reply to Greg KH2.6.32-longterm review patch. If anyone has any objections, please let us know.
------------------
From: Jiri Slaby <[email protected]>
commit cb174681a9ececa6702f114b85bdf82144b6a5af upstream.
[ Backport to .32.y by Antonio Ospite <[email protected]> ]
There is a window between hidraw_table check and its dereference. In that window, the device may be unplugged and removed form the system and we will then dereference NULL.
Lock that place properly so that either we get NULL and jump out or we can work with real pointer.
--- drivers/hid/hidraw.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-)
drivers/hid/hidraw.c +8 -3
@@ -211,11 +211,14 @@ static int hidraw_release(struct inode *unsigned int minor =iminor (inode);struct hidraw *dev;struct hidraw_list *list = file->private_data; +int ret; +mutex_lock (&minors_lock);if (!hidraw_table[minor]) {printk (KERN_EMERG "hidraw device with minor %d doesn't exist\n" , minor); -return -ENODEV ; + ret = -ENODEV ; + goto unlock; }list_del (&list->node);
@@ -229,10 +232,12 @@ static int hidraw_release(struct inode *kfree (list->hidraw); } } -kfree (list); + ret =0 ; +unlock: +mutex_unlock (&minors_lock); -return 0 ; +return ret; } static long hidraw_ioctl(struct file *file, unsigned int cmd,