3.5.1-stable review
Subsystems (75)
Greg Kroah-Hartman
maintainercover 3.5.1-stable review
From: Greg KH <[email protected]>
--------------
Note, I still have a lot more patches in the "to-apply" queue for the 3.5-stable, and other stable trees, I am pushing this update out now due to the size of it. It will take a few releases to get caught up with all of the patches tagged and requested for the stable kernel trees.
--------------
This is the start of the stable review cycle for the 3.5.1 release. There are 122 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let me know.
Responses should be made by Thu Aug 9 22:19:44 UTC 2012. 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.5.1-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
-------------
Documentation/sound/alsa/HD-Audio-Models.txt | 3 +- Documentation/stable_kernel_rules.txt | 19 ++- Makefile | 4 +- arch/arm/boot/dts/tegra-trimslice.dts | 2 + arch/arm/mach-omap2/opp.c | 3 +- arch/m68k/kernel/sys_m68k.c | 8 +- arch/mips/kernel/kspd.c | 2 +- arch/powerpc/boot/dts/p1022ds.dtsi | 16 --- arch/powerpc/include/asm/reg.h | 3 +- arch/powerpc/kernel/ftrace.c | 12 +- arch/powerpc/platforms/85xx/p1022_ds.c | 106 ++++++++++++-- arch/powerpc/platforms/pseries/eeh_event.c | 6 +- arch/s390/include/asm/mmu_context.h | 14 +- arch/s390/include/asm/processor.h | 2 + arch/s390/kernel/processor.c | 2 + arch/s390/kernel/smp.c | 3 - arch/s390/mm/fault.c | 13 +- arch/s390/mm/mmap.c | 12 +- arch/s390/mm/pgtable.c | 5 - arch/x86/kernel/cpu/mcheck/mce.c | 6 +- arch/x86/kernel/microcode_core.c | 26 +++- drivers/acpi/ac.c | 4 +- drivers/acpi/apei/apei-base.c | 5 + drivers/base/power/main.c | 10 +- drivers/char/tpm/tpm.c | 12 +- drivers/gpu/drm/nouveau/nouveau_drv.h | 2 - drivers/gpu/drm/nouveau/nouveau_irq.c | 4 - drivers/gpu/drm/nouveau/nouveau_software.h | 1 + drivers/gpu/drm/nouveau/nva3_copy.fuc | 4 +- drivers/gpu/drm/nouveau/nva3_copy.fuc.h | 94 +++++++++++- drivers/gpu/drm/nouveau/nvc0_copy.fuc.h | 87 +++++++++++- drivers/gpu/drm/radeon/atombios_dp.c | 10 +- drivers/gpu/drm/radeon/atombios_encoders.c | 12 +- drivers/gpu/drm/radeon/radeon_connectors.c | 35 +++-- drivers/gpu/drm/radeon/radeon_cs.c | 2 +- drivers/gpu/drm/radeon/radeon_cursor.c | 8 +- drivers/gpu/drm/radeon/radeon_object.c | 3 +- drivers/hid/hid-multitouch.c | 13 +- drivers/iommu/amd_iommu.c | 17 ++- drivers/iommu/amd_iommu_v2.c | 2 + drivers/md/dm-thin.c | 7 +- drivers/mmc/host/sdhci-pci.c | 1 + drivers/mmc/host/sdhci.c | 8 +- drivers/net/caif/caif_serial.c | 3 + drivers/net/ethernet/atheros/atl1c/atl1c_hw.h | 5 + drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 16 ++- drivers/net/ethernet/broadcom/tg3.c | 10 +- drivers/net/ethernet/emulex/benet/be_ethtool.c | 5 +- drivers/net/ethernet/emulex/benet/be_main.c | 2 +- drivers/net/ethernet/realtek/r8169.c | 27 +--- drivers/net/tun.c | 9 +- drivers/net/usb/kaweth.c | 2 +- drivers/net/wireless/b43/b43.h | 7 - drivers/net/wireless/b43/main.c | 32 ++--- drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 5 + drivers/net/wireless/iwlwifi/iwl-agn-sta.c | 1 + drivers/net/wireless/mwifiex/cfg80211.c | 4 +- drivers/net/wireless/rt2x00/rt2800usb.c | 3 +- drivers/net/wireless/rtlwifi/rtl8192de/phy.c | 6 +- drivers/net/wireless/rtlwifi/usb.c | 14 +- drivers/net/wireless/rtlwifi/wifi.h | 1 + drivers/s390/net/qeth_l3_main.c | 4 + drivers/scsi/hosts.c | 7 +- drivers/scsi/libsas/sas_expander.c | 47 +++--- drivers/scsi/scsi_error.c | 14 ++ drivers/scsi/scsi_lib.c | 43 ++---- drivers/scsi/scsi_priv.h | 1 - drivers/scsi/scsi_scan.c | 3 + drivers/scsi/scsi_sysfs.c | 46 +++--- drivers/spi/spi-pl022.c | 5 + drivers/staging/zsmalloc/zsmalloc-main.c | 33 +---- drivers/target/iscsi/iscsi_target.c | 22 +-- drivers/target/iscsi/iscsi_target_core.h | 2 - drivers/target/iscsi/iscsi_target_login.c | 60 +------- drivers/target/target_core_transport.c | 10 ++ drivers/usb/core/devio.c | 10 +- drivers/usb/core/hub.c | 26 ++-- drivers/usb/core/message.c | 8 +- drivers/usb/core/usb.c | 1 + drivers/usb/early/ehci-dbgp.c | 2 +- drivers/usb/gadget/u_ether.c | 12 +- drivers/usb/serial/option.c | 2 + drivers/usb/storage/uas.c | 90 ++---------- fs/btrfs/async-thread.c | 9 +- fs/cifs/cifsglob.h | 6 +- fs/cifs/connect.c | 9 +- fs/cifs/file.c | 17 ++- fs/exec.c | 2 +- fs/ext4/balloc.c | 3 +- fs/ext4/bitmap.c | 12 +- fs/ext4/ext4.h | 6 +- fs/ext4/extents.c | 46 +++--- fs/ext4/ialloc.c | 3 +- fs/ext4/inode.c | 41 ++++-- fs/ext4/namei.c | 11 +- fs/ext4/resize.c | 7 +- fs/ext4/super.c | 174 ++++++++++++++++------- fs/ext4/xattr.c | 11 +- fs/locks.c | 6 +- fs/nfs/file.c | 7 +- fs/nfs/idmap.c | 26 +++- fs/nfsd/nfs4state.c | 4 +- fs/nfsd/nfs4xdr.c | 2 +- fs/select.c | 10 +- fs/udf/super.c | 2 +- include/linux/cpu.h | 5 +- include/linux/mm.h | 1 + include/linux/net.h | 1 + include/linux/posix_types.h | 18 +-- include/linux/time.h | 8 -- include/linux/usb.h | 1 - include/target/target_core_base.h | 1 + kernel/cgroup.c | 2 +- kernel/exit.c | 2 +- kernel/futex.c | 17 ++- kernel/power/hibernate.c | 6 + kernel/power/suspend.c | 3 + kernel/power/wakelock.c | 7 + kernel/printk.c | 33 +++-- kernel/workqueue.c | 38 ++++- mm/memory-failure.c | 14 +- net/batman-adv/routing.c | 2 + net/compat.c | 4 +- net/core/rtnetlink.c | 8 +- net/ipv4/tcp.c | 5 +- net/ipv4/tcp_input.c | 4 +- net/mac80211/mlme.c | 4 +- net/mac80211/tx.c | 2 +- net/mac80211/util.c | 12 +- net/socket.c | 3 + net/sunrpc/sched.c | 2 + net/sunrpc/xprtrdma/transport.c | 3 +- net/sunrpc/xprtsock.c | 10 ++ net/wanrouter/wanmain.c | 51 +++---- security/selinux/hooks.c | 2 +- security/smack/smackfs.c | 8 +- sound/drivers/mpu401/mpu401_uart.c | 1 + sound/pci/hda/hda_codec.c | 7 + sound/pci/hda/patch_hdmi.c | 12 +- sound/pci/hda/patch_realtek.c | 29 ++++ sound/pci/hda/patch_sigmatel.c | 22 ++- sound/pci/hda/patch_via.c | 7 +- sound/soc/codecs/wm8962.c | 6 + sound/soc/codecs/wm8994.c | 2 +- sound/soc/soc-dapm.c | 15 +- sound/usb/clock.c | 3 +- 146 files changed, 1273 insertions(+), 730 deletions(-)
Greg Kroah-Hartman
maintainerPATCH 1/122 target: Add generation of LOGICAL BLOCK ADDRESS OUT OF RANGE
From: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Roland Dreier <[email protected]>
commit e2397c704429025bc6b331a970f699e52f34283e upstream.
Many SCSI commands are defined to return a CHECK CONDITION / ILLEGAL REQUEST with ASC set to LOGICAL BLOCK ADDRESS OUT OF RANGE if the initiator sends a command that accesses a too-big LBA. Add an enum value and case entries so that target code can return this status.
--- drivers/target/target_core_transport.c | 10 ++++++++++ include/target/target_core_base.h | 1 + 2 files changed, 11 insertions(+)
drivers/target/target_core_transport.c +10 -0
@@ -1797,6 +1797,7 @@ void transport_generic_request_failure(scase TCM_LOGICAL_UNIT_COMMUNICATION_FAILURE :case TCM_UNKNOWN_MODE_PAGE :case TCM_WRITE_PROTECTED : +case TCM_ADDRESS_OUT_OF_RANGE :case TCM_CHECK_CONDITION_ABORT_CMD :case TCM_CHECK_CONDITION_UNIT_ATTENTION :case TCM_CHECK_CONDITION_NOT_READY :
@@ -4212,6 +4213,15 @@ int transport_send_check_condition_and_s/* WRITE PROTECTED */ buffer[offset+SPC_ASC_KEY_OFFSET ] =0x27 ;break ; +case TCM_ADDRESS_OUT_OF_RANGE : +/* CURRENT ERROR */ + buffer[offset] =0x70 ; + buffer[offset+SPC_ADD_SENSE_LEN_OFFSET ] =10 ; +/* ILLEGAL REQUEST */ + buffer[offset+SPC_SENSE_KEY_OFFSET ] =ILLEGAL_REQUEST ; +/* LOGICAL BLOCK ADDRESS OUT OF RANGE */ + buffer[offset+SPC_ASC_KEY_OFFSET ] =0x21 ; +break ;case TCM_CHECK_CONDITION_UNIT_ATTENTION :/* CURRENT ERROR */ buffer[offset] =0x70 ;
include/target/target_core_base.h +1 -0
@@ -220,6 +220,7 @@ enum tcm_sense_reason_table {TCM_CHECK_CONDITION_UNIT_ATTENTION =0x0e ,TCM_CHECK_CONDITION_NOT_READY =0x0f ,TCM_RESERVATION_CONFLICT =0x10 , + TCM_ADDRESS_OUT_OF_RANGE = 0x11, }; enum target_sc_flags_table {
Greg Kroah-Hartman
maintainerPATCH 2/122 iscsi-target: Drop bogus struct file usage for iSCSI/SCTP
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Al Viro <[email protected]>
commit bf6932f44a7b3fa7e2246a8b18a44670e5eab6c2 upstream.
Quoted 1 line
From Al Viro:
BTW, speaking of struct file treatment related to sockets -
there's this piece of code in iscsi:
/*
* The SCTP stack needs struct socket->file.
*/
if ((np->np_network_transport == ISCSI_SCTP_TCP) ||
(np->np_network_transport == ISCSI_SCTP_UDP)) {
if (!new_sock->file) {
new_sock->file = kzalloc(
sizeof(struct file), GFP_KERNEL);For one thing, as far as I can see it'not true - sctp does *not* depend on socket->file being non-NULL; it does, in one place, check socket->file->f_flags for O_NONBLOCK, but there it treats NULL socket->file as "flag not set". Which is the case here anyway - the fake struct file created in __iscsi_target_login_thread() (and in iscsi_target_setup_login_socket(), with the same excuse) do *not* get that flag set.
Moreover, it's a bloody serious violation of a bunch of asserts in VFS; all struct file instances should come from filp_cachep, via get_empty_filp() (or alloc_file(), which is a wrapper for it). FWIW, I'm very tempted to do this and be done with the entire mess:
--- drivers/target/iscsi/iscsi_target.c | 22 +---------- drivers/target/iscsi/iscsi_target_core.h | 2 - drivers/target/iscsi/iscsi_target_login.c | 60 +----------------------------- 3 files changed, 6 insertions(+), 78 deletions(-)
drivers/target/iscsi/iscsi_target.c +3 -19
@@ -429,19 +429,8 @@ int iscsit_reset_np_thread(int iscsit_del_np_comm (struct iscsi_np *np) { -if (!np->np_socket) -return 0 ; - -/* -* Some network transports allocate their own struct sock->file, -* see if we need to free any additional allocated resources. -*/ -if (np->np_flags &NPF_SCTP_STRUCT_FILE ) { -kfree (np->np_socket->file); - np->np_socket->file =NULL ; - } - -sock_release (np->np_socket); +if (np->np_socket) +sock_release (np->np_socket);return 0 ; }
@@ -4077,13 +4066,8 @@ int iscsit_close_connection(kfree (conn->conn_ops); conn->conn_ops =NULL ; -if (conn->sock) { -if (conn->conn_flags &CONNFLAG_SCTP_STRUCT_FILE ) { -kfree (conn->sock->file); - conn->sock->file =NULL ; - } +if (conn->sock)sock_release (conn->sock); - } conn->thread_set =NULL ;pr_debug ("Moving to TARG_CONN_STATE_FREE.\n" );
drivers/target/iscsi/iscsi_target_core.h +0 -2
@@ -224,7 +224,6 @@ enum iscsi_timer_flags_table {/* Used for struct iscsi_np->np_flags */ enum np_flags_table {NPF_IP_NETWORK =0x00 , -NPF_SCTP_STRUCT_FILE =0x01 /* Bugfix */ };/* Used for struct iscsi_np->np_thread_state */
@@ -503,7 +502,6 @@ struct iscsi_conn {u16 local_port;int net_size;u32 auth_id; -#define CONNFLAG_SCTP_STRUCT_FILE 0x01u32 conn_flags;/* Used for iscsi_tx_login_rsp() */ u32 login_itt;
drivers/target/iscsi/iscsi_target_login.c +3 -57
110 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 3/122 mmc: sdhci-pci: CaFe has broken card detection
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Drake <[email protected]>
commit 55fc05b7414274f17795cd0e8a3b1546f3649d5e upstream.
At http://dev.laptop.org/ticket/11980 we have determined that the Marvell CaFe SDHCI controller reports bad card presence during resume. It reports that no card is present even when it is. This is a regression -- resume worked back around 2.6.37.
Around 400ms after resuming, a "card inserted" interrupt is generated, at which point it starts reporting presence.
Work around this hardware oddity by setting theSDHCI_QUIRK_BROKEN_CARD_DETECTION flag.
Thanks to Chris Ball for helping with diagnosis.
--- drivers/mmc/host/sdhci-pci.c | 1 + 1 file changed, 1 insertion(+)
drivers/mmc/host/sdhci-pci.c +1 -0
@@ -157,6 +157,7 @@ static const struct sdhci_pci_fixes sdhcstatic const struct sdhci_pci_fixes sdhci_cafe = { .quirks =SDHCI_QUIRK_NO_SIMULT_VDD_AND_POWER |SDHCI_QUIRK_NO_BUSY_IRQ | +SDHCI_QUIRK_BROKEN_CARD_DETECTION |SDHCI_QUIRK_BROKEN_TIMEOUT_VAL , };
Greg Kroah-Hartman
maintainerPATCH 4/122 mmc: sdhci: fix incorrect command used in tuning
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Aaron Lu <[email protected]>
commit 473b095a72a95ba719905b1f2e82cd18d099a427 upstream.
For SD hosts using retuning mode 1, when retuning timer expired, it will need to do retuning in sdhci_request before processing the actual request. But the retuning command is fixed: cmd19 for SD card and cmd21 for eMMC card, so we can't use the original request's command to do the tuning.
And since the tuning command depends on the card type attached to the host, we will need to know the card type to use the correct tuning command.
--- drivers/mmc/host/sdhci.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/mmc/host/sdhci.c +7 -1
@@ -27,6 +27,7 @@#include <linux/mmc/mmc.h> #include <linux/mmc/host.h> +#include <linux/mmc/card.h> #include "sdhci.h"
@@ -1245,6 +1246,7 @@ static void sdhci_request(struct mmc_hosstruct sdhci_host *host;bool present;unsigned long flags; +u32 tuning_opcode; host =mmc_priv (mmc);
@@ -1292,8 +1294,12 @@ static void sdhci_request(struct mmc_hos*/ if ((host->flags &SDHCI_NEEDS_RETUNING ) && !(present_state & (SDHCI_DOING_WRITE |SDHCI_DOING_READ ))) { +/* eMMC uses cmd21 while sd and sdio use cmd19 */ + tuning_opcode = mmc->card->type ==MMC_TYPE_MMC ? +MMC_SEND_TUNING_BLOCK_HS200 : +MMC_SEND_TUNING_BLOCK ;spin_unlock_irqrestore (&host->lock, flags); -sdhci_execute_tuning (mmc, mrq->cmd->opcode); +sdhci_execute_tuning (mmc, tuning_opcode);spin_lock_irqsave (&host->lock, flags);/* Restore original mmc_request structure */
Greg Kroah-Hartman
maintainerPATCH 5/122 powerpc/ftrace: Fix assembly trampoline register usage
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: roger blofeld <[email protected]>
commit fd5a42980e1cf327b7240adf5e7b51ea41c23437 upstream.
Just like the module loader, ftrace needs to be updated to use r12 instead of r11 with newer gcc's.
--- arch/powerpc/kernel/ftrace.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
arch/powerpc/kernel/ftrace.c +6 -6
@@ -245,9 +245,9 @@ __ftrace_make_nop(struct module *mod,/* * On PPC32 the trampoline looks like: -* 0x3d, 0x60, 0x00, 0x00 lis r11,sym@ha -* 0x39, 0x6b, 0x00, 0x00 addi r11,r11,sym@l -* 0x7d, 0x69, 0x03, 0xa6 mtctr r11 +* 0x3d, 0x80, 0x00, 0x00 lis r12,sym@ha +* 0x39, 0x8c, 0x00, 0x00 addi r12,r12,sym@l +* 0x7d, 0x89, 0x03, 0xa6 mtctr r12 * 0x4e, 0x80, 0x04, 0x20 bctr */
@@ -262,9 +262,9 @@ __ftrace_make_nop(struct module *mod,pr_devel (" %08x %08x " , jmp[0 ], jmp[1 ]);/* verify that this is what we expect it to be */ -if (((jmp[0 ] &0xffff0000 ) !=0x3d600000 ) || - ((jmp[1 ] &0xffff0000 ) !=0x396b0000 ) || - (jmp[2 ] !=0x7d6903a6 ) || +if (((jmp[0 ] &0xffff0000 ) !=0x3d800000 ) || + ((jmp[1 ] &0xffff0000 ) !=0x398c0000 ) || + (jmp[2 ] !=0x7d8903a6 ) || (jmp[3 ] !=0x4e800420 )) {printk (KERN_ERR "Not a trampoline\n" );return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 6/122 powerpc: Add "memory" attribute for mfmsr()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tiejun Chen <[email protected]>
commit b416c9a10baae6a177b4f9ee858b8d309542fbef upstream.
Add "memory" attribute in inline assembly language as a compiler barrier to make sure 4.6.x GCC don't reorder mfmsr().
--- arch/powerpc/include/asm/reg.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/powerpc/include/asm/reg.h +2 -1
@@ -1024,7 +1024,8 @@/* Macros for setting and retrieving special purpose registers */ #ifndef __ASSEMBLY__#define mfmsr () ({unsigned long rval; \ - asm volatile("mfmsr %0" : "=r" (rval)); rval;}) + asm volatile("mfmsr %0" : "=r" (rval) : \ + : "memory"); rval;})#ifdef CONFIG_PPC_BOOK3S_64 #define __mtmsrd (v, l) asm volatile("mtmsrd %0," __stringify(l) \ : : "r" (v) : "memory")
Greg Kroah-Hartman
maintainerPATCH 7/122 powerpc/eeh: Check handle_eeh_events() return value
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kleber Sacilotto de Souza <[email protected]>
commit 10db8d212864cb6741df7d7fafda5ab6661f6f88 upstream.
Function eeh_event_handler() dereferences the pointer returned by handle_eeh_events() without checking, causing a crash if NULL was returned, which is expected in some situations.
This patch fixes this bug by checking for the value returned by handle_eeh_events() before dereferencing it.
--- arch/powerpc/platforms/pseries/eeh_event.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
arch/powerpc/platforms/pseries/eeh_event.c +4 -2
@@ -85,8 +85,10 @@ static int eeh_event_handler(void * dummset_current_state (TASK_INTERRUPTIBLE );/* Don't add to load average */ edev =handle_eeh_events (event); -eeh_clear_slot (eeh_dev_to_of_node (edev),EEH_MODE_RECOVERING ); -pci_dev_put (edev->pdev); +if (edev) { +eeh_clear_slot (eeh_dev_to_of_node (edev),EEH_MODE_RECOVERING ); +pci_dev_put (edev->pdev); + }kfree (event);mutex_unlock (&eeh_event_mutex);
Greg Kroah-Hartman
maintainerPATCH 8/122 be2net: Missing byteswap in be_get_fw_log_level causes oops on PowerPC
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Anton Blanchard <[email protected]>
commit ac46a4623815113a0305b2a491c125f473a88c53 upstream.
We are seeing an oops in be_get_fw_log_level on ppc64 where we walk off the end of memory.
commit 941a77d582c8 (be2net: Fix to allow get/set of debug levels in the firmware.) requires byteswapping of num_modes and num_modules.
--- drivers/net/ethernet/emulex/benet/be_ethtool.c | 5 +++-- drivers/net/ethernet/emulex/benet/be_main.c | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-)
drivers/net/ethernet/emulex/benet/be_ethtool.c +3 -2
@@ -910,8 +910,9 @@ static void be_set_fw_log_level(struct bif (!status) { cfgs = (struct be_fat_conf_params *)(extfat_cmd.va +sizeof (struct be_cmd_resp_hdr )); -for (i =0 ; i < cfgs->num_modules; i++) { -for (j =0 ; j < cfgs->module[i].num_modes; j++) { +for (i =0 ; i <le32_to_cpu (cfgs->num_modules); i++) { +u32 num_modes =le32_to_cpu (cfgs->module[i].num_modes); +for (j =0 ; j < num_modes; j++) {if (cfgs->module[i].trace_lvl[j].mode ==MODE_UART ) cfgs->module[i].trace_lvl[j].dbg_lvl =
drivers/net/ethernet/emulex/benet/be_main.c +1 -1
@@ -3479,7 +3479,7 @@ u32 be_get_fw_log_level(struct be_adapteif (!status) { cfgs = (struct be_fat_conf_params *)(extfat_cmd.va +sizeof (struct be_cmd_resp_hdr )); -for (j =0 ; j < cfgs->module[0 ].num_modes; j++) { +for (j =0 ; j <le32_to_cpu (cfgs->module[0 ].num_modes); j++) {if (cfgs->module[0 ].trace_lvl[j].mode ==MODE_UART ) level = cfgs->module[0 ].trace_lvl[j].dbg_lvl; }
Greg Kroah-Hartman
maintainerPATCH 9/122 powerpc/85xx: use the BRx registers to enable indirect mode on the P1022DS
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Timur Tabi <[email protected]>
commit 6bd825f02966be8ba544047cab313d6032c23819 upstream.
In order to enable the DIU video controller on the P1022DS, the FPGA needs to be switched to "indirect mode", where the localbus is disabled and the FPGA is accessed via writes to localbus chip select signals CS0 and CS1.
To obtain the address of CS0 and CS1, the platform driver uses an "indirect pixis mode" device tree node. This node assumes that the localbus 'ranges' property is sorted in chip-select order. That is, reg value 0 maps to CS0, reg value 1 maps to CS1, etc. This is how the 'ranges' property is supposed to be arranged.
Unfortunately, the 'ranges' property is often mis-arranged, and not just on the P1022DS. Linux normally does not care, since it does not program the localbus. But the indirect-mode code on the P1022DS does care.
The "proper" fix is to have U-Boot fix the 'ranges' property, but this would be too cumbersome. The names and 'reg' properties of all the localbus devices would also need to be updated, and determining which localbus device maps to which chip select is board-specific.
Instead, we determine the CS0/CS1 base addresses the same way that U-boot does -- by reading the BRx registers directly and mapping them to physical addresses. This code is simpler and more reliable, and it does not require a U-boot or device tree change.
Since the indirect pixis device tree node is no longer needed, the node is deleted from the DTS.
--- arch/powerpc/boot/dts/p1022ds.dtsi | 16 ---- arch/powerpc/platforms/85xx/p1022_ds.c | 106 ++++++++++++++++++++++++++++----- 2 files changed, 93 insertions(+), 29 deletions(-)
arch/powerpc/boot/dts/p1022ds.dtsi +0 -16
@@ -33,22 +33,6 @@ */ &board_lbc { - /* - * This node is used to access the pixis via "indirect" mode, - * which is done by writing the pixis register index to chip - * select 0 and the value to/from chip select 1. Indirect - * mode is the only way to access the pixis when DIU video - * is enabled. Note that this assumes that the first column - * of the 'ranges' property above is the chip select number. - */ - board-control@0,0 { - compatible = "fsl,p1022ds-indirect-pixis"; - reg = <0x0 0x0 1 /* CS0 */ - 0x1 0x0 1>; /* CS1 */ - interrupt-parent = <&mpic>; - interrupts = <8 0 0 0>; - }; - nor@0,0 { #address-cells = <1>; #size-cells = <1>;
arch/powerpc/platforms/85xx/p1022_ds.c +93 -13
151 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 10/122 smack: off by one error
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Cox <[email protected]>
commit 3b9fc37280c521b086943f9aedda767f5bf3b2d3 upstream.
Consider the input case of a rule that consists entirely of non space symbols followed by a \0. Say 64 + \0
In this case strlen(data) = 64
kzalloc of subject and object are 64 byte objects
sscanfdata, "%s %s %s", subject, ...)
will put 65 bytes into subject.
--- security/smack/smackfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
security/smack/smackfs.c +4 -4
@@ -325,11 +325,11 @@ static int smk_parse_long_rule(const chaint datalen;int rc =-1 ; -/* -* This is probably inefficient, but safe. -*/ +/* This is inefficient */ datalen =strlen (data); - subject =kzalloc (datalen,GFP_KERNEL ); + +/* Our first element can be 64 + \0 with no spaces */ + subject =kzalloc (datalen +1 ,GFP_KERNEL );if (subject ==NULL )return -1 ; object =kzalloc (datalen,GFP_KERNEL );
Casey Schaufler
maintainerRe: [ 010/122] smack: off by one error
Quoted 3 lines · Greg Kroah-Hartman
From: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
No objection here.
Quoted 46 lines
------------------
From: Alan Cox <[email protected]>
commit
3b9fc37280c521b086943f9aedda767f5bf3b2d3upstream.Consider the input case of a rule that consists entirely of non space symbols followed by a \0. Say 64 + \0
In this case strlen(data) = 64
kzalloc of subject and object are 64 byte objects
sscanfdata, "%s %s %s", subject, ...)will put 65 bytes into subject.
Signed-off-by Alan Cox <[email protected]>Acked-by Casey Schaufler <[email protected]>Signed-off-by James Morris <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- security/smack/smackfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)security/smack/smackfs.c +4
-4@@ -325,11 +325,11 @@ static int smk_parse_long_rule(const chaint datalen;int rc =-1 ; -/* -* This is probably inefficient, but safe. -*/ +/* This is inefficient */ datalen =strlen (data); - subject =kzalloc (datalen,GFP_KERNEL ); + +/* Our first element can be 64 + \0 with no spaces */ + subject =kzalloc (datalen +1 ,GFP_KERNEL );if (subject ==NULL )return -1 ; object =kzalloc (datalen,GFP_KERNEL );
Casey Schaufler
maintainerRe: [ 010/122] smack: off by one error
In reply to Greg Kroah-HartmanQuoted 3 lines · Greg Kroah-Hartman
From: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
No objection here.
Quoted 51 lines
------------------
From: Alan Cox <[email protected]>
commit
3b9fc37280c521b086943f9aedda767f5bf3b2d3upstream.Consider the input case of a rule that consists entirely of non space symbols followed by a \0. Say 64 + \0
In this case strlen(data) = 64
kzalloc of subject and object are 64 byte objects
sscanfdata, "%s %s %s", subject, ...)will put 65 bytes into subject.
Signed-off-by Alan Cox <[email protected]>Acked-by Casey Schaufler <[email protected]>Signed-off-by James Morris <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- security/smack/smackfs.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)security/smack/smackfs.c +4
-5@@ -325,11 +325,11 @@ static int smk_parse_long_rule(const chaint datalen;int rc =-1 ; -/* -* This is probably inefficient, but safe. -*/ +/* This is inefficient */ datalen =strlen (data); - subject =kzalloc (datalen,GFP_KERNEL ); + +/* Our first element can be 64 + \0 with no spaces */ + subject =kzalloc (datalen +1 ,GFP_KERNEL );if (subject ==NULL )return -1 ; object =kzalloc (datalen,GFP_KERNEL ); --To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Greg Kroah-Hartman
maintainerPATCH 11/122 SCSI: libsas: continue revalidation
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 26f2f199ff150d8876b2641c41e60d1c92d2fb81 upstream.
Continue running revalidation until no more broadcast devices are discovered. Fixes cases where re-discovery completes too early in a domain with multiple expanders with pending re-discovery events. Servicing BCNs can get backed up behind error recovery.
--- drivers/scsi/libsas/sas_expander.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/scsi/libsas/sas_expander.c +4 -4
@@ -2109,9 +2109,7 @@ int sas_ex_revalidate_domain(struct domastruct domain_device *dev =NULL ; res =sas_find_bcast_dev (port_dev, &dev); -if (res) - goto out; -if (dev) { +while (res ==0 && dev) {struct expander_device *ex = &dev->ex_dev;int i =0 , phy_id;
@@ -2123,8 +2121,10 @@ int sas_ex_revalidate_domain(struct doma res =sas_rediscover (dev, phy_id); i = phy_id +1 ; }while (i < ex->num_phys); + + dev =NULL ; + res =sas_find_bcast_dev (port_dev, &dev); } -out:return res; }
Greg Kroah-Hartman
maintainerPATCH 12/122 SCSI: libsas: fix sas_discover_devices return code handling
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit b17caa174a7e1fd2e17b26e210d4ee91c4c28b37 upstream.
commit 198439e4 [SCSI] libsas: do not set res = 0 in sas_ex_discover_dev() commit 19252de6 [SCSI] libsas: fix wide port hotplug issues
The above commits seem to have confused the return value of sas_ex_discover_dev which is non-zero on failure and sas_ex_join_wide_port which just indicates short circuiting discovery on already established ports. The result is random discovery failures depending on configuration.
Calls to sas_ex_join_wide_port are the source of the trouble as its return value is errantly assigned to 'res'. Convert it to bool and stop returning its result up the stack.
--- drivers/scsi/libsas/sas_expander.c | 39 +++++++++++-------------------------- 1 file changed, 12 insertions(+), 27 deletions(-)
drivers/scsi/libsas/sas_expander.c +12 -27
@@ -868,7 +868,7 @@ static struct domain_device *sas_ex_disc }/* See if this phy is part of a wide port */ -static int sas_ex_join_wide_port (struct domain_device *parent,int phy_id) +static bool sas_ex_join_wide_port (struct domain_device *parent,int phy_id) {struct ex_phy *phy = &parent->ex_dev.ex_phy[phy_id];int i;
@@ -884,11 +884,11 @@ static int sas_ex_join_wide_port(structsas_port_add_phy (ephy->port, phy->phy); phy->port = ephy->port; phy->phy_state =PHY_DEVICE_DISCOVERED ; -return 0 ; +return true; } } -return -ENODEV ; +return false; } static struct domain_device *sas_ex_discover_expander(
@@ -1030,8 +1030,7 @@ static int sas_ex_discover_dev(struct doreturn res; } - res =sas_ex_join_wide_port (dev, phy_id); -if (!res) { +if (sas_ex_join_wide_port (dev, phy_id)) {SAS_DPRINTK ("Attaching ex phy%d to wide port %016llx\n" , phy_id,SAS_ADDR (ex_phy->attached_sas_addr));return res;
@@ -1077,8 +1076,7 @@ static int sas_ex_discover_dev(struct doif (SAS_ADDR (ex->ex_phy[i].attached_sas_addr) ==SAS_ADDR (child->sas_addr)) { ex->ex_phy[i].phy_state=PHY_DEVICE_DISCOVERED ; - res =sas_ex_join_wide_port (dev, i); -if (!res) +if (sas_ex_join_wide_port (dev, i))SAS_DPRINTK ("Attaching ex phy%d to wide port %016llx\n" , i,SAS_ADDR (ex->ex_phy[i].attached_sas_addr));
@@ -1943,32 +1941,20 @@ static int sas_discover_new(struct domai {struct ex_phy *ex_phy = &dev->ex_dev.ex_phy[phy_id];struct domain_device *child; -bool found = false; -int res, i; +int res;SAS_DPRINTK ("ex %016llx phy%d new device attached\n" ,SAS_ADDR (dev->sas_addr), phy_id); res =sas_ex_phy_discover (dev, phy_id);if (res) - goto out; -/* to support the wide port inserted */ -for (i =0 ; i < dev->ex_dev.num_phys; i++) { -struct ex_phy *ex_phy_temp = &dev->ex_dev.ex_phy[i]; -if (i == phy_id) -continue ; -if (SAS_ADDR (ex_phy_temp->attached_sas_addr) == -SAS_ADDR (ex_phy->attached_sas_addr)) { - found = true; -break ; - } - } -if (found) { -sas_ex_join_wide_port (dev, phy_id); +return res; + +if (sas_ex_join_wide_port (dev, phy_id))return 0 ; - } + res =sas_ex_discover_devices (dev, phy_id); -if (!res) - goto out; +if (res) +return res;list_for_each_entry (child, &dev->ex_dev.children, siblings) {if (SAS_ADDR (child->sas_addr) ==SAS_ADDR (ex_phy->attached_sas_addr)) {
@@ -1978,7 +1964,6 @@ static int sas_discover_new(struct domaibreak ; } } -out:return res; }
Greg Kroah-Hartman
maintainerPATCH 13/122 SCSI: fix eh wakeup (scsi_schedule_eh vs scsi_restart_operations)
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 57fc2e335fd3c2f898ee73570dc81426c28dc7b4 upstream.
Rapid ata hotplug on a libsas controller results in cases where libsas is waiting indefinitely on eh to perform an ata probe.
A race exists between scsi_schedule_eh() and scsi_restart_operations() in the case when scsi_restart_operations() issues i/o to other devices in the sas domain. When this happens the host state transitions from SHOST_RECOVERY (set by scsi_schedule_eh) back to SHOST_RUNNING and ->host_busy is non-zero so we put the eh thread to sleep even though ->host_eh_scheduled is active.
Before putting the error handler to sleep we need to check if the host_state needs to return to SHOST_RECOVERY for another trip through eh. Since i/o that is released by scsi_restart_operations has been blocked for at least one eh cycle, this implementation allows those i/o's to run before another eh cycle starts to discourage hung task timeouts.
--- drivers/scsi/scsi_error.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
drivers/scsi/scsi_error.c +14 -0
@@ -1687,6 +1687,20 @@ static void scsi_restart_operations(stru* requests are started. */ scsi_run_host_queues (shost); + +/* +* if eh is active and host_eh_scheduled is pending we need to re-run +* recovery. we do this check after scsi_run_host_queues() to allow +* everything pent up since the last eh run a chance to make forward +* progress before we sync again. Either we'll immediately re-run +* recovery or scsi_device_unbusy() will wake us again when these +* pending commands complete. +*/ +spin_lock_irqsave (shost->host_lock, flags); +if (shost->host_eh_scheduled) +if (scsi_host_set_state (shost,SHOST_RECOVERY )) +WARN_ON (scsi_host_set_state (shost,SHOST_CANCEL_RECOVERY )); +spin_unlock_irqrestore (shost->host_lock, flags); }/**
Greg Kroah-Hartman
maintainerPATCH 14/122 SCSI: fix hot unplug vs async scan race
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Williams <[email protected]>
commit 3b661a92e869ebe2358de8f4b3230ad84f7fce51 upstream.
The following crash results from cases where the end_device has been removed before scsi_sysfs_add_sdev has had a chance to run.
BUG: unable to handle kernel NULL pointer dereference at 0000000000000098 IP: [<ffffffff8115e100>] sysfs_create_dir+0x32/0xb6 ... Call Trace: [<ffffffff8125e4a8>] kobject_add_internal+0x120/0x1e3 [<ffffffff81075149>] ? trace_hardirqs_on+0xd/0xf [<ffffffff8125e641>] kobject_add_varg+0x41/0x50 [<ffffffff8125e70b>] kobject_add+0x64/0x66 [<ffffffff8131122b>] device_add+0x12d/0x63a [<ffffffff814b65ea>] ? _raw_spin_unlock_irqrestore+0x47/0x56 [<ffffffff8107de15>] ? module_refcount+0x89/0xa0 [<ffffffff8132f348>] scsi_sysfs_add_sdev+0x4e/0x28a [<ffffffff8132dcbb>] do_scan_async+0x9c/0x145
...teach scsi_sysfs_add_devices() to check for deleted devices() before trying to add them, and teach scsi_remove_target() how to remove targets that have not been added via device_add().
--- drivers/scsi/scsi_scan.c | 3 +++ drivers/scsi/scsi_sysfs.c | 41 ++++++++++++++++++++++++++--------------- 2 files changed, 29 insertions(+), 15 deletions(-)
drivers/scsi/scsi_scan.c +3 -0
@@ -1717,6 +1717,9 @@ static void scsi_sysfs_add_devices(struc {struct scsi_device *sdev;shost_for_each_device (sdev, shost) { +/* target removed before the device could be added */ +if (sdev->sdev_state ==SDEV_DEL ) +continue ;if (!scsi_host_scan_allowed (shost) ||scsi_sysfs_add_sdev (sdev) !=0 )__scsi_remove_device (sdev);
drivers/scsi/scsi_sysfs.c +26 -15
61 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 15/122 SCSI: Fix device removal NULL pointer dereference
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 67bd94130015c507011af37858989b199c52e1de upstream.
Use blk_queue_dead() to test whether the queue is dead instead of !sdev. Since scsi_prep_fn() may be invoked concurrently with __scsi_remove_device(), keep the queuedata (sdev) pointer in __scsi_remove_device(). This patch fixes a kernel oops that can be triggered by USB device removal. See also
http://www.spinics.net/lists/linux-scsi/msg56254.html.
Other changes included in this patch:
- Swap the blk_cleanup_queue() and kfree() calls in scsi_host_dev_release() to make that code easier to grasp.
- Remove the queue dead check from scsi_run_queue() since the queue state can change anyway at any point in that function where the queue lock is not held.
- Remove the queue dead check from the start of scsi_request_fn() since it is redundant with the scsi_device_online() check.
--- drivers/scsi/hosts.c | 7 ++++--- drivers/scsi/scsi_lib.c | 32 ++++---------------------------- drivers/scsi/scsi_priv.h | 1 - drivers/scsi/scsi_sysfs.c | 5 +---- 4 files changed, 9 insertions(+), 36 deletions(-)
drivers/scsi/hosts.c +4 -3
@@ -290,6 +290,7 @@ static void scsi_host_dev_release(structstruct Scsi_Host *shost =dev_to_shost (dev);struct device *parent = dev->parent;struct request_queue *q; +void *queuedata;scsi_proc_hostdir_rm (shost->hostt);
@@ -299,9 +300,9 @@ static void scsi_host_dev_release(structdestroy_workqueue (shost->work_q); q = shost->uspace_req_q;if (q) { -kfree (q->queuedata); - q->queuedata =NULL ; -scsi_free_queue (q); + queuedata = q->queuedata; +blk_cleanup_queue (q); +kfree (queuedata); }scsi_destroy_command_freelist (shost);
drivers/scsi/scsi_lib.c +4 -28
@@ -406,10 +406,6 @@ static void scsi_run_queue(struct requesLIST_HEAD (starved_list);unsigned long flags; -/* if the device is dead, sdev will be NULL, so no queue to run */ -if (!sdev) -return ; - shost = sdev->host;if (scsi_target (sdev)->single_lun)scsi_single_lun_run (sdev);
@@ -1370,16 +1366,16 @@ static inline int scsi_host_queue_ready(* may be changed after request stacking drivers call the function, * regardless of taking lock or not. * -* When scsi can't dispatch I/Os anymore and needs to kill I/Os -* (e.g. !sdev), scsi needs to return 'not busy'. -* Otherwise, request stacking drivers may hold requests forever. +* When scsi can't dispatch I/Os anymore and needs to kill I/Os scsi +* needs to return 'not busy'. Otherwise, request stacking drivers +* may hold requests forever. */ static int scsi_lld_busy (struct request_queue *q) {struct scsi_device *sdev = q->queuedata;struct Scsi_Host *shost; -if (!sdev) +if (blk_queue_dead (q))return 0 ; shost = sdev->host;
@@ -1490,12 +1486,6 @@ static void scsi_request_fn(struct requestruct scsi_cmnd *cmd;struct request *req; -if (!sdev) { -while ((req =blk_peek_request (q)) !=NULL ) -scsi_kill_request (req, q); -return ; - } -if (!get_device (&sdev->sdev_gendev))/* We must be tearing the block queue down already */ return ;
@@ -1697,20 +1687,6 @@ struct request_queue *scsi_alloc_queue(sreturn q; } -void scsi_free_queue (struct request_queue *q) -{ -unsigned long flags; - -WARN_ON (q->queuedata); - -/* cause scsi_request_fn() to kill all non-finished requests */ -spin_lock_irqsave (q->queue_lock, flags); - q->request_fn (q); -spin_unlock_irqrestore (q->queue_lock, flags); - -blk_cleanup_queue (q); -} -/* * Function: scsi_block_requests() *
drivers/scsi/scsi_priv.h +0 -1
@@ -84,7 +84,6 @@ extern void scsi_next_command(struct scsextern void scsi_io_completion (struct scsi_cmnd *,unsigned int );extern void scsi_run_host_queues (struct Scsi_Host *shost);extern struct request_queue *scsi_alloc_queue (struct scsi_device *sdev); -extern void scsi_free_queue (struct request_queue *q);extern int scsi_init_queue (void );extern void scsi_exit_queue (void );struct request_queue ;
drivers/scsi/scsi_sysfs.c +1 -4
@@ -971,11 +971,8 @@ void __scsi_remove_device(struct scsi_de sdev->host->hostt->slave_destroy (sdev);transport_destroy_device (dev); -/* cause the request function to reject all I/O requests */ - sdev->request_queue->queuedata =NULL ; -/* Freeing the queue signals to block that we're done */ -scsi_free_queue (sdev->request_queue); +blk_cleanup_queue (sdev->request_queue);put_device (dev); }
Greg Kroah-Hartman
maintainerPATCH 16/122 SCSI: Avoid dangling pointer in scsi_requeue_command()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bart Van Assche <[email protected]>
commit 940f5d47e2f2e1fa00443921a0abf4822335b54d upstream.
When we call scsi_unprep_request() the command associated with the request gets destroyed and therefore drops its reference on the device. If this was the only reference, the device may get released and we end up with a NULL pointer deref when we call blk_requeue_request.
--- drivers/scsi/scsi_lib.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
drivers/scsi/scsi_lib.c +11 -0
@@ -479,15 +479,26 @@ void scsi_requeue_run_queue(struct work_*/ static void scsi_requeue_command (struct request_queue *q,struct scsi_cmnd *cmd) { +struct scsi_device *sdev = cmd->device;struct request *req = cmd->request;unsigned long flags; +/* +* We need to hold a reference on the device to avoid the queue being +* killed after the unlock and before scsi_run_queue is invoked which +* may happen because scsi_unprep_request() puts the command which +* releases its reference on the device. +*/ +get_device (&sdev->sdev_gendev); +spin_lock_irqsave (q->queue_lock, flags);scsi_unprep_request (req);blk_requeue_request (q, req);spin_unlock_irqrestore (q->queue_lock, flags);scsi_run_queue (q); + +put_device (&sdev->sdev_gendev); }void scsi_next_command (struct scsi_cmnd *cmd)
Greg Kroah-Hartman
maintainerPATCH 17/122 rt2800usb: 2001:3c17 is an RT3370 device
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Albert Pool <[email protected]>
commit 8fd9d059af12786341dec5a688e607bcdb372238 upstream.
D-Link DWA-123 rev A1
--- drivers/net/wireless/rt2x00/rt2800usb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/wireless/rt2x00/rt2800usb.c +2 -1
@@ -1137,6 +1137,8 @@ static struct usb_device_id rt2800usb_de #ifdef CONFIG_RT2800USB_RT33XX /* Belkin */ { USB_DEVICE(0x050d, 0x945b) }, + /* D-Link */ + { USB_DEVICE(0x2001, 0x3c17) }, /* Panasonic */ { USB_DEVICE(0x083a, 0xb511) }, /* Philips */
@@ -1237,7 +1239,6 @@ static struct usb_device_id rt2800usb_de/* D-Link */ { USB_DEVICE(0x07d1, 0x3c0b) }, { USB_DEVICE(0x07d1, 0x3c17) }, - { USB_DEVICE(0x2001, 0x3c17) },/* Encore */ { USB_DEVICE(0x203d, 0x14a1) },/* Gemtek */
Greg Kroah-Hartman
maintainerPATCH 18/122 ARM: dt: tegra trimslice: enable USB2 port
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Warren <[email protected]>
commit a6a3dd1aed31ace7c827236c53d83f4e845dcff2 upstream.
This was accidentally disabled by commit 2a5fdc9 "ARM: dt: tegra:
invert status=disable vs status=okay".
--- arch/arm/boot/dts/tegra-trimslice.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/tegra-trimslice.dts +1 -0
@@ -279,6 +279,7 @@ }; usb@c5004000 { + status = "okay"; nvidia,phy-reset-gpio = <&gpio 168 0>; /* gpio PV0 */ };
Greg Kroah-Hartman
maintainerPATCH 19/122 ARM: OMAP2+: OPP: Fix to ensure check of right oppdef after bad one
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Nishanth Menon <[email protected]>
commit b110547e586eb5825bc1d04aa9147bff83b57672 upstream.
Commit 9fa2df6b90786301b175e264f5fa9846aba81a65
(ARM: OMAP2+: OPP: allow OPP enumeration to continue if device is not present) makes the logic:
for (i = 0; i < opp_def_size; i++) {
<snip>
if (!oh || !oh->od) {
<snip>
continue;
}<snip>
opp_def++;
}
In short, the moment we hit a "Bad OPP", we end up looping the list comparing against the bad opp definition pointer for the rest of the iteration count. Instead, increment opp_def in the for loop itself and allow continue to be used in code without much thought so that we check the next set of OPP definition pointers :)
--- arch/arm/mach-omap2/opp.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/arm/mach-omap2/opp.c +1 -2
@@ -53,7 +53,7 @@ int __init omap_init_opp_table(struct om omap_table_init =1 ;/* Lets now register with OPP library */ -for (i =0 ; i < opp_def_size; i++) { +for (i =0 ; i < opp_def_size; i++, opp_def++) {struct omap_hwmod *oh;struct device *dev;
@@ -86,7 +86,6 @@ int __init omap_init_opp_table(struct om __func__, opp_def->freq, opp_def->hwmod_name, i, r); } - opp_def++; }return 0 ;
Greg Kroah-Hartman
maintainerPATCH 20/122 ARM: dt: tegra trimslice: add vbus-gpio property
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Stephen Warren <[email protected]>
commit 01ad8063a5db9ac8320f197577a34b423ba64eca upstream.
On TrimSlice, Tegra's USB1 port may be routed to either an external micro USB port, or an internal USB->SATA bridge for SSD or HDD. This muxing is controlled by a GPIO. Whilst not strictly a VBUS GPIO, the TrimSlice board files caused this GPIO to be set appropriately to enable the SATA bridge by passing it as the VBUS GPIO to the USB driver. Echo this same configuration in device tree to enable the SATA bridge.
An alternative might be to implement a full USB bus mux driver. However, that seems over-complex right now.
--- arch/arm/boot/dts/tegra-trimslice.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm/boot/dts/tegra-trimslice.dts +1 -0
@@ -276,6 +276,7 @@ usb@c5000000 { status = "okay"; + nvidia,vbus-gpio = <&gpio 170 0>; /* gpio PV2 */ }; usb@c5004000 {
Greg Kroah-Hartman
maintainerPATCH 21/122 ASoC: dapm: Fix locking during codec shutdown
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Liam Girdwood <[email protected]>
commit 01005a729a17ab419f61a366e22f3419e7a2c3fe upstream.
Codec shutdown performs a DAPM power sequence that might cause conflicts and/or race conditions if another stream power event is running simultaneously. Use card's dapm mutex to protect any potential race condition between them.
--- sound/soc/soc-dapm.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/soc/soc-dapm.c +5 -0
@@ -3538,10 +3538,13 @@ EXPORT_SYMBOL_GPL(snd_soc_dapm_free);static void soc_dapm_shutdown_codec (struct snd_soc_dapm_context *dapm) { +struct snd_soc_card *card = dapm->card;struct snd_soc_dapm_widget *w;LIST_HEAD (down_list);int powerdown =0 ; +mutex_lock (&card->dapm_mutex); +list_for_each_entry (w, &dapm->card->widgets, list) {if (w->dapm != dapm)continue ;
@@ -3564,6 +3567,8 @@ static void soc_dapm_shutdown_codec(strusnd_soc_dapm_set_bias_level (dapm,SND_SOC_BIAS_STANDBY ); } + +mutex_unlock (&card->dapm_mutex); }/*
Greg Kroah-Hartman
maintainerPATCH 22/122 ASoC: dapm: Fix _PRE and _POST events for DAPM performance improvements
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 0ff97ebf0804d2e519d578fcb4db03f104d2ca8c upstream.
Ever since the DAPM performance improvements we've been marking all widgets as not dirty after each DAPM run. Since _PRE and _POST events aren't part of the DAPM graph this has rendered them non-functional, they will never be marked dirty again and thus will never be run again.
Fix this by skipping them when marking widgets as not dirty.
--- sound/soc/soc-dapm.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
sound/soc/soc-dapm.c +9 -1
@@ -1570,7 +1570,15 @@ static int dapm_power_widgets(struct snd }list_for_each_entry (w, &card->widgets, list) { -list_del_init (&w->dirty); +switch (w->id) { +case snd_soc_dapm_pre: +case snd_soc_dapm_post: +/* These widgets always need to be powered */ +break ; +default : +list_del_init (&w->dirty); +break ; + }if (w->power) { d = w->dapm;
Greg Kroah-Hartman
maintainerPATCH 23/122 ASoC: wm8962: Redo early init of the part on resume
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit e4dd76788c7e5b27165890d712c8c4f6f0abd645 upstream.
Ensure robust startup of the part by going through the reset procedure prior to resyncing the full register cache, avoiding potential intermittent faults in some designs.
--- sound/soc/codecs/wm8962.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/codecs/wm8962.c +3 -0
@@ -3722,6 +3722,9 @@ static int wm8962_runtime_resume(struct }regcache_cache_only (wm8962->regmap, false); + +wm8962_reset (wm8962); +regcache_sync (wm8962->regmap); regmap_update_bits(wm8962->regmap, WM8962_ANTI_POP,
Greg Kroah-Hartman
maintainerPATCH 24/122 ALSA: hda - Add support for Realtek ALC282
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Henningsson <[email protected]>
commit 4e01ec636e64707d202a1ca21a47bbc6d53085b7 upstream.
This codec has a separate dmic path (separate dmic only ADC), and thus it looks mostly like ALC275.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -6831,6 +6831,7 @@ static const struct hda_codec_preset snd { .id = 0x10ec0275, .name = "ALC275", .patch = patch_alc269 }, { .id = 0x10ec0276, .name = "ALC276", .patch = patch_alc269 }, { .id = 0x10ec0280, .name = "ALC280", .patch = patch_alc269 }, + { .id = 0x10ec0282, .name = "ALC282", .patch = patch_alc269 }, { .id = 0x10ec0861, .rev = 0x100340, .name = "ALC660", .patch = patch_alc861 }, { .id = 0x10ec0660, .name = "ALC660-VD", .patch = patch_alc861vd },
Greg Kroah-Hartman
maintainerPATCH 25/122 ALSA: hda - Turn on PIN_OUT from hdmi playback prepare.
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dylan Reid <[email protected]>
commit 9e76e6d031482194a5b24d8e9ab88063fbd6b4b5 upstream.
Turn on the pin widget's PIN_OUT bit from playback prepare. The pin is enabled in open, but is disabled in hdmi_init_pin which is called during system resume. This causes a system suspend/resume during playback to mute HDMI/DP. Enabling the pin in prepare instead of open allows calling snd_pcm_prepare after a system resume to restore audio.
--- sound/pci/hda/patch_hdmi.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/pci/hda/patch_hdmi.c +6 -6
@@ -876,7 +876,6 @@ static int hdmi_pcm_open(struct hda_pcm_struct hdmi_spec_per_pin *per_pin;struct hdmi_eld *eld;struct hdmi_spec_per_cvt *per_cvt =NULL ; -int pinctl;/* Validate hinfo */ pin_idx =hinfo_to_pin_index (spec, hinfo);
@@ -912,11 +911,6 @@ static int hdmi_pcm_open(struct hda_pcm_snd_hda_codec_write (codec, per_pin->pin_nid,0 ,AC_VERB_SET_CONNECT_SEL , mux_idx); - pinctl =snd_hda_codec_read (codec, per_pin->pin_nid,0 , -AC_VERB_GET_PIN_WIDGET_CONTROL ,0 ); -snd_hda_codec_write (codec, per_pin->pin_nid,0 , -AC_VERB_SET_PIN_WIDGET_CONTROL , - pinctl |PIN_OUT );snd_hda_spdif_ctls_assign (codec, pin_idx, per_cvt->cvt_nid);/* Initially set the converter's capabilities */
@@ -1153,11 +1147,17 @@ static int generic_hdmi_playback_pcm_prestruct hdmi_spec *spec = codec->spec;int pin_idx =hinfo_to_pin_index (spec, hinfo);hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid; +int pinctl;hdmi_set_channel_count (codec, cvt_nid, substream->runtime->channels);hdmi_setup_audio_infoframe (codec, pin_idx, substream); + pinctl =snd_hda_codec_read (codec, pin_nid,0 , +AC_VERB_GET_PIN_WIDGET_CONTROL ,0 ); +snd_hda_codec_write (codec, pin_nid,0 , +AC_VERB_SET_PIN_WIDGET_CONTROL , pinctl |PIN_OUT ); +return hdmi_setup_stream (codec, cvt_nid, pin_nid, stream_tag, format); }
Greg Kroah-Hartman
maintainerPATCH 26/122 ALSA: hda - Dont power up when not powered down.
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dylan Reid <[email protected]>
commit b43d224767e426cf1a8b6622d1d172f2b2b0e857 upstream.
After cancel_delayed_work_sync returns, the power down work either never started (power_on == 1) or finished (power_on == 0). In the former case there is no need to power up again.
--- sound/pci/hda/hda_codec.c | 7 +++++++ 1 file changed, 7 insertions(+)
sound/pci/hda/hda_codec.c +7 -0
@@ -4418,6 +4418,13 @@ static void __snd_hda_power_up(struct hdcancel_delayed_work_sync (&codec->power_work);spin_lock (&codec->power_lock); +/* If the power down delayed work was cancelled above before starting, +* then there is no need to go through power up here. +*/ +if (codec->power_on) { +spin_unlock (&codec->power_lock); +return ; + }trace_hda_power_up (codec);snd_hda_update_power_acct (codec); codec->power_on =1 ;
Greg Kroah-Hartman
maintainerPATCH 27/122 HID: hid-multitouch: fix input mode feature command
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Benjamin Tissoires <[email protected]>
commit 4aceed37e315e8eaa26cb4c8dfd619a32fa24669 upstream.
Zytronic panels shows a new way of setting the Input Mode feature. This feature is put in the second usage in the HID feature, instead of the first, as the majority of the multitouch devices.
This patch adds a detection step when the feature is presented to know where the feature is located in the report. We can then trigger the right command to the device. This removes the magic number "0" in the function mt_set_input_mode.
--- drivers/hid/hid-multitouch.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
drivers/hid/hid-multitouch.c +12 -1
@@ -83,6 +83,7 @@ struct mt_device {unsigned last_field_index;/* last field index of the report */ unsigned last_slot_field;/* the last field of a slot */ __s8 inputmode;/* InputMode HID feature, -1 if non-existent */ +__s8 inputmode_index;/* InputMode HID feature index in the report */ __s8 maxcontact_report_id;/* Maximum Contact Number HID feature, -1 if non-existent */ __u8 num_received;/* how many contacts we received */
@@ -260,10 +261,20 @@ static void mt_feature_mapping(struct hi struct hid_field *field, struct hid_usage *usage) { struct mt_device *td = hid_get_drvdata(hdev); +int i;switch (usage->hid) {case HID_DG_INPUTMODE : td->inputmode = field->report->id; + td->inputmode_index =0 ;/* has to be updated below */ + +for (i=0 ; i < field->maxusage; i++) { +if (field->usage[i].hid == usage->hid) { + td->inputmode_index = i; +break ; + } + } +break ;case HID_DG_CONTACTMAX : td->maxcontact_report_id = field->report->id;
@@ -618,7 +629,7 @@ static void mt_set_input_mode(struct hid re = &(hdev->report_enum[HID_FEATURE_REPORT ]); r = re->report_id_hash[td->inputmode];if (r) { - r->field[0 ]->value[0 ] =0x02 ; + r->field[0 ]->value[td->inputmode_index] =0x02 ;usbhid_submit_report (hdev, r,USB_DIR_OUT ); } }
Greg Kroah-Hartman
maintainerPATCH 28/122 usbdevfs: Correct amount of data copied to user in processcompl_compat
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hans de Goede <[email protected]>
commit 2102e06a5f2e414694921f23591f072a5ba7db9f upstream.
iso data buffers may have holes in them if some packets were short, so for iso urbs we should always copy the entire buffer, just like the regular processcompl does.
--- drivers/usb/core/devio.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/usb/core/devio.c +7 -3
@@ -1604,10 +1604,14 @@ static int processcompl_compat(struct asvoid __user *addr = as->userurb;unsigned int i; -if (as->userbuffer && urb->actual_length) -if (copy_to_user (as->userbuffer, urb->transfer_buffer, - urb->actual_length)) +if (as->userbuffer && urb->actual_length) { +if (urb->number_of_packets >0 )/* Isochronous */ + i = urb->transfer_buffer_length; +else /* Non-Isoc */ + i = urb->actual_length; +if (copy_to_user (as->userbuffer, urb->transfer_buffer, i))return -EFAULT ; + }if (put_user (as->status, &userurb->status))return -EFAULT ;if (put_user (urb->actual_length, &userurb->actual_length))
Greg Kroah-Hartman
maintainerPATCH 29/122 usb: gadget: Fix g_ether interface link status
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kevin Cernekee <[email protected]>
commit 31bde1ceaa873bcaecd49e829bfabceacc4c512d upstream.
A "usb0" interface that has never been connected to a host has an unknown operstate, and therefore the IFF_RUNNING flag is (incorrectly) asserted when queried by ifconfig, ifplugd, etc. This is a result of calling netif_carrier_off() too early in the probe function; it should be called after register_netdev().
Similar problems have been fixed in many other drivers, e.g.:
e826eafa6 (bonding: Call netif_carrier_off after register_netdevice) 0d672e9f8 (drivers/net: Call netif_carrier_off at the end of the probe) 6a3c869a6 (cxgb4: fix reported state of interfaces without link)
Fix is to move netif_carrier_off() to the end of the function.
--- drivers/usb/gadget/u_ether.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/usb/gadget/u_ether.c +6 -6
@@ -798,12 +798,6 @@ int gether_setup_name(struct usb_gadgetSET_ETHTOOL_OPS (net, &ops); -/* two kinds of host-initiated state changes: -* - iff DATA transfer is active, carrier is "on" -* - tx queueing enabled if open *and* carrier is "on" -*/ -netif_carrier_off (net); - dev->gadget = g;SET_NETDEV_DEV (net, &g->dev);SET_NETDEV_DEVTYPE (net, &gadget_type);
@@ -817,6 +811,12 @@ int gether_setup_name(struct usb_gadgetINFO (dev,"HOST MAC %pM\n" , dev->host_mac); the_dev = dev; + +/* two kinds of host-initiated state changes: +* - iff DATA transfer is active, carrier is "on" +* - tx queueing enabled if open *and* carrier is "on" +*/ +netif_carrier_off (net); }return status;
Greg Kroah-Hartman
maintainerPATCH 30/122 USB: option: add ZTE MF821D
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Bjørn Mork <[email protected]>
commit 09110529780890804b22e997ae6b4fe3f0b3b158 upstream.
Sold by O2 (telefonica germany) under the name "LTE4G"
--- drivers/usb/serial/option.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/serial/option.c +2 -0
@@ -936,6 +936,8 @@ static const struct usb_device_id option { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0165, 0xff, 0xff, 0xff) }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0167, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, + { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x0326, 0xff, 0xff, 0xff), + .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1008, 0xff, 0xff, 0xff), .driver_info = (kernel_ulong_t)&net_intf4_blacklist }, { USB_DEVICE_AND_INTERFACE_INFO(ZTE_VENDOR_ID, 0x1010, 0xff, 0xff, 0xff),
Greg Kroah-Hartman
maintainerPATCH 31/122 Revert "usb/uas: make sure data urb is gone if we receive status before that"
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Gerd Hoffmann <[email protected]>
commit c621a81edecdee85da32c566c21836332c764fda upstream.
This reverts commit e4d8318a85779b25b880187b1b1c44e797bd7d4b.
This patch makes uas.c call usb_unlink_urb on data urbs. The data urbs get freed in the completion callback. This is illegal according to the usb_unlink_urb documentation.
This patch also makes the code expect the data completion callback being called before the status completion callback. This isn't guaranteed to be the case, even though the actual data transfer should be finished by the time the status is received.
Background: The ehci irq handler for example only know that there are finished transfers, it then has go check the QHs & TDs to see which transfers did actually finish. It has no way to figure in which order the transfers did complete. The xhci driver can call the callbacks in completion order thanks to the event queue. This does nicely explain why the driver is solid on a (usb2) xhci port whereas it goes crazy on ehci in my testing.
--- drivers/usb/storage/uas.c | 90 +++++++--------------------------------------- 1 file changed, 15 insertions(+), 75 deletions(-)
drivers/usb/storage/uas.c +15 -75
@@ -58,9 +58,6 @@ enum {SUBMIT_DATA_OUT_URB = (1 <<5 ),ALLOC_CMD_URB = (1 <<6 ), SUBMIT_CMD_URB = (1 << 7), -COMPLETED_DATA_IN = (1 <<8 ), -COMPLETED_DATA_OUT = (1 <<9 ), - DATA_COMPLETES_CMD = (1 << 10), };/* Overrides scsi_pointer */
@@ -114,7 +111,6 @@ static void uas_sense(struct urb *urb, s {struct sense_iu *sense_iu = urb->transfer_buffer;struct scsi_device *sdev = cmnd->device; -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp;if (urb->actual_length >16 ) {unsigned len =be16_to_cpup (&sense_iu->len);
@@ -132,15 +128,13 @@ static void uas_sense(struct urb *urb, s } cmnd->result = sense_iu->status; -if (!(cmdinfo->state &DATA_COMPLETES_CMD )) - cmnd->scsi_done (cmnd); + cmnd->scsi_done (cmnd); }static void uas_sense_old (struct urb *urb,struct scsi_cmnd *cmnd) {struct sense_iu_old *sense_iu = urb->transfer_buffer;struct scsi_device *sdev = cmnd->device; -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp;if (urb->actual_length >8 ) {unsigned len =be16_to_cpup (&sense_iu->len) -2 ;
@@ -158,8 +152,7 @@ static void uas_sense_old(struct urb *ur } cmnd->result = sense_iu->status; -if (!(cmdinfo->state &DATA_COMPLETES_CMD )) - cmnd->scsi_done (cmnd); + cmnd->scsi_done (cmnd); } static void uas_xfer_data(struct urb *urb, struct scsi_cmnd *cmnd,
@@ -184,7 +177,6 @@ static void uas_stat_cmplt(struct urb *ustruct Scsi_Host *shost = urb->context;struct uas_dev_info *devinfo = (void *)shost->hostdata[0 ];struct scsi_cmnd *cmnd; -struct uas_cmd_info *cmdinfo;u16 tag;int ret;
@@ -210,32 +202,12 @@ static void uas_stat_cmplt(struct urb *udev_err (&urb->dev->dev,"failed submit status urb\n" );return ; } - cmdinfo = (void *)&cmnd->SCp;switch (iu->iu_id) {case IU_ID_STATUS :if (devinfo->cmnd == cmnd) devinfo->cmnd =NULL ; -if (!(cmdinfo->state &COMPLETED_DATA_IN ) && - cmdinfo->data_in_urb) { -if (devinfo->use_streams) { - cmdinfo->state |=DATA_COMPLETES_CMD ; -usb_unlink_urb (cmdinfo->data_in_urb); - }else { -usb_free_urb (cmdinfo->data_in_urb); - } - } -if (!(cmdinfo->state &COMPLETED_DATA_OUT ) && - cmdinfo->data_out_urb) { -if (devinfo->use_streams) { - cmdinfo->state |=DATA_COMPLETES_CMD ; -usb_unlink_urb (cmdinfo->data_in_urb); - }else { -usb_free_urb (cmdinfo->data_out_urb); - } - } -if (urb->actual_length <16 ) devinfo->uas_sense_old =1 ;if (devinfo->uas_sense_old)
@@ -264,59 +236,27 @@ static void uas_stat_cmplt(struct urb *udev_err (&urb->dev->dev,"failed submit status urb\n" ); } -static void uas_data_out_cmplt (struct urb *urb) -{ -struct scsi_cmnd *cmnd = urb->context; -struct scsi_data_buffer *sdb =scsi_out (cmnd); -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; - - cmdinfo->state |=COMPLETED_DATA_OUT ; - - sdb->resid = sdb->length - urb->actual_length; -usb_free_urb (urb); - -if (cmdinfo->state &DATA_COMPLETES_CMD ) - cmnd->scsi_done (cmnd); -} - -static void uas_data_in_cmplt (struct urb *urb) +static void uas_data_cmplt (struct urb *urb) { -struct scsi_cmnd *cmnd = urb->context; -struct scsi_data_buffer *sdb =scsi_in (cmnd); -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp; - - cmdinfo->state |=COMPLETED_DATA_IN ; - +struct scsi_data_buffer *sdb = urb->context; sdb->resid = sdb->length - urb->actual_length;usb_free_urb (urb); - -if (cmdinfo->state &DATA_COMPLETES_CMD ) - cmnd->scsi_done (cmnd); }static struct urb *uas_alloc_data_urb (struct uas_dev_info *devinfo,gfp_t gfp, -unsigned int pipe,struct scsi_cmnd *cmnd, -enum dma_data_direction dir) +unsigned int pipe,u16 stream_id, +struct scsi_data_buffer *sdb, +enum dma_data_direction dir) { -struct uas_cmd_info *cmdinfo = (void *)&cmnd->SCp;struct usb_device *udev = devinfo->udev;struct urb *urb =usb_alloc_urb (0 , gfp); -struct scsi_data_buffer *sdb; -usb_complete_t complete_fn; -u16 stream_id = cmdinfo->stream;if (!urb) goto out; -if (dir ==DMA_FROM_DEVICE ) { - sdb =scsi_in (cmnd); - complete_fn = uas_data_in_cmplt; - }else { - sdb =scsi_out (cmnd); - complete_fn = uas_data_out_cmplt; - } -usb_fill_bulk_urb (urb, udev, pipe,NULL , sdb->length, - complete_fn, cmnd); - urb->stream_id = stream_id; +usb_fill_bulk_urb (urb, udev, pipe,NULL , sdb->length, uas_data_cmplt, + sdb); +if (devinfo->use_streams) + urb->stream_id = stream_id; urb->num_sgs = udev->bus->sg_tablesize ? sdb->table.nents :0 ; urb->sg = sdb->table.sgl; out:
@@ -418,8 +358,8 @@ static int uas_submit_urbs(struct scsi_cif (cmdinfo->state &ALLOC_DATA_IN_URB ) { cmdinfo->data_in_urb =uas_alloc_data_urb (devinfo, gfp, - devinfo->data_in_pipe, cmnd, -DMA_FROM_DEVICE ); + devinfo->data_in_pipe, cmdinfo->stream, +scsi_in (cmnd),DMA_FROM_DEVICE );if (!cmdinfo->data_in_urb)return SCSI_MLQUEUE_DEVICE_BUSY ; cmdinfo->state &= ~ALLOC_DATA_IN_URB ;
@@ -436,8 +376,8 @@ static int uas_submit_urbs(struct scsi_cif (cmdinfo->state &ALLOC_DATA_OUT_URB ) { cmdinfo->data_out_urb =uas_alloc_data_urb (devinfo, gfp, - devinfo->data_out_pipe, cmnd, -DMA_TO_DEVICE ); + devinfo->data_out_pipe, cmdinfo->stream, +scsi_out (cmnd),DMA_TO_DEVICE );if (!cmdinfo->data_out_urb)return SCSI_MLQUEUE_DEVICE_BUSY ; cmdinfo->state &= ~ALLOC_DATA_OUT_URB ;
Greg Kroah-Hartman
maintainerPATCH 32/122 USB: Disable LPM while the device is unconfigured.
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit 9cf65991dd93ac3d5f97f536171c388918b7c1a9 upstream.
The USB 3.0 Set/Clear Feature U1/U2 Enable cannot be sent to a device in the Default or Addressed state. It can only be sent to a configured device. Change the USB core to initialize the LPM disable count to 1 (disabled), which reflects this limitation.
Change usb_set_configuration() to ensure that if the device is unconfigured on entry, usb_lpm_disable() is not called. This avoids sending the Clear Feature U1/U2 when the device is in the Addressed state. When usb_set_configuration() exits with a successfully installed configuration, usb_lpm_enable() will be called.
Once the new configuration is installed, make sure usb_set_configuration() only calls usb_enable_lpm() if the device moved to the Configured state. If we have unconfigured the device by sending it a Set Configuration for config 0, don't enable LPM.
This commit should be backported to kernels as old as 3.5, that contain the commit 8306095fd2c1100e8244c09bf560f97aca5a311d "USB: Disable USB 3.0 LPM in critical sections."
--- drivers/usb/core/message.c | 7 ++++--- drivers/usb/core/usb.c | 1 + 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/usb/core/message.c +4 -3
@@ -1791,14 +1791,15 @@ free_interfaces:* installed, so that the xHCI driver can recalculate the U1/U2 * timeouts. */ -if (usb_disable_lpm (dev)) { +if (dev->actconfig &&usb_disable_lpm (dev)) {dev_err (&dev->dev,"%s Failed to disable LPM\n." , __func__);mutex_unlock (hcd->bandwidth_mutex);return -ENOMEM ; } ret =usb_hcd_alloc_bandwidth (dev, cp,NULL ,NULL );if (ret <0 ) { -usb_enable_lpm (dev); +if (dev->actconfig) +usb_enable_lpm (dev);mutex_unlock (hcd->bandwidth_mutex);usb_autosuspend_device (dev); goto free_interfaces;
@@ -1818,7 +1819,7 @@ free_interfaces:if (!cp) {usb_set_device_state (dev,USB_STATE_ADDRESS );usb_hcd_alloc_bandwidth (dev,NULL ,NULL ,NULL ); -usb_enable_lpm (dev); +/* Leave LPM disabled while the device is unconfigured. */ mutex_unlock (hcd->bandwidth_mutex);usb_autosuspend_device (dev); goto free_interfaces;
drivers/usb/core/usb.c +1 -0
@@ -396,6 +396,7 @@ struct usb_device *usb_alloc_dev(struct dev->dev.dma_mask = bus->controller->dma_mask;set_dev_node (&dev->dev,dev_to_node (bus->controller)); dev->state =USB_STATE_ATTACHED ; + dev->lpm_disable_count =1 ;atomic_set (&dev->urbnum,0 );INIT_LIST_HEAD (&dev->ep0.urb_list);
Greg Kroah-Hartman
maintainerPATCH 33/122 USB: Fix LPM disable/enable during device reset.
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit 6d1d051330ee096f575523647fbd8ffe703600b5 upstream.
The USB 3.0 specification says that sending a Set Feature or Clear Feature for U1/U2 Enable is not a valid request when the device is in the Default or Addressed state. It is only valid when the device is in the Configured state.
The original LPM patch attempted to disable LPM after the device had been reset by hub_port_init(), before it had the configuration reinstalled. The TI hub I tested with did not fail the Clear Feature U1/U2 Enable request that khubd sent while it was in the addressed state, which is why I didn't catch it.
Move the LPM disable before the device reset, so that we can send the Clear Feature U1/U2 Enable successfully, and balance the LPM disable count.
Also delete any calls to usb_enable_lpm() on error paths that lead to re-enumeration. The calls will fail because the device isn't configured, and it's not useful to balance the LPM disable count because the usb_device is about to be destroyed before re-enumeration.
Fix the early exit path ("done" label) to call usb_enable_lpm() to balance the LPM disable count.
Note that calling usb_reset_and_verify_device() with an unconfigured device may fail on the first call to usb_disable_lpm(). That's because the LPM disable count is initialized to 0 (LPM enabled), and usb_disable_lpm() will attempt to send a Clear Feature U1/U2 request to a device in the Addressed state. The next patch will fix that.
This commit should be backported to kernels as old as 3.5, that contain the commit 8306095fd2c1100e8244c09bf560f97aca5a311d "USB: Disable USB 3.0 LPM in critical sections."
--- drivers/usb/core/hub.c | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-)
drivers/usb/core/hub.c +12 -14
@@ -4672,6 +4672,16 @@ static int usb_reset_and_verify_device(s } parent_hub =hdev_to_hub (parent_hdev); +/* Disable LPM while we reset the device and reinstall the alt settings. +* Device-initiated LPM settings, and system exit latency settings are +* cleared when the device is reset, so we have to set them up again. +*/ + ret =usb_unlocked_disable_lpm (udev); +if (ret) { +dev_err (&udev->dev,"%s Failed to disable LPM\n." , __func__); + goto re_enumerate; + } +set_bit (port1, parent_hub->busy_bits);for (i =0 ; i <SET_CONFIG_TRIES ; ++i) {
@@ -4699,22 +4709,11 @@ static int usb_reset_and_verify_device(s goto done;mutex_lock (hcd->bandwidth_mutex); -/* Disable LPM while we reset the device and reinstall the alt settings. -* Device-initiated LPM settings, and system exit latency settings are -* cleared when the device is reset, so we have to set them up again. -*/ - ret =usb_disable_lpm (udev); -if (ret) { -dev_err (&udev->dev,"%s Failed to disable LPM\n." , __func__); -mutex_unlock (hcd->bandwidth_mutex); - goto done; - } ret =usb_hcd_alloc_bandwidth (udev, udev->actconfig,NULL ,NULL );if (ret <0 ) {dev_warn (&udev->dev,"Busted HC? Not enough HCD resources for " "old configuration.\n" ); -usb_enable_lpm (udev);mutex_unlock (hcd->bandwidth_mutex); goto re_enumerate; }
@@ -4726,7 +4725,6 @@ static int usb_reset_and_verify_device(sdev_err (&udev->dev,"can't restore configuration #%d (error=%d)\n" , udev->actconfig->desc.bConfigurationValue, ret); -usb_enable_lpm (udev);mutex_unlock (hcd->bandwidth_mutex); goto re_enumerate; }
@@ -4765,17 +4763,17 @@ static int usb_reset_and_verify_device(s desc->bInterfaceNumber, desc->bAlternateSetting, ret); -usb_unlocked_enable_lpm (udev); goto re_enumerate; } } +done:/* Now that the alt settings are re-installed, enable LPM. */ usb_unlocked_enable_lpm (udev); -done:return 0 ; re_enumerate: +/* LPM state doesn't matter when we're about to destroy the device. */ hub_port_logical_disconnect (parent_hub, port1);return -ENODEV ; }
Greg Kroah-Hartman
maintainerPATCH 34/122 USB: Remove unused LPM variable.
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit c5c4bdf02e518a281b229ae0891b346919e2d291 upstream.
hub_initiated_lpm_disable_count is not used by any code, so remove it.
This commit should be backported to kernels as old as 3.5, that contain the commit 8306095fd2c1100e8244c09bf560f97aca5a311d "USB: Disable USB 3.0 LPM in critical sections."
--- include/linux/usb.h | 1 - 1 file changed, 1 deletion(-)
include/linux/usb.h +0 -1
@@ -556,7 +556,6 @@ struct usb_device {struct usb3_lpm_parameters u1_params;struct usb3_lpm_parameters u2_params;unsigned lpm_disable_count; -unsigned hub_initiated_lpm_disable_count; };#define to_usb_device (d) container_of(d, struct usb_device, dev)
Greg Kroah-Hartman
maintainerPATCH 35/122 USB: Fix LPM disable count mismatch on driver unbind.
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Sarah Sharp <[email protected]>
commit 249719121bc2b841bdfcab5eb21b10d8b871743b upstream.
When a user runs echo 0 > bConfigurationValue for a USB 3.0 device, usb_disable_device() is called. This function disables all drivers, deallocates interfaces, and sets the device configuration value to 0 (unconfigured).
With the new scheme to ensure that unconfigured devices have LPM disabled, usb_disable_device() must call usb_unlocked_disable_lpm() once it unconfigures the device.
This commit should be backported to kernels as old as 3.5, that contain the commit 8306095fd2c1100e8244c09bf560f97aca5a311d "USB: Disable USB 3.0 LPM in critical sections."
--- drivers/usb/core/message.c | 1 + 1 file changed, 1 insertion(+)
drivers/usb/core/message.c +1 -0
@@ -1174,6 +1174,7 @@ void usb_disable_device(struct usb_devicput_device (&dev->actconfig->interface[i]->dev); dev->actconfig->interface[i] =NULL ; } +usb_unlocked_disable_lpm (dev); dev->actconfig =NULL ;if (dev->state ==USB_STATE_CONFIGURED )usb_set_device_state (dev,USB_STATE_ADDRESS );
Greg Kroah-Hartman
maintainerPATCH 36/122 ALSA: hda - add dock support for Thinkpad X230 Tablet
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Henningsson <[email protected]>
commit 108cc108a3bb42fe4705df1317ff98e1e29428a6 upstream.
Also add a model/fixup string "lenovo-dock", so that other Thinkpad users will be able to test this fixup easily, to see if it enables dock I/O for them as well.
--- Documentation/sound/alsa/HD-Audio-Models.txt | 3 ++- sound/pci/hda/patch_realtek.c | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-)
Documentation/sound/alsa/HD-Audio-Models.txt +2 -1
@@ -21,10 +21,11 @@ ALC267/268 ========== N/A -ALC269 +ALC269/270/275/276/280/282 ====== laptop-amic Laptops with analog-mic input laptop-dmic Laptops with digital-mic input + lenovo-dock Enables docking station I/O for some Lenovos ALC662/663/272 ==============
sound/pci/hda/patch_realtek.c +27 -0
@@ -5704,6 +5704,15 @@ static int alc269_resume(struct hda_code }#endif /* CONFIG_PM */ +static void alc269_fixup_pincfg_no_hp_to_lineout (struct hda_codec *codec, +const struct alc_fixup *fix,int action) +{ +struct alc_spec *spec = codec->spec; + +if (action ==ALC_FIXUP_ACT_PRE_PROBE ) + spec->parse_flags =HDA_PINCFG_NO_HP_FIXUP ; +} +static void alc269_fixup_hweq (struct hda_codec *codec,const struct alc_fixup *fix,int action) {
@@ -5828,6 +5837,8 @@ enum {ALC269VB_FIXUP_AMIC ,ALC269VB_FIXUP_DMIC ,ALC269_FIXUP_MIC2_MUTE_LED , +ALC269_FIXUP_LENOVO_DOCK , + ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT, }; static const struct alc_fixup alc269_fixups[] = {
@@ -5952,6 +5963,20 @@ static const struct alc_fixup alc269_fix .type = ALC_FIXUP_FUNC, .v.func = alc269_fixup_mic2_mute, }, + [ALC269_FIXUP_LENOVO_DOCK] = { + .type = ALC_FIXUP_PINS, + .v.pins = (const struct alc_pincfg []) { + {0x19 ,0x23a11040 },/* dock mic */ + {0x1b ,0x2121103f },/* dock headphone */ + { } + }, + .chained = true, + .chain_id =ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT + }, + [ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT] = { + .type = ALC_FIXUP_FUNC, + .v.func = alc269_fixup_pincfg_no_hp_to_lineout, + }, };static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -5975,6 +6000,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x17aa ,0x21b8 ,"Thinkpad Edge 14" ,ALC269_FIXUP_SKU_IGNORE ),SND_PCI_QUIRK (0x17aa ,0x21ca ,"Thinkpad L412" ,ALC269_FIXUP_SKU_IGNORE ),SND_PCI_QUIRK (0x17aa ,0x21e9 ,"Thinkpad Edge 15" ,ALC269_FIXUP_SKU_IGNORE ), +SND_PCI_QUIRK (0x17aa ,0x2203 ,"Thinkpad X230 Tablet" ,ALC269_FIXUP_LENOVO_DOCK ),SND_PCI_QUIRK (0x17aa ,0x3bf8 ,"Quanta FL1" ,ALC269_FIXUP_QUANTA_MUTE ),SND_PCI_QUIRK (0x17aa ,0x3bf8 ,"Lenovo Ideapd" ,ALC269_FIXUP_PCM_44K ), SND_PCI_QUIRK(0x17aa, 0x9e54, "LENOVO NB", ALC269_FIXUP_LENOVO_EAPD),
@@ -6033,6 +6059,7 @@ static const struct snd_pci_quirk alc269static const struct alc_model_fixup alc269_fixup_models[] = { {.id =ALC269_FIXUP_AMIC , .name ="laptop-amic" }, {.id =ALC269_FIXUP_DMIC , .name ="laptop-dmic" }, + {.id =ALC269_FIXUP_LENOVO_DOCK , .name ="lenovo-dock" }, {} };
Greg Kroah-Hartman
maintainerPATCH 37/122 x86, microcode: Sanitize per-cpu microcode reloading interface
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Borislav Petkov <[email protected]>
commit c9fc3f778a6a215ace14ee556067c73982b6d40f upstream.
Microcode reloading in a per-core manner is a very bad idea for both major x86 vendors. And the thing is, we have such interface with which we can end up with different microcode versions applied on different cores of an otherwise homogeneous wrt (family,model,stepping) system.
So turn off the possibility of doing that per core and allow it only system-wide.
This is a minimal fix which we'd like to see in stable too thus the more-or-less arbitrary decision to allow system-wide reloading only on the BSP:
$ echo 1 > /sys/devices/system/cpu/cpu0/microcode/reload ...
and disable the interface on the other cores:
$ echo 1 > /sys/devices/system/cpu/cpu23/microcode/reload -bash: echo: write error: Invalid argument
Also, allowing the reload only from one CPU (the BSP in that case) doesn't allow the reload procedure to degenerate into an O(n^2) deal when triggering reloads from all /sys/devices/system/cpu/cpuX/microcode/reload sysfs nodes simultaneously.
A more generic fix will follow.
--- arch/x86/kernel/microcode_core.c | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-)
arch/x86/kernel/microcode_core.c +19 -7
@@ -298,19 +298,31 @@ static ssize_t reload_store(struct devic const char *buf, size_t size) { unsigned long val; -int cpu = dev->id; -ssize_t ret =0 ; +int cpu; +ssize_t ret =0 , tmp_ret; + +/* allow reload only from the BSP */ +if (boot_cpu_data.cpu_index != dev->id) +return -EINVAL ; ret =kstrtoul (buf,0 , &val);if (ret)return ret; -if (val ==1 ) { -get_online_cpus (); -if (cpu_online (cpu)) - ret =reload_for_cpu (cpu); -put_online_cpus (); +if (val !=1 ) +return size; + +get_online_cpus (); +for_each_online_cpu (cpu) { + tmp_ret =reload_for_cpu (cpu); +if (tmp_ret !=0 ) +pr_warn ("Error reloading microcode on CPU %d\n" , cpu); + +/* save retval of the first encountered reload error */ +if (!ret) + ret = tmp_ret; } +put_online_cpus ();if (!ret) ret = size;
Greg Kroah-Hartman
maintainerPATCH 38/122 x86/mce: Fix siginfo_t->si_addr value for non-recoverable memory faults
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tony Luck <[email protected]>
commit 6751ed65dc6642af64f7b8a440a75563c8aab7ae upstream.
In commit dad1743e5993f1 ("x86/mce: Only restart instruction after machine check recovery if it is safe") we fixed mce_notify_process() to force a signal to the current process if it was not restartable (RIPV bit not set in MCG_STATUS). But doing it here means that the process doesn't get told the virtual address of the fault via siginfo_t->si_addr. This would prevent application level recovery from the fault.
Make a new MF_MUST_KILL flag bit for memory_failure() et al. to use so that we will provide the right information with the signal.
--- arch/x86/kernel/cpu/mcheck/mce.c | 6 ++++-- include/linux/mm.h | 1 + mm/memory-failure.c | 14 ++++++++------ 3 files changed, 13 insertions(+), 8 deletions(-)
arch/x86/kernel/cpu/mcheck/mce.c +4 -2
@@ -1186,6 +1186,7 @@ void mce_notify_process(void) {unsigned long pfn;struct mce_info *mi =mce_find_info (); +int flags =MF_ACTION_REQUIRED ;if (!mi)mce_panic ("Lost physical address for unconsumed uncorrectable error" ,NULL ,NULL );
@@ -1200,8 +1201,9 @@ void mce_notify_process(void)* doomed. We still need to mark the page as poisoned and alert any * other users of the page. */ -if (memory_failure (pfn,MCE_VECTOR ,MF_ACTION_REQUIRED ) <0 || - mi->restartable ==0 ) { +if (!mi->restartable) + flags |=MF_MUST_KILL ; +if (memory_failure (pfn,MCE_VECTOR , flags) <0 ) {pr_err ("Memory error not recovered" );force_sig (SIGBUS , current); }
include/linux/mm.h +1 -0
@@ -1591,6 +1591,7 @@ void vmemmap_populate_print_last(void);enum mf_flags {MF_COUNT_INCREASED =1 <<0 ,MF_ACTION_REQUIRED =1 <<1 , +MF_MUST_KILL =1 <<2 , };extern int memory_failure (unsigned long pfn,int trapno,int flags);extern void memory_failure_queue (unsigned long pfn,int trapno,int flags);
mm/memory-failure.c +8 -6
@@ -345,14 +345,14 @@ static void add_to_kill(struct task_stru* Also when FAIL is set do a force kill because something went * wrong earlier. */ -static void kill_procs (struct list_head *to_kill,int doit,int trapno, +static void kill_procs (struct list_head *to_kill,int forcekill,int trapno,int fail,struct page *page,unsigned long pfn,int flags) {struct to_kill *tk, *next; list_for_each_entry_safe (tk, next, to_kill, nd) { -if (doit) { +if (forcekill) {/* * In case something went wrong with munmapping * make sure the process doesn't catch the
@@ -858,7 +858,7 @@ static int hwpoison_user_mappings(structstruct address_space *mapping;LIST_HEAD (tokill);int ret; -int kill =1 ; +int kill =1 , forcekill;struct page *hpage =compound_head (p);struct page *ppage;
@@ -888,7 +888,7 @@ static int hwpoison_user_mappings(struct* be called inside page lock (it's recommended but not enforced). */ mapping =page_mapping (hpage); -if (!PageDirty (hpage) && mapping && +if (!(flags &MF_MUST_KILL ) && !PageDirty (hpage) && mapping &&mapping_cap_writeback_dirty (mapping)) {if (page_mkclean (hpage)) {SetPageDirty (hpage);
@@ -965,12 +965,14 @@ static int hwpoison_user_mappings(struct* Now that the dirty bit has been propagated to the * struct page and all unmaps done we can decide if * killing is needed or not. Only kill when the page -* was dirty, otherwise the tokill list is merely +* was dirty or the process is not restartable, +* otherwise the tokill list is merely * freed. When there was a problem unmapping earlier * use a more force-full uncatchable kill to prevent * any accesses to the poisoned memory. */ -kill_procs (&tokill, !!PageDirty (ppage), trapno, + forcekill =PageDirty (ppage) || (flags &MF_MUST_KILL ); +kill_procs (&tokill, forcekill, trapno, ret !=SWAP_SUCCESS , p, pfn, flags);return ret;
Greg Kroah-Hartman
maintainerPATCH 39/122 locks: fix checking of fcntl_setlease argument
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit 0ec4f431eb56d633da3a55da67d5c4b88886ccc7 upstream.
The only checks of the long argument passed to fcntl(fd,F_SETLEASE,.) are done after converting the long to an int. Thus some illegal values may be let through and cause problems in later code.
[ They actually *don't* cause problems in mainline, as of Dave Jones's
commit 8d657eb3b438 "Remove easily user-triggerable BUG from generic_setlease", but we should fix this anyway. And this patch will be necessary to fix real bugs on earlier kernels. ]
--- fs/locks.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
fs/locks.c +3 -3
@@ -308,7 +308,7 @@ static int flock_make_lock(struct file *return 0 ; } -static int assign_type (struct file_lock *fl,int type) +static int assign_type (struct file_lock *fl,long type) {switch (type) {case F_RDLCK :
@@ -445,7 +445,7 @@ static const struct lock_manager_operati/* * Initialize a lease, use the default lock manager operations */ -static int lease_init (struct file *filp,int type,struct file_lock *fl) +static int lease_init (struct file *filp,long type,struct file_lock *fl) {if (assign_type (fl, type) !=0 )return -EINVAL ;
@@ -463,7 +463,7 @@ static int lease_init(struct file *filp, }/* Allocate a file_lock initialised to this type of lease */ -static struct file_lock *lease_alloc (struct file *filp,int type) +static struct file_lock *lease_alloc (struct file *filp,long type) {struct file_lock *fl =locks_alloc_lock ();int error = -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 40/122 batman-adv: fix skb->data assignment
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Quartulli <[email protected]>
commit d2b6cc8e460494251442a877fcbc150faa175b4f upstream.
skb_linearize(skb) possibly rearranges the skb internal data and then changes the skb->data pointer value. For this reason any other pointer in the code that was assigned skb->data before invoking skb_linearise(skb) must be re-assigned.
In the current tt_query message handling code this is not done and therefore, in case of skb linearization, the pointer used to handle the packet header ends up in pointing to poisoned memory. The packet is then dropped but the translation-table mechanism is corrupted.
--- net/batman-adv/routing.c | 2 ++ 1 file changed, 2 insertions(+)
net/batman-adv/routing.c +2 -0
@@ -626,6 +626,8 @@ int recv_tt_query(struct sk_buff *skb, sif (unlikely (skb_headlen (skb) <sizeof (struct tt_query_packet ) + tt_len)) goto out; +/* skb_linearize() possibly changed skb->data */ + tt_query = (struct tt_query_packet *)skb->data;handle_tt_response (bat_priv, tt_query); }else {
Re: [ 040/122] batman-adv: fix skb->data assignment
Quoted 9 lines · Greg Kroah-Hartman
From: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Antonio Quartulli <[email protected]>
commit
d2b6cc8e460494251442a877fcbc150faa175b4fupstream.
[...]
This is a duplicate of commit 2c995ff892313009e336ecc8ec3411022f5b1c39 which is already in 3.5. Please drop it.
Ben.
Signature · 2 lines
Ben Hutchings Make three consecutive correct guesses and you will be considered an expert.
Greg Kroah-Hartman
maintainerRe: [ 040/122] batman-adv: fix skb->data assignment
Quoted 7 lines · Ben Hutchings
Quoted 6 lines · Greg Kroah-Hartman
From: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
Quoted 7 lines
Quoted 3 lines
From: Antonio Quartulli <[email protected]>
commit
d2b6cc8e460494251442a877fcbc150faa175b4fupstream.[...]
This is a duplicate of commit
2c995ff892313009e336ecc8ec3411022f5b1c39which is already in 3.5. Please drop it.
Thanks for noticing this, now dropped.
greg k-h
Greg Kroah-Hartman
maintainerPATCH 41/122 ftrace: Disable function tracing during suspend/resume and hibernation, again
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Srivatsa S. Bhat" <[email protected]>
commit 443772d408a25af62498793f6f805ce3c559309a upstream.
If function tracing is enabled for some of the low-level suspend/resume functions, it leads to triple fault during resume from suspend, ultimately ending up in a reboot instead of a resume (or a total refusal to come out of suspended state, on some machines).
This issue was explained in more detail in commit f42ac38c59e0a03d (ftrace:
disable tracing for suspend to ram). However, the changes made by that commit got reverted by commit cbe2f5a6e84eebb (tracing: allow tracing of suspend/resume & hibernation code again). So, unfortunately since things are not yet robust enough to allow tracing of low-level suspend/resume functions, suspend/resume is still broken when ftrace is enabled.
So fix this by disabling function tracing during suspend/resume & hibernation.
--- kernel/power/hibernate.c | 6 ++++++ kernel/power/suspend.c | 3 +++ 2 files changed, 9 insertions(+)
kernel/power/hibernate.c +6 -0
@@ -353,6 +353,7 @@ int hibernation_snapshot(int platform_mo }suspend_console (); +ftrace_stop ();pm_restrict_gfp_mask (); error =dpm_suspend (PMSG_FREEZE );
@@ -378,6 +379,7 @@ int hibernation_snapshot(int platform_moif (error || !in_suspend)pm_restore_gfp_mask (); +ftrace_start ();resume_console ();dpm_complete (msg);
@@ -480,6 +482,7 @@ int hibernation_restore(int platform_modpm_prepare_console ();suspend_console (); +ftrace_stop ();pm_restrict_gfp_mask (); error =dpm_suspend_start (PMSG_QUIESCE );if (!error) {
@@ -487,6 +490,7 @@ int hibernation_restore(int platform_moddpm_resume_end (PMSG_RECOVER ); }pm_restore_gfp_mask (); +ftrace_start ();resume_console ();pm_restore_console ();return error;
@@ -513,6 +517,7 @@ int hibernation_platform_enter(void) entering_platform_hibernation = true;suspend_console (); +ftrace_stop (); error =dpm_suspend_start (PMSG_HIBERNATE );if (error) {if (hibernation_ops->recover)
@@ -556,6 +561,7 @@ int hibernation_platform_enter(void) Resume_devices: entering_platform_hibernation = false;dpm_resume_end (PMSG_RESTORE ); +ftrace_start ();resume_console (); Close:
kernel/power/suspend.c +3 -0
@@ -24,6 +24,7 @@#include <linux/export.h> #include <linux/suspend.h> #include <linux/syscore_ops.h> +#include <linux/ftrace.h> #include <trace/events/power.h> #include "power.h"
@@ -212,6 +213,7 @@ int suspend_devices_and_enter(suspend_st goto Close; }suspend_console (); +ftrace_stop ();suspend_test_start (); error =dpm_suspend_start (PMSG_SUSPEND );if (error) {
@@ -231,6 +233,7 @@ int suspend_devices_and_enter(suspend_stsuspend_test_start ();dpm_resume_end (PMSG_RESUME );suspend_test_finish ("resume devices" ); +ftrace_start ();resume_console (); Close:if (suspend_ops->end)
Greg Kroah-Hartman
maintainerPATCH 42/122 PM / Sleep: Require CAP_BLOCK_SUSPEND to use wake_lock/wake_unlock
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: "Rafael J. Wysocki" <[email protected]>
commit 11388c87d2abca1f01975ced28ce9eacea239104 upstream.
Require processes wanting to use the wake_lock/wake_unlock sysfs files to have the CAP_BLOCK_SUSPEND capability, which also is required for the eventpoll EPOLLWAKEUP flag to be effective, so that all interfaces related to blocking autosleep depend on the same capability.
--- kernel/power/wakelock.c | 7 +++++++ 1 file changed, 7 insertions(+)
kernel/power/wakelock.c +7 -0
@@ -9,6 +9,7 @@* manipulate wakelocks on Android. */ +#include <linux/capability.h> #include <linux/ctype.h> #include <linux/device.h> #include <linux/err.h>
@@ -188,6 +189,9 @@ int pm_wake_lock(const char *buf)size_t len;int ret =0 ; +if (!capable (CAP_BLOCK_SUSPEND )) +return -EPERM ; +while (*str && !isspace (*str)) str++;
@@ -231,6 +235,9 @@ int pm_wake_unlock(const char *buf)size_t len;int ret =0 ; +if (!capable (CAP_BLOCK_SUSPEND )) +return -EPERM ; + len =strlen (buf);if (!len)return -EINVAL ;
Greg Kroah-Hartman
maintainerPATCH 43/122 PM / Sleep: call early resume handlers when suspend_noirq fails
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Cross <[email protected]>
commit 064b021fbe470ecc9ca10f9f87af48c0fc0865fb upstream.
Commit cf579dfb82550e34de7ccf3ef090d8b834ccd3a9 (PM / Sleep: Introduce "late suspend" and "early resume" of devices) introduced a bug where suspend_late handlers would be called, but if dpm_suspend_noirq returned an error the early_resume handlers would never be called. All devices would end up on the dpm_late_early_list, and would never be resumed again.
Fix it by calling dpm_resume_early when dpm_suspend_noirq returns an error.
--- drivers/base/power/main.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/base/power/main.c +9 -1
@@ -989,8 +989,16 @@ static int dpm_suspend_late(pm_message_tint dpm_suspend_end (pm_message_t state) {int error =dpm_suspend_late (state); +if (error) +return error; -return error ? :dpm_suspend_noirq (state); + error =dpm_suspend_noirq (state); +if (error) { +dpm_resume_early (state); +return error; + } + +return 0 ; }EXPORT_SYMBOL_GPL (dpm_suspend_end);
Greg Kroah-Hartman
maintainerPATCH 44/122 TPM: chip disabled state erronously being reported as error
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Rajiv Andrade <[email protected]>
commit 24ebe6670de3d1f0dca11c9eb372134c7ab05503 upstream.
tpm_do_selftest() attempts to read a PCR in order to decide if one can rely on the TPM being used or not. The function that's used by __tpm_pcr_read() does not expect the TPM to be disabled or deactivated, and if so, reports an error.
It's fine if the TPM returns this error when trying to use it for the first time after a power cycle, but it's definitely not if it already returned success for a previous attempt to read one of its PCRs.
The tpm_do_selftest() was modified so that the driver only reports this return code as an error when it really is.
--- drivers/char/tpm/tpm.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/char/tpm/tpm.c +10 -2
@@ -827,10 +827,10 @@ EXPORT_SYMBOL_GPL(tpm_pcr_extend);int tpm_do_selftest (struct tpm_chip *chip) {int rc; -u8 digest[TPM_DIGEST_SIZE ];unsigned int loops;unsigned int delay_msec =1000 ;unsigned long duration; +struct tpm_cmd_t cmd; duration =tpm_calc_ordinal_duration (chip,TPM_ORD_CONTINUE_SELFTEST );
@@ -845,7 +845,15 @@ int tpm_do_selftest(struct tpm_chip *chireturn rc; do { - rc = __tpm_pcr_read(chip, 0, digest); + /* Attempt to read a PCR value */ + cmd.header.in = pcrread_header; + cmd.params.pcrread_in.pcr_idx = cpu_to_be32(0); + rc = tpm_transmit(chip, (u8 *) &cmd, READ_PCR_RESULT_SIZE); + + if (rc < TPM_HEADER_SIZE) + return -EFAULT; + + rc = be32_to_cpu(cmd.header.out.return_code); if (rc == TPM_ERR_DISABLED || rc == TPM_ERR_DEACTIVATED) { dev_info(chip->dev, "TPM is disabled/deactivated (0x%X)\n", rc);
Greg Kroah-Hartman
maintainerPATCH 45/122 tun: fix a crash bug and a memory leak
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mikulas Patocka <[email protected]>
commit b09e786bd1dd66418b69348cb110f3a64764626a upstream.
This patch fixes a crashtun_chr_close -> netdev_run_todo -> tun_free_netdev -> sk_release_kernel -> sock_release -> iput(SOCK_INODE(sock))
introduced by commit 1ab5ecb90cb6a3df1476e052f76a6e8f6511cb3d
The problem is that this socket is embedded in struct tun_struct, it has no inode, iput is called on invalid inode, which modifies invalid memory and optionally causes a crash.
sock_release also decrements sockets_in_use, this causes a bug that "sockets: used" field in /proc/*/net/sockstat keeps on decreasing when creating and closing tun devices.
This patch introduces a flag SOCK_EXTERNALLY_ALLOCATED that instructs sock_release to not free the inode and not decrement sockets_in_use, fixing both memory corruption and sockets_in_use underflow.
It should be backported to 3.3 an 3.4 stabke.
--- drivers/net/tun.c | 3 +++ include/linux/net.h | 1 + net/socket.c | 3 +++ 3 files changed, 7 insertions(+)
drivers/net/tun.c +3 -0
@@ -358,6 +358,8 @@ static void tun_free_netdev(struct net_d {struct tun_struct *tun =netdev_priv (dev); +BUG_ON (!test_bit (SOCK_EXTERNALLY_ALLOCATED , &tun->socket.flags)); +sk_release_kernel (tun->socket.sk); }
@@ -1115,6 +1117,7 @@ static int tun_set_iff(struct net *net, tun->flags = flags; tun->txflt.count =0 ; tun->vnet_hdr_sz =sizeof (struct virtio_net_hdr ); +set_bit (SOCK_EXTERNALLY_ALLOCATED , &tun->socket.flags); err = -ENOMEM ; sk =sk_alloc (&init_net,AF_UNSPEC ,GFP_KERNEL , &tun_proto);
include/linux/net.h +1 -0
@@ -72,6 +72,7 @@ struct net;#define SOCK_NOSPACE 2#define SOCK_PASSCRED 3#define SOCK_PASSSEC 4 +#define SOCK_EXTERNALLY_ALLOCATED 5#ifndef ARCH_HAS_SOCKET_TYPES /**
net/socket.c +3 -0
@@ -522,6 +522,9 @@ void sock_release(struct socket *sock)if (rcu_dereference_protected (sock->wq,1 )->fasync_list)printk (KERN_ERR "sock_release: fasync list not empty!\n" ); +if (test_bit (SOCK_EXTERNALLY_ALLOCATED , &sock->flags)) +return ; +this_cpu_sub (sockets_in_use,1 );if (!sock->file) {iput (SOCK_INODE (sock));
Greg Kroah-Hartman
maintainerPATCH 46/122 mac80211: fix crash with single-queue drivers
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit a6f38ac3cc853189705006cc1e0f17ce8467a1df upstream.
Larry (and some others I think) reported that with single-queue drivers mac80211 crashes when waking the queues. This happens because we allocate just a single queue for each virtual interface in case the driver doesn't have at least 4 queues, but the code stopping/waking the virtual interface queues wasn't taking this into account.
--- net/mac80211/util.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
net/mac80211/util.c +10 -2
@@ -268,6 +268,10 @@ EXPORT_SYMBOL(ieee80211_ctstoself_durativoid ieee80211_propagate_queue_wake (struct ieee80211_local *local,int queue) {struct ieee80211_sub_if_data *sdata; +int n_acs =IEEE80211_NUM_ACS ; + +if (local->hw.queues <IEEE80211_NUM_ACS ) + n_acs =1 ;list_for_each_entry_rcu (sdata, &local->interfaces, list) {int ac;
@@ -279,7 +283,7 @@ void ieee80211_propagate_queue_wake(stru local->queue_stop_reasons[sdata->vif.cab_queue] != 0)continue ; -for (ac =0 ; ac <IEEE80211_NUM_ACS ; ac++) { +for (ac =0 ; ac < n_acs; ac++) {int ac_queue = sdata->vif.hw_queue[ac]; if (ac_queue == queue ||
@@ -341,6 +345,7 @@ static void __ieee80211_stop_queue(struc {struct ieee80211_local *local =hw_to_local (hw);struct ieee80211_sub_if_data *sdata; +int n_acs =IEEE80211_NUM_ACS ;trace_stop_queue (local, queue, reason);
@@ -352,11 +357,14 @@ static void __ieee80211_stop_queue(struc__set_bit (reason, &local->queue_stop_reasons[queue]); +if (local->hw.queues <IEEE80211_NUM_ACS ) + n_acs =1 ; +rcu_read_lock ();list_for_each_entry_rcu (sdata, &local->interfaces, list) {int ac; -for (ac =0 ; ac <IEEE80211_NUM_ACS ; ac++) { +for (ac =0 ; ac < n_acs; ac++) {if (sdata->vif.hw_queue[ac] == queue || sdata->vif.cab_queue == queue)netif_stop_subqueue (sdata->dev, ac);
Greg Kroah-Hartman
maintainerPATCH 47/122 b43: fix crash with OpenFWWF
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Johannes Berg <[email protected]>
commit 097b0e1bf18a00195cd89bb13565ddbc9b0df942 upstream.
b43 with open firmware crashes mac80211 because it changes the number of queues at runtime which, while it was never really supported, now crashes mac80211 due to the new hardware queue logic.
Fix this by detecting open vs. proprietary fw earlier and registering with mac80211 with the right number of queues.
--- drivers/net/wireless/b43/b43.h | 7 ------- drivers/net/wireless/b43/main.c | 32 ++++++++++---------------------- 2 files changed, 10 insertions(+), 29 deletions(-)
drivers/net/wireless/b43/b43.h +0 -7
@@ -870,13 +870,6 @@ struct b43_wl {* handler, only. This basically is just the IRQ mask register. */ spinlock_t hardirq_lock; -/* The number of queues that were registered with the mac80211 subsystem -* initially. This is a backup copy of hw->queues in case hw->queues has -* to be dynamically lowered at runtime (Firmware does not support QoS). -* hw->queues has to be restored to the original value before unregistering -* from the mac80211 subsystem. */ -u16 mac80211_initially_registered_queues; -/* Set this if we call ieee80211_register_hw() and check if we call * ieee80211_unregister_hw(). */ bool hw_registred;
drivers/net/wireless/b43/main.c +10 -22
@@ -2359,6 +2359,8 @@ static int b43_try_request_fw(struct b43if (err) goto err_load; + fw->opensource = (ctx->req_type ==B43_FWTYPE_OPENSOURCE ); +return 0 ; err_no_ucode:
@@ -2434,6 +2436,10 @@ static void b43_request_firmware(struct goto out; start_ieee80211: + wl->hw->queues =B43_QOS_QUEUE_NUM ; +if (!modparam_qos || dev->fw.opensource) + wl->hw->queues =1 ; + err =ieee80211_register_hw (wl->hw);if (err) goto err_one_core_detach;
@@ -2537,11 +2543,9 @@ static int b43_upload_microcode(struct b dev->fw.hdr_format =B43_FW_HDR_410 ; else dev->fw.hdr_format = B43_FW_HDR_351; - dev->fw.opensource = (fwdate ==0xFFFF ); +WARN_ON (dev->fw.opensource != (fwdate ==0xFFFF )); -/* Default to use-all-queues. */ - dev->wl->hw->queues = dev->wl->mac80211_initially_registered_queues; - dev->qos_enabled = !!modparam_qos; + dev->qos_enabled = dev->wl->hw->queues >1 ;/* Default to firmware/hardware crypto acceleration. */ dev->hwcrypto_enabled = true;
@@ -2559,14 +2563,8 @@ static int b43_upload_microcode(struct b/* Disable hardware crypto and fall back to software crypto. */ dev->hwcrypto_enabled = false; } -if (!(fwcapa &B43_FWCAPA_QOS )) { -b43info (dev->wl,"QoS not supported by firmware\n" ); -/* Disable QoS. Tweak hw->queues to 1. It will be restored before -* ieee80211_unregister to make sure the networking core can -* properly free possible resources. */ - dev->wl->hw->queues =1 ; - dev->qos_enabled = false; - } +/* adding QoS support should use an offline discovery mechanism */ +WARN (fwcapa &B43_FWCAPA_QOS ,"QoS in OpenFW not supported\n" ); }else { b43info(dev->wl, "Loading firmware version %u.%u " "(20%.2i-%.2i-%.2i %.2i:%.2i:%.2i)\n",
@@ -5298,8 +5296,6 @@ static struct b43_wl *b43_wireless_init( hw->wiphy->flags |=WIPHY_FLAG_IBSS_RSN ; - hw->queues = modparam_qos ?B43_QOS_QUEUE_NUM :1 ; - wl->mac80211_initially_registered_queues = hw->queues; wl->hw_registred = false; hw->max_rates =2 ;SET_IEEE80211_DEV (hw, dev->dev);
@@ -5374,10 +5370,6 @@ static void b43_bcma_remove(struct bcma_B43_WARN_ON (!wl);if (wl->current_dev == wldev && wl->hw_registred) { -/* Restore the queues count before unregistering, because firmware detect -* might have modified it. Restoring is important, so the networking -* stack can properly free resources. */ - wl->hw->queues = wl->mac80211_initially_registered_queues;b43_leds_stop (wldev);ieee80211_unregister_hw (wl->hw); }
@@ -5452,10 +5444,6 @@ static void b43_ssb_remove(struct ssb_deB43_WARN_ON (!wl);if (wl->current_dev == wldev && wl->hw_registred) { -/* Restore the queues count before unregistering, because firmware detect -* might have modified it. Restoring is important, so the networking -* stack can properly free resources. */ - wl->hw->queues = wl->mac80211_initially_registered_queues;b43_leds_stop (wldev);ieee80211_unregister_hw (wl->hw); }
Greg Kroah-Hartman
maintainerPATCH 48/122 mac80211: fix read outside array bounds
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian Lamparter <[email protected]>
commit 353d09c6ceedc1cb0c54fe5002c0ca80b6ee6e4f upstream.
ieee802_1d_to_ac is defined as a const int[8],
but the tid parameter has a range from 0 to 15.
--- net/mac80211/tx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/mac80211/tx.c +1 -1
@@ -2733,7 +2733,7 @@ EXPORT_SYMBOL(ieee80211_get_buffered_bc)void ieee80211_tx_skb_tid (struct ieee80211_sub_if_data *sdata,struct sk_buff *skb,int tid) { -int ac = ieee802_1d_to_ac[tid]; +int ac = ieee802_1d_to_ac[tid &7 ];skb_set_mac_header (skb,0 );skb_set_network_header (skb,0 );
Greg Kroah-Hartman
maintainerPATCH 49/122 mac80211: fail authentication when AP denied authentication
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eliad Peller <[email protected]>
commit dac211ec10d268b9d09000093a9fa2ac1773894f upstream.
ieee80211_rx_mgmt_auth() doesn't handle denied authentication properly - it authenticates the station and waits for association (for 5 seconds) instead of failing the authentication.
Fix it by destroying auth_data and bailing out instead.
--- net/mac80211/mlme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/mac80211/mlme.c +2 -2
@@ -1805,7 +1805,8 @@ ieee80211_rx_mgmt_auth(struct ieee80211_if (status_code !=WLAN_STATUS_SUCCESS ) {printk (KERN_DEBUG "%s: %pM denied authentication (status %d)\n" , sdata->name, mgmt->sa, status_code); - goto out; +ieee80211_destroy_auth_data (sdata, false); +return RX_MGMT_CFG80211_RX_AUTH ; }switch (ifmgd->auth_data->algorithm) {
@@ -1827,7 +1828,6 @@ ieee80211_rx_mgmt_auth(struct ieee80211_ }printk (KERN_DEBUG "%s: authenticated\n" , sdata->name); - out: ifmgd->auth_data->done = true; ifmgd->auth_data->timeout = jiffies +IEEE80211_AUTH_WAIT_ASSOC ;run_again (ifmgd, ifmgd->auth_data->timeout);
Greg Kroah-Hartman
maintainerPATCH 50/122 iwlwifi: Check BSS ctx active before call mac80211
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ilan Peer <[email protected]>
commit e19ebcab01cc130fa832764d453b263460ec3b91 upstream.
It is possible that the BSS context is not active (for example when the current mode is set to GO), or that the vif->type is different than station. In such a case we cannot call mac80211 to report the average rssi for the interface (the function assumes that the vif is valid and that the type is station).
--- drivers/net/wireless/iwlwifi/iwl-agn-lib.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/net/wireless/iwlwifi/iwl-agn-lib.c +5 -0
@@ -617,6 +617,11 @@ static bool iwlagn_fill_txpower_mode(strstruct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS ];int ave_rssi; +if (!ctx->vif || (ctx->vif->type !=NL80211_IFTYPE_STATION )) { +IWL_DEBUG_INFO (priv,"BSS ctx not active or not in sta mode\n" ); +return false; + } + ave_rssi =ieee80211_ave_rssi (ctx->vif);if (!ave_rssi) {/* no rssi data, no changes to reduce tx power */
Greg Kroah-Hartman
maintainerPATCH 51/122 iwlwifi: fix debug print in iwl_sta_calc_ht_flags
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Meenakshi Venkataraman <[email protected]>
commit a35e270881a5db1ec9ac8bc6d61ebc3e85c14f33 upstream.
We missed passing an argument to the
debug print. Fix it.
--- drivers/net/wireless/iwlwifi/iwl-agn-sta.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/wireless/iwlwifi/iwl-agn-sta.c +1 -0
@@ -236,6 +236,7 @@ static void iwl_sta_calc_ht_flags(struct mimo_ps_mode = (sta_ht_inf->cap &IEEE80211_HT_CAP_SM_PS ) >>2 ;IWL_DEBUG_INFO (priv,"STA %pM SM PS mode: %s\n" , + sta->addr, (mimo_ps_mode ==WLAN_HT_CAP_SM_PS_STATIC ) ?"static" : (mimo_ps_mode == WLAN_HT_CAP_SM_PS_DYNAMIC) ?
Greg Kroah-Hartman
maintainerPATCH 52/122 atl1c: fix issue of io access mode for AR8152 v2.1
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Cloud Ren <[email protected]>
commit fa0afcd10951afad2022dda09777d2bf70cdab3d upstream.
When io access mode is enabled by BOOTROM or BIOS for AR8152 v2.1, the register can't be read/write by memory access mode. Clearing Bit 8 of Register 0x21c could fixed the issue.
--- drivers/net/ethernet/atheros/atl1c/atl1c_hw.h | 5 +++++ drivers/net/ethernet/atheros/atl1c/atl1c_main.c | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-)
drivers/net/ethernet/atheros/atl1c/atl1c_hw.h +5 -0
@@ -74,6 +74,8 @@ void atl1c_post_phy_linkchg(struct atl1c#define PCI_DEVICE_ID_ATHEROS_L1D_2_0 0x1083/* AR8151 v2.0 Gigabit 1000 */ #define L2CB_V10 0xc0#define L2CB_V11 0xc1 +#define L2CB_V20 0xc0 +#define L2CB_V21 0xc1/* register definition */ #define REG_DEVICE_CAP 0x5C
@@ -87,6 +89,9 @@ void atl1c_post_phy_linkchg(struct atl1c#define LINK_CTRL_L1_EN 0x02#define LINK_CTRL_EXT_SYNC 0x80 +#define REG_PCIE_IND_ACC_ADDR 0x80 +#define REG_PCIE_IND_ACC_DATA 0x84 +#define REG_DEV_SERIALNUM_CTRL 0x200#define REG_DEV_MAC_SEL_MASK 0x0/* 0:EUI; 1:MAC */ #define REG_DEV_MAC_SEL_SHIFT 0
drivers/net/ethernet/atheros/atl1c/atl1c_main.c +15 -1
@@ -739,6 +739,8 @@ static const struct atl1c_platform_patchstatic void __devinit atl1c_patch_assign (struct atl1c_hw *hw) { +struct pci_dev *pdev = hw->adapter->pdev; +u32 misc_ctrl;int i =0 ; hw->msi_lnkpatch = false;
@@ -753,6 +755,18 @@ static void __devinit atl1c_patch_assign } i++; } + +if (hw->device_id ==PCI_DEVICE_ID_ATHEROS_L2C_B2 && + hw->revision_id ==L2CB_V21 ) { +/* config acess mode */ +pci_write_config_dword (pdev,REG_PCIE_IND_ACC_ADDR , +REG_PCIE_DEV_MISC_CTRL ); +pci_read_config_dword (pdev,REG_PCIE_IND_ACC_DATA , &misc_ctrl); + misc_ctrl &= ~0x100 ; +pci_write_config_dword (pdev,REG_PCIE_IND_ACC_ADDR , +REG_PCIE_DEV_MISC_CTRL ); +pci_write_config_dword (pdev,REG_PCIE_IND_ACC_DATA , misc_ctrl); + } }/* * atl1c_sw_init - Initialize general software structures (struct atl1c_adapter)
@@ -780,7 +794,7 @@ static int __devinit atl1c_sw_init(struc hw->device_id = pdev->device; hw->subsystem_vendor_id = pdev->subsystem_vendor; hw->subsystem_id = pdev->subsystem_device; -AT_READ_REG (hw,PCI_CLASS_REVISION , &revision); +pci_read_config_dword (pdev,PCI_CLASS_REVISION , &revision); hw->revision_id = revision &0xFF ;/* before link up, we assume hibernate is true */ hw->hibernate = true;
Greg Kroah-Hartman
maintainerPATCH 53/122 rtlwifi: rtl8192cu: Change buffer allocation for synchronous reads
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Larry Finger <[email protected]>
commit 3ce4d85b76010525adedcc2555fa164bf706a2f3 upstream.
In commit a7959c1, the USB part of rtlwifi was switched to convert _usb_read_sync() to using a preallocated buffer rather than one that has been acquired using kmalloc. Although this routine is named as though it were synchronous, there seem to be simultaneous users, and the selection of the index to the data buffer is not multi-user safe. This situation is addressed by adding a new spinlock. The routine cannot sleep, thus a mutex is not allowed.
--- drivers/net/wireless/rtlwifi/usb.c | 14 +++++++++++--- drivers/net/wireless/rtlwifi/wifi.h | 1 + 2 files changed, 12 insertions(+), 3 deletions(-)
drivers/net/wireless/rtlwifi/usb.c +11 -3
@@ -131,15 +131,19 @@ static u32 _usb_read_sync(struct rtl_priu8 request;u16 wvalue;u16 index; -__le32 *data = &rtlpriv->usb_data[rtlpriv->usb_data_index]; +__le32 *data; +unsigned long flags; +spin_lock_irqsave (&rtlpriv->locks.usb_lock, flags); +if (++rtlpriv->usb_data_index >=RTL_USB_MAX_RX_COUNT ) + rtlpriv->usb_data_index =0 ; + data = &rtlpriv->usb_data[rtlpriv->usb_data_index]; +spin_unlock_irqrestore (&rtlpriv->locks.usb_lock, flags); request =REALTEK_USB_VENQT_CMD_REQ ; index =REALTEK_USB_VENQT_CMD_IDX ;/* n/a */ wvalue = (u16 )addr;_usbctrl_vendorreq_sync_read (udev, request, wvalue, index, data, len); -if (++rtlpriv->usb_data_index >=RTL_USB_MAX_RX_COUNT ) - rtlpriv->usb_data_index =0 ;return le32_to_cpu (*data); }
@@ -951,6 +955,10 @@ int __devinit rtl_usb_probe(struct usb_i GFP_KERNEL);if (!rtlpriv->usb_data)return -ENOMEM ; + +/* this spin lock must be initialized early */ +spin_lock_init (&rtlpriv->locks.usb_lock); + rtlpriv->usb_data_index =0 ;init_completion (&rtlpriv->firmware_loading_complete);SET_IEEE80211_DEV (hw, &intf->dev);
drivers/net/wireless/rtlwifi/wifi.h +1 -0
@@ -1555,6 +1555,7 @@ struct rtl_locks {spinlock_t rf_ps_lock;spinlock_t rf_lock;spinlock_t waitq_lock; +spinlock_t usb_lock;/*Dual mac*/ spinlock_t cck_and_rw_pagea_lock;
Greg Kroah-Hartman
maintainerPATCH 54/122 rtlwifi: rtl8192de: Fix phy-based version calculation
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Forest Bond <[email protected]>
commit f1b00f4dab29b57bdf1bc03ef12020b280fd2a72 upstream.
Commit d83579e2a50ac68389e6b4c58b845c702cf37516 incorporated some changes from the vendor driver that made it newly important that the calculated hardware version correctly include the CHIP_92D bit, as all of the IS_92D_* macros were changed to depend on it. However, this bit was being unset for dual-mac, dual-phy devices. The vendor driver behavior was modified to not do this, but unfortunately this change was not picked up along with the others. This caused scanning in the 2.4GHz band to be broken, and possibly other bugs as well.
This patch brings the version calculation logic in parity with the vendor driver in this regard, and in doing so fixes the regression. However, the version calculation code in general continues to be largely incoherent and messy, and needs to be cleaned up.
--- drivers/net/wireless/rtlwifi/rtl8192de/phy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/rtlwifi/rtl8192de/phy.c +3 -3
@@ -3345,21 +3345,21 @@ void rtl92d_phy_config_macphymode_info(sswitch (rtlhal->macphymode) {case DUALMAC_SINGLEPHY : rtlphy->rf_type =RF_2T2R ; - rtlhal->version |=CHIP_92D_SINGLEPHY ; + rtlhal->version |=RF_TYPE_2T2R ; rtlhal->bandset =BAND_ON_BOTH ; rtlhal->current_bandtype =BAND_ON_2_4G ;break ;case SINGLEMAC_SINGLEPHY : rtlphy->rf_type =RF_2T2R ; - rtlhal->version |=CHIP_92D_SINGLEPHY ; + rtlhal->version |=RF_TYPE_2T2R ; rtlhal->bandset =BAND_ON_BOTH ; rtlhal->current_bandtype =BAND_ON_2_4G ;break ;case DUALMAC_DUALPHY : rtlphy->rf_type =RF_1T1R ; - rtlhal->version &= (~CHIP_92D_SINGLEPHY ); + rtlhal->version &=RF_TYPE_1T1R ;/* Now we let MAC0 run on 5G band. */ if (rtlhal->interfaceindex ==0 ) { rtlhal->bandset =BAND_ON_5G ;
Greg Kroah-Hartman
maintainerPATCH 55/122 mwifiex: correction in mcs index check
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Amitkumar Karwar <[email protected]>
commit fe020120cb863ba918c6d603345342a880272c4d upstream.
mwifiex driver supports 2x2 chips as well. Hence valid mcs values are 0 to 15. The check for mcs index is corrected in this patch.
For example: if 40MHz is enabled and mcs index is 11, "iw link" command would show "tx bitrate: 108.0 MBit/s" without this patch. Now it shows "tx bitrate: 108.0 MBit/s MCS 11 40Mhz" with the patch.
--- drivers/net/wireless/mwifiex/cfg80211.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/net/wireless/mwifiex/cfg80211.c +2 -2
@@ -634,9 +634,9 @@ mwifiex_dump_station_info(struct mwifiex/* * Bit 0 in tx_htinfo indicates that current Tx rate is 11n rate. Valid -* MCS index values for us are 0 to 7. +* MCS index values for us are 0 to 15. */ -if ((priv->tx_htinfo &BIT (0 )) && (priv->tx_rate <8 )) { +if ((priv->tx_htinfo &BIT (0 )) && (priv->tx_rate <16 )) { sinfo->txrate.mcs = priv->tx_rate; sinfo->txrate.flags |=RATE_INFO_FLAGS_MCS ;/* 40MHz rate */
Greg Kroah-Hartman
maintainerPATCH 56/122 s390/idle: fix sequence handling vs cpu hotplug
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit 0008204ffe85d23382d6fd0f971f3f0fbe70bae2 upstream.
The s390 idle accounting code uses a sequence counter which gets used when the per cpu idle statistics get updated and read.
One assumption on read access is that only when the sequence counter is even and did not change while reading all values the result is valid. On cpu hotplug however the per cpu data structure gets initialized via a cpu hotplug notifier on CPU_ONLINE.CPU_ONLINE however is too late, since the onlined cpu is already running and might access the per cpu data. Worst case is that the data structure gets initialized while an idle thread is updating its idle statistics. This will result in an uneven sequence counter after an update.
As a result user space tools like top, which access /proc/stat in order to get idle stats, will busy loop waiting for the sequence counter to become even again, which will never happen until the queried cpu will update its idle statistics again. And even then the sequence counter will only have an even value for a couple of cpu cycles.
Fix this by moving the initialization of the per cpu idle statistics to cpu_init(). I prefer that solution in favor of changing the notifier to CPU_UP_PREPARE, which would be a different solution to the problem.
--- arch/s390/kernel/processor.c | 2 ++ arch/s390/kernel/smp.c | 3 --- 2 files changed, 2 insertions(+), 3 deletions(-)
arch/s390/kernel/processor.c +2 -0
@@ -26,12 +26,14 @@ static DEFINE_PER_CPU(struct cpuid, cpu_void __cpuinit cpu_init (void ) {struct cpuid *id = &per_cpu (cpu_id,smp_processor_id ()); +struct s390_idle_data *idle = &__get_cpu_var (s390_idle);get_cpu_id (id);atomic_inc (&init_mm.mm_count); current->active_mm = &init_mm;BUG_ON (current->mm);enter_lazy_tlb (&init_mm, current); +memset (idle,0 ,sizeof (*idle)); }/*
arch/s390/kernel/smp.c +0 -3
@@ -984,14 +984,11 @@ static int __cpuinit smp_cpu_notify(struunsigned int cpu = (unsigned int )(long )hcpu;struct cpu *c = &pcpu_devices[cpu].cpu;struct device *s = &c->dev; -struct s390_idle_data *idle;int err =0 ;switch (action) {case CPU_ONLINE :case CPU_ONLINE_FROZEN : - idle = &per_cpu (s390_idle, cpu); -memset (idle,0 ,sizeof (struct s390_idle_data )); err =sysfs_create_group (&s->kobj, &cpu_online_attr_group);break ;case CPU_DEAD :
Greg Kroah-Hartman
maintainerPATCH 57/122 s390/mm: downgrade page table after fork of a 31 bit process
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Martin Schwidefsky <[email protected]>
commit 0f6f281b731d20bfe75c13f85d33f3f05b440222 upstream.
The downgrade of the 4 level page table created by init_new_context is currently done only in start_thread31. If a 31 bit process forks the new mm uses a 4 level page table, including the task size of 2<<42 that goes along with it. This is incorrect as now a 31 bit process can map memory beyond 2GB. Define arch_dup_mmap to do the downgrade after fork.
--- arch/s390/include/asm/mmu_context.h | 14 +++++++++++++- arch/s390/include/asm/processor.h | 2 ++ arch/s390/mm/mmap.c | 12 ++++++++++-- arch/s390/mm/pgtable.c | 5 ----- 4 files changed, 25 insertions(+), 8 deletions(-)
arch/s390/include/asm/mmu_context.h +13 -1
@@ -13,7 +13,6 @@#include <asm/uaccess.h> #include <asm/tlbflush.h> #include <asm/ctl_reg.h> -#include <asm-generic/mm_hooks.h> static inline int init_new_context (struct task_struct *tsk,struct mm_struct *mm)
@@ -93,4 +92,17 @@ static inline void activate_mm(struct mm switch_mm(prev, next, current); } +static inline void arch_dup_mmap (struct mm_struct *oldmm, +struct mm_struct *mm) +{ +#ifdef CONFIG_64BIT +if (oldmm->context.asce_limit < mm->context.asce_limit) +crst_table_downgrade (mm, oldmm->context.asce_limit); +#endif +} + +static inline void arch_exit_mmap (struct mm_struct *mm) +{ +} +#endif /* __S390_MMU_CONTEXT_H */
arch/s390/include/asm/processor.h +2 -0
@@ -122,7 +122,9 @@ struct stack_frame { regs->psw.mask = psw_user_bits |PSW_MASK_BA ; \ regs->psw.addr = new_psw |PSW_ADDR_AMODE ; \ regs->gprs[15 ] = new_stackp; \ +__tlb_flush_mm (current->mm); \crst_table_downgrade (current->mm,1UL <<31 ); \ +update_mm (current->mm, current); \ }while (0 )/* Forward declaration, a strange C thing */
arch/s390/mm/mmap.c +10 -2
@@ -105,9 +105,15 @@ void arch_pick_mmap_layout(struct mm_strint s390_mmap_check (unsigned long addr,unsigned long len) { +int rc; +if (!is_compat_task () && - len >=TASK_SIZE &&TASK_SIZE < (1UL <<53 )) -return crst_table_upgrade (current->mm,1UL <<53 ); + len >=TASK_SIZE &&TASK_SIZE < (1UL <<53 )) { + rc =crst_table_upgrade (current->mm,1UL <<53 ); +if (rc) +return rc; +update_mm (current->mm, current); + }return 0 ; }
@@ -127,6 +133,7 @@ s390_get_unmapped_area(struct file *filp rc =crst_table_upgrade (mm,1UL <<53 );if (rc)return (unsigned long ) rc; +update_mm (mm, current); area =arch_get_unmapped_area (filp, addr, len, pgoff, flags); }return area;
@@ -149,6 +156,7 @@ s390_get_unmapped_area_topdown(struct fi rc =crst_table_upgrade (mm,1UL <<53 );if (rc)return (unsigned long ) rc; +update_mm (mm, current); area =arch_get_unmapped_area_topdown (filp, addr, len, pgoff, flags); }
arch/s390/mm/pgtable.c +0 -5
@@ -85,7 +85,6 @@ repeat:crst_table_free (mm, table);if (mm->context.asce_limit < limit) goto repeat; -update_mm (mm, current);return 0 ; }
@@ -93,9 +92,6 @@ void crst_table_downgrade(struct mm_stru {pgd_t *pgd; -if (mm->context.asce_limit <= limit) -return ; -__tlb_flush_mm (mm);while (mm->context.asce_limit > limit) { pgd = mm->pgd;switch (pgd_val (*pgd) & _REGION_ENTRY_TYPE_MASK) {
@@ -118,7 +114,6 @@ void crst_table_downgrade(struct mm_stru mm->task_size = mm->context.asce_limit; crst_table_free(mm, (unsigned long *) pgd); } -update_mm (mm, current); }#endif
Greg Kroah-Hartman
maintainerPATCH 58/122 s390/mm: fix fault handling for page table walk case
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Heiko Carstens <[email protected]>
commit 008c2e8f247f0a8db1e8e26139da12f3a3abcda0 upstream.
Make sure the kernel does not incorrectly create a SIGBUS signal during user space accesses:
For user space accesses in the switched addressing mode case the kernel may walk page tables and access user address space via the kernel mapping. If a page table entry is invalid the function __handle_fault() gets called in order to emulate a page fault and trigger all the usual actions like paging in a missing page etc. by calling handle_mm_fault().
If handle_mm_fault() returns with an error fixup handling is necessary. For the switched addressing mode case all errors need to be mapped to -EFAULT, so that the calling uaccess function can return -EFAULT to user space.
Unfortunately the __handle_fault() incorrectly calls do_sigbus() if VM_FAULT_SIGBUS is set. This however should only happen if a page fault was triggered by a user space instruction. For kernel mode uaccesses the correct action is to only return -EFAULT.
So user space may incorrectly see SIGBUS signals because of this bug.
For current machines this would only be possible for the switched addressing mode case in conjunction with futex operations.
--- arch/s390/mm/fault.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
arch/s390/mm/fault.c +7 -6
@@ -443,6 +443,7 @@ int __handle_fault(unsigned long uaddr,struct pt_regs regs;int access, fault; +/* Emulate a uaccess fault from kernel mode. */ regs.psw.mask = psw_kernel_bits |PSW_MASK_DAT |PSW_MASK_MCHECK ;if (!irqs_disabled ()) regs.psw.mask |=PSW_MASK_IO |PSW_MASK_EXT ;
@@ -452,12 +453,12 @@ int __handle_fault(unsigned long uaddr, regs.int_parm_long = (uaddr &PAGE_MASK ) |2 ; access = write ?VM_WRITE :VM_READ ; fault =do_exception (®s, access); -if (unlikely (fault)) { -if (fault &VM_FAULT_OOM ) -return -EFAULT ; -else if (fault &VM_FAULT_SIGBUS ) -do_sigbus (®s); - } +/* +* Since the fault happened in kernel mode while performing a uaccess +* all we need to do now is emulating a fixup in case "fault" is not +* zero. +* For the calling uaccess functions this results always in -EFAULT. +*/ return fault ? -EFAULT :0 ; }
Greg Kroah-Hartman
maintainerPATCH 59/122 cgroup: cgroup_rm_files() was calling simple_unlink() with the wrong inode
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit ce27e317ba22b359bde02216afab934dac3af095 upstream.
While refactoring cgroup file removal path, 05ef1d7c4a "cgroup:
introduce struct cfent" incorrectly changed the @dir argument of simple_unlink() to the inode of the file being deleted instead of that of the containing directory.
The effect of this bug is minor - ctime and mtime of the parent weren't properly updated on file deletion.
Fix it by using @cgrp->dentry->d_inode instead.
--- kernel/cgroup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cgroup.c +1 -1
@@ -954,7 +954,7 @@ static int cgroup_rm_file(struct cgroupdget (d);d_delete (d); -simple_unlink (d->d_inode, d); +simple_unlink (cgrp->dentry->d_inode, d);list_del_init (&cfe->node);dput (d);
Greg Kroah-Hartman
maintainerPATCH 60/122 iommu/amd: Add missing spin_lock initialization
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joerg Roedel <[email protected]>
commit 2c13d47a1a7ee8808796016c617aef25fd1d1925 upstream.
Add missing spin_lock initialization in amd_iommu_bind_pasid() function and make lockdep happy again.
--- drivers/iommu/amd_iommu_v2.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/iommu/amd_iommu_v2.c +2 -0
@@ -681,6 +681,8 @@ int amd_iommu_bind_pasid(struct pci_devatomic_set (&pasid_state->count,1 );init_waitqueue_head (&pasid_state->wq); +spin_lock_init (&pasid_state->lock); + pasid_state->task = task; pasid_state->mm =get_task_mm (task); pasid_state->device_state = dev_state;
Greg Kroah-Hartman
maintainerPATCH 61/122 iommu/amd: Fix hotplug with iommu=pt
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joerg Roedel <[email protected]>
commit 2c9195e990297068d0f1f1bd8e2f1d09538009da upstream.
This did not work because devices are not put into the pt_domain. Fix this.
--- drivers/iommu/amd_iommu.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/iommu/amd_iommu.c +13 -4
@@ -2254,6 +2254,18 @@ static int device_change_notifier(structiommu_init_device (dev); +/* +* dev_data is still NULL and +* got initialized in iommu_init_device +*/ + dev_data =get_dev_data (dev); + +if (iommu_pass_through || dev_data->iommu_v2) { + dev_data->passthrough = true; +attach_device (dev, pt_domain); +break ; + } + domain =domain_for_device (dev);/* allocate a protection domain if a device is added */
@@ -2271,10 +2283,7 @@ static int device_change_notifier(struct dev_data =get_dev_data (dev); -if (!dev_data->passthrough) - dev->archdata.dma_ops = &amd_iommu_dma_ops; -else - dev->archdata.dma_ops = &nommu_dma_ops; + dev->archdata.dma_ops = &amd_iommu_dma_ops;break ;case BUS_NOTIFY_DEL_DEVICE :
Greg Kroah-Hartman
maintainerPATCH 62/122 udf: Improve table length check to avoid possible overflow
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jan Kara <[email protected]>
commit 57b9655d01ef057a523e810d29c37ac09b80eead upstream.
When a partition table length is corrupted to be close to 1 << 32, the check for its length may overflow on 32-bit systems and we will think the length is valid. Later on the kernel can crash trying to read beyond end of buffer. Fix the check to avoid possible overflow.
--- fs/udf/super.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/udf/super.c +1 -1
@@ -1283,7 +1283,7 @@ static int udf_load_logicalvol(struct suBUG_ON (ident !=TAG_IDENT_LVD ); lvd = (struct logicalVolDesc *)bh->b_data; table_len =le32_to_cpu (lvd->mapTableLength); -if (sizeof (*lvd) + table_len > sb->s_blocksize) { +if (table_len > sb->s_blocksize -sizeof (*lvd)) {udf_err (sb,"error loading logical volume descriptor: " "Partition table too long (%u > %lu)\n" , table_len, sb->s_blocksize -sizeof (*lvd));
Greg Kroah-Hartman
maintainerPATCH 63/122 stable: update references to older 2.6 versions for 3.x
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Paul Gortmaker <[email protected]>
commit 2584f5212d97b664be250ad5700a2d0fee31a10d upstream.
Also add information on where the respective trees are.
--- Documentation/stable_kernel_rules.txt | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
Documentation/stable_kernel_rules.txt +14 -5
@@ -1,4 +1,4 @@ -Everything you ever wanted to know about Linux 2.6 -stable releases. +Everything you ever wanted to know about Linux -stable releases. Rules on what kind of patches are accepted, and which ones are not, into the "-stable" tree:
@@ -42,10 +42,10 @@ Procedure for submitting patches to the cherry-picked than this can be specified in the following format in the sign-off area: - Cc: <[email protected]> # .32.x: a1f84a3: sched: Check for idle - Cc: <[email protected]> # .32.x: 1b9508f: sched: Rate-limit newidle - Cc: <[email protected]> # .32.x: fd21073: sched: Fix affinity logic - Cc: <[email protected]> # .32.x + Cc: <[email protected]> # 3.3.x: a1f84a3: sched: Check for idle + Cc: <[email protected]> # 3.3.x: 1b9508f: sched: Rate-limit newidle + Cc: <[email protected]> # 3.3.x: fd21073: sched: Fix affinity logic + Cc: <[email protected]> # 3.3.x Signed-off-by: Ingo Molnar <[email protected]> The tag sequence has the meaning of:
@@ -79,6 +79,15 @@ Review cycle: security kernel team, and not go through the normal review cycle. Contact the kernel security team for more details on this procedure. +Trees: + + - The queues of patches, for both completed versions and in progress + versions can be found at: + http://git.kernel.org/?p=linux/kernel/git/stable/stable-queue.git + - The finalized and tagged releases of all stable kernels can be found + in separate branches per version at: + http://git.kernel.org/?p=linux/kernel/git/stable/linux-stable.git + Review committee:
Greg Kroah-Hartman
maintainerPATCH 64/122 staging: zsmalloc: Finish conversion to a separate module
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ben Hutchings <[email protected]>
commit 069f101fa463351f528773d73b74e9b606b3f66a upstream.
ZSMALLOC is tristate, but the code has no MODULE_LICENSE and since it depends on GPL-only symbols it cannot be loaded as a module. This in turn breaks zram which now depends on it. I assume it's meant to be Dual BSD/GPL like the other z-stuff.
There is also no module_exit, which will make it impossible to unload. Add the appropriate module_init and module_exit declarations suggested by comments.
References: http://bugs.debian.org/677273
--- drivers/staging/zsmalloc/zsmalloc-main.c | 33 ++++++------------------------- 1 file changed, 7 insertions(+), 26 deletions(-)
drivers/staging/zsmalloc/zsmalloc-main.c +7 -26
@@ -425,12 +425,6 @@ static struct page *find_get_zspage(stru } -/* -* If this becomes a separate module, register zs_init() with -* module_init(), zs_exit with module_exit(), and remove zs_initialized -*/ -static int zs_initialized; -static int zs_cpu_notifier (struct notifier_block *nb,unsigned long action,void *pcpu) {
@@ -489,7 +483,7 @@ fail:struct zs_pool *zs_create_pool (const char *name,gfp_t flags) { -int i, error, ovhd_size; +int i, ovhd_size;struct zs_pool *pool;if (!name)
@@ -516,28 +510,9 @@ struct zs_pool *zs_create_pool(const cha } -/* -* If this becomes a separate module, register zs_init with -* module_init, and remove this block -*/ -if (!zs_initialized) { - error =zs_init (); -if (error) - goto cleanup; - zs_initialized =1 ; - } - pool->flags = flags; pool->name = name; - error =0 ;/* Success */ - -cleanup: -if (error) { -zs_destroy_pool (pool); - pool =NULL ; - } -return pool; }EXPORT_SYMBOL_GPL (zs_create_pool);
@@ -753,3 +728,9 @@ u64 zs_get_total_size_bytes(struct zs_poreturn npages <<PAGE_SHIFT ; }EXPORT_SYMBOL_GPL (zs_get_total_size_bytes); + +module_init (zs_init); +module_exit (zs_exit); + +MODULE_LICENSE ("Dual BSD/GPL" ); +MODULE_AUTHOR ("Nitin Gupta <[email protected]>" );
Greg Kroah-Hartman
maintainerPATCH 65/122 workqueue: perform cpu down operations from low priority cpu_notifier()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tejun Heo <[email protected]>
commit 6575820221f7a4dd6eadecf7bf83cdd154335eda upstream.
Currently, all workqueue cpu hotplug operations run off CPU_PRI_WORKQUEUE which is higher than normal notifiers. This is to ensure that workqueue is up and running while bringing up a CPU before other notifiers try to use workqueue on the CPU.
Per-cpu workqueues are supposed to remain working and bound to the CPU for normal CPU_DOWN_PREPARE notifiers. This holds mostly true even with workqueue offlining running with higher priority because workqueue CPU_DOWN_PREPARE only creates a bound trustee thread which runs the per-cpu workqueue without concurrency management without explicitly detaching the existing workers.
However, if the trustee needs to create new workers, it creates unbound workers which may wander off to other CPUs while CPU_DOWN_PREPARE notifiers are in progress. Furthermore, if the CPU down is cancelled, the per-CPU workqueue may end up with workers which aren't bound to the CPU.
While reliably reproducible with a convoluted artificial test-case involving scheduling and flushing CPU burning work items from CPU down notifiers, this isn't very likely to happen in the wild, and, even when it happens, the effects are likely to be hidden by the following successful CPU down.
Fix it by using different priorities for up and down notifiers - high priority for up operations and low priority for down operations.
Workqueue cpu hotplug operations will soon go through further cleanup.
--- include/linux/cpu.h | 5 +++-- kernel/workqueue.c | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 3 deletions(-)
include/linux/cpu.h +3 -2
@@ -73,8 +73,9 @@ enum {/* migration should happen before other stuff but after perf */ CPU_PRI_PERF =20 ,CPU_PRI_MIGRATION =10 , -/* prepare workqueues for other notifiers */ - CPU_PRI_WORKQUEUE = 5, +/* bring up workqueues before normal notifiers and down after */ +CPU_PRI_WORKQUEUE_UP =5 , + CPU_PRI_WORKQUEUE_DOWN = -5, };#define CPU_ONLINE 0x0002/* CPU (unsigned)v is up */
kernel/workqueue.c +37 -1
@@ -3590,6 +3590,41 @@ static int __devinit workqueue_cpu_callbreturn notifier_from_errno (0 ); } +/* +* Workqueues should be brought up before normal priority CPU notifiers. +* This will be registered high priority CPU notifier. +*/ +static int __devinit workqueue_cpu_up_callback (struct notifier_block *nfb, +unsigned long action, +void *hcpu) +{ +switch (action & ~CPU_TASKS_FROZEN ) { +case CPU_UP_PREPARE : +case CPU_UP_CANCELED : +case CPU_DOWN_FAILED : +case CPU_ONLINE : +return workqueue_cpu_callback (nfb, action, hcpu); + } +return NOTIFY_OK ; +} + +/* +* Workqueues should be brought down after normal priority CPU notifiers. +* This will be registered as low priority CPU notifier. +*/ +static int __devinit workqueue_cpu_down_callback (struct notifier_block *nfb, +unsigned long action, +void *hcpu) +{ +switch (action & ~CPU_TASKS_FROZEN ) { +case CPU_DOWN_PREPARE : +case CPU_DYING : +case CPU_POST_DEAD : +return workqueue_cpu_callback (nfb, action, hcpu); + } +return NOTIFY_OK ; +} +#ifdef CONFIG_SMP struct work_for_cpu {
@@ -3783,7 +3818,8 @@ static int __init init_workqueues(void)unsigned int cpu;int i; -cpu_notifier (workqueue_cpu_callback,CPU_PRI_WORKQUEUE ); +cpu_notifier (workqueue_cpu_up_callback,CPU_PRI_WORKQUEUE_UP ); +cpu_notifier (workqueue_cpu_down_callback,CPU_PRI_WORKQUEUE_DOWN );/* initialize gcwqs */ for_each_gcwq_cpu (cpu) {
Greg Kroah-Hartman
maintainerPATCH 66/122 ACPI, APEI: Fixup common access width firmware bug
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jean Delvare <[email protected]>
commit f712c71f7b2b43b894d1e92e1b77385fcad8815f upstream.
Many firmwares have a common register definition bug where 8-bit access width is specified for a 32-bit register. Ideally this should be fixed in the BIOS, but earlier versions of the kernel did not complain, so fix that up silently.
This closes kernel bug #43282:
https://bugzilla.kernel.org/show_bug.cgi?id=43282
--- drivers/acpi/apei/apei-base.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/acpi/apei/apei-base.c +5 -0
@@ -586,6 +586,11 @@ static int apei_check_gar(struct acpi_ge } *access_bit_width =1UL << (access_size_code +2 ); +/* Fixup common BIOS bug */ +if (bit_width ==32 && bit_offset ==0 && (*paddr &0x03 ) ==0 && + *access_bit_width <32 ) + *access_bit_width =32 ; +if ((bit_width + bit_offset) > *access_bit_width) { pr_warning(FW_BUG APEI_PFX "Invalid bit width + offset in GAR [0x%llx/%u/%u/%u/%u]\n",
Greg Kroah-Hartman
maintainerPATCH 67/122 ACPI/AC: prevent OOPS on some boxes due to missing check power_supply_register() return value check
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Lan Tianyu <[email protected]>
commit f197ac13f6eeb351b31250b9ab7d0da17434ea36 upstream.
In the ac.c, power_supply_register()'s return value is not checked.
As a result, the driver's add() ops may return success even though the device failed to initialize.
For example, some BIOS may describe two ACADs in the same DSDT. The second ACAD device will fail to register,
but ACPI driver's add() ops returns sucessfully.
The ACPI device will receive ACPI notification and cause OOPS.
https://bugzilla.redhat.com/show_bug.cgi?id=772730
--- drivers/acpi/ac.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/acpi/ac.c +3 -1
@@ -292,7 +292,9 @@ static int acpi_ac_add(struct acpi_devic ac->charger.properties = ac_props; ac->charger.num_properties =ARRAY_SIZE (ac_props); ac->charger.get_property = get_ac_property; -power_supply_register (&ac->device->dev, &ac->charger); + result =power_supply_register (&ac->device->dev, &ac->charger); +if (result) + goto end; printk(KERN_INFO PREFIX "%s [%s] (%s)\n", acpi_device_name(device), acpi_device_bid(device),
Greg Kroah-Hartman
maintainerPATCH 68/122 kmsg - properly print over-long continuation lines
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Kay Sievers <[email protected]>
commit 70498253186586e5dca7bc3ebd3415203b059fbc upstream.
Reserve PREFIX_MAX bytes in the LOG_LINE_MAX line when buffering a continuation line, to be able to properly prefix the LOG_LINE_MAX line with the syslog prefix and timestamp when printing it.
--- kernel/printk.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-)
kernel/printk.c +19 -14
@@ -235,7 +235,8 @@ static u32 log_next_idx;static u64 clear_seq;static u32 clear_idx; -#define LOG_LINE_MAX 1024 +#define PREFIX_MAX 32 +#define LOG_LINE_MAX 1024 - PREFIX_MAX/* record buffer */ #if defined(CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS )
@@ -876,7 +877,7 @@ static size_t msg_print_text(const strucif (buf) {if (print_prefix (msg, syslog,NULL ) + - text_len +1 >= size - len) + text_len +1 >= size - len)break ;if (prefix)
@@ -907,7 +908,7 @@ static int syslog_print(char __user *bufstruct log *msg;int len =0 ; - text =kmalloc (LOG_LINE_MAX ,GFP_KERNEL ); + text =kmalloc (LOG_LINE_MAX +PREFIX_MAX ,GFP_KERNEL );if (!text)return -ENOMEM ;
@@ -930,7 +931,8 @@ static int syslog_print(char __user *buf skip = syslog_partial; msg =log_from_idx (syslog_idx); - n =msg_print_text (msg, syslog_prev, true, text,LOG_LINE_MAX ); + n =msg_print_text (msg, syslog_prev, true, text, +LOG_LINE_MAX +PREFIX_MAX );if (n - syslog_partial <= size) {/* message fits into buffer, move forward */ syslog_idx =log_next (syslog_idx);
@@ -969,7 +971,7 @@ static int syslog_print_all(char __userchar *text;int len =0 ; - text =kmalloc (LOG_LINE_MAX ,GFP_KERNEL ); + text =kmalloc (LOG_LINE_MAX +PREFIX_MAX ,GFP_KERNEL );if (!text)return -ENOMEM ;
@@ -1022,7 +1024,8 @@ static int syslog_print_all(char __userstruct log *msg =log_from_idx (idx);int textlen; - textlen =msg_print_text (msg, prev, true, text,LOG_LINE_MAX ); + textlen =msg_print_text (msg, prev, true, text, +LOG_LINE_MAX +PREFIX_MAX );if (textlen <0 ) { len = textlen;break ;
@@ -1352,15 +1355,15 @@ static struct cont { bool flushed:1; /* buffer sealed and committed */ } cont; -static void cont_flush (void ) +static void cont_flush (enum log_flags flags) {if (cont.flushed)return ;if (cont.len ==0 )return ; -log_store (cont.facility, cont.level,LOG_NOCONS , cont.ts_nsec, -NULL ,0 , cont.buf, cont.len); +log_store (cont.facility, cont.level,LOG_NOCONS | flags, + cont.ts_nsec,NULL ,0 , cont.buf, cont.len); cont.flushed = true; }
@@ -1371,7 +1374,8 @@ static bool cont_add(int facility, int lreturn false;if (cont.len + len >sizeof (cont.buf)) { -cont_flush (); +/* the line gets too long, split it up in separate records */ +cont_flush (LOG_CONT );return false; }
@@ -1507,7 +1511,7 @@ asmlinkage int vprintk_emit(int facility* or another task also prints continuation lines. */ if (cont.len && (lflags &LOG_PREFIX || cont.owner != current)) -cont_flush (); +cont_flush (0 );/* buffer line if possible, otherwise store it right away */ if (!cont_add (facility, level, text, text_len))
@@ -1525,7 +1529,7 @@ asmlinkage int vprintk_emit(int facilityif (cont.len && cont.owner == current) {if (!(lflags &LOG_PREFIX )) stored =cont_add (facility, level, text, text_len); -cont_flush (); +cont_flush (0 ); }if (!stored)
@@ -1618,7 +1622,8 @@ EXPORT_SYMBOL(printk); #else -#define LOG_LINE_MAX 0 +#define LOG_LINE_MAX 0 +#define PREFIX_MAX 0 static struct cont { size_t len; size_t cons;
@@ -1923,7 +1928,7 @@ static enum log_flags console_prev;*/ void console_unlock (void ) { -static char text[LOG_LINE_MAX ]; +static char text[LOG_LINE_MAX +PREFIX_MAX ];static u64 seen_seq;unsigned long flags;bool wake_klogd = false;
Greg Kroah-Hartman
maintainerPATCH 69/122 Btrfs: call the ordered free operation without any locks held
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Chris Mason <[email protected]>
commit e9fbcb42201c862fd6ab45c48ead4f47bb2dea9d upstream.
Each ordered operation has a free callback, and this was called with the worker spinlock held. Josef made the free callback also call iput, which we can't do with the spinlock.
This drops the spinlock for the free operation and grabs it again before moving through the rest of the list. We'll circle back around to this and find a cleaner way that doesn't bounce the lock around so much.
--- fs/btrfs/async-thread.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
fs/btrfs/async-thread.c +8 -1
@@ -206,10 +206,17 @@ static noinline void run_ordered_complet work->ordered_func (work); -/* now take the lock again and call the freeing code */ +/* now take the lock again and drop our item from the list */ spin_lock (&workers->order_lock);list_del (&work->order_list); +spin_unlock (&workers->order_lock); + +/* +* we don't want to call the ordered free functions +* with the lock held though +*/ work->ordered_free (work); +spin_lock (&workers->order_lock); }spin_unlock (&workers->order_lock);
Greg Kroah-Hartman
maintainerPATCH 70/122 cifs: reinstate sec=ntlmv2 mount option
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 7659624ffb550d69c87f9af9ae63e717daa874bd upstream.
sec=ntlmv2 as a mount option got dropped in the mount option overhaul.
--- fs/cifs/connect.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
fs/cifs/connect.c +5 -4
@@ -238,8 +238,8 @@ static const match_table_t cifs_mount_openum { Opt_sec_krb5, Opt_sec_krb5i, Opt_sec_krb5p, Opt_sec_ntlmsspi, Opt_sec_ntlmssp, - Opt_ntlm, Opt_sec_ntlmi, Opt_sec_ntlmv2i, - Opt_sec_nontlm, Opt_sec_lanman, + Opt_ntlm, Opt_sec_ntlmi, Opt_sec_ntlmv2, + Opt_sec_ntlmv2i, Opt_sec_lanman, Opt_sec_none, Opt_sec_err
@@ -253,8 +253,9 @@ static const match_table_t cifs_secflavo { Opt_sec_ntlmssp, "ntlmssp" }, { Opt_ntlm, "ntlm" }, { Opt_sec_ntlmi, "ntlmi" }, + { Opt_sec_ntlmv2, "nontlm" }, + { Opt_sec_ntlmv2, "ntlmv2" }, { Opt_sec_ntlmv2i, "ntlmv2i" }, - { Opt_sec_nontlm, "nontlm" }, { Opt_sec_lanman, "lanman" }, { Opt_sec_none, "none" },
@@ -1167,7 +1168,7 @@ static int cifs_parse_security_flavors(ccase Opt_sec_ntlmi: vol->secFlg |=CIFSSEC_MAY_NTLM |CIFSSEC_MUST_SIGN ;break ; -case Opt_sec_nontlm: +case Opt_sec_ntlmv2: vol->secFlg |=CIFSSEC_MAY_NTLMV2 ;break ;case Opt_sec_ntlmv2i:
Greg Kroah-Hartman
maintainerPATCH 71/122 cifs: ensure that we always do cifsFileInfo_get under the spinlock
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 764a1b1acecedfe204cb2e80d8e2cc7c6df1b0b8 upstream.
The readpages bug is a regression that was introduced in 6993f74a5. This also fixes a couple of similar bugs in the uncached read and write codepaths.
Also, prevent this sort of thing in the future by having cifsFileInfo_get take the spinlock itself, and adding a _locked variant for use in places that are already holding the lock. The _put code has always done that so this makes for a less confusing interface.
--- fs/cifs/cifsglob.h | 6 +++--- fs/cifs/file.c | 17 ++++++++++++----- 2 files changed, 15 insertions(+), 8 deletions(-)
fs/cifs/cifsglob.h +3 -3
@@ -657,13 +657,13 @@ struct cifs_io_parms {* Take a reference on the file private data. Must be called with * cifs_file_list_lock held. */ -static inline -struct cifsFileInfo *cifsFileInfo_get (struct cifsFileInfo *cifs_file) +static inline void +cifsFileInfo_get_locked (struct cifsFileInfo *cifs_file) { ++cifs_file->count; -return cifs_file; } +struct cifsFileInfo *cifsFileInfo_get (struct cifsFileInfo *cifs_file);void cifsFileInfo_put (struct cifsFileInfo *cifs_file);/*
fs/cifs/file.c +12 -5
@@ -284,6 +284,15 @@ cifs_new_fileinfo(__u16 fileHandle, strustatic void cifs_del_lock_waiters (struct cifsLockInfo *lock); +struct cifsFileInfo * +cifsFileInfo_get (struct cifsFileInfo *cifs_file) +{ +spin_lock (&cifs_file_list_lock); +cifsFileInfo_get_locked (cifs_file); +spin_unlock (&cifs_file_list_lock); +return cifs_file; +} +/* * Release a reference on the file private data. This may involve closing * the filehandle out on the server. Must be called without holding
@@ -1563,7 +1572,7 @@ struct cifsFileInfo *find_readable_file(if (!open_file->invalidHandle) {/* found a good file */ /* lock it so it will not be closed on us */ -cifsFileInfo_get (open_file); +cifsFileInfo_get_locked (open_file);spin_unlock (&cifs_file_list_lock);return open_file; }/* else might as well continue, and look for
@@ -1615,7 +1624,7 @@ refind_writable:if (OPEN_FMODE (open_file->f_flags) &FMODE_WRITE ) {if (!open_file->invalidHandle) {/* found a good writable file */ -cifsFileInfo_get (open_file); +cifsFileInfo_get_locked (open_file);spin_unlock (&cifs_file_list_lock);return open_file; }else {
@@ -1632,7 +1641,7 @@ refind_writable:if (inv_file) { any_available = false; -cifsFileInfo_get (inv_file); +cifsFileInfo_get_locked (inv_file); }spin_unlock (&cifs_file_list_lock);
@@ -3082,8 +3091,6 @@ static int cifs_readpages(struct file *fbreak ; } -spin_lock (&cifs_file_list_lock); -spin_unlock (&cifs_file_list_lock); rdata->cfile =cifsFileInfo_get (open_file); rdata->mapping = mapping; rdata->offset = offset;
Greg Kroah-Hartman
maintainerPATCH 72/122 spi/pl022: disable port when unused
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Virupax Sadashivpetimath <[email protected]>
commit fd316941cfee1fbd12746afea83720fb7823888a upstream.
Commit ffbbdd21329f3e15eeca6df2d4bc11c04d9d91c0 "spi: create a message queueing infrastructure" Accidentally deleted the logic to disable the port when unused leading to higher power consumption. Fix this up.
--- drivers/spi/spi-pl022.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/spi/spi-pl022.c +5 -0
@@ -489,6 +489,11 @@ static void giveback(struct pl022 *pl022 pl022->cur_transfer =NULL ; pl022->cur_chip =NULL ;spi_finalize_current_message (pl022->master); + +/* disable the SPI/SSP operation */ +writew ((readw (SSP_CR1 (pl022->virtbase)) & + (~SSP_CR1_MASK_SSE )),SSP_CR1 (pl022->virtbase)); + }/**
Greg Kroah-Hartman
maintainerPATCH 73/122 qeth: repair crash in qeth_l3_vlan_rx_kill_vid()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Frank Blaschka <[email protected]>
commit eabfbe6230ee7363681e7a561948d362b87169f0 upstream.
Commit efc73f4b "net: Fix memory leak - vlan_info struct" adds deletion of VLAN 0 for devices with feature NETIF_F_HW_VLAN_FILTER. For driver qeth these are the layer 3 devices. Usually there exists no separate vlan net_device for VLAN 0. Thus the qeth functions qeth_l3_free_vlan_addresses4() and qeth_l3_free_vlan_addresses6() require an extra checking if function __vlan_find_dev_deep() returns with a net_device.
--- drivers/s390/net/qeth_l3_main.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/s390/net/qeth_l3_main.c +4 -0
@@ -1760,6 +1760,8 @@ static void qeth_l3_free_vlan_addresses4QETH_CARD_TEXT (card,4 ,"frvaddr4" ); netdev =__vlan_find_dev_deep (card->dev, vid); +if (!netdev) +return ; in_dev =in_dev_get (netdev);if (!in_dev)return ;
@@ -1788,6 +1790,8 @@ static void qeth_l3_free_vlan_addresses6QETH_CARD_TEXT (card,4 ,"frvaddr6" ); netdev =__vlan_find_dev_deep (card->dev, vid); +if (!netdev) +return ; in6_dev =in6_dev_get (netdev);if (!in6_dev)return ;
Greg Kroah-Hartman
maintainerPATCH 74/122 tg3: add device id of Apple Thunderbolt Ethernet device
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Greg KH <[email protected]>
commit 02eca3f5f5e458c3a5d7b772bc8042ee2a4ebedf upstream.
The Apple Thunderbolt ethernet device is already listed in the driver, but not hooked up in the MODULE_DEVICE_TABLE(). This fixes that and allows it to work properly.
--- drivers/net/ethernet/broadcom/tg3.c | 1 + 1 file changed, 1 insertion(+)
drivers/net/ethernet/broadcom/tg3.c +1 -0
@@ -298,6 +298,7 @@ static DEFINE_PCI_DEVICE_TABLE(tg3_pci_t {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57795)}, {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5719)}, {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_5720)}, + {PCI_DEVICE(PCI_VENDOR_ID_BROADCOM, TG3PCI_DEVICE_TIGON3_57762)}, {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9DXX)}, {PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_9MXX)}, {PCI_DEVICE(PCI_VENDOR_ID_ALTIMA, PCI_DEVICE_ID_ALTIMA_AC1000)},
Greg Kroah-Hartman
maintainerPATCH 75/122 tg3: Fix Read DMA workaround for 5719 A0.
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Chan <[email protected]>
commit 10ce95d6ef36c65df7dcd3b8fcf86913f8b298bd upstream.
The workaround was mis-applied to all 5719 and 5720 chips.
--- drivers/net/ethernet/broadcom/tg3.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +1 -2
@@ -8975,8 +8975,7 @@ static int tg3_reset_hw(struct tg3 *tp, GET_ASIC_REV(tp->pci_chip_rev_id) == ASIC_REV_57780 || tg3_flag(tp, 57765_PLUS)) { val =tr32 (TG3_RDMA_RSRVCTRL_REG ); -if (GET_ASIC_REV (tp->pci_chip_rev_id) ==ASIC_REV_5719 || -GET_ASIC_REV (tp->pci_chip_rev_id) ==ASIC_REV_5720 ) { +if (tp->pci_chip_rev_id ==CHIPREV_ID_5719_A0 ) { val &= ~(TG3_RDMA_RSRVCTRL_TXMRGN_MASK |TG3_RDMA_RSRVCTRL_FIFO_LWM_MASK |TG3_RDMA_RSRVCTRL_FIFO_HWM_MASK );
Greg Kroah-Hartman
maintainerPATCH 76/122 tg3: Fix race condition in tg3_get_stats64()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michael Chan <[email protected]>
commit 0f566b208b41918053b2e67399673aaec02dde5d upstream.
Spinlock should be taken before checking for tp->hw_stats.
--- drivers/net/ethernet/broadcom/tg3.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/ethernet/broadcom/tg3.c +4 -2
@@ -12282,10 +12282,12 @@ static struct rtnl_link_stats64 *tg3_get {struct tg3 *tp =netdev_priv (dev); -if (!tp->hw_stats) +spin_lock_bh (&tp->lock); +if (!tp->hw_stats) { +spin_unlock_bh (&tp->lock);return &tp->net_stats_prev; + } -spin_lock_bh (&tp->lock);tg3_get_nstats (tp, stats);spin_unlock_bh (&tp->lock);
Greg Kroah-Hartman
maintainerPATCH 77/122 drm/radeon: fix fence related segfault in CS
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Christian König <[email protected]>
commit 93bf888c5c730605e3470f5d2381f296eda88d79 upstream.
Don't return success if scheduling the IB fails, otherwise we end up with an oops in ttm_eu_fence_buffer_objects.
--- drivers/gpu/drm/radeon/radeon_cs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_cs.c +1 -1
@@ -377,7 +377,7 @@ static int radeon_cs_ib_chunk(struct radif (r) {DRM_ERROR ("Failed to schedule IB !\n" ); } -return 0 ; +return r; } static int radeon_bo_vm_update_pte(struct radeon_cs_parser *parser,
Greg Kroah-Hartman
maintainerPATCH 78/122 drm/radeon: fix bo creation retry path
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Glisse <[email protected]>
commit d1c7871ddb1f588b8eb35affd9ee1a3d5e11cd0c upstream.
Retry label was at wrong place in function leading to memory leak.
--- drivers/gpu/drm/radeon/radeon_object.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_object.c +2 -1
@@ -138,7 +138,6 @@ int radeon_bo_create(struct radeon_devic acc_size =ttm_bo_dma_acc_size (&rdev->mman.bdev, size,sizeof (struct radeon_bo )); -retry: bo =kzalloc (sizeof (struct radeon_bo ),GFP_KERNEL );if (bo ==NULL )return -ENOMEM ;
@@ -152,6 +151,8 @@ retry: bo->surface_reg =-1 ;INIT_LIST_HEAD (&bo->list);INIT_LIST_HEAD (&bo->va); + +retry:radeon_ttm_placement_from_domain (bo, domain);/* Kernel allocation are uninterruptible */ mutex_lock (&rdev->vram_mutex);
Greg Kroah-Hartman
maintainerPATCH 79/122 drm/radeon: Try harder to avoid HW cursor ending on a multiple of 128 columns.
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Michel Dänzer <[email protected]>
commit f60ec4c7df043df81e62891ac45383d012afe0da upstream.
This could previously fail if either of the enabled displays was using a horizontal resolution that is a multiple of 128, and only the leftmost column of the cursor was (supposed to be) visible at the right edge of that display.
The solution is to move the cursor one pixel to the left in that case.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=33183
--- drivers/gpu/drm/radeon/radeon_cursor.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/gpu/drm/radeon/radeon_cursor.c +7 -1
@@ -262,8 +262,14 @@ int radeon_crtc_cursor_move(struct drm_cif (!(cursor_end &0x7f )) w--; } -if (w <=0 ) +if (w <=0 ) { w =1 ; + cursor_end = x - xorigin + w; +if (!(cursor_end &0x7f )) { + x--; +WARN_ON_ONCE (x <0 ); + } + } } }
Greg Kroah-Hartman
maintainerPATCH 80/122 drm/radeon: fix non revealent error message
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Glisse <[email protected]>
commit 8d1c702aa0b2c4b22b0742b72a1149d91690674b upstream.
We want to print link status query failed only if it's an unexepected fail. If we query to see if we need link training it might be because there is nothing connected and thus link status query have the right to fail in that case.
To avoid printing failure when it's expected, move the failure message to proper place.
--- drivers/gpu/drm/radeon/atombios_dp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/gpu/drm/radeon/atombios_dp.c +7 -3
@@ -22,6 +22,7 @@* * Authors: Dave Airlie * Alex Deucher +* Jerome Glisse */ #include "drmP.h" #include "radeon_drm.h"
@@ -654,7 +655,6 @@ static bool radeon_dp_get_link_status(st ret =radeon_dp_aux_native_read (radeon_connector,DP_LANE0_1_STATUS , link_status,DP_LINK_STATUS_SIZE ,100 );if (ret <=0 ) { -DRM_ERROR ("displayport link status failed\n" );return false; }
@@ -833,8 +833,10 @@ static int radeon_dp_link_train_cr(strucelse mdelay (dp_info->rd_interval *4 ); -if (!radeon_dp_get_link_status (dp_info->radeon_connector, dp_info->link_status)) +if (!radeon_dp_get_link_status (dp_info->radeon_connector, dp_info->link_status)) { +DRM_ERROR ("displayport link status failed\n" );break ; + }if (dp_clock_recovery_ok (dp_info->link_status, dp_info->dp_lane_count)) { clock_recovery = true;
@@ -896,8 +898,10 @@ static int radeon_dp_link_train_ce(strucelse mdelay (dp_info->rd_interval *4 ); -if (!radeon_dp_get_link_status (dp_info->radeon_connector, dp_info->link_status)) +if (!radeon_dp_get_link_status (dp_info->radeon_connector, dp_info->link_status)) { +DRM_ERROR ("displayport link status failed\n" );break ; + }if (dp_channel_eq_ok (dp_info->link_status, dp_info->dp_lane_count)) { channel_eq = true;
Greg Kroah-Hartman
maintainerPATCH 81/122 drm/radeon: fix hotplug of DP to DVI|HDMI passive adapters (v2)
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Glisse <[email protected]>
commit 266dcba541a1ef7e5d82d9e67c67fde2910636e8 upstream.
No need to retrain the link for passive adapters.
v2: agd5f
- no passive DP to VGA adapters, update comments
- assign radeon_connector_atom_dig after we are sure we have a digital connector as analog connectors have different private data.
- get new sink type before checking for retrain. No need to check if it's no longer a DP connection.
--- drivers/gpu/drm/radeon/radeon_connectors.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-)
drivers/gpu/drm/radeon/radeon_connectors.c +20 -7
@@ -64,14 +64,27 @@ void radeon_connector_hotplug(struct drm/* just deal with DP (not eDP) here. */ if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) { -int saved_dpms = connector->dpms; +struct radeon_connector_atom_dig *dig_connector = + radeon_connector->con_priv; -/* Only turn off the display it it's physically disconnected */ -if (!radeon_hpd_sense (rdev, radeon_connector->hpd.hpd)) -drm_helper_connector_dpms (connector,DRM_MODE_DPMS_OFF ); -else if (radeon_dp_needs_link_train (radeon_connector)) -drm_helper_connector_dpms (connector,DRM_MODE_DPMS_ON ); - connector->dpms = saved_dpms; +/* if existing sink type was not DP no need to retrain */ +if (dig_connector->dp_sink_type !=CONNECTOR_OBJECT_ID_DISPLAYPORT ) +return ; + +/* first get sink type as it may be reset after (un)plug */ + dig_connector->dp_sink_type =radeon_dp_getsinktype (radeon_connector); +/* don't do anything if sink is not display port, i.e., +* passive dp->(dvi|hdmi) adaptor +*/ +if (dig_connector->dp_sink_type ==CONNECTOR_OBJECT_ID_DISPLAYPORT ) { +int saved_dpms = connector->dpms; +/* Only turn off the display if it's physically disconnected */ +if (!radeon_hpd_sense (rdev, radeon_connector->hpd.hpd)) +drm_helper_connector_dpms (connector,DRM_MODE_DPMS_OFF ); +else if (radeon_dp_needs_link_train (radeon_connector)) +drm_helper_connector_dpms (connector,DRM_MODE_DPMS_ON ); + connector->dpms = saved_dpms; + } } }
Greg Kroah-Hartman
maintainerPATCH 82/122 drm/radeon: on hotplug force link training to happen (v2)
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Glisse <[email protected]>
commit ca2ccde5e2f24a792caa4cca919fc5c6f65d1887 upstream.
To have DP behave like VGA/DVI we need to retrain the link on hotplug. For this to happen we need to force link training to happen by setting connector dpms to off before asking it turning it on again.
v2: agd5f
- drop the dp_get_link_status() change in atombios_dp.c for now. We still need the dpms OFF change.
--- drivers/gpu/drm/radeon/radeon_connectors.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/radeon_connectors.c +8 -2
@@ -79,10 +79,16 @@ void radeon_connector_hotplug(struct drmif (dig_connector->dp_sink_type ==CONNECTOR_OBJECT_ID_DISPLAYPORT ) {int saved_dpms = connector->dpms;/* Only turn off the display if it's physically disconnected */ -if (!radeon_hpd_sense (rdev, radeon_connector->hpd.hpd)) +if (!radeon_hpd_sense (rdev, radeon_connector->hpd.hpd)) {drm_helper_connector_dpms (connector,DRM_MODE_DPMS_OFF ); -else if (radeon_dp_needs_link_train (radeon_connector)) + }else if (radeon_dp_needs_link_train (radeon_connector)) { +/* set it to OFF so that drm_helper_connector_dpms() +* won't return immediately since the current state +* is ON at this point. +*/ + connector->dpms =DRM_MODE_DPMS_OFF ;drm_helper_connector_dpms (connector,DRM_MODE_DPMS_ON ); + } connector->dpms = saved_dpms; } }
Greg Kroah-Hartman
maintainerPATCH 83/122 drm/radeon: fix dpms on/off on trinity/aruba v2
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jerome Glisse <[email protected]>
commit fcedac670c3da0d17aaa5db1708694971e8024a9 upstream.
The external encoder need to be setup again before enabling the transmiter. This seems to be only needed on some trinity/aruba to fix dpms on.
v2: Add comment, only setup again on dce6 ie aruba or newer.
--- drivers/gpu/drm/radeon/atombios_encoders.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
drivers/gpu/drm/radeon/atombios_encoders.c +10 -2
@@ -1392,10 +1392,18 @@ radeon_atom_encoder_dpms_dig(struct drm_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 ) || -ASIC_IS_DCE41 (rdev) ||ASIC_IS_DCE5 (rdev)) +ASIC_IS_DCE41 (rdev) ||ASIC_IS_DCE5 (rdev)) { +if (ASIC_IS_DCE6 (rdev)) { +/* It seems we need to call ATOM_ENCODER_CMD_SETUP again +* before reenabling encoder on DPMS ON, otherwise we never +* get picture +*/ +atombios_dig_encoder_setup (encoder,ATOM_ENCODER_CMD_SETUP ,0 ); + }atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_ENABLE ,0 ,0 ); -else + }else {atombios_dig_transmitter_setup (encoder,ATOM_TRANSMITTER_ACTION_ENABLE_OUTPUT ,0 ,0 ); + }if (ENCODER_MODE_IS_DP (atombios_get_encoder_mode (encoder)) && connector) {if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { atombios_set_edp_panel_power(connector,
Greg Kroah-Hartman
maintainerPATCH 84/122 drm/nouveau: init vblank requests list
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Marcin Slusarz <[email protected]>
commit 715855457e6bc93e148caf8cb3b5dcabbf605b0d upstream.
Fixes kernel panic when vblank interrupt triggers before first sync to vblank request.
(Besides init, remove some relevant leftovers from vblank rework)
--- drivers/gpu/drm/nouveau/nouveau_drv.h | 2 -- drivers/gpu/drm/nouveau/nouveau_irq.c | 4 ---- drivers/gpu/drm/nouveau/nouveau_software.h | 1 + 3 files changed, 1 insertion(+), 6 deletions(-)
drivers/gpu/drm/nouveau/nouveau_drv.h +0 -2
@@ -689,8 +689,6 @@ struct drm_nouveau_private {void (*irq_handler[32 ])(struct drm_device *);bool msi_enabled; -struct list_head vbl_waiting; -struct {struct drm_global_reference mem_global_ref;struct ttm_bo_global_ref bo_global_ref;
drivers/gpu/drm/nouveau/nouveau_irq.c +0 -4
@@ -41,12 +41,8 @@void nouveau_irq_preinstall (struct drm_device *dev) { -struct drm_nouveau_private *dev_priv = dev->dev_private; -/* Master disable */ nv_wr32 (dev,NV03_PMC_INTR_EN_0 ,0 ); - -INIT_LIST_HEAD (&dev_priv->vbl_waiting); }int
drivers/gpu/drm/nouveau/nouveau_software.h +1 -0
@@ -38,6 +38,7 @@ static inline void nouveau_software_context_new(struct nouveau_software_chan *pch) {INIT_LIST_HEAD (&pch->flip); +INIT_LIST_HEAD (&pch->vblank.list); } static inline void
Greg Kroah-Hartman
maintainerPATCH 85/122 posix_types.h: Cleanup stale __NFDBITS and related definitions
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Josh Boyer <[email protected]>
commit 8ded2bbc1845e19c771eb55209aab166ef011243 upstream.
Recently, glibc made a change to suppress sign-conversion warnings in FD_SET (glibc commit ceb9e56b3d1). This uncovered an issue with the kernel's definition of __NFDBITS if applications #include <linux/types.h> after including <sys/select.h>. A build failure would be seen when passing the -Werror=sign-compare and -D_FORTIFY_SOURCE=2 flags to gcc.
It was suggested that the kernel should either match the glibc definition of __NFDBITS or remove that entirely. The current in-kernel uses of __NFDBITS can be replaced with BITS_PER_LONG, and there are no uses of the related __FDELT and __FDMASK defines. Given that, we'll continue the cleanup that was started with commit 8b3d1cda4f5f ("posix_types: Remove fd_set macros") and drop the remaining unused macros.
Additionally, linux/time.h has similar macros defined that expand to nothing so we'll remove those at the same time.
--- arch/mips/kernel/kspd.c | 2 +- fs/exec.c | 2 +- fs/select.c | 10 +++++----- include/linux/posix_types.h | 18 +++--------------- include/linux/time.h | 8 -------- kernel/exit.c | 2 +- security/selinux/hooks.c | 2 +- 7 files changed, 12 insertions(+), 32 deletions(-)
arch/mips/kernel/kspd.c +1 -1
@@ -323,7 +323,7 @@ static void sp_cleanup(void) fdt =files_fdtable (files);for (;;) {unsigned long set; - i = j * __NFDBITS; + i = j *BITS_PER_LONG ;if (i >= fdt->max_fds)break ; set = fdt->open_fds[j++];
fs/exec.c +1 -1
@@ -1020,7 +1020,7 @@ static void flush_old_files(struct filesunsigned long set, i; j++; - i = j * __NFDBITS; + i = j *BITS_PER_LONG ; fdt =files_fdtable (files);if (i >= fdt->max_fds)break ;
fs/select.c +5 -5
@@ -345,8 +345,8 @@ static int max_select_fd(unsigned long nstruct fdtable *fdt;/* handle last in-complete long-word first */ - set = ~(~0UL << (n & (__NFDBITS-1 ))); - n /= __NFDBITS; + set = ~(~0UL << (n & (BITS_PER_LONG -1 ))); + n /=BITS_PER_LONG ; fdt =files_fdtable (current->files); open_fds = fdt->open_fds + n; max =0 ;
@@ -373,7 +373,7 @@ get_max: max++; set >>=1 ; }while (set); - max += n * __NFDBITS; + max += n *BITS_PER_LONG ; }return max;
@@ -435,11 +435,11 @@ int do_select(int n, fd_set_bits *fds, s in = *inp++; out = *outp++; ex = *exp++; all_bits = in | out | ex;if (all_bits ==0 ) { - i += __NFDBITS; + i +=BITS_PER_LONG ;continue ; } -for (j =0 ; j < __NFDBITS; ++j, ++i, bit <<=1 ) { +for (j =0 ; j <BITS_PER_LONG ; ++j, ++i, bit <<=1 ) {int fput_needed;if (i >= n)break ;
include/linux/posix_types.h +3 -15
@@ -15,26 +15,14 @@*/ /* -* Those macros may have been defined in <gnu/types.h>. But we always -* use the ones here. +* This macro may have been defined in <gnu/types.h>. But we always +* use the one here. */ -#undef __NFDBITS -#define __NFDBITS (8 * sizeof(unsigned long)) -#undef __FD_SETSIZE#define __FD_SETSIZE 1024 -#undef __FDSET_LONGS -#define __FDSET_LONGS (__FD_SETSIZE/__NFDBITS) - -#undef __FDELT -#define __FDELT (d) ((d) / __NFDBITS) - -#undef __FDMASK -#define __FDMASK (d) (1UL << ((d) % __NFDBITS)) -typedef struct { -unsigned long fds_bits [__FDSET_LONGS]; +unsigned long fds_bits[__FD_SETSIZE / (8 *sizeof (long ))]; }__kernel_fd_set ;/* Type of a signal handler. */
include/linux/time.h +0 -8
@@ -257,14 +257,6 @@ static __always_inline void timespec_add#endif /* __KERNEL__ */ -#define NFDBITS __NFDBITS - -#define FD_SETSIZE __FD_SETSIZE -#define FD_SET (fd,fdsetp) __FD_SET(fd,fdsetp) -#define FD_CLR (fd,fdsetp) __FD_CLR(fd,fdsetp) -#define FD_ISSET (fd,fdsetp) __FD_ISSET(fd,fdsetp) -#define FD_ZERO (fdsetp) __FD_ZERO(fdsetp) -/* * Names of the interval timers, and structure * defining a timer setting:
kernel/exit.c +1 -1
@@ -483,7 +483,7 @@ static void close_files(struct files_strrcu_read_unlock ();for (;;) {unsigned long set; - i = j * __NFDBITS; + i = j *BITS_PER_LONG ;if (i >= fdt->max_fds)break ; set = fdt->open_fds[j++];
security/selinux/hooks.c +1 -1
@@ -2129,7 +2129,7 @@ static inline void flush_unauthorized_fiint fd; j++; - i = j * __NFDBITS; + i = j *BITS_PER_LONG ; fdt =files_fdtable (files);if (i >= fdt->max_fds)break ;
Greg Kroah-Hartman
maintainerPATCH 86/122 dm thin: reduce endio_hook pool size
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alasdair G Kergon <[email protected]>
commit 7768ed33ccdc02801c4483fc5682dc66ace14aea upstream.
Reduce the slab size used for the dm_thin_endio_hook mempool.
Allocation has been seen to fail on machines with smaller amounts of memory due to fragmentation.
lvm: page allocation failure. order:5, mode:0xd0
device-mapper: table: 253:38: thin-pool: Error creating pool's endio_hook mempool
--- drivers/md/dm-thin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/md/dm-thin.c +1 -1
@@ -19,7 +19,7 @@/* * Tunable constants */ -#define ENDIO_HOOK_POOL_SIZE 10240 +#define ENDIO_HOOK_POOL_SIZE 1024#define DEFERRED_SET_SIZE 64#define MAPPING_POOL_SIZE 1024#define PRISON_CELLS 1024
Greg Kroah-Hartman
maintainerPATCH 87/122 dm thin: fix memory leak in process_prepared_mapping error paths
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Joe Thornber <[email protected]>
commit 905386f82d08f66726912f303f3e6605248c60a3 upstream.
Fix memory leak in process_prepared_mapping by always freeing the dm_thin_new_mapping structs from the mapping_pool mempool on the error paths.
--- drivers/md/dm-thin.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/md/dm-thin.c +3 -2
@@ -859,7 +859,7 @@ static void process_prepared_mapping(strif (m->err) {cell_error (m->cell); -return ; + goto out; }/*
@@ -871,7 +871,7 @@ static void process_prepared_mapping(strif (r) {DMERR ("dm_thin_insert_block() failed" );cell_error (m->cell); -return ; + goto out; }/*
@@ -886,6 +886,7 @@ static void process_prepared_mapping(str }else cell_defer (tc, m->cell, m->data_block); +out:list_del (&m->list);mempool_free (m, tc->pool->mapping_pool); }
Greg Kroah-Hartman
maintainerPATCH 88/122 nfsd4: our filesystems are normally case sensitive
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: "J. Bruce Fields" <[email protected]>
commit 2930d381d22b9c56f40dd4c63a8fa59719ca2c3c upstream.
Actually, xfs and jfs can optionally be case insensitive; we'll handle that case in later patches.
--- fs/nfsd/nfs4xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs4xdr.c +1 -1
@@ -2259,7 +2259,7 @@ out_acl:if (bmval0 &FATTR4_WORD0_CASE_INSENSITIVE ) {if ((buflen -=4 ) <0 ) goto out_resource; -WRITE32 (1 ); +WRITE32 (0 ); }if (bmval0 &FATTR4_WORD0_CASE_PRESERVING ) {if ((buflen -=4 ) <0 )
Greg Kroah-Hartman
maintainerPATCH 89/122 nfsd4: fix cr_principal comparison check in same_creds
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Vivek Trivedi <[email protected]>
commit 5559b50acdcdcad7e362882d3261bf934c9436f6 upstream.
This fixes a wrong check for same cr_principal in same_creds
Introduced by 8fbba96e5b327665265ad02b7f331b68536828bf "nfsd4: stricter cred comparison for setclientid/exchange_id".
--- fs/nfsd/nfs4state.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
fs/nfsd/nfs4state.c +2 -2
@@ -1215,7 +1215,7 @@ static bool groups_equal(struct group_inreturn true; } -static int +static bool same_creds (struct svc_cred *cr1,struct svc_cred *cr2) { if ((cr1->cr_flavor != cr2->cr_flavor)
@@ -1227,7 +1227,7 @@ same_creds(struct svc_cred *cr1, structreturn true;if (!cr1->cr_principal || !cr2->cr_principal)return false; -return 0 ==strcmp (cr1->cr_principal, cr1->cr_principal); +return 0 ==strcmp (cr1->cr_principal, cr2->cr_principal); }static void gen_clid (struct nfs4_client *clp)
Greg Kroah-Hartman
maintainerPATCH 90/122 nfs: skip commit in releasepage if were freeing memory for fs-related reasons
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jeff Layton <[email protected]>
commit 5cf02d09b50b1ee1c2d536c9cf64af5a7d433f56 upstream.
We've had some reports of a deadlock where rpciod ends up with a stack trace like this:
PID: 2507 TASK: ffff88103691ab40 CPU: 14 COMMAND: "rpciod/14"
#0 [ffff8810343bf2f0] schedule at ffffffff814dabd9
#1 [ffff8810343bf3b8] nfs_wait_bit_killable at ffffffffa038fc04 [nfs]
#2 [ffff8810343bf3c8] __wait_on_bit at ffffffff814dbc2f
#3 [ffff8810343bf418] out_of_line_wait_on_bit at ffffffff814dbcd8
#4 [ffff8810343bf488] nfs_commit_inode at ffffffffa039e0c1 [nfs]
#5 [ffff8810343bf4f8] nfs_release_page at ffffffffa038bef6 [nfs]
#6 [ffff8810343bf528] try_to_release_page at ffffffff8110c670
#7 [ffff8810343bf538] shrink_page_list.clone.0 at ffffffff81126271
#8 [ffff8810343bf668] shrink_inactive_list at ffffffff81126638
#9 [ffff8810343bf818] shrink_zone at ffffffff8112788f
#10 [ffff8810343bf8c8] do_try_to_free_pages at ffffffff81127b1e
#11 [ffff8810343bf958] try_to_free_pages at ffffffff8112812f
#12 [ffff8810343bfa08] __alloc_pages_nodemask at ffffffff8111fdad
#13 [ffff8810343bfb28] kmem_getpages at ffffffff81159942
#14 [ffff8810343bfb58] fallback_alloc at ffffffff8115a55a
#15 [ffff8810343bfbd8] ____cache_alloc_node at ffffffff8115a2d9
#16 [ffff8810343bfc38] kmem_cache_alloc at ffffffff8115b09b
#17 [ffff8810343bfc78] sk_prot_alloc at ffffffff81411808
#18 [ffff8810343bfcb8] sk_alloc at ffffffff8141197c
#19 [ffff8810343bfce8] inet_create at ffffffff81483ba6
#20 [ffff8810343bfd38] __sock_create at ffffffff8140b4a7
#21 [ffff8810343bfd98] xs_create_sock at ffffffffa01f649b [sunrpc]
#22 [ffff8810343bfdd8] xs_tcp_setup_socket at ffffffffa01f6965 [sunrpc]
#23 [ffff8810343bfe38] worker_thread at ffffffff810887d0
#24 [ffff8810343bfee8] kthread at ffffffff8108dd96
#25 [ffff8810343bff48] kernel_thread at ffffffff8100c1carpciod is trying to allocate memory for a new socket to talk to the server. The VM ends up calling ->releasepage to get more memory, and it tries to do a blocking commit. That commit can't succeed however without a connected socket, so we deadlock.
Fix this by setting PF_FSTRANS on the workqueue task prior to doing the socket allocation, and having nfs_release_page check for that flag when deciding whether to do a commit call. Also, set PF_FSTRANS unconditionally in rpc_async_schedule since that function can also do allocations sometimes.
--- fs/nfs/file.c | 7 +++++-- net/sunrpc/sched.c | 2 ++ net/sunrpc/xprtrdma/transport.c | 3 ++- net/sunrpc/xprtsock.c | 10 ++++++++++ 4 files changed, 19 insertions(+), 3 deletions(-)
fs/nfs/file.c +5 -2
@@ -459,8 +459,11 @@ static int nfs_release_page(struct pagedfprintk (PAGECACHE ,"NFS: release_page(%p)\n" , page); -/* Only do I/O if gfp is a superset of GFP_KERNEL */ -if (mapping && (gfp &GFP_KERNEL ) ==GFP_KERNEL ) { +/* Only do I/O if gfp is a superset of GFP_KERNEL, and we're not +* doing this memory reclaim for a fs-related allocation. +*/ +if (mapping && (gfp &GFP_KERNEL ) ==GFP_KERNEL && + !(current->flags &PF_FSTRANS )) {int how =FLUSH_SYNC ;/* Don't let kswapd deadlock waiting for OOM RPC calls */
net/sunrpc/sched.c +2 -0
@@ -790,7 +790,9 @@ void rpc_execute(struct rpc_task *task)static void rpc_async_schedule (struct work_struct *work) { + current->flags |=PF_FSTRANS ; __rpc_execute(container_of(work, struct rpc_task, u.tk_work)); + current->flags &= ~PF_FSTRANS ; }/**
net/sunrpc/xprtrdma/transport.c +2 -1
@@ -200,6 +200,7 @@ xprt_rdma_connect_worker(struct work_strint rc =0 ;if (!xprt->shutdown) { + current->flags |=PF_FSTRANS ;xprt_clear_connected (xprt); dprintk("RPC: %s: %sconnect\n", __func__,
@@ -212,10 +213,10 @@ xprt_rdma_connect_worker(struct work_str out:xprt_wake_pending_tasks (xprt, rc); - out_clear:dprintk ("RPC: %s: exit\n" , __func__);xprt_clear_connecting (xprt); + current->flags &= ~PF_FSTRANS ; }/*
net/sunrpc/xprtsock.c +10 -0
@@ -1895,6 +1895,8 @@ static void xs_local_setup_socket(structif (xprt->shutdown) goto out; + current->flags |=PF_FSTRANS ; +clear_bit (XPRT_CONNECTION_ABORT , &xprt->state); status =__sock_create (xprt->xprt_net,AF_LOCAL ,SOCK_STREAM ,0 , &sock,1 );
@@ -1928,6 +1930,7 @@ static void xs_local_setup_socket(struct out:xprt_clear_connecting (xprt);xprt_wake_pending_tasks (xprt, status); + current->flags &= ~PF_FSTRANS ; }static void xs_udp_finish_connecting (struct rpc_xprt *xprt,struct socket *sock)
@@ -1970,6 +1973,8 @@ static void xs_udp_setup_socket(struct wif (xprt->shutdown) goto out; + current->flags |=PF_FSTRANS ; +/* Start by resetting any existing state */ xs_reset_transport (transport); sock = xs_create_sock(xprt, transport,
@@ -1988,6 +1993,7 @@ static void xs_udp_setup_socket(struct w out:xprt_clear_connecting (xprt);xprt_wake_pending_tasks (xprt, status); + current->flags &= ~PF_FSTRANS ; }/*
@@ -2113,6 +2119,8 @@ static void xs_tcp_setup_socket(struct wif (xprt->shutdown) goto out; + current->flags |=PF_FSTRANS ; +if (!sock) {clear_bit (XPRT_CONNECTION_ABORT , &xprt->state); sock = xs_create_sock(xprt, transport,
@@ -2162,6 +2170,7 @@ static void xs_tcp_setup_socket(struct wcase -EINPROGRESS :case -EALREADY :xprt_clear_connecting (xprt); + current->flags &= ~PF_FSTRANS ;return ;case -EINVAL :/* Happens, for instance, if the user specified a link
@@ -2174,6 +2183,7 @@ out_eagain: out:xprt_clear_connecting (xprt);xprt_wake_pending_tasks (xprt, status); + current->flags &= ~PF_FSTRANS ; }/**
Greg Kroah-Hartman
maintainerPATCH 91/122 NFS: Fix a number of bugs in the idmapper
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: David Howells <[email protected]>
commit a427b9ec4eda8cd6e641ea24541d30b641fc3140 upstream.
Fix a number of bugs in the NFS idmapper code:
(1) Only registered key types can be passed to the core keys code, so register the legacy idmapper key type.
This is a requirement because the unregister function cleans up keys belonging to that key type so that there aren't dangling pointers to the module left behind - including the key->type pointer.
(2) Rename the legacy key type. You can't have two key types with the same name, and (1) would otherwise require that.
(3) complete_request_key() must be called in the error path of nfs_idmap_legacy_upcall().
(4) There is one idmap struct for each nfs_client struct. This means that idmap->idmap_key_cons is shared without the use of a lock. This is a problem because key_instantiate_and_link() - as called indirectly by idmap_pipe_downcall() - releases anyone waiting for the key to be instantiated.
What happens is that idmap_pipe_downcall() running in the rpc.idmapd thread, releases the NFS filesystem in whatever thread that is running in to continue. This may then make another idmapper call, overwriting idmap_key_cons before idmap_pipe_downcall() gets the chance to call complete_request_key().
I *think* that reading idmap_key_cons only once, before key_instantiate_and_link() is called, and then caching the result in a variable is sufficient.
Bug (4) is the cause of:
BUG: unable to handle kernel NULL pointer dereference at (null) IP: [< (null)>] (null) PGD 0 Oops: 0010 [#1] SMP CPU 1 Modules linked in: ppdev parport_pc lp parport ip6table_filter ip6_tables ebtable_nat ebtables ipt_MASQUERADE iptable_nat nf_nat nf_conntrack_ipv4 nf_defrag_ipv4 xt_state nf_conntrack nfs fscache xt_CHECKSUM auth_rpcgss iptable_mangle nfs_acl bridge stp llc lockd be2iscsi iscsi_boot_sysfs bnx2i cnic uio cxgb4i cxgb4 cxgb3i libcxgbi cxgb3 mdio ib_iser rdma_cm ib_cm iw_cm ib_sa ib_mad ib_core ib_addr iscsi_tcp libiscsi_tcp libiscsi scsi_transport_iscsi snd_hda_codec_realtek snd_usb_audio snd_hda_intel snd_hda_codec snd_seq snd_pcm snd_hwdep snd_usbmidi_lib snd_rawmidi snd_timer uvcvideo videobuf2_core videodev media videobuf2_vmalloc snd_seq_device videobuf2_memops e1000e vhost_net iTCO_wdt joydev coretemp snd soundcore macvtap macvlan i2c_i801 snd_page_alloc tun iTCO_vendor_support microcode kvm_intel kvm sunrpc hid_logitech_dj usb_storage i915 drm_kms_helper drm i2c_algo_bit i2c_core video [last unloaded: scsi_wait_scan] Pid: 1229, comm: rpc.idmapd Not tainted 3.4.2-1.fc16.x86_64 #1 Gateway DX4710-UB801A/G33M05G1 RIP: 0010:[<0000000000000000>] [< (null)>] (null) RSP: 0018:ffff8801a3645d40 EFLAGS: 00010246 RAX: ffff880077707e30 RBX: ffff880077707f50 RCX: ffff8801a18ccd80 RDX: 0000000000000006 RSI: ffff8801a3645e75 RDI: ffff880077707f50 RBP: ffff8801a3645d88 R08: ffff8801a430f9c0 R09: ffff8801a3645db0 R10: 000000000000000a R11: 0000000000000246 R12: ffff8801a18ccd80 R13: ffff8801a3645e75 R14: ffff8801a430f9c0 R15: 0000000000000006 FS: 00007fb6fb51a700(0000) GS:ffff8801afc80000(0000) knlGS:0000000000000000 CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 CR2: 0000000000000000 CR3: 00000001a49b0000 CR4: 00000000000027e0 DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400 Process rpc.idmapd (pid: 1229, threadinfo ffff8801a3644000, task ffff8801a3bf9710) Stack: ffffffff81260878 ffff8801a3645db0 ffff8801a3645db0 ffff880077707a90 ffff880077707f50 ffff8801a18ccd80 0000000000000006 ffff8801a3645e75 ffff8801a430f9c0 ffff8801a3645dd8 ffffffff81260983 ffff8801a3645de8 Call Trace: [<ffffffff81260878>] ? __key_instantiate_and_link+0x58/0x100 [<ffffffff81260983>] key_instantiate_and_link+0x63/0xa0 [<ffffffffa057062b>] idmap_pipe_downcall+0x1cb/0x1e0 [nfs] [<ffffffffa0107f57>] rpc_pipe_write+0x67/0x90 [sunrpc] [<ffffffff8117f833>] vfs_write+0xb3/0x180 [<ffffffff8117fb5a>] sys_write+0x4a/0x90 [<ffffffff81600329>] system_call_fastpath+0x16/0x1b Code: Bad RIP value.
RIP [< (null)>] (null)
RSP <ffff8801a3645d40>
CR2: 0000000000000000
--- fs/nfs/idmap.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-)
fs/nfs/idmap.c +20 -6
@@ -205,12 +205,18 @@ static int nfs_idmap_init_keyring(void)if (ret <0 ) goto failed_put_key; + ret =register_key_type (&key_type_id_resolver_legacy); +if (ret <0 ) + goto failed_reg_legacy; +set_bit (KEY_FLAG_ROOT_CAN_CLEAR , &keyring->flags); cred->thread_keyring = keyring; cred->jit_keyring =KEY_REQKEY_DEFL_THREAD_KEYRING ; id_resolver_cache = cred;return 0 ; +failed_reg_legacy: +unregister_key_type (&key_type_id_resolver); failed_put_key:key_put (keyring); failed_put_cred:
@@ -222,6 +228,7 @@ static void nfs_idmap_quit_keyring(void) {key_revoke (id_resolver_cache->thread_keyring);unregister_key_type (&key_type_id_resolver); +unregister_key_type (&key_type_id_resolver_legacy);put_cred (id_resolver_cache); }
@@ -385,7 +392,7 @@ static const struct rpc_pipe_ops idmap_u };static struct key_type key_type_id_resolver_legacy = { - .name ="id_resolver" , + .name ="id_legacy" , .instantiate = user_instantiate, .match = user_match, .revoke = user_revoke,
@@ -674,6 +681,7 @@ static int nfs_idmap_legacy_upcall(strucif (ret <0 ) goto out2; +BUG_ON (idmap->idmap_key_cons !=NULL ); idmap->idmap_key_cons = cons; ret =rpc_queue_upcall (idmap->idmap_pipe, msg);
@@ -687,8 +695,7 @@ out2: out1:kfree (msg); out0: -key_revoke (cons->key); -key_revoke (cons->authkey); +complete_request_key (cons, ret);return ret; }
@@ -722,11 +729,18 @@ idmap_pipe_downcall(struct file *filp, c {struct rpc_inode *rpci =RPC_I (filp->f_path.dentry->d_inode);struct idmap *idmap = (struct idmap *)rpci->private; -struct key_construction *cons = idmap->idmap_key_cons; +struct key_construction *cons;struct idmap_msg im;size_t namelen_in;int ret; +/* If instantiation is successful, anyone waiting for key construction +* will have been woken up and someone else may now have used +* idmap_key_cons - so after this point we may no longer touch it. +*/ + cons =ACCESS_ONCE (idmap->idmap_key_cons); + idmap->idmap_key_cons =NULL ; +if (mlen !=sizeof (im)) { ret = -ENOSPC ; goto out;
@@ -739,7 +753,7 @@ idmap_pipe_downcall(struct file *filp, cif (!(im.im_status &IDMAP_STATUS_SUCCESS )) { ret = mlen; -complete_request_key (idmap->idmap_key_cons, -ENOKEY ); +complete_request_key (cons, -ENOKEY ); goto out_incomplete; }
@@ -756,7 +770,7 @@ idmap_pipe_downcall(struct file *filp, c } out: -complete_request_key (idmap->idmap_key_cons, ret); +complete_request_key (cons, ret); out_incomplete:return ret; }
Greg Kroah-Hartman
maintainerPATCH 92/122 nouveau: Fix alignment requirements on src and dst addresses
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Maarten Lankhorst <[email protected]>
commit ce806a30470bcd846d148bf39d46de3ad7748228 upstream.
Linear copy works by adding the offset to the buffer address, which may end up not being 16-byte aligned.
Some tests I've written for prime_pcopy show that the engine allows this correctly, so the restriction on lowest 4 bits of address can be lifted safely.
The comments added were by envyas, I think because I used a newer version.
--- drivers/gpu/drm/nouveau/nva3_copy.fuc | 4 - drivers/gpu/drm/nouveau/nva3_copy.fuc.h | 94 ++++++++++++++++++++++++++++++-- drivers/gpu/drm/nouveau/nvc0_copy.fuc.h | 87 ++++++++++++++++++++++++++++- 3 files changed, 175 insertions(+), 10 deletions(-)
drivers/gpu/drm/nouveau/nva3_copy.fuc +2 -2
@@ -119,9 +119,9 @@ dispatch_dma: // mthd 0x030c-0x0340, various stuff .b16 0xc3 14 .b32 #ctx_src_address_high ~0x000000ff -.b32 #ctx_src_address_low ~0xfffffff0 +.b32 #ctx_src_address_low ~0xffffffff .b32 #ctx_dst_address_high ~0x000000ff -.b32 #ctx_dst_address_low ~0xfffffff0 +.b32 #ctx_dst_address_low ~0xffffffff .b32 #ctx_src_pitch ~0x0007ffff .b32 #ctx_dst_pitch ~0x0007ffff .b32 #ctx_xcnt ~0x0000ffff
drivers/gpu/drm/nouveau/nva3_copy.fuc.h +90 -4
343 lines not on this page · raw message
drivers/gpu/drm/nouveau/nvc0_copy.fuc.h +83 -4
313 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 93/122 ext4: pass a char * to ext4_count_free() instead of a buffer_head ptr
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit f6fb99cadcd44660c68e13f6eab28333653621e6 upstream.
Make it possible for ext4_count_free to operate on buffers and not just data in buffer_heads.
--- fs/ext4/balloc.c | 3 ++- fs/ext4/bitmap.c | 8 +++----- fs/ext4/ext4.h | 2 +- fs/ext4/ialloc.c | 3 ++- 4 files changed, 8 insertions(+), 8 deletions(-)
fs/ext4/balloc.c +2 -1
@@ -609,7 +609,8 @@ ext4_fsblk_t ext4_count_free_clusters(stif (bitmap_bh ==NULL )continue ; - x =ext4_count_free (bitmap_bh, sb->s_blocksize); + x =ext4_count_free (bitmap_bh->b_data, +EXT4_BLOCKS_PER_GROUP (sb) /8 );printk (KERN_DEBUG "group %u: stored = %d, counted = %u\n" , i,ext4_free_group_clusters (sb, gdp), x); bitmap_count += x;
fs/ext4/bitmap.c +3 -5
@@ -15,15 +15,13 @@static const int nibblemap[] = {4 ,3 ,3 ,2 ,3 ,2 ,2 ,1 ,3 ,2 ,2 ,1 ,2 ,1 ,1 ,0 }; -unsigned int ext4_count_free (struct buffer_head *map,unsigned int numchars) +unsigned int ext4_count_free (char *bitmap,unsigned int numchars) {unsigned int i, sum =0 ; -if (!map) -return 0 ;for (i =0 ; i < numchars; i++) - sum += nibblemap[map->b_data[i] &0xf ] + - nibblemap[(map->b_data[i] >>4 ) &0xf ]; + sum += nibblemap[bitmap[i] &0xf ] + + nibblemap[(bitmap[i] >>4 ) &0xf ];return sum; }
fs/ext4/ext4.h +1 -1
@@ -1852,7 +1852,7 @@ struct mmpd_data {# define NORET_AND noreturn,/* bitmap.c */ -extern unsigned int ext4_count_free (struct buffer_head *,unsigned ); +extern unsigned int ext4_count_free (char *bitmap,unsigned numchars);void ext4_inode_bitmap_csum_set (struct super_block *sb,ext4_group_t group,struct ext4_group_desc *gdp,struct buffer_head *bh,int sz);
fs/ext4/ialloc.c +2 -1
@@ -1054,7 +1054,8 @@ unsigned long ext4_count_free_inodes(strif (!bitmap_bh)continue ; - x =ext4_count_free (bitmap_bh,EXT4_INODES_PER_GROUP (sb) /8 ); + x =ext4_count_free (bitmap_bh->b_data, +EXT4_INODES_PER_GROUP (sb) /8 );printk (KERN_DEBUG "group %lu: stored = %d, counted = %lu\n" , (unsigned long ) i,ext4_free_inodes_count (sb, gdp), x); bitmap_count += x;
Greg Kroah-Hartman
maintainerPATCH 94/122 ext4: fix overhead calculation used by ext4_statfs()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 952fc18ef9ec707ebdc16c0786ec360295e5ff15 upstream.
Commit f975d6bcc7a introduced bug which caused ext4_statfs() to miscalculate the number of file system overhead blocks. This causes the f_blocks field in the statfs structure to be larger than it should be. This would in turn cause the "df" output to show the number of data blocks in the file system and the number of data blocks used to be larger than they should be.
--- fs/ext4/bitmap.c | 4 - fs/ext4/ext4.h | 4 - fs/ext4/resize.c | 7 +- fs/ext4/super.c | 174 +++++++++++++++++++++++++++++++++++++++---------------- 4 files changed, 132 insertions(+), 57 deletions(-)
fs/ext4/bitmap.c +0 -4
@@ -11,8 +11,6 @@#include <linux/jbd2.h> #include "ext4.h" -#ifdef EXT4FS_DEBUG -static const int nibblemap[] = {4 ,3 ,3 ,2 ,3 ,2 ,2 ,1 ,3 ,2 ,2 ,1 ,2 ,1 ,1 ,0 };unsigned int ext4_count_free (char *bitmap,unsigned int numchars)
@@ -25,8 +23,6 @@ unsigned int ext4_count_free(char *bitmareturn sum; } -#endif /* EXT4FS_DEBUG */ -int ext4_inode_bitmap_csum_verify (struct super_block *sb,ext4_group_t group,struct ext4_group_desc *gdp,struct buffer_head *bh,int sz)
fs/ext4/ext4.h +2 -2
@@ -1161,8 +1161,7 @@ struct ext4_sb_info {unsigned long s_desc_per_block;/* Number of group descriptors per block */ ext4_group_t s_groups_count;/* Number of groups in the fs */ ext4_group_t s_blockfile_groups;/* Groups acceptable for non-extent files */ -unsigned long s_overhead_last;/* Last calculated overhead */ -unsigned long s_blocks_last;/* Last seen block count */ +unsigned long s_overhead;/* # of fs overhead clusters */ unsigned int s_cluster_ratio;/* Number of blocks per cluster */ unsigned int s_cluster_bits;/* log2 of s_cluster_ratio */ loff_t s_bitmap_maxbytes;/* max bytes for bitmap files */
@@ -2037,6 +2036,7 @@ extern int ext4_group_extend(struct supeextern int ext4_resize_fs (struct super_block *sb,ext4_fsblk_t n_blocks_count);/* super.c */ +extern int ext4_calculate_overhead (struct super_block *sb);extern int ext4_superblock_csum_verify (struct super_block *sb,struct ext4_super_block *es); extern void ext4_superblock_csum_set(struct super_block *sb,
fs/ext4/resize.c +6 -1
@@ -1197,7 +1197,7 @@ static void ext4_update_super(struct supstruct ext4_new_group_data *group_data = flex_gd->groups;struct ext4_sb_info *sbi =EXT4_SB (sb);struct ext4_super_block *es = sbi->s_es; -int i; +int i, ret;BUG_ON (flex_gd->count ==0 || group_data ==NULL );/*
@@ -1272,6 +1272,11 @@ static void ext4_update_super(struct sup &sbi->s_flex_groups[flex_group].free_inodes); } +/* +* Update the fs overhead information +*/ +ext4_calculate_overhead (sb); +if (test_opt (sb,DEBUG )) printk(KERN_DEBUG "EXT4-fs: added group %u:" "%llu blocks(%llu free %llu reserved)\n", flex_gd->count,
fs/ext4/super.c +124 -50
203 lines not on this page · raw message
Greg Kroah-Hartman
maintainerPATCH 95/122 ext4: fix hole punch failure when depth is greater than 0
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Ashish Sangwan <[email protected]>
commit 968dee77220768a5f52cf8b21d0bdb73486febef upstream.
Whether to continue removing extents or not is decided by the return value of function ext4_ext_more_to_rm() which checks 2 conditions:
a) if there are no more indexes to process.
b) if the number of entries are decreased in the header of "depth -1".
In case of hole punch, if the last block to be removed is not part of the last extent index than this index will not be deleted, hence the number of valid entries in the extent header of "depth - 1" will remain as it is and ext4_ext_more_to_rm will return 0 although the required blocks are not yet removed.
This patch fixes the above mentioned problem as instead of removing the extents from the end of file, it starts removing the blocks from the particular extent from which removing blocks is actually required and continue backward until done.
--- fs/ext4/extents.c | 48 ++++++++++++++++++++++++++++++------------------ 1 file changed, 30 insertions(+), 18 deletions(-)
fs/ext4/extents.c +30 -18
@@ -2570,10 +2570,10 @@ static int ext4_ext_remove_space(struct {struct super_block *sb = inode->i_sb;int depth =ext_depth (inode); -struct ext4_ext_path *path; +struct ext4_ext_path *path =NULL ;ext4_fsblk_t partial_cluster =0 ;handle_t *handle; -int i, err; +int i =0 , err;ext_debug ("truncate since %u to %u\n" , start, end);
@@ -2606,8 +2606,12 @@ again: } depth =ext_depth (inode); ex = path[depth].p_ext; -if (!ex) +if (!ex) { +ext4_ext_drop_refs (path); +kfree (path); + path =NULL ; goto cont; + } ee_block =le32_to_cpu (ex->ee_block);
@@ -2637,8 +2641,6 @@ again:if (err <0 ) goto out; } -ext4_ext_drop_refs (path); -kfree (path); } cont:
@@ -2647,19 +2649,27 @@ cont:* after i_size and walking into the tree depth-wise. */ depth =ext_depth (inode); - path =kzalloc (sizeof (struct ext4_ext_path ) * (depth +1 ),GFP_NOFS ); -if (path ==NULL ) { -ext4_journal_stop (handle); -return -ENOMEM ; - } - path[0 ].p_depth = depth; - path[0 ].p_hdr =ext_inode_hdr (inode); - -if (ext4_ext_check (inode, path[0 ].p_hdr, depth)) { - err = -EIO ; - goto out; +if (path) { +int k = i = depth; +while (--k >0 ) + path[k].p_block = +le16_to_cpu (path[k].p_hdr->eh_entries)+1 ; + }else { + path =kzalloc (sizeof (struct ext4_ext_path ) * (depth +1 ), +GFP_NOFS ); +if (path ==NULL ) { +ext4_journal_stop (handle); +return -ENOMEM ; + } + path[0 ].p_depth = depth; + path[0 ].p_hdr =ext_inode_hdr (inode); + +if (ext4_ext_check (inode, path[0 ].p_hdr, depth)) { + err = -EIO ; + goto out; + } } - i = err =0 ; + err =0 ;while (i >=0 && err ==0 ) {if (i == depth) {
@@ -2773,8 +2783,10 @@ cont: out:ext4_ext_drop_refs (path);kfree (path); -if (err == -EAGAIN ) +if (err == -EAGAIN ) { + path =NULL ; goto again; + }ext4_journal_stop (handle);return err;
Greg Kroah-Hartman
maintainerPATCH 96/122 ext4: dont let i_reserved_meta_blocks go negative
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Brian Foster <[email protected]>
commit 97795d2a5b8d3c8dc4365d4bd3404191840453ba upstream.
If we hit a condition where we have allocated metadata blocks that were not appropriately reserved, we risk underflow of ei->i_reserved_meta_blocks. In turn, this can throw sbi->s_dirtyclusters_counter significantly out of whack and undermine the nondelalloc fallback logic in ext4_nonda_switch(). Warn if this occurs and set i_allocated_meta_blocks to avoid this problem.
This condition is reproduced by xfstests 270 against ext2 with delalloc enabled:
Mar 28 08:58:02 localhost kernel: [ 171.526344] EXT4-fs (loop1): delayed block allocation failed for inode 14 at logical offset 64486 with max blocks 64 with error -28 Mar 28 08:58:02 localhost kernel: [ 171.526346] EXT4-fs (loop1): This should not happen!! Data will be lost
270 ultimately fails with an inconsistent filesystem and requires an fsck to repair. The cause of the error is an underflow in ext4_da_update_reserve_space() due to an unreserved meta block allocation.
--- fs/ext4/inode.c | 9 +++++++++ 1 file changed, 9 insertions(+)
fs/ext4/inode.c +9 -0
@@ -346,6 +346,15 @@ void ext4_da_update_reserve_space(struct used = ei->i_reserved_data_blocks; } +if (unlikely (ei->i_allocated_meta_blocks > ei->i_reserved_meta_blocks)) { +ext4_msg (inode->i_sb,KERN_NOTICE ,"%s: ino %lu, allocated %d " +"with only %d reserved metadata blocks\n" , __func__, + inode->i_ino, ei->i_allocated_meta_blocks, + ei->i_reserved_meta_blocks); +WARN_ON (1 ); + ei->i_allocated_meta_blocks = ei->i_reserved_meta_blocks; + } +/* Update per-inode reservations */ ei->i_reserved_data_blocks -= used; ei->i_reserved_meta_blocks -= ei->i_allocated_meta_blocks;
Greg Kroah-Hartman
maintainerPATCH 97/122 ext4: undo ext4_calc_metadata_amount if we fail to claim space
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Theodore Ts'o <[email protected]>
commit 03179fe92318e7934c180d96f12eff2cb36ef7b6 upstream.
The function ext4_calc_metadata_amount() has side effects, although it's not obvious from its function name. So if we fail to claim space, regardless of whether we retry to claim the space again, or return an error, we need to undo these side effects.
Otherwise we can end up incorrectly calculating the number of metadata blocks needed for the operation, which was responsible for an xfstests failure for test #271 when using an ext2 file system with delalloc enabled.
--- fs/ext4/inode.c | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-)
fs/ext4/inode.c +21 -11
@@ -1180,6 +1180,17 @@ static int ext4_da_reserve_space(structstruct ext4_inode_info *ei =EXT4_I (inode);unsigned int md_needed;int ret; +ext4_lblk_t save_last_lblock; +int save_len; + +/* +* We will charge metadata quota at writeout time; this saves +* us from metadata over-estimation, though we may go over by +* a small amount in the end. Here we just reserve for data. +*/ + ret =dquot_reserve_block (inode,EXT4_C2B (sbi,1 )); +if (ret) +return ret;/* * recalculate the amount of metadata blocks to reserve
@@ -1188,32 +1199,31 @@ static int ext4_da_reserve_space(struct*/ repeat:spin_lock (&ei->i_block_reservation_lock); +/* +* ext4_calc_metadata_amount() has side effects, which we have +* to be prepared undo if we fail to claim space. +*/ + save_len = ei->i_da_metadata_calc_len; + save_last_lblock = ei->i_da_metadata_calc_last_lblock; md_needed =EXT4_NUM_B2C (sbi,ext4_calc_metadata_amount (inode, lblock));trace_ext4_da_reserve_space (inode, md_needed); -spin_unlock (&ei->i_block_reservation_lock);/* -* We will charge metadata quota at writeout time; this saves -* us from metadata over-estimation, though we may go over by -* a small amount in the end. Here we just reserve for data. -*/ - ret =dquot_reserve_block (inode,EXT4_C2B (sbi,1 )); -if (ret) -return ret; -/* * We do still charge estimated metadata to the sb though; * we cannot afford to run out of free blocks. */ if (ext4_claim_free_clusters (sbi, md_needed +1 ,0 )) { -dquot_release_reservation_block (inode,EXT4_C2B (sbi,1 )); + ei->i_da_metadata_calc_len = save_len; + ei->i_da_metadata_calc_last_lblock = save_last_lblock; +spin_unlock (&ei->i_block_reservation_lock);if (ext4_should_retry_alloc (inode->i_sb, &retries)) {yield (); goto repeat; } +dquot_release_reservation_block (inode,EXT4_C2B (sbi,1 ));return -ENOSPC ; } -spin_lock (&ei->i_block_reservation_lock); ei->i_reserved_data_blocks++; ei->i_reserved_meta_blocks += md_needed;spin_unlock (&ei->i_block_reservation_lock);
Greg Kroah-Hartman
maintainerPATCH 98/122 ext4: use proper csum calculation in ext4_rename
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tao Ma <[email protected]>
commit ef58f69c3c34f6377f1e21d3533c806dbd980ad0 upstream.
In ext4_rename, when the old name is a dir, we need to change ".." to its new parent and journal the change, so with metadata_csum enabled, we have to re-calc the csum.
As the first block of the dir can be either a htree root or a normal directory block and we have different csum calculation for these 2 types, we have to choose the right one in ext4_rename.
btw, it is found by xfstests 013.
--- fs/ext4/namei.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
fs/ext4/namei.c +9 -2
@@ -2918,8 +2918,15 @@ static int ext4_rename(struct inode *oldPARENT_INO (dir_bh->b_data, new_dir->i_sb->s_blocksize) =cpu_to_le32 (new_dir->i_ino);BUFFER_TRACE (dir_bh,"call ext4_handle_dirty_metadata" ); - retval =ext4_handle_dirty_dirent_node (handle, old_inode, - dir_bh); +if (is_dx (old_inode)) { + retval =ext4_handle_dirty_dx_node (handle, + old_inode, + dir_bh); + }else { + retval =ext4_handle_dirty_dirent_node (handle, + old_inode, + dir_bh); + }if (retval) {ext4_std_error (old_dir->i_sb, retval); goto end_rename;
Greg Kroah-Hartman
maintainerPATCH 99/122 ext4: use s_csum_seed instead of i_csum_seed for xattr block
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Tao Ma <[email protected]>
commit 41eb70dde42b2360074a559a6f1fc49860a50179 upstream.
In xattr block operation, we use h_refcount to indicate whether the xattr block is shared among many inodes. And xattr block csum uses s_csum_seed if it is shared and i_csum_seed if it belongs to one inode. But this has a problem. So consider the block is shared first bewteen inode A and B, and B has some xattr update and CoW the xattr block. When it updates the *old* xattr block(because of the h_refcount change) and calls ext4_xattr_release_block, we has no idea that inode A is the real owner of the *old* xattr block and we can't use the i_csum_seed of inode A either in xattr block csum calculation. And I don't think we have an easy way to find inode A.
So this patch just removes the tricky i_csum_seed and we now uses s_csum_seed every time for the xattr block csum. The corresponding patch for the e2fsprogs will be sent in another patch.
This is spotted by xfstests 117.
--- fs/ext4/xattr.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-)
fs/ext4/xattr.c +4 -7
@@ -127,19 +127,16 @@ static __le32 ext4_xattr_block_csum(stru struct ext4_xattr_header *hdr) {struct ext4_sb_info *sbi =EXT4_SB (inode->i_sb); -struct ext4_inode_info *ei =EXT4_I (inode);__u32 csum, old; old = hdr->h_checksum; hdr->h_checksum =0 ; -if (le32_to_cpu (hdr->h_refcount) !=1 ) { - block_nr =cpu_to_le64 (block_nr); - csum =ext4_chksum (sbi, sbi->s_csum_seed, (__u8 *)&block_nr, -sizeof (block_nr)); - }else - csum = ei->i_csum_seed; + block_nr =cpu_to_le64 (block_nr); + csum =ext4_chksum (sbi, sbi->s_csum_seed, (__u8 *)&block_nr, +sizeof (block_nr)); csum =ext4_chksum (sbi, csum, (__u8 *)hdr,EXT4_BLOCK_SIZE (inode->i_sb)); + hdr->h_checksum = old;return cpu_to_le32 (csum); }
Greg Kroah-Hartman
maintainerPATCH 100/122 net: Fix references to out-of-scope variables in put_cmsg_compat()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jesper Juhl <[email protected]>
[ Upstream commit 818810472b129004c16fc51bf0a570b60776bfb7 ]
In net/compat.c::put_cmsg_compat() we may assign 'data' the address of either the 'ctv' or 'cts' local variables inside the 'if (!COMPAT_USE_64BIT_TIME)' branch.
Those variables go out of scope at the end of the 'if' statement, so when we use 'data' further down in 'copy_to_user(CMSG_COMPAT_DATA(cm), data, cmlen - sizeof(struct compat_cmsghdr))' there's no telling what it may be refering to - not good.
Fix the problem by simply giving 'ctv' and 'cts' function scope.
--- net/compat.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
net/compat.c +2 -2
@@ -221,6 +221,8 @@ int put_cmsg_compat(struct msghdr *kmsg, {struct compat_cmsghdr __user *cm = (struct compat_cmsghdr __user *) kmsg->msg_control;struct compat_cmsghdr cmhdr; +struct compat_timeval ctv; +struct compat_timespec cts[3 ];int cmlen;if (cm ==NULL || kmsg->msg_controllen <sizeof (*cm)) {
@@ -229,8 +231,6 @@ int put_cmsg_compat(struct msghdr *kmsg, }if (!COMPAT_USE_64BIT_TIME ) { -struct compat_timeval ctv; -struct compat_timespec cts[3 ];if (level ==SOL_SOCKET && type ==SCM_TIMESTAMP ) {struct timeval *tv = (struct timeval *)data; ctv.tv_sec = tv->tv_sec;
Greg Kroah-Hartman
maintainerPATCH 101/122 r8169: revert "add byte queue limit support".
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Francois Romieu <[email protected]>
[ Upstream commit 17bcb684f08649a2ab6a7dcd8288332e72d208f1 ]
This reverts commit 036dafa28da1e2565a8529de2ae663c37b7a0060.
First it appears in bisection, then reverting it solves the usual netdev watchdog problem for different people. I don't have a proper fix yet so get rid of it.
--- drivers/net/ethernet/realtek/r8169.c | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-)
drivers/net/ethernet/realtek/r8169.c +5 -22
@@ -5380,7 +5380,6 @@ static void rtl8169_tx_clear(struct rtl8 {rtl8169_tx_clear_range (tp, tp->dirty_tx,NUM_TX_DESC ); tp->cur_tx = tp->dirty_tx =0 ; -netdev_reset_queue (tp->dev); }static void rtl_reset_work (struct rtl8169_private *tp)
@@ -5535,8 +5534,6 @@ static netdev_tx_t rtl8169_start_xmit(st txd->opts2 =cpu_to_le32 (opts[1 ]); -netdev_sent_queue (dev, skb->len); -skb_tx_timestamp (skb);wmb ();
@@ -5633,16 +5630,9 @@ static void rtl8169_pcierr_interrupt(strrtl_schedule_task (tp,RTL_FLAG_TASK_RESET_PENDING ); } -struct rtl_txc { -int packets; -int bytes; -}; -static void rtl_tx (struct net_device *dev,struct rtl8169_private *tp) { -struct rtl8169_stats *tx_stats = &tp->tx_stats;unsigned int dirty_tx, tx_left; -struct rtl_txc txc = {0 ,0 }; dirty_tx = tp->dirty_tx;smp_rmb ();
@@ -5661,24 +5651,17 @@ static void rtl_tx(struct net_device *dertl8169_unmap_tx_skb (&tp->pci_dev->dev, tx_skb, tp->TxDescArray + entry);if (status & LastFrag) { -struct sk_buff *skb = tx_skb->skb; - - txc.packets++; - txc.bytes += skb->len; -dev_kfree_skb (skb); +u64_stats_update_begin (&tp->tx_stats.syncp); + tp->tx_stats.packets++; + tp->tx_stats.bytes += tx_skb->skb->len; +u64_stats_update_end (&tp->tx_stats.syncp); +dev_kfree_skb (tx_skb->skb); tx_skb->skb =NULL ; } dirty_tx++; tx_left--; } -u64_stats_update_begin (&tx_stats->syncp); - tx_stats->packets += txc.packets; - tx_stats->bytes += txc.bytes; -u64_stats_update_end (&tx_stats->syncp); - -netdev_completed_queue (dev, txc.packets, txc.bytes); -if (tp->dirty_tx != dirty_tx) { tp->dirty_tx = dirty_tx;/* Sync with rtl8169_start_xmit:
Greg Kroah-Hartman
maintainerPATCH 102/122 caif: fix NULL pointer check
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Cox <[email protected]>
[ Upstream commit c66b9b7d365444b433307ebb18734757cb668a02 ]
Resolves-bug: http://bugzilla.kernel.org/show_bug?44441
--- drivers/net/caif/caif_serial.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/net/caif/caif_serial.c +3 -0
@@ -325,6 +325,9 @@ static int ldisc_open(struct tty_structsprintf (name,"cf%s" , tty->name); dev =alloc_netdev (sizeof (*ser), name, caifdev_setup); +if (!dev) +return -ENOMEM ; + ser =netdev_priv (dev); ser->tty =tty_kref_get (tty); ser->dev = dev;
Greg Kroah-Hartman
maintainerPATCH 103/122 wanmain: comparing array with NULL
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Alan Cox <[email protected]>
[ Upstream commit 8b72ff6484fe303e01498b58621810a114f3cf09 ]
gcc really should warn about these !
--- net/wanrouter/wanmain.c | 53 +++++++++++++++++++++--------------------------- 1 file changed, 24 insertions(+), 29 deletions(-)
net/wanrouter/wanmain.c +24 -29
@@ -602,36 +602,31 @@ static int wanrouter_device_new_if(struc* successfully, add it to the interface list. */ -if (dev->name ==NULL ) { - err = -EINVAL ; - }else { - -#ifdef WANDEBUG -printk (KERN_INFO "%s: registering interface %s...\n" , - wanrouter_modname, dev->name); -#endif - - err =register_netdev (dev); -if (!err) { -struct net_device *slave =NULL ; -unsigned long smp_flags=0 ; - -lock_adapter_irq (&wandev->lock, &smp_flags); - -if (wandev->dev ==NULL ) { - wandev->dev = dev; - }else { -for (slave=wandev->dev; -DEV_TO_SLAVE (slave); - slave =DEV_TO_SLAVE (slave)) -DEV_TO_SLAVE (slave) = dev; - } - ++wandev->ndev; - -unlock_adapter_irq (&wandev->lock, &smp_flags); - err =0 ;/* done !!! */ - goto out; +#ifdef WANDEBUG +printk (KERN_INFO "%s: registering interface %s...\n" , + wanrouter_modname, dev->name); +#endif + + err =register_netdev (dev); +if (!err) { +struct net_device *slave =NULL ; +unsigned long smp_flags=0 ; + +lock_adapter_irq (&wandev->lock, &smp_flags); + +if (wandev->dev ==NULL ) { + wandev->dev = dev; + }else { +for (slave=wandev->dev; +DEV_TO_SLAVE (slave); + slave =DEV_TO_SLAVE (slave)) +DEV_TO_SLAVE (slave) = dev; } + ++wandev->ndev; + +unlock_adapter_irq (&wandev->lock, &smp_flags); + err =0 ;/* done !!! */ + goto out; }if (wandev->del_if) wandev->del_if (wandev, dev);
Greg Kroah-Hartman
maintainerPATCH 104/122 tcp: Add TCP_USER_TIMEOUT negative value check
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Hangbin Liu <[email protected]>
[ Upstream commit 42493570100b91ef663c4c6f0c0fdab238f9d3c2 ]
TCP_USER_TIMEOUT is a TCP level socket option that takes an unsigned int. But patch "tcp: Add TCP_USER_TIMEOUT socket option"(dca43c75) didn't check the negative values. If a user assign -1 to it, the socket will set successfully and wait for 4294967295 miliseconds. This patch add a negative value check to avoid this issue.
--- net/ipv4/tcp.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
net/ipv4/tcp.c +4 -1
@@ -2625,7 +2625,10 @@ static int do_tcp_setsockopt(struct sock/* Cap the max timeout in ms TCP will retry/retrans * before giving up and aborting (ETIMEDOUT) a connection. */ - icsk->icsk_user_timeout =msecs_to_jiffies (val); +if (val <0 ) + err = -EINVAL ; +else + icsk->icsk_user_timeout =msecs_to_jiffies (val);break ;default : err = -ENOPROTOOPT ;
Greg Kroah-Hartman
maintainerPATCH 105/122 USB: kaweth.c: use GFP_ATOMIC under spin_lock
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <[email protected]>
[ Upstream commit e4c7f259c5be99dcfc3d98f913590663b0305bf8 ]
The problem is that we call this with a spin lock held. The call tree is:
kaweth_start_xmit() holds kaweth->device_lock. -> kaweth_async_set_rx_mode() -> kaweth_control() -> kaweth_internal_control_msg()
The kaweth_internal_control_msg() function is only called from kaweth_control() which used GFP_ATOMIC for its allocations.
--- drivers/net/usb/kaweth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/usb/kaweth.c +1 -1
@@ -1314,7 +1314,7 @@ static int kaweth_internal_control_msg(sint retv;int length =0 ;/* shut up GCC */ - urb =usb_alloc_urb (0 ,GFP_NOIO ); + urb =usb_alloc_urb (0 ,GFP_ATOMIC );if (!urb)return -ENOMEM ;
Greg Kroah-Hartman
maintainerPATCH 106/122 net: fix rtnetlink IFF_PROMISC and IFF_ALLMULTI handling
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Benc <[email protected]>
[ Upstream commit b1beb681cba5358f62e6187340660ade226a5fcc ]
When device flags are set using rtnetlink, IFF_PROMISC and IFF_ALLMULTI flags are handled specially. Function dev_change_flags sets IFF_PROMISC and IFF_ALLMULTI bits in dev->gflags according to the passed value but do_setlink passes a result of rtnl_dev_combine_flags which takes those bits from dev->flags.
This can be easily trigerred by doing:
tcpdump -i eth0 &
ip l s up eth0
ip sets IFF_UP flag in ifi_flags and ifi_change, which is combined with IFF_PROMISC by rtnl_dev_combine_flags, causing __dev_change_flags to set IFF_PROMISC in gflags.
--- net/core/rtnetlink.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/core/rtnetlink.c +7 -1
@@ -674,6 +674,12 @@ static void set_operstate(struct net_dev } } +static unsigned int rtnl_dev_get_flags (const struct net_device *dev) +{ +return (dev->flags & ~(IFF_PROMISC |IFF_ALLMULTI )) | + (dev->gflags & (IFF_PROMISC |IFF_ALLMULTI )); +} +static unsigned int rtnl_dev_combine_flags (const struct net_device *dev,const struct ifinfomsg *ifm) {
@@ -682,7 +688,7 @@ static unsigned int rtnl_dev_combine_fla/* bugwards compatibility: ifi_change == 0 is treated as ~0 */ if (ifm->ifi_change) flags = (flags & ifm->ifi_change) | - (dev->flags & ~ifm->ifi_change); + (rtnl_dev_get_flags (dev) & ~ifm->ifi_change);return flags; }
Greg Kroah-Hartman
maintainerPATCH 107/122 tcp: perform DMA to userspace only if there is a task waiting for it
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Jiri Kosina <[email protected]>
[ Upstream commit 59ea33a68a9083ac98515e4861c00e71efdc49a1 ]
Back in 2006, commit 1a2449a87b ("[I/OAT]: TCP recv offload to I/OAT") added support for receive offloading to IOAT dma engine if available.
The code in tcp_rcv_established() tries to perform early DMA copy if applicable. It however does so without checking whether the userspace task is actually expecting the data in the buffer.
This is not a problem under normal circumstances, but there is a corner case where this doesn't work -- and that's when MSG_TRUNC flag to recvmsg() is used.
If the IOAT dma engine is not used, the code properly checks whether there is a valid ucopy.task and the socket is owned by userspace, but misses the check in the dmaengine case.
This problem can be observed in real trivially -- for example 'tbench' is a good reproducer, as it makes a heavy use of MSG_TRUNC. On systems utilizing IOAT, you will soon find tbench waiting indefinitely in sk_wait_data(), as they have been already early-copied in tcp_rcv_established() using dma engine.
This patch introduces the same check we are performing in the simple iovec copy case to the IOAT case as well. It fixes the indefinite recvmsg(MSG_TRUNC) hangs.
--- net/ipv4/tcp_input.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/ipv4/tcp_input.c +3 -1
@@ -5602,7 +5602,9 @@ int tcp_rcv_established(struct sock *sk,if (tp->copied_seq == tp->rcv_nxt && len - tcp_header_len <= tp->ucopy.len) {#ifdef CONFIG_NET_DMA -if (tcp_dma_try_early_copy (sk, skb, tcp_header_len)) { +if (tp->ucopy.task == current && +sock_owned_by_user (sk) && +tcp_dma_try_early_copy (sk, skb, tcp_header_len)) { copied_early =1 ; eaten =1 ; }
Greg Kroah-Hartman
maintainerPATCH 108/122 net/tun: fix ioctl() based info leaks
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mathias Krause <[email protected]>
[ Upstream commits a117dacde0288f3ec60b6e5bcedae8fa37ee0dfc
and 8bbb181308bc348e02bfdbebdedd4e4ec9d452ce ]
The tun module leaks up to 36 bytes of memory by not fully initializing a structure located on the stack that gets copied to user memory by the TUNGETIFF and SIOCGIFHWADDR ioctl()s.
--- drivers/net/tun.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/net/tun.c +4 -2
@@ -1255,10 +1255,12 @@ static long __tun_chr_ioctl(struct fileint vnet_hdr_sz;int ret; -if (cmd ==TUNSETIFF ||_IOC_TYPE (cmd) ==0x89 ) +if (cmd ==TUNSETIFF ||_IOC_TYPE (cmd) ==0x89 ) {if (copy_from_user (&ifr, argp, ifreq_len))return -EFAULT ; - + }else { +memset (&ifr,0 ,sizeof (ifr)); + }if (cmd ==TUNGETFEATURES ) {/* Currently this just means: "what IFF flags are valid?". * This is needed because we never checked for invalid flags on
Greg Kroah-Hartman
maintainerPATCH 109/122 USB: echi-dbgp: increase the controller wait time to come out of halt.
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Colin Ian King <[email protected]>
commit f96a4216e85050c0a9d41a41ecb0ae9d8e39b509 upstream.
The default 10 microsecond delay for the controller to come out of halt in dbgp_ehci_startup is too short, so increase it to 1 millisecond.
This is based on emperical testing on various USB debug ports on modern machines such as a Lenovo X220i and an Ivybridge development platform that needed to wait ~450-950 microseconds.
--- drivers/usb/early/ehci-dbgp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/early/ehci-dbgp.c +1 -1
@@ -450,7 +450,7 @@ static int dbgp_ehci_startup(void)writel (FLAG_CF , &ehci_regs->configured_flag);/* Wait until the controller is no longer halted */ - loop =10 ; + loop =1000 ; do { status = readl(&ehci_regs->status); if (!(status & STS_HALT))
Greg Kroah-Hartman
maintainerPATCH 110/122 ALSA: snd-usb: fix clock source validity index
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Daniel Mack <[email protected]>
commit aff252a848ce21b431ba822de3dab9c4c94571cb upstream.
uac_clock_source_is_valid() uses the control selector value to access the bmControls bitmap of the clock source unit. This is wrong, as control selector values start from 1, while the bitmap uses all available bits.
In other words, "Clock Validity Control" is stored in D3..2, not D5..4 of the clock selector unit's bmControls.
--- sound/usb/clock.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/usb/clock.c +2 -1
@@ -111,7 +111,8 @@ static bool uac_clock_source_is_valid(streturn 0 ;/* If a clock source can't tell us whether it's valid, we assume it is */ -if (!uac2_control_is_readable (cs_desc->bmControls,UAC2_CS_CONTROL_CLOCK_VALID )) +if (!uac2_control_is_readable (cs_desc->bmControls, +UAC2_CS_CONTROL_CLOCK_VALID -1 ))return 1 ; err = snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0), UAC2_CS_CUR,
Greg Kroah-Hartman
maintainerPATCH 111/122 ALSA: mpu401: Fix missing initialization of irq field
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit bc733d495267a23ef8660220d696c6e549ce30b3 upstream.
The irq field of struct snd_mpu401 is supposed to be initialized to -1. Since it's set to zero as of now, a probing error before the irq installation results in a kernel warning "Trying to free already-free IRQ 0".
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=44821
--- sound/drivers/mpu401/mpu401_uart.c | 1 + 1 file changed, 1 insertion(+)
sound/drivers/mpu401/mpu401_uart.c +1 -0
@@ -554,6 +554,7 @@ int snd_mpu401_uart_new(struct snd_cardspin_lock_init (&mpu->output_lock);spin_lock_init (&mpu->timer_lock); mpu->hardware = hardware; + mpu->irq =-1 ;if (! (info_flags &MPU401_INFO_INTEGRATED )) {int res_size = hardware ==MPU401_HW_PC98II ?4 :2 ; mpu->res =request_region (port, res_size,"MPU401 UART" );
Greg Kroah-Hartman
maintainerPATCH 112/122 ALSA: hda - Fix invalid D3 of headphone DAC on VT202x codecs
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 6162552b0de6ba80937c3dd53e084967851cd199 upstream.
We've got a bug report about the silent output from the headphone on a mobo with VT2021, and spotted out that this was because of the wrong D3 state on the DAC for the headphone output. The bug is triggered by the incomplete check for this DAC in set_widgets_power_state_vt1718S(). It checks only the connectivity of the primary output (0x27) but doesn't consider the path from the headphone pin (0x28).
Now this patch fixes the problem by checking both pins for DAC 0x0b.
--- sound/pci/hda/patch_via.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
sound/pci/hda/patch_via.c +5 -2
@@ -3226,7 +3226,7 @@ static void set_widgets_power_state_vt17 {struct via_spec *spec = codec->spec;int imux_is_smixer; -unsigned int parm; +unsigned int parm, parm2;/* MUX6 (1eh) = stereo mixer */ imux_is_smixer =snd_hda_codec_read (codec,0x1e ,0 ,AC_VERB_GET_CONNECT_SEL ,0x00 ) ==5 ;
@@ -3249,7 +3249,7 @@ static void set_widgets_power_state_vt17 parm =AC_PWRST_D3 ;set_pin_power_state (codec,0x27 , &parm);update_power_state (codec,0x1a , parm); -update_power_state (codec,0xb , parm); + parm2 = parm;/* for pin 0x0b */ /* PW2 (26h), AOW2 (ah) */ parm =AC_PWRST_D3 ;
@@ -3264,6 +3264,9 @@ static void set_widgets_power_state_vt17if (!spec->hp_independent_mode)/* check for redirected HP */ set_pin_power_state (codec,0x28 , &parm);update_power_state (codec,0x8 , parm); +if (!spec->hp_independent_mode && parm2 !=AC_PWRST_D3 ) + parm = parm2; +update_power_state (codec,0xb , parm);/* MW9 (21h), Mw2 (1ah), AOW0 (8h) */ update_power_state (codec,0x21 , imux_is_smixer ?AC_PWRST_D0 : parm);
Greg Kroah-Hartman
maintainerPATCH 113/122 ALSA: hda - Fix mute-LED GPIO setup for HP Mini 210
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit a3e199732b8e2b272e82cc1ccc49c35239ed6c5a upstream.
BIOS on HP Mini 210 doesn't provide the proper "HP_Mute_LED" DMI string, thus the driver doesn't initialize the GPIO, too. In the earlier kernel, the driver falls back to GPIO1, but since 3.3 we've stopped this due to other wrongly advertised machines.
For fixing this particular case, add a new model type to specify the default polarity explicitly so that the fallback to GPIO1 is handled.
Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=772923
--- sound/pci/hda/patch_sigmatel.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
sound/pci/hda/patch_sigmatel.c +9 -1
@@ -101,6 +101,7 @@ enum { STAC_92HD83XXX_HP_cNB11_INTQUAD,STAC_HP_DV7_4000 ,STAC_HP_ZEPHYR , +STAC_92HD83XXX_HP_LED , STAC_92HD83XXX_MODELS };
@@ -1675,6 +1676,7 @@ static const char * const stac92hd83xxx_ [STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad", [STAC_HP_DV7_4000] = "hp-dv7-4000", [STAC_HP_ZEPHYR] = "hp-zephyr", + [STAC_92HD83XXX_HP_LED] = "hp-led", };static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
@@ -1729,6 +1731,8 @@ static const struct snd_pci_quirk stac92 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3561, "HP", STAC_HP_ZEPHYR), + SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x3660, + "HP Mini", STAC_92HD83XXX_HP_LED), {}/* terminator */ };
@@ -5507,6 +5511,7 @@ static void stac92hd8x_fill_auto_spec(ststatic int patch_stac92hd83xxx (struct hda_codec *codec) {struct sigmatel_spec *spec; +int default_polarity =-1 ;/* no default cfg */ int err; spec =kzalloc (sizeof (*spec),GFP_KERNEL );
@@ -5555,9 +5560,12 @@ again:case STAC_HP_ZEPHYR : spec->init = stac92hd83xxx_hp_zephyr_init;break ; +case STAC_92HD83XXX_HP_LED : + default_polarity =1 ; +break ; } -if (find_mute_led_cfg (codec,-1 /*no default cfg*/ )) +if (find_mute_led_cfg (codec, default_polarity))snd_printd ("mute LED gpio %d polarity %d\n" , spec->gpio_led, spec->gpio_led_polarity);
Greg Kroah-Hartman
maintainerPATCH 114/122 ALSA: hda - Fix polarity of mute LED on HP Mini 210
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit ff8a1e274cbc11da6b57849f925b895a212b56c9 upstream.
The commit a3e199732b made the LED working again on HP Mini 210 but with a wrong polarity. This patch fixes the polarity for this machine, and also introduce a new model string "hp-inv-led".
Bugzilla: https://bugzilla.novell.com/show_bug.cgi?id=772923
--- sound/pci/hda/patch_sigmatel.c | 5 +++++ 1 file changed, 5 insertions(+)
sound/pci/hda/patch_sigmatel.c +5 -0
@@ -102,6 +102,7 @@ enum {STAC_HP_DV7_4000 ,STAC_HP_ZEPHYR ,STAC_92HD83XXX_HP_LED , +STAC_92HD83XXX_HP_INV_LED , STAC_92HD83XXX_MODELS };
@@ -1677,6 +1678,7 @@ static const char * const stac92hd83xxx_ [STAC_HP_DV7_4000] = "hp-dv7-4000", [STAC_HP_ZEPHYR] = "hp-zephyr", [STAC_92HD83XXX_HP_LED] = "hp-led", + [STAC_92HD83XXX_HP_INV_LED] = "hp-inv-led", };static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
@@ -5561,6 +5563,9 @@ again: spec->init = stac92hd83xxx_hp_zephyr_init;break ;case STAC_92HD83XXX_HP_LED : + default_polarity =0 ; +break ; +case STAC_92HD83XXX_HP_INV_LED : default_polarity =1 ;break ; }
Greg Kroah-Hartman
maintainerPATCH 115/122 ALSA: hda - Fix mute-LED GPIO initialization for IDT codecs
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 1f43f6c1bc8d740e75b4177eb29110858bb5fea2 upstream.
The IDT codecs initializes the GPIO setup for mute LEDs via snd_hda_sync_vmaster_hook(). This works in most cases except for the very first call, which is called before PCM and control creations. Thus before Master switch is set manually via alsactl, the mute LED may show the wrong state, depending on the polarity.
Now it's fixed by calling the LED-status update function manually when no vmaster is set yet.
--- sound/pci/hda/patch_sigmatel.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
sound/pci/hda/patch_sigmatel.c +6 -1
@@ -4420,7 +4420,12 @@ static int stac92xx_init(struct hda_codesnd_hda_jack_report_sync (codec);/* sync mute LED */ -snd_hda_sync_vmaster_hook (&spec->vmaster_mute); +if (spec->gpio_led) { +if (spec->vmaster_mute.hook) +snd_hda_sync_vmaster_hook (&spec->vmaster_mute); +else /* the very first init call doesn't have vmaster yet */ +stac92xx_update_led_status (codec, false); + }/* sync the power-map */ if (spec->num_pwrs)
Greg Kroah-Hartman
maintainerPATCH 116/122 ALSA: hda - Support dock on Lenovo Thinkpad T530 with ALC269VC
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Takashi Iwai <[email protected]>
commit 707fba3fa76a4c8855552f5d4c1a12430c09bce8 upstream.
Lenovo Thinkpad T530 with ALC269VC codec has a dock port but BIOS doesn't set up the pins properly. Enable the pins as well as on Thinkpad X230 Tablet.
--- sound/pci/hda/patch_realtek.c | 1 + 1 file changed, 1 insertion(+)
sound/pci/hda/patch_realtek.c +1 -0
@@ -6000,6 +6000,7 @@ static const struct snd_pci_quirk alc269SND_PCI_QUIRK (0x17aa ,0x21b8 ,"Thinkpad Edge 14" ,ALC269_FIXUP_SKU_IGNORE ),SND_PCI_QUIRK (0x17aa ,0x21ca ,"Thinkpad L412" ,ALC269_FIXUP_SKU_IGNORE ),SND_PCI_QUIRK (0x17aa ,0x21e9 ,"Thinkpad Edge 15" ,ALC269_FIXUP_SKU_IGNORE ), +SND_PCI_QUIRK (0x17aa ,0x21f6 ,"Thinkpad T530" ,ALC269_FIXUP_LENOVO_DOCK ),SND_PCI_QUIRK (0x17aa ,0x2203 ,"Thinkpad X230 Tablet" ,ALC269_FIXUP_LENOVO_DOCK ),SND_PCI_QUIRK (0x17aa ,0x3bf8 ,"Quanta FL1" ,ALC269_FIXUP_QUANTA_MUTE ), SND_PCI_QUIRK(0x17aa, 0x3bf8, "Lenovo Ideapd", ALC269_FIXUP_PCM_44K),
Greg Kroah-Hartman
maintainerPATCH 117/122 ASoC: wm8962: Allow VMID time to fully ramp
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit 9d40e5582c9c4cfb6977ba2a0ca9c2ed82c56f21 upstream.
Required for reliable power up from cold.
--- sound/soc/codecs/wm8962.c | 3 +++ 1 file changed, 3 insertions(+)
sound/soc/codecs/wm8962.c +3 -0
@@ -2501,6 +2501,9 @@ static int wm8962_set_bias_level(struct/* VMID 2*250k */ snd_soc_update_bits (codec,WM8962_PWR_MGMT_1 ,WM8962_VMID_SEL_MASK ,0x100 ); + +if (codec->dapm.bias_level ==SND_SOC_BIAS_OFF ) +msleep (100 );break ;case SND_SOC_BIAS_OFF :
Greg Kroah-Hartman
maintainerPATCH 118/122 ASoC: wm8994: Ensure there are enough BCLKs for four channels
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Mark Brown <[email protected]>
commit b8edf3e5522735c8ce78b81845f7a1a2d4a08626 upstream.
Otherwise if someone tries to use all four channels on AIF1 with the device in master mode we won't be able to clock out all the data.
--- sound/soc/codecs/wm8994.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/codecs/wm8994.c +1 -1
@@ -2649,7 +2649,7 @@ static int wm8994_hw_params(struct snd_preturn -EINVAL ; } - bclk_rate =params_rate (params) *2 ; + bclk_rate =params_rate (params) *4 ;switch (params_format (params)) {case SNDRV_PCM_FORMAT_S16_LE : bclk_rate *=16 ;
Greg Kroah-Hartman
maintainerPATCH 119/122 m68k: Make sys_atomic_cmpxchg_32 work on classic m68k
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Andreas Schwab <[email protected]>
commit 9e2760d18b3cf179534bbc27692c84879c61b97c upstream.
User space access must always go through uaccess accessors, since on classic m68k user space and kernel space are completely separate.
--- arch/m68k/kernel/sys_m68k.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/m68k/kernel/sys_m68k.c +6 -2
@@ -479,9 +479,13 @@ sys_atomic_cmpxchg_32(unsigned long newv goto bad_access; } - mem_value = *mem; +/* +* No need to check for EFAULT; we know that the page is +* present and writable. +*/ +__get_user (mem_value, mem);if (mem_value == oldval) - *mem = newval; +__put_user (newval, mem);pte_unmap_unlock (pte, ptl);up_read (&mm->mmap_sem);
Greg Kroah-Hartman
maintainerPATCH 120/122 futex: Test for pi_mutex on fault in futex_wait_requeue_pi()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darren Hart <[email protected]>
commit b6070a8d9853eda010a549fa9a09eb8d7269b929 upstream.
If fixup_pi_state_owner() faults, pi_mutex may be NULL. Test for pi_mutex != NULL before testing the owner against current and possibly unlocking it.
--- kernel/futex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/futex.c +1 -1
@@ -2370,7 +2370,7 @@ static int futex_wait_requeue_pi(u32 __u* fault, unlock the rt_mutex and return the fault to userspace. */ if (ret == -EFAULT ) { -if (rt_mutex_owner (pi_mutex) == current) +if (pi_mutex &&rt_mutex_owner (pi_mutex) == current)rt_mutex_unlock (pi_mutex); }else if (ret == -EINTR ) {/*
Greg Kroah-Hartman
maintainerPATCH 121/122 futex: Fix bug in WARN_ON for NULL q.pi_state
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darren Hart <[email protected]>
commit f27071cb7fe3e1d37a9dbe6c0dfc5395cd40fa43 upstream.
The WARN_ON in futex_wait_requeue_pi() for a NULL q.pi_state was testing the address (&q.pi_state) of the pointer instead of the value (q.pi_state) of the pointer. Correct it accordingly.
--- kernel/futex.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/futex.c +1 -1
@@ -2343,7 +2343,7 @@ static int futex_wait_requeue_pi(u32 __u* signal. futex_unlock_pi() will not destroy the lock_ptr nor * the pi_state. */ -WARN_ON (!&q.pi_state); +WARN_ON (!q.pi_state); pi_mutex = &q.pi_state->pi_mutex; ret =rt_mutex_finish_proxy_lock (pi_mutex, to, &rt_waiter,1 );debug_rt_mutex_free_waiter (&rt_waiter);
Greg Kroah-Hartman
maintainerPATCH 122/122 futex: Forbid uaddr == uaddr2 in futex_wait_requeue_pi()
In reply to Greg Kroah-HartmanFrom: Greg KH <[email protected]>
3.5-stable review patch. If anyone has any objections, please let me know.
------------------
From: Darren Hart <[email protected]>
commit 6f7b0a2a5c0fb03be7c25bd1745baa50582348ef upstream.
If uaddr == uaddr2, then we have broken the rule of only requeueing from a non-pi futex to a pi futex with this call. If we attempt this, as the trinity test suite manages to do, we miss early wakeups as q.key is equal to key2 (because they are the same uaddr). We will then attempt to dereference the pi_mutex (which would exist had the futex_q been properly requeued to a pi futex) and trigger a NULL pointer dereference.
--- kernel/futex.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-)
kernel/futex.c +8 -5
@@ -2231,11 +2231,11 @@ int handle_early_requeue_pi_wakeup(struc* @uaddr2: the pi futex we will take prior to returning to user-space * * The caller will wait on uaddr and will be requeued by futex_requeue() to -* uaddr2 which must be PI aware. Normal wakeup will wake on uaddr2 and -* complete the acquisition of the rt_mutex prior to returning to userspace. -* This ensures the rt_mutex maintains an owner when it has waiters; without -* one, the pi logic wouldn't know which task to boost/deboost, if there was a -* need to. +* uaddr2 which must be PI aware and unique from uaddr. Normal wakeup will wake +* on uaddr2 and complete the acquisition of the rt_mutex prior to returning to +* userspace. This ensures the rt_mutex maintains an owner when it has waiters; +* without one, the pi logic would not know which task to boost/deboost, if +* there was a need to. * * We call schedule in futex_wait_queue_me() when we enqueue and return there * via the following:
@@ -2272,6 +2272,9 @@ static int futex_wait_requeue_pi(u32 __ustruct futex_q q = futex_q_init;int res, ret; +if (uaddr == uaddr2) +return -EINVAL ; +if (!bitset)return -EINVAL ;