3.2.3-stable review
Subsystems (54)
Greg KH
maintainercover 3.2.3-stable review
This is the start of the stable review cycle for the 3.2.3 release. There are 89 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by Friday, February 3, 2012, 20:00:00 UTC Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v3.0/stable-review/patch-3.2.3-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
Makefile | 4 +- arch/arm/mach-at91/setup.c | 7 +- arch/arm/mach-ux500/Kconfig | 1 + arch/arm/mach-ux500/board-mop500-sdi.c | 2 + arch/arm/mm/proc-v7.S | 6 - arch/m68k/atari/config.c | 8 +- arch/m68k/kernel/process_mm.c | 4 +- arch/m68k/kernel/process_no.c | 4 +- arch/m68k/kernel/traps.c | 36 ++++---- arch/m68k/mm/cache.c | 6 +- arch/x86/include/asm/uv/uv_hub.h | 4 +- arch/x86/kernel/microcode_amd.c | 24 +++++- arch/x86/net/bpf_jit_comp.c | 36 +++++--- arch/x86/platform/uv/tlb_uv.c | 2 + arch/x86/platform/uv/uv_irq.c | 2 +- arch/x86/xen/spinlock.c | 27 +++++- crypto/sha512_generic.c | 62 +++++++------ drivers/char/tpm/tpm_tis.c | 3 + drivers/gpu/drm/drm_auth.c | 6 +- drivers/gpu/drm/drm_fops.c | 5 + drivers/gpu/drm/i915/i915_suspend.c | 4 +- drivers/gpu/drm/i915/intel_ringbuffer.c | 27 +++++- drivers/gpu/drm/i915/intel_sdvo.c | 8 +- drivers/gpu/drm/radeon/atombios_dp.c | 22 ++--- drivers/gpu/drm/radeon/atombios_encoders.c | 26 ++++- drivers/gpu/drm/radeon/radeon_irq_kms.c | 6 + drivers/gpu/drm/radeon/radeon_mode.h | 3 + drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 2 +- drivers/hwmon/f71805f.c | 10 +- drivers/hwmon/sht15.c | 3 +- drivers/hwmon/w83627ehf.c | 6 + drivers/net/bonding/bond_alb.c | 27 ++---- drivers/net/macvlan.c | 1 + drivers/net/wireless/brcm80211/brcmsmac/main.c | 10 ++- drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 4 +- drivers/scsi/mpt2sas/mpt2sas_base.c | 20 ++--- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 3 +- drivers/tty/serial/amba-pl011.c | 14 +++ drivers/tty/serial/jsm/jsm_driver.c | 1 + drivers/tty/tty_port.c | 12 ++- drivers/usb/class/cdc-wdm.c | 59 ++++++++---- drivers/usb/dwc3/ep0.c | 14 +-- drivers/usb/gadget/langwell_udc.c | 18 ++-- drivers/usb/gadget/storage_common.c | 6 +- drivers/usb/host/ehci-fsl.c | 2 +- drivers/usb/host/xhci-ring.c | 6 +- drivers/usb/misc/usbsevseg.c | 2 +- drivers/usb/musb/davinci.c | 3 - drivers/usb/serial/cp210x.c | 107 +++++++++++++++------- drivers/usb/serial/ftdi_sio.c | 14 ++- drivers/usb/serial/ftdi_sio_ids.h | 19 ++++ drivers/usb/serial/io_ti.c | 10 +-- drivers/usb/serial/option.c | 5 + drivers/usb/serial/qcaux.c | 7 +- drivers/usb/storage/realtek_cr.c | 2 +- fs/ecryptfs/crypto.c | 49 +--------- fs/ecryptfs/inode.c | 48 +++++++--- fs/ecryptfs/miscdev.c | 56 ++++++++---- fs/ecryptfs/read_write.c | 19 +++- fs/jbd/checkpoint.c | 27 +++++- fs/jbd/recovery.c | 4 + fs/sysfs/file.c | 6 + fs/sysfs/inode.c | 5 +- fs/xfs/xfs_vnodeops.c | 3 +- include/drm/drmP.h | 1 + include/net/netns/generic.h | 1 + net/caif/caif_dev.c | 11 +-- net/caif/cfcnfg.c | 1 - net/core/net-sysfs.c | 6 +- net/core/net_namespace.c | 31 +++--- net/core/netpoll.c | 2 +- net/decnet/dn_dev.c | 4 +- net/ipv4/devinet.c | 2 +- net/ipv4/fib_trie.c | 10 +- net/ipv4/igmp.c | 8 +- net/ipv4/ipip.c | 8 +- net/ipv4/ipmr.c | 2 +- net/ipv4/tcp_ipv4.c | 2 +- net/ipv4/tcp_output.c | 6 +- net/ipv6/addrconf.c | 2 +- net/ipv6/ip6_tunnel.c | 8 +- net/ipv6/raw.c | 2 +- net/ipv6/sit.c | 10 +- net/ipv6/tcp_ipv6.c | 2 +- net/l2tp/l2tp_ip.c | 5 - net/mac80211/agg-rx.c | 2 +- net/mac80211/cfg.c | 4 +- net/mac80211/ibss.c | 2 +- net/mac80211/mlme.c | 38 ++++++-- net/mac80211/sta_info.c | 6 +- net/netfilter/nf_conntrack_core.c | 2 +- net/netfilter/nf_conntrack_ecache.c | 4 +- net/netfilter/nf_conntrack_extend.c | 2 +- net/netfilter/nf_conntrack_helper.c | 2 +- net/netfilter/nf_conntrack_netlink.c | 2 +- net/netfilter/nf_log.c | 6 +- net/netfilter/nf_queue.c | 2 +- net/netfilter/nfnetlink.c | 4 +- net/netlabel/netlabel_domainhash.c | 4 +- net/netlabel/netlabel_unlabeled.c | 6 +- net/phonet/af_phonet.c | 2 +- net/phonet/pn_dev.c | 2 +- net/phonet/socket.c | 2 +- net/rds/af_rds.c | 20 ++--- net/socket.c | 2 +- net/sunrpc/auth_gss/auth_gss.c | 2 +- net/unix/af_unix.c | 19 +--- net/xfrm/xfrm_user.c | 2 +- sound/pci/hda/hda_intel.c | 6 +- sound/pci/hda/patch_realtek.c | 11 ++ sound/pci/hda/patch_sigmatel.c | 17 +++- sound/soc/codecs/wm5100.c | 3 + sound/soc/codecs/wm8996.c | 7 +- sound/soc/codecs/wm8996.h | 4 + 114 files changed, 767 insertions(+), 491 deletions(-)
Greg KH
maintainerPATCH 1/89 ALSA: hda - Fix buffer-alignment regression with Nvidia HDMI
3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 52409aa6a0e96337da137c069856298f4dd825a0 upstream.
The commit 2ae66c26550cd94b0e2606a9275eb0ab7070ad0e
ALSA: hda: option to enable arbitrary buffer/period sizes
introduced a regression on machines with Intel controller and Nvidia HDMI. The reason is that the driver modifies the global variable align_buffer_size when an Intel controller is found, and the Nvidia HDMI controller is probed after Intel although Nvidia chips require the aligned buffers.
This patch fixes the problem by moving the flag into the local struct so that it's not affected by other controllers.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=42567
--- sound/pci/hda/hda_intel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
sound/pci/hda/hda_intel.c +4 -2
@@ -461,6 +461,7 @@ struct azx { unsigned int irq_pending_warned :1; unsigned int probing :1; /* codec probing phase */ unsigned int snoop:1; + unsigned int align_buffer_size:1;/* for debugging */ unsigned int last_cmd[AZX_MAX_CODECS ];
@@ -1697,7 +1698,7 @@ static int azx_pcm_open(struct snd_pcm_s runtime->hw.rates = hinfo->rates;snd_pcm_limit_hw_rates (runtime);snd_pcm_hw_constraint_integer (runtime,SNDRV_PCM_HW_PARAM_PERIODS ); -if (align_buffer_size) +if (chip->align_buffer_size)/* constrain buffer sizes to be multiple of 128 bytes. This is more efficient in terms of memory access but isn't required by the HDA spec and
@@ -2753,8 +2754,9 @@ static int __devinit azx_create(struct s }/* disable buffer size rounding to 128-byte multiples if supported */ + chip->align_buffer_size = align_buffer_size;if (chip->driver_caps &AZX_DCAPS_BUFSIZE ) - align_buffer_size =0 ; + chip->align_buffer_size =0 ;/* allow 64bit DMA address if supported by H/W */ if ((gcap &ICH6_GCAP_64OK ) && !pci_set_dma_mask (pci,DMA_BIT_MASK (64 )))
Greg KH
maintainerPATCH 2/89 ALSA: hda - Fix silent outputs from docking-station jacks of Dell laptops
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit b4ead019afc201f71c39cd0dfcaafed4a97b3dd2 upstream.
The recent change of the power-widget handling for IDT codecs caused the silent output from the docking-station line-out jack. This was partially fixed by the commit f2cbba7602383cd9cdd21f0a5d0b8bd1aad47b33 "ALSA: hda - Fix the lost power-setup of seconary pins after PM resume". But the line-out on the docking-station is still silent when booted with the jack plugged even by this fix.
The remainig bug is that the power-widget is set off in stac92xx_init() because the pins in cfg->line_out_pins[] aren't checked there properly but only hp_pins[] are checked in is_nid_hp_pin().
This patch fixes the problem by checking both HP and line-out pins and leaving the power-map correctly.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=42637
--- sound/pci/hda/patch_sigmatel.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
sound/pci/hda/patch_sigmatel.c +5 -3
@@ -4253,13 +4253,15 @@ static int enable_pin_detect(struct hda_return 1 ; } -static int is_nid_hp_pin (struct auto_pin_cfg *cfg,hda_nid_t nid) +static int is_nid_out_jack_pin (struct auto_pin_cfg *cfg,hda_nid_t nid) {int i;for (i =0 ; i < cfg->hp_outs; i++)if (cfg->hp_pins[i] == nid)return 1 ;/* nid is a HP-Out */ - +for (i =0 ; i < cfg->line_outs; i++) +if (cfg->line_out_pins[i] == nid) +return 1 ;/* nid is a line-Out */ return 0 ;/* nid is not a HP-Out */ };
@@ -4465,7 +4467,7 @@ static int stac92xx_init(struct hda_codecontinue ; } -if (is_nid_hp_pin (cfg, nid)) +if (is_nid_out_jack_pin (cfg, nid))continue ;/* already has an unsol event */ pinctl = snd_hda_codec_read(codec, nid, 0,
Greg KH
maintainerPATCH 3/89 eCryptfs: Sanitize write counts of /dev/ecryptfs
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyler Hicks <[email protected]>
commit db10e556518eb9d21ee92ff944530d84349684f4 upstream.
A malicious count value specified when writing to /dev/ecryptfs may result in a a very large kernel memory allocation.
This patch peeks at the specified packet payload size, adds that to the size of the packet headers and compares the result with the write count value. The resulting maximum memory allocation size is approximately 532 bytes.
--- fs/ecryptfs/miscdev.c | 56 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 38 insertions(+), 18 deletions(-)
fs/ecryptfs/miscdev.c +38 -18
@@ -409,11 +409,47 @@ ecryptfs_miscdev_write(struct file *filessize_t sz =0 ;char *data;uid_t euid =current_euid (); +unsigned char packet_size_peek[3 ];int rc; -if (count ==0 ) +if (count ==0 ) { goto out; + }else if (count == (1 +4 )) { +/* Likely a harmless MSG_HELO or MSG_QUIT - no packet length */ + goto memdup; + }else if (count < (1 +4 +1 ) + || count > (1 +4 +2 +sizeof (struct ecryptfs_message ) +4 + +ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES )) { +printk (KERN_WARNING "%s: Acceptable packet size range is " +"[%d-%lu], but amount of data written is [%zu]." , + __func__, (1 +4 +1 ), + (1 +4 +2 +sizeof (struct ecryptfs_message ) +4 + +ECRYPTFS_MAX_ENCRYPTED_KEY_BYTES ), count); +return -EINVAL ; + } + +if (copy_from_user (packet_size_peek, (buf +1 +4 ), +sizeof (packet_size_peek))) { +printk (KERN_WARNING "%s: Error while inspecting packet size\n" , + __func__); +return -EFAULT ; + } + rc =ecryptfs_parse_packet_length (packet_size_peek, &packet_size, + &packet_size_length); +if (rc) { +printk (KERN_WARNING "%s: Error parsing packet length; " +"rc = [%d]\n" , __func__, rc); +return rc; + } + +if ((1 +4 + packet_size_length + packet_size) != count) { +printk (KERN_WARNING "%s: Invalid packet size [%zu]\n" , __func__, + packet_size); +return -EINVAL ; + } + +memdup: data =memdup_user (buf, count);if (IS_ERR (data)) { printk(KERN_ERR "%s: memdup_user returned error [%ld]\n",
@@ -435,23 +471,7 @@ ecryptfs_miscdev_write(struct file *file }memcpy (&counter_nbo, &data[i],4 ); seq =be32_to_cpu (counter_nbo); - i +=4 ; - rc =ecryptfs_parse_packet_length (&data[i], &packet_size, - &packet_size_length); -if (rc) { -printk (KERN_WARNING "%s: Error parsing packet length; " -"rc = [%d]\n" , __func__, rc); - goto out_free; - } - i += packet_size_length; -if ((1 +4 + packet_size_length + packet_size) != count) { -printk (KERN_WARNING "%s: (1 + packet_size_length([%zd])" -" + packet_size([%zd]))([%zd]) != " -"count([%zd]). Invalid packet format.\n" , - __func__, packet_size_length, packet_size, - (1 + packet_size_length + packet_size), count); - goto out_free; - } + i +=4 + packet_size_length; rc =ecryptfs_miscdev_response (&data[i], packet_size, euid,current_user_ns (),task_pid (current), seq);
Greg KH
maintainerPATCH 4/89 ecryptfs: Improve metadata read failure logging
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tim Gardner <[email protected]>
commit 30373dc0c87ffef68d5628e77d56ffb1fa22e1ee upstream.
Print inode on metadata read failure. The only real way of dealing with metadata read failures is to delete the underlying file system file. Having the inode allows one to 'find . -inum INODE`.
--- fs/ecryptfs/crypto.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
fs/ecryptfs/crypto.c +6 -3
@@ -1620,7 +1620,8 @@ int ecryptfs_read_metadata(struct dentry rc =ecryptfs_read_xattr_region (page_virt, ecryptfs_inode);if (rc) {printk (KERN_DEBUG "Valid eCryptfs headers not found in " -"file header region or xattr region\n" ); +"file header region or xattr region, inode %lu\n" , + ecryptfs_inode->i_ino); rc = -EINVAL ; goto out; }
@@ -1629,7 +1630,8 @@ int ecryptfs_read_metadata(struct dentry ECRYPTFS_DONT_VALIDATE_HEADER_SIZE);if (rc) {printk (KERN_DEBUG "Valid eCryptfs headers not found in " -"file xattr region either\n" ); +"file xattr region either, inode %lu\n" , + ecryptfs_inode->i_ino); rc = -EINVAL ; } if (crypt_stat->mount_crypt_stat->flags
@@ -1640,7 +1642,8 @@ int ecryptfs_read_metadata(struct dentry"crypto metadata only in the extended attribute " "region, but eCryptfs was mounted without " "xattr support enabled. eCryptfs will not treat " - "this like an encrypted file.\n"); +"this like an encrypted file, inode %lu\n" , + ecryptfs_inode->i_ino); rc = -EINVAL ; } }
Greg KH
maintainerPATCH 5/89 eCryptfs: Make truncate path killable
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyler Hicks <[email protected]>
commit 5e6f0d769017cc49207ef56996e42363ec26c1f0 upstream.
ecryptfs_write() handles the truncation of eCryptfs inodes. It grabs a page, zeroes out the appropriate portions, and then encrypts the page before writing it to the lower filesystem. It was unkillable and due to the lack of sparse file support could result in tying up a large portion of system resources, while encrypting pages of zeros, with no way for the truncate operation to be stopped from userspace.
This patch adds the ability for ecryptfs_write() to detect a pending fatal signal and return as gracefully as possible. The intent is to leave the lower file in a useable state, while still allowing a user to break out of the encryption loop. If a pending fatal signal is detected, the eCryptfs inode size is updated to reflect the modified inode size and then -EINTR is returned.
--- fs/ecryptfs/read_write.c | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
fs/ecryptfs/read_write.c +14 -5
@@ -132,6 +132,11 @@ int ecryptfs_write(struct inode *ecryptfsize_t num_bytes = (PAGE_CACHE_SIZE - start_offset_in_page);size_t total_remaining_bytes = ((offset + size) - pos); +if (fatal_signal_pending (current)) { + rc = -EINTR ; +break ; + } +if (num_bytes > total_remaining_bytes) num_bytes = total_remaining_bytes;if (pos < offset) {
@@ -193,15 +198,19 @@ int ecryptfs_write(struct inode *ecryptf } pos += num_bytes; } -if ((offset + size) > ecryptfs_file_size) { -i_size_write (ecryptfs_inode, (offset + size)); +if (pos > ecryptfs_file_size) { +i_size_write (ecryptfs_inode, pos);if (crypt_stat->flags &ECRYPTFS_ENCRYPTED ) { - rc =ecryptfs_write_inode_size_to_metadata ( +int rc2; + + rc2 =ecryptfs_write_inode_size_to_metadata ( ecryptfs_inode); -if (rc) { +if (rc2) {printk (KERN_ERR "Problem with " "ecryptfs_write_inode_size_to_metadata; " -"rc = [%d]\n" , rc); +"rc = [%d]\n" , rc2); +if (!rc) + rc = rc2; goto out; } }
Greg KH
maintainerPATCH 6/89 eCryptfs: Check inode changes in setattr
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyler Hicks <[email protected]>
commit a261a03904849c3df50bd0300efb7fb3f865137d upstream.
Most filesystems call inode_change_ok() very early in ->setattr(), but eCryptfs didn't call it at all. It allowed the lower filesystem to make the call in its ->setattr() function. Then, eCryptfs would copy the appropriate inode attributes from the lower inode to the eCryptfs inode.
This patch changes that and actually calls inode_change_ok() on the eCryptfs inode, fairly early in ecryptfs_setattr(). Ideally, the call would happen earlier in ecryptfs_setattr(), but there are some possible inode initialization steps that must happen first.
Since the call was already being made on the lower inode, the change in functionality should be minimal, except for the case of a file extending truncate call. In that case, inode_newsize_ok() was never being called on the eCryptfs inode. Rather than inode_newsize_ok() catching maximum file size errors early on, eCryptfs would encrypt zeroed pages and write them to the lower filesystem until the lower filesystem's write path caught the error in generic_write_checks(). This patch introduces a new function, called ecryptfs_inode_newsize_ok(), which checks if the new lower file size is within the appropriate limits when the truncate operation will be growing the lower file.
In summary this change prevents eCryptfs truncate operations (and the resulting page encryptions), which would exceed the lower filesystem limits or FSIZE rlimits, from ever starting.
--- fs/ecryptfs/inode.c | 48 ++++++++++++++++++++++++++++++++++++------------ 1 file changed, 36 insertions(+), 12 deletions(-)
fs/ecryptfs/inode.c +36 -12
@@ -841,18 +841,6 @@ static int truncate_upper(struct dentrysize_t num_zeros = (PAGE_CACHE_SIZE - (ia->ia_size & ~PAGE_CACHE_MASK )); - -/* -* XXX(truncate) this should really happen at the begginning -* of ->setattr. But the code is too messy to that as part -* of a larger patch. ecryptfs is also totally missing out -* on the inode_change_ok check at the beginning of -* ->setattr while would include this. -*/ - rc =inode_newsize_ok (inode, ia->ia_size); -if (rc) - goto out; -if (!(crypt_stat->flags &ECRYPTFS_ENCRYPTED )) {truncate_setsize (inode, ia->ia_size); lower_ia->ia_size = ia->ia_size;
@@ -902,6 +890,28 @@ out:return rc; } +static int ecryptfs_inode_newsize_ok (struct inode *inode,loff_t offset) +{ +struct ecryptfs_crypt_stat *crypt_stat; +loff_t lower_oldsize, lower_newsize; + + crypt_stat = &ecryptfs_inode_to_private (inode)->crypt_stat; + lower_oldsize =upper_size_to_lower_size (crypt_stat, +i_size_read (inode)); + lower_newsize =upper_size_to_lower_size (crypt_stat, offset); +if (lower_newsize > lower_oldsize) { +/* +* The eCryptfs inode and the new *lower* size are mixed here +* because we may not have the lower i_mutex held and/or it may +* not be appropriate to call inode_newsize_ok() with inodes +* from other filesystems. +*/ +return inode_newsize_ok (inode, lower_newsize); + } + +return 0 ; +} +/** * ecryptfs_truncate * @dentry: The ecryptfs layer dentry
@@ -918,6 +928,10 @@ int ecryptfs_truncate(struct dentry *denstruct iattr lower_ia = { .ia_valid =0 };int rc; + rc =ecryptfs_inode_newsize_ok (dentry->d_inode, new_length); +if (rc) +return rc; + rc =truncate_upper (dentry, &ia, &lower_ia);if (!rc && lower_ia.ia_valid &ATTR_SIZE ) {struct dentry *lower_dentry =ecryptfs_dentry_to_lower (dentry);
@@ -997,6 +1011,16 @@ static int ecryptfs_setattr(struct dentr } }mutex_unlock (&crypt_stat->cs_mutex); + + rc =inode_change_ok (inode, ia); +if (rc) + goto out; +if (ia->ia_valid &ATTR_SIZE ) { + rc =ecryptfs_inode_newsize_ok (inode, ia->ia_size); +if (rc) + goto out; + } +if (S_ISREG (inode->i_mode)) { rc =filemap_write_and_wait (inode->i_mapping);if (rc)
Greg KH
maintainerPATCH 7/89 eCryptfs: Fix oops when printing debug info in extent crypto functions
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tyler Hicks <[email protected]>
commit 58ded24f0fcb85bddb665baba75892f6ad0f4b8a upstream.
If pages passed to the eCryptfs extent-based crypto functions are not mapped and the module parameter ecryptfs_verbosity=1 was specified at loading time, a NULL pointer dereference will occur.
Note that this wouldn't happen on a production system, as you wouldn't pass ecryptfs_verbosity=1 on a production system. It leaks private information to the system logs and is for debugging only.
The debugging info printed in these messages is no longer very useful and rather than doing a kmap() in these debugging paths, it will be better to simply remove the debugging paths completely.
https://launchpad.net/bugs/913651
--- fs/ecryptfs/crypto.c | 40 ---------------------------------------- 1 file changed, 40 deletions(-)
fs/ecryptfs/crypto.c +0 -40
@@ -417,17 +417,6 @@ static int ecryptfs_encrypt_extent(struc (unsigned long long)(extent_base + extent_offset), rc); goto out; } -if (unlikely (ecryptfs_verbosity >0 )) { -ecryptfs_printk (KERN_DEBUG ,"Encrypting extent " -"with iv:\n" ); -ecryptfs_dump_hex (extent_iv, crypt_stat->iv_bytes); -ecryptfs_printk (KERN_DEBUG ,"First 8 bytes before " -"encryption:\n" ); -ecryptfs_dump_hex ((char *) - (page_address (page) - + (extent_offset * crypt_stat->extent_size)), -8 ); - } rc = ecryptfs_encrypt_page_offset(crypt_stat, enc_extent_page, 0, page, (extent_offset * crypt_stat->extent_size),
@@ -440,14 +429,6 @@ static int ecryptfs_encrypt_extent(struc goto out; } rc =0 ; -if (unlikely (ecryptfs_verbosity >0 )) { -ecryptfs_printk (KERN_DEBUG ,"Encrypt extent [0x%.16llx]; " -"rc = [%d]\n" , - (unsigned long long )(extent_base + extent_offset), rc); -ecryptfs_printk (KERN_DEBUG ,"First 8 bytes after " -"encryption:\n" ); -ecryptfs_dump_hex ((char *)(page_address (enc_extent_page)),8 ); - } out:return rc; }
@@ -543,17 +524,6 @@ static int ecryptfs_decrypt_extent(struc (unsigned long long)(extent_base + extent_offset), rc); goto out; } -if (unlikely (ecryptfs_verbosity >0 )) { -ecryptfs_printk (KERN_DEBUG ,"Decrypting extent " -"with iv:\n" ); -ecryptfs_dump_hex (extent_iv, crypt_stat->iv_bytes); -ecryptfs_printk (KERN_DEBUG ,"First 8 bytes before " -"decryption:\n" ); -ecryptfs_dump_hex ((char *) - (page_address (enc_extent_page) - + (extent_offset * crypt_stat->extent_size)), -8 ); - } rc = ecryptfs_decrypt_page_offset(crypt_stat, page, (extent_offset * crypt_stat->extent_size),
@@ -567,16 +537,6 @@ static int ecryptfs_decrypt_extent(struc goto out; } rc =0 ; -if (unlikely (ecryptfs_verbosity >0 )) { -ecryptfs_printk (KERN_DEBUG ,"Decrypt extent [0x%.16llx]; " -"rc = [%d]\n" , - (unsigned long long )(extent_base + extent_offset), rc); -ecryptfs_printk (KERN_DEBUG ,"First 8 bytes after " -"decryption:\n" ); -ecryptfs_dump_hex ((char *)(page_address (page) - + (extent_offset - * crypt_stat->extent_size)),8 ); - } out:return rc; }
Greg KH
maintainerPATCH 8/89 drm/radeon/kms: Add an MSI quirk for Dell RS690
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 44517c44496062180a6376cc704b33129441ce60 upstream.
Interrupts only work with MSIs.
https://bugs.freedesktop.org/show_bug.cgi?id=37679
--- drivers/gpu/drm/radeon/radeon_irq_kms.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/gpu/drm/radeon/radeon_irq_kms.c +6 -0
@@ -134,6 +134,12 @@ static bool radeon_msi_ok(struct radeon_/* Dell RS690 only seems to work with MSIs. */ if ((rdev->pdev->device ==0x791f ) && (rdev->pdev->subsystem_vendor ==0x1028 ) && + (rdev->pdev->subsystem_device ==0x01fc )) +return true; + +/* Dell RS690 only seems to work with MSIs. */ +if ((rdev->pdev->device ==0x791f ) && + (rdev->pdev->subsystem_vendor ==0x1028 ) && (rdev->pdev->subsystem_device ==0x01fd ))return true;
Greg KH
maintainerPATCH 9/89 drm/radeon/kms: move panel mode setup into encoder mode set
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 386d4d751e8e0b4b693bb724f09aae064ee5297d upstream.
Needs to happen earlier in the mode set.
--- drivers/gpu/drm/radeon/atombios_dp.c | 22 ++++++++++------------ drivers/gpu/drm/radeon/atombios_encoders.c | 11 +++++++++++ drivers/gpu/drm/radeon/radeon_mode.h | 3 +++ 3 files changed, 24 insertions(+), 12 deletions(-)
drivers/gpu/drm/radeon/atombios_dp.c +10 -12
@@ -549,8 +549,8 @@ bool radeon_dp_getdpcd(struct radeon_conreturn false; } -static void radeon_dp_set_panel_mode (struct drm_encoder *encoder, -struct drm_connector *connector) +int radeon_dp_get_panel_mode (struct drm_encoder *encoder, +struct drm_connector *connector) {struct drm_device *dev = encoder->dev;struct radeon_device *rdev = dev->dev_private;
@@ -558,7 +558,7 @@ static void radeon_dp_set_panel_mode(strint panel_mode =DP_PANEL_MODE_EXTERNAL_DP_MODE ;if (!ASIC_IS_DCE4 (rdev)) -return ; +return panel_mode;if (radeon_connector_encoder_get_dp_bridge_encoder_id (connector) ==ENCODER_OBJECT_ID_NUTMEG )
@@ -572,14 +572,7 @@ static void radeon_dp_set_panel_mode(str panel_mode =DP_PANEL_MODE_INTERNAL_DP2_MODE ; } -atombios_dig_encoder_setup (encoder, -ATOM_ENCODER_CMD_SETUP_PANEL_MODE , - panel_mode); - -if ((connector->connector_type == DRM_MODE_CONNECTOR_eDP) && - (panel_mode ==DP_PANEL_MODE_INTERNAL_DP2_MODE )) { -radeon_write_dpcd_reg (radeon_connector,DP_EDP_CONFIGURATION_SET ,1 ); - } +return panel_mode; } void radeon_dp_set_link_config(struct drm_connector *connector,
@@ -717,6 +710,8 @@ static void radeon_dp_set_tp(struct radestatic int radeon_dp_link_train_init (struct radeon_dp_link_train_info *dp_info) { +struct radeon_encoder *radeon_encoder =to_radeon_encoder (dp_info->encoder); +struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;u8 tmp;/* power up the sink */
@@ -732,7 +727,10 @@ static int radeon_dp_link_train_init(strradeon_write_dpcd_reg (dp_info->radeon_connector,DP_DOWNSPREAD_CTRL ,0 ); -radeon_dp_set_panel_mode (dp_info->encoder, dp_info->connector); +if ((dp_info->connector->connector_type == DRM_MODE_CONNECTOR_eDP) && + (dig->panel_mode ==DP_PANEL_MODE_INTERNAL_DP2_MODE )) { +radeon_write_dpcd_reg (dp_info->radeon_connector,DP_EDP_CONFIGURATION_SET ,1 ); + }/* set the lane count on the sink */ tmp = dp_info->dp_lane_count;
drivers/gpu/drm/radeon/atombios_encoders.c +11 -0
@@ -1822,10 +1822,21 @@ radeon_atom_encoder_mode_set(struct drm_case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 :case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA :if (ASIC_IS_DCE4 (rdev)) { +struct drm_connector *connector =radeon_get_connector_for_encoder (encoder); +struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv; + +if (!connector) + dig->panel_mode =DP_PANEL_MODE_EXTERNAL_DP_MODE ; +else + dig->panel_mode =radeon_dp_get_panel_mode (encoder, connector); +/* disable the transmitter */ atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_DISABLE ,0 ,0 );/* setup and enable the encoder */ atombios_dig_encoder_setup (encoder,ATOM_ENCODER_CMD_SETUP ,0 ); +atombios_dig_encoder_setup (encoder, +ATOM_ENCODER_CMD_SETUP_PANEL_MODE , + dig->panel_mode);/* enable the transmitter */ atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_ENABLE ,0 ,0 );
drivers/gpu/drm/radeon/radeon_mode.h +3 -0
@@ -362,6 +362,7 @@ struct radeon_encoder_atom_dig {struct backlight_device *bl_dev;int dpms_mode;uint8_t backlight_level; +int panel_mode; };struct radeon_encoder_atom_dac {
@@ -482,6 +483,8 @@ extern void radeon_dp_link_train(structextern bool radeon_dp_needs_link_train (struct radeon_connector *radeon_connector);extern u8 radeon_dp_getsinktype (struct radeon_connector *radeon_connector);extern bool radeon_dp_getdpcd (struct radeon_connector *radeon_connector); +extern int radeon_dp_get_panel_mode (struct drm_encoder *encoder, +struct drm_connector *connector);extern void atombios_dig_encoder_setup (struct drm_encoder *encoder,int action,int panel_mode);extern void radeon_atom_encoder_init (struct radeon_device *rdev); extern void atombios_dig_transmitter_setup(struct drm_encoder *encoder,
Greg KH
maintainerPATCH 10/89 drm/radeon/kms: rework modeset sequence for DCE41 and DCE5
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alex Deucher <[email protected]>
commit 3a47824d85eeca122895646f027dc63480994199 upstream.
dig transmitter control table only has ENABLE/DISABLE actions on DCE4.1/DCE5.
Fixes:
https://bugs.freedesktop.org/show_bug.cgi?id=44955
--- drivers/gpu/drm/radeon/atombios_encoders.c | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-)
drivers/gpu/drm/radeon/atombios_encoders.c +12 -7
@@ -1352,7 +1352,8 @@ radeon_atom_encoder_dpms_dig(struct drm_switch (mode) {case DRM_MODE_DPMS_ON :/* some early dce3.2 boards have a bug in their transmitter control table */ -if ((rdev->family ==CHIP_RV710 ) || (rdev->family ==CHIP_RV730 )) +if ((rdev->family ==CHIP_RV710 ) || (rdev->family ==CHIP_RV730 ) || +ASIC_IS_DCE41 (rdev) ||ASIC_IS_DCE5 (rdev))atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_ENABLE ,0 ,0 );else atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT ,0 ,0 );
@@ -1362,8 +1363,6 @@ radeon_atom_encoder_dpms_dig(struct drm_ ATOM_TRANSMITTER_ACTION_POWER_ON); radeon_dig_connector->edp_on = true; } -if (ASIC_IS_DCE4 (rdev)) -atombios_dig_encoder_setup (encoder,ATOM_ENCODER_CMD_DP_VIDEO_OFF ,0 );radeon_dp_link_train (encoder, connector);if (ASIC_IS_DCE4 (rdev))atombios_dig_encoder_setup (encoder,ATOM_ENCODER_CMD_DP_VIDEO_ON ,0 );
@@ -1374,7 +1373,10 @@ radeon_atom_encoder_dpms_dig(struct drm_case DRM_MODE_DPMS_STANDBY :case DRM_MODE_DPMS_SUSPEND :case DRM_MODE_DPMS_OFF : -atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT ,0 ,0 ); +if (ASIC_IS_DCE41 (rdev) ||ASIC_IS_DCE5 (rdev)) +atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_DISABLE ,0 ,0 ); +else +atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_DISABLE_OUTPUT ,0 ,0 );if (ENCODER_MODE_IS_DP (atombios_get_encoder_mode (encoder)) && connector) {if (ASIC_IS_DCE4 (rdev))atombios_dig_encoder_setup (encoder,ATOM_ENCODER_CMD_DP_VIDEO_OFF ,0 );
@@ -1821,7 +1823,7 @@ radeon_atom_encoder_mode_set(struct drm_case ENCODER_OBJECT_ID_INTERNAL_UNIPHY1 :case ENCODER_OBJECT_ID_INTERNAL_UNIPHY2 :case ENCODER_OBJECT_ID_INTERNAL_KLDSCP_LVTMA : -if (ASIC_IS_DCE4 (rdev)) { +if (ASIC_IS_DCE41 (rdev) ||ASIC_IS_DCE5 (rdev)) {struct drm_connector *connector =radeon_get_connector_for_encoder (encoder);struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
@@ -1830,13 +1832,16 @@ radeon_atom_encoder_mode_set(struct drm_else dig->panel_mode =radeon_dp_get_panel_mode (encoder, connector); -/* disable the transmitter */ -atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_DISABLE ,0 ,0 );/* setup and enable the encoder */ atombios_dig_encoder_setup (encoder,ATOM_ENCODER_CMD_SETUP ,0 );atombios_dig_encoder_setup (encoder,ATOM_ENCODER_CMD_SETUP_PANEL_MODE , dig->panel_mode); + }else if (ASIC_IS_DCE4 (rdev)) { +/* disable the transmitter */ +atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_DISABLE ,0 ,0 ); +/* setup and enable the encoder */ +atombios_dig_encoder_setup (encoder,ATOM_ENCODER_CMD_SETUP ,0 );/* enable the transmitter */ atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_ENABLE ,0 ,0 );
Greg KH
maintainerPATCH 11/89 drm: Fix authentication kernel crash
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Thomas Hellstrom <[email protected]>
commit 598781d71119827b454fd75d46f84755bca6f0c6 upstream.
If the master tries to authenticate a client using drm_authmagic and that client has already closed its drm file descriptor,
either wilfully or because it was terminated, the
call to drm_authmagic will dereference a stale pointer into kmalloc'ed memory and corrupt it.
Typically this results in a hard system hang.
This patch fixes that problem by removing any authentication tokens (struct drm_magic_entry) open for a file descriptor when that file descriptor is closed.
--- drivers/gpu/drm/drm_auth.c | 6 +++++- drivers/gpu/drm/drm_fops.c | 5 +++++ include/drm/drmP.h | 1 + 3 files changed, 11 insertions(+), 1 deletion(-)
drivers/gpu/drm/drm_auth.c +5 -1
@@ -101,7 +101,7 @@ static int drm_add_magic(struct drm_mast* Searches and unlinks the entry in drm_device::magiclist with the magic * number hash key, while holding the drm_device::struct_mutex lock. */ -static int drm_remove_magic (struct drm_master *master,drm_magic_t magic) +int drm_remove_magic (struct drm_master *master,drm_magic_t magic) {struct drm_magic_entry *pt;struct drm_hash_item *hash;
@@ -136,6 +136,8 @@ static int drm_remove_magic(struct drm_m* If there is a magic number in drm_file::magic then use it, otherwise * searches an unique non-zero magic number and add it associating it with \p * file_priv. +* This ioctl needs protection by the drm_global_mutex, which protects +* struct drm_file::magic and struct drm_magic_entry::priv. */ int drm_getmagic (struct drm_device *dev,void *data,struct drm_file *file_priv) {
@@ -173,6 +175,8 @@ int drm_getmagic(struct drm_device *dev,* \return zero if authentication successed, or a negative number otherwise. * * Checks if \p file_priv is associated with the magic number passed in \arg. +* This ioctl needs protection by the drm_global_mutex, which protects +* struct drm_file::magic and struct drm_magic_entry::priv. */ int drm_authmagic (struct drm_device *dev,void *data,struct drm_file *file_priv)
drivers/gpu/drm/drm_fops.c +5 -0
@@ -487,6 +487,11 @@ int drm_release(struct inode *inode, str (long )old_encode_dev (file_priv->minor->device), dev->open_count); +/* Release any auth tokens that might point to this file_priv, +(do that under the drm_global_mutex) */ +if (file_priv->magic) + (void )drm_remove_magic (file_priv->master, file_priv->magic); +/* if the master has gone away we can't do anything with the lock */ if (file_priv->minor->master)drm_master_release (dev, filp);
include/drm/drmP.h +1 -0
@@ -1328,6 +1328,7 @@ extern int drm_getmagic(struct drm_devic struct drm_file *file_priv);extern int drm_authmagic (struct drm_device *dev,void *data,struct drm_file *file_priv); +extern int drm_remove_magic (struct drm_master *master,drm_magic_t magic);/* Cache management (drm_cache.c) */ void drm_clflush_pages (struct page *pages[],unsigned long num_pages);
Greg KH
maintainerPATCH 12/89 xfs: Fix missing xfs_iunlock() on error recovery path in xfs_readlink()
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 9b025eb3a89e041bab6698e3858706be2385d692 upstream.
Commit b52a360b forgot to call xfs_iunlock() when it detected corrupted symplink and bailed out. Fix it by jumping to 'out' instead of doing return.
--- fs/xfs/xfs_vnodeops.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
fs/xfs/xfs_vnodeops.c +2 -1
@@ -131,7 +131,8 @@ xfs_readlink( __func__, (unsigned long long ) ip->i_ino, (long long) pathlen);ASSERT (0 ); -return XFS_ERROR (EFSCORRUPTED ); + error =XFS_ERROR (EFSCORRUPTED ); + goto out; }
Greg KH
maintainerPATCH 13/89 ASoC: Mark WM5100 register map cache only when going into BIAS_OFF
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit e53e417331c57b9b97e3f8be870214a02c99265c upstream.
Writing to the registers won't work if we do actually manage to hit a fully powered off state.
--- sound/soc/codecs/wm5100.c | 1 + 1 file changed, 1 insertion(+)
sound/soc/codecs/wm5100.c +1 -0
@@ -1404,6 +1404,7 @@ static int wm5100_set_bias_level(structbreak ;case SND_SOC_BIAS_OFF : +regcache_cache_only (wm5100->regmap, true);if (wm5100->pdata.ldo_ena)gpio_set_value_cansleep (wm5100->pdata.ldo_ena,0 ); regulator_bulk_disable(ARRAY_SIZE(wm5100->core_supplies),
Greg KH
maintainerPATCH 14/89 ASoC: Disable register synchronisation for low frequency WM8996 SYSCLK
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit fed22007113cb857e917913ce016d9b539dc3a80 upstream.
With a low frequency SYSCLK and a fast I2C clock register synchronisation may occasionally take too long to take effect, causing I/O issues. Disable synchronisation in order to avoid any issues.
--- sound/soc/codecs/wm8996.c | 4 ++++ sound/soc/codecs/wm8996.h | 4 ++++ 2 files changed, 8 insertions(+)
sound/soc/codecs/wm8996.c +4 -0
@@ -1932,6 +1932,7 @@ static int wm8996_set_sysclk(struct snd_struct wm8996_priv *wm8996 =snd_soc_codec_get_drvdata (codec);int lfclk =0 ;int ratediv =0 ; +int sync =WM8996_REG_SYNC ;int src;int old;
@@ -1976,6 +1977,7 @@ static int wm8996_set_sysclk(struct snd_case 32000 :case 32768 : lfclk =WM8996_LFCLK_ENA ; + sync =0 ;break ;default : dev_warn(codec->dev, "Unsupported clock rate %dHz\n",
@@ -1989,6 +1991,8 @@ static int wm8996_set_sysclk(struct snd_WM8996_SYSCLK_SRC_MASK |WM8996_SYSCLK_DIV_MASK , src << WM8996_SYSCLK_SRC_SHIFT | ratediv);snd_soc_update_bits (codec,WM8996_CLOCKING_1 ,WM8996_LFCLK_ENA , lfclk); +snd_soc_update_bits (codec,WM8996_CONTROL_INTERFACE_1 , +WM8996_REG_SYNC , sync);snd_soc_update_bits (codec,WM8996_AIF_CLOCKING_1 ,WM8996_SYSCLK_ENA , old);
sound/soc/codecs/wm8996.h +4 -0
@@ -1567,6 +1567,10 @@ int wm8996_detect(struct snd_soc_codec */* * R257 (0x101) - Control Interface (1) */ +#define WM8996_REG_SYNC 0x8000/* REG_SYNC */ +#define WM8996_REG_SYNC_MASK 0x8000/* REG_SYNC */ +#define WM8996_REG_SYNC_SHIFT 15/* REG_SYNC */ +#define WM8996_REG_SYNC_WIDTH 1/* REG_SYNC */ #define WM8996_AUTO_INC 0x0004/* AUTO_INC */ #define WM8996_AUTO_INC_MASK 0x0004/* AUTO_INC */ #define WM8996_AUTO_INC_SHIFT 2/* AUTO_INC */
Greg KH
maintainerPATCH 15/89 ASoC: Dont go through cache when applying WM5100 rev A updates
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 495174a8ffbaa0d15153d855cf206cdc46d51cf4 upstream.
These are all to either uncached registers or fixes to register defaults, in the former case the cache won't do anything and in the latter case we're fixing things so the cache sync will do the right thing.
--- sound/soc/codecs/wm5100.c | 2 ++ 1 file changed, 2 insertions(+)
sound/soc/codecs/wm5100.c +2 -0
@@ -1379,6 +1379,7 @@ static int wm5100_set_bias_level(structswitch (wm5100->rev) {case 0 : +regcache_cache_bypass (wm5100->regmap, true);snd_soc_write (codec,0x11 ,0x3 );snd_soc_write (codec,0x203 ,0xc );snd_soc_write (codec,0x206 ,0 );
@@ -1394,6 +1395,7 @@ static int wm5100_set_bias_level(structsnd_soc_write (codec, wm5100_reva_patches[i].reg, wm5100_reva_patches[i].val); +regcache_cache_bypass (wm5100->regmap, false);break ;default :break ;
Greg KH
maintainerPATCH 16/89 ASoC: wm8996: Call _POST_PMU callback for CPVDD
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit a14304edcd5e8323205db34b08f709feb5357e64 upstream.
We should be allowing a 5ms delay after the charge pump is started in order to ensure it has finished ramping.
--- sound/soc/codecs/wm8996.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/codecs/wm8996.c +2 -1
@@ -1049,7 +1049,8 @@ SND_SOC_DAPM_SUPPLY_S("SYSCLK", 1, WM899SND_SOC_DAPM_SUPPLY_S ("SYSDSPCLK" ,2 ,WM8996_CLOCKING_1 ,1 ,0 ,NULL ,0 ),SND_SOC_DAPM_SUPPLY_S ("AIFCLK" ,2 ,WM8996_CLOCKING_1 ,2 ,0 ,NULL ,0 ),SND_SOC_DAPM_SUPPLY_S ("Charge Pump" ,2 ,WM8996_CHARGE_PUMP_1 ,15 ,0 , cp_event, -SND_SOC_DAPM_PRE_PMU |SND_SOC_DAPM_POST_PMD ), +SND_SOC_DAPM_PRE_PMU |SND_SOC_DAPM_POST_PMU | +SND_SOC_DAPM_POST_PMD ),SND_SOC_DAPM_SUPPLY ("Bandgap" ,SND_SOC_NOPM ,0 ,0 , bg_event,SND_SOC_DAPM_PRE_PMU |SND_SOC_DAPM_POST_PMD ), SND_SOC_DAPM_SUPPLY("LDO2", WM8996_POWER_MANAGEMENT_2, 1, 0, NULL, 0),
Greg KH
maintainerPATCH 17/89 brcmsmac: fix tx queue flush infinite loop
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit f96b08a7e6f69c0f0a576554df3df5b1b519c479 upstream.
This patch workaround live deadlock problem caused by infinite loop in brcms_c_wait_for_tx_completion(). I do not consider the patch as the proper fix, which should fix the real reason of tx queue flush failure, but patch helps with system lockup.
Reference:
https://bugzilla.kernel.org/show_bug.cgi?id=42576
--- drivers/net/wireless/brcm80211/brcmsmac/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/net/wireless/brcm80211/brcmsmac/main.c +9 -1
@@ -8217,13 +8217,21 @@ int brcms_c_get_curband(struct brcms_c_ivoid brcms_c_wait_for_tx_completion (struct brcms_c_info *wlc,bool drop) { +int timeout =20 ; +/* flush packet queue when requested */ if (drop)brcmu_pktq_flush (&wlc->pkt_queue->q, false,NULL ,NULL );/* wait for queue and DMA fifos to run dry */ -while (!pktq_empty (&wlc->pkt_queue->q) ||brcms_txpktpendtot (wlc) >0 ) +while (!pktq_empty (&wlc->pkt_queue->q) ||brcms_txpktpendtot (wlc) >0 ) {brcms_msleep (wlc->wl,1 ); + +if (--timeout ==0 ) +break ; + } + +WARN_ON_ONCE (timeout ==0 ); }void brcms_c_set_beacon_listen_interval (struct brcms_c_info *wlc,u8 interval)
Greg KH
maintainerPATCH 18/89 mac80211: fix work removal on deauth request
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit bc4934bc61d0a11fd62c5187ff83645628f8be8b upstream.
When deauth is requested while an auth or assoc work item is in progress, we currently delete it without regard for any state it might need to clean up. Fix it by cleaning up for those items.
In the case Pontus found, the problem manifested itself as such:
authenticate with 00:23:69:aa:dd:7b (try 1) authenticated
failed to insert Dummy STA entry for the AP (error -17) deauthenticating from 00:23:69:aa:dd:7b by local choice (reason=2)
It could also happen differently if the driver uses the tx_sync callback.
We can't just call the ->done() method of the work items because that will lock up due to the locking in cfg80211. This fix isn't very clean, but that seems acceptable since I have patches pending to remove this code completely.
--- net/mac80211/mlme.c | 38 +++++++++++++++++++++++++++----------- 1 file changed, 27 insertions(+), 11 deletions(-)
net/mac80211/mlme.c +27 -11
@@ -2719,7 +2719,6 @@ int ieee80211_mgd_deauth(struct ieee8021 {struct ieee80211_local *local = sdata->local;struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; -struct ieee80211_work *wk;u8 bssid[ETH_ALEN ];bool assoc_bss = false;
@@ -2732,30 +2731,47 @@ int ieee80211_mgd_deauth(struct ieee8021 assoc_bss = true; }else {bool not_auth_yet = false; +struct ieee80211_work *tmp, *wk =NULL ;mutex_unlock (&ifmgd->mtx);mutex_lock (&local->mtx); -list_for_each_entry (wk, &local->work_list, list) { -if (wk->sdata != sdata) +list_for_each_entry (tmp, &local->work_list, list) { +if (tmp->sdata != sdata)continue ; -if (wk->type !=IEEE80211_WORK_DIRECT_PROBE && - wk->type !=IEEE80211_WORK_AUTH && - wk->type !=IEEE80211_WORK_ASSOC && - wk->type !=IEEE80211_WORK_ASSOC_BEACON_WAIT ) +if (tmp->type !=IEEE80211_WORK_DIRECT_PROBE && + tmp->type !=IEEE80211_WORK_AUTH && + tmp->type !=IEEE80211_WORK_ASSOC && + tmp->type !=IEEE80211_WORK_ASSOC_BEACON_WAIT )continue ; -if (memcmp (req->bss->bssid, wk->filter_ta,ETH_ALEN )) +if (memcmp (req->bss->bssid, tmp->filter_ta,ETH_ALEN ))continue ; - not_auth_yet = wk->type ==IEEE80211_WORK_DIRECT_PROBE ; -list_del_rcu (&wk->list); -free_work (wk); + not_auth_yet = tmp->type ==IEEE80211_WORK_DIRECT_PROBE ; +list_del_rcu (&tmp->list); +synchronize_rcu (); + wk = tmp;break ; }mutex_unlock (&local->mtx); +if (wk && wk->type ==IEEE80211_WORK_ASSOC ) { +/* clean up dummy sta & TX sync */ +sta_info_destroy_addr (wk->sdata, wk->filter_ta); +if (wk->assoc.synced) +drv_finish_tx_sync (local, wk->sdata, + wk->filter_ta, +IEEE80211_TX_SYNC_ASSOC ); + }else if (wk && wk->type ==IEEE80211_WORK_AUTH ) { +if (wk->probe_auth.synced) +drv_finish_tx_sync (local, wk->sdata, + wk->filter_ta, +IEEE80211_TX_SYNC_AUTH ); + } +kfree (wk); +/* * If somebody requests authentication and we haven't * sent out an auth frame yet there's no need to send
Greg KH
maintainerPATCH 19/89 jbd: Issue cache flush after checkpointing
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 353b67d8ced4dc53281c88150ad295e24bc4b4c5 upstream.
When we reach cleanup_journal_tail(), there is no guarantee that checkpointed buffers are on a stable storage - especially if buffers were written out by log_do_checkpoint(), they are likely to be only in disk's caches. Thus when we update journal superblock, effectively removing old transaction from journal, this write of superblock can get to stable storage before those checkpointed buffers which can result in filesystem corruption after a crash.
A similar problem can happen if we replay the journal and wipe it before flushing disk's caches.
Thus we must unconditionally issue a cache flush before we update journal superblock in these cases. The fix is slightly complicated by the fact that we have to get log tail before we issue cache flush but we can store it in the journal superblock only after the cache flush. Otherwise we risk races where new tail is written before appropriate cache flush is finished.
I managed to reproduce the corruption using somewhat tweaked Chris Mason's barrier-test scheduler. Also this should fix occasional reports of 'Bit already freed' filesystem errors which are totally unreproducible but inspection of several fs images I've gathered over time points to a problem like this.
--- fs/jbd/checkpoint.c | 27 ++++++++++++++++++++++----- fs/jbd/recovery.c | 4 ++++ 2 files changed, 26 insertions(+), 5 deletions(-)
fs/jbd/checkpoint.c +22 -5
@@ -453,8 +453,6 @@ out:* * Return <0 on error, 0 on success, 1 if there was nothing to clean up. * -* Called with the journal lock held. -* * This is the only part of the journaling code which really needs to be * aware of transaction aborts. Checkpointing involves writing to the * main filesystem area rather than to the journal, so it can proceed
@@ -472,13 +470,14 @@ int cleanup_journal_tail(journal_t *jourif (is_journal_aborted (journal))return 1 ; -/* OK, work out the oldest transaction remaining in the log, and +/* +* OK, work out the oldest transaction remaining in the log, and * the log block it starts at. * * If the log is now empty, we need to work out which is the * next transaction ID we will write, and where it will -* start. */ - +* start. +*/ spin_lock (&journal->j_state_lock);spin_lock (&journal->j_list_lock); transaction = journal->j_checkpoint_transactions;
@@ -504,7 +503,25 @@ int cleanup_journal_tail(journal_t *jourspin_unlock (&journal->j_state_lock);return 1 ; } +spin_unlock (&journal->j_state_lock); + +/* +* We need to make sure that any blocks that were recently written out +* --- perhaps by log_do_checkpoint() --- are flushed out before we +* drop the transactions from the journal. It's unlikely this will be +* necessary, especially with an appropriately sized journal, but we +* need this to guarantee correctness. Fortunately +* cleanup_journal_tail() doesn't get called all that often. +*/ +if (journal->j_flags &JFS_BARRIER ) +blkdev_issue_flush (journal->j_fs_dev,GFP_KERNEL ,NULL ); +spin_lock (&journal->j_state_lock); +if (!tid_gt (first_tid, journal->j_tail_sequence)) { +spin_unlock (&journal->j_state_lock); +/* Someone else cleaned up journal so return 0 */ +return 0 ; + }/* OK, update the superblock to recover the freed space. * Physical blocks come first: have we wrapped beyond the end of * the log? */
fs/jbd/recovery.c +4 -0
@@ -20,6 +20,7 @@#include <linux/fs.h> #include <linux/jbd.h> #include <linux/errno.h> +#include <linux/blkdev.h> #endif /*
@@ -263,6 +264,9 @@ int journal_recover(journal_t *journal) err2 =sync_blockdev (journal->j_fs_dev);if (!err) err = err2; +/* Flush disk caches to get replayed data on the permanent storage */ +if (journal->j_flags &JFS_BARRIER ) +blkdev_issue_flush (journal->j_fs_dev,GFP_KERNEL ,NULL );return err; }
Greg KH
maintainerPATCH 20/89 crypto: sha512 - make it work, undo percpu message schedule
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Dobriyan <[email protected]>
commit 84e31fdb7c797a7303e0cc295cb9bc8b73fb872d upstream.
commit f9e2bca6c22d75a289a349f869701214d63b5060
aka "crypto: sha512 - Move message schedule W[80] to static percpu area" created global message schedule area.
If sha512_update will ever be entered twice, hash will be silently calculated incorrectly.
Probably the easiest way to notice incorrect hashes being calculated is to run 2 ping floods over AH with hmac(sha512):
#!/usr/sbin/setkey -f flush; spdflush; add IP1 IP2 ah 25 -A hmac-sha512 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000025; add IP2 IP1 ah 52 -A hmac-sha512 0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000052; spdadd IP1 IP2 any -P out ipsec ah/transport//require; spdadd IP2 IP1 any -P in ipsec ah/transport//require;
XfrmInStateProtoError will start ticking with -EBADMSG being returned from ah_input(). This never happens with, say, hmac(sha1).
With patch applied (on BOTH sides), XfrmInStateProtoError does not tick with multiple bidirectional ping flood streams like it doesn't tick with SHA-1.
After this patch sha512_transform() will start using ~750 bytes of stack on x86_64. This is OK for simple loads, for something more heavy, stack reduction will be done separatedly.
--- crypto/sha512_generic.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-)
crypto/sha512_generic.c +1 -5
@@ -21,8 +21,6 @@#include <linux/percpu.h> #include <asm/byteorder.h> -static DEFINE_PER_CPU(u64[80], msg_schedule); -static inline u64 Ch (u64 x,u64 y,u64 z) {return z ^ (x & (y ^ z));
@@ -89,7 +87,7 @@ sha512_transform(u64 *state, const u8 *iu64 a, b, c, d, e, f, g, h, t1, t2;int i; -u64 *W =get_cpu_var (msg_schedule); +u64 W [80 ];/* load the input */ for (i =0 ; i <16 ; i++)
@@ -128,8 +126,6 @@ sha512_transform(u64 *state, const u8 *i/* erase our data */ a = b = c = d = e = f = g = h = t1 = t2 =0 ; -memset (W ,0 ,sizeof (__get_cpu_var (msg_schedule))); -put_cpu_var (msg_schedule); } static int
Greg KH
maintainerPATCH 21/89 crypto: sha512 - reduce stack usage to safe number
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexey Dobriyan <[email protected]>
commit 51fc6dc8f948047364f7d42a4ed89b416c6cc0a3 upstream.
For rounds 16--79, W[i] only depends on W[i - 2], W[i - 7], W[i - 15] and W[i - 16]. Consequently, keeping all W[80] array on stack is unnecessary,
only 16 values are really needed.
Using W[16] instead of W[80] greatly reduces stack usage (~750 bytes to ~340 bytes on x86_64).
Line by line explanation:
* BLEND_OP
array is "circular" now, all indexes have to be modulo 16. Round number is positive, so remainder operation should be without surprises.
* initial full message scheduling is trimmed to first 16 values which come from data block, the rest is calculated before it's needed.
* original loop body is unrolled version of new SHA512_0_15 and SHA512_16_79 macros, unrolling was done to not do explicit variable renaming. Otherwise it's the very same code after preprocessing. See sha1_transform() code which does the same trick.
Patch survives in-tree crypto test and original bugreport test (ping flood with hmac(sha512).
See FIPS 180-2 for SHA-512 definition
http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf
--- crypto/sha512_generic.c | 58 ++++++++++++++++++++++++++++-------------------- 1 file changed, 34 insertions(+), 24 deletions(-)
crypto/sha512_generic.c +34 -24
@@ -78,7 +78,7 @@ static inline void LOAD_OP(int I, u64 *Wstatic inline void BLEND_OP (int I ,u64 *W ) { -W [I ] =s1 (W [I -2 ]) +W [I -7 ] +s0 (W [I -15 ]) +W [I -16 ]; +W [I %16 ] +=s1 (W [(I -2 ) %16 ]) +W [(I -7 ) %16 ] +s0 (W [(I -15 ) %16 ]); } static void
@@ -87,38 +87,48 @@ sha512_transform(u64 *state, const u8 *iu64 a, b, c, d, e, f, g, h, t1, t2;int i; -u64 W [80 ]; +u64 W [16 ];/* load the input */ for (i =0 ; i <16 ; i++)LOAD_OP (i,W , input); -for (i =16 ; i <80 ; i++) { -BLEND_OP (i,W ); - } -/* load the state into our registers */ a=state[0 ]; b=state[1 ]; c=state[2 ]; d=state[3 ]; e=state[4 ]; f=state[5 ]; g=state[6 ]; h=state[7 ]; -/* now iterate */ -for (i=0 ; i<80 ; i+=8 ) { - t1 = h +e1 (e) +Ch (e,f,g) + sha512_K[i ] +W [i ]; - t2 =e0 (a) +Maj (a,b,c); d+=t1; h=t1+t2; - t1 = g +e1 (d) +Ch (d,e,f) + sha512_K[i+1 ] +W [i+1 ]; - t2 =e0 (h) +Maj (h,a,b); c+=t1; g=t1+t2; - t1 = f +e1 (c) +Ch (c,d,e) + sha512_K[i+2 ] +W [i+2 ]; - t2 =e0 (g) +Maj (g,h,a); b+=t1; f=t1+t2; - t1 = e +e1 (b) +Ch (b,c,d) + sha512_K[i+3 ] +W [i+3 ]; - t2 =e0 (f) +Maj (f,g,h); a+=t1; e=t1+t2; - t1 = d +e1 (a) +Ch (a,b,c) + sha512_K[i+4 ] +W [i+4 ]; - t2 =e0 (e) +Maj (e,f,g); h+=t1; d=t1+t2; - t1 = c +e1 (h) +Ch (h,a,b) + sha512_K[i+5 ] +W [i+5 ]; - t2 =e0 (d) +Maj (d,e,f); g+=t1; c=t1+t2; - t1 = b +e1 (g) +Ch (g,h,a) + sha512_K[i+6 ] +W [i+6 ]; - t2 =e0 (c) +Maj (c,d,e); f+=t1; b=t1+t2; - t1 = a +e1 (f) +Ch (f,g,h) + sha512_K[i+7 ] +W [i+7 ]; - t2 =e0 (b) +Maj (b,c,d); e+=t1; a=t1+t2; +#define SHA512_0_15 (i, a, b, c, d, e, f, g, h) \ + t1 = h + e1(e) + Ch(e, f, g) + sha512_K[i] + W[i]; \ + t2 = e0(a) + Maj(a, b, c); \ + d += t1; \ + h = t1 + t2 + +#define SHA512_16_79 (i, a, b, c, d, e, f, g, h) \ + BLEND_OP(i, W); \ + t1 = h + e1(e) + Ch(e, f, g) + sha512_K[i] + W[(i)%16]; \ + t2 = e0(a) + Maj(a, b, c); \ + d += t1; \ + h = t1 + t2 + +for (i =0 ; i <16 ; i +=8 ) { +SHA512_0_15 (i, a, b, c, d, e, f, g, h); +SHA512_0_15 (i +1 , h, a, b, c, d, e, f, g); +SHA512_0_15 (i +2 , g, h, a, b, c, d, e, f); +SHA512_0_15 (i +3 , f, g, h, a, b, c, d, e); +SHA512_0_15 (i +4 , e, f, g, h, a, b, c, d); +SHA512_0_15 (i +5 , d, e, f, g, h, a, b, c); +SHA512_0_15 (i +6 , c, d, e, f, g, h, a, b); +SHA512_0_15 (i +7 , b, c, d, e, f, g, h, a); + } +for (i =16 ; i <80 ; i +=8 ) { +SHA512_16_79 (i, a, b, c, d, e, f, g, h); +SHA512_16_79 (i +1 , h, a, b, c, d, e, f, g); +SHA512_16_79 (i +2 , g, h, a, b, c, d, e, f); +SHA512_16_79 (i +3 , f, g, h, a, b, c, d, e); +SHA512_16_79 (i +4 , e, f, g, h, a, b, c, d); +SHA512_16_79 (i +5 , d, e, f, g, h, a, b, c); +SHA512_16_79 (i +6 , c, d, e, f, g, h, a, b); +SHA512_16_79 (i +7 , b, c, d, e, f, g, h, a); } state[0 ] += a; state[1 ] += b; state[2 ] += c; state[3 ] += d;
Greg KH
maintainerPATCH 22/89 tpm_tis: add delay after aborting command
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stefan Berger <[email protected]>
commit a927b8131794ee449b7f6666e7ab61301949b20f upstream.
This patch adds a delay after aborting a command. Some TPMs need this and will not process the subsequent command correctly otherwise.
It's worth noting that a TPM randomly failing to process a command, maps to randomly failing suspend/resume operations.
--- drivers/char/tpm/tpm_tis.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/char/tpm/tpm_tis.c +3 -0
@@ -432,6 +432,9 @@ static int probe_itpm(struct tpm_chip *c out: itpm = rem_itpm;tpm_tis_ready (chip); +/* some TPMs need a break here otherwise they will not work +* correctly on the immediately subsequent command */ +msleep (chip->vendor.timeout_b);release_locality (chip, chip->vendor.locality,0 );return rc;
Greg KH
maintainerPATCH 23/89 x86/uv: Fix uninitialized spinlocks
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cliff Wickman <[email protected]>
commit d2ebc71d472020bc30e29afe8c4d2a85a5b41f56 upstream.
Initialize two spinlocks in tlb_uv.c and also properly define/initialize the uv_irq_lock.
The lack of explicit initialization seems to be functionally harmless, but it is diagnosed when these are turned on:
CONFIG_DEBUG_SPINLOCK=y
CONFIG_DEBUG_MUTEXES=y
CONFIG_DEBUG_LOCK_ALLOC=y
CONFIG_LOCKDEP=y
--- arch/x86/platform/uv/tlb_uv.c | 2 ++ arch/x86/platform/uv/uv_irq.c | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-)
arch/x86/platform/uv/tlb_uv.c +2 -0
@@ -1860,6 +1860,8 @@ static void __init init_per_cpu_tunables bcp->cong_reps = congested_reps; bcp->cong_period = congested_period; bcp->clocks_per_100_usec =usec_2_cycles (100 ); +spin_lock_init (&bcp->queue_lock); +spin_lock_init (&bcp->uvhub_lock); } }
arch/x86/platform/uv/uv_irq.c +1 -1
@@ -25,7 +25,7 @@ struct uv_irq_2_mmr_pnode{int irq; }; -static spinlock_t uv_irq_lock; +static DEFINE_SPINLOCK (uv_irq_lock);static struct rb_root uv_irq_root;static int uv_set_irq_affinity (struct irq_data *,const struct cpumask *,bool );
Greg KH
maintainerPATCH 24/89 x86/uv: Fix uv_gpa_to_soc_phys_ram() shift
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Russ Anderson <[email protected]>
commit 5a51467b146ab7948d2f6812892eac120a30529c upstream.
uv_gpa_to_soc_phys_ram() was inadvertently ignoring the shift values. This fix takes the shift into account.
--- arch/x86/include/asm/uv/uv_hub.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
arch/x86/include/asm/uv/uv_hub.h +2 -2
@@ -318,13 +318,13 @@ uv_gpa_in_mmr_space(unsigned long gpa)/* UV global physical address --> socket phys RAM */ static inline unsigned long uv_gpa_to_soc_phys_ram (unsigned long gpa) { -unsigned long paddr = gpa & uv_hub_info->gpa_mask; +unsigned long paddr;unsigned long remap_base = uv_hub_info->lowmem_remap_base;unsigned long remap_top = uv_hub_info->lowmem_remap_top; gpa = ((gpa << uv_hub_info->m_shift) >> uv_hub_info->m_shift) | ((gpa >> uv_hub_info->n_lshift) << uv_hub_info->m_val); - gpa = gpa & uv_hub_info->gpa_mask; + paddr = gpa & uv_hub_info->gpa_mask;if (paddr >= remap_base && paddr < remap_base + remap_top) paddr -= remap_base;return paddr;
Greg KH
maintainerPATCH 25/89 x86/microcode_amd: Add support for CPU family specific container files
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Herrmann <[email protected]>
commit 5b68edc91cdc972c46f76f85eded7ffddc3ff5c2 upstream.
We've decided to provide CPU family specific container files (starting with CPU family 15h). E.g. for family 15h we have to load microcode_amd_fam15h.bin instead of microcode_amd.bin
Rationale is that starting with family 15h patch size is larger than 2KB which was hard coded as maximum patch size in various microcode loaders (not just Linux).
Container files which include patches larger than 2KB cause different kinds of trouble with such old patch loaders. Thus we have to ensure that the default container file provides only patches with size less than 2KB.
--- arch/x86/kernel/microcode_amd.c | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-)
arch/x86/kernel/microcode_amd.c +22 -2
@@ -300,13 +300,33 @@ free_table:return state; } +/* +* AMD microcode firmware naming convention, up to family 15h they are in +* the legacy file: +* +* amd-ucode/microcode_amd.bin +* +* This legacy file is always smaller than 2K in size. +* +* Starting at family 15h they are in family specific firmware files: +* +* amd-ucode/microcode_amd_fam15h.bin +* amd-ucode/microcode_amd_fam16h.bin +* ... +* +* These might be larger than 2K. +*/ static enum ucode_state request_microcode_amd (int cpu,struct device *device) { -const char *fw_name ="amd-ucode/microcode_amd.bin" ; +char fw_name[36 ] ="amd-ucode/microcode_amd.bin" ;const struct firmware *fw;enum ucode_state ret =UCODE_NFOUND ; +struct cpuinfo_x86 *c = &cpu_data (cpu); -if (request_firmware (&fw, fw_name, device)) { +if (c->x86 >=0x15 ) +snprintf (fw_name,sizeof (fw_name),"amd-ucode/microcode_amd_fam%.2xh.bin" , c->x86); + +if (request_firmware (&fw, (const char *)fw_name, device)) {pr_err ("failed to load file %s\n" , fw_name); goto out; }
Greg KH
maintainerPATCH 26/89 m68k: Fix assembler constraint to prevent overeager gcc optimisation
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Schwab <[email protected]>
commit 2a3535069e33d8b416f406c159ce924427315303 upstream.
Passing the address of a variable as an operand to an asm statement doesn't mark the value of this variable as used, so gcc may optimize its initialisation away. Fix this by using the "m" constraint instead.
--- arch/m68k/atari/config.c | 8 ++++---- arch/m68k/kernel/process_mm.c | 4 ++-- arch/m68k/kernel/process_no.c | 4 ++-- arch/m68k/kernel/traps.c | 36 +++++++++++++++++------------------- arch/m68k/mm/cache.c | 6 +++--- 5 files changed, 28 insertions(+), 30 deletions(-)
arch/m68k/atari/config.c +4 -4
@@ -414,9 +414,9 @@ void __init config_atari(void)* FDC val = 4 -> Supervisor only */ asmvolatile ("\n" " .chip 68030\n" -" pmove %0@,%/tt1\n" +" pmove %0,%/tt1\n" " .chip 68k" - : :"a" (&tt1_val)); + : :"m" (tt1_val)); }else { asmvolatile ("\n" " .chip 68040\n"
@@ -569,10 +569,10 @@ static void atari_reset(void) : "d0"); }else asmvolatile ("\n" -" pmove %0@,%%tc\n" +" pmove %0,%%tc\n" " jmp %1@" :/* no outputs */ - :"a" (&tc_val),"a" (reset_addr)); + :"m" (tc_val),"a" (reset_addr)); }
arch/m68k/kernel/process_mm.c +2 -2
@@ -189,8 +189,8 @@ void flush_thread(void) current->thread.fs = __USER_DS;if (!FPU_IS_EMU ) asmvolatile (".chip 68k/68881\n\t" -"frestore %0@\n\t" -".chip 68k" : :"a" (&zero)); +"frestore %0\n\t" +".chip 68k" : :"m" (zero)); }/*
arch/m68k/kernel/process_no.c +2 -2
@@ -163,8 +163,8 @@ void flush_thread(void)#ifdef CONFIG_FPU if (!FPU_IS_EMU ) asmvolatile (".chip 68k/68881\n\t" -"frestore %0@\n\t" -".chip 68k" : :"a" (&zero)); +"frestore %0\n\t" +".chip 68k" : :"m" (zero));#endif }
arch/m68k/kernel/traps.c +17 -19
@@ -552,13 +552,13 @@ static inline void bus_error030 (struct#ifdef DEBUG asmvolatile ("ptestr %3,%2@,#7,%0\n\t" -"pmove %%psr,%1@" - :"=a&" (desc) - :"a" (&temp),"a" (addr),"d" (ssw)); +"pmove %%psr,%1" + :"=a&" (desc),"=m" (temp) + :"a" (addr),"d" (ssw));#else asmvolatile ("ptestr %2,%1@,#7\n\t" -"pmove %%psr,%0@" - : :"a" (&temp),"a" (addr),"d" (ssw)); +"pmove %%psr,%0" + :"=m" (temp) :"a" (addr),"d" (ssw));#endif mmusr = temp;
@@ -605,20 +605,18 @@ static inline void bus_error030 (struct !(ssw &RW ) ?"write" :"read" , addr, fp->ptregs.pc, ssw); asmvolatile ("ptestr #1,%1@,#0\n\t" -"pmove %%psr,%0@" - :/* no outputs */ - :"a" (&temp),"a" (addr)); +"pmove %%psr,%0" + :"=m" (temp) + :"a" (addr)); mmusr = temp;printk ("level 0 mmusr is %#x\n" , mmusr);#if 0 - asmvolatile ("pmove %%tt0,%0@" - :/* no outputs */ - :"a" (&tlong)); + asmvolatile ("pmove %%tt0,%0" + :"=m" (tlong));printk ("tt0 is %#lx, " , tlong); - asmvolatile ("pmove %%tt1,%0@" - :/* no outputs */ - :"a" (&tlong)); + asmvolatile ("pmove %%tt1,%0" + :"=m" (tlong));printk ("tt1 is %#lx\n" , tlong);#endif #ifdef DEBUG
@@ -668,13 +666,13 @@ static inline void bus_error030 (struct#ifdef DEBUG asmvolatile ("ptestr #1,%2@,#7,%0\n\t" -"pmove %%psr,%1@" - :"=a&" (desc) - :"a" (&temp),"a" (addr)); +"pmove %%psr,%1" + :"=a&" (desc),"=m" (temp) + :"a" (addr));#else asmvolatile ("ptestr #1,%1@,#7\n\t" -"pmove %%psr,%0@" - : :"a" (&temp),"a" (addr)); +"pmove %%psr,%0" + :"=m" (temp) :"a" (addr));#endif mmusr = temp;
arch/m68k/mm/cache.c +3 -3
@@ -52,9 +52,9 @@ static unsigned long virt_to_phys_slow(uunsigned long *descaddr; asmvolatile ("ptestr %3,%2@,#7,%0\n\t" -"pmove %%psr,%1@" - :"=a&" (descaddr) - :"a" (&mmusr),"a" (vaddr),"d" (get_fs ().seg)); +"pmove %%psr,%1" + :"=a&" (descaddr),"=m" (mmusr) + :"a" (vaddr),"d" (get_fs ().seg));if (mmusr & (MMU_I |MMU_B |MMU_L ))return 0 ; descaddr =phys_to_virt ((unsigned long )descaddr);
Greg KH
maintainerPATCH 27/89 ALSA: hda: set mute led polarity for laptops with buggy BIOS based on SSID
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gustavo Maciel Dias Vieira <[email protected]>
commit a6a600d10aaddf1da38053c4c6b64f50f56176e6 upstream.
HP laptop models with buggy BIOS are apparently frequent, including machines with different codecs. Set the polarity of the mute led based on the SSID and include an entry for the HP Mini 110-3100.
--- sound/pci/hda/patch_sigmatel.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
sound/pci/hda/patch_sigmatel.c +8 -1
@@ -4952,7 +4952,14 @@ static int find_mute_led_gpio(struct hda/* BIOS bug: unfilled OEM string */ if (strstr (dev->name,"HP_Mute_LED_P_G" )) {set_hp_led_gpio (codec); - spec->gpio_led_polarity =1 ; +switch (codec->subsystem_id) { +case 0x103c148a : + spec->gpio_led_polarity =0 ; +break ; +default : + spec->gpio_led_polarity =1 ; +break ; + }return 1 ; } }
Greg KH
maintainerPATCH 28/89 ALSA: hda - Fix silent output on ASUS A6Rp
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 3b25eb690e8c7424eecffe1458c02b87b32aa001 upstream.
The refactoring of Realtek codec driver in 3.2 kernel caused a regression for ASUS A6Rp laptop; it doesn't give any output. The reason was that this machine has a secret master mute (or EAPD) control via NID 0x0f VREF. Setting VREF50 on this node makes the sound working again.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=42588
--- sound/pci/hda/patch_realtek.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
sound/pci/hda/patch_realtek.c +10 -0
@@ -5223,6 +5223,7 @@ static const struct hda_amp_list alc861_/* Pin config fixes */ enum {PINFIX_FSC_AMILO_PI1505 , +PINFIX_ASUS_A6RP , };static const struct alc_fixup alc861_fixups[] = {
@@ -5234,9 +5235,18 @@ static const struct alc_fixup alc861_fix { } } }, + [PINFIX_ASUS_A6RP ] = { + .type =ALC_FIXUP_VERBS , + .v.verbs = (const struct hda_verb []) { +/* node 0x0f VREF seems controlling the master output */ + {0x0f ,AC_VERB_SET_PIN_WIDGET_CONTROL ,PIN_VREF50 }, + { } + }, + }, };static const struct snd_pci_quirk alc861_fixup_tbl[] = { +SND_PCI_QUIRK (0x1043 ,0x1393 ,"ASUS A6Rp" ,PINFIX_ASUS_A6RP ),SND_PCI_QUIRK (0x1734 ,0x10c7 ,"FSC Amilo Pi1505" ,PINFIX_FSC_AMILO_PI1505 ), {} };
Greg KH
maintainerPATCH 29/89 ALSA: hda - Fix silent output on Haier W18 laptop
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit b3a81520bd37a28f77cb0f7002086fb14061824d upstream.
The very same problem is seen on Haier W18 laptop with ALC861 as seen on ASUS A6Rp, which was fixed by the commit 3b25eb69.
Now we just need to add a new SSID entry pointing to the same fixup.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=42656
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -5247,6 +5247,7 @@ static const struct alc_fixup alc861_fixstatic const struct snd_pci_quirk alc861_fixup_tbl[] = {SND_PCI_QUIRK (0x1043 ,0x1393 ,"ASUS A6Rp" ,PINFIX_ASUS_A6RP ), +SND_PCI_QUIRK (0x1584 ,0x2b01 ,"Haier W18" ,PINFIX_ASUS_A6RP ),SND_PCI_QUIRK (0x1734 ,0x10c7 ,"FSC Amilo Pi1505" ,PINFIX_FSC_AMILO_PI1505 ), {} };
Greg KH
maintainerPATCH 30/89 drm/i915: paper over missed irq issues with force wake voodoo
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Vetter <[email protected]>
commit 4cd53c0c8b01fc05c3ad5b2acdad02e37d3c2f55 upstream.
Two things seem to do the trick on my ivb machine here:
- prevent the gt from powering down while waiting for seqno notification interrupts by grabbing the force_wake in get_irq (and dropping it in put_irq again).
- ordering writes from the ring's CS by reading a CS register, ACTHD seems to work.
Only the blt&bsd ring on ivb seem to be massively affected by this, but for paranoia do this dance also on the render ring and on snb (i.e. all gpus with forcewake).
Tested with Eric's glCopyPixels loop which without this patch scores a missed irq every few seconds.
This patch needs my forcewake rework to use a spinlock instead of dev->struct_mutex.
After crawling through docs a lot I've found the following nugget:
Internal doc "SNB GT PM Programming Guide", Section 4.3.1:
"GT does not generate interrupts while in RC6 (by design)"
So it looks like rc6 and irq generation are indeed related.
v2: Improve the comment per Eugeni Dodonov's suggestion.
v3: Add the documentation snipped. Also restrict the w/a to ivb only for -fixes, as suggested by Keith Packard.
--- drivers/gpu/drm/i915/intel_ringbuffer.c | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/intel_ringbuffer.c +25 -2
@@ -631,6 +631,19 @@ render_ring_add_request(struct intel_rin }static u32 +gen6_ring_get_seqno (struct intel_ring_buffer *ring) +{ +struct drm_device *dev = ring->dev; + +/* Workaround to force correct ordering between irq and seqno writes on +* ivb (and maybe also on snb) by reading from a CS register (like +* ACTHD) before reading the status page. */ +if (IS_GEN7 (dev)) +intel_ring_get_active_head (ring); +return intel_read_status_page (ring,I915_GEM_HWS_INDEX ); +} + +static u32 ring_get_seqno (struct intel_ring_buffer *ring) {return intel_read_status_page (ring,I915_GEM_HWS_INDEX );
@@ -795,6 +808,12 @@ gen6_ring_get_irq(struct intel_ring_buffif (!dev->irq_enabled)return false; +/* It looks like we need to prevent the gt from suspending while waiting +* for an notifiy irq, otherwise irqs seem to get lost on at least the +* blt/bsd rings on ivb. */ +if (IS_GEN7 (dev)) +gen6_gt_force_wake_get (dev_priv); +spin_lock (&ring->irq_lock);if (ring->irq_refcount++ ==0 ) { ring->irq_mask &= ~rflag;
@@ -819,6 +838,9 @@ gen6_ring_put_irq(struct intel_ring_buffironlake_disable_irq (dev_priv, gflag); }spin_unlock (&ring->irq_lock); + +if (IS_GEN7 (dev)) +gen6_gt_force_wake_put (dev_priv); } static bool
@@ -1316,7 +1338,7 @@ static const struct intel_ring_buffer ge .write_tail = gen6_bsd_ring_write_tail, .flush = gen6_ring_flush, .add_request = gen6_add_request, - .get_seqno = ring_get_seqno, + .get_seqno = gen6_ring_get_seqno, .irq_get = gen6_bsd_ring_get_irq, .irq_put = gen6_bsd_ring_put_irq, .dispatch_execbuffer = gen6_ring_dispatch_execbuffer,
@@ -1451,7 +1473,7 @@ static const struct intel_ring_buffer ge .write_tail = ring_write_tail, .flush = blt_ring_flush, .add_request = gen6_add_request, - .get_seqno = ring_get_seqno, + .get_seqno = gen6_ring_get_seqno, .irq_get = blt_ring_get_irq, .irq_put = blt_ring_put_irq, .dispatch_execbuffer = gen6_ring_dispatch_execbuffer,
@@ -1474,6 +1496,7 @@ int intel_init_render_ring_buffer(struct ring->flush = gen6_render_ring_flush; ring->irq_get = gen6_render_ring_get_irq; ring->irq_put = gen6_render_ring_put_irq; + ring->get_seqno = gen6_ring_get_seqno; }else if (IS_GEN5 (dev)) { ring->add_request = pc_render_add_request; ring->get_seqno = pc_render_get_seqno;
Greg KH
maintainerPATCH 31/89 drm/i915/sdvo: always set positive sync polarity
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paulo Zanoni <[email protected]>
commit ba68e086223a5f149f37bf8692c8cdbf1b0ba3ef upstream.
This is a revert of 81a14b46846fea0741902e8d8dfcc6c6c78154c8.
We already set the mode polarity using the SDVO commands with struct intel_sdvo_dtd. We have at least 3 bugs that get fixed with this patch. The documentation, despite not clear, can also be interpreted in a way that suggests this patch is needed.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=15766
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=42174
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=43333
--- drivers/gpu/drm/i915/intel_sdvo.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/intel_sdvo.c +3 -5
@@ -1066,15 +1066,13 @@ static void intel_sdvo_mode_set(struct d/* Set the SDVO control regs. */ if (INTEL_INFO (dev)->gen >=4 ) { - sdvox =0 ; +/* The real mode polarity is set by the SDVO commands, using +* struct intel_sdvo_dtd. */ + sdvox =SDVO_VSYNC_ACTIVE_HIGH |SDVO_HSYNC_ACTIVE_HIGH ;if (intel_sdvo->is_hdmi) sdvox |= intel_sdvo->color_range;if (INTEL_INFO (dev)->gen <5 ) sdvox |=SDVO_BORDER_ENABLE ; -if (adjusted_mode->flags &DRM_MODE_FLAG_PVSYNC ) - sdvox |=SDVO_VSYNC_ACTIVE_HIGH ; -if (adjusted_mode->flags &DRM_MODE_FLAG_PHSYNC ) - sdvox |=SDVO_HSYNC_ACTIVE_HIGH ; }else { sdvox =I915_READ (intel_sdvo->sdvo_reg);switch (intel_sdvo->sdvo_reg) {
Greg KH
maintainerPATCH 32/89 drm/i915: Re-enable gen7 RC6 and GPU turbo after resume.
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Anholt <[email protected]>
commit 04115a9dee110b52a8eaa556c574022fa3bf4704 upstream.
--- drivers/gpu/drm/i915/i915_suspend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/i915_suspend.c +2 -2
@@ -822,7 +822,7 @@ int i915_save_state(struct drm_device *dif (IS_IRONLAKE_M (dev))ironlake_disable_drps (dev); -if (IS_GEN6 (dev)) +if (INTEL_INFO (dev)->gen >=6 )gen6_disable_rps (dev);/* Cache mode state */
@@ -881,7 +881,7 @@ int i915_restore_state(struct drm_deviceintel_init_emon (dev); } -if (IS_GEN6 (dev)) { +if (INTEL_INFO (dev)->gen >=6 ) {gen6_enable_rps (dev_priv);gen6_update_ring_freq (dev_priv); }
Greg KH
maintainerPATCH 33/89 ARM: at91: fix at91rm9200 soc subtype handling
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nicolas Ferre <[email protected]>
commit 3e90772f76010c315474bde59eaca7cc4c94d645 upstream.
Currently setting it to PQFP changes subtype to BGA as subtypes are swapped in at91rm9200_set_type().
Wrong subtype causes GPIO bank D not to work at all.
After this fix, subtype is still set as unknown. But board code should fill it in with proper value. Another information is thus printed.
Bug discovery and first implementation made by Veli-Pekka Peltola.
--- arch/arm/mach-at91/setup.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
arch/arm/mach-at91/setup.c +5 -2
@@ -27,9 +27,12 @@ EXPORT_SYMBOL(at91_soc_initdata);void __init at91rm9200_set_type (int type) {if (type ==ARCH_REVISON_9200_PQFP ) - at91_soc_initdata.subtype =AT91_SOC_RM9200_BGA ; -else at91_soc_initdata.subtype =AT91_SOC_RM9200_PQFP ; +else + at91_soc_initdata.subtype =AT91_SOC_RM9200_BGA ; + +pr_info ("AT91: filled in soc subtype: %s\n" , +at91_get_soc_subtype (&at91_soc_initdata)); }void __init at91_init_irq_default (void )
Greg KH
maintainerPATCH 34/89 mach-ux500: enable ARM errata 764369
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Srinidhi KASAGAR <[email protected]>
commit d65015f7c5c5be9fd3f5e567889c844ba81bdc9c upstream.
This applies ARM errata 764369 for all ux500 platforms.
--- arch/arm/mach-ux500/Kconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm/mach-ux500/Kconfig +1 -0
@@ -7,6 +7,7 @@ config UX500_SOC_COMMON select HAS_MTU select ARM_ERRATA_753970 select ARM_ERRATA_754322 + select ARM_ERRATA_764369 menu "Ux500 SoC"
Greg KH
maintainerPATCH 35/89 ARM: 7296/1: proc-v7.S: remove HARVARD_CACHE preprocessor guards
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Will Deacon <[email protected]>
commit 612539e81f655f6ac73c7af1da8701c1ee618aee upstream.
On v7, we use the same cache maintenance instructions for data lines as for unified lines. This was not the case for v6, where HARVARD_CACHE was defined to indicate the L1 cache topology.
This patch removes the erroneous compile-time check for HARVARD_CACHE in proc-v7.S, ensuring that we perform I-side invalidation at boot.
--- arch/arm/mm/proc-v7.S | 6 ------ 1 file changed, 6 deletions(-)
arch/arm/mm/proc-v7.S +0 -6
@@ -271,10 +271,6 @@ ENDPROC(cpu_v7_do_resume) * Initialise TLB, Caches, and MMU state ready to switch the MMU * on. Return in r0 the new CP15 C1 control register setting. * - * We automatically detect if we have a Harvard cache, and use the - * Harvard cache control instructions insead of the unified cache - * control instructions. - * * This should be able to cover all ARMv7 cores. * * It is assumed that:
@@ -373,9 +369,7 @@ __v7_setup: #endif 3: mov r10, #0 -#ifdef HARVARD_CACHE mcr p15, 0, r10, c7, c5, 0 @ I+BTB cache invalidate -#endif dsb #ifdef CONFIG_MMU mcr p15, 0, r10, c8, c7, 0 @ invalidate I + D TLBs
Greg KH
maintainerPATCH 36/89 sysfs: Complain bitterly about attempts to remove files from nonexistent directories.
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit ce597919361dcec97341151690e780eade2a9cf4 upstream.
Recently an OOPS was observed from the usb serial io_ti driver when it tried to remove sysfs directories. Upon investigation it turns out this driver was always buggy and that a recent sysfs change had stopped guarding itself against removing attributes from sysfs directories that had already been removed. :(
Historically we have been silent about attempting to files from nonexistent sysfs directories and have politely returned error codes. That has resulted in people writing broken code that ignores the error codes.
Issue a kernel WARNING and a stack backtrace to make it clear in no uncertain terms that abusing sysfs is not ok, and the callers need to fix their code.
This change transforms the io_ti OOPS into a more comprehensible error message and stack backtrace.
--- fs/sysfs/file.c | 6 ++++++ fs/sysfs/inode.c | 5 ++++- 2 files changed, 10 insertions(+), 1 deletion(-)
fs/sysfs/file.c +6 -0
@@ -493,6 +493,12 @@ int sysfs_attr_ns(struct kobject *kobj,const void *ns =NULL ;int err; +if (!dir_sd) { +WARN (1 ,KERN_ERR "sysfs: kobject %s without dirent\n" , +kobject_name (kobj)); +return -ENOENT ; + } + err =0 ;if (!sysfs_ns_type (dir_sd)) goto out;
fs/sysfs/inode.c +4 -1
@@ -318,8 +318,11 @@ int sysfs_hash_and_remove(struct sysfs_dstruct sysfs_addrm_cxt acxt;struct sysfs_dirent *sd; -if (!dir_sd) +if (!dir_sd) { +WARN (1 ,KERN_WARNING "sysfs: can not remove '%s', no directory\n" , + name);return -ENOENT ; + }sysfs_addrm_start (&acxt, dir_sd);
Greg KH
maintainerPATCH 37/89 x86: xen: size struct xen_spinlock to always fit in arch_spinlock_t
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Vrabel <[email protected]>
commit 7a7546b377bdaa25ac77f33d9433c59f259b9688 upstream.
If NR_CPUS < 256 then arch_spinlock_t is only 16 bits wide but struct xen_spinlock is 32 bits. When a spin lock is contended and xl->spinners is modified the two bytes immediately after the spin lock would be corrupted.
This is a regression caused by 84eb950db13ca40a0572ce9957e14723500943d6 (x86, ticketlock: Clean up types and accessors) which reduced the size of arch_spinlock_t.
Fix this by making xl->spinners a u8 if NR_CPUS < 256. A BUILD_BUG_ON() is also added to check the sizes of the two structures are compatible.
In many cases this was not noticable as there would often be padding bytes after the lock (e.g., if any of CONFIG_GENERIC_LOCKBREAK, CONFIG_DEBUG_SPINLOCK, or CONFIG_DEBUG_LOCK_ALLOC were enabled).
The bnx2 driver is affected. In struct bnx2, phy_lock and indirect_lock may have no padding after them. Contention on phy_lock would corrupt indirect_lock making it appear locked and the driver would deadlock.
--- arch/x86/xen/spinlock.c | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-)
arch/x86/xen/spinlock.c +22 -5
@@ -116,9 +116,26 @@ static inline void spin_time_accum_block }#endif /* CONFIG_XEN_DEBUG_FS */ +/* +* Size struct xen_spinlock so it's the same as arch_spinlock_t. +*/ +#if NR_CPUS <256 +typedef u8 xen_spinners_t ; +# define inc_spinners (xl) \ + asm(LOCK_PREFIX " incb %0" : "+m" ((xl)->spinners) : : "memory"); +# define dec_spinners (xl) \ + asm(LOCK_PREFIX " decb %0" : "+m" ((xl)->spinners) : : "memory"); +#else +typedef u16 xen_spinners_t ; +# define inc_spinners (xl) \ + asm(LOCK_PREFIX " incw %0" : "+m" ((xl)->spinners) : : "memory"); +# define dec_spinners (xl) \ + asm(LOCK_PREFIX " decw %0" : "+m" ((xl)->spinners) : : "memory"); +#endif +struct xen_spinlock {unsigned char lock;/* 0 -> free; 1 -> locked */ -unsigned short spinners;/* count of waiting cpus */ +xen_spinners_t spinners;/* count of waiting cpus */ };static int xen_spin_is_locked (struct arch_spinlock *lock)
@@ -164,8 +181,7 @@ static inline struct xen_spinlock *spinnwmb ();/* set lock of interest before count */ - asm(LOCK_PREFIX " incw %0" - :"+m" (xl->spinners) : :"memory" ); +inc_spinners (xl);return prev; }
@@ -176,8 +192,7 @@ static inline struct xen_spinlock *spinn*/ static inline void unspinning_lock (struct xen_spinlock *xl,struct xen_spinlock *prev) { - asm(LOCK_PREFIX " decw %0" - :"+m" (xl->spinners) : :"memory" ); +dec_spinners (xl);wmb ();/* decrement count before restoring lock */ __this_cpu_write (lock_spinners, prev); }
@@ -373,6 +388,8 @@ void xen_uninit_lock_cpu(int cpu)void __init xen_init_spinlocks (void ) { +BUILD_BUG_ON (sizeof (struct xen_spinlock ) >sizeof (arch_spinlock_t)); + pv_lock_ops.spin_is_locked = xen_spin_is_locked; pv_lock_ops.spin_is_contended = xen_spin_is_contended; pv_lock_ops.spin_lock = xen_spin_lock;
Greg KH
maintainerPATCH 38/89 mpt2sas: Removed redundant calling of _scsih_probe_devices() from _scsih_probe
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: "[email protected]" <[email protected]>
commit 2cb6fc8c014b9b00c4487a79b8f6ed0da4121f45 upstream.
Removed redundant calling of _scsih_probe_devices() from _scsih_probe as it is getting called from _scsih_scan_finished.
Also moved the function scsi_scan_host(shost) to get called after the volumes on warp drive are reported to the OS. Otherwise by the time the (ioc->hide_drives) flags is set, the volumes on warp drive are reported to the OS already.
Also modified the initialization of reply queues only in case of driver load time in the function _base_make_ioc_operational().
--- drivers/scsi/mpt2sas/mpt2sas_base.c | 20 +++++++------------- drivers/scsi/mpt2sas/mpt2sas_scsih.c | 3 +-- 2 files changed, 8 insertions(+), 15 deletions(-)
drivers/scsi/mpt2sas/mpt2sas_base.c +7 -13
@@ -4033,7 +4033,8 @@ _base_make_ioc_operational(struct MPT2SA ioc->reply_free[i] =cpu_to_le32 (reply_address);/* initialize reply queues */ -_base_assign_reply_queues (ioc); +if (ioc->is_driver_loading) +_base_assign_reply_queues (ioc);/* initialize Reply Post Free Queue */ reply_post_free = (long )ioc->reply_post_free;
@@ -4081,24 +4082,17 @@ _base_make_ioc_operational(struct MPT2SAif (ioc->is_driver_loading) { - - - - ioc->wait_for_discovery_to_complete = -_base_determine_wait_on_discovery (ioc); -return r;/* scan_start and scan_finished support */ - } - - -if (ioc->wait_for_discovery_to_complete && ioc->is_warpdrive) { -if (ioc->manu_pg10.OEMIdentifier ==0x80 ) { +if (ioc->is_warpdrive && ioc->manu_pg10.OEMIdentifier + ==0x80 ) { hide_flag = (u8) (ioc->manu_pg10.OEMSpecificFlags0 &MFG_PAGE10_HIDE_SSDS_MASK );if (hide_flag !=MFG_PAGE10_HIDE_SSDS_MASK ) ioc->mfg_pg10_hide_flag = hide_flag; } + ioc->wait_for_discovery_to_complete = +_base_determine_wait_on_discovery (ioc); +return r;/* scan_start and scan_finished support */ } - r =_base_send_port_enable (ioc, sleep_flag);if (r)return r;
drivers/scsi/mpt2sas/mpt2sas_scsih.c +1 -2
@@ -8001,7 +8001,6 @@ _scsih_probe(struct pci_dev *pdev, const goto out_attach_fail; } -scsi_scan_host (shost);if (ioc->is_warpdrive) {if (ioc->mfg_pg10_hide_flag ==MFG_PAGE10_EXPOSE_ALL_DISKS ) ioc->hide_drives =0 ;
@@ -8015,8 +8014,8 @@ _scsih_probe(struct pci_dev *pdev, const } }else ioc->hide_drives =0 ; +scsi_scan_host (shost); -_scsih_probe_devices (ioc);return 0 ; out_attach_fail:
Greg KH
maintainerPATCH 39/89 USB: option: Add LG docomo L-02C
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kentaro Matsuyama <[email protected]>
commit e423d7401fd0717cb56a6cf51dd8341cc3e800d2 upstream.
Add vendor and product ID for USB 3G/LTE modem of docomo L-02C
--- drivers/usb/serial/option.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/usb/serial/option.c +5 -0
@@ -480,6 +480,10 @@ static void option_instat_callback(struc#define ZD_VENDOR_ID 0x0685#define ZD_PRODUCT_7000 0x7000 +/* LG products */ +#define LG_VENDOR_ID 0x1004 +#define LG_PRODUCT_L02C 0x618f +/* some devices interfaces need special handling due to a number of reasons */ enum option_blacklist_reason {OPTION_BLACKLIST_NONE =0 ,
@@ -1183,6 +1187,7 @@ static const struct usb_device_id option { USB_DEVICE(YUGA_VENDOR_ID, YUGA_PRODUCT_CLU526) }, { USB_DEVICE_AND_INTERFACE_INFO(VIETTEL_VENDOR_ID, VIETTEL_PRODUCT_VT1000, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZD_VENDOR_ID, ZD_PRODUCT_7000, 0xff, 0xff, 0xff) }, + { USB_DEVICE(LG_VENDOR_ID, LG_PRODUCT_L02C) }, /* docomo L-02C modem */ { } /* Terminating entry */ };MODULE_DEVICE_TABLE (usb, option_ids);
Greg KH
maintainerPATCH 40/89 USB: ftdi_sio: fix TIOCSSERIAL baud_base handling
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit eb833a9e0972f60beb4ab8104ad7ef6bf30f02fc upstream.
Return EINVAL if new baud_base does not match the current one.
The baud_base is device specific and can not be changed. This restores the old (pre-2005) behaviour which was changed due to a misunderstanding regarding this fact (see
https://lkml.org/lkml/2005/1/20/84).
--- drivers/usb/serial/ftdi_sio.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/usb/serial/ftdi_sio.c +1 -2
@@ -1333,8 +1333,7 @@ static int set_serial_info(struct tty_st goto check_and_exit; } -if ((new_serial.baud_base != priv->baud_base) && - (new_serial.baud_base <9600 )) { +if (new_serial.baud_base != priv->baud_base) {mutex_unlock (&priv->cfg_lock);return -EINVAL ; }
Greg KH
maintainerPATCH 41/89 USB: ftdi_sio: fix initial baud rate
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 108e02b12921078a59dcacd048079ece48a4a983 upstream.
Fix regression introduced by commit b1ffb4c851f1 ("USB: Fix Corruption issue in USB ftdi driver ftdi_sio.c") which caused the termios settings to no longer be initialised at open. Consequently it was no longer possible to set the port to the default speed of 9600 baud without first changing to another baud rate and back again.
--- drivers/usb/serial/ftdi_sio.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/usb/serial/ftdi_sio.c +5 -2
@@ -1823,6 +1823,7 @@ static int ftdi_sio_port_remove(struct ustatic int ftdi_open (struct tty_struct *tty,struct usb_serial_port *port) { +struct ktermios dummy;struct usb_device *dev = port->serial->dev;struct ftdi_private *priv =usb_get_serial_port_data (port);int result;
@@ -1841,8 +1842,10 @@ static int ftdi_open(struct tty_struct *This is same behaviour as serial.c/rs_open() - Kuba */ /* ftdi_set_termios will send usb control messages */ -if (tty) -ftdi_set_termios (tty, port, tty->termios); +if (tty) { +memset (&dummy,0 ,sizeof (dummy)); +ftdi_set_termios (tty, port, &dummy); + }/* Start reading from the device */ result =usb_serial_generic_open (tty, port);
Greg KH
maintainerPATCH 42/89 USB: ftdi_sio: add PID for TI XDS100v2 / BeagleBone A3
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Korsgaard <[email protected]>
commit 55f13aeae0346f0c89bfface91ad9a97653dc433 upstream.
Port A for JTAG, port B for serial.
--- drivers/usb/serial/ftdi_sio.c | 2 ++ drivers/usb/serial/ftdi_sio_ids.h | 7 +++++++ 2 files changed, 9 insertions(+)
drivers/usb/serial/ftdi_sio.c +2 -0
@@ -805,6 +805,8 @@ static struct usb_device_id id_table_com { USB_DEVICE(BAYER_VID, BAYER_CONTOUR_CABLE_PID) }, { USB_DEVICE(FTDI_VID, MARVELL_OPENRD_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, + { USB_DEVICE(FTDI_VID, TI_XDS100V2_PID), + .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(FTDI_VID, HAMEG_HO820_PID) }, { USB_DEVICE(FTDI_VID, HAMEG_HO720_PID) }, { USB_DEVICE(FTDI_VID, HAMEG_HO730_PID) },
drivers/usb/serial/ftdi_sio_ids.h +7 -0
@@ -39,6 +39,13 @@/* www.candapter.com Ewert Energy Systems CANdapter device */ #define FTDI_CANDAPTER_PID 0x9F80/* Product Id */ +/* +* Texas Instruments XDS100v2 JTAG / BeagleBone A3 +* http://processors.wiki.ti.com/index.php/XDS100 +* http://beagleboard.org/bone +*/ +#define TI_XDS100V2_PID 0xa6d0 +#define FTDI_NXTCAM_PID 0xABB8/* NXTCam for Mindstorms NXT */ /* US Interface Navigator (http://www.usinterface.com/) */
Greg KH
maintainerPATCH 43/89 USB: serial: ftdi additional IDs
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Peter Naulls <[email protected]>
commit fc216ec363f4d174932df90bbf35c77d0540e561 upstream.
I tested this against 2.6.39 in the Ubuntu kernel, however I see the IDs are not in latest 3.2 git.
This adds IDs for the FTDI controller in the Rainforest Automation Zigbee dongle.
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++ 2 files changed, 7 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -843,6 +843,7 @@ static struct usb_device_id id_table_com .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(ST_VID, ST_STMCLT1030_PID), .driver_info = (kernel_ulong_t)&ftdi_stmclite_quirk }, + { USB_DEVICE(FTDI_VID, FTDI_RF_R106) }, { }, /* Optional parameter entry */ { }/* Terminating entry */ };
drivers/usb/serial/ftdi_sio_ids.h +6 -0
@@ -1175,3 +1175,9 @@*/ /* TagTracer MIFARE*/ #define FTDI_ZEITCONTROL_TAGTRACE_MIFARE_PID 0xF7C0 + +/* +* Rainforest Automation +*/ +/* ZigBee controller */ +#define FTDI_RF_R106 0x8A28
Greg KH
maintainerPATCH 44/89 USB: ftdi_sio: Add more identifiers
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Cox <[email protected]>
commit 2353f806c97020d4c7709f15eebb49b591f7306d upstream.
0x04d8, 0x000a: Hornby Elite
--- drivers/usb/serial/ftdi_sio.c | 1 + drivers/usb/serial/ftdi_sio_ids.h | 6 ++++++ 2 files changed, 7 insertions(+)
drivers/usb/serial/ftdi_sio.c +1 -0
@@ -797,6 +797,7 @@ static struct usb_device_id id_table_com .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, { USB_DEVICE(ADI_VID, ADI_GNICEPLUS_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk }, + { USB_DEVICE(HORNBY_VID, HORNBY_ELITE_PID) }, { USB_DEVICE(JETI_VID, JETI_SPC1201_PID) }, { USB_DEVICE(MARVELL_VID, MARVELL_SHEEVAPLUG_PID), .driver_info = (kernel_ulong_t)&ftdi_jtag_quirk },
drivers/usb/serial/ftdi_sio_ids.h +6 -0
@@ -532,6 +532,12 @@#define ADI_GNICEPLUS_PID 0xF001/* +* Hornby Elite +*/ +#define HORNBY_VID 0x04D8 +#define HORNBY_ELITE_PID 0x000A + +/* * RATOC REX-USB60F */ #define RATOC_VENDOR_ID 0x0584
Greg KH
maintainerPATCH 45/89 USB: cdc-wdm: updating desc->length must be protected by spin_lock
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit c428b70c1e115c5649707a602742e34130d19428 upstream.
wdm_in_callback() will also touch this field, so we cannot change it without locking
--- drivers/usb/class/cdc-wdm.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/class/cdc-wdm.c +2 -0
@@ -467,7 +467,9 @@ retry:for (i =0 ; i < desc->length - cntr; i++) desc->ubuf[i] = desc->ubuf[i + cntr]; +spin_lock_irq (&desc->iuspin); desc->length -= cntr; +spin_unlock_irq (&desc->iuspin);/* in case we had outstanding data */ if (!desc->length)clear_bit (WDM_READ , &desc->flags);
Greg KH
maintainerPATCH 46/89 USB: cdc-wdm: use two mutexes to allow simultaneous read and write
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit e8537bd2c4f325a4796da33564ddcef9489b7feb upstream.
using a separate read and write mutex for locking is sufficient to make the driver accept simultaneous read and write. This improves useability a lot.
--- drivers/usb/class/cdc-wdm.c | 49 +++++++++++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 18 deletions(-)
drivers/usb/class/cdc-wdm.c +31 -18
@@ -88,7 +88,8 @@ struct wdm_device {int count;dma_addr_t shandle;dma_addr_t ihandle; -struct mutex lock; +struct mutex wlock; +struct mutex rlock;wait_queue_head_t wait;struct work_struct rxwork;int werr;
@@ -323,7 +324,7 @@ static ssize_t wdm_write }/* concurrent writes and disconnect */ - r =mutex_lock_interruptible (&desc->lock); + r =mutex_lock_interruptible (&desc->wlock); rv = -ERESTARTSYS ;if (r) {kfree (buf);
@@ -386,7 +387,7 @@ static ssize_t wdm_write out:usb_autopm_put_interface (desc->intf); outnp: -mutex_unlock (&desc->lock); +mutex_unlock (&desc->wlock); outnl:return rv <0 ? rv : count; }
@@ -399,7 +400,7 @@ static ssize_t wdm_readstruct wdm_device *desc = file->private_data; - rv =mutex_lock_interruptible (&desc->lock);/*concurrent reads */ + rv =mutex_lock_interruptible (&desc->rlock);/*concurrent reads */ if (rv <0 )return -ERESTARTSYS ;
@@ -476,7 +477,7 @@ retry: rv = cntr; err: -mutex_unlock (&desc->lock); +mutex_unlock (&desc->rlock);return rv; }
@@ -542,7 +543,8 @@ static int wdm_open(struct inode *inode, } intf->needs_remote_wakeup =1 ; -mutex_lock (&desc->lock); +/* using write lock to protect desc->count */ +mutex_lock (&desc->wlock);if (!desc->count++) { desc->werr =0 ; desc->rerr =0 ;
@@ -555,7 +557,7 @@ static int wdm_open(struct inode *inode, }else { rv =0 ; } -mutex_unlock (&desc->lock); +mutex_unlock (&desc->wlock);usb_autopm_put_interface (desc->intf); out:mutex_unlock (&wdm_mutex);
@@ -567,9 +569,11 @@ static int wdm_release(struct inode *inostruct wdm_device *desc = file->private_data;mutex_lock (&wdm_mutex); -mutex_lock (&desc->lock); + +/* using write lock to protect desc->count */ +mutex_lock (&desc->wlock); desc->count--; -mutex_unlock (&desc->lock); +mutex_unlock (&desc->wlock);if (!desc->count) {dev_dbg (&desc->intf->dev,"wdm_release: cleanup" );
@@ -667,7 +671,8 @@ next_desc: desc =kzalloc (sizeof (struct wdm_device ),GFP_KERNEL );if (!desc) goto out; -mutex_init (&desc->lock); +mutex_init (&desc->rlock); +mutex_init (&desc->wlock);spin_lock_init (&desc->iuspin);init_waitqueue_head (&desc->wait); desc->wMaxCommand = maxcom;
@@ -781,10 +786,12 @@ static void wdm_disconnect(struct usb_in/* to terminate pending flushes */ clear_bit (WDM_IN_USE , &desc->flags);spin_unlock_irqrestore (&desc->iuspin, flags); -mutex_lock (&desc->lock); +mutex_lock (&desc->rlock); +mutex_lock (&desc->wlock);kill_urbs (desc);cancel_work_sync (&desc->rxwork); -mutex_unlock (&desc->lock); +mutex_unlock (&desc->wlock); +mutex_unlock (&desc->rlock);wake_up_all (&desc->wait);if (!desc->count)cleanup (desc);
@@ -800,8 +807,10 @@ static int wdm_suspend(struct usb_interfdev_dbg (&desc->intf->dev,"wdm%d_suspend\n" , intf->minor);/* if this is an autosuspend the caller does the locking */ -if (!PMSG_IS_AUTO (message)) -mutex_lock (&desc->lock); +if (!PMSG_IS_AUTO (message)) { +mutex_lock (&desc->rlock); +mutex_lock (&desc->wlock); + }spin_lock_irq (&desc->iuspin); if (PMSG_IS_AUTO(message) &&
@@ -817,8 +826,10 @@ static int wdm_suspend(struct usb_interfkill_urbs (desc);cancel_work_sync (&desc->rxwork); } -if (!PMSG_IS_AUTO (message)) -mutex_unlock (&desc->lock); +if (!PMSG_IS_AUTO (message)) { +mutex_unlock (&desc->wlock); +mutex_unlock (&desc->rlock); + }return rv; }
@@ -856,7 +867,8 @@ static int wdm_pre_reset(struct usb_inte {struct wdm_device *desc =usb_get_intfdata (intf); -mutex_lock (&desc->lock); +mutex_lock (&desc->rlock); +mutex_lock (&desc->wlock);kill_urbs (desc);/*
@@ -878,7 +890,8 @@ static int wdm_post_reset(struct usb_intint rv; rv =recover_from_urb_loss (desc); -mutex_unlock (&desc->lock); +mutex_unlock (&desc->wlock); +mutex_unlock (&desc->rlock);return 0 ; }
Greg KH
maintainerPATCH 47/89 qcaux: add more Pantech UML190 and UML290 ports
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 074cc73506f529f39fef32ad1c9e1d4cdd8acf6c upstream.
More ports we now know how to talk to.
--- drivers/usb/serial/qcaux.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/usb/serial/qcaux.c +6 -1
@@ -36,6 +36,7 @@#define UTSTARCOM_PRODUCT_UM175_V1 0x3712#define UTSTARCOM_PRODUCT_UM175_V2 0x3714#define UTSTARCOM_PRODUCT_UM175_ALLTEL 0x3715 +#define PANTECH_PRODUCT_UML190_VZW 0x3716#define PANTECH_PRODUCT_UML290_VZW 0x3718/* CMOTECH devices */
@@ -67,7 +68,11 @@ static struct usb_device_id id_table[] = { USB_DEVICE_AND_INTERFACE_INFO(LG_VENDOR_ID, LG_PRODUCT_VX4400_6000, 0xff, 0xff, 0x00) }, { USB_DEVICE_AND_INTERFACE_INFO(SANYO_VENDOR_ID, SANYO_PRODUCT_KATANA_LX, 0xff, 0xff, 0x00) }, { USB_DEVICE_AND_INTERFACE_INFO(SAMSUNG_VENDOR_ID, SAMSUNG_PRODUCT_U520, 0xff, 0x00, 0x00) }, - { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML190_VZW, 0xff, 0xff, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML190_VZW, 0xff, 0xfe, 0xff) }, + { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xfd, 0xff) }, /* NMEA */ + { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xfe, 0xff) }, /* WMC */ + { USB_DEVICE_AND_INTERFACE_INFO(UTSTARCOM_VENDOR_ID, PANTECH_PRODUCT_UML290_VZW, 0xff, 0xff, 0xff) }, /* DIAG */ { }, };MODULE_DEVICE_TABLE (usb, id_table);
Greg KH
maintainerPATCH 48/89 usb: dwc3: ep0: tidy up Pending Request handling
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Felipe Balbi <[email protected]>
commit 68d8a781575d7be490f97eb2c403fb13b083da6a upstream.
The way our code was written, we should never have a DWC3_EP_PENDING_REQUEST flag set out of a Data Phase and the code in __dwc3_gadget_ep0_queue() did not reflect that situation properly.
Tidy up that case to avoid any possible mistakes when starting requests for IRQs which are long gone.
--- drivers/usb/dwc3/ep0.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-)
drivers/usb/dwc3/ep0.c +4 -10
@@ -149,20 +149,14 @@ static int __dwc3_gadget_ep0_queue(struc direction = !!(dep->flags &DWC3_EP0_DIR_IN ); -if (dwc->ep0state ==EP0_STATUS_PHASE ) { - type = dwc->three_stage_setup - ?DWC3_TRBCTL_CONTROL_STATUS3 - :DWC3_TRBCTL_CONTROL_STATUS2 ; - }else if (dwc->ep0state ==EP0_DATA_PHASE ) { - type =DWC3_TRBCTL_CONTROL_DATA ; - }else { -/* should never happen */ -WARN_ON (1 ); +if (dwc->ep0state !=EP0_DATA_PHASE ) { +dev_WARN (dwc->dev,"Unexpected pending request\n" );return 0 ; } ret =dwc3_ep0_start_trans (dwc, direction, - req->request.dma, req->request.length, type); + req->request.dma, req->request.length, +DWC3_TRBCTL_CONTROL_DATA ); dep->flags &= ~(DWC3_EP_PENDING_REQUEST |DWC3_EP0_DIR_IN ); }
Greg KH
maintainerPATCH 49/89 usb: io_ti: Make edge_remove_sysfs_attrs the port_remove method.
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
commit 6d443d8499e4e59ffb949759cdded32730f8d2f6 upstream.
Calling edge_remove_sysfs_attrs from edge_disconnect is too late as the device has already been removed from sysfs.
Do the simple and obvious thing and make edge_remove_sysfs_attrs the port_remove method.
--- drivers/usb/serial/io_ti.c | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/usb/serial/io_ti.c +2 -8
@@ -2677,15 +2677,7 @@ cleanup:static void edge_disconnect (struct usb_serial *serial) { -int i; -struct edgeport_port *edge_port; -dbg ("%s" , __func__); - -for (i =0 ; i < serial->num_ports; ++i) { - edge_port =usb_get_serial_port_data (serial->port[i]); -edge_remove_sysfs_attrs (edge_port->port); - } }static void edge_release (struct usb_serial *serial)
@@ -2764,6 +2756,7 @@ static struct usb_serial_driver edgeport .disconnect = edge_disconnect, .release = edge_release, .port_probe = edge_create_sysfs_attrs, + .port_remove = edge_remove_sysfs_attrs, .ioctl = edge_ioctl, .set_termios = edge_set_termios, .tiocmget = edge_tiocmget,
@@ -2795,6 +2788,7 @@ static struct usb_serial_driver edgeport .disconnect = edge_disconnect, .release = edge_release, .port_probe = edge_create_sysfs_attrs, + .port_remove = edge_remove_sysfs_attrs, .ioctl = edge_ioctl, .set_termios = edge_set_termios, .tiocmget = edge_tiocmget,
Greg KH
maintainerPATCH 50/89 TTY: fix UV serial console regression
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Slaby <[email protected]>
commit 0eee50af5b13e00b3fb7a5fe8480419a71b8235d upstream.
Commit 74c2107759d (serial: Use block_til_ready helper) and its fixup 3f582b8c110 (serial: fix termios settings in open) introduced a regression on UV systems. The serial eventually freezes while being used. It's completely unpredictable and sometimes needs a heap of traffic to happen first.
To reproduce this, yast installation was used as it turned out to be pretty reliable in reproducing. Especially during installation process where one doesn't have an SSH daemon running. And no monitor as the HW is completely headless. So this was fun to find. Given the machine doesn't boot on vanilla before 2.6.36 final. (And the commits above are older.)
Unless there is some bad race in the code, the hardware seems to be pretty broken. Otherwise pure MSR read should not cause such a bug, or?
So to prevent the bug, revert to the old behavior. I.e. read modem status only if we really have to -- for non-CLOCAL set serials. Non-CLOCAL works on this hardware OK, I tried. See? I don't.
And document that shit.
References: https://lkml.org/lkml/2011/12/6/573
References: https://bugzilla.novell.com/show_bug.cgi?id=718518
--- drivers/tty/tty_port.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/tty/tty_port.c +7 -5
@@ -227,7 +227,6 @@ int tty_port_block_til_ready(struct tty_int do_clocal =0 , retval;unsigned long flags;DEFINE_WAIT (wait); -int cd;/* block if port is in the process of being closed */ if (tty_hung_up_p (filp) || port->flags &ASYNC_CLOSING ) {
@@ -284,11 +283,14 @@ int tty_port_block_til_ready(struct tty_ retval = -ERESTARTSYS ;break ; } -/* Probe the carrier. For devices with no carrier detect this -will always return true */ - cd =tty_port_carrier_raised (port); +/* +* Probe the carrier. For devices with no carrier detect +* tty_port_carrier_raised will always return true. +* Never ask drivers if CLOCAL is set, this causes troubles +* on some hardware. +*/ if (!(port->flags &ASYNC_CLOSING ) && - (do_clocal || cd)) + (do_clocal ||tty_port_carrier_raised (port)))break ;if (signal_pending (current)) { retval = -ERESTARTSYS ;
Greg KH
maintainerPATCH 51/89 serial: amba-pl011: lock console writes against interrupts
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rabin Vincent <[email protected]>
commit ef605fdb33883d687cff5ba75095a91b313b4966 upstream.
Protect against pl011_console_write() and the interrupt for the console UART running concurrently on different CPUs.
Otherwise the console_write could spin for a long time waiting for the UART to become not busy, while the other CPU continuously services UART interrupts and keeps the UART busy.
The checks for sysrq and oops_in_progress are taken from 8250.c.
--- drivers/tty/serial/amba-pl011.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/tty/serial/amba-pl011.c +14 -0
@@ -1740,9 +1740,19 @@ pl011_console_write(struct console *co, {struct uart_amba_port *uap = amba_ports[co->index];unsigned int status, old_cr, new_cr; +unsigned long flags; +int locked =1 ;clk_enable (uap->clk); +local_irq_save (flags); +if (uap->port.sysrq) + locked =0 ; +else if (oops_in_progress) + locked =spin_trylock (&uap->port.lock); +else +spin_lock (&uap->port.lock); +/* * First save the CR then disable the interrupts */
@@ -1762,6 +1772,10 @@ pl011_console_write(struct console *co, }while (status & UART01x_FR_BUSY);writew (old_cr, uap->port.membase +UART011_CR ); +if (locked) +spin_unlock (&uap->port.lock); +local_irq_restore (flags); +clk_disable (uap->clk); }
Greg KH
maintainerPATCH 52/89 jsm: Fixed EEH recovery error
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lucas Kannebley Tavares <[email protected]>
commit 26aa38cafae0dbef3b2fe75ea487c83313c36d45 upstream.
There was an error on the jsm driver that would cause it to be unable to recover after a second error is detected.
At the first error, the device recovers properly:
[72521.485691] EEH: Detected PCI bus error on device 0003:02:00.0 [72521.485695] EEH: This PCI device has failed 1 times in the last hour: ... [72532.035693] ttyn3 at MMIO 0x0 (irq = 49) is a jsm [72532.105689] jsm: Port 3 added
However, at the second error, it cascades until EEH disables the device:
[72631.229549] Call Trace: ... [72641.725687] jsm: Port 3 added [72641.725695] EEH: Detected PCI bus error on device 0003:02:00.0 [72641.725698] EEH: This PCI device has failed 3 times in the last hour:
It was caused because the PCI state was not being saved after the first restore. Therefore, at the second recovery the PCI state would not be restored.
--- drivers/tty/serial/jsm/jsm_driver.c | 1 + 1 file changed, 1 insertion(+)
drivers/tty/serial/jsm/jsm_driver.c +1 -0
@@ -251,6 +251,7 @@ static void jsm_io_resume(struct pci_devstruct jsm_board *brd =pci_get_drvdata (pdev);pci_restore_state (pdev); +pci_save_state (pdev);jsm_uart_port_init (brd); }
Greg KH
maintainerPATCH 53/89 iwlwifi: fix PCI-E transport "inta" race
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit b49ba04a3a0382e7314d990707c21094c410425a upstream.
When an interrupt comes in, we read the reason bits and collect them into "trans_pcie->inta". This happens with the spinlock held. However, there's a bug resetting this variable -- that happens after the spinlock has been released. This means that it is possible for interrupts to be missed if the reset happens after some other interrupt reasons were already added to the variable.
I found this by code inspection, looking for a reason that we sometimes see random commands time out. It seems possible that this causes such behaviour, but I can't say for sure right now since it happens extremely infrequently on my test systems.
--- drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/iwlwifi/iwl-trans-pcie-rx.c +2 -2
@@ -957,11 +957,11 @@ void iwl_irq_tasklet(struct iwl_trans *t }#endif -spin_unlock_irqrestore (&trans->shrd->lock, flags); -/* saved interrupt in inta variable now we can reset trans_pcie->inta */ trans_pcie->inta =0 ; +spin_unlock_irqrestore (&trans->shrd->lock, flags); +/* Now service all interrupt bits discovered above. */ if (inta &CSR_INT_BIT_HW_ERR ) {IWL_ERR (trans,"Hardware error detected. Restarting.\n" );
Greg KH
maintainerPATCH 54/89 vmwgfx: Fix assignment in vmw_framebuffer_create_handle
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ryan Mallon <[email protected]>
commit bf9c05d5b6d19b3e4c9fe21047694e94f48db89b upstream.
The assignment of handle in vmw_framebuffer_create_handle doesn't actually do anything useful and is incorrectly assigning an integer value to a pointer argument. It appears that this is a typo and should be dereferencing handle rather than assigning to it directly. This fixes a bug where an undefined handle value is potentially returned to user-space.
--- drivers/gpu/drm/vmwgfx/vmwgfx_kms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/vmwgfx/vmwgfx_kms.c +1 -1
@@ -378,7 +378,7 @@ int vmw_framebuffer_create_handle(struct unsigned int *handle) {if (handle) - handle =0 ; + *handle =0 ;return 0 ; }
Greg KH
maintainerPATCH 55/89 USB: Realtek cr: fix autopm scheduling while atomic
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stanislaw Gruszka <[email protected]>
commit b3ef051db763b640d1ff724b616ffba940896b44 upstream.
Resolves:
https://bugzilla.redhat.com/show_bug.cgi?id=784345
--- drivers/usb/storage/realtek_cr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/storage/realtek_cr.c +1 -1
@@ -791,7 +791,7 @@ static void rts51x_suspend_timer_fn(unsirts51x_set_stat (chip,RTS51X_STAT_SS );/* ignore mass storage interface's children */ pm_suspend_ignore_children (&us->pusb_intf->dev, true); -usb_autopm_put_interface (us->pusb_intf); +usb_autopm_put_interface_async (us->pusb_intf); US_DEBUGP("%s: RTS51X_STAT_SS 01," "intf->pm_usage_cnt:%d, power.usage:%d\n", __func__,
Greg KH
maintainerPATCH 56/89 USB: usbsevseg: fix max length
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Harrison Metzger <[email protected]>
commit 1097ccebe630170080c41df0edcf88e0626e9c75 upstream.
This changes the max length for the usb seven segment delcom device to 8 from 6. Delcom has both 6 and 8 variants and having 8 works fine with devices which are only 6.
--- drivers/usb/misc/usbsevseg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/misc/usbsevseg.c +1 -1
@@ -24,7 +24,7 @@#define VENDOR_ID 0x0fc5#define PRODUCT_ID 0x1227 -#define MAXLEN 6 +#define MAXLEN 8/* table of devices that work with this driver */ static const struct usb_device_id id_table[] = {
Greg KH
maintainerPATCH 57/89 usb: gadget: langwell: dont call gadgets disconnect()
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alexander Shishkin <[email protected]>
commit 37fd37108449d574da11aa9055c5c8afb39ff226 upstream.
UDC core will call disconnect() and unbind() for us upon the gadget removal, so we should not do it ourselves. Otherwise, a composite gadget will explode, for example. Others might too.
This was introduced during conversion to new style gadget in 2c7f0989 (usb: gadget: langwell: convert to new style).
--- drivers/usb/gadget/langwell_udc.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
drivers/usb/gadget/langwell_udc.c +8 -10
@@ -1522,8 +1522,7 @@ static void langwell_udc_stop(struct lan/* stop all USB activities */ -static void stop_activity (struct langwell_udc *dev, -struct usb_gadget_driver *driver) +static void stop_activity (struct langwell_udc *dev) {struct langwell_ep *ep;dev_dbg (&dev->pdev->dev,"---> %s()\n" , __func__);
@@ -1535,9 +1534,9 @@ static void stop_activity(struct langwel }/* report disconnect; the driver is already quiesced */ -if (driver) { +if (dev->driver) {spin_unlock (&dev->lock); - driver->disconnect (&dev->gadget); + dev->driver->disconnect (&dev->gadget);spin_lock (&dev->lock); }
@@ -1925,11 +1924,10 @@ static int langwell_stop(struct usb_gadg/* stop all usb activities */ dev->gadget.speed =USB_SPEED_UNKNOWN ; -stop_activity (dev, driver); -spin_unlock_irqrestore (&dev->lock, flags); - dev->gadget.dev.driver =NULL ; dev->driver =NULL ; +stop_activity (dev); +spin_unlock_irqrestore (&dev->lock, flags);device_remove_file (&dev->pdev->dev, &dev_attr_function);
@@ -2733,7 +2731,7 @@ static void handle_usb_reset(struct lang dev->bus_reset =1 ;/* reset all the queues, stop all USB activities */ -stop_activity (dev, dev->driver); +stop_activity (dev); dev->usb_state =USB_STATE_DEFAULT ; }else {dev_vdbg (&dev->pdev->dev,"device controller reset\n" );
@@ -2741,7 +2739,7 @@ static void handle_usb_reset(struct langlangwell_udc_reset (dev);/* reset all the queues, stop all USB activities */ -stop_activity (dev, dev->driver); +stop_activity (dev);/* reset ep0 dQH and endptctrl */ ep0_reset (dev);
@@ -3367,7 +3365,7 @@ static int langwell_udc_suspend(struct pspin_lock_irq (&dev->lock);/* stop all usb activities */ -stop_activity (dev, dev->driver); +stop_activity (dev);spin_unlock_irq (&dev->lock);/* free dTD dma_pool and dQH */
Greg KH
maintainerPATCH 58/89 usb: gadget: storage: endian fix
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andiry Xu <[email protected]>
commit a85016390135d577c457876d0e905095600751de upstream.
Fix some endian issues for storage gadgets.
--- drivers/usb/gadget/storage_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/usb/gadget/storage_common.c +3 -3
@@ -598,16 +598,16 @@ static __maybe_unused struct usb_ss_cap_ | USB_5GBPS_OPERATION), .bFunctionalitySupport = USB_LOW_SPEED_OPERATION, .bU1devExitLat = USB_DEFAULT_U1_DEV_EXIT_LAT, - .bU2DevExitLat = USB_DEFAULT_U2_DEV_EXIT_LAT, + .bU2DevExitLat = cpu_to_le16(USB_DEFAULT_U2_DEV_EXIT_LAT), };static __maybe_unused struct usb_bos_descriptor fsg_bos_desc = { .bLength =USB_DT_BOS_SIZE , .bDescriptorType =USB_DT_BOS , - .wTotalLength =USB_DT_BOS_SIZE + .wTotalLength =cpu_to_le16 (USB_DT_BOS_SIZE +USB_DT_USB_EXT_CAP_SIZE - +USB_DT_USB_SS_CAP_SIZE , + +USB_DT_USB_SS_CAP_SIZE ), .bNumDeviceCaps =2 , };
Greg KH
maintainerPATCH 59/89 drivers/usb/host/ehci-fsl.c: add missing iounmap
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Julia Lawall <[email protected]>
commit 2492c6e6454ff3edb11e273b071a6ea80a199c71 upstream.
Add missing iounmap in error handling code, in a case where the function already preforms iounmap on some other execution path.
A simplified version of the semantic match that finds this problem is as
follows: (http://coccinelle.lip6.fr/)
// <smpl>
@@
expression e;
statement S,S1;
int ret;
@@
e = \(ioremap\|ioremap_nocache\)(...)
... when != iounmap(e)
if (<+...e...+>) S
... when any
when != iounmap(e)
*if (...)
{ ... when != iounmap(e)
return ...; }... when any
iounmap(e);
// </smpl>
--- drivers/usb/host/ehci-fsl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/ehci-fsl.c +1 -1
@@ -125,7 +125,7 @@ static int usb_hcd_fsl_probe(const struc*/ if (pdata->init && pdata->init (pdev)) { retval = -ENODEV ; - goto err3; + goto err4; }/* Enable USB controller, 83xx or 8536 */
Greg KH
maintainerPATCH 60/89 xhci: Fix USB 3.0 device restart on resume.
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit d0cd5d482b8a6dc92c6c69a5387baf72ea84f23a upstream.
The xHCI hub port code gets passed a zero-based port number by the USB core. It then adds one to in order to find a device slot by port number and device speed by calling xhci_find_slot_id_by_port. That function clearly states it requires a one-based port number. The xHCI port status change event handler was using a zero-based port number that it got from find_faked_portnum_from_hw_portnum, not a one-based port number. This lead to the doorbells never being rung for a device after a resume, or worse, a different device with the same speed having its doorbell rung (which could lead to bad power management in the xHCI host controller).
This patch should be backported to kernels as old as 2.6.39.
--- drivers/usb/host/xhci-ring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +2 -1
@@ -1215,6 +1215,7 @@ static void handle_vendor_event(struct x* * Returns a zero-based port number, which is suitable for indexing into each of * the split roothubs' port arrays and bus state arrays. +* Add one to it in order to call xhci_find_slot_id_by_port. */ static unsigned int find_faked_portnum_from_hw_portnum (struct usb_hcd *hcd,struct xhci_hcd *xhci,u32 port_id)
@@ -1335,7 +1336,7 @@ static void handle_port_status(struct xhxhci_set_link_state (xhci, port_array, faked_port_index,XDEV_U0 ); slot_id =xhci_find_slot_id_by_port (hcd, xhci, - faked_port_index); + faked_port_index +1 );if (!slot_id) {xhci_dbg (xhci,"slot_id is zero\n" ); goto cleanup;
Greg KH
maintainerPATCH 61/89 xHCI: Cleanup isoc transfer ring when TD length mismatch found
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andiry Xu <[email protected]>
commit cf840551a884360841bd3d3ce1ad0868ff0b759a upstream.
When a TD length mismatch is found during isoc TRB enqueue, it directly returns -EINVAL. However, isoc transfer is partially enqueued at this time, and the ring should be cleared.
This should be backported to kernels as old as 2.6.36, which contain the commit 522989a27c7badb608155b1f1dea3487ed431f74 "xhci: Fix failed enqueue in the middle of isoch TD."
--- drivers/usb/host/xhci-ring.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/usb/host/xhci-ring.c +2 -1
@@ -3373,7 +3373,8 @@ static int xhci_queue_isoc_tx(struct xhc/* Check TD length */ if (running_total != td_len) {xhci_err (xhci,"ISOC TD length unmatch\n" ); -return -EINVAL ; + ret = -EINVAL ; + goto cleanup; } }
Greg KH
maintainerPATCH 62/89 usb: musb: davinci: fix build breakage
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sekhar Nori <[email protected]>
commit 006896fc612f11bf0624db7814a75d0d5410855f upstream.
Commit 0020afb369859472a461ef4af6410732e929d402 (ARM: mach-davinci:
remove mach/memory.h) removed mach/memory.h for DaVinci which broke DaVinci MUSB build.
mach/memory.h is not actually needed in davinci.c, so remove it. While at it, also remove some more machine specific inclulde files which are not needed for build.
Tested on DM644x EVM using USB card reader.
--- drivers/usb/musb/davinci.c | 3 --- 1 file changed, 3 deletions(-)
drivers/usb/musb/davinci.c +0 -3
@@ -33,9 +33,6 @@#include <linux/platform_device.h> #include <linux/dma-mapping.h> -#include <mach/hardware.h> -#include <mach/memory.h> -#include <asm/gpio.h> #include <mach/cputype.h> #include <asm/mach-types.h>
Greg KH
maintainerPATCH 63/89 hwmon: (f71805f) Fix clamping of temperature limits
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
commit 86b2bbfdbd1fcc4a3aa62ccd3f245c40c5ad5b85 upstream.
Properly clamp temperature limits set by the user. Without this fix, attempts to write temperature limits above the maximum supported by the chip (255 degrees Celsius) would arbitrarily and unexpectedly result in the limit being set to 0 degree Celsius.
--- drivers/hwmon/f71805f.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/hwmon/f71805f.c +5 -5
@@ -283,11 +283,11 @@ static inline long temp_from_reg(u8 reg)static inline u8 temp_to_reg (long val) { -if (val <0 ) - val =0 ; -else if (val >1000 *0xff ) - val =0xff ; -return ((val +500 ) /1000 ); +if (val <=0 ) +return 0 ; +if (val >=1000 *0xff ) +return 0xff ; +return (val +500 ) /1000 ; }/*
Greg KH
maintainerPATCH 64/89 hwmon: (w83627ehf) Disable setting DC mode for pwm2, pwm3 on NCT6776F
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Guenter Roeck <[email protected]>
commit ad77c3e1808f07fa70f707b1c92a683b7c7d3f85 upstream.
NCT6776F only supports pwm mode for pwm2 and pwm3. Return error if an attempt is made to set those pwm channels to DC mode.
--- drivers/hwmon/w83627ehf.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/hwmon/w83627ehf.c +6 -0
@@ -1319,6 +1319,7 @@ store_pwm_mode(struct device *dev, struc {struct w83627ehf_data *data =dev_get_drvdata (dev);struct sensor_device_attribute *sensor_attr =to_sensor_dev_attr (attr); +struct w83627ehf_sio_data *sio_data = dev->platform_data;int nr = sensor_attr->index;unsigned long val;int err;
@@ -1330,6 +1331,11 @@ store_pwm_mode(struct device *dev, strucif (val >1 )return -EINVAL ; + +/* On NCT67766F, DC mode is only supported for pwm1 */ +if (sio_data->kind == nct6776 && nr && val !=1 ) +return -EINVAL ; +mutex_lock (&data->update_lock); reg =w83627ehf_read_value (data,W83627EHF_REG_PWM_ENABLE [nr]); data->pwm_mode[nr] = val;
Greg KH
maintainerPATCH 65/89 hwmon: (sht15) fix bad error code
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vivien Didelot <[email protected]>
commit 6edf3c30af01854c416f8654d3d5d2652470afd4 upstream.
When no platform data was supplied, returned error code was 0.
--- drivers/hwmon/sht15.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/hwmon/sht15.c +2 -1
@@ -883,7 +883,7 @@ static int sht15_invalidate_voltage(strustatic int __devinit sht15_probe (struct platform_device *pdev) { -int ret =0 ; +int ret;struct sht15_data *data =kzalloc (sizeof (*data),GFP_KERNEL );u8 status =0 ;
@@ -901,6 +901,7 @@ static int __devinit sht15_probe(structinit_waitqueue_head (&data->wait_queue);if (pdev->dev.platform_data ==NULL ) { + ret = -EINVAL ;dev_err (&pdev->dev,"no platform data supplied\n" ); goto err_free_data; }
Greg KH
maintainerPATCH 66/89 USB: cdc-wdm: call wake_up_all to allow driver to shutdown on device removal
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit 62aaf24dc125d7c55c93e313d15611f152b030c7 upstream.
wdm_disconnect() waits for the mutex held by wdm_read() before calling wake_up_all(). This causes a deadlock, preventing device removal to complete. Do the wake_up_all() before we start waiting for the locks.
--- drivers/usb/class/cdc-wdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/class/cdc-wdm.c +1 -1
@@ -786,13 +786,13 @@ static void wdm_disconnect(struct usb_in/* to terminate pending flushes */ clear_bit (WDM_IN_USE , &desc->flags);spin_unlock_irqrestore (&desc->iuspin, flags); +wake_up_all (&desc->wait);mutex_lock (&desc->rlock);mutex_lock (&desc->wlock);kill_urbs (desc);cancel_work_sync (&desc->rxwork);mutex_unlock (&desc->wlock);mutex_unlock (&desc->rlock); -wake_up_all (&desc->wait);if (!desc->count)cleanup (desc);mutex_unlock (&wdm_mutex);
Greg KH
maintainerPATCH 67/89 USB: cdc-wdm: better allocate a buffer that is at least as big as we tell the USB core
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit 655e247daf52b202a6c2d0f8a06dd2051e756ce4 upstream.
As it turns out, there was a mismatch between the allocated inbuf size (desc->bMaxPacketSize0, typically something like 64) and the length we specified in the URB (desc->wMaxCommand, typically something like 2048)
--- drivers/usb/class/cdc-wdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/class/cdc-wdm.c +1 -1
@@ -723,7 +723,7 @@ next_desc: goto err; desc->inbuf =usb_alloc_coherent (interface_to_usbdev (intf), - desc->bMaxPacketSize0, + desc->wMaxCommand,GFP_KERNEL , &desc->response->transfer_dma);if (!desc->inbuf)
Greg KH
maintainerPATCH 68/89 USB: cdc-wdm: Avoid hanging on interface with no USB_CDC_DMM_TYPE
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit 15699e6fafc3a90e5fdc2ef30555a04dee62286f upstream.
The probe does not strictly require the USB_CDC_DMM_TYPE descriptor, which is a good thing as it makes the driver usable on non-conforming interfaces. A user could e.g. bind to it to a CDC ECM interface by using the new_id and bind sysfs files. But this would fail with a 0 buffer length due to the missing descriptor.
Fix by defining a reasonable fallback size: The minimum device receive buffer size required by the CDC WMC standard, revision 1.1
--- drivers/usb/class/cdc-wdm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/class/cdc-wdm.c +3 -1
@@ -57,6 +57,8 @@ MODULE_DEVICE_TABLE (usb, wdm_ids);#define WDM_MAX 16 +/* CDC-WMC r1.1 requires wMaxCommand to be "at least 256 decimal (0x100)" */ +#define WDM_DEFAULT_BUFSIZE 256static DEFINE_MUTEX (wdm_mutex);
@@ -636,7 +638,7 @@ static int wdm_probe(struct usb_interfacstruct usb_cdc_dmm_desc *dmhd;u8 *buffer = intf->altsetting->extra;int buflen = intf->altsetting->extralen; -u16 maxcom =0 ; +u16 maxcom =WDM_DEFAULT_BUFSIZE ;if (!buffer) goto out;
Greg KH
maintainerPATCH 69/89 netns: fix net_alloc_generic()
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 073862ba5d249c20bd5c49fc6d904ff0e1f6a672 ]
When a new net namespace is created, we should attach to it a "struct net_generic" with enough slots (even empty), or we can hit the following BUG_ON() :
[ 200.752016] kernel BUG at include/net/netns/generic.h:40! ... [ 200.752016] [<ffffffff825c3cea>] ? get_cfcnfg+0x3a/0x180 [ 200.752016] [<ffffffff821cf0b0>] ? lockdep_rtnl_is_held+0x10/0x20 [ 200.752016] [<ffffffff825c41be>] caif_device_notify+0x2e/0x530 [ 200.752016] [<ffffffff810d61b7>] notifier_call_chain+0x67/0x110 [ 200.752016] [<ffffffff810d67c1>] raw_notifier_call_chain+0x11/0x20 [ 200.752016] [<ffffffff821bae82>] call_netdevice_notifiers+0x32/0x60 [ 200.752016] [<ffffffff821c2b26>] register_netdevice+0x196/0x300 [ 200.752016] [<ffffffff821c2ca9>] register_netdev+0x19/0x30 [ 200.752016] [<ffffffff81c1c67a>] loopback_net_init+0x4a/0xa0 [ 200.752016] [<ffffffff821b5e62>] ops_init+0x42/0x180 [ 200.752016] [<ffffffff821b600b>] setup_net+0x6b/0x100 [ 200.752016] [<ffffffff821b6466>] copy_net_ns+0x86/0x110 [ 200.752016] [<ffffffff810d5789>] create_new_namespaces+0xd9/0x190
net_alloc_generic() should take into account the maximum index into the ptr array, as a subsystem might use net_generic() anytime.
This also reduces number of reallocations in net_assign_generic()
--- net/core/net_namespace.c | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-)
net/core/net_namespace.c +16 -15
@@ -30,6 +30,20 @@ EXPORT_SYMBOL(init_net);#define INITIAL_NET_GEN_PTRS 13/* +1 for len +2 for rcu_head */ +static unsigned int max_gen_ptrs =INITIAL_NET_GEN_PTRS ; + +static struct net_generic *net_alloc_generic (void ) +{ +struct net_generic *ng; + size_t generic_size = offsetof(struct net_generic, ptr[max_gen_ptrs]); + + ng =kzalloc (generic_size,GFP_KERNEL ); +if (ng) + ng->len = max_gen_ptrs; + +return ng; +} +static int net_assign_generic (struct net *net,int id,void *data) {struct net_generic *ng, *old_ng;
@@ -43,8 +57,7 @@ static int net_assign_generic(struct netif (old_ng->len >= id) goto assign; - ng =kzalloc (sizeof (struct net_generic ) + - id *sizeof (void *),GFP_KERNEL ); + ng =net_alloc_generic ();if (ng ==NULL )return -ENOMEM ;
@@ -59,7 +72,6 @@ static int net_assign_generic(struct net* the old copy for kfree after a grace period. */ - ng->len = id;memcpy (&ng->ptr, &old_ng->ptr, old_ng->len *sizeof (void *));rcu_assign_pointer (net->gen, ng);
@@ -161,18 +173,6 @@ out_undo: goto out; } -static struct net_generic *net_alloc_generic (void ) -{ -struct net_generic *ng; -size_t generic_size =sizeof (struct net_generic ) + -INITIAL_NET_GEN_PTRS *sizeof (void *); - - ng =kzalloc (generic_size,GFP_KERNEL ); -if (ng) - ng->len =INITIAL_NET_GEN_PTRS ; - -return ng; -}#ifdef CONFIG_NET_NS static struct kmem_cache *net_cachep;
@@ -483,6 +483,7 @@ again: }return error; } + max_gen_ptrs = max_t(unsigned int, max_gen_ptrs, *ops->id); } error =__register_pernet_operations (list, ops);if (error) {
Greg KH
maintainerPATCH 70/89 netns: Fail conspicously if someone uses net_generic at an inappropriate time.
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
[ Upstream commit 5ee4433efe99b9f39f6eff5052a177bbcfe72cea ]
By definition net_generic should never be called when it can return NULL. Fail conspicously with a BUG_ON to make it clear when people mess up that a NULL return should never happen.
Recently there was a bug in the CAIF subsystem where it was registered with register_pernet_device instead of register_pernet_subsys. It was erroneously concluded that net_generic could validly return NULL and that net_assign_generic was buggy (when it was just inefficient). Hopefully this BUG_ON will prevent people to coming to similar erroneous conclusions in the futrue.
--- include/net/netns/generic.h | 1 + 1 file changed, 1 insertion(+)
include/net/netns/generic.h +1 -0
@@ -41,6 +41,7 @@ static inline void *net_generic(const st ptr = ng->ptr[id -1 ];rcu_read_unlock (); +BUG_ON (!ptr); return ptr; }#endif
Greg KH
maintainerPATCH 71/89 net caif: Register properly as a pernet subsystem.
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Eric W. Biederman" <[email protected]>
[ Upstream commit 8a8ee9aff6c3077dd9c2c7a77478e8ed362b96c6 ]
caif is a subsystem and as such it needs to register with register_pernet_subsys instead of register_pernet_device.
Among other problems using register_pernet_device was resulting in net_generic being called before the caif_net structure was allocated. Which has been causing net_generic to fail with either BUG_ON's or by return NULL pointers.
A more ugly problem that could be caused is packets in flight why the subsystem is shutting down.
To remove confusion also remove the cruft cause by inappropriately trying to fix this bug.
With the aid of the previous patch I have tested this patch and confirmed that using register_pernet_subsys makes the failure go away as it should.
--- net/caif/caif_dev.c | 11 ++++------- net/caif/cfcnfg.c | 1 - 2 files changed, 4 insertions(+), 8 deletions(-)
net/caif/caif_dev.c +4 -7
@@ -53,7 +53,6 @@ struct cfcnfg *get_cfcnfg(struct net *nestruct caif_net *caifn;BUG_ON (!net); caifn =net_generic (net, caif_net_id); -BUG_ON (!caifn);return caifn->cfg; }EXPORT_SYMBOL (get_cfcnfg);
@@ -63,7 +62,6 @@ static struct caif_device_entry_list *castruct caif_net *caifn;BUG_ON (!net); caifn =net_generic (net, caif_net_id); -BUG_ON (!caifn);return &caifn->caifdevs; }
@@ -92,7 +90,6 @@ static struct caif_device_entry *caif_destruct caif_device_entry *caifd; caifdevs =caif_device_list (dev_net (dev)); -BUG_ON (!caifdevs); caifd =kzalloc (sizeof (*caifd),GFP_KERNEL );if (!caifd)
@@ -112,7 +109,7 @@ static struct caif_device_entry *caif_gestruct caif_device_entry_list *caifdevs =caif_device_list (dev_net (dev));struct caif_device_entry *caifd; -BUG_ON (!caifdevs); +list_for_each_entry_rcu (caifd, &caifdevs->list, list) {if (caifd->netdev == dev)return caifd;
@@ -353,7 +350,7 @@ static struct notifier_block caif_devicestatic int caif_init_net (struct net *net) {struct caif_net *caifn =net_generic (net, caif_net_id); -BUG_ON (!caifn); +INIT_LIST_HEAD (&caifn->caifdevs.list);mutex_init (&caifn->caifdevs.lock);
@@ -418,7 +415,7 @@ static int __init caif_device_init(void) {int result; - result =register_pernet_device (&caif_net_ops); + result =register_pernet_subsys (&caif_net_ops);if (result)return result;
@@ -431,7 +428,7 @@ static int __init caif_device_init(void) static void __exit caif_device_exit(void) { -unregister_pernet_device (&caif_net_ops); +unregister_pernet_subsys (&caif_net_ops);unregister_netdevice_notifier (&caif_device_notifier);dev_remove_pack (&caif_packet_type); }
net/caif/cfcnfg.c +0 -1
@@ -309,7 +309,6 @@ int caif_connect_client(struct net *net,int err;struct cfctrl_link_param param;struct cfcnfg *cfg =get_cfcnfg (net); -caif_assert (cfg !=NULL );rcu_read_lock (); err =caif_connect_req_to_link_param (cfg, conn_req, ¶m);
Greg KH
maintainerPATCH 72/89 af_unix: fix EPOLLET regression for stream sockets
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 6f01fd6e6f6809061b56e78f1e8d143099716d70 ]
Commit 0884d7aa24 (AF_UNIX: Fix poll blocking problem when reading from a stream socket) added a regression for epoll() in Edge Triggered mode (EPOLLET)
Appropriate fix is to use skb_peek()/skb_unlink() instead of skb_dequeue(), and only call skb_unlink() when skb is fully consumed.
This remove the need to requeue a partial skb into sk_receive_queue head and the extra sk->sk_data_ready() calls that added the regression.
This is safe because once skb is given to sk_receive_queue, it is not modified by a writer, and readers are serialized by u->readlock mutex.
This also reduce number of spinlock acquisition for small reads or MSG_PEEK users so should improve overall performance.
--- net/unix/af_unix.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-)
net/unix/af_unix.c +4 -15
@@ -1915,7 +1915,7 @@ static int unix_stream_recvmsg(struct kistruct sk_buff *skb;unix_state_lock (sk); - skb =skb_dequeue (&sk->sk_receive_queue); + skb =skb_peek (&sk->sk_receive_queue);if (skb ==NULL ) {unix_sk (sk)->recursion_level =0 ;if (copied >= target)
@@ -1955,11 +1955,8 @@ static int unix_stream_recvmsg(struct kiif (check_creds) {/* Never glue messages from different writers */ if ((UNIXCB (skb).pid != siocb->scm->pid) || - (UNIXCB (skb).cred != siocb->scm->cred)) { -skb_queue_head (&sk->sk_receive_queue, skb); - sk->sk_data_ready (sk, skb->len); + (UNIXCB (skb).cred != siocb->scm->cred))break ; - } }else {/* Copy credentials */ scm_set_cred (siocb->scm,UNIXCB (skb).pid,UNIXCB (skb).cred);
@@ -1974,8 +1971,6 @@ static int unix_stream_recvmsg(struct ki chunk = min_t(unsigned int, skb->len, size);if (memcpy_toiovec (msg->msg_iov, skb->data, chunk)) { -skb_queue_head (&sk->sk_receive_queue, skb); - sk->sk_data_ready (sk, skb->len);if (copied ==0 ) copied = -EFAULT ;break ;
@@ -1990,13 +1985,10 @@ static int unix_stream_recvmsg(struct kiif (UNIXCB (skb).fp)unix_detach_fds (siocb->scm, skb); -/* put the skb back if we didn't use it up.. */ -if (skb->len) { -skb_queue_head (&sk->sk_receive_queue, skb); - sk->sk_data_ready (sk, skb->len); +if (skb->len)break ; - } +skb_unlink (skb, &sk->sk_receive_queue);consume_skb (skb);if (siocb->scm->fp)
@@ -2007,9 +1999,6 @@ static int unix_stream_recvmsg(struct kiif (UNIXCB (skb).fp) siocb->scm->fp =scm_fp_dup (UNIXCB (skb).fp); -/* put message back and return */ -skb_queue_head (&sk->sk_receive_queue, skb); - sk->sk_data_ready (sk, skb->len);break ; } }while (size);
Greg KH
maintainerPATCH 73/89 bonding: fix enslaving in alb mode when link down
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Bohac <[email protected]>
[ Upstream commit b924551bed09f61b64f21bffe241afc5526b091a ]
bond_alb_init_slave() is called from bond_enslave() and sets the slave's MAC address. This is done differently for TLB and ALB modes. bond->alb_info.rlb_enabled is used to discriminate between the two modes but this flag may be uninitialized if the slave is being enslaved prior to calling bond_open() -> bond_alb_initialize() on the master.
It turns out all the callers of alb_set_slave_mac_addr() pass bond->alb_info.rlb_enabled as the hw parameter.
This patch cleans up the unnecessary parameter of alb_set_slave_mac_addr() and makes the function decide based on the bonding mode instead, which fixes the above problem.
--- drivers/net/bonding/bond_alb.c | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-)
drivers/net/bonding/bond_alb.c +9 -18
@@ -871,16 +871,12 @@ static void alb_send_learning_packets(st } } -/* hw is a boolean parameter that determines whether we should try and -* set the hw address of the device as well as the hw address of the -* net_device -*/ -static int alb_set_slave_mac_addr (struct slave *slave,u8 addr[],int hw) +static int alb_set_slave_mac_addr (struct slave *slave,u8 addr[]) {struct net_device *dev = slave->dev;struct sockaddr s_addr; -if (!hw) { +if (slave->bond->params.mode ==BOND_MODE_TLB ) {memcpy (dev->dev_addr, addr, dev->addr_len);return 0 ; }
@@ -910,8 +906,8 @@ static void alb_swap_mac_addr(struct bonu8 tmp_mac_addr[ETH_ALEN ];memcpy (tmp_mac_addr, slave1->dev->dev_addr,ETH_ALEN ); -alb_set_slave_mac_addr (slave1, slave2->dev->dev_addr, bond->alb_info.rlb_enabled); -alb_set_slave_mac_addr (slave2, tmp_mac_addr, bond->alb_info.rlb_enabled); +alb_set_slave_mac_addr (slave1, slave2->dev->dev_addr); +alb_set_slave_mac_addr (slave2, tmp_mac_addr); }
@@ -1058,8 +1054,7 @@ static int alb_handle_addr_collision_on_/* Try setting slave mac to bond address and fall-through to code handling that situation below... */ -alb_set_slave_mac_addr (slave, bond->dev->dev_addr, - bond->alb_info.rlb_enabled); +alb_set_slave_mac_addr (slave, bond->dev->dev_addr); }/* The slave's address is equal to the address of the bond.
@@ -1095,8 +1090,7 @@ static int alb_handle_addr_collision_on_ }if (free_mac_slave) { -alb_set_slave_mac_addr (slave, free_mac_slave->perm_hwaddr, - bond->alb_info.rlb_enabled); +alb_set_slave_mac_addr (slave, free_mac_slave->perm_hwaddr); pr_warning("%s: Warning: the hw address of slave %s is in use by the bond; giving it the hw address of %s\n", bond->dev->name, slave->dev->name,
@@ -1451,8 +1445,7 @@ int bond_alb_init_slave(struct bonding * {int res; - res =alb_set_slave_mac_addr (slave, slave->perm_hwaddr, - bond->alb_info.rlb_enabled); + res =alb_set_slave_mac_addr (slave, slave->perm_hwaddr);if (res) {return res; }
@@ -1603,8 +1596,7 @@ void bond_alb_handle_active_change(strucalb_swap_mac_addr (bond, swap_slave, new_slave); }else {/* set the new_slave to the bond mac address */ -alb_set_slave_mac_addr (new_slave, bond->dev->dev_addr, - bond->alb_info.rlb_enabled); +alb_set_slave_mac_addr (new_slave, bond->dev->dev_addr); }if (swap_slave) {
@@ -1664,8 +1656,7 @@ int bond_alb_set_mac_address(struct net_alb_swap_mac_addr (bond, swap_slave, bond->curr_active_slave);alb_fasten_mac_swap (bond, swap_slave, bond->curr_active_slave); }else { -alb_set_slave_mac_addr (bond->curr_active_slave, bond_dev->dev_addr, - bond->alb_info.rlb_enabled); +alb_set_slave_mac_addr (bond->curr_active_slave, bond_dev->dev_addr);read_lock (&bond->lock);alb_send_learning_packets (bond->curr_active_slave, bond_dev->dev_addr);
Greg KH
maintainerPATCH 74/89 l2tp: l2tp_ip - fix possible oops on packet receive
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: James Chapman <[email protected]>
[ Upstream commit 68315801dbf3ab2001679fd2074c9dc5dcf87dfa ]
When a packet is received on an L2TP IP socket (L2TPv3 IP link encapsulation), the l2tpip socket's backlog_rcv function calls xfrm4_policy_check(). This is not necessary, since it was called before the skb was added to the backlog. With CONFIG_NET_NS enabled, xfrm4_policy_check() will oops if skb->dev is null, so this trivial patch removes the call.
This bug has always been present, but only when CONFIG_NET_NS is enabled does it cause problems. Most users are probably using UDP encapsulation for L2TP, hence the problem has only recently surfaced.
EIP: 0060:[<c12bb62b>] EFLAGS: 00210246 CPU: 0 EIP is at l2tp_ip_recvmsg+0xd4/0x2a7
EAX: 00000001 EBX: d77b5180 ECX: 00000000 EDX: 00200246
ESI: 00000000 EDI: d63cbd30 EBP: d63cbd18 ESP: d63cbcf4
DS: 007b ES: 007b FS: 00d8 GS: 00e0 SS: 0068
Call Trace: [<c1218568>] sock_common_recvmsg+0x31/0x46 [<c1215c92>] __sock_recvmsg_nosec+0x45/0x4d [<c12163a1>] __sock_recvmsg+0x31/0x3b [<c1216828>] sock_recvmsg+0x96/0xab [<c10b2693>] ? might_fault+0x47/0x81 [<c10b2693>] ? might_fault+0x47/0x81 [<c1167fd0>] ? _copy_from_user+0x31/0x115 [<c121e8c8>] ? copy_from_user+0x8/0xa [<c121ebd6>] ? verify_iovec+0x3e/0x78 [<c1216604>] __sys_recvmsg+0x10a/0x1aa [<c1216792>] ? sock_recvmsg+0x0/0xab [<c105a99b>] ? __lock_acquire+0xbdf/0xbee [<c12d5a99>] ? do_page_fault+0x193/0x375 [<c10d1200>] ? fcheck_files+0x9b/0xca [<c10d1259>] ? fget_light+0x2a/0x9c [<c1216bbb>] sys_recvmsg+0x2b/0x43 [<c1218145>] sys_socketcall+0x16d/0x1a5 [<c11679f0>] ? trace_hardirqs_on_thunk+0xc/0x10 [<c100305f>] sysenter_do_call+0x12/0x38 Code: c6 05 8c ea a8 c1 01 e8 0c d4 d9 ff 85 f6 74 07 3e ff 86 80 00 00 00 b9 17 b6 2b c1 ba 01 00 00 00 b8 78 ed 48 c1 e8 23 f6 d9 ff <ff> 76 0c 68 28 e3 30 c1 68 2d 44 41 c1 e8 89 57 01 00 83 c4 0c
--- net/l2tp/l2tp_ip.c | 5 ----- 1 file changed, 5 deletions(-)
net/l2tp/l2tp_ip.c +0 -5
@@ -393,11 +393,6 @@ static int l2tp_ip_backlog_recv(struct s {int rc; -if (!xfrm4_policy_check (sk,XFRM_POLICY_IN , skb)) - goto drop; - -nf_reset (skb); -/* Charge it to the socket, dropping if the queue is full. */ rc =sock_queue_rcv_skb (sk, skb);if (rc <0 )
Greg KH
maintainerPATCH 75/89 macvlan: fix a possible use after free
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit 4ec7ac1203bcf21f5e3d977c9818b1a56c9ef40d ]
Commit bc416d9768 (macvlan: handle fragmented multicast frames) added a possible use after free in macvlan_handle_frame(), since ip_check_defrag() uses pskb_may_pull() : skb header can be reallocated.
--- drivers/net/macvlan.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/macvlan.c +1 -0
@@ -172,6 +172,7 @@ static rx_handler_result_t macvlan_handl skb =ip_check_defrag (skb,IP_DEFRAG_MACVLAN );if (!skb)return RX_HANDLER_CONSUMED ; + eth =eth_hdr (skb); src =macvlan_hash_lookup (port, eth->h_source);if (!src)/* frame comes from an external address */
Greg KH
maintainerPATCH 76/89 net: bpf_jit: fix divide by 0 generation
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit d00a9dd21bdf7908b70866794c8313ee8a5abd5c ]
Several problems fixed in this patch :
1) Target of the conditional jump in case a divide by 0 is performed by a bpf is wrong.
2) Must 'generate' the full function prologue/epilogue at pass=0, or else we can stop too early in pass=1 if the proglen doesnt change. (if the increase of prologue/epilogue equals decrease of all instructions length because some jumps are converted to near jumps)
3) Change the wrong length detection at the end of code generation to issue a more explicit message, no need for a full stack trace.
--- arch/x86/net/bpf_jit_comp.c | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-)
arch/x86/net/bpf_jit_comp.c +22 -14
@@ -151,17 +151,18 @@ void bpf_jit_compile(struct sk_filter *f cleanup_addr = proglen;/* epilogue address */ for (pass =0 ; pass <10 ; pass++) { +u8 seen_or_pass0 = (pass ==0 ) ? (SEEN_XREG |SEEN_DATAREF |SEEN_MEM ) : seen;/* no prologue/epilogue for trivial filters (RET something) */ proglen =0 ; prog = temp; -if (seen) { +if (seen_or_pass0) {EMIT4 (0x55 ,0x48 ,0x89 ,0xe5 );/* push %rbp; mov %rsp,%rbp */ EMIT4 (0x48 ,0x83 ,0xec ,96 );/* subq $96,%rsp */ /* note : must save %rbx in case bpf_error is hit */ -if (seen & (SEEN_XREG |SEEN_DATAREF )) +if (seen_or_pass0 & (SEEN_XREG |SEEN_DATAREF ))EMIT4 (0x48 ,0x89 ,0x5d ,0xf8 );/* mov %rbx, -8(%rbp) */ -if (seen &SEEN_XREG ) +if (seen_or_pass0 &SEEN_XREG )CLEAR_X ();/* make sure we dont leek kernel memory */ /*
@@ -170,7 +171,7 @@ void bpf_jit_compile(struct sk_filter *f* r9 = skb->len - skb->data_len * r8 = skb->data */ -if (seen &SEEN_DATAREF ) { +if (seen_or_pass0 &SEEN_DATAREF ) {if (offsetof(struct sk_buff , len) <=127 )/* mov off8(%rdi),%r9d */ EMIT4 (0x44 ,0x8b ,0x4f , offsetof(struct sk_buff , len));
@@ -260,9 +261,14 @@ void bpf_jit_compile(struct sk_filter *fcase BPF_S_ALU_DIV_X :/* A /= X; */ seen |=SEEN_XREG ;EMIT2 (0x85 ,0xdb );/* test %ebx,%ebx */ -if (pc_ret0 !=-1 ) -EMIT_COND_JMP (X86_JE , addrs[pc_ret0] - (addrs[i] -4 )); -else { +if (pc_ret0 >0 ) { +/* addrs[pc_ret0 - 1] is start address of target +* (addrs[i] - 4) is the address following this jmp +* ("xor %edx,%edx; div %ebx" being 4 bytes long) +*/ +EMIT_COND_JMP (X86_JE , addrs[pc_ret0 -1 ] - + (addrs[i] -4 )); + }else {EMIT_COND_JMP (X86_JNE ,2 +5 );CLEAR_A ();EMIT1_off32 (0xe9 , cleanup_addr - (addrs[i] -4 ));/* jmp .+off32 */
@@ -335,12 +341,12 @@ void bpf_jit_compile(struct sk_filter *f }/* fallinto */ case BPF_S_RET_A : -if (seen) { +if (seen_or_pass0) {if (i != flen -1 ) {EMIT_JMP (cleanup_addr - addrs[i]);break ; } -if (seen &SEEN_XREG ) +if (seen_or_pass0 &SEEN_XREG )EMIT4 (0x48 ,0x8b ,0x5d ,0xf8 );/* mov -8(%rbp),%rbx */ EMIT1 (0xc9 );/* leaveq */ }
@@ -483,8 +489,9 @@ common_load: seen |= SEEN_DATAREF; goto common_load;case BPF_S_LDX_B_MSH :if ((int )K <0 ) { -if (pc_ret0 !=-1 ) { -EMIT_JMP (addrs[pc_ret0] - addrs[i]); +if (pc_ret0 >0 ) { +/* addrs[pc_ret0 - 1] is the start address */ +EMIT_JMP (addrs[pc_ret0 -1 ] - addrs[i]);break ; }CLEAR_A ();
@@ -599,13 +606,14 @@ cond_branch: f_offset = addrs[i + filt* use it to give the cleanup instruction(s) addr */ cleanup_addr = proglen -1 ;/* ret */ -if (seen) +if (seen_or_pass0) cleanup_addr -=1 ;/* leaveq */ -if (seen &SEEN_XREG ) +if (seen_or_pass0 &SEEN_XREG ) cleanup_addr -=4 ;/* mov -8(%rbp),%rbx */ if (image) { -WARN_ON (proglen != oldproglen); +if (proglen != oldproglen) +pr_err ("bpb_jit_compile proglen=%u != oldproglen=%u\n" , proglen, oldproglen);break ; }if (proglen == oldproglen) {
Greg KH
maintainerPATCH 77/89 net: reintroduce missing rcu_assign_pointer() calls
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <[email protected]>
[ Upstream commit cf778b00e96df6d64f8e21b8395d1f8a859ecdc7 ]
commit a9b3cd7f32 (rcu: convert uses of rcu_assign_pointer(x, NULL) to RCU_INIT_POINTER) did a lot of incorrect changes, since it did a complete conversion of rcu_assign_pointer(x, y) to RCU_INIT_POINTER(x, y).
We miss needed barriers, even on x86, when y is not NULL.
--- net/core/net-sysfs.c | 6 +++--- net/core/netpoll.c | 2 +- net/decnet/dn_dev.c | 4 ++-- net/ipv4/devinet.c | 2 +- net/ipv4/fib_trie.c | 10 +++++----- net/ipv4/igmp.c | 8 ++++---- net/ipv4/ipip.c | 8 ++++---- net/ipv4/ipmr.c | 2 +- net/ipv6/addrconf.c | 2 +- net/ipv6/ip6_tunnel.c | 8 ++++---- net/ipv6/raw.c | 2 +- net/ipv6/sit.c | 10 +++++----- net/mac80211/agg-rx.c | 2 +- net/mac80211/cfg.c | 4 ++-- net/mac80211/ibss.c | 2 +- net/mac80211/sta_info.c | 6 +++--- net/netfilter/nf_conntrack_core.c | 2 +- net/netfilter/nf_conntrack_ecache.c | 4 ++-- net/netfilter/nf_conntrack_extend.c | 2 +- net/netfilter/nf_conntrack_helper.c | 2 +- net/netfilter/nf_conntrack_netlink.c | 2 +- net/netfilter/nf_log.c | 6 +++--- net/netfilter/nf_queue.c | 2 +- net/netfilter/nfnetlink.c | 4 ++-- net/netlabel/netlabel_domainhash.c | 4 ++-- net/netlabel/netlabel_unlabeled.c | 6 ++---- net/phonet/af_phonet.c | 2 +- net/phonet/pn_dev.c | 2 +- net/phonet/socket.c | 2 +- net/socket.c | 2 +- net/sunrpc/auth_gss/auth_gss.c | 2 +- net/xfrm/xfrm_user.c | 2 +- 32 files changed, 61 insertions(+), 63 deletions(-)
net/core/net-sysfs.c +3 -3
@@ -990,9 +990,9 @@ static ssize_t store_xps_map(struct netd nonempty =1 ; } -if (nonempty) -RCU_INIT_POINTER (dev->xps_maps, new_dev_maps); -else { +if (nonempty) { +rcu_assign_pointer (dev->xps_maps, new_dev_maps); + }else {kfree (new_dev_maps);RCU_INIT_POINTER (dev->xps_maps,NULL ); }
net/core/netpoll.c +1 -1
@@ -763,7 +763,7 @@ int __netpoll_setup(struct netpoll *np) }/* last thing to do is link it to the net device structure */ -RCU_INIT_POINTER (ndev->npinfo, npinfo); +rcu_assign_pointer (ndev->npinfo, npinfo);return 0 ;
net/decnet/dn_dev.c +2 -2
@@ -388,7 +388,7 @@ static int dn_dev_insert_ifa(struct dn_d } ifa->ifa_next = dn_db->ifa_list; -RCU_INIT_POINTER (dn_db->ifa_list, ifa); +rcu_assign_pointer (dn_db->ifa_list, ifa);dn_ifaddr_notify (RTM_NEWADDR , ifa);blocking_notifier_call_chain (&dnaddr_chain,NETDEV_UP , ifa);
@@ -1093,7 +1093,7 @@ static struct dn_dev *dn_dev_create(strumemcpy (&dn_db->parms, p,sizeof (struct dn_dev_parms )); -RCU_INIT_POINTER (dev->dn_ptr, dn_db); +rcu_assign_pointer (dev->dn_ptr, dn_db); dn_db->dev = dev;init_timer (&dn_db->timer);
net/ipv4/devinet.c +1 -1
@@ -258,7 +258,7 @@ static struct in_device *inetdev_init(stip_mc_up (in_dev);/* we can receive as soon as ip_ptr is set -- do this last */ -RCU_INIT_POINTER (dev->ip_ptr, in_dev); +rcu_assign_pointer (dev->ip_ptr, in_dev); out:return in_dev; out_kfree:
net/ipv4/fib_trie.c +5 -5
@@ -205,7 +205,7 @@ static inline struct tnode *node_parent_return (struct tnode *)(parent & ~NODE_TYPE_MASK ); } -/* Same as RCU_INIT_POINTER +/* Same as rcu_assign_pointer * but that macro() assumes that value is a pointer. */ static inline void node_set_parent (struct rt_trie_node *node,struct tnode *ptr)
@@ -529,7 +529,7 @@ static void tnode_put_child_reorg(structif (n)node_set_parent (n, tn); -RCU_INIT_POINTER (tn->child[i], n); +rcu_assign_pointer (tn->child[i], n); }#define MAX_WORK 10
@@ -1015,7 +1015,7 @@ static void trie_rebalance(struct trie * tp =node_parent ((struct rt_trie_node *) tn);if (!tp) -RCU_INIT_POINTER (t->trie, (struct rt_trie_node *)tn); +rcu_assign_pointer (t->trie, (struct rt_trie_node *)tn);tnode_free_flush ();if (!tp)
@@ -1027,7 +1027,7 @@ static void trie_rebalance(struct trie *if (IS_TNODE (tn)) tn = (struct tnode *)resize (t, (struct tnode *)tn); -RCU_INIT_POINTER (t->trie, (struct rt_trie_node *)tn); +rcu_assign_pointer (t->trie, (struct rt_trie_node *)tn);tnode_free_flush (); }
@@ -1164,7 +1164,7 @@ static struct list_head *fib_insert_nodeput_child (t, (struct tnode *)tp, cindex, (struct rt_trie_node *)tn); }else { -RCU_INIT_POINTER (t->trie, (struct rt_trie_node *)tn); +rcu_assign_pointer (t->trie, (struct rt_trie_node *)tn); tp = tn; } }
net/ipv4/igmp.c +4 -4
@@ -1244,7 +1244,7 @@ void ip_mc_inc_group(struct in_device *i im->next_rcu = in_dev->mc_list; in_dev->mc_count++; -RCU_INIT_POINTER (in_dev->mc_list, im); +rcu_assign_pointer (in_dev->mc_list, im);#ifdef CONFIG_IP_MULTICAST igmpv3_del_delrec (in_dev, im->multiaddr);
@@ -1816,7 +1816,7 @@ int ip_mc_join_group(struct sock *sk , s iml->next_rcu = inet->mc_list; iml->sflist =NULL ; iml->sfmode =MCAST_EXCLUDE ; -RCU_INIT_POINTER (inet->mc_list, iml); +rcu_assign_pointer (inet->mc_list, iml);ip_mc_inc_group (in_dev, addr); err =0 ; done:
@@ -2003,7 +2003,7 @@ int ip_mc_source(int add, int omode, stratomic_sub (IP_SFLSIZE (psl->sl_max), &sk->sk_omem_alloc);kfree_rcu (psl, rcu); } -RCU_INIT_POINTER (pmc->sflist, newpsl); +rcu_assign_pointer (pmc->sflist, newpsl); psl = newpsl; } rv =1 ;/* > 0 for insert logic below if sl_count is 0 */
@@ -2106,7 +2106,7 @@ int ip_mc_msfilter(struct sock *sk, stru }else (void )ip_mc_del_src (in_dev, &msf->imsf_multiaddr, pmc->sfmode,0 ,NULL ,0 ); -RCU_INIT_POINTER (pmc->sflist, newpsl); +rcu_assign_pointer (pmc->sflist, newpsl); pmc->sfmode = msf->imsf_fmode; err =0 ; done:
net/ipv4/ipip.c +4 -4
@@ -231,7 +231,7 @@ static void ipip_tunnel_unlink(struct ip (iter =rtnl_dereference (*tp)) !=NULL ; tp = &iter->next) {if (t == iter) { -RCU_INIT_POINTER (*tp, t->next); +rcu_assign_pointer (*tp, t->next);break ; } }
@@ -241,8 +241,8 @@ static void ipip_tunnel_link(struct ipip {struct ip_tunnel __rcu **tp =ipip_bucket (ipn, t); -RCU_INIT_POINTER (t->next,rtnl_dereference (*tp)); -RCU_INIT_POINTER (*tp, t); +rcu_assign_pointer (t->next,rtnl_dereference (*tp)); +rcu_assign_pointer (*tp, t); } static struct ip_tunnel * ipip_tunnel_locate(struct net *net,
@@ -792,7 +792,7 @@ static int __net_init ipip_fb_tunnel_inireturn -ENOMEM ;dev_hold (dev); -RCU_INIT_POINTER (ipn->tunnels_wc[0 ], tunnel); +rcu_assign_pointer (ipn->tunnels_wc[0 ], tunnel);return 0 ; }
net/ipv4/ipmr.c +1 -1
@@ -1225,7 +1225,7 @@ int ip_mroute_setsockopt(struct sock *sk ret =ip_ra_control (sk,1 , mrtsock_destruct);if (ret ==0 ) { -RCU_INIT_POINTER (mrt->mroute_sk, sk); +rcu_assign_pointer (mrt->mroute_sk, sk);IPV4_DEVCONF_ALL (net,MC_FORWARDING )++; }rtnl_unlock ();
net/ipv6/addrconf.c +1 -1
@@ -429,7 +429,7 @@ static struct inet6_dev * ipv6_add_dev(s ndev->tstamp = jiffies;addrconf_sysctl_register (ndev);/* protected by rtnl_lock */ -RCU_INIT_POINTER (dev->ip6_ptr, ndev); +rcu_assign_pointer (dev->ip6_ptr, ndev);/* Join all-node multicast group */ ipv6_dev_mc_inc (dev, &in6addr_linklocal_allnodes);
net/ipv6/ip6_tunnel.c +4 -4
@@ -218,8 +218,8 @@ ip6_tnl_link(struct ip6_tnl_net *ip6n, s {struct ip6_tnl __rcu **tp =ip6_tnl_bucket (ip6n, &t->parms); -RCU_INIT_POINTER (t->next ,rtnl_dereference (*tp)); -RCU_INIT_POINTER (*tp, t); +rcu_assign_pointer (t->next ,rtnl_dereference (*tp)); +rcu_assign_pointer (*tp, t); }/**
@@ -237,7 +237,7 @@ ip6_tnl_unlink(struct ip6_tnl_net *ip6n, (iter =rtnl_dereference (*tp)) !=NULL ; tp = &iter->next) {if (t == iter) { -RCU_INIT_POINTER (*tp, t->next); +rcu_assign_pointer (*tp, t->next);break ; } }
@@ -1450,7 +1450,7 @@ static int __net_init ip6_fb_tnl_dev_ini t->parms.proto =IPPROTO_IPV6 ;dev_hold (dev); -RCU_INIT_POINTER (ip6n->tnls_wc[0 ], t); +rcu_assign_pointer (ip6n->tnls_wc[0 ], t);return 0 ; }
net/ipv6/raw.c +1 -1
@@ -131,7 +131,7 @@ static mh_filter_t __rcu *mh_filter __reint rawv6_mh_filter_register (mh_filter_t filter) { -RCU_INIT_POINTER (mh_filter, filter); +rcu_assign_pointer (mh_filter, filter);return 0 ; }EXPORT_SYMBOL (rawv6_mh_filter_register);
net/ipv6/sit.c +5 -5
@@ -182,7 +182,7 @@ static void ipip6_tunnel_unlink(struct s (iter =rtnl_dereference (*tp)) !=NULL ; tp = &iter->next) {if (t == iter) { -RCU_INIT_POINTER (*tp, t->next); +rcu_assign_pointer (*tp, t->next);break ; } }
@@ -192,8 +192,8 @@ static void ipip6_tunnel_link(struct sit {struct ip_tunnel __rcu **tp =ipip6_bucket (sitn, t); -RCU_INIT_POINTER (t->next,rtnl_dereference (*tp)); -RCU_INIT_POINTER (*tp, t); +rcu_assign_pointer (t->next,rtnl_dereference (*tp)); +rcu_assign_pointer (*tp, t); }static void ipip6_tunnel_clone_6rd (struct net_device *dev,struct sit_net *sitn)
@@ -393,7 +393,7 @@ ipip6_tunnel_add_prl(struct ip_tunnel *t p->addr = a->addr; p->flags = a->flags; t->prl_count++; -RCU_INIT_POINTER (t->prl, p); +rcu_assign_pointer (t->prl, p); out:return err; }
@@ -1177,7 +1177,7 @@ static int __net_init ipip6_fb_tunnel_inif (!dev->tstats)return -ENOMEM ;dev_hold (dev); -RCU_INIT_POINTER (sitn->tunnels_wc[0 ], tunnel); +rcu_assign_pointer (sitn->tunnels_wc[0 ], tunnel);return 0 ; }
net/mac80211/agg-rx.c +1 -1
@@ -326,7 +326,7 @@ void ieee80211_process_addba_request(str status =WLAN_STATUS_SUCCESS ;/* activate it for RX */ -RCU_INIT_POINTER (sta->ampdu_mlme.tid_rx[tid], tid_agg_rx); +rcu_assign_pointer (sta->ampdu_mlme.tid_rx[tid], tid_agg_rx);if (timeout)mod_timer (&tid_agg_rx->session_timer,TU_TO_EXP_TIME (timeout));
net/mac80211/cfg.c +2 -2
@@ -575,7 +575,7 @@ static int ieee80211_config_beacon(struc sdata->vif.bss_conf.dtim_period = new->dtim_period; -RCU_INIT_POINTER (sdata->u.ap.beacon, new); +rcu_assign_pointer (sdata->u.ap.beacon, new);synchronize_rcu ();
@@ -922,7 +922,7 @@ static int ieee80211_change_station(strureturn -EBUSY ; } -RCU_INIT_POINTER (vlansdata->u.vlan.sta, sta); +rcu_assign_pointer (vlansdata->u.vlan.sta, sta); } sta->sdata = vlansdata;
net/mac80211/ibss.c +1 -1
@@ -184,7 +184,7 @@ static void __ieee80211_sta_join_ibss(st *pos++ =0 ;/* U-APSD no in use */ } -RCU_INIT_POINTER (ifibss->presp, skb); +rcu_assign_pointer (ifibss->presp, skb); sdata->vif.bss_conf.beacon_int = beacon_int; sdata->vif.bss_conf.basic_rates = basic_rates;
net/mac80211/sta_info.c +3 -3
@@ -73,7 +73,7 @@ static int sta_info_hash_del(struct ieeeif (!s)return -ENOENT ;if (s == sta) { -RCU_INIT_POINTER (local->sta_hash[STA_HASH (sta->sta.addr)], +rcu_assign_pointer (local->sta_hash[STA_HASH (sta->sta.addr)], s->hnext);return 0 ; }
@@ -83,7 +83,7 @@ static int sta_info_hash_del(struct ieee s =rcu_dereference_protected (s->hnext,lockdep_is_held (&local->sta_lock));if (rcu_access_pointer (s->hnext)) { -RCU_INIT_POINTER (s->hnext, sta->hnext); +rcu_assign_pointer (s->hnext, sta->hnext);return 0 ; }
@@ -232,7 +232,7 @@ static void sta_info_hash_add(struct iee struct sta_info *sta) { sta->hnext = local->sta_hash[STA_HASH (sta->sta.addr)]; -RCU_INIT_POINTER (local->sta_hash[STA_HASH (sta->sta.addr)], sta); +rcu_assign_pointer (local->sta_hash[STA_HASH (sta->sta.addr)], sta); }static void sta_unblock (struct work_struct *wk)
net/netfilter/nf_conntrack_core.c +1 -1
@@ -776,7 +776,7 @@ init_conntrack(struct net *net, struct nif (exp->helper) { help =nf_ct_helper_ext_add (ct,GFP_ATOMIC );if (help) -RCU_INIT_POINTER (help->helper, exp->helper); +rcu_assign_pointer (help->helper, exp->helper); }#ifdef CONFIG_NF_CONNTRACK_MARK
net/netfilter/nf_conntrack_ecache.c +2 -2
@@ -91,7 +91,7 @@ int nf_conntrack_register_notifier(struc ret = -EBUSY ; goto out_unlock; } -RCU_INIT_POINTER (net->ct.nf_conntrack_event_cb, new); +rcu_assign_pointer (net->ct.nf_conntrack_event_cb, new);mutex_unlock (&nf_ct_ecache_mutex);return ret;
@@ -128,7 +128,7 @@ int nf_ct_expect_register_notifier(struc ret = -EBUSY ; goto out_unlock; } -RCU_INIT_POINTER (net->ct.nf_expect_event_cb, new); +rcu_assign_pointer (net->ct.nf_expect_event_cb, new);mutex_unlock (&nf_ct_ecache_mutex);return ret;
net/netfilter/nf_conntrack_extend.c +1 -1
@@ -169,7 +169,7 @@ int nf_ct_extend_register(struct nf_ct_ebefore updating alloc_size */ type->alloc_size =ALIGN (sizeof (struct nf_ct_ext ), type->align) + type->len; -RCU_INIT_POINTER (nf_ct_ext_types[type->id], type); +rcu_assign_pointer (nf_ct_ext_types[type->id], type);update_alloc_size (type); out:mutex_unlock (&nf_ct_ext_type_mutex);
net/netfilter/nf_conntrack_helper.c +1 -1
@@ -145,7 +145,7 @@ int __nf_ct_try_assign_helper(struct nf_memset (&help->help,0 ,sizeof (help->help)); } -RCU_INIT_POINTER (help->helper, helper); +rcu_assign_pointer (help->helper, helper); out:return ret; }
net/netfilter/nf_conntrack_netlink.c +1 -1
@@ -1163,7 +1163,7 @@ ctnetlink_change_helper(struct nf_conn *return -EOPNOTSUPP ; } -RCU_INIT_POINTER (help->helper, helper); +rcu_assign_pointer (help->helper, helper);return 0 ; }
net/netfilter/nf_log.c +3 -3
@@ -55,7 +55,7 @@ int nf_log_register(u_int8_t pf, struct llog =rcu_dereference_protected (nf_loggers[pf],lockdep_is_held (&nf_log_mutex));if (llog ==NULL ) -RCU_INIT_POINTER (nf_loggers[pf], logger); +rcu_assign_pointer (nf_loggers[pf], logger); }mutex_unlock (&nf_log_mutex);
@@ -92,7 +92,7 @@ int nf_log_bind_pf(u_int8_t pf, const stmutex_unlock (&nf_log_mutex);return -ENOENT ; } -RCU_INIT_POINTER (nf_loggers[pf], logger); +rcu_assign_pointer (nf_loggers[pf], logger);mutex_unlock (&nf_log_mutex);return 0 ; }
@@ -250,7 +250,7 @@ static int nf_log_proc_dostring(ctl_tablmutex_unlock (&nf_log_mutex);return -ENOENT ; } -RCU_INIT_POINTER (nf_loggers[tindex], logger); +rcu_assign_pointer (nf_loggers[tindex], logger);mutex_unlock (&nf_log_mutex); }else {mutex_lock (&nf_log_mutex);
net/netfilter/nf_queue.c +1 -1
@@ -40,7 +40,7 @@ int nf_register_queue_handler(u_int8_t pelse if (old) ret = -EBUSY ;else { -RCU_INIT_POINTER (queue_handler[pf], qh); +rcu_assign_pointer (queue_handler[pf], qh); ret =0 ; }mutex_unlock (&queue_handler_mutex);
net/netfilter/nfnetlink.c +2 -2
@@ -59,7 +59,7 @@ int nfnetlink_subsys_register(const strunfnl_unlock ();return -EBUSY ; } -RCU_INIT_POINTER (subsys_table[n->subsys_id], n); +rcu_assign_pointer (subsys_table[n->subsys_id], n);nfnl_unlock ();return 0 ;
@@ -210,7 +210,7 @@ static int __net_init nfnetlink_net_initif (!nfnl)return -ENOMEM ; net->nfnl_stash = nfnl; -RCU_INIT_POINTER (net->nfnl, nfnl); +rcu_assign_pointer (net->nfnl, nfnl);return 0 ; }
net/netlabel/netlabel_domainhash.c +2 -2
@@ -282,7 +282,7 @@ int __init netlbl_domhsh_init(u32 size)INIT_LIST_HEAD (&hsh_tbl->tbl[iter]);spin_lock (&netlbl_domhsh_lock); -RCU_INIT_POINTER (netlbl_domhsh, hsh_tbl); +rcu_assign_pointer (netlbl_domhsh, hsh_tbl);spin_unlock (&netlbl_domhsh_lock);return 0 ;
@@ -330,7 +330,7 @@ int netlbl_domhsh_add(struct netlbl_dom_ &rcu_dereference(netlbl_domhsh)->tbl[bkt]); }else {INIT_LIST_HEAD (&entry->list); -RCU_INIT_POINTER (netlbl_domhsh_def, entry); +rcu_assign_pointer (netlbl_domhsh_def, entry); }if (entry->type ==NETLBL_NLTYPE_ADDRSELECT ) {
net/netlabel/netlabel_unlabeled.c +2 -4
@@ -354,7 +354,7 @@ static struct netlbl_unlhsh_iface *netlbINIT_LIST_HEAD (&iface->list);if (netlbl_unlhsh_rcu_deref (netlbl_unlhsh_def) !=NULL ) goto add_iface_failure; -RCU_INIT_POINTER (netlbl_unlhsh_def, iface); +rcu_assign_pointer (netlbl_unlhsh_def, iface); }spin_unlock (&netlbl_unlhsh_lock);
@@ -1447,11 +1447,9 @@ int __init netlbl_unlabel_init(u32 size)for (iter =0 ; iter < hsh_tbl->size; iter++)INIT_LIST_HEAD (&hsh_tbl->tbl[iter]); -rcu_read_lock ();spin_lock (&netlbl_unlhsh_lock); -RCU_INIT_POINTER (netlbl_unlhsh, hsh_tbl); +rcu_assign_pointer (netlbl_unlhsh, hsh_tbl);spin_unlock (&netlbl_unlhsh_lock); -rcu_read_unlock ();register_netdevice_notifier (&netlbl_unlhsh_netdev_notifier);
net/phonet/af_phonet.c +1 -1
@@ -480,7 +480,7 @@ int __init_or_module phonet_proto_registif (proto_tab[protocol]) err = -EBUSY ;else -RCU_INIT_POINTER (proto_tab[protocol], pp); +rcu_assign_pointer (proto_tab[protocol], pp);mutex_unlock (&proto_tab_lock);return err;
net/phonet/pn_dev.c +1 -1
@@ -390,7 +390,7 @@ int phonet_route_add(struct net_device * daddr = daddr >>2 ;mutex_lock (&routes->lock);if (routes->table[daddr] ==NULL ) { -RCU_INIT_POINTER (routes->table[daddr], dev); +rcu_assign_pointer (routes->table[daddr], dev);dev_hold (dev); err =0 ; }
net/phonet/socket.c +1 -1
@@ -680,7 +680,7 @@ int pn_sock_bind_res(struct sock *sk, u8mutex_lock (&resource_mutex);if (pnres.sk[res] ==NULL ) {sock_hold (sk); -RCU_INIT_POINTER (pnres.sk[res], sk); +rcu_assign_pointer (pnres.sk[res], sk); ret =0 ; }mutex_unlock (&resource_mutex);
net/socket.c +1 -1
@@ -2472,7 +2472,7 @@ int sock_register(const struct net_proto lockdep_is_held(&net_family_lock))) err = -EEXIST; else { -RCU_INIT_POINTER (net_families[ops->family], ops); +rcu_assign_pointer (net_families[ops->family], ops); err =0 ; }spin_unlock (&net_family_lock);
net/sunrpc/auth_gss/auth_gss.c +1 -1
@@ -122,7 +122,7 @@ gss_cred_set_ctx(struct rpc_cred *cred,if (!test_bit (RPCAUTH_CRED_NEW , &cred->cr_flags))return ;gss_get_ctx (ctx); -RCU_INIT_POINTER (gss_cred->gc_ctx, ctx); +rcu_assign_pointer (gss_cred->gc_ctx, ctx);set_bit (RPCAUTH_CRED_UPTODATE , &cred->cr_flags);smp_mb__before_clear_bit ();clear_bit (RPCAUTH_CRED_NEW , &cred->cr_flags);
net/xfrm/xfrm_user.c +1 -1
@@ -2927,7 +2927,7 @@ static int __net_init xfrm_user_net_initif (nlsk ==NULL )return -ENOMEM ; net->xfrm.nlsk_stash = nlsk;/* Don't set to NULL */ -RCU_INIT_POINTER (net->xfrm.nlsk, nlsk); +rcu_assign_pointer (net->xfrm.nlsk, nlsk);return 0 ; }
Greg KH
maintainerPATCH 78/89 rds: Make rds_sock_lock BH rather than IRQ safe.
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: "David S. Miller" <[email protected]>
[ Upstream commit efc3dbc37412c027e363736b4f4c74ee5e8ecffc ]
rds_sock_info() triggers locking warnings because we try to perform a local_bh_enable() (via sock_i_ino()) while hardware interrupts are disabled (via taking rds_sock_lock).
There is no reason for rds_sock_lock to be a hardware IRQ disabling lock, none of these access paths run in hardware interrupt context.
Therefore making it a BH disabling lock is safe and sufficient to fix this bug.
--- net/rds/af_rds.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
net/rds/af_rds.c +8 -12
@@ -68,7 +68,6 @@ static int rds_release(struct socket *so {struct sock *sk = sock->sk;struct rds_sock *rs; -unsigned long flags;if (!sk) goto out;
@@ -94,10 +93,10 @@ static int rds_release(struct socket *sords_rdma_drop_keys (rs);rds_notify_queue_get (rs,NULL ); -spin_lock_irqsave (&rds_sock_lock, flags); +spin_lock_bh (&rds_sock_lock);list_del_init (&rs->rs_item); rds_sock_count--; -spin_unlock_irqrestore (&rds_sock_lock, flags); +spin_unlock_bh (&rds_sock_lock);rds_trans_put (rs->rs_transport);
@@ -409,7 +408,6 @@ static const struct proto_ops rds_proto_static int __rds_create (struct socket *sock,struct sock *sk,int protocol) { -unsigned long flags;struct rds_sock *rs;sock_init_data (sock, sk);
@@ -426,10 +424,10 @@ static int __rds_create(struct socket *sspin_lock_init (&rs->rs_rdma_lock); rs->rs_rdma_keys =RB_ROOT ; -spin_lock_irqsave (&rds_sock_lock, flags); +spin_lock_bh (&rds_sock_lock);list_add_tail (&rs->rs_item, &rds_sock_list); rds_sock_count++; -spin_unlock_irqrestore (&rds_sock_lock, flags); +spin_unlock_bh (&rds_sock_lock);return 0 ; }
@@ -471,12 +469,11 @@ static void rds_sock_inc_info(struct soc {struct rds_sock *rs;struct rds_incoming *inc; -unsigned long flags;unsigned int total =0 ; len /=sizeof (struct rds_info_message ); -spin_lock_irqsave (&rds_sock_lock, flags); +spin_lock_bh (&rds_sock_lock);list_for_each_entry (rs, &rds_sock_list, rs_item) {read_lock (&rs->rs_recv_lock);
@@ -492,7 +489,7 @@ static void rds_sock_inc_info(struct socread_unlock (&rs->rs_recv_lock); } -spin_unlock_irqrestore (&rds_sock_lock, flags); +spin_unlock_bh (&rds_sock_lock); lens->nr = total; lens->each =sizeof (struct rds_info_message );
@@ -504,11 +501,10 @@ static void rds_sock_info(struct socket {struct rds_info_socket sinfo;struct rds_sock *rs; -unsigned long flags; len /=sizeof (struct rds_info_socket ); -spin_lock_irqsave (&rds_sock_lock, flags); +spin_lock_bh (&rds_sock_lock);if (len < rds_sock_count) goto out;
@@ -529,7 +525,7 @@ out: lens->nr = rds_sock_count; lens->each =sizeof (struct rds_info_socket ); -spin_unlock_irqrestore (&rds_sock_lock, flags); +spin_unlock_bh (&rds_sock_lock); }static void rds_exit (void )
Greg KH
maintainerPATCH 79/89 tcp: fix tcp_trim_head() to adjust segment count with skb MSS
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Neal Cardwell <[email protected]>
[ Upstream commit 5b35e1e6e9ca651e6b291c96d1106043c9af314a ]
This commit fixes tcp_trim_head() to recalculate the number of segments in the skb with the skb's existing MSS, so trimming the head causes the skb segment count to be monotonically non-increasing - it should stay the same or go down, but not increase.
Previously tcp_trim_head() used the current MSS of the connection. But if there was a decrease in MSS between original transmission and ACK (e.g. due to PMTUD), this could cause tcp_trim_head() to counter-intuitively increase the segment count when trimming bytes off the head of an skb. This violated assumptions in tcp_tso_acked() that tcp_trim_head() only decreases the packet count, so that packets_acked in tcp_tso_acked() could underflow, leading tcp_clean_rtx_queue() to pass u32 pkts_acked values as large as 0xffffffff to ca_ops->pkts_acked().
As an aside, if tcp_trim_head() had really wanted the skb to reflect the current MSS, it should have called tcp_set_skb_tso_segs() unconditionally, since a decrease in MSS would mean that a single-packet skb should now be sliced into multiple segments.
--- net/ipv4/tcp_output.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
net/ipv4/tcp_output.c +2 -4
@@ -1138,11 +1138,9 @@ int tcp_trim_head(struct sock *sk, strucsk_mem_uncharge (sk, len);sock_set_flag (sk,SOCK_QUEUE_SHRUNK ); -/* Any change of skb->len requires recalculation of tso -* factor and mss. -*/ +/* Any change of skb->len requires recalculation of tso factor. */ if (tcp_skb_pcount (skb) >1 ) -tcp_set_skb_tso_segs (sk, skb,tcp_current_mss (sk)); +tcp_set_skb_tso_segs (sk, skb,tcp_skb_mss (skb));return 0 ; }
Greg KH
maintainerPATCH 80/89 tcp: md5: using remote adress for md5 lookup in rst packet
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: shawnlu <[email protected]>
[ Upstream commit 8a622e71f58ec9f092fc99eacae0e6cf14f6e742 ]
md5 key is added in socket through remote address. remote address should be used in finding md5 key when sending out reset packet.
--- net/ipv4/tcp_ipv4.c | 2 +- net/ipv6/tcp_ipv6.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
net/ipv4/tcp_ipv4.c +1 -1
@@ -630,7 +630,7 @@ static void tcp_v4_send_reset(struct soc arg.iov[0 ].iov_len =sizeof (rep.th);#ifdef CONFIG_TCP_MD5SIG - key = sk ?tcp_v4_md5_do_lookup (sk,ip_hdr (skb)->daddr) :NULL ; + key = sk ?tcp_v4_md5_do_lookup (sk,ip_hdr (skb)->saddr) :NULL ;if (key) { rep.opt[0] = htonl((TCPOPT_NOP << 24) | (TCPOPT_NOP << 16) |
net/ipv6/tcp_ipv6.c +1 -1
@@ -1084,7 +1084,7 @@ static void tcp_v6_send_reset(struct soc#ifdef CONFIG_TCP_MD5SIG if (sk) - key =tcp_v6_md5_do_lookup (sk, &ipv6_hdr (skb)->daddr); + key =tcp_v6_md5_do_lookup (sk, &ipv6_hdr (skb)->saddr);#endif if (th->ack)
Greg KH
maintainerPATCH 81/89 USB: serial: CP210x: Added USB-ID for the Link Instruments MSO-19
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Renato Caldas <[email protected]>
commit 791b7d7cf69de11275e4dccec2f538eec02cbff6 upstream.
This device is a Oscilloscope/Logic Analizer/Pattern Generator/TDR, using a Silabs CP2103 USB to UART Bridge.
--- drivers/usb/serial/cp210x.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/serial/cp210x.c +1 -0
@@ -138,6 +138,7 @@ static const struct usb_device_id id_tab { USB_DEVICE(0x1843, 0x0200) }, /* Vaisala USB Instrument Cable */ { USB_DEVICE(0x18EF, 0xE00F) }, /* ELV USB-I2C-Interface */ { USB_DEVICE(0x1BE3, 0x07A6) }, /* WAGO 750-923 USB Service Cable */ + { USB_DEVICE(0x3195, 0xF190) }, /* Link Instruments MSO-19 */ { USB_DEVICE(0x413C, 0x9500) }, /* DW700 GPS USB interface */ { } /* Terminating Entry */ };
Greg KH
maintainerPATCH 82/89 USB: cp210x: call generic open last in open
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 55b2afbb92ad92e9f6b0aa4354eb1c94589280c3 upstream.
Make sure port is fully initialised before calling generic open.
--- drivers/usb/serial/cp210x.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-)
drivers/usb/serial/cp210x.c +2 -7
@@ -393,8 +393,6 @@ static unsigned int cp210x_quantise_baudstatic int cp210x_open (struct tty_struct *tty,struct usb_serial_port *port) { -int result; -dbg ("%s - port %d" , __func__, port->number);if (cp210x_set_config_single (port,CP210X_IFC_ENABLE ,UART_ENABLE )) {
@@ -403,13 +401,10 @@ static int cp210x_open(struct tty_structreturn -EPROTO ; } - result =usb_serial_generic_open (tty, port); -if (result) -return result; -/* Configure the termios structure */ cp210x_get_termios (tty, port); -return 0 ; + +return usb_serial_generic_open (tty, port); }static void cp210x_close (struct usb_serial_port *port)
Greg KH
maintainerPATCH 83/89 USB: cp210x: fix CP2104 baudrate usage
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Preston Fick <[email protected]>
commit 7f482fc88ac47662228d6b1f05759797c8936a30 upstream.
This fix changes the way baudrates are set on the CP210x devices from Silicon Labs. The CP2101/2/3 will respond to both a GET/SET_BAUDDIV command, and GET/SET_BAUDRATE command, while CP2104 and higher devices only respond to GET/SET_BAUDRATE. The current cp210x.ko driver in kernel version 3.2.0 only implements the GET/SET_BAUDDIV command.
This patch implements the two new codes for the GET/SET_BAUDRATE commands. Then there is a change in the way that the baudrate is assigned or retrieved. This is done according to the CP210x USB specification in AN571. This document can be found here:
http://www.silabs.com/pages/DownloadDoc.aspx?FILEURL=Support%20Documents/TechnicalDocs/AN571.pdf&src=DocumentationWebPart
Sections 5.3/5.4 describe the USB packets for the old baudrate method. Sections 5.5/5.6 describe the USB packets for the new method. This patch also implements the new request scheme, and eliminates the unnecessary baudrate calculations since it uses the "actual baudrate" method.
This patch solves the problem reported for the CP2104 in bug 42586, and also keeps support for all other devices (CP2101/2/3).
This patchfile is also attached to the bug report on bugzilla.kernel.org. This patch has been developed and test on the 3.2.0 mainline kernel version under Ubuntu 10.11.
--- drivers/usb/serial/cp210x.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/usb/serial/cp210x.c +4 -6
@@ -202,6 +202,8 @@ static struct usb_serial_driver cp210x_d#define CP210X_EMBED_EVENTS 0x15#define CP210X_GET_EVENTSTATE 0x16#define CP210X_SET_CHARS 0x19 +#define CP210X_GET_BAUDRATE 0x1D +#define CP210X_SET_BAUDRATE 0x1E/* CP210X_IFC_ENABLE */ #define UART_ENABLE 0x0001
@@ -456,10 +458,7 @@ static void cp210x_get_termios_port(strudbg ("%s - port %d" , __func__, port->number); -cp210x_get_config (port,CP210X_GET_BAUDDIV , &baud,2 ); -/* Convert to baudrate */ -if (baud) - baud =cp210x_quantise_baudrate ((BAUD_RATE_GEN_FREQ + baud/2 )/ baud); +cp210x_get_config (port,CP210X_GET_BAUDRATE , &baud,4 );dbg ("%s - baud rate = %d" , __func__, baud); *baudp = baud;
@@ -594,8 +593,7 @@ static void cp210x_set_termios(struct ttif (baud !=tty_termios_baud_rate (old_termios) && baud !=0 ) {dbg ("%s - Setting baud rate to %d baud" , __func__, baud); -if (cp210x_set_config_single (port,CP210X_SET_BAUDDIV , - ((BAUD_RATE_GEN_FREQ + baud/2 ) / baud))) { +if (cp210x_set_config (port,CP210X_SET_BAUDRATE , &baud,4 )) {dbg ("Baud rate requested not supported by device" ); baud =tty_termios_baud_rate (old_termios); }
Greg KH
maintainerPATCH 84/89 USB: cp210x: do not map baud rates to B0
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit be125d9c8d59560e7cc2d6e2b65c8fd233498ab7 upstream.
We do not implement B0 hangup yet so map low baudrates to 300bps.
--- drivers/usb/serial/cp210x.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/usb/serial/cp210x.c +2 -2
@@ -357,8 +357,8 @@ static inline int cp210x_set_config_sing* Quantises the baud rate as per AN205 Table 1 */ static unsigned int cp210x_quantise_baudrate (unsigned int baud) { -if (baud <=56 ) baud =0 ; -else if (baud <=300 ) baud =300 ; +if (baud <=300 ) + baud =300 ;else if (baud <=600 ) baud =600 ;else if (baud <=1200 ) baud =1200 ;else if (baud <=1800 ) baud =1800 ;
Greg KH
maintainerPATCH 85/89 USB: cp210x: fix up set_termios variables
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit 34b76fcaee574017862ea3fa0efdcd77a9d0e57d upstream.
[Based on a patch from Johan, mangled by gregkh to keep things in line]
Fix up the variable usage in the set_termios call.
--- drivers/usb/serial/cp210x.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/usb/serial/cp210x.c +3 -2
@@ -576,7 +576,8 @@ static void cp210x_set_termios(struct tt struct usb_serial_port *port, struct ktermios *old_termios) { unsigned int cflag, old_cflag; -unsigned int baud =0 , bits; +u32 baud; +unsigned int bits;unsigned int modem_ctl[4 ];dbg ("%s - port %d" , __func__, port->number);
@@ -593,7 +594,7 @@ static void cp210x_set_termios(struct ttif (baud !=tty_termios_baud_rate (old_termios) && baud !=0 ) {dbg ("%s - Setting baud rate to %d baud" , __func__, baud); -if (cp210x_set_config (port,CP210X_SET_BAUDRATE , &baud,4 )) { +if (cp210x_set_config (port,CP210X_SET_BAUDRATE , &baud,sizeof (baud))) {dbg ("Baud rate requested not supported by device" ); baud =tty_termios_baud_rate (old_termios); }
Greg KH
maintainerPATCH 86/89 USB: cp210x: clean up, refactor and document speed handling
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit e5990874e511d5bbca23b3396419480cb2ca0ee7 upstream.
Clean up and refactor speed handling. Document baud rate handling for CP210{1,2,4,5,10}.
--- drivers/usb/serial/cp210x.c | 69 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 56 insertions(+), 13 deletions(-)
drivers/usb/serial/cp210x.c +56 -13
@@ -39,6 +39,8 @@ static void cp210x_get_termios(struct tt struct usb_serial_port *port);static void cp210x_get_termios_port (struct usb_serial_port *port,unsigned int *cflagp,unsigned int *baudp); +static void cp210x_change_speed (struct tty_struct *,struct usb_serial_port *, +struct ktermios *);static void cp210x_set_termios (struct tty_struct *,struct usb_serial_port *,struct ktermios *);static int cp210x_tiocmget (struct tty_struct *);
@@ -572,11 +574,62 @@ static void cp210x_get_termios_port(stru *cflagp = cflag; } +/* +* CP2101 supports the following baud rates: +* +* 300, 600, 1200, 1800, 2400, 4800, 7200, 9600, 14400, 19200, 28800, +* 38400, 56000, 57600, 115200, 128000, 230400, 460800, 921600 +* +* CP2102 and CP2103 support the following additional rates: +* +* 4000, 16000, 51200, 64000, 76800, 153600, 250000, 256000, 500000, +* 576000 +* +* The device will map a requested rate to a supported one, but the result +* of requests for rates greater than 1053257 is undefined (see AN205). +* +* CP2104, CP2105 and CP2110 support most rates up to 2M, 921k and 1M baud, +* respectively, with an error less than 1%. The actual rates are determined +* by +* +* div = round(freq / (2 x prescale x request)) +* actual = freq / (2 x prescale x div) +* +* For CP2104 and CP2105 freq is 48Mhz and prescale is 4 for request <= 365bps +* or 1 otherwise. +* For CP2110 freq is 24Mhz and prescale is 4 for request <= 300bps or 1 +* otherwise. +*/ +static void cp210x_change_speed (struct tty_struct *tty, +struct usb_serial_port *port,struct ktermios *old_termios) +{ +u32 baud; + + baud = tty->termios->c_ospeed; + +/* This maps the requested rate to a rate valid on cp2102 or cp2103. +* +* NOTE: B0 is not implemented. +*/ + baud =cp210x_quantise_baudrate (baud); + +dbg ("%s - setting baud rate to %u" , __func__, baud); +if (cp210x_set_config (port,CP210X_SET_BAUDRATE , &baud, +sizeof (baud))) { +dev_warn (&port->dev,"failed to set baud rate to %u\n" , baud); +if (old_termios) + baud = old_termios->c_ospeed; +else + baud =9600 ; + } + +tty_encode_baud_rate (tty, baud, baud); +} +static void cp210x_set_termios (struct tty_struct *tty,struct usb_serial_port *port,struct ktermios *old_termios) {unsigned int cflag, old_cflag; -u32 baud;unsigned int bits;unsigned int modem_ctl[4 ];
@@ -588,19 +641,9 @@ static void cp210x_set_termios(struct tt tty->termios->c_cflag &= ~CMSPAR ; cflag = tty->termios->c_cflag; old_cflag = old_termios->c_cflag; - baud =cp210x_quantise_baudrate (tty_get_baud_rate (tty)); -/* If the baud rate is to be updated*/ -if (baud !=tty_termios_baud_rate (old_termios) && baud !=0 ) { -dbg ("%s - Setting baud rate to %d baud" , __func__, - baud); -if (cp210x_set_config (port,CP210X_SET_BAUDRATE , &baud,sizeof (baud))) { -dbg ("Baud rate requested not supported by device" ); - baud =tty_termios_baud_rate (old_termios); - } - } -/* Report back the resulting baud rate */ -tty_encode_baud_rate (tty, baud, baud); +if (tty->termios->c_ospeed != old_termios->c_ospeed) +cp210x_change_speed (tty, port, old_termios);/* If the number of data bits is to be updated */ if ((cflag &CSIZE ) != (old_cflag &CSIZE )) {
Greg KH
maintainerPATCH 87/89 USB: cp210x: initialise baud rate at open
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit cdc32fd6f7b2b2580d7f1b74563f888e4dd9eb8a upstream.
The newer cp2104 devices require the baud rate to be initialised after power on. Make sure it is set when port is opened.
--- drivers/usb/serial/cp210x.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/usb/serial/cp210x.c +4 -0
@@ -408,6 +408,10 @@ static int cp210x_open(struct tty_struct/* Configure the termios structure */ cp210x_get_termios (tty, port); +/* The baud rate must be initialised on cp2104 */ +if (tty) +cp210x_change_speed (tty, port,NULL ); +return usb_serial_generic_open (tty, port); }
Greg KH
maintainerPATCH 88/89 USB: cp210x: allow more baud rates above 1Mbaud
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johan Hovold <[email protected]>
commit d1620ca9e7bb0030068c3b45b653defde8839dac upstream.
Allow more baud rates to be set in [1M,2M] baud.
--- drivers/usb/serial/cp210x.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/usb/serial/cp210x.c +6 -5
@@ -388,10 +388,10 @@ static unsigned int cp210x_quantise_baudelse if (baud <=491520 ) baud =460800 ;else if (baud <=567138 ) baud =500000 ;else if (baud <=670254 ) baud =576000 ; -else if (baud <=1053257 ) baud =921600 ; -else if (baud <=1474560 ) baud =1228800 ; -else if (baud <=2457600 ) baud =1843200 ; -else baud =3686400 ; +else if (baud <1000000 ) + baud =921600 ; +else if (baud >2000000 ) + baud =2000000 ;return baud; }
@@ -611,7 +611,8 @@ static void cp210x_change_speed(struct t baud = tty->termios->c_ospeed; -/* This maps the requested rate to a rate valid on cp2102 or cp2103. +/* This maps the requested rate to a rate valid on cp2102 or cp2103, +* or to an arbitrary rate in [1M,2M]. * * NOTE: B0 is not implemented. */
Greg KH
maintainerPATCH 89/89 mach-ux500: no MMC_CAP_SD_HIGHSPEED on Snowball
In reply to Greg KH3.2-stable review patch. If anyone has any objections, please let me know.
------------------
From: Philippe Langlais <[email protected]>
commit 2ab1159e80e8f416071e9f51e4f77b9173948296 upstream.
MMC_CAP_SD_HIGHSPEED is not supported on Snowball board resulting on initialization errors.
--- arch/arm/mach-ux500/board-mop500-sdi.c | 2 ++ 1 file changed, 2 insertions(+)
arch/arm/mach-ux500/board-mop500-sdi.c +2 -0
@@ -233,6 +233,8 @@ void __init snowball_sdi_init(void) {u32 periphid =0x10480180 ; +/* On Snowball MMC_CAP_SD_HIGHSPEED isn't supported on sdi0 */ + mop500_sdi0_data.capabilities &= ~MMC_CAP_SD_HIGHSPEED ; mop500_sdi2_data.capabilities |=MMC_CAP_MMC_HIGHSPEED ;/* On-board eMMC */