3.10.25-stable review
Subsystems (2)
Greg Kroah-Hartman
maintainercover 3.10.25-stable review
This is the start of the stable review cycle for the 3.10.25 release. There are 78 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 me know.
Responses should be made by Fri Dec 20 21:10:56 UTC 2013. 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/v3.0/stable-review/patch-3.10.25-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Pseudo-Shortlog of commits:
Greg Kroah-Hartman <[email protected]>
Linux 3.10.25-rc1
Liu Bo <[email protected]>
Btrfs: do not run snapshot-aware defragment on error
Filipe David Borba Manana <[email protected]>
Btrfs: fix incorrect inode acl reset
Josef Bacik <[email protected]>
Btrfs: fix hole check in log_one_extent
Liu Bo <[email protected]>
Btrfs: fix memory leak of chunks' extent map
Greg Kroah-Hartman <[email protected]>
Revert "net: update consumers of MSG_MORE to recognize MSG_SENDPAGE_NOTLAST"
Nicolas Dichtel <[email protected]>
ip6tnl: fix use after free of fb_tnl_dev
Andy Adamson <[email protected]>
NFSv4 wait on recovery for async session errors
Alan <[email protected]>
sc1200_wdt: Fix oops
H Hartley Sweeten <[email protected]>
staging: comedi: ssv_dnp: use comedi_dio_update_state()
H Hartley Sweeten <[email protected]>
staging: comedi: drivers: use comedi_dio_update_state() for simple cases
Ian Abbott <[email protected]>
staging: comedi: pcmuio: fix possible NULL deref on detach
Ben Segall <[email protected]>
sched: Avoid throttle_cfs_rq() racing with period_timer stopping
Hans Verkuil <[email protected]>
cxd2820r_core: fix sparse warnings
Helge Deller <[email protected]>
nfs: fix do_div() warning by instead using sector_div()
Joe Thornber <[email protected]>
dm thin: switch to read only mode if a mapping insert fails
Mikulas Patocka <[email protected]>
dm table: fail dm_table_create on dm_round_up overflow
Mike Snitzer <[email protected]>
dm space map metadata: return on failure in sm_metadata_new_block
Mikulas Patocka <[email protected]>
dm delay: fix a possible deadlock due to shared workqueue
Joe Thornber <[email protected]>
dm array: fix a reference counting bug in shadow_ablock
Mikulas Patocka <[email protected]>
dm snapshot: avoid snapshot space leak on crash
Mikulas Patocka <[email protected]>
dm bufio: initialize read-only module parameters
David Sterba <[email protected]>
btrfs: call mnt_drop_write after interrupted subvol deletion
Dan Carpenter <[email protected]>
Btrfs: fix access_ok() check in btrfs_ioctl_send()
Dan Carpenter <[email protected]>
media: af9035: unlock on error in af9035_i2c_master_xfer()
Antti Palosaari <[email protected]>
media: af9035: add [0413:6a05] Leadtek WinFast DTV Dongle Dual
Hans Verkuil <[email protected]>
media: wm8775: fix broken audio routing
Antti Palosaari <[email protected]>
media: af9033: fix broken I2C
Hans Verkuil <[email protected]>
media: bttv: don't setup the controls if there are no video devices
Wei Yongjun <[email protected]>
media: saa7164: fix return value check in saa7164_initdev()
H. Peter Anvin <[email protected]>
x86, build, icc: Remove uninitialized_var() from compiler-intel.h
H. Peter Anvin <[email protected]>
x86, build: Pass in additional -mno-mmx, -mno-sse options
Matthew Garrett <[email protected]>
x86, efi: Don't use (U)EFI time services on 32 bit
Alex Deucher <[email protected]>
drm/radeon: fixup bad vram size on SI
Alex Deucher <[email protected]>
drm/radeon: program DCE2 audio dto just like DCE3
Carolyn Wyborny <[email protected]>
igb: Fix for issue where values could be too high for udelay function.
Ujjal Roy <[email protected]>
mwifiex: fix memory leak issue for ibss join
Johannes Berg <[email protected]>
iwlwifi: mvm: check sta_id/drain values in debugfs
Johannes Berg <[email protected]>
mac80211: don't attempt to reorder multicast frames
Bob Copeland <[email protected]>
Revert "mac80211: allow disable power save in mesh"
Paul Moore <[email protected]>
selinux: handle TCP SYN-ACK packets correctly in selinux_ip_postroute()
Paul Moore <[email protected]>
selinux: handle TCP SYN-ACK packets correctly in selinux_ip_output()
Sujith Manoharan <[email protected]>
ath9k: Fix XLNA bias strength
Sujith Manoharan <[email protected]>
ath9k: Fix QuickDrop usage
Ville Syrjälä <[email protected]>
drm/i915: Fix pipe CSC post offset calculation
Linus Pizunski <[email protected]>
drivers/rtc/rtc-at91rm9200.c: correct alarm over day/month wrap
Hong H. Pham <[email protected]>
powerpc: Fix PTE page address mismatch in pgtable ctor/dtor
Antti Palosaari <[email protected]>
media: af9035: fix broken I2C and USB I/O
Christian Engelmayer <[email protected]>
Input: usbtouchscreen - separate report and transmit buffer size handling
Fangxiaozhi (Franko) <[email protected]>
USB: option: support new huawei devices
Gustavo Zacarias <[email protected]>
USB: serial: option: blacklist interface 1 for Huawei E173s-6
Michael Grzeschik <[email protected]>
usb: gadget: composite: reset delayed_status on reset_config
Alan Stern <[email protected]>
usb: dwc3: fix implementation of endpoint wedge
Julius Werner <[email protected]>
usb: hub: Use correct reset for wedged USB3 devices that are NOTATTACHED
Jeff Layton <[email protected]>
nfsd: when reusing an existing repcache entry, unhash it first
Linus Torvalds <[email protected]>
futex: fix handling of read-only-mapped hugepages
Khalid Aziz <[email protected]>
PCI: Disable Bus Master only on kexec reboot
Dan Carpenter <[email protected]>
xfs: underflow bug in xfs_attrlist_by_handle()
Dave Chinner <[email protected]>
xfs: growfs overruns AGFL buffer on V4 filesystems
Jean Delvare <[email protected]>
hwmon: (w83l768ng) Fix fan speed control range
Brian Carnes <[email protected]>
hwmon: (w83l786ng) Fix fan speed control mode setting and reporting
José Miguel Gonçalves <[email protected]>
hwmon: HIH-6130: Support I2C bus drivers without I2C_FUNC_SMBUS_QUICK
Dan Carpenter <[email protected]>
hwmon: Prevent some divide by zeros in FAN_TO_REG()
Gleb Natapov <[email protected]>
KVM: x86: fix guest-initiated crash with x2apic (CVE-2013-6376)
Andy Honig <[email protected]>
KVM: x86: Convert vapic synchronization to _cached functions (CVE-2013-6368)
Andy Honig <[email protected]>
KVM: x86: Fix potential divide by 0 in lapic (CVE-2013-6367)
Andy Honig <[email protected]>
KVM: Improve create VCPU parameter (CVE-2013-4587)
Konstantin Khlebnikov <[email protected]>
ARM: 7913/1: fix framepointer check in unwind_frame
Konstantin Khlebnikov <[email protected]>
ARM: 7912/1: check stack pointer in get_wchan
Roger Quadros <[email protected]>
ARM: OMAP3: hwmod data: Don't prevent RESET of USB Host module
Sergei Ianovich <[email protected]>
ARM: pxa: prevent PXA270 occasional reboot freezes
Dmitry Eremin-Solenikov <[email protected]>
ARM: pxa: tosa: fix keys mapping
Anssi Hannula <[email protected]>
ALSA: hda - hdmi: Fix IEC958 ctl indexes for some simple HDMI devices
Takashi Iwai <[email protected]>
ALSA: hda - Mute all aamix inputs as default
Takashi Iwai <[email protected]>
ALSA: hda - Add static DAC/pin mapping for AD1986A codec
Stefano Panella <[email protected]>
ALSA: memalloc.h - fix wrong truncation of dma_addr_t
Takashi Iwai <[email protected]>
ALSA: compress: Fix 64bit ABI incompatibility
Mag <[email protected]>
Input: xpad - add signature for Razer Onza Classic Edition
Jim Quinlan <[email protected]>
MIPS: DMA: For BMIPS5000 cores flush region just like non-coherent R10000
-------------
Diffstat:
Makefile | 4 +- arch/arm/kernel/process.c | 7 +- arch/arm/kernel/stacktrace.c | 2 +- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 13 +-- arch/arm/mach-pxa/reset.c | 8 +- arch/arm/mach-pxa/tosa.c | 102 ++++++++++----------- arch/mips/mm/dma-default.c | 16 ++-- arch/powerpc/include/asm/pgalloc-32.h | 6 +- arch/powerpc/include/asm/pgalloc-64.h | 6 +- arch/x86/Makefile | 8 +- arch/x86/boot/Makefile | 6 +- arch/x86/boot/compressed/Makefile | 1 + arch/x86/kvm/lapic.c | 35 ++++--- arch/x86/kvm/lapic.h | 4 +- arch/x86/kvm/x86.c | 40 +------- arch/x86/platform/efi/efi.c | 7 -- arch/x86/realmode/rm/Makefile | 3 +- crypto/algif_hash.c | 3 - crypto/algif_skcipher.c | 3 - drivers/gpu/drm/i915/intel_display.c | 2 +- drivers/gpu/drm/radeon/r600_hdmi.c | 8 +- drivers/gpu/drm/radeon/si.c | 11 ++- drivers/hwmon/hih6130.c | 16 +++- drivers/hwmon/lm78.c | 2 + drivers/hwmon/sis5595.c | 2 + drivers/hwmon/vt8231.c | 2 +- drivers/hwmon/w83l786ng.c | 13 ++- drivers/input/joystick/xpad.c | 1 + drivers/input/touchscreen/usbtouchscreen.c | 22 ++++- drivers/md/dm-bufio.c | 5 + drivers/md/dm-delay.c | 23 +++-- drivers/md/dm-snap.c | 71 ++++++++++++-- drivers/md/dm-table.c | 5 + drivers/md/dm-thin.c | 4 +- drivers/md/persistent-data/dm-array.c | 10 +- drivers/md/persistent-data/dm-space-map-metadata.c | 8 +- drivers/media/dvb-frontends/af9033.c | 12 +-- drivers/media/dvb-frontends/cxd2820r_core.c | 4 +- drivers/media/i2c/wm8775.c | 4 +- drivers/media/pci/bt8xx/bttv-driver.c | 3 +- drivers/media/pci/saa7164/saa7164-core.c | 4 +- drivers/media/usb/dvb-usb-v2/af9035.c | 17 ++-- drivers/net/ethernet/intel/igb/e1000_phy.c | 5 +- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 22 +++-- drivers/net/wireless/iwlwifi/mvm/debugfs.c | 4 + drivers/net/wireless/mwifiex/sta_ioctl.c | 4 +- drivers/pci/pci-driver.c | 12 ++- drivers/rtc/rtc-at91rm9200.c | 2 + drivers/staging/comedi/drivers/amplc_pc263.c | 3 + drivers/staging/comedi/drivers/amplc_pci263.c | 3 + drivers/staging/comedi/drivers/pcmuio.c | 11 ++- drivers/staging/comedi/drivers/ssv_dnp.c | 6 +- drivers/usb/core/hub.c | 5 +- drivers/usb/dwc3/ep0.c | 2 + drivers/usb/dwc3/gadget.c | 5 +- drivers/usb/gadget/composite.c | 1 + drivers/usb/serial/option.c | 27 ++++++ drivers/watchdog/sc1200wdt.c | 3 +- fs/btrfs/acl.c | 2 +- fs/btrfs/inode.c | 47 ++++++---- fs/btrfs/ioctl.c | 3 +- fs/btrfs/send.c | 4 +- fs/btrfs/tree-log.c | 2 +- fs/btrfs/volumes.c | 2 + fs/nfs/blocklayout/extents.c | 2 +- fs/nfs/nfs4proc.c | 3 +- fs/nfsd/nfscache.c | 9 +- fs/xfs/xfs_fsops.c | 6 +- fs/xfs/xfs_ioctl.c | 3 +- fs/xfs/xfs_ioctl32.c | 3 +- include/linux/compiler-intel.h | 2 - include/linux/kexec.h | 3 + include/sound/memalloc.h | 2 +- include/uapi/sound/compress_offload.h | 6 +- kernel/futex.c | 2 +- kernel/kexec.c | 4 + kernel/sched/debug.c | 8 ++ kernel/sched/fair.c | 2 + net/ipv4/udp.c | 3 - net/ipv6/ip6_tunnel.c | 2 - net/mac80211/cfg.c | 3 +- net/mac80211/rx.c | 3 +- security/selinux/hooks.c | 93 +++++++++++++++---- sound/pci/hda/hda_generic.c | 47 +++++++++- sound/pci/hda/hda_generic.h | 3 + sound/pci/hda/patch_analog.c | 10 ++ sound/pci/hda/patch_hdmi.c | 5 +- virt/kvm/kvm_main.c | 3 + 88 files changed, 608 insertions(+), 317 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/78 MIPS: DMA: For BMIPS5000 cores flush region just like non-coherent R10000
3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jim Quinlan <[email protected]>
commit f86f55d3ad21b21b736bdeb29bee0f0937b77138 upstream.
The BMIPS5000 (Zephyr) processor utilizes instruction speculation. A stale misprediction address in either the JTB or the CRS may trigger a prefetch inside a region that is currently being used by a DMA engine, which is not IO-coherent. This prefetch will fetch a line into the scache, and that line will soon become stale (ie wrong) during/after the DMA. Mayhem ensues.
In dma-default.c, the r10000 is handled as a special case in the same way that we want to handle Zephyr. So we generalize the exception cases into a function, and include Zephyr as one of the processors that needs this special care.
Patchwork: https://patchwork.linux-mips.org/patch/5776/
--- arch/mips/mm/dma-default.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-)
arch/mips/mm/dma-default.c +10 -6
@@ -50,16 +50,20 @@ static inline struct page *dma_addr_to_p }/* +* The affected CPUs below in 'cpu_needs_post_dma_flush()' can +* speculatively fill random cachelines with stale data at any time, +* requiring an extra flush post-DMA. +* * Warning on the terminology - Linux calls an uncached area coherent; * MIPS terminology calls memory areas with hardware maintained coherency * coherent. */ - -static inline int cpu_is_noncoherent_r10000 (struct device *dev) +static inline int cpu_needs_post_dma_flush (struct device *dev) {return !plat_device_is_coherent (dev) && (current_cpu_type () ==CPU_R10000 || -current_cpu_type () ==CPU_R12000 ); +current_cpu_type () ==CPU_R12000 || +current_cpu_type () ==CPU_BMIPS5000 ); }static gfp_t massage_gfp_flags (const struct device *dev,gfp_t gfp)
@@ -230,7 +234,7 @@ static inline void __dma_sync(struct pagstatic void mips_dma_unmap_page (struct device *dev,dma_addr_t dma_addr,size_t size,enum dma_data_direction direction,struct dma_attrs *attrs) { -if (cpu_is_noncoherent_r10000 (dev)) +if (cpu_needs_post_dma_flush (dev))__dma_sync (dma_addr_to_page (dev, dma_addr), dma_addr & ~PAGE_MASK , size, direction);
@@ -281,7 +285,7 @@ static void mips_dma_unmap_sg(struct devstatic void mips_dma_sync_single_for_cpu (struct device *dev,dma_addr_t dma_handle,size_t size,enum dma_data_direction direction) { -if (cpu_is_noncoherent_r10000 (dev)) +if (cpu_needs_post_dma_flush (dev))__dma_sync (dma_addr_to_page (dev, dma_handle), dma_handle & ~PAGE_MASK , size, direction); }
@@ -302,7 +306,7 @@ static void mips_dma_sync_sg_for_cpu(str/* Make sure that gcc doesn't leave the empty loop body. */ for (i =0 ; i < nelems; i++, sg++) { -if (cpu_is_noncoherent_r10000 (dev)) +if (cpu_needs_post_dma_flush (dev))__dma_sync (sg_page (sg), sg->offset, sg->length, direction); }
Greg Kroah-Hartman
maintainerPATCH 2/78 Input: xpad - add signature for Razer Onza Classic Edition
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mag <[email protected]>
commit ed06349fe8d12dcb718984862b6e839fc8606c34 upstream.
--- drivers/input/joystick/xpad.c | 1 + 1 file changed, 1 insertion(+)
drivers/input/joystick/xpad.c +1 -0
@@ -167,6 +167,7 @@ static const struct xpad_device { { 0x1430, 0x8888, "TX6500+ Dance Pad (first generation)", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX }, { 0x146b, 0x0601, "BigBen Interactive XBOX 360 Controller", 0, XTYPE_XBOX360 }, { 0x1689, 0xfd00, "Razer Onza Tournament Edition", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, + { 0x1689, 0xfd01, "Razer Onza Classic Edition", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, { 0x1bad, 0x0002, "Harmonix Rock Band Guitar", 0, XTYPE_XBOX360 }, { 0x1bad, 0x0003, "Harmonix Rock Band Drumkit", MAP_DPAD_TO_BUTTONS, XTYPE_XBOX360 }, { 0x1bad, 0xf016, "Mad Catz Xbox 360 Controller", 0, XTYPE_XBOX360 },
Greg Kroah-Hartman
maintainerPATCH 3/78 ALSA: compress: Fix 64bit ABI incompatibility
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 6733cf572a9e20db2b7580a5dd39d5782d571eec upstream.
snd_pcm_uframes_t is defined as unsigned long so it would take different sizes depending on 32 or 64bit architectures. As we don't want this ABI incompatibility, and there is no real 64bit user yet, let's make it the fixed size with __u32.
Also bump the protocol version number to 0.1.2.
--- include/uapi/sound/compress_offload.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
include/uapi/sound/compress_offload.h +3 -3
@@ -30,7 +30,7 @@#include <sound/compress_params.h> -#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 1) +#define SNDRV_COMPRESS_VERSION SNDRV_PROTOCOL_VERSION(0, 1, 2)/** * struct snd_compressed_buffer: compressed buffer * @fragment_size: size of buffer fragment in bytes
@@ -67,8 +67,8 @@ struct snd_compr_params {struct snd_compr_tstamp {__u32 byte_offset;__u32 copied_total; -snd_pcm_uframes_t pcm_frames; -snd_pcm_uframes_t pcm_io_frames; +__u32 pcm_frames; +__u32 pcm_io_frames;__u32 sampling_rate; };
Greg Kroah-Hartman
maintainerPATCH 4/78 ALSA: memalloc.h - fix wrong truncation of dma_addr_t
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefano Panella <[email protected]>
commit 932e9dec380c67ec15ac3eb073bb55797d8b4801 upstream.
When running a 32bit kernel the hda_intel driver is still reporting a 64bit dma_mask if the HW supports it.
Quoted 1 line
Quoted 1 line
From
sound/pci/hda/hda_intel.c:
/* allow 64bit DMA address if supported by H/W */
if ((gcap & ICH6_GCAP_64OK) && !pci_set_dma_mask(pci, DMA_BIT_MASK(64)))
pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(64));
else {
pci_set_dma_mask(pci, DMA_BIT_MASK(32));
pci_set_consistent_dma_mask(pci, DMA_BIT_MASK(32));
}which means when there is a call to dma_alloc_coherent from snd_malloc_dev_pages a machine address bigger than 32bit can be returned. This can be true in particular if running the 32bit kernel as a pv dom0 under the Xen Hypervisor or PAE on bare metal.
The problem is that when calling setup_bdle to program the BLE the dma_addr_t returned from the dma_alloc_coherent is wrongly truncated from snd_sgbuf_get_addr if running a 32bit kernel:
static inline dma_addr_t snd_sgbuf_get_addr(struct snd_dma_buffer *dmab,
size_t offset)
{
struct snd_sg_buf *sgbuf = dmab->private_data;
dma_addr_t addr = sgbuf->table[offset >> PAGE_SHIFT].addr;
addr &= PAGE_MASK;
return addr + offset % PAGE_SIZE;
}where PAGE_MASK in a 32bit kernel is zeroing the upper 32bit af addr.
Without this patch the HW will fetch the 32bit truncated address, which is not the one obtained from dma_alloc_coherent and will result to a non working audio but can corrupt host memory at a random location.
The current patch apply to v3.13-rc3-74-g6c843f5
--- include/sound/memalloc.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
include/sound/memalloc.h +1 -1
@@ -103,7 +103,7 @@ static inline dma_addr_t snd_sgbuf_get_a {struct snd_sg_buf *sgbuf = dmab->private_data;dma_addr_t addr = sgbuf->table[offset >>PAGE_SHIFT ].addr; - addr &=PAGE_MASK ; + addr &= ~((dma_addr_t )PAGE_SIZE -1 );return addr + offset %PAGE_SIZE ; }
Greg Kroah-Hartman
maintainerPATCH 5/78 ALSA: hda - Add static DAC/pin mapping for AD1986A codec
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 3690739b013504d33fe9348dd45f6b126aa370fb upstream.
AD1986A codec is a pretty old codec and has really many hidden restrictions. One of such is that each DAC is dedicated to certain pin although there are possible connections. Currently, the generic parser tries to assign individual DACs as much as possible, and this lead to two bad situations: connections where the sound actually doesn't work, and connections conflicting other channels.
We may fix this by trying to find the best connections more harder, but as of now, it's easier to give some hints for paired DAC/pin connections and honor them if available, since such a hint is needed only for specific codecs (right now only AD1986A, and there will be unlikely any others in future).
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=64971
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=66621
--- sound/pci/hda/hda_generic.c | 23 ++++++++++++++++++++++- sound/pci/hda/hda_generic.h | 3 +++ sound/pci/hda/patch_analog.c | 10 ++++++++++ 3 files changed, 35 insertions(+), 1 deletion(-)
sound/pci/hda/hda_generic.c +22 -1
@@ -468,6 +468,20 @@ static void invalidate_nid_path(struct hmemset (path,0 ,sizeof (*path)); } +/* return a DAC if paired to the given pin by codec driver */ +static hda_nid_t get_preferred_dac (struct hda_codec *codec,hda_nid_t pin) +{ +struct hda_gen_spec *spec = codec->spec; +const hda_nid_t *list = spec->preferred_dacs; + +if (!list) +return 0 ; +for (; *list; list +=2 ) +if (*list == pin) +return list[1 ]; +return 0 ; +} +/* look for an empty DAC slot */ static hda_nid_t look_for_dac (struct hda_codec *codec,hda_nid_t pin,bool is_digital)
@@ -1134,7 +1148,14 @@ static int try_assign_dacs(struct hda_cocontinue ; } - dacs[i] =look_for_dac (codec, pin, false); + dacs[i] =get_preferred_dac (codec, pin); +if (dacs[i]) { +if (is_dac_already_used (codec, dacs[i])) + badness += bad->shared_primary; + } + +if (!dacs[i]) + dacs[i] =look_for_dac (codec, pin, false);if (!dacs[i] && !i) {/* try to steal the DAC of surrounds for the front */ for (j =1 ; j < num_outs; j++) {
sound/pci/hda/hda_generic.h +3 -0
@@ -241,6 +241,9 @@ struct hda_gen_spec {const struct badness_table *main_out_badness;const struct badness_table *extra_out_badness; +/* preferred pin/DAC pairs; an array of paired NIDs */ +const hda_nid_t *preferred_dacs; +/* loopback mixing mode */ bool aamix_mode;
sound/pci/hda/patch_analog.c +10 -0
@@ -1227,6 +1227,14 @@ static int ad1986a_parse_auto_config(str {int err;struct ad198x_spec *spec; +static hda_nid_t preferred_pairs[] = { +0x1a ,0x03 , +0x1b ,0x03 , +0x1c ,0x04 , +0x1d ,0x05 , +0x1e ,0x03 , +0 + }; err =alloc_ad_spec (codec);if (err <0 )
@@ -1247,6 +1255,8 @@ static int ad1986a_parse_auto_config(str* So, let's disable the shared stream. */ spec->gen.multiout.no_share_stream =1 ; +/* give fixed DAC/pin pairs */ + spec->gen.preferred_dacs = preferred_pairs;snd_hda_pick_fixup (codec,NULL , ad1986a_fixup_tbl, ad1986a_fixups);snd_hda_apply_fixup (codec,HDA_FIXUP_ACT_PRE_PROBE );
Greg Kroah-Hartman
maintainerPATCH 6/78 ALSA: hda - Mute all aamix inputs as default
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit ebb93c057dda376414fbc499ad6ace9b527dff5a upstream.
Not all channels have been initialized, so far, especially when aamix NID itself doesn't have amps but its leaves have. This patch fixes these holes. Otherwise you might get unexpected loopback inputs, e.g. from surround channels.
--- sound/pci/hda/hda_generic.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
sound/pci/hda/hda_generic.c +24 -0
@@ -4222,6 +4222,26 @@ static unsigned int snd_hda_gen_path_powreturn AC_PWRST_D3 ; } +/* mute all aamix inputs initially; parse up to the first leaves */ +static void mute_all_mixer_nid (struct hda_codec *codec,hda_nid_t mix) +{ +int i, nums; +const hda_nid_t *conn; +bool has_amp; + + nums =snd_hda_get_conn_list (codec, mix, &conn); + has_amp =nid_has_mute (codec, mix,HDA_INPUT ); +for (i =0 ; i < nums; i++) { +if (has_amp) +snd_hda_codec_amp_stereo (codec, mix, +HDA_INPUT , i, +0xff ,HDA_AMP_MUTE ); +else if (nid_has_volume (codec, conn[i],HDA_OUTPUT )) +snd_hda_codec_amp_stereo (codec, conn[i], +HDA_OUTPUT ,0 , +0xff ,HDA_AMP_MUTE ); + } +}/* * Parse the given BIOS configuration and set up the hda_gen_spec
@@ -4360,6 +4380,10 @@ int snd_hda_gen_parse_auto_config(struct } } +/* mute all aamix input initially */ +if (spec->mixer_nid) +mute_all_mixer_nid (codec, spec->mixer_nid); + dig_only:parse_digital (codec);
Greg Kroah-Hartman
maintainerPATCH 7/78 ALSA: hda - hdmi: Fix IEC958 ctl indexes for some simple HDMI devices
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anssi Hannula <[email protected]>
commit c9a6338aecdb92f9d015ecc26d203e54250bebbb upstream.
In case a single HDA card has both HDMI and S/PDIF outputs, the S/PDIF outputs will have their IEC958 controls created starting from index 16 and the HDMI controls will be created starting from index 0.
However, HDMI simple_playback_build_controls() as used by old VIA and NVIDIA codecs incorrectly requests the IEC958 controls to be created with an S/PDIF type instead of HDMI.
In case the card has other codecs that have HDMI outputs, the controls will be created with wrong index=16, causing them to e.g. be unreachable by the ALSA "hdmi" alias.
Fix that by making simple_playback_build_controls() request controls with HDMI indexes.
Not many cards have an affected configuration, but e.g. ASUS M3N78-VM contains an integrated NVIDIA HDA "card" with:
- a VIA codec that has, among others, an S/PDIF pin incorrectly labelled as an HDMI pin, and
- an NVIDIA MCP7x HDMI codec.
--- sound/pci/hda/patch_hdmi.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
sound/pci/hda/patch_hdmi.c +3 -2
@@ -2001,8 +2001,9 @@ static int simple_playback_build_controlint err; per_cvt =get_cvt (spec,0 ); - err =snd_hda_create_spdif_out_ctls (codec, per_cvt->cvt_nid, - per_cvt->cvt_nid); + err =snd_hda_create_dig_out_ctls (codec, per_cvt->cvt_nid, + per_cvt->cvt_nid, +HDA_PCM_TYPE_HDMI );if (err <0 )return err;return simple_hdmi_build_jack (codec,0 );
Greg Kroah-Hartman
maintainerPATCH 8/78 ARM: pxa: tosa: fix keys mapping
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dmitry Eremin-Solenikov <[email protected]>
commit 506cac15ac86f204b83e3cfccde73eeb4e7c5f34 upstream.
When converting from tosa-keyboard driver to matrix keyboard, tosa keys received extra 1 column shift. Replace that with correct values to make keyboard work again.
--- arch/arm/mach-pxa/tosa.c | 102 +++++++++++++++++++++++------------------------ 1 file changed, 51 insertions(+), 51 deletions(-)
arch/arm/mach-pxa/tosa.c +51 -51
@@ -424,57 +424,57 @@ static struct platform_device tosa_power* Tosa Keyboard */ static const uint32_t tosakbd_keymap[] = { -KEY (0 ,2 ,KEY_W ), -KEY (0 ,6 ,KEY_K ), -KEY (0 ,7 ,KEY_BACKSPACE ), -KEY (0 ,8 ,KEY_P ), -KEY (1 ,1 ,KEY_Q ), -KEY (1 ,2 ,KEY_E ), -KEY (1 ,3 ,KEY_T ), -KEY (1 ,4 ,KEY_Y ), -KEY (1 ,6 ,KEY_O ), -KEY (1 ,7 ,KEY_I ), -KEY (1 ,8 ,KEY_COMMA ), -KEY (2 ,1 ,KEY_A ), -KEY (2 ,2 ,KEY_D ), -KEY (2 ,3 ,KEY_G ), -KEY (2 ,4 ,KEY_U ), -KEY (2 ,6 ,KEY_L ), -KEY (2 ,7 ,KEY_ENTER ), -KEY (2 ,8 ,KEY_DOT ), -KEY (3 ,1 ,KEY_Z ), -KEY (3 ,2 ,KEY_C ), -KEY (3 ,3 ,KEY_V ), -KEY (3 ,4 ,KEY_J ), -KEY (3 ,5 ,TOSA_KEY_ADDRESSBOOK ), -KEY (3 ,6 ,TOSA_KEY_CANCEL ), -KEY (3 ,7 ,TOSA_KEY_CENTER ), -KEY (3 ,8 ,TOSA_KEY_OK ), -KEY (3 ,9 ,KEY_LEFTSHIFT ), -KEY (4 ,1 ,KEY_S ), -KEY (4 ,2 ,KEY_R ), -KEY (4 ,3 ,KEY_B ), -KEY (4 ,4 ,KEY_N ), -KEY (4 ,5 ,TOSA_KEY_CALENDAR ), -KEY (4 ,6 ,TOSA_KEY_HOMEPAGE ), -KEY (4 ,7 ,KEY_LEFTCTRL ), -KEY (4 ,8 ,TOSA_KEY_LIGHT ), -KEY (4 ,10 ,KEY_RIGHTSHIFT ), -KEY (5 ,1 ,KEY_TAB ), -KEY (5 ,2 ,KEY_SLASH ), -KEY (5 ,3 ,KEY_H ), -KEY (5 ,4 ,KEY_M ), -KEY (5 ,5 ,TOSA_KEY_MENU ), -KEY (5 ,7 ,KEY_UP ), -KEY (5 ,11 ,TOSA_KEY_FN ), -KEY (6 ,1 ,KEY_X ), -KEY (6 ,2 ,KEY_F ), -KEY (6 ,3 ,KEY_SPACE ), -KEY (6 ,4 ,KEY_APOSTROPHE ), -KEY (6 ,5 ,TOSA_KEY_MAIL ), -KEY (6 ,6 ,KEY_LEFT ), -KEY (6 ,7 ,KEY_DOWN ), -KEY (6 ,8 ,KEY_RIGHT ), +KEY (0 ,1 ,KEY_W ), +KEY (0 ,5 ,KEY_K ), +KEY (0 ,6 ,KEY_BACKSPACE ), +KEY (0 ,7 ,KEY_P ), +KEY (1 ,0 ,KEY_Q ), +KEY (1 ,1 ,KEY_E ), +KEY (1 ,2 ,KEY_T ), +KEY (1 ,3 ,KEY_Y ), +KEY (1 ,5 ,KEY_O ), +KEY (1 ,6 ,KEY_I ), +KEY (1 ,7 ,KEY_COMMA ), +KEY (2 ,0 ,KEY_A ), +KEY (2 ,1 ,KEY_D ), +KEY (2 ,2 ,KEY_G ), +KEY (2 ,3 ,KEY_U ), +KEY (2 ,5 ,KEY_L ), +KEY (2 ,6 ,KEY_ENTER ), +KEY (2 ,7 ,KEY_DOT ), +KEY (3 ,0 ,KEY_Z ), +KEY (3 ,1 ,KEY_C ), +KEY (3 ,2 ,KEY_V ), +KEY (3 ,3 ,KEY_J ), +KEY (3 ,4 ,TOSA_KEY_ADDRESSBOOK ), +KEY (3 ,5 ,TOSA_KEY_CANCEL ), +KEY (3 ,6 ,TOSA_KEY_CENTER ), +KEY (3 ,7 ,TOSA_KEY_OK ), +KEY (3 ,8 ,KEY_LEFTSHIFT ), +KEY (4 ,0 ,KEY_S ), +KEY (4 ,1 ,KEY_R ), +KEY (4 ,2 ,KEY_B ), +KEY (4 ,3 ,KEY_N ), +KEY (4 ,4 ,TOSA_KEY_CALENDAR ), +KEY (4 ,5 ,TOSA_KEY_HOMEPAGE ), +KEY (4 ,6 ,KEY_LEFTCTRL ), +KEY (4 ,7 ,TOSA_KEY_LIGHT ), +KEY (4 ,9 ,KEY_RIGHTSHIFT ), +KEY (5 ,0 ,KEY_TAB ), +KEY (5 ,1 ,KEY_SLASH ), +KEY (5 ,2 ,KEY_H ), +KEY (5 ,3 ,KEY_M ), +KEY (5 ,4 ,TOSA_KEY_MENU ), +KEY (5 ,6 ,KEY_UP ), +KEY (5 ,10 ,TOSA_KEY_FN ), +KEY (6 ,0 ,KEY_X ), +KEY (6 ,1 ,KEY_F ), +KEY (6 ,2 ,KEY_SPACE ), +KEY (6 ,3 ,KEY_APOSTROPHE ), +KEY (6 ,4 ,TOSA_KEY_MAIL ), +KEY (6 ,5 ,KEY_LEFT ), +KEY (6 ,6 ,KEY_DOWN ), +KEY (6 ,7 ,KEY_RIGHT ), };static struct matrix_keymap_data tosakbd_keymap_data = {
Greg Kroah-Hartman
maintainerPATCH 9/78 ARM: pxa: prevent PXA270 occasional reboot freezes
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sergei Ianovich <[email protected]>
commit ff88b4724fde18056a4c539f7327389aec0f4c2d upstream.
Erratum 71 of PXA270M Processor Family Specification Update (April 19, 2010) explains that watchdog reset time is just 8us insead of 10ms in EMTS.
If SDRAM is not reset, it causes memory bus congestion and the device hangs. We put SDRAM in selfresh mode before watchdog reset, removing potential freezes.
Without this patch PXA270-based ICP DAS LP-8x4x hangs after up to 40 reboots. With this patch it has successfully rebooted 500 times.
--- arch/arm/mach-pxa/reset.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
arch/arm/mach-pxa/reset.c +7 -1
@@ -13,6 +13,7 @@#include <mach/regs-ost.h> #include <mach/reset.h> +#include <mach/smemc.h> unsigned int reset_status;EXPORT_SYMBOL (reset_status);
@@ -81,6 +82,12 @@ static void do_hw_reset(void)writel_relaxed (OSSR_M3 ,OSSR );/* ... in 100 ms */ writel_relaxed (readl_relaxed (OSCR ) +368640 ,OSMR3 ); +/* +* SDRAM hangs on watchdog reset on Marvell PXA270 (erratum 71) +* we put SDRAM into self-refresh to prevent that +*/ +while (1 ) +writel_relaxed (MDREFR_SLFRSH ,MDREFR ); }void pxa_restart (char mode,const char *cmd)
@@ -104,4 +111,3 @@ void pxa_restart(char mode, const char *break ; } } -
Greg Kroah-Hartman
maintainerPATCH 10/78 ARM: OMAP3: hwmod data: Dont prevent RESET of USB Host module
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roger Quadros <[email protected]>
commit 7f4d3641e2548d1ac5dee837ff434df668a2810c upstream.
Unlike what the comment states, errata i660 does not state that we can't RESET the USB host module. Instead it states that RESET is the only way to recover from a deadlock situation.
RESET ensures that the module is in a known good state irrespective of what bootloader does with the module, so it must be done at boot.
--- arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +3 -10
@@ -1930,7 +1930,8 @@ static struct omap_hwmod_class_sysconfig .syss_offs = 0x0014, .sysc_flags = (SYSC_HAS_MIDLEMODE |SYSC_HAS_CLOCKACTIVITY |SYSC_HAS_SIDLEMODE |SYSC_HAS_ENAWAKEUP | - SYSC_HAS_SOFTRESET | SYSC_HAS_AUTOIDLE), +SYSC_HAS_SOFTRESET |SYSC_HAS_AUTOIDLE | + SYSS_HAS_RESET_STATUS), .idlemodes = (SIDLE_FORCE |SIDLE_NO |SIDLE_SMART | MSTANDBY_FORCE | MSTANDBY_NO | MSTANDBY_SMART), .sysc_fields = &omap_hwmod_sysc_type1,
@@ -2008,15 +2009,7 @@ static struct omap_hwmod omap3xxx_usb_ho* hence HWMOD_SWSUP_MSTANDBY */ -/* -* During system boot; If the hwmod framework resets the module -* the module will have smart idle settings; which can lead to deadlock -* (above Errata Id:i660); so, dont reset the module during boot; -* Use HWMOD_INIT_NO_RESET. -*/ - - .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY | - HWMOD_INIT_NO_RESET, + .flags = HWMOD_SWSUP_SIDLE | HWMOD_SWSUP_MSTANDBY, };/*
Greg Kroah-Hartman
maintainerPATCH 11/78 ARM: 7912/1: check stack pointer in get_wchan
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Khlebnikov <[email protected]>
commit 1b15ec7a7427d4188ba91b9bbac696250a059d22 upstream.
get_wchan() is lockless. Task may wakeup at any time and change its own stack, thus each next stack frame may be overwritten and filled with random stuff.
/proc/$pid/stack interface had been disabled for non-current tasks, see [1] But 'wchan' still allows to trigger stack frame unwinding on volatile stack.
This patch fixes oops in unwind_frame() by adding stack pointer validation on each step (as x86 code do), unwind_frame() already checks frame pointer.
Also I've found another report of this oops on stackoverflow (irony).
--- arch/arm/kernel/process.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/arm/kernel/process.c +5 -2
@@ -408,6 +408,7 @@ EXPORT_SYMBOL(dump_fpu);unsigned long get_wchan (struct task_struct *p) {struct stackframe frame; +unsigned long stack_page;int count =0 ;if (!p || p == current || p->state ==TASK_RUNNING )return 0 ;
@@ -416,9 +417,11 @@ unsigned long get_wchan(struct task_stru frame.sp =thread_saved_sp (p); frame.lr =0 ;/* recovered from the stack */ frame.pc =thread_saved_pc (p); + stack_page = (unsigned long )task_stack_page (p); do { - int ret = unwind_frame(&frame); - if (ret < 0) + if (frame.sp < stack_page || + frame.sp >= stack_page + THREAD_SIZE || + unwind_frame(&frame) < 0) return 0; if (!in_sched_functions(frame.pc)) return frame.pc;
Greg Kroah-Hartman
maintainerPATCH 12/78 ARM: 7913/1: fix framepointer check in unwind_frame
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Konstantin Khlebnikov <[email protected]>
commit 3abb6671a9c04479c4bd026798a05f857393b7e2 upstream.
This patch fixes corner case when (fp + 4) overflows unsigned long, for example: fp = 0xFFFFFFFF -> fp + 4 == 3.
--- arch/arm/kernel/stacktrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/kernel/stacktrace.c +1 -1
@@ -31,7 +31,7 @@ int notrace unwind_frame(struct stackfra high =ALIGN (low,THREAD_SIZE );/* check current frame pointer is within bounds */ -if (fp < (low +12 ) || fp +4 >= high) +if (fp < low +12 || fp > high -4 )return -EINVAL ;/* restore the registers from the stack frame */
Greg Kroah-Hartman
maintainerPATCH 13/78 KVM: Improve create VCPU parameter (CVE-2013-4587)
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Honig <[email protected]>
commit 338c7dbadd2671189cec7faf64c84d01071b3f96 upstream.
In multiple functions the vcpu_id is used as an offset into a bitfield. Ag malicious user could specify a vcpu_id greater than 255 in order to set or clear bits in kernel memory. This could be used to elevate priveges in the kernel. This patch verifies that the vcpu_id provided is less than 255. The api documentation already specifies that the vcpu_id must be less than max_vcpus, but this is currently not checked.
--- virt/kvm/kvm_main.c | 3 +++ 1 file changed, 3 insertions(+)
virt/kvm/kvm_main.c +3 -0
@@ -1904,6 +1904,9 @@ static int kvm_vm_ioctl_create_vcpu(struint r;struct kvm_vcpu *vcpu, *v; +if (id >=KVM_MAX_VCPUS ) +return -EINVAL ; + vcpu =kvm_arch_vcpu_create (kvm, id);if (IS_ERR (vcpu))return PTR_ERR (vcpu);
Greg Kroah-Hartman
maintainerPATCH 14/78 KVM: x86: Fix potential divide by 0 in lapic (CVE-2013-6367)
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Honig <[email protected]>
commit b963a22e6d1a266a67e9eecc88134713fd54775c upstream.
Under guest controllable circumstances apic_get_tmcct will execute a divide by zero and cause a crash. If the guest cpuid support tsc deadline timers and performs the following sequence of requests the host will crash.
- Set the mode to periodic
- Set the TMICT to 0
- Set the mode bits to 11 (neither periodic, nor one shot, nor tsc deadline)
- Set the TMICT to non-zero.
Then the lapic_timer.period will be 0, but the TMICT will not be. If the guest then reads from the TMCCT then the host will perform a divide by 0.
This patch ensures that if the lapic_timer.period is 0, then the division does not occur.
--- arch/x86/kvm/lapic.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/x86/kvm/lapic.c +2 -1
@@ -855,7 +855,8 @@ static u32 apic_get_tmcct(struct kvm_lapASSERT (apic !=NULL );/* if initial count is 0, current count should also be 0 */ -if (kvm_apic_get_reg (apic,APIC_TMICT ) ==0 ) +if (kvm_apic_get_reg (apic,APIC_TMICT ) ==0 || + apic->lapic_timer.period ==0 )return 0 ; remaining =hrtimer_get_remaining (&apic->lapic_timer.timer);
Greg Kroah-Hartman
maintainerPATCH 15/78 KVM: x86: Convert vapic synchronization to _cached functions (CVE-2013-6368)
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Honig <[email protected]>
commit fda4e2e85589191b123d31cdc21fd33ee70f50fd upstream.
In kvm_lapic_sync_from_vapic and kvm_lapic_sync_to_vapic there is the potential to corrupt kernel memory if userspace provides an address that is at the end of a page. This patches concerts those functions to use kvm_write_guest_cached and kvm_read_guest_cached. It also checks the vapic_address specified by userspace during ioctl processing and returns an error to userspace if the address is not a valid GPA.
This is generally not guest triggerable, because the required write is done by firmware that runs before the guest. Also, it only affects AMD processors and oldish Intel that do not have the FlexPriority feature (unless you disable FlexPriority, of course; then newer processors are also affected).
--- arch/x86/kvm/lapic.c | 27 +++++++++++++++------------ arch/x86/kvm/lapic.h | 4 ++-- arch/x86/kvm/x86.c | 40 +--------------------------------------- 3 files changed, 18 insertions(+), 53 deletions(-)
arch/x86/kvm/lapic.c +15 -12
@@ -1706,7 +1706,6 @@ static void apic_sync_pv_eoi_from_guest(void kvm_lapic_sync_from_vapic (struct kvm_vcpu *vcpu) {u32 data; -void *vapic;if (test_bit (KVM_APIC_PV_EOI_PENDING , &vcpu->arch.apic_attention))apic_sync_pv_eoi_from_guest (vcpu, vcpu->arch.apic);
@@ -1714,9 +1713,8 @@ void kvm_lapic_sync_from_vapic(struct kvif (!test_bit (KVM_APIC_CHECK_VAPIC , &vcpu->arch.apic_attention))return ; - vapic =kmap_atomic (vcpu->arch.apic->vapic_page); - data = *(u32 *)(vapic +offset_in_page (vcpu->arch.apic->vapic_addr)); -kunmap_atomic (vapic); +kvm_read_guest_cached (vcpu->kvm, &vcpu->arch.apic->vapic_cache, &data, +sizeof (u32));apic_set_tpr (vcpu->arch.apic, data &0xff ); }
@@ -1752,7 +1750,6 @@ void kvm_lapic_sync_to_vapic(struct kvm_u32 data, tpr;int max_irr, max_isr;struct kvm_lapic *apic = vcpu->arch.apic; -void *vapic;apic_sync_pv_eoi_to_guest (vcpu, apic);
@@ -1768,18 +1765,24 @@ void kvm_lapic_sync_to_vapic(struct kvm_ max_isr =0 ; data = (tpr &0xff ) | ((max_isr &0xf0 ) <<8 ) | (max_irr <<24 ); - vapic =kmap_atomic (vcpu->arch.apic->vapic_page); - *(u32 *)(vapic +offset_in_page (vcpu->arch.apic->vapic_addr)) = data; -kunmap_atomic (vapic); +kvm_write_guest_cached (vcpu->kvm, &vcpu->arch.apic->vapic_cache, &data, +sizeof (u32)); } -void kvm_lapic_set_vapic_addr (struct kvm_vcpu *vcpu,gpa_t vapic_addr) +int kvm_lapic_set_vapic_addr (struct kvm_vcpu *vcpu,gpa_t vapic_addr) { - vcpu->arch.apic->vapic_addr = vapic_addr; -if (vapic_addr) +if (vapic_addr) { +if (kvm_gfn_to_hva_cache_init (vcpu->kvm, + &vcpu->arch.apic->vapic_cache, + vapic_addr,sizeof (u32))) +return -EINVAL ;__set_bit (KVM_APIC_CHECK_VAPIC , &vcpu->arch.apic_attention); -else + }else {__clear_bit (KVM_APIC_CHECK_VAPIC , &vcpu->arch.apic_attention); + } + + vcpu->arch.apic->vapic_addr = vapic_addr; +return 0 ; }int kvm_x2apic_msr_write (struct kvm_vcpu *vcpu,u32 msr,u64 data)
arch/x86/kvm/lapic.h +2 -2
@@ -34,7 +34,7 @@ struct kvm_lapic {*/ void *regs;gpa_t vapic_addr; -struct page *vapic_page; +struct gfn_to_hva_cache vapic_cache;unsigned long pending_events;unsigned int sipi_vector; };
@@ -76,7 +76,7 @@ void kvm_set_lapic_tscdeadline_msr(strucvoid kvm_apic_write_nodecode (struct kvm_vcpu *vcpu,u32 offset);void kvm_apic_set_eoi_accelerated (struct kvm_vcpu *vcpu,int vector); -void kvm_lapic_set_vapic_addr (struct kvm_vcpu *vcpu,gpa_t vapic_addr); +int kvm_lapic_set_vapic_addr (struct kvm_vcpu *vcpu,gpa_t vapic_addr);void kvm_lapic_sync_from_vapic (struct kvm_vcpu *vcpu);void kvm_lapic_sync_to_vapic (struct kvm_vcpu *vcpu);
arch/x86/kvm/x86.c +1 -39
@@ -3138,8 +3138,7 @@ long kvm_arch_vcpu_ioctl(struct file *fi r = -EFAULT ;if (copy_from_user (&va, argp,sizeof va)) goto out; - r =0 ; -kvm_lapic_set_vapic_addr (vcpu, va.vapic_addr); + r =kvm_lapic_set_vapic_addr (vcpu, va.vapic_addr);break ; }case KVM_X86_SETUP_MCE : {
@@ -5539,36 +5538,6 @@ static void post_kvm_run_save(struct kvm !kvm_event_needs_reinjection (vcpu); } -static int vapic_enter (struct kvm_vcpu *vcpu) -{ -struct kvm_lapic *apic = vcpu->arch.apic; -struct page *page; - -if (!apic || !apic->vapic_addr) -return 0 ; - - page =gfn_to_page (vcpu->kvm, apic->vapic_addr >>PAGE_SHIFT ); -if (is_error_page (page)) -return -EFAULT ; - - vcpu->arch.apic->vapic_page = page; -return 0 ; -} - -static void vapic_exit (struct kvm_vcpu *vcpu) -{ -struct kvm_lapic *apic = vcpu->arch.apic; -int idx; - -if (!apic || !apic->vapic_addr) -return ; - - idx =srcu_read_lock (&vcpu->kvm->srcu); -kvm_release_page_dirty (apic->vapic_page); -mark_page_dirty (vcpu->kvm, apic->vapic_addr >>PAGE_SHIFT ); -srcu_read_unlock (&vcpu->kvm->srcu, idx); -} -static void update_cr8_intercept (struct kvm_vcpu *vcpu) {int max_irr, tpr;
@@ -5889,11 +5858,6 @@ static int __vcpu_run(struct kvm_vcpu *vstruct kvm *kvm = vcpu->kvm; vcpu->srcu_idx =srcu_read_lock (&kvm->srcu); - r =vapic_enter (vcpu); -if (r) { -srcu_read_unlock (&kvm->srcu, vcpu->srcu_idx); -return r; - } r =1 ;while (r >0 ) {
@@ -5951,8 +5915,6 @@ static int __vcpu_run(struct kvm_vcpu *vsrcu_read_unlock (&kvm->srcu, vcpu->srcu_idx); -vapic_exit (vcpu); -return r; }
Greg Kroah-Hartman
maintainerPATCH 16/78 KVM: x86: fix guest-initiated crash with x2apic (CVE-2013-6376)
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gleb Natapov <[email protected]>
commit 17d68b763f09a9ce824ae23eb62c9efc57b69271 upstream.
A guest can cause a BUG_ON() leading to a host kernel crash. When the guest writes to the ICR to request an IPI, while in x2apic mode the following things happen, the destination is read from ICR2, which is a register that the guest can control.
kvm_irq_delivery_to_apic_fast uses the high 16 bits of ICR2 as the cluster id. A BUG_ON is triggered, which is a protection against accessing map->logical_map with an out-of-bounds access and manages to avoid that anything really unsafe occurs.
The logic in the code is correct from real HW point of view. The problem is that KVM supports only one cluster with ID 0 in clustered mode, but the code that has the bug does not take this into account.
--- arch/x86/kvm/lapic.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
arch/x86/kvm/lapic.c +4 -1
@@ -153,6 +153,8 @@ static inline int kvm_apic_id(struct kvmreturn (kvm_apic_get_reg (apic,APIC_ID ) >>24 ) &0xff ; } +#define KVM_X2APIC_CID_BITS 0 +static void recalculate_apic_map (struct kvm *kvm) {struct kvm_apic_map *new, *old =NULL ;
@@ -190,7 +192,8 @@ static void recalculate_apic_map(structif (apic_x2apic_mode (apic)) { new->ldr_bits =32 ; new->cid_shift =16 ; - new->cid_mask = new->lid_mask =0xffff ; + new->cid_mask = (1 <<KVM_X2APIC_CID_BITS ) -1 ; + new->lid_mask =0xffff ; }else if (kvm_apic_sw_enabled (apic) && !new->cid_mask/* flat mode */ &&kvm_apic_get_reg (apic,APIC_DFR ) ==APIC_DFR_CLUSTER ) {
Greg Kroah-Hartman
maintainerPATCH 17/78 hwmon: Prevent some divide by zeros in FAN_TO_REG()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 3806b45ba4655147a011df03242cc197ab986c43 upstream.
The "rpm * div" operations can overflow here, so this patch adds an upper limit to rpm to prevent that. Jean Delvare helped me with this patch.
--- drivers/hwmon/lm78.c | 2 ++ drivers/hwmon/sis5595.c | 2 ++ drivers/hwmon/vt8231.c | 2 +- 3 files changed, 5 insertions(+), 1 deletion(-)
drivers/hwmon/lm78.c +2 -0
@@ -94,6 +94,8 @@ static inline u8 FAN_TO_REG(long rpm, in {if (rpm <=0 )return 255 ; +if (rpm >1350000 ) +return 1 ;return clamp_val ((1350000 + rpm * div /2 ) / (rpm * div),1 ,254 ); }
drivers/hwmon/sis5595.c +2 -0
@@ -141,6 +141,8 @@ static inline u8 FAN_TO_REG(long rpm, in {if (rpm <=0 )return 255 ; +if (rpm >1350000 ) +return 1 ;return clamp_val ((1350000 + rpm * div /2 ) / (rpm * div),1 ,254 ); }
drivers/hwmon/vt8231.c +1 -1
@@ -145,7 +145,7 @@ static const u8 regtempmin[] = { 0x3a, 0*/ static inline u8 FAN_TO_REG (long rpm,int div) { -if (rpm ==0 ) +if (rpm <=0 || rpm >1310720 )return 0 ;return clamp_val (1310720 / (rpm * div),1 ,255 ); }
Greg Kroah-Hartman
maintainerPATCH 19/78 hwmon: (w83l786ng) Fix fan speed control mode setting and reporting
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Carnes <[email protected]>
commit cf7559bc053471f32373d71d04a9aa19e0b48d59 upstream.
The wrong mask is used, which causes some fan speed control modes (pwmX_enable) to be incorrectly reported, and some modes to be impossible to set.
[JD: add subject and description.]
--- drivers/hwmon/w83l786ng.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/hwmon/w83l786ng.c +2 -2
@@ -510,7 +510,7 @@ store_pwm_enable(struct device *dev, strmutex_lock (&data->update_lock); reg =w83l786ng_read_value (client,W83L786NG_REG_FAN_CFG ); data->pwm_enable[nr] = val; - reg &= ~(0x02 <<W83L786NG_PWM_ENABLE_SHIFT [nr]); + reg &= ~(0x03 <<W83L786NG_PWM_ENABLE_SHIFT [nr]); reg |= (val -1 ) <<W83L786NG_PWM_ENABLE_SHIFT [nr];w83l786ng_write_value (client,W83L786NG_REG_FAN_CFG , reg);mutex_unlock (&data->update_lock);
@@ -776,7 +776,7 @@ static struct w83l786ng_data *w83l786ng_ ((pwmcfg >>W83L786NG_PWM_MODE_SHIFT [i]) &1 ) ?0 :1 ; data->pwm_enable[i] = - ((pwmcfg >>W83L786NG_PWM_ENABLE_SHIFT [i]) &2 ) +1 ; + ((pwmcfg >>W83L786NG_PWM_ENABLE_SHIFT [i]) &3 ) +1 ; data->pwm[i] =w83l786ng_read_value (client,W83L786NG_REG_PWM [i]); }
Greg Kroah-Hartman
maintainerPATCH 20/78 hwmon: (w83l768ng) Fix fan speed control range
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
commit 33a7ab91d509fa33b4bcd3ce0038cc80298050da upstream.
The W83L786NG stores the fan speed on 4 bits while the sysfs interface uses a 0-255 range. Thus the driver should scale the user input down to map it to the device range, and scale up the value read from the device before presenting it to the user. The reserved register nibble should be left unchanged.
--- drivers/hwmon/w83l786ng.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/hwmon/w83l786ng.c +6 -3
@@ -481,9 +481,11 @@ store_pwm(struct device *dev, struct devif (err)return err; val =clamp_val (val,0 ,255 ); + val =DIV_ROUND_CLOSEST (val,0x11 );mutex_lock (&data->update_lock); - data->pwm[nr] = val; + data->pwm[nr] = val *0x11 ; + val |=w83l786ng_read_value (client,W83L786NG_REG_PWM [nr]) &0xf0 ;w83l786ng_write_value (client,W83L786NG_REG_PWM [nr], val);mutex_unlock (&data->update_lock);return count;
@@ -777,8 +779,9 @@ static struct w83l786ng_data *w83l786ng_ ?0 :1 ; data->pwm_enable[i] = ((pwmcfg >>W83L786NG_PWM_ENABLE_SHIFT [i]) &3 ) +1 ; - data->pwm[i] =w83l786ng_read_value (client, -W83L786NG_REG_PWM [i]); + data->pwm[i] = + (w83l786ng_read_value (client,W83L786NG_REG_PWM [i]) + &0x0f ) *0x11 ; }
Greg Kroah-Hartman
maintainerPATCH 21/78 xfs: growfs overruns AGFL buffer on V4 filesystems
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dave Chinner <[email protected]>
commit f94c44573e7c22860e2c3dfe349c45f72ba35ad3 upstream.
This loop in xfs_growfs_data_private() is incorrect for V4 superblocks filesystems:
for (bucket = 0; bucket < XFS_AGFL_SIZE(mp); bucket++) agfl->agfl_bno[bucket] = cpu_to_be32(NULLAGBLOCK);
For V4 filesystems, we don't have a agfl header structure, and so XFS_AGFL_SIZE() returns an entire sector's worth of entries, which we then index from an offset into the sector. Hence: buffer overrun.
This problem was introduced in 3.10 by commit 77c95bba ("xfs: add CRC checks to the AGFL") which changed the AGFL structure but failed to update the growfs code to handle the different structures.
Fix it by using the correct offset into the buffer for both V4 and V5 filesystems.
--- fs/xfs/xfs_fsops.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
fs/xfs/xfs_fsops.c +5 -1
@@ -216,6 +216,8 @@ xfs_growfs_data_private(*/ nfree =0 ;for (agno = nagcount -1 ; agno >= oagcount; agno--, new -= agsize) { +__be32 *agfl_bno; +/* * AG freespace header block */
@@ -275,8 +277,10 @@ xfs_growfs_data_private( agfl->agfl_seqno =cpu_to_be32 (agno);uuid_copy (&agfl->agfl_uuid, &mp->m_sb.sb_uuid); } + + agfl_bno =XFS_BUF_TO_AGFL_BNO (mp, bp);for (bucket =0 ; bucket <XFS_AGFL_SIZE (mp); bucket++) - agfl->agfl_bno[bucket] =cpu_to_be32 (NULLAGBLOCK ); + agfl_bno[bucket] =cpu_to_be32 (NULLAGBLOCK ); error =xfs_bwrite (bp);xfs_buf_relse (bp);
Greg Kroah-Hartman
maintainerPATCH 22/78 xfs: underflow bug in xfs_attrlist_by_handle()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 31978b5cc66b8ba8a7e8eef60b12395d41b7b890 upstream.
If we allocate less than sizeof(struct attrlist) then we end up corrupting memory or doing a ZERO_PTR_SIZE dereference.
This can only be triggered with CAP_SYS_ADMIN.
--- fs/xfs/xfs_ioctl.c | 3 ++- fs/xfs/xfs_ioctl32.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-)
fs/xfs/xfs_ioctl.c +2 -1
@@ -409,7 +409,8 @@ xfs_attrlist_by_handle(return -XFS_ERROR (EPERM );if (copy_from_user (&al_hreq, arg,sizeof (xfs_fsop_attrlist_handlereq_t)))return -XFS_ERROR (EFAULT ); -if (al_hreq.buflen >XATTR_LIST_MAX ) +if (al_hreq.buflen <sizeof (struct attrlist ) || + al_hreq.buflen >XATTR_LIST_MAX )return -XFS_ERROR (EINVAL );/*
fs/xfs/xfs_ioctl32.c +2 -1
@@ -359,7 +359,8 @@ xfs_compat_attrlist_by_handle(if (copy_from_user (&al_hreq, arg,sizeof (compat_xfs_fsop_attrlist_handlereq_t)))return -XFS_ERROR (EFAULT ); -if (al_hreq.buflen >XATTR_LIST_MAX ) +if (al_hreq.buflen <sizeof (struct attrlist ) || + al_hreq.buflen >XATTR_LIST_MAX )return -XFS_ERROR (EINVAL );/*
Greg Kroah-Hartman
maintainerPATCH 23/78 PCI: Disable Bus Master only on kexec reboot
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Khalid Aziz <[email protected]>
commit 4fc9bbf98fd66f879e628d8537ba7c240be2b58e upstream.
Add a flag to tell the PCI subsystem that kernel is shutting down in preparation to kexec a kernel. Add code in PCI subsystem to use this flag to clear Bus Master bit on PCI devices only in case of kexec reboot.
This fixes a power-off problem on Acer Aspire V5-573G and likely other machines and avoids any other issues caused by clearing Bus Master bit on PCI devices in normal shutdown path. The problem was introduced by b566a22c2332 ("PCI: disable Bus Master on PCI device shutdown").
This patch is based on discussion at
http://marc.info/?l=linux-pci&m=138425645204355&w=2
--- drivers/pci/pci-driver.c | 12 +++++++++--- include/linux/kexec.h | 3 +++ kernel/kexec.c | 4 ++++ 3 files changed, 16 insertions(+), 3 deletions(-)
drivers/pci/pci-driver.c +9 -3
@@ -19,6 +19,7 @@#include <linux/cpu.h> #include <linux/pm_runtime.h> #include <linux/suspend.h> +#include <linux/kexec.h> #include "pci.h" struct pci_dynid {
@@ -388,12 +389,17 @@ static void pci_device_shutdown(struct dpci_msi_shutdown (pci_dev);pci_msix_shutdown (pci_dev); +#ifdef CONFIG_KEXEC /* -* Turn off Bus Master bit on the device to tell it to not -* continue to do DMA. Don't touch devices in D3cold or unknown states. +* If this is a kexec reboot, turn off Bus Master bit on the +* device to tell it to not continue to do DMA. Don't touch +* devices in D3cold or unknown states. +* If it is not a kexec reboot, firmware will hit the PCI +* devices with big hammer and stop their DMA any way. */ -if (pci_dev->current_state <= PCI_D3hot) +if (kexec_in_progress && (pci_dev->current_state <= PCI_D3hot))pci_clear_master (pci_dev); +#endif }#ifdef CONFIG_PM
include/linux/kexec.h +3 -0
@@ -198,6 +198,9 @@ extern u32 vmcoreinfo_note[VMCOREINFO_NOextern size_t vmcoreinfo_size;extern size_t vmcoreinfo_max_size; +/* flag to track if kexec reboot is in progress */ +extern bool kexec_in_progress; +int __init parse_crashkernel (char *cmdline,unsigned long long system_ram,unsigned long long *crash_size,unsigned long long *crash_base); int parse_crashkernel_high(char *cmdline, unsigned long long system_ram,
kernel/kexec.c +4 -0
@@ -47,6 +47,9 @@ u32 vmcoreinfo_note[VMCOREINFO_NOTE_SIZEsize_t vmcoreinfo_size;size_t vmcoreinfo_max_size =sizeof (vmcoreinfo_data); +/* Flag to indicate we are going to kexec a new kernel */ +bool kexec_in_progress = false; +/* Location of the reserved area for the crash kernel */ struct resource crashk_res = { .name ="Crash kernel" ,
@@ -1678,6 +1681,7 @@ int kernel_kexec(void) } else#endif { + kexec_in_progress = true;kernel_restart_prepare (NULL );printk (KERN_EMERG "Starting new kernel\n" );machine_shutdown ();
Greg Kroah-Hartman
maintainerPATCH 24/78 futex: fix handling of read-only-mapped hugepages
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Torvalds <[email protected]>
commit f12d5bfceb7e1f9051563381ec047f7f13956c3c upstream.
The hugepage code had the exact same bug that regular pages had in commit 7485d0d3758e ("futexes: Remove rw parameter from get_futex_key()").
The regular page case was fixed by commit 9ea71503a8ed ("futex: Fix regression with read only mappings"), but the transparent hugepage case (added in a5b338f2b0b1: "thp: update futex compound knowledge") case remained broken.
Found by Dave Jones and his trinity tool.
--- kernel/futex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/futex.c +1 -1
@@ -287,7 +287,7 @@ again:put_page (page);/* serialize against __split_huge_page_splitting() */ local_irq_disable (); -if (likely (__get_user_pages_fast (address,1 ,1 , &page) ==1 )) { +if (likely (__get_user_pages_fast (address,1 , !ro, &page) ==1 )) { page_head =compound_head (page);/* * page_head is valid pointer but we must pin
Greg Kroah-Hartman
maintainerPATCH 25/78 nfsd: when reusing an existing repcache entry, unhash it first
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 781c2a5a5f75eacc04663aced0f0f1a648d4f308 upstream.
The DRC code will attempt to reuse an existing, expired cache entry in preference to allocating a new one. It'll then search the cache, and if it gets a hit it'll then free the cache entry that it was going to reuse.
The cache code doesn't unhash the entry that it's going to reuse however, so it's possible for it end up designating an entry for reuse and then subsequently freeing the same entry after it finds it. This leads it to a later use-after-free situation and usually some list corruption warnings or an oops.
Fix this by simply unhashing the entry that we intend to reuse. That will mean that it's not findable via a search and should prevent this situation from occurring.
--- fs/nfsd/nfscache.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
fs/nfsd/nfscache.c +8 -1
@@ -129,6 +129,13 @@ nfsd_reply_cache_alloc(void) }static void +nfsd_reply_cache_unhash (struct svc_cacherep *rp) +{ +hlist_del_init (&rp->c_hash); +list_del_init (&rp->c_lru); +} + +static void nfsd_reply_cache_free_locked (struct svc_cacherep *rp) {if (rp->c_type ==RC_REPLBUFF && rp->c_replvec.iov_base) {
@@ -403,7 +410,7 @@ nfsd_cache_lookup(struct svc_rqst *rqstp rp = list_first_entry(&lru_head, struct svc_cacherep, c_lru);if (nfsd_cache_entry_expired (rp) || num_drc_entries >= max_drc_entries) { -lru_put_end (rp); +nfsd_reply_cache_unhash (rp);prune_cache_entries (); goto search_cache; }
Greg Kroah-Hartman
maintainerPATCH 26/78 usb: hub: Use correct reset for wedged USB3 devices that are NOTATTACHED
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julius Werner <[email protected]>
commit 2d51f3cd11f414c56a87dc018196b85fd50b04a4 upstream.
This patch adds a check for USB_STATE_NOTATTACHED to the hub_port_warm_reset_required() workaround for ports that end up in Compliance Mode in hub_events() when trying to decide which reset function to use. Trying to call usb_reset_device() with a NOTATTACHED device will just fail and leave the port broken.
--- drivers/usb/core/hub.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/core/hub.c +3 -2
@@ -4808,8 +4808,9 @@ static void hub_events(void) hub->ports[i -1 ]->child;dev_dbg (hub_dev,"warm reset port %d\n" , i); -if (!udev || !(portstatus & -USB_PORT_STAT_CONNECTION )) { +if (!udev || + !(portstatus &USB_PORT_STAT_CONNECTION ) || + udev->state ==USB_STATE_NOTATTACHED ) { status =hub_port_reset (hub, i,NULL ,HUB_BH_RESET_TIME , true);
Greg Kroah-Hartman
maintainerPATCH 27/78 usb: dwc3: fix implementation of endpoint wedge
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Stern <[email protected]>
commit a535d81c92615b8ffb99b7e1fd1fb01effaed1af upstream.
The dwc3 UDC driver doesn't implement endpoint wedging correctly. When an endpoint is wedged, the gadget driver should be allowed to clear the wedge by calling usb_ep_clear_halt(). Only the host is prevented from resetting the endpoint.
This patch fixes the implementation.
--- drivers/usb/dwc3/ep0.c | 2 ++ drivers/usb/dwc3/gadget.c | 5 +---- 2 files changed, 3 insertions(+), 4 deletions(-)
drivers/usb/dwc3/ep0.c +2 -0
@@ -478,6 +478,8 @@ static int dwc3_ep0_handle_feature(struc dep =dwc3_wIndex_to_dep (dwc, wIndex);if (!dep)return -EINVAL ; +if (set ==0 && (dep->flags &DWC3_EP_WEDGE )) +break ; ret =__dwc3_gadget_ep_set_halt (dep, set);if (ret)return -EINVAL ;
drivers/usb/dwc3/gadget.c +1 -4
@@ -1220,9 +1220,6 @@ int __dwc3_gadget_ep_set_halt(struct dwcelse dep->flags |=DWC3_EP_STALL ; }else { -if (dep->flags &DWC3_EP_WEDGE ) -return 0 ; - ret =dwc3_send_gadget_ep_cmd (dwc, dep->number,DWC3_DEPCMD_CLEARSTALL , ¶ms);if (ret)
@@ -1230,7 +1227,7 @@ int __dwc3_gadget_ep_set_halt(struct dwc value ?"set" :"clear" , dep->name); else - dep->flags &= ~DWC3_EP_STALL; + dep->flags &= ~(DWC3_EP_STALL | DWC3_EP_WEDGE); }return ret;
Greg Kroah-Hartman
maintainerPATCH 28/78 usb: gadget: composite: reset delayed_status on reset_config
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Grzeschik <[email protected]>
commit 2bac51a1827a18821150ed8c9f9752c02f9c2b02 upstream.
The delayed_status value is used to keep track of status response packets on ep0. It needs to be reset or the set_config function would still delay the answer, if the usb device got unplugged while waiting for setup_continue to be called.
--- drivers/usb/gadget/composite.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/gadget/composite.c +1 -0
@@ -593,6 +593,7 @@ static void reset_config(struct usb_compbitmap_zero (f->endpoints,32 ); } cdev->config =NULL ; + cdev->delayed_status =0 ; } static int set_config(struct usb_composite_dev *cdev,
Greg Kroah-Hartman
maintainerPATCH 29/78 USB: serial: option: blacklist interface 1 for Huawei E173s-6
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo Zacarias <[email protected]>
commit 8f173e22abf2258ddfa73f46eadbb6a6c29f1631 upstream.
Interface 1 on this device isn't for option to bind to otherwise an oops on usb_wwan with log flooding will happen when accessing the port:
tty_release: ttyUSB1: read/write wait queue active!
It doesn't seem to respond to QMI if it's added to qmi_wwan so don't add it there - it's likely used by the card reader.
--- drivers/usb/serial/option.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/usb/serial/option.c +3 -0
@@ -85,6 +85,7 @@ static void option_instat_callback(struc#define HUAWEI_PRODUCT_K4505 0x1464#define HUAWEI_PRODUCT_K3765 0x1465#define HUAWEI_PRODUCT_K4605 0x14C6 +#define HUAWEI_PRODUCT_E173S6 0x1C07#define QUANTA_VENDOR_ID 0x0408#define QUANTA_PRODUCT_Q101 0xEA02
@@ -572,6 +573,8 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1c23, USB_CLASS_COMM, 0x02, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t) &net_intf1_blacklist }, + { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E173S6, 0xff, 0xff, 0xff), + .driver_info = (kernel_ulong_t) &net_intf1_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_E1750, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t) &net_intf2_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0x1441, USB_CLASS_COMM, 0x02, 0xff) },
Greg Kroah-Hartman
maintainerPATCH 30/78 USB: option: support new huawei devices
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Fangxiaozhi (Franko)" <[email protected]>
commit 2bf308d7bc5e8cdd69672199f59532f35339133c upstream.
Add new supporting declarations to option.c, to support Huawei new devices with new bInterfaceProtocol value.
--- drivers/usb/serial/option.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/usb/serial/option.c +24 -0
@@ -637,6 +637,10 @@ static const struct usb_device_id option { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6D) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6E) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x6F) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x72) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x73) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x74) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x75) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x78) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x79) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x01, 0x7A) },
@@ -691,6 +695,10 @@ static const struct usb_device_id option { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6D) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6E) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x6F) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x72) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x73) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x74) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x75) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x78) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x79) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x02, 0x7A) },
@@ -745,6 +753,10 @@ static const struct usb_device_id option { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x6D) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x6E) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x6F) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x72) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x73) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x74) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x75) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x78) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x79) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x03, 0x7A) },
@@ -799,6 +811,10 @@ static const struct usb_device_id option { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x6D) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x6E) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x6F) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x72) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x73) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x74) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x75) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x78) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x79) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x04, 0x7A) },
@@ -853,6 +869,10 @@ static const struct usb_device_id option { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x6D) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x6E) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x6F) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x72) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x73) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x74) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x75) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x78) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x79) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x05, 0x7A) },
@@ -907,6 +927,10 @@ static const struct usb_device_id option { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x6D) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x6E) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x6F) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x72) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x73) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x74) }, + { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x75) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x78) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x79) }, { USB_VENDOR_AND_INTERFACE_INFO(HUAWEI_VENDOR_ID, 0xff, 0x06, 0x7A) },
Greg Kroah-Hartman
maintainerPATCH 31/78 Input: usbtouchscreen - separate report and transmit buffer size handling
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Engelmayer <[email protected]>
commit 4ef38351d770cc421f4a0c7a849fd13207fc5741 upstream.
This patch supports the separate handling of the USB transfer buffer length and the length of the buffer used for multi packet support. For devices supporting multiple report or diagnostic packets, the USB transfer size is now limited to the USB endpoints wMaxPacketSize - otherwise it defaults to the configured report packet size as before.
This fixes an issue where event reporting can be delayed for an arbitrary time for multi packet devices. For instance the report size for eGalax devices is defined to the 16 byte maximum diagnostic packet size as opposed to the 5 byte report packet size. In case the driver requests 16 byte from the USB interrupt endpoint, the USB host controller driver needs to split up the request into 2 accesses according to the endpoints wMaxPacketSize of 8 byte. When the first transfer is answered by the eGalax device with not less than the full 8 byte requested, the host controller has got no way of knowing whether the touch controller has got additional data queued and will issue the second transfer. If per example a liftoff event finishes at such a wMaxPacketSize boundary, the data will not be available to the usbtouch driver until a further event is triggered and transfered to the host. From user perspective the BTN_TOUCH release event in this case is stuck until the next touch down event.
--- drivers/input/touchscreen/usbtouchscreen.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-)
drivers/input/touchscreen/usbtouchscreen.c +18 -4
@@ -106,6 +106,7 @@ struct usbtouch_device_info {struct usbtouch_usb {unsigned char *data;dma_addr_t data_dma; +int data_size;unsigned char *buffer;int buf_len;struct urb *irq;
@@ -1521,7 +1522,7 @@ static int usbtouch_reset_resume(structstatic void usbtouch_free_buffers (struct usb_device *udev,struct usbtouch_usb *usbtouch) { -usb_free_coherent (udev, usbtouch->type->rept_size, +usb_free_coherent (udev, usbtouch->data_size, usbtouch->data, usbtouch->data_dma);kfree (usbtouch->buffer); }
@@ -1566,7 +1567,20 @@ static int usbtouch_probe(struct usb_intif (!type->process_pkt) type->process_pkt = usbtouch_process_pkt; - usbtouch->data =usb_alloc_coherent (udev, type->rept_size, + usbtouch->data_size = type->rept_size; +if (type->get_pkt_len) { +/* +* When dealing with variable-length packets we should +* not request more than wMaxPacketSize bytes at once +* as we do not know if there is more data coming or +* we filled exactly wMaxPacketSize bytes and there is +* nothing else. +*/ + usbtouch->data_size =min (usbtouch->data_size, +usb_endpoint_maxp (endpoint)); + } + + usbtouch->data =usb_alloc_coherent (udev, usbtouch->data_size,GFP_KERNEL , &usbtouch->data_dma);if (!usbtouch->data) goto out_free;
@@ -1626,12 +1640,12 @@ static int usbtouch_probe(struct usb_intif (usb_endpoint_type (endpoint) ==USB_ENDPOINT_XFER_INT )usb_fill_int_urb (usbtouch->irq, udev,usb_rcvintpipe (udev, endpoint->bEndpointAddress), - usbtouch->data, type->rept_size, + usbtouch->data, usbtouch->data_size, usbtouch_irq, usbtouch, endpoint->bInterval);else usb_fill_bulk_urb (usbtouch->irq, udev,usb_rcvbulkpipe (udev, endpoint->bEndpointAddress), - usbtouch->data, type->rept_size, + usbtouch->data, usbtouch->data_size, usbtouch_irq, usbtouch); usbtouch->irq->dev = udev;
Greg Kroah-Hartman
maintainerPATCH 32/78 media: af9035: fix broken I2C and USB I/O
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antti Palosaari <[email protected]>
commit 9323297dc0ea9141f8099e474657391bb3ad98f8 upstream.
There was three small buffer len calculation bugs which caused driver non-working. These are coming from recent commit:
commit 7760e148350bf6df95662bc0db3734e9d991cb03 [media] af9035: Don't use dynamic static allocation
--- drivers/media/usb/dvb-usb-v2/af9035.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.c +4 -4
@@ -130,7 +130,7 @@ static int af9035_wr_regs(struct dvb_usb {u8 wbuf[MAX_XFER_SIZE ];u8 mbox = (reg >>16 ) &0xff ; -struct usb_req req = {CMD_MEM_WR , mbox,sizeof (wbuf), wbuf,0 ,NULL }; +struct usb_req req = {CMD_MEM_WR , mbox,6 + len, wbuf,0 ,NULL };if (6 + len >sizeof (wbuf)) { dev_warn(&d->udev->dev, "%s: i2c wr: len=%d is too big!\n",
@@ -237,7 +237,7 @@ static int af9035_i2c_master_xfer(struct }else {/* I2C */ u8 buf[MAX_XFER_SIZE ]; -struct usb_req req = {CMD_I2C_RD ,0 ,sizeof (buf), +struct usb_req req = {CMD_I2C_RD ,0 ,5 + msg[0 ].len, buf, msg[1 ].len, msg[1 ].buf };if (5 + msg[0 ].len >sizeof (buf)) {
@@ -273,8 +273,8 @@ static int af9035_i2c_master_xfer(struct }else {/* I2C */ u8 buf[MAX_XFER_SIZE ]; -struct usb_req req = {CMD_I2C_WR ,0 ,sizeof (buf), buf, -0 ,NULL }; +struct usb_req req = {CMD_I2C_WR ,0 ,5 + msg[0 ].len, + buf,0 ,NULL };if (5 + msg[0 ].len >sizeof (buf)) { dev_warn(&d->udev->dev,
Greg Kroah-Hartman
maintainerPATCH 33/78 powerpc: Fix PTE page address mismatch in pgtable ctor/dtor
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Hong H. Pham" <[email protected]>
commit cf77ee54362a245f9a01f240adce03a06c05eb68 upstream.
In pte_alloc_one(), pgtable_page_ctor() is passed an address that has not been converted by page_address() to the newly allocated PTE page.
When the PTE is freed, __pte_free_tlb() calls pgtable_page_dtor() with an address to the PTE page that has been converted by page_address(). The mismatch in the PTE's page address causes pgtable_page_dtor() to access invalid memory, so resources for that PTE (such as the page lock) is not properly cleaned up.
On PPC32, only SMP kernels are affected.
On PPC64, only SMP kernels with 4K page size are affected.
This bug was introduced by commit d614bb041209fd7cb5e4b35e11a7b2f6ee8f62b8 "powerpc: Move the pte free routines from common header".
On a preempt-rt kernel, a spinlock is dynamically allocated for each PTE in pgtable_page_ctor(). When the PTE is freed, calling pgtable_page_dtor() with a mismatched page address causes a memory leak, as the pointer to the PTE's spinlock is bogus.
On mainline, there isn't any immediately obvious symptoms, but the problem still exists here.
--- arch/powerpc/include/asm/pgalloc-32.h | 6 ++---- arch/powerpc/include/asm/pgalloc-64.h | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-)
arch/powerpc/include/asm/pgalloc-32.h +2 -4
@@ -84,10 +84,8 @@ static inline void pgtable_free_tlb(strustatic inline void __pte_free_tlb (struct mmu_gather *tlb,pgtable_t table,unsigned long address) { -struct page *page =page_address (table); -tlb_flush_pgtable (tlb, address); -pgtable_page_dtor (page); -pgtable_free_tlb (tlb, page,0 ); +pgtable_page_dtor (table); +pgtable_free_tlb (tlb,page_address (table),0 ); }#endif /* _ASM_POWERPC_PGALLOC_32_H */
arch/powerpc/include/asm/pgalloc-64.h +2 -4
@@ -144,11 +144,9 @@ static inline void pgtable_free_tlb(strustatic inline void __pte_free_tlb (struct mmu_gather *tlb,pgtable_t table,unsigned long address) { -struct page *page =page_address (table); -tlb_flush_pgtable (tlb, address); -pgtable_page_dtor (page); -pgtable_free_tlb (tlb, page,0 ); +pgtable_page_dtor (table); +pgtable_free_tlb (tlb,page_address (table),0 ); }#else /* if CONFIG_PPC_64K_PAGES */
Greg Kroah-Hartman
maintainerPATCH 34/78 drivers/rtc/rtc-at91rm9200.c: correct alarm over day/month wrap
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Linus Pizunski <[email protected]>
commit eb3c227289840eed95ddfb0516046f08d8993940 upstream.
Update month and day of month to the alarm month/day instead of current day/month when setting the RTC alarm mask.
--- drivers/rtc/rtc-at91rm9200.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/rtc/rtc-at91rm9200.c +2 -0
@@ -221,6 +221,8 @@ static int at91_rtc_setalarm(struct devi at91_alarm_year = tm.tm_year; + tm.tm_mon = alrm->time.tm_mon; + tm.tm_mday = alrm->time.tm_mday; tm.tm_hour = alrm->time.tm_hour; tm.tm_min = alrm->time.tm_min; tm.tm_sec = alrm->time.tm_sec;
Greg Kroah-Hartman
maintainerPATCH 36/78 ath9k: Fix QuickDrop usage
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sujith Manoharan <[email protected]>
commit 93c1cfbe598f72cfa7be49e4a7d2a1d482e15119 upstream.
Bit 5 in the miscConfiguration field of the base EEPROM header denotes whether QuickDrop is enabled or not. Fix the incorrect usage of BIT(1) and also make sure that this is done only for the required chips.
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +11 -9
@@ -3937,18 +3937,20 @@ static void ar9003_hw_quick_drop_apply(sint quick_drop;s32 t[3 ], f[3 ] = {5180 ,5500 ,5785 }; -if (!(pBase->miscConfiguration &BIT (1 ))) +if (!(pBase->miscConfiguration &BIT (4 )))return ; -if (freq <4000 ) - quick_drop = eep->modalHeader2G.quick_drop; -else { - t[0 ] = eep->base_ext1.quick_drop_low; - t[1 ] = eep->modalHeader5G.quick_drop; - t[2 ] = eep->base_ext1.quick_drop_high; - quick_drop =ar9003_hw_power_interpolate (freq, f, t,3 ); +if (AR_SREV_9300 (ah) ||AR_SREV_9580 (ah) ||AR_SREV_9340 (ah)) { +if (freq <4000 ) { + quick_drop = eep->modalHeader2G.quick_drop; + }else { + t[0 ] = eep->base_ext1.quick_drop_low; + t[1 ] = eep->modalHeader5G.quick_drop; + t[2 ] = eep->base_ext1.quick_drop_high; + quick_drop =ar9003_hw_power_interpolate (freq, f, t,3 ); + } +REG_RMW_FIELD (ah,AR_PHY_AGC ,AR_PHY_AGC_QUICK_DROP , quick_drop); } -REG_RMW_FIELD (ah,AR_PHY_AGC ,AR_PHY_AGC_QUICK_DROP , quick_drop); }static void ar9003_hw_txend_to_xpa_off_apply (struct ath_hw *ah,bool is2ghz)
Greg Kroah-Hartman
maintainerPATCH 37/78 ath9k: Fix XLNA bias strength
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sujith Manoharan <[email protected]>
commit a1783a7b0846fc6414483e6caf646db72023fffd upstream.
The EEPROM parameter to determine whether the bias strength values for XLNA have to be applied is part of the miscConfiguration field and not featureEnable.
--- drivers/net/wireless/ath/ath9k/ar9003_eeprom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/ath/ath9k/ar9003_eeprom.c +1 -1
@@ -3990,7 +3990,7 @@ static void ar9003_hw_xlna_bias_strengthstruct ar9300_eeprom *eep = &ah->eeprom.ar9300_eep;u8 bias; -if (!(eep->baseEepHeader.featureEnable &0x40 )) +if (!(eep->baseEepHeader.miscConfiguration &0x40 ))return ;if (!AR_SREV_9300 (ah))
Greg Kroah-Hartman
maintainerPATCH 38/78 selinux: handle TCP SYN-ACK packets correctly in selinux_ip_output()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Moore <[email protected]>
commit 47180068276a04ed31d24fe04c673138208b07a9 upstream.
In selinux_ip_output() we always label packets based on the parent socket. While this approach works in almost all cases, it doesn't work in the case of TCP SYN-ACK packets when the correct label is not the label of the parent socket, but rather the label of the larval socket represented by the request_sock struct.
Unfortunately, since the request_sock isn't queued on the parent socket until *after* the SYN-ACK packet is sent, we can't lookup the request_sock to determine the correct label for the packet; at this point in time the best we can do is simply pass/NF_ACCEPT the packet. It must be said that simply passing the packet without any explicit labeling action, while far from ideal, is not terrible as the SYN-ACK packet will inherit any IP option based labeling from the initial connection request so the label *should* be correct and all our access controls remain in place so we shouldn't have to worry about information leaks.
--- security/selinux/hooks.c | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-)
security/selinux/hooks.c +23 -2
@@ -53,6 +53,7 @@#include <net/ip.h> /* for local_port_range[] */ #include <net/sock.h> #include <net/tcp.h> /* struct or_callable used in sock_rcv_skb */ +#include <net/inet_connection_sock.h> #include <net/net_namespace.h> #include <net/netlabel.h> #include <linux/uaccess.h>
@@ -4621,6 +4622,7 @@ static unsigned int selinux_ipv6_forwardstatic unsigned int selinux_ip_output (struct sk_buff *skb,u16 family) { +struct sock *sk;u32 sid;if (!netlbl_enabled ())
@@ -4629,8 +4631,27 @@ static unsigned int selinux_ip_output(st/* we do this in the LOCAL_OUT path and not the POST_ROUTING path * because we want to make sure we apply the necessary labeling * before IPsec is applied so we can leverage AH protection */ -if (skb->sk) { -struct sk_security_struct *sksec = skb->sk->sk_security; + sk = skb->sk; +if (sk) { +struct sk_security_struct *sksec; + +if (sk->sk_state ==TCP_LISTEN ) +/* if the socket is the listening state then this +* packet is a SYN-ACK packet which means it needs to +* be labeled based on the connection/request_sock and +* not the parent socket. unfortunately, we can't +* lookup the request_sock yet as it isn't queued on +* the parent socket until after the SYN-ACK is sent. +* the "solution" is to simply pass the packet as-is +* as any IP option based labeling should be copied +* from the initial connection request (in the IP +* layer). it is far from ideal, but until we get a +* security label in the packet itself this is the +* best we can do. */ +return NF_ACCEPT ; + +/* standard practice, label using the parent socket */ + sksec = sk->sk_security; sid = sksec->sid; }else sid =SECINITSID_KERNEL ;
Greg Kroah-Hartman
maintainerPATCH 39/78 selinux: handle TCP SYN-ACK packets correctly in selinux_ip_postroute()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Moore <[email protected]>
commit 446b802437f285de68ffb8d6fac3c44c3cab5b04 upstream.
In selinux_ip_postroute() we perform access checks based on the packet's security label. For locally generated traffic we get the packet's security label from the associated socket; this works in all cases except for TCP SYN-ACK packets. In the case of SYN-ACK packet's the correct security label is stored in the connection's request_sock, not the server's socket. Unfortunately, at the point in time when selinux_ip_postroute() is called we can't query the request_sock directly, we need to recreate the label using the same logic that originally labeled the associated request_sock.
See the inline comments for more explanation.
--- security/selinux/hooks.c | 68 ++++++++++++++++++++++++++++++++++++----------- 1 file changed, 53 insertions(+), 15 deletions(-)
security/selinux/hooks.c +53 -15
@@ -3737,6 +3737,30 @@ static int selinux_skb_peerlbl_sid(strucreturn 0 ; } +/** +* selinux_conn_sid - Determine the child socket label for a connection +* @sk_sid: the parent socket's SID +* @skb_sid: the packet's SID +* @conn_sid: the resulting connection SID +* +* If @skb_sid is valid then the user:role:type information from @sk_sid is +* combined with the MLS information from @skb_sid in order to create +* @conn_sid. If @skb_sid is not valid then then @conn_sid is simply a copy +* of @sk_sid. Returns zero on success, negative values on failure. +* +*/ +static int selinux_conn_sid (u32 sk_sid,u32 skb_sid,u32 *conn_sid) +{ +int err =0 ; + +if (skb_sid !=SECSID_NULL ) + err =security_sid_mls_copy (sk_sid, skb_sid, conn_sid); +else + *conn_sid = sk_sid; + +return err; +} +/* socket security operations */ static int socket_sockcreate_sid(const struct task_security_struct *tsec,
@@ -4343,7 +4367,7 @@ static int selinux_inet_conn_request(strstruct sk_security_struct *sksec = sk->sk_security;int err;u16 family = sk->sk_family; -u32 newsid; +u32 connsid;u32 peersid;/* handle mapped IPv4 packets arriving via IPv6 sockets */
@@ -4353,16 +4377,11 @@ static int selinux_inet_conn_request(str err =selinux_skb_peerlbl_sid (skb, family, &peersid);if (err)return err; -if (peersid ==SECSID_NULL ) { - req->secid = sksec->sid; - req->peer_secid =SECSID_NULL ; - }else { - err =security_sid_mls_copy (sksec->sid, peersid, &newsid); -if (err) -return err; - req->secid = newsid; - req->peer_secid = peersid; - } + err =selinux_conn_sid (sksec->sid, peersid, &connsid); +if (err) +return err; + req->secid = connsid; + req->peer_secid = peersid;return selinux_netlbl_inet_conn_request (req, family); }
@@ -4736,12 +4755,12 @@ static unsigned int selinux_ip_postrouteif (!secmark_active && !peerlbl_active)return NF_ACCEPT ; -/* if the packet is being forwarded then get the peer label from the -* packet itself; otherwise check to see if it is from a local -* application or the kernel, if from an application get the peer label -* from the sending socket, otherwise use the kernel's sid */ sk = skb->sk;if (sk ==NULL ) { +/* Without an associated socket the packet is either coming +* from the kernel or it is being forwarded; check the packet +* to determine which and if the packet is being forwarded +* query the packet directly to determine the security label. */ if (skb->skb_iif) { secmark_perm =PACKET__FORWARD_OUT ;if (selinux_skb_peerlbl_sid (skb, family, &peer_sid))
@@ -4750,7 +4769,26 @@ static unsigned int selinux_ip_postroute secmark_perm =PACKET__SEND ; peer_sid =SECINITSID_KERNEL ; } + }else if (sk->sk_state ==TCP_LISTEN ) { +/* Locally generated packet but the associated socket is in the +* listening state which means this is a SYN-ACK packet. In +* this particular case the correct security label is assigned +* to the connection/request_sock but unfortunately we can't +* query the request_sock as it isn't queued on the parent +* socket until after the SYN-ACK packet is sent; the only +* viable choice is to regenerate the label like we do in +* selinux_inet_conn_request(). See also selinux_ip_output() +* for similar problems. */ +u32 skb_sid; +struct sk_security_struct *sksec = sk->sk_security; +if (selinux_skb_peerlbl_sid (skb, family, &skb_sid)) +return NF_DROP ; +if (selinux_conn_sid (sksec->sid, skb_sid, &peer_sid)) +return NF_DROP ; + secmark_perm =PACKET__SEND ; }else { +/* Locally generated packet, fetch the security label from the +* associated socket. */ struct sk_security_struct *sksec = sk->sk_security; peer_sid = sksec->sid; secmark_perm =PACKET__SEND ;
Greg Kroah-Hartman
maintainerPATCH 40/78 Revert "mac80211: allow disable power save in mesh"
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bob Copeland <[email protected]>
commit 2d3db210860f1df099a35b1dd54cca35454e0361 upstream.
This reverts commit ee1f668136b2fb6640ee2d54c2a525ea41f98211.
The aformentioned commit added a check to allow 'iw wlan0 set power_save off' to work for mesh interfaces.
However, this is problematic because it also allows 'iw wlan0 set power_save on', which will crash in short order because all of the subsequent code manipulates sdata->u.mgd.
The power-saving states for mesh interfaces can be manipulated through the mesh config, e.g:
'iw wlan0 set mesh_param mesh_power_save=active' (which, despite the name, actualy disables power saving since the setting refers to the type of sleep the interface undergoes).
--- net/mac80211/cfg.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
net/mac80211/cfg.c +1 -2
@@ -2356,8 +2356,7 @@ static int ieee80211_set_power_mgmt(strustruct ieee80211_sub_if_data *sdata =IEEE80211_DEV_TO_SUB_IF (dev);struct ieee80211_local *local =wdev_priv (dev->ieee80211_ptr); -if (sdata->vif.type !=NL80211_IFTYPE_STATION && - sdata->vif.type !=NL80211_IFTYPE_MESH_POINT ) +if (sdata->vif.type !=NL80211_IFTYPE_STATION )return -EOPNOTSUPP ;if (!(local->hw.flags &IEEE80211_HW_SUPPORTS_PS ))
Greg Kroah-Hartman
maintainerPATCH 41/78 mac80211: dont attempt to reorder multicast frames
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 051a41fa4ee14f5c39668f0980973b9a195de560 upstream.
Multicast frames can't be transmitted as part of an aggregation session (such a session couldn't even be set up) so don't try to reorder them. Trying to do so would cause the reorder to stop working correctly since multicast QoS frames (as transmitted by the Aruba APs this was found with) would cause sequence number confusion in the buffer.
--- net/mac80211/rx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
net/mac80211/rx.c +2 -1
@@ -864,7 +864,8 @@ static void ieee80211_rx_reorder_ampdu(su16 sc;u8 tid, ack_policy; -if (!ieee80211_is_data_qos (hdr->frame_control)) +if (!ieee80211_is_data_qos (hdr->frame_control) || +is_multicast_ether_addr (hdr->addr1)) goto dont_reorder;/*
Greg Kroah-Hartman
maintainerPATCH 42/78 iwlwifi: mvm: check sta_id/drain values in debugfs
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 60765a47a433d54e4744c285ad127f182dcd80aa upstream.
The station ID must be valid, if it's out of range then the array access may crash. Validate the station ID to the array length, and also validate the drain value even if that doesn't matter all that much.
--- drivers/net/wireless/iwlwifi/mvm/debugfs.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/net/wireless/iwlwifi/mvm/debugfs.c +4 -0
@@ -119,6 +119,10 @@ static ssize_t iwl_dbgfs_sta_drain_writeif (sscanf (buf,"%d %d" , &sta_id, &drain) !=2 )return -EINVAL ; +if (sta_id <0 || sta_id >=IWL_MVM_STATION_COUNT ) +return -EINVAL ; +if (drain <0 || drain >1 ) +return -EINVAL ;mutex_lock (&mvm->mutex);
Greg Kroah-Hartman
maintainerPATCH 43/78 mwifiex: fix memory leak issue for ibss join
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ujjal Roy <[email protected]>
commit 517543fd72d577dde2ebd9505dc4abf26d589f9a upstream.
For IBSS join if the requested SSID matches current SSID, it returns without freeing the allocated beacon IE buffer.
--- drivers/net/wireless/mwifiex/sta_ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mwifiex/sta_ioctl.c +2 -2
@@ -309,8 +309,8 @@ int mwifiex_bss_start(struct mwifiex_priif (bss_desc && bss_desc->ssid.ssid_len && (!mwifiex_ssid_cmp (&priv->curr_bss_params.bss_descriptor. ssid, &bss_desc->ssid))) { -kfree (bss_desc); -return 0 ; + ret =0 ; + goto done; }/* Exit Adhoc mode first */
Greg Kroah-Hartman
maintainerPATCH 44/78 igb: Fix for issue where values could be too high for udelay function.
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Carolyn Wyborny <[email protected]>
commit df29df92adda751ac04ca5149d30014b5199db81 upstream.
This patch changes the igb_phy_has_link function to check the value of the parameter before deciding to use udelay or mdelay in order to be sure that the value is not too high for udelay function.
--- drivers/net/ethernet/intel/igb/e1000_phy.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/ethernet/intel/igb/e1000_phy.c +4 -1
@@ -1595,7 +1595,10 @@ s32 igb_phy_has_link(struct e1000_hw *hw* ownership of the resources, wait and try again to * see if they have relinquished the resources yet. */ -udelay (usec_interval); +if (usec_interval >=1000 ) +mdelay (usec_interval/1000 ); +else +udelay (usec_interval); } ret_val = hw->phy.ops.read_reg (hw,PHY_STATUS , &phy_status);if (ret_val)
Greg Kroah-Hartman
maintainerPATCH 45/78 drm/radeon: program DCE2 audio dto just like DCE3
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 55d4e020fb8ddd3896a8cd3351028f5c3a2c4bd3 upstream.
Seems to work like the DCE3 version despite what
the register spec says.
bug:
https://bugs.freedesktop.org/show_bug.cgi?id=71975
--- drivers/gpu/drm/radeon/r600_hdmi.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/gpu/drm/radeon/r600_hdmi.c +2 -6
@@ -279,9 +279,9 @@ void r600_audio_set_dto(struct drm_encodWREG32 (DCCG_AUDIO_DTO1_MODULE , clock *100 );WREG32 (DCCG_AUDIO_DTO_SELECT ,1 );/* select DTO1 */ } - }else if (ASIC_IS_DCE3 (rdev)) { + }else {/* according to the reg specs, this should DCE3.2 only, but in -* practice it seems to cover DCE3.0/3.1 as well. +* practice it seems to cover DCE2.0/3.0/3.1 as well. */ if (dig->dig_encoder ==0 ) {WREG32 (DCCG_AUDIO_DTO0_PHASE , base_rate *100 );
@@ -292,10 +292,6 @@ void r600_audio_set_dto(struct drm_encodWREG32 (DCCG_AUDIO_DTO1_MODULE , clock *100 );WREG32 (DCCG_AUDIO_DTO_SELECT ,1 );/* select DTO1 */ } - }else { -/* according to the reg specs, this should be DCE2.0 and DCE3.0/3.1 */ -WREG32 (AUDIO_DTO ,AUDIO_DTO_PHASE (base_rate /10 ) | -AUDIO_DTO_MODULE (clock /10 )); } }
Greg Kroah-Hartman
maintainerPATCH 46/78 drm/radeon: fixup bad vram size on SI
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 0ca223b029a261e82fb2f50c52eb85d510f4260e upstream.
Some boards seem to have garbage in the upper 16 bits of the vram size register. Check for this and clamp the size properly. Fixes boards reporting bogus amounts of vram.
--- drivers/gpu/drm/radeon/si.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/si.c +9 -2
@@ -3615,8 +3615,15 @@ static int si_mc_init(struct radeon_devi rdev->mc.aper_base =pci_resource_start (rdev->pdev,0 ); rdev->mc.aper_size =pci_resource_len (rdev->pdev,0 );/* size in MB on si */ - rdev->mc.mc_vram_size =RREG32 (CONFIG_MEMSIZE ) *1024ULL *1024ULL ; - rdev->mc.real_vram_size =RREG32 (CONFIG_MEMSIZE ) *1024ULL *1024ULL ; + tmp =RREG32 (CONFIG_MEMSIZE ); +/* some boards may have garbage in the upper 16 bits */ +if (tmp &0xffff0000 ) { +DRM_INFO ("Probable bad vram size: 0x%08x\n" , tmp); +if (tmp &0xffff ) + tmp &=0xffff ; + } + rdev->mc.mc_vram_size = tmp *1024ULL *1024ULL ; + rdev->mc.real_vram_size = rdev->mc.mc_vram_size; rdev->mc.visible_vram_size = rdev->mc.aper_size;si_vram_gtt_location (rdev, &rdev->mc);radeon_update_bandwidth_info (rdev);
Greg Kroah-Hartman
maintainerPATCH 47/78 x86, efi: Dont use (U)EFI time services on 32 bit
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Matthew Garrett <[email protected]>
commit 04bf9ba720fcc4fa313fa122b799ae0989b6cd50 upstream.
UEFI time services are often broken once we're in virtual mode. We were already refusing to use them on 64-bit systems, but it turns out that they're also broken on some 32-bit firmware, including the Dell Venue. Disable them for now, we can revisit once we have the 1:1 mappings code incorporated.
--- arch/x86/platform/efi/efi.c | 7 ------- 1 file changed, 7 deletions(-)
arch/x86/platform/efi/efi.c +0 -7
@@ -766,13 +766,6 @@ void __init efi_init(void)set_bit (EFI_MEMMAP , &x86_efi_facility); -#ifdef CONFIG_X86_32 -if (efi_is_native ()) { - x86_platform.get_wallclock = efi_get_time; - x86_platform.set_wallclock = efi_set_rtc_mmss; - } -#endif -#if EFI_DEBUG print_efi_memmap ();#endif
Greg Kroah-Hartman
maintainerPATCH 48/78 x86, build: Pass in additional -mno-mmx, -mno-sse options
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 8b3b005d675726e38bc504d2e35a991e55819155 upstream.
In checkin
5551a34e5aea x86-64, build: Always pass in -mno-sse
we unconditionally added -mno-sse to the main build, to keep newer compilers from generating SSE instructions from autovectorization. However, this did not extend to the special environments (arch/x86/boot, arch/x86/boot/compressed, and arch/x86/realmode/rm). Add -mno-sse to the compiler command line for these environments, and add -mno-mmx to all the environments as well, as we don't want a compiler to generate MMX code either.
This patch also removes a $(cc-option) call for -m32, since we have long since stopped supporting compilers too old for the -m32 option, and in fact hardcode it in other places in the Makefiles.
--- arch/x86/Makefile | 8 ++++---- arch/x86/boot/Makefile | 6 +++--- arch/x86/boot/compressed/Makefile | 1 + arch/x86/realmode/rm/Makefile | 3 ++- 4 files changed, 10 insertions(+), 8 deletions(-)
arch/x86/Makefile +4 -4
@@ -31,8 +31,8 @@ ifeq ($(CONFIG_X86_32),y) KBUILD_CFLAGS += -msoft-float -mregparm=3 -freg-struct-return - # Don't autogenerate SSE instructions - KBUILD_CFLAGS += -mno-sse + # Don't autogenerate MMX or SSE instructions + KBUILD_CFLAGS += -mno-mmx -mno-sse # Never want PIC in a 32-bit kernel, prevent breakage with GCC built # with nonstandard options
@@ -60,8 +60,8 @@ else KBUILD_AFLAGS += -m64 KBUILD_CFLAGS += -m64 - # Don't autogenerate SSE instructions - KBUILD_CFLAGS += -mno-sse + # Don't autogenerate MMX or SSE instructions + KBUILD_CFLAGS += -mno-mmx -mno-sse # Use -mpreferred-stack-boundary=3 if supported. KBUILD_CFLAGS += $(call cc-option,-mpreferred-stack-boundary=3)
arch/x86/boot/Makefile +3 -3
@@ -53,18 +53,18 @@ $(obj)/cpustr.h: $(obj)/mkcpustr FORCE # How to compile the 16-bit code. Note we always compile for -march=i386, # that way we can complain to the user if the CPU is insufficient. -KBUILD_CFLAGS := $(USERINCLUDE) -g -Os -D_SETUP -D__KERNEL__ \ +KBUILD_CFLAGS := $(USERINCLUDE) -m32 -g -Os -D_SETUP -D__KERNEL__ \ -DDISABLE_BRANCH_PROFILING \ -Wall -Wstrict-prototypes \ -march=i386 -mregparm=3 \ -include $(srctree)/$(src)/code16gcc.h \ -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ + -mno-mmx -mno-sse \ $(call cc-option, -ffreestanding) \ $(call cc-option, -fno-toplevel-reorder,\ - $(call cc-option, -fno-unit-at-a-time)) \ + $(call cc-option, -fno-unit-at-a-time)) \ $(call cc-option, -fno-stack-protector) \ $(call cc-option, -mpreferred-stack-boundary=2) -KBUILD_CFLAGS += $(call cc-option, -m32) KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__ GCOV_PROFILE := n
arch/x86/boot/compressed/Makefile +1 -0
@@ -12,6 +12,7 @@ KBUILD_CFLAGS += -DDISABLE_BRANCH_PROFIL cflags-$(CONFIG_X86_32) := -march=i386 cflags-$(CONFIG_X86_64) := -mcmodel=small KBUILD_CFLAGS += $(cflags-y) +KBUILD_CFLAGS += -mno-mmx -mno-sse KBUILD_CFLAGS += $(call cc-option,-ffreestanding) KBUILD_CFLAGS += $(call cc-option,-fno-stack-protector)
arch/x86/realmode/rm/Makefile +2 -1
@@ -73,9 +73,10 @@ KBUILD_CFLAGS := $(LINUXINCLUDE) -m32 -g -march=i386 -mregparm=3 \ -include $(srctree)/$(src)/../../boot/code16gcc.h \ -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ + -mno-mmx -mno-sse \ $(call cc-option, -ffreestanding) \ $(call cc-option, -fno-toplevel-reorder,\ - $(call cc-option, -fno-unit-at-a-time)) \ + $(call cc-option, -fno-unit-at-a-time)) \ $(call cc-option, -fno-stack-protector) \ $(call cc-option, -mpreferred-stack-boundary=2) KBUILD_AFLAGS := $(KBUILD_CFLAGS) -D__ASSEMBLY__
Greg Kroah-Hartman
maintainerPATCH 49/78 x86, build, icc: Remove uninitialized_var() from compiler-intel.h
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: "H. Peter Anvin" <[email protected]>
commit 503cf95c061a0551eb684da364509297efbe55d9 upstream.
When compiling with icc, <linux/compiler-gcc.h> ends up included because the icc environment defines __GNUC__. Thus, we neither need nor want to have this macro defined in both compiler-gcc.h and compiler-intel.h, and the fact that they are inconsistent just makes the compiler spew warnings.
--- include/linux/compiler-intel.h | 2 -- 1 file changed, 2 deletions(-)
include/linux/compiler-intel.h +0 -2
@@ -28,8 +28,6 @@#endif -#define uninitialized_var (x) x -#ifndef __HAVE_BUILTIN_BSWAP16__/* icc has this, but it's called _bswap16 */ #define __HAVE_BUILTIN_BSWAP16__
Greg Kroah-Hartman
maintainerPATCH 50/78 media: saa7164: fix return value check in saa7164_initdev()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Wei Yongjun <[email protected]>
commit 89f4d45b2752df5d222b5f63919ce59e2d8afaf4 upstream.
In case of error, the function kthread_run() returns ERR_PTR() and never returns NULL. The NULL test in the return value check should be replaced with IS_ERR().
--- drivers/media/pci/saa7164/saa7164-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/media/pci/saa7164/saa7164-core.c +3 -1
@@ -1348,9 +1348,11 @@ static int saa7164_initdev(struct pci_deif (fw_debug) { dev->kthread =kthread_run (saa7164_thread_function, dev,"saa7164 debug" ); -if (!dev->kthread) +if (IS_ERR (dev->kthread)) { + dev->kthread =NULL ;printk (KERN_ERR "%s() Failed to create " "debug kernel thread\n" , __func__); + } } }/* != BOARD_UNKNOWN */
Greg Kroah-Hartman
maintainerPATCH 52/78 media: af9033: fix broken I2C
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antti Palosaari <[email protected]>
commit d18a88b1f535d627412b2a265d71b2f7d464860e upstream.
Driver did not work anymore since I2C has gone broken due to recent commit:
commit 37ebaf6891ee81687bb558e8375c0712d8264ed8 [media] dvb-frontends: Don't use dynamic static allocation
--- drivers/media/dvb-frontends/af9033.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/media/dvb-frontends/af9033.c +6 -6
@@ -170,18 +170,18 @@ static int af9033_rd_reg_mask(struct af9static int af9033_wr_reg_val_tab (struct af9033_state *state,const struct reg_val *tab,int tab_len) { +#define MAX_TAB_LEN 212int ret, i, j; -u8 buf[MAX_XFER_SIZE ]; +u8 buf[1 +MAX_TAB_LEN ]; + +dev_dbg (&state->i2c->dev,"%s: tab_len=%d\n" , __func__, tab_len);if (tab_len >sizeof (buf)) { -dev_warn (&state->i2c->dev, -"%s: i2c wr len=%d is too big!\n" , -KBUILD_MODNAME , tab_len); +dev_warn (&state->i2c->dev,"%s: tab len %d is too big\n" , +KBUILD_MODNAME , tab_len);return -EINVAL ; } -dev_dbg (&state->i2c->dev,"%s: tab_len=%d\n" , __func__, tab_len); -for (i =0 , j =0 ; i < tab_len; i++) { buf[j] = tab[i].val;
Greg Kroah-Hartman
maintainerPATCH 53/78 media: wm8775: fix broken audio routing
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
commit 3af41a337a5b270de3e65466a07f106ad97ad0c6 upstream.
Commit 5aa9ae5ed5d449a85fbf7aac3d1fdc241c542a79 inverted the mute control state test in s_routing which caused the audio routing to fail. This broke ivtv support for the Hauppauge video/audio input bracket (which adds additional video and audio inputs) all the way back in kernel 2.6.36.
This fix fixes the condition and it also removes a nonsense check on the balance control.
--- drivers/media/i2c/wm8775.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
drivers/media/i2c/wm8775.c +1 -3
@@ -131,12 +131,10 @@ static int wm8775_s_routing(struct v4l2_return -EINVAL ; } state->input = input; -if (!v4l2_ctrl_g_ctrl (state->mute)) +if (v4l2_ctrl_g_ctrl (state->mute))return 0 ;if (!v4l2_ctrl_g_ctrl (state->vol))return 0 ; -if (!v4l2_ctrl_g_ctrl (state->bal)) -return 0 ;wm8775_set_audio (sd,1 );return 0 ; }
Greg Kroah-Hartman
maintainerPATCH 54/78 media: af9035: add [0413:6a05] Leadtek WinFast DTV Dongle Dual
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antti Palosaari <[email protected]>
commit 0c413d10515feae02cee967b31bb8afea8aa0d29 upstream.
It is IT9135 dual design.
Thanks to Michael Piko for reporting that!
--- drivers/media/usb/dvb-usb-v2/af9035.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/media/usb/dvb-usb-v2/af9035.c +2 -0
@@ -1512,6 +1512,8 @@ static const struct usb_device_id af9035/* XXX: that same ID [0ccd:0099] is used by af9015 driver too */ {DVB_USB_DEVICE (USB_VID_TERRATEC ,0x0099 , &af9035_props, "TerraTec Cinergy T Stick Dual RC (rev. 2)", NULL) }, + { DVB_USB_DEVICE(USB_VID_LEADTEK, 0x6a05, + &af9035_props, "Leadtek WinFast DTV Dongle Dual", NULL) }, { } };MODULE_DEVICE_TABLE (usb, af9035_id_table);
Greg Kroah-Hartman
maintainerPATCH 55/78 media: af9035: unlock on error in af9035_i2c_master_xfer()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 3189ef0290dcc9f44782672fade35847cb30da00 upstream.
We introduced a couple new error paths which are missing unlocks.
--- drivers/media/usb/dvb-usb-v2/af9035.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/media/usb/dvb-usb-v2/af9035.c +5 -2
@@ -244,7 +244,8 @@ static int af9035_i2c_master_xfer(structdev_warn (&d->udev->dev,"%s: i2c xfer: len=%d is too big!\n" ,KBUILD_MODNAME , msg[0 ].len); -return -EOPNOTSUPP ; + ret = -EOPNOTSUPP ; + goto unlock; } req.mbox |= ((msg[0 ].addr &0x80 ) >>3 ); buf[0 ] = msg[1 ].len;
@@ -280,7 +281,8 @@ static int af9035_i2c_master_xfer(structdev_warn (&d->udev->dev,"%s: i2c xfer: len=%d is too big!\n" ,KBUILD_MODNAME , msg[0 ].len); -return -EOPNOTSUPP ; + ret = -EOPNOTSUPP ; + goto unlock; } req.mbox |= ((msg[0 ].addr &0x80 ) >>3 ); buf[0 ] = msg[0 ].len;
@@ -300,6 +302,7 @@ static int af9035_i2c_master_xfer(struct ret = -EOPNOTSUPP ; } +unlock:mutex_unlock (&d->i2c_mutex);if (ret <0 )
Greg Kroah-Hartman
maintainerPATCH 56/78 Btrfs: fix access_ok() check in btrfs_ioctl_send()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
commit 700ff4f095d78af0998953e922e041d75254518b upstream.
The closing parenthesis is in the wrong place. We want to check "sizeof(*arg->clone_sources) * arg->clone_sources_count" instead of "sizeof(*arg->clone_sources * arg->clone_sources_count)".
--- fs/btrfs/send.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/btrfs/send.c +2 -2
@@ -4623,8 +4623,8 @@ long btrfs_ioctl_send(struct file *mnt_f }if (!access_ok (VERIFY_READ , arg->clone_sources, -sizeof (*arg->clone_sources * - arg->clone_sources_count))) { +sizeof (*arg->clone_sources) * + arg->clone_sources_count)) { ret = -EFAULT ; goto out; }
Greg Kroah-Hartman
maintainerPATCH 57/78 btrfs: call mnt_drop_write after interrupted subvol deletion
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Sterba <[email protected]>
commit e43f998e47bae27e37e159915625e8d4b130153b upstream.
If btrfs_ioctl_snap_destroy blocks on the mutex and the process is killed, mnt_write count is unbalanced and leads to unmountable filesystem.
--- fs/btrfs/ioctl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/btrfs/ioctl.c +2 -1
@@ -2093,7 +2093,7 @@ static noinline int btrfs_ioctl_snap_des err =mutex_lock_killable_nested (&dir->i_mutex,I_MUTEX_PARENT );if (err == -EINTR ) - goto out; + goto out_drop_write; dentry =lookup_one_len (vol_args->name, parent, namelen);if (IS_ERR (dentry)) { err =PTR_ERR (dentry);
@@ -2235,6 +2235,7 @@ out_dput:dput (dentry); out_unlock_dir:mutex_unlock (&dir->i_mutex); +out_drop_write:mnt_drop_write_file (file); out:kfree (vol_args);
Greg Kroah-Hartman
maintainerPATCH 58/78 dm bufio: initialize read-only module parameters
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 4cb57ab4a2e61978f3a9b7d4f53988f30d61c27f upstream.
Some module parameters in dm-bufio are read-only. These parameters inform the user about memory consumption. They are not supposed to be changed by the user.
However, despite being read-only, these parameters can be set on modprobe or insmod command line, for example:
modprobe dm-bufio current_allocated_bytes=12345
The kernel doesn't expect that these variables can be non-zero at module initialization and if the user sets them, it results in BUG.
This patch initializes the variables in the module init routine, so that user-supplied values are ignored.
--- drivers/md/dm-bufio.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/md/dm-bufio.c +5 -0
@@ -1660,6 +1660,11 @@ static int __init dm_bufio_init(void) {__u64 mem; + dm_bufio_allocated_kmem_cache =0 ; + dm_bufio_allocated_get_free_pages =0 ; + dm_bufio_allocated_vmalloc =0 ; + dm_bufio_current_allocated =0 ; +memset (&dm_bufio_caches,0 ,sizeof dm_bufio_caches);memset (&dm_bufio_cache_names,0 ,sizeof dm_bufio_cache_names);
Greg Kroah-Hartman
maintainerPATCH 59/78 dm snapshot: avoid snapshot space leak on crash
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 230c83afdd9cd384348475bea1e14b80b3b6b1b8 upstream.
There is a possible leak of snapshot space in case of crash.
The reason for space leaking is that chunks in the snapshot device are allocated sequentially, but they are finished (and stored in the metadata) out of order, depending on the order in which copying finished.
For example, supposed that the metadata contains the following records SUPERBLOCK
METADATA (blocks 0 ... 250)
DATA 0
DATA 1
DATA 2
...
DATA 250
Now suppose that you allocate 10 new data blocks 251-260. Suppose that copying of these blocks finish out of order (block 260 finished first and the block 251 finished last). Now, the snapshot device looks like this:
SUPERBLOCK
METADATA (blocks 0 ... 250, 260, 259, 258, 257, 256)
DATA 0
DATA 1
DATA 2
...
DATA 250
DATA 251
DATA 252
DATA 253
DATA 254
DATA 255
METADATA (blocks 255, 254, 253, 252, 251)
DATA 256
DATA 257
DATA 258
DATA 259
DATA 260
Now, if the machine crashes after writing the first metadata block but before writing the second metadata block, the space for areas DATA 250-255 is leaked, it contains no valid data and it will never be used in the future.
This patch makes dm-snapshot complete exceptions in the same order they were allocated, thus fixing this bug.
Note: when backporting this patch to the stable kernel, change the version field in the following way:
* if version in the stable kernel is {1, 11, 1}, change it to {1, 12, 0}
* if version in the stable kernel is {1, 10, 0} or {1, 10, 1}, change it to {1, 10, 2}
Userspace reads the version to determine if the bug was fixed, so the version change is needed.
--- drivers/md/dm-snap.c | 71 +++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 64 insertions(+), 7 deletions(-)
drivers/md/dm-snap.c +64 -7
@@ -66,6 +66,18 @@ struct dm_snapshot {atomic_t pending_exceptions_count; +/* Protected by "lock" */ +sector_t exception_start_sequence; + +/* Protected by kcopyd single-threaded callback */ +sector_t exception_complete_sequence; + +/* +* A list of pending exceptions that completed out of order. +* Protected by kcopyd single-threaded callback. +*/ +struct list_head out_of_order_list; +mempool_t *pending_pool;struct dm_exception_table pending;
@@ -173,6 +185,14 @@ struct dm_snap_pending_exception {*/ int started; +/* There was copying error. */ +int copy_error; + +/* A sequence number, it is used for in-order completion. */ +sector_t exception_sequence; + +struct list_head out_of_order_entry; +/* * For writing a complete chunk, bypassing the copy. */
@@ -1094,6 +1114,9 @@ static int snapshot_ctr(struct dm_target s->valid =1 ; s->active =0 ;atomic_set (&s->pending_exceptions_count,0 ); + s->exception_start_sequence =0 ; + s->exception_complete_sequence =0 ; +INIT_LIST_HEAD (&s->out_of_order_list);init_rwsem (&s->lock);INIT_LIST_HEAD (&s->list);spin_lock_init (&s->pe_lock);
@@ -1443,6 +1466,19 @@ static void commit_callback(void *contexpending_complete (pe, success); } +static void complete_exception (struct dm_snap_pending_exception *pe) +{ +struct dm_snapshot *s = pe->snap; + +if (unlikely (pe->copy_error)) +pending_complete (pe,0 ); + +else +/* Update the metadata if we are persistent */ + s->store->type->commit_exception (s->store, &pe->e, + commit_callback, pe); +} +/* * Called when the copy I/O has finished. kcopyd actually runs * this code so don't block.
@@ -1452,13 +1488,32 @@ static void copy_callback(int read_err,struct dm_snap_pending_exception *pe = context;struct dm_snapshot *s = pe->snap; -if (read_err || write_err) -pending_complete (pe,0 ); + pe->copy_error = read_err || write_err; -else -/* Update the metadata if we are persistent */ - s->store->type->commit_exception (s->store, &pe->e, - commit_callback, pe); +if (pe->exception_sequence == s->exception_complete_sequence) { + s->exception_complete_sequence++; +complete_exception (pe); + +while (!list_empty (&s->out_of_order_list)) { + pe =list_entry (s->out_of_order_list.next, + struct dm_snap_pending_exception, out_of_order_entry); +if (pe->exception_sequence != s->exception_complete_sequence) +break ; + s->exception_complete_sequence++; +list_del (&pe->out_of_order_entry); +complete_exception (pe); + } + }else { +struct list_head *lh; +struct dm_snap_pending_exception *pe2; + +list_for_each_prev (lh, &s->out_of_order_list) { + pe2 = list_entry(lh, struct dm_snap_pending_exception, out_of_order_entry); +if (pe2->exception_sequence < pe->exception_sequence) +break ; + } +list_add (&pe->out_of_order_entry, lh); + } }/*
@@ -1553,6 +1608,8 @@ __find_pending_exception(struct dm_snapsreturn NULL ; } + pe->exception_sequence = s->exception_start_sequence++; +dm_insert_exception (&s->pending, &pe->e);return pe;
@@ -2192,7 +2249,7 @@ static struct target_type origin_targetstatic struct target_type snapshot_target = { .name ="snapshot" , - .version = {1 ,11 ,1 }, + .version = {1 ,12 ,0 }, .module =THIS_MODULE , .ctr = snapshot_ctr, .dtr = snapshot_dtr,
Greg Kroah-Hartman
maintainerPATCH 60/78 dm array: fix a reference counting bug in shadow_ablock
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit ed9571f0cf1fe09d3506302610f3ccdfa1d22c4a upstream.
An old array block could have its reference count decremented below zero when it is being replaced in the btree by a new array block.
The fix is to increment the old ablock's reference count just before inserting a new ablock into the btree.
--- drivers/md/persistent-data/dm-array.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/md/persistent-data/dm-array.c +9 -1
@@ -317,8 +317,16 @@ static int shadow_ablock(struct dm_array* The shadow op will often be a noop. Only insert if it really * copied data. */ -if (dm_block_location (*block) != b) +if (dm_block_location (*block) != b) { +/* +* dm_tm_shadow_block will have already decremented the old +* block, but it is still referenced by the btree. We +* increment to stop the insert decrementing it below zero +* when overwriting the old value. +*/ +dm_tm_inc (info->btree_info.tm, b); r =insert_ablock (info, index, *block, root); + }return r; }
Greg Kroah-Hartman
maintainerPATCH 61/78 dm delay: fix a possible deadlock due to shared workqueue
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 718822c1c112dc99e0c72c8968ee1db9d9d910f0 upstream.
The dm-delay target uses a shared workqueue for multiple instances. This can cause deadlock if two or more dm-delay targets are stacked on the top of each other.
This patch changes dm-delay to use a per-instance workqueue.
--- drivers/md/dm-delay.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-)
drivers/md/dm-delay.c +11 -12
@@ -20,6 +20,7 @@struct delay_c {struct timer_list delay_timer;struct mutex timer_lock; +struct workqueue_struct *kdelayd_wq;struct work_struct flush_expired_bios;struct list_head delayed_bios;atomic_t may_delay;
@@ -45,14 +46,13 @@ struct dm_delay_info {static DEFINE_MUTEX (delayed_bios_lock); -static struct workqueue_struct *kdelayd_wq;static struct kmem_cache *delayed_cache;static void handle_delayed_timer (unsigned long data) {struct delay_c *dc = (struct delay_c *)data; -queue_work (kdelayd_wq, &dc->flush_expired_bios); +queue_work (dc->kdelayd_wq, &dc->flush_expired_bios); }static void queue_timeout (struct delay_c *dc,unsigned long expires)
@@ -191,6 +191,12 @@ out: goto bad_dev_write; } + dc->kdelayd_wq =alloc_workqueue ("kdelayd" ,WQ_MEM_RECLAIM ,0 ); +if (!dc->kdelayd_wq) { +DMERR ("Couldn't start kdelayd" ); + goto bad_queue; + } +setup_timer (&dc->delay_timer, handle_delayed_timer, (unsigned long )dc);INIT_WORK (&dc->flush_expired_bios, flush_expired_bios);
@@ -203,6 +209,8 @@ out: ti->private = dc;return 0 ; +bad_queue: +mempool_destroy (dc->delayed_pool); bad_dev_write:if (dc->dev_write)dm_put_device (ti, dc->dev_write);
@@ -217,7 +225,7 @@ static void delay_dtr(struct dm_target * {struct delay_c *dc = ti->private; -flush_workqueue (kdelayd_wq); +destroy_workqueue (dc->kdelayd_wq);dm_put_device (ti, dc->dev_read);
@@ -350,12 +358,6 @@ static int __init dm_delay_init(void) {int r = -ENOMEM ; - kdelayd_wq =alloc_workqueue ("kdelayd" ,WQ_MEM_RECLAIM ,0 ); -if (!kdelayd_wq) { -DMERR ("Couldn't start kdelayd" ); - goto bad_queue; - } - delayed_cache =KMEM_CACHE (dm_delay_info,0 );if (!delayed_cache) {DMERR ("Couldn't create delayed bio cache." );
@@ -373,8 +375,6 @@ static int __init dm_delay_init(void) bad_register:kmem_cache_destroy (delayed_cache); bad_memcache: -destroy_workqueue (kdelayd_wq); -bad_queue:return r; }
@@ -382,7 +382,6 @@ static void __exit dm_delay_exit(void) {dm_unregister_target (&delay_target);kmem_cache_destroy (delayed_cache); -destroy_workqueue (kdelayd_wq); }/* Module hooks */
Greg Kroah-Hartman
maintainerPATCH 62/78 dm space map metadata: return on failure in sm_metadata_new_block
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mike Snitzer <[email protected]>
commit f62b6b8f498658a9d537c7d380e9966f15e1b2a1 upstream.
Commit 2fc48021f4afdd109b9e52b6eef5db89ca80bac7 ("dm persistent
metadata: add space map threshold callback") introduced a regression to the metadata block allocation path that resulted in errors being ignored. This regression was uncovered by running the following device-mapper-test-suite test:
dmtest run --suite thin-provisioning -n /exhausting_metadata_space_causes_fail_mode/
The ignored error codes in sm_metadata_new_block() could crash the kernel through use of either the dm-thin or dm-cache targets, e.g.:
device-mapper: thin: 253:4: reached low water mark for metadata device: sending event.
device-mapper: space map metadata: unable to allocate new metadata block
general protection fault: 0000 [#1] SMP ... Workqueue: dm-thin do_worker [dm_thin_pool] task: ffff880035ce2ab0 ti: ffff88021a054000 task.ti: ffff88021a054000 RIP: 0010:[<ffffffffa0331385>] [<ffffffffa0331385>] metadata_ll_load_ie+0x15/0x30 [dm_persistent_data] RSP: 0018:ffff88021a055a68 EFLAGS: 00010202 RAX: 003fc8243d212ba0 RBX: ffff88021a780070 RCX: ffff88021a055a78 RDX: ffff88021a055a78 RSI: 0040402222a92a80 RDI: ffff88021a780070 RBP: ffff88021a055a68 R08: ffff88021a055ba4 R09: 0000000000000010 R10: 0000000000000000 R11: 00000002a02e1000 R12: ffff88021a055ad4 R13: 0000000000000598 R14: ffffffffa0338470 R15: ffff88021a055ba4 FS: 0000000000000000(0000) GS:ffff88033fca0000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b CR2: 00007f467c0291b8 CR3: 0000000001a0b000 CR4: 00000000000007e0 Stack: ffff88021a055ab8 ffffffffa0332020 ffff88021a055b30 0000000000000001 ffff88021a055b30 0000000000000000 ffff88021a055b18 0000000000000000 ffff88021a055ba4 ffff88021a055b98 ffff88021a055ae8 ffffffffa033304c Call Trace: [<ffffffffa0332020>] sm_ll_lookup_bitmap+0x40/0xa0 [dm_persistent_data] [<ffffffffa033304c>] sm_metadata_count_is_more_than_one+0x8c/0xc0 [dm_persistent_data] [<ffffffffa0333825>] dm_tm_shadow_block+0x65/0x110 [dm_persistent_data] [<ffffffffa0331b00>] sm_ll_mutate+0x80/0x300 [dm_persistent_data] [<ffffffffa0330e60>] ? set_ref_count+0x10/0x10 [dm_persistent_data] [<ffffffffa0331dba>] sm_ll_inc+0x1a/0x20 [dm_persistent_data] [<ffffffffa0332270>] sm_disk_new_block+0x60/0x80 [dm_persistent_data] [<ffffffff81520036>] ? down_write+0x16/0x40 [<ffffffffa001e5c4>] dm_pool_alloc_data_block+0x54/0x80 [dm_thin_pool] [<ffffffffa001b23c>] alloc_data_block+0x9c/0x130 [dm_thin_pool] [<ffffffffa001c27e>] provision_block+0x4e/0x180 [dm_thin_pool] [<ffffffffa001fe9a>] ? dm_thin_find_block+0x6a/0x110 [dm_thin_pool] [<ffffffffa001c57a>] process_bio+0x1ca/0x1f0 [dm_thin_pool] [<ffffffff8111e2ed>] ? mempool_free+0x8d/0xa0 [<ffffffffa001d755>] process_deferred_bios+0xc5/0x230 [dm_thin_pool] [<ffffffffa001d911>] do_worker+0x51/0x60 [dm_thin_pool] [<ffffffff81067872>] process_one_work+0x182/0x3b0 [<ffffffff81068c90>] worker_thread+0x120/0x3a0 [<ffffffff81068b70>] ? manage_workers+0x160/0x160 [<ffffffff8106eb2e>] kthread+0xce/0xe0 [<ffffffff8106ea60>] ? kthread_freezable_should_stop+0x70/0x70 [<ffffffff8152af6c>] ret_from_fork+0x7c/0xb0 [<ffffffff8106ea60>] ? kthread_freezable_should_stop+0x70/0x70 [<ffffffff8152af6c>] ret_from_fork+0x7c/0xb0 [<ffffffff8106ea60>] ? kthread_freezable_should_stop+0x70/0x70
--- drivers/md/persistent-data/dm-space-map-metadata.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/md/persistent-data/dm-space-map-metadata.c +6 -2
@@ -384,12 +384,16 @@ static int sm_metadata_new_block(struct struct sm_metadata *smm = container_of(sm, struct sm_metadata, sm);int r =sm_metadata_new_block_ (sm, b); -if (r) +if (r) {DMERR ("unable to allocate new metadata block" ); +return r; + } r =sm_metadata_get_nr_free (sm, &count); -if (r) +if (r) {DMERR ("couldn't get free block count" ); +return r; + }check_threshold (&smm->threshold, count);
Greg Kroah-Hartman
maintainerPATCH 63/78 dm table: fail dm_table_create on dm_round_up overflow
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit 5b2d06576c5410c10d95adfd5c4d8b24de861d87 upstream.
The dm_round_up function may overflow to zero. In this case, dm_table_create() must fail rather than go on to allocate an empty array with alloc_targets().
This fixes a possible memory corruption that could be caused by passing too large a number in "param->target_count".
--- drivers/md/dm-table.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/md/dm-table.c +5 -0
@@ -215,6 +215,11 @@ int dm_table_create(struct dm_table **re num_targets =dm_round_up (num_targets,KEYS_PER_NODE ); +if (!num_targets) { +kfree (t); +return -ENOMEM ; + } +if (alloc_targets (t, num_targets)) {kfree (t);return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 64/78 dm thin: switch to read only mode if a mapping insert fails
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit fafc7a815e40255d24e80a1cb7365892362fa398 upstream.
Switch the thin pool to read-only mode when dm_thin_insert_block() fails since there is little reason to expect the cause of the failure to be resolved without further action by user space.
This issue was noticed with the device-mapper-test-suite using:
dmtest run --suite thin-provisioning -n /exhausting_metadata_space_causes_fail_mode/
The quantity of errors logged in this case must be reduced.
before patch:
device-mapper: thin: dm_thin_insert_block() failed
device-mapper: space map metadata: unable to allocate new metadata block
device-mapper: thin: dm_thin_insert_block() failed
device-mapper: space map metadata: unable to allocate new metadata block
device-mapper: thin: dm_thin_insert_block() failed
device-mapper: space map metadata: unable to allocate new metadata block
device-mapper: thin: dm_thin_insert_block() failed
device-mapper: space map metadata: unable to allocate new metadata block
device-mapper: thin: dm_thin_insert_block() failed
device-mapper: space map metadata: unable to allocate new metadata block
device-mapper: thin: dm_thin_insert_block() failed
device-mapper: space map metadata: unable to allocate new metadata block
device-mapper: thin: dm_thin_insert_block() failed
device-mapper: space map metadata: unable to allocate new metadata block
device-mapper: thin: dm_thin_insert_block() failed
device-mapper: space map metadata: unable to allocate new metadata block
device-mapper: thin: dm_thin_insert_block() failed
device-mapper: space map metadata: unable to allocate new metadata block
device-mapper: thin: dm_thin_insert_block() failed
device-mapper: space map metadata: unable to allocate new metadata block
device-mapper: space map metadata: unable to allocate new metadata block
device-mapper: space map metadata: unable to allocate new metadata block
device-mapper: space map metadata: unable to allocate new metadata block
device-mapper: space map metadata: unable to allocate new metadata block
device-mapper: space map metadata: unable to allocate new metadata block <snip ... these repeat for a long while ... >
device-mapper: space map metadata: unable to allocate new metadata block
device-mapper: space map common: dm_tm_shadow_block() failed
device-mapper: thin: 253:4: no free metadata space available.
device-mapper: thin: 253:4: switching pool to read-only mode
after patch:
device-mapper: space map metadata: unable to allocate new metadata block
device-mapper: thin: 253:4: dm_thin_insert_block() failed: error = -28
device-mapper: thin: 253:4: switching pool to read-only mode
--- drivers/md/dm-thin.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/md/dm-thin.c +3 -1
@@ -640,7 +640,9 @@ static void process_prepared_mapping(str*/ r =dm_thin_insert_block (tc->td, m->virt_block, m->data_block);if (r) { -DMERR_LIMIT ("dm_thin_insert_block() failed" ); +DMERR_LIMIT ("%s: dm_thin_insert_block() failed: error = %d" , +dm_device_name (pool->pool_md), r); +set_pool_mode (pool,PM_READ_ONLY );cell_error (pool, m->cell); goto out; }
Greg Kroah-Hartman
maintainerPATCH 66/78 cxd2820r_core: fix sparse warnings
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans Verkuil <[email protected]>
commit 0db3fa2741ad8371c21b3a6785416a4afc0cc1d4 upstream.
drivers/media/dvb-frontends/cxd2820r_core.c:34:32: error: cannot size expression drivers/media/dvb-frontends/cxd2820r_core.c:68:32: error: cannot size expression
--- drivers/media/dvb-frontends/cxd2820r_core.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/dvb-frontends/cxd2820r_core.c +2 -2
@@ -34,7 +34,7 @@ static int cxd2820r_wr_regs_i2c(struct c { .addr = i2c, .flags = 0, - .len = sizeof(buf), + .len = len + 1, .buf = buf, } };
@@ -75,7 +75,7 @@ static int cxd2820r_rd_regs_i2c(struct c }, { .addr = i2c, .flags = I2C_M_RD, - .len = sizeof(buf), + .len = len, .buf = buf, } };
Greg Kroah-Hartman
maintainerPATCH 67/78 sched: Avoid throttle_cfs_rq() racing with period_timer stopping
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Segall <[email protected]>
commit f9f9ffc237dd924f048204e8799da74f9ecf40cf upstream.
throttle_cfs_rq() doesn't check to make sure that period_timer is running, and while update_curr/assign_cfs_runtime does, a concurrently running period_timer on another cpu could cancel itself between this cpu's update_curr and throttle_cfs_rq(). If there are no other cfs_rqs running in the tg to restart the timer, this causes the cfs_rq to be stranded forever.
Fix this by calling __start_cfs_bandwidth() in throttle if the timer is inactive.
(Also add some sched_debug lines for cfs_bandwidth.)
Tested: make a run/sleep task in a cgroup, loop switching the cgroup between 1ms/100ms quota and unlimited, checking for timer_active=0 and throttled=1 as a failure. With the throttle_cfs_rq() change commented out this fails, with the full patch it passes.
--- kernel/sched/debug.c | 8 ++++++++ kernel/sched/fair.c | 2 ++ 2 files changed, 10 insertions(+)
kernel/sched/debug.c +8 -0
@@ -224,6 +224,14 @@ void print_cfs_rq(struct seq_file *m, inSEQ_printf (m," .%-30s: %d\n" ,"tg->runnable_avg" ,atomic_read (&cfs_rq->tg->runnable_avg));#endif +#ifdef CONFIG_CFS_BANDWIDTH +SEQ_printf (m," .%-30s: %d\n" ,"tg->cfs_bandwidth.timer_active" , + cfs_rq->tg->cfs_bandwidth.timer_active); +SEQ_printf (m," .%-30s: %d\n" ,"throttled" , + cfs_rq->throttled); +SEQ_printf (m," .%-30s: %d\n" ,"throttle_count" , + cfs_rq->throttle_count); +#endif print_cfs_group_stats (m, cpu, cfs_rq->tg);#endif
kernel/sched/fair.c +2 -0
@@ -2288,6 +2288,8 @@ static void throttle_cfs_rq(struct cfs_r cfs_rq->throttled_clock = rq->clock;raw_spin_lock (&cfs_b->lock);list_add_tail_rcu (&cfs_rq->throttled_list, &cfs_b->throttled_cfs_rq); +if (!cfs_b->timer_active) +__start_cfs_bandwidth (cfs_b);raw_spin_unlock (&cfs_b->lock); }
Greg Kroah-Hartman
maintainerPATCH 68/78 staging: comedi: pcmuio: fix possible NULL deref on detach
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ian Abbott <[email protected]>
commit 2fd2bdfccae61efe18f6b92b6a45fbf936d75b48 upstream.
pcmuio_detach() is called by the comedi core even if pcmuio_attach() returned an error, so dev->private might be NULL. Check for that before dereferencing it.
Also, as pointed out by Dan Carpenter, there is no need to check the pointer passed to kfree() is non-NULL, so remove that check.
--- drivers/staging/comedi/drivers/pcmuio.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/staging/comedi/drivers/pcmuio.c +6 -5
@@ -935,12 +935,13 @@ static void pcmuio_detach(struct comedi_struct pcmuio_private *devpriv = dev->private;int i; -for (i =0 ; i <MAX_ASICS ; ++i) { -if (devpriv->asics[i].irq) -free_irq (devpriv->asics[i].irq, dev); - } -if (devpriv && devpriv->sprivs) +if (devpriv) { +for (i =0 ; i <MAX_ASICS ; ++i) { +if (devpriv->asics[i].irq) +free_irq (devpriv->asics[i].irq, dev); + }kfree (devpriv->sprivs); + }comedi_legacy_detach (dev); }
Greg Kroah-Hartman
maintainerPATCH 69/78 staging: comedi: drivers: use comedi_dio_update_state() for simple cases
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: H Hartley Sweeten <[email protected]>
commit 97f4289ad08cffe55de06d4ac4f89ac540450aee upstream.
[Split from original patch subject: "staging: comedi: drivers: use comedi_dio_update_state() for simple cases"]
Use comedi_dio_update_state() to handle the boilerplate code to update the subdevice s->state for simple cases where the hardware is updated when any channel is modified.
Also, fix a bug in the amplc_pc263 and amplc_pci263 drivers where the current state is not returned in data[1].
--- drivers/staging/comedi/drivers/amplc_pc263.c | 3 +++ drivers/staging/comedi/drivers/amplc_pci263.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/staging/comedi/drivers/amplc_pc263.c +3 -0
@@ -72,6 +72,9 @@ static int pc263_do_insn_bits(struct comoutb (s->state &0xFF , dev->iobase);outb (s->state >>8 , dev->iobase +1 ); } + + data[1 ] = s->state; +return insn->n; }
drivers/staging/comedi/drivers/amplc_pci263.c +3 -0
@@ -59,6 +59,9 @@ static int pci263_do_insn_bits(struct cooutb (s->state &0xFF , dev->iobase);outb (s->state >>8 , dev->iobase +1 ); } + + data[1 ] = s->state; +return insn->n; }
Greg Kroah-Hartman
maintainerPATCH 70/78 staging: comedi: ssv_dnp: use comedi_dio_update_state()
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: H Hartley Sweeten <[email protected]>
commit f6b316bcd8c421acd6fa5a6e18b4c846ecb9d965 upstream.
Use comedi_dio_update_state() to handle the boilerplate code to update the subdevice s->state.
Also, fix a bug where the state of the channels is returned in data[0]. The comedi core expects it to be returned in data[1].
--- drivers/staging/comedi/drivers/ssv_dnp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/staging/comedi/drivers/ssv_dnp.c +3 -3
@@ -87,11 +87,11 @@ static int dnp_dio_insn_bits(struct come/* on return, data[1] contains the value of the digital input lines. */ outb (PADR ,CSCIR ); - data[0 ] =inb (CSCDR ); + data[1 ] =inb (CSCDR );outb (PBDR ,CSCIR ); - data[0 ] +=inb (CSCDR ) <<8 ; + data[1 ] +=inb (CSCDR ) <<8 ;outb (PCDR ,CSCIR ); - data[0 ] += ((inb (CSCDR ) &0xF0 ) <<12 ); + data[1 ] += ((inb (CSCDR ) &0xF0 ) <<12 );return insn->n;
Greg Kroah-Hartman
maintainerPATCH 71/78 sc1200_wdt: Fix oops
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan <[email protected]>
commit dace8bbfccfd9e4fcccfffcfbd82881fda3e756f upstream.
If loaded with isapnp = 0 the driver explodes. This is catching people out now and then. What should happen in the working case is a complete mystery and the code appears terminally confused, but we can at least make the error path work properly.
Partially-Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=53991
--- drivers/watchdog/sc1200wdt.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/watchdog/sc1200wdt.c +2 -1
@@ -409,8 +409,9 @@ static int __init sc1200wdt_init(void)#if definedCONFIG_PNP /* now that the user has specified an IO port and we haven't detected * any devices, disable pnp support */ +if (isapnp) +pnp_unregister_driver (&scl200wdt_pnp_driver); isapnp =0 ; -pnp_unregister_driver (&scl200wdt_pnp_driver);#endif if (!request_region (io, io_len,SC1200_MODULE_NAME )) {
Greg Kroah-Hartman
maintainerPATCH 72/78 NFSv4 wait on recovery for async session errors
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andy Adamson <[email protected]>
commit 4a82fd7c4e78a1b7a224f9ae8bb7e1fd95f670e0 upstream.
When the state manager is processing the NFS4CLNT_DELEGRETURN flag, session draining is off, but DELEGRETURN can still get a session error. The async handler calls nfs4_schedule_session_recovery returns -EAGAIN, and the DELEGRETURN done then restarts the RPC task in the prepare state. With the state manager still processing the NFS4CLNT_DELEGRETURN flag with session draining off, these DELEGRETURNs will cycle with errors filling up the session slots.
This prevents OPEN reclaims (from nfs_delegation_claim_opens) required by the NFS4CLNT_DELEGRETURN state manager processing from completing, hanging the state manager in the __rpc_wait_for_completion_task in nfs4_run_open_task as seen in this kernel thread dump:
kernel: 4.12.32.53-ma D 0000000000000000 0 3393 2 0x00000000
kernel: ffff88013995fb60 0000000000000046 ffff880138cc5400 ffff88013a9df140
kernel: ffff8800000265c0 ffffffff8116eef0 ffff88013fc10080 0000000300000001
kernel: ffff88013a4ad058 ffff88013995ffd8 000000000000fbc8 ffff88013a4ad058
kernel: Call Trace:
kernel: [<ffffffff8116eef0>] ? cache_alloc_refill+0x1c0/0x240
kernel: [<ffffffffa0358110>] ? rpc_wait_bit_killable+0x0/0xa0 [sunrpc]
kernel: [<ffffffffa0358152>] rpc_wait_bit_killable+0x42/0xa0 [sunrpc]
kernel: [<ffffffff8152914f>] __wait_on_bit+0x5f/0x90
kernel: [<ffffffffa0358110>] ? rpc_wait_bit_killable+0x0/0xa0 [sunrpc]
kernel: [<ffffffff815291f8>] out_of_line_wait_on_bit+0x78/0x90
kernel: [<ffffffff8109b520>] ? wake_bit_function+0x0/0x50
kernel: [<ffffffffa035810d>] __rpc_wait_for_completion_task+0x2d/0x30 [sunrpc]
kernel: [<ffffffffa040d44c>] nfs4_run_open_task+0x11c/0x160 [nfs]
kernel: [<ffffffffa04114e7>] nfs4_open_recover_helper+0x87/0x120 [nfs]
kernel: [<ffffffffa0411646>] nfs4_open_recover+0xc6/0x150 [nfs]
kernel: [<ffffffffa040cc6f>] ? nfs4_open_recoverdata_alloc+0x2f/0x60 [nfs]
kernel: [<ffffffffa0414e1a>] nfs4_open_delegation_recall+0x6a/0xa0 [nfs]
kernel: [<ffffffffa0424020>] nfs_end_delegation_return+0x120/0x2e0 [nfs]
kernel: [<ffffffff8109580f>] ? queue_work+0x1f/0x30
kernel: [<ffffffffa0424347>] nfs_client_return_marked_delegations+0xd7/0x110 [nfs]
kernel: [<ffffffffa04225d8>] nfs4_run_state_manager+0x548/0x620 [nfs]
kernel: [<ffffffffa0422090>] ? nfs4_run_state_manager+0x0/0x620 [nfs]
kernel: [<ffffffff8109b0f6>] kthread+0x96/0xa0
kernel: [<ffffffff8100c20a>] child_rip+0xa/0x20
kernel: [<ffffffff8109b060>] ? kthread+0x0/0xa0
kernel: [<ffffffff8100c200>] ? child_rip+0x0/0x20
The state manager can not therefore process the DELEGRETURN session errors. Change the async handler to wait for recovery on session errors.
--- fs/nfs/nfs4proc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
fs/nfs/nfs4proc.c +1 -2
@@ -4222,8 +4222,7 @@ nfs4_async_handle_error(struct rpc_taskdprintk ("%s ERROR %d, Reset session\n" , __func__, task->tk_status);nfs4_schedule_session_recovery (clp->cl_session, task->tk_status); - task->tk_status =0 ; -return -EAGAIN ; + goto wait_on_recovery;#endif /* CONFIG_NFS_V4_1 */ case -NFS4ERR_DELAY :nfs_inc_server_stats (server,NFSIOS_DELAY );
Greg Kroah-Hartman
maintainerPATCH 73/78 ip6tnl: fix use after free of fb_tnl_dev
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
The upstream commit bb8140947a24 ("ip6tnl: allow to use rtnl ops on fb tunnel") (backported into linux-3.10.y) left a bug which was fixed upstream by commit 1e9f3d6f1c40 ("ip6tnl: fix use after free of fb_tnl_dev").
The problem is a bit different in linux-3.10.y, because there is no x-netns support (upstream commit 0bd8762824e7 ("ip6tnl: add x-netns support")). When ip6_tunnel.ko is unloaded, FB device is deleted by rtnl_link_unregister() and then we try to delete it again in ip6_tnl_destroy_tunnels().
This patch removes the second deletion.
--- net/ipv6/ip6_tunnel.c | 2 -- 1 file changed, 2 deletions(-)
net/ipv6/ip6_tunnel.c +0 -2
@@ -1711,8 +1711,6 @@ static void __net_exit ip6_tnl_destroy_t } } - t =rtnl_dereference (ip6n->tnls_wc[0 ]); -unregister_netdevice_queue (t->dev, &list);unregister_netdevice_many (&list); }
Greg Kroah-Hartman
maintainerPATCH 74/78 Revert "net: update consumers of MSG_MORE to recognize MSG_SENDPAGE_NOTLAST"
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
It turns out that commit: d3f7d56a7a4671d395e8af87071068a195257bf6 was applied to the tree twice, which didn't hurt anything, but it's good to fix this up.
--- crypto/algif_hash.c | 3 --- crypto/algif_skcipher.c | 3 --- net/ipv4/udp.c | 3 --- 3 files changed, 9 deletions(-)
crypto/algif_hash.c +0 -3
@@ -117,9 +117,6 @@ static ssize_t hash_sendpage(struct sockif (flags &MSG_SENDPAGE_NOTLAST ) flags |=MSG_MORE ; -if (flags &MSG_SENDPAGE_NOTLAST ) - flags |=MSG_MORE ; -lock_sock (sk);sg_init_table (ctx->sgl.sg,1 );sg_set_page (ctx->sgl.sg, page, size, offset);
crypto/algif_skcipher.c +0 -3
@@ -381,9 +381,6 @@ static ssize_t skcipher_sendpage(structif (flags &MSG_SENDPAGE_NOTLAST ) flags |=MSG_MORE ; -if (flags &MSG_SENDPAGE_NOTLAST ) - flags |=MSG_MORE ; -lock_sock (sk);if (!ctx->more && ctx->used) goto unlock;
net/ipv4/udp.c +0 -3
@@ -1073,9 +1073,6 @@ int udp_sendpage(struct sock *sk, structif (flags &MSG_SENDPAGE_NOTLAST ) flags |=MSG_MORE ; -if (flags &MSG_SENDPAGE_NOTLAST ) - flags |=MSG_MORE ; -if (!up->pending) {struct msghdr msg = { .msg_flags = flags|MSG_MORE };
Greg Kroah-Hartman
maintainerPATCH 75/78 Btrfs: fix memory leak of chunks extent map
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
commit 7d3d1744f8a7d62e4875bd69cc2192a939813880 upstream.
As we're hold a ref on looking up the extent map, we need to drop the ref before returning to callers.
--- fs/btrfs/volumes.c | 2 ++ 1 file changed, 2 insertions(+)
fs/btrfs/volumes.c +2 -0
@@ -4248,6 +4248,7 @@ int btrfs_num_copies(struct btrfs_fs_infbtrfs_emerg (fs_info,"Invalid mapping for %Lu-%Lu, got " "%Lu-%Lu\n" , logical, logical+len, em->start, em->start + em->len); +free_extent_map (em);return 1 ; }
@@ -4429,6 +4430,7 @@ static int __btrfs_map_block(struct btrfbtrfs_crit (fs_info,"found a bad mapping, wanted %Lu, " "found %Lu-%Lu\n" , logical, em->start, em->start + em->len); +free_extent_map (em);return -EINVAL ; }
Greg Kroah-Hartman
maintainerPATCH 76/78 Btrfs: fix hole check in log_one_extent
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josef Bacik <[email protected]>
commit ed9e8af88e2551aaa6bf51d8063a2493e2d71597 upstream.
I added an assert to make sure we were looking up aligned offsets for csums and I tripped it when running xfstests. This is because log_one_extent was checking if block_start == 0 for a hole instead of EXTENT_MAP_HOLE. This worked out fine in practice it seems, but it adds a lot of extra work that is uneeded. With this fix I'm no longer tripping my assert. Thanks,
--- fs/btrfs/tree-log.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/tree-log.c +1 -1
@@ -3314,7 +3314,7 @@ static int log_one_extent(struct btrfs_tbtrfs_set_token_file_extent_type (leaf, fi,BTRFS_FILE_EXTENT_REG , &token); -if (em->block_start ==0 ) +if (em->block_start ==EXTENT_MAP_HOLE ) skip_csum = true; }
Greg Kroah-Hartman
maintainerPATCH 77/78 Btrfs: fix incorrect inode acl reset
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Filipe David Borba Manana <[email protected]>
commit 8185554d3eb09d23a805456b6fa98dcbb34aa518 upstream.
When a directory has a default ACL and a subdirectory is created under that directory, btrfs_init_acl() is called when the subdirectory's inode is created to initialize the inode's ACL (inherited from the parent directory) but it was clearing the ACL from the inode after setting it if posix_acl_create() returned success, instead of clearing it only if it returned an error.
To reproduce this issue:
$ mkfs.btrfs -f /dev/loop0 $ mount /dev/loop0 /mnt $ mkdir /mnt/acl $ setfacl -d --set u::rwx,g::rwx,o::- /mnt/acl $ getfacl /mnt/acl user::rwx group::rwx other::r-x default:user::rwx default:group::rwx default:other::---
$ mkdir /mnt/acl/dir1 $ getfacl /mnt/acl/dir1 user::rwx group::rwx other::---
After unmounting and mounting again the filesystem, fgetacl returned the expected ACL:
$ umount /mnt/acl $ mount /dev/loop0 /mnt $ getfacl /mnt/acl/dir1 user::rwx group::rwx other::--- default:user::rwx default:group::rwx default:other::---
Meaning that the underlying xattr was persisted.
--- fs/btrfs/acl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/btrfs/acl.c +1 -1
@@ -229,7 +229,7 @@ int btrfs_init_acl(struct btrfs_trans_haif (ret >0 ) {/* we need an acl */ ret =btrfs_set_acl (trans, inode, acl,ACL_TYPE_ACCESS ); - }else { + }else if (ret <0 ) {cache_no_acl (inode); } }else {
Greg Kroah-Hartman
maintainerPATCH 78/78 Btrfs: do not run snapshot-aware defragment on error
In reply to Greg Kroah-Hartman3.10-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liu Bo <[email protected]>
commit 6f519564d7d978c00351d9ab6abac3deeac31621 upstream.
If something wrong happens in write endio, running snapshot-aware defragment can end up with undefined results, maybe a crash, so we should avoid it.
In order to share similar code, this also adds a helper to free the struct for snapshot-aware defrag.
--- fs/btrfs/inode.c | 47 ++++++++++++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 19 deletions(-)
fs/btrfs/inode.c +28 -19
@@ -2419,10 +2419,23 @@ out_unlock:return ret; } +static void free_sa_defrag_extent (struct new_sa_defrag_extent *new) +{ +struct old_sa_defrag_extent *old, *tmp; + +if (!new) +return ; + +list_for_each_entry_safe (old, tmp, &new->head, list) { +list_del (&old->list); +kfree (old); + } +kfree (new); +} +static void relink_file_extents (struct new_sa_defrag_extent *new) {struct btrfs_path *path; -struct old_sa_defrag_extent *old, *tmp;struct sa_defrag_extent_backref *backref;struct sa_defrag_extent_backref *prev =NULL ;struct inode *inode;
@@ -2465,16 +2478,11 @@ static void relink_file_extents(struct nkfree (prev);btrfs_free_path (path); - -list_for_each_entry_safe (old, tmp, &new->head, list) { -list_del (&old->list); -kfree (old); - } out: +free_sa_defrag_extent (new); +atomic_dec (&root->fs_info->defrag_running);wake_up (&root->fs_info->transaction_wait); - -kfree (new); } static struct new_sa_defrag_extent *
@@ -2484,7 +2492,7 @@ record_old_file_extents(struct inode *instruct btrfs_root *root =BTRFS_I (inode)->root;struct btrfs_path *path;struct btrfs_key key; -struct old_sa_defrag_extent *old, *tmp; +struct old_sa_defrag_extent *old;struct new_sa_defrag_extent *new;int ret;
@@ -2532,7 +2540,7 @@ record_old_file_extents(struct inode *inif (slot >=btrfs_header_nritems (l)) { ret =btrfs_next_leaf (root, path);if (ret <0 ) - goto out_free_list; + goto out_free_path;else if (ret >0 )break ;continue ;
@@ -2561,7 +2569,7 @@ record_old_file_extents(struct inode *in old =kmalloc (sizeof (*old),GFP_NOFS );if (!old) - goto out_free_list; + goto out_free_path; offset =max (new->file_pos, key.offset); end =min (new->file_pos + new->len, key.offset + num_bytes);
@@ -2583,15 +2591,10 @@ next:return new; -out_free_list: -list_for_each_entry_safe (old, tmp, &new->head, list) { -list_del (&old->list); -kfree (old); - } out_free_path:btrfs_free_path (path); out_kfree: -kfree (new); +free_sa_defrag_extent (new);return NULL ; }
@@ -2743,8 +2746,14 @@ out:btrfs_remove_ordered_extent (inode, ordered_extent);/* for snapshot-aware defrag */ -if (new) -relink_file_extents (new); +if (new) { +if (ret) { +free_sa_defrag_extent (new); +atomic_dec (&root->fs_info->defrag_running); + }else { +relink_file_extents (new); + } + }/* once for us */ btrfs_put_ordered_extent (ordered_extent);
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.25 release. There are 78 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 me know.
Responses should be made by Fri Dec 20 21:10:56 UTC 2013. Anything received after that time might be too late.
Build results:
total: 110 pass: 109 skipped: 0 fail: 1
Build avr32:atngw100mkii_evklcd101_defconfig still fails.
qemu tests all passed.
Results are as expected.
Details are available as usual at http://server.roeck-us.net:8010/builders.
Guenter
Greg Kroah-Hartman
maintainerQuoted 11 lines · Guenter Roeck
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.25 release. There are 78 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 me know.
Responses should be made by Fri Dec 20 21:10:56 UTC 2013. Anything received after that time might be too late.
Build results:
Quoted 8 lines
total: 110 pass: 109 skipped: 0 fail: 1Build avr32:atngw100mkii_evklcd101_defconfig still fails.
qemu tests all passed.
Results are as expected.
Details are available as usual at http://server.roeck-us.net:8010/builders.
Thanks for testing and letting me know.
greg k-h
Quoted 8 lines · Greg Kroah-Hartman
This is the start of the stable review cycle for the 3.10.25 release. There are 78 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 me know.
Responses should be made by Fri Dec 20 21:10:56 UTC 2013. Anything received after that time might be too late.
Quoted 8 lines
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.10.25-rc1.gzand the diffstat can be found below.
thanks,
greg k-h
Patch applied cleanly
Compile testing - passed
Boot testing - passed
dmesg regression testing - passed
dmesgs look good. No regressions compared to the previous dmesgs for this release. dmesg emerg, crit, alert, err are clean. No regressions in warn.
Test systems
Samsung Series 9 900X4C Intel Corei5 (3.4 and later) HP ProBook 6475b AMD A10-4600M APU with Radeon(tm) HD Graphics Dell OptiPlex 790 Intel(R) Core(TM) i5-2400
-- Shuah
Signature · 4 lines
Shuah Khan Senior Linux Kernel Developer - Open Source Group Samsung Research America(Silicon Valley) [email protected] | (970) 672-0658