1. 10 Oct, 2012 40 commits
    • Sebastian Andrzej Siewior's avatar
      usb: gadget: dummy_hcd: fixup error probe path · 7961453c
      Sebastian Andrzej Siewior authored
      commit 1b68a4ca upstream.
      
      If USB2 host controller probes fine but USB3 does not then we don't
      remove the USB controller properly and lock up the system while the HUB
      code will try to enumerate the USB2 controller and access memory which
      is no longer available in case the dummy_hcd was compiled as a module.
      
      This is a problem since 448b6eb1 ("USB: Make sure to fetch the BOS desc
      for roothubs.) if used in USB3 mode because dummy does not provide this
      descriptor and explodes later.
      Signed-off-by: default avatarSebastian Andrzej Siewior <sebastian@breakpoint.cc>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      7961453c
    • Miklos Szeredi's avatar
      vfs: dcache: fix deadlock in tree traversal · 5e47beb7
      Miklos Szeredi authored
      commit 8110e16d upstream.
      
      IBM reported a deadlock in select_parent().  This was found to be caused
      by taking rename_lock when already locked when restarting the tree
      traversal.
      
      There are two cases when the traversal needs to be restarted:
      
       1) concurrent d_move(); this can only happen when not already locked,
          since taking rename_lock protects against concurrent d_move().
      
       2) racing with final d_put() on child just at the moment of ascending
          to parent; rename_lock doesn't protect against this rare race, so it
          can happen when already locked.
      
      Because of case 2, we need to be able to handle restarting the traversal
      when rename_lock is already held.  This patch fixes all three callers of
      try_to_ascend().
      
      IBM reported that the deadlock is gone with this patch.
      
      [ I rewrote the patch to be smaller and just do the "goto again" if the
        lock was already held, but credit goes to Miklos for the real work.
         - Linus ]
      Signed-off-by: default avatarMiklos Szeredi <mszeredi@suse.cz>
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      5e47beb7
    • Seth Forshee's avatar
      irq_remap: disable IRQ remapping if any IOAPIC lacks an IOMMU · b4723adc
      Seth Forshee authored
      commit 32ab31e0 upstream.
      
      The ACPI tables in the Macbook Air 5,1 define a single IOAPIC with id 2,
      but the only remapping unit described in the DMAR table matches id 0.
      Interrupt remapping fails as a result, and the kernel panics with the
      message "timer doesn't work through Interrupt-remapped IO-APIC."
      
      To fix this, check each IOAPIC for a corresponding IOMMU. If an IOMMU is
      not found, do not allow IRQ remapping to be enabled.
      
      v2: Move check to parse_ioapics_under_ir(), raise log level to KERN_ERR,
          and add FW_BUG to the log message
      v3: Skip check if IOMMU doesn't support interrupt remapping and remove
          existing check that the IOMMU count equals the IOAPIC count
      Acked-by: default avatarSuresh Siddha <suresh.b.siddha@intel.com>
      Signed-off-by: default avatarSeth Forshee <seth.forshee@canonical.com>
      Acked-by: default avatarYinghai Lu <yinghai@kernel.org>
      Signed-off-by: default avatarJoerg Roedel <joerg.roedel@amd.com>
      [bwh: Backported to 3.2: adjust filename]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b4723adc
    • Darren Hart's avatar
      pch_uart: Add eg20t_port lock field, avoid recursive spinlocks · 3f00d57f
      Darren Hart authored
      commit 2588aba0 upstream.
      
      pch_uart_interrupt() takes priv->port.lock which leads to two recursive
      spinlock calls if low_latency==1 or CONFIG_PREEMPT_RT_FULL=y (one
      otherwise):
      
      pch_uart_interrupt
        spin_lock_irqsave(priv->port.lock, flags)
        case PCH_UART_IID_RDR_TO (data ready)
        handle_rx_to
          push_rx
            tty_port_tty_get
              spin_lock_irqsave(&port->lock, flags) <--- already hold this lock
              ...
            tty_flip_buffer_push
              ...
              flush_to_ldisc
                spin_lock_irqsave(&tty->buf.lock)
                  spin_lock_irqsave(&tty->buf.lock)
                  disc->ops->receive_buf(tty, char_buf)
                    n_tty_receive_buf
                      tty->ops->flush_chars()
                      uart_flush_chars
                        uart_start
                          spin_lock_irqsave(&port->lock) <--- already hold this lock
      
      Avoid this by using a dedicated lock to protect the eg20t_port structure
      and IO access to its membase. This is more consistent with the 8250
      driver.  Ensure priv->lock is always take prior to priv->port.lock when
      taken at the same time.
      
      V2: Remove inadvertent whitespace change.
      V3: Account for oops_in_progress for the private lock in
          pch_console_write().
      
      Note: Like the 8250 driver, if a printk is introduced anywhere inside
            the pch_console_write() critical section, the kernel will hang
            on a recursive spinlock on the private lock. The oops case is
            handled by using a trylock in the oops_in_progress case.
      Signed-off-by: default avatarDarren Hart <dvhart@linux.intel.com>
      CC: Tomoya MORINAGA <tomoya.rohm@gmail.com>
      CC: Feng Tang <feng.tang@intel.com>
      CC: Alexander Stein <alexander.stein@systec-electronic.com>
      Acked-by: default avatarAlan Cox <alan@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [bwh: Backported to 3.2:
       - Adjust context
       - Drop changes to pch_console_write()]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      3f00d57f
    • Vinicius Costa Gomes's avatar
      Bluetooth: Fix sending a HCI Authorization Request over LE links · ff03261a
      Vinicius Costa Gomes authored
      commit d8343f12 upstream.
      
      In the case that the link is already in the connected state and a
      Pairing request arrives from the mgmt interface, hci_conn_security()
      would be called but it was not considering LE links.
      Reported-by: default avatarJoão Paulo Rechi Vita <jprvita@openbossa.org>
      Signed-off-by: default avatarVinicius Costa Gomes <vinicius.gomes@openbossa.org>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      ff03261a
    • Vinicius Costa Gomes's avatar
      Bluetooth: Change signature of smp_conn_security() · 6e792a90
      Vinicius Costa Gomes authored
      commit cc110922 upstream.
      
      To make it clear that it may be called from contexts that may not have
      any knowledge of L2CAP, we change the connection parameter, to receive
      a hci_conn.
      
      This also makes it clear that it is checking the security of the link.
      Signed-off-by: default avatarVinicius Costa Gomes <vinicius.gomes@openbossa.org>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      6e792a90
    • Al Cooper's avatar
      mmc: Prevent 1.8V switch for SD hosts that don't support UHS modes. · 26fb1ba1
      Al Cooper authored
      commit 4188bba0 upstream.
      
      The driver should not try to switch to 1.8V when the SD 3.0 host
      controller does not have any UHS capabilities bits set (SDR50, DDR50
      or SDR104). See page 72 of "SD Specifications Part A2 SD Host
      Controller Simplified Specification Version 3.00" under
      "1.8V Signaling Enable". Instead of setting SDR12 and SDR25 in the host
      capabilities data structure for all V3.0 host controllers, only set them
      if SDR104, SDR50 or DDR50 is set in the host capabilities register. This
      will prevent the switch to 1.8V later.
      Signed-off-by: default avatarAl Cooper <acooper@gmail.com>
      Acked-by: default avatarArindam Nath <arindam.nath@amd.com>
      Acked-by: default avatarPhilip Rakity <prakity@marvell.com>
      Acked-by: default avatarGirish K S <girish.shivananjappa@linaro.org>
      Signed-off-by: default avatarChris Ball <cjb@laptop.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      26fb1ba1
    • Daniel J Blueman's avatar
      Prevent interface errors with Seagate FreeAgent GoFlex · 96947d2b
      Daniel J Blueman authored
      commit c531077f upstream.
      
      When using my Seagate FreeAgent GoFlex eSATAp external disk enclosure,
      interface errors are always seen until 1.5Gbps is negotiated [1]. This
      occurs using any disk in the enclosure, and when the disk is connected
      directly with a generic passive eSATAp cable, we see stable 3Gbps
      operation as expected.
      
      Blacklist 3Gbps mode to avoid dataloss and the ~30s delay bus reset
      and renegotiation incurs.
      Signed-off-by: default avatarDaniel J Blueman <daniel@quora.org>
      Signed-off-by: default avatarJeff Garzik <jgarzik@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      96947d2b
    • Weiping Pan's avatar
      rds: set correct msg_namelen · 2a181c85
      Weiping Pan authored
      commit 06b6a1cf upstream.
      
      Jay Fenlason (fenlason@redhat.com) found a bug,
      that recvfrom() on an RDS socket can return the contents of random kernel
      memory to userspace if it was called with a address length larger than
      sizeof(struct sockaddr_in).
      rds_recvmsg() also fails to set the addr_len paramater properly before
      returning, but that's just a bug.
      There are also a number of cases wher recvfrom() can return an entirely bogus
      address. Anything in rds_recvmsg() that returns a non-negative value but does
      not go through the "sin = (struct sockaddr_in *)msg->msg_name;" code path
      at the end of the while(1) loop will return up to 128 bytes of kernel memory
      to userspace.
      
      And I write two test programs to reproduce this bug, you will see that in
      rds_server, fromAddr will be overwritten and the following sock_fd will be
      destroyed.
      Yes, it is the programmer's fault to set msg_namelen incorrectly, but it is
      better to make the kernel copy the real length of address to user space in
      such case.
      
      How to run the test programs ?
      I test them on 32bit x86 system, 3.5.0-rc7.
      
      1 compile
      gcc -o rds_client rds_client.c
      gcc -o rds_server rds_server.c
      
      2 run ./rds_server on one console
      
      3 run ./rds_client on another console
      
      4 you will see something like:
      server is waiting to receive data...
      old socket fd=3
      server received data from client:data from client
      msg.msg_namelen=32
      new socket fd=-1067277685
      sendmsg()
      : Bad file descriptor
      
      /***************** rds_client.c ********************/
      
      int main(void)
      {
      	int sock_fd;
      	struct sockaddr_in serverAddr;
      	struct sockaddr_in toAddr;
      	char recvBuffer[128] = "data from client";
      	struct msghdr msg;
      	struct iovec iov;
      
      	sock_fd = socket(AF_RDS, SOCK_SEQPACKET, 0);
      	if (sock_fd < 0) {
      		perror("create socket error\n");
      		exit(1);
      	}
      
      	memset(&serverAddr, 0, sizeof(serverAddr));
      	serverAddr.sin_family = AF_INET;
      	serverAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
      	serverAddr.sin_port = htons(4001);
      
      	if (bind(sock_fd, (struct sockaddr*)&serverAddr, sizeof(serverAddr)) < 0) {
      		perror("bind() error\n");
      		close(sock_fd);
      		exit(1);
      	}
      
      	memset(&toAddr, 0, sizeof(toAddr));
      	toAddr.sin_family = AF_INET;
      	toAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
      	toAddr.sin_port = htons(4000);
      	msg.msg_name = &toAddr;
      	msg.msg_namelen = sizeof(toAddr);
      	msg.msg_iov = &iov;
      	msg.msg_iovlen = 1;
      	msg.msg_iov->iov_base = recvBuffer;
      	msg.msg_iov->iov_len = strlen(recvBuffer) + 1;
      	msg.msg_control = 0;
      	msg.msg_controllen = 0;
      	msg.msg_flags = 0;
      
      	if (sendmsg(sock_fd, &msg, 0) == -1) {
      		perror("sendto() error\n");
      		close(sock_fd);
      		exit(1);
      	}
      
      	printf("client send data:%s\n", recvBuffer);
      
      	memset(recvBuffer, '\0', 128);
      
      	msg.msg_name = &toAddr;
      	msg.msg_namelen = sizeof(toAddr);
      	msg.msg_iov = &iov;
      	msg.msg_iovlen = 1;
      	msg.msg_iov->iov_base = recvBuffer;
      	msg.msg_iov->iov_len = 128;
      	msg.msg_control = 0;
      	msg.msg_controllen = 0;
      	msg.msg_flags = 0;
      	if (recvmsg(sock_fd, &msg, 0) == -1) {
      		perror("recvmsg() error\n");
      		close(sock_fd);
      		exit(1);
      	}
      
      	printf("receive data from server:%s\n", recvBuffer);
      
      	close(sock_fd);
      
      	return 0;
      }
      
      /***************** rds_server.c ********************/
      
      int main(void)
      {
      	struct sockaddr_in fromAddr;
      	int sock_fd;
      	struct sockaddr_in serverAddr;
      	unsigned int addrLen;
      	char recvBuffer[128];
      	struct msghdr msg;
      	struct iovec iov;
      
      	sock_fd = socket(AF_RDS, SOCK_SEQPACKET, 0);
      	if(sock_fd < 0) {
      		perror("create socket error\n");
      		exit(0);
      	}
      
      	memset(&serverAddr, 0, sizeof(serverAddr));
      	serverAddr.sin_family = AF_INET;
      	serverAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
      	serverAddr.sin_port = htons(4000);
      	if (bind(sock_fd, (struct sockaddr*)&serverAddr, sizeof(serverAddr)) < 0) {
      		perror("bind error\n");
      		close(sock_fd);
      		exit(1);
      	}
      
      	printf("server is waiting to receive data...\n");
      	msg.msg_name = &fromAddr;
      
      	/*
      	 * I add 16 to sizeof(fromAddr), ie 32,
      	 * and pay attention to the definition of fromAddr,
      	 * recvmsg() will overwrite sock_fd,
      	 * since kernel will copy 32 bytes to userspace.
      	 *
      	 * If you just use sizeof(fromAddr), it works fine.
      	 * */
      	msg.msg_namelen = sizeof(fromAddr) + 16;
      	/* msg.msg_namelen = sizeof(fromAddr); */
      	msg.msg_iov = &iov;
      	msg.msg_iovlen = 1;
      	msg.msg_iov->iov_base = recvBuffer;
      	msg.msg_iov->iov_len = 128;
      	msg.msg_control = 0;
      	msg.msg_controllen = 0;
      	msg.msg_flags = 0;
      
      	while (1) {
      		printf("old socket fd=%d\n", sock_fd);
      		if (recvmsg(sock_fd, &msg, 0) == -1) {
      			perror("recvmsg() error\n");
      			close(sock_fd);
      			exit(1);
      		}
      		printf("server received data from client:%s\n", recvBuffer);
      		printf("msg.msg_namelen=%d\n", msg.msg_namelen);
      		printf("new socket fd=%d\n", sock_fd);
      		strcat(recvBuffer, "--data from server");
      		if (sendmsg(sock_fd, &msg, 0) == -1) {
      			perror("sendmsg()\n");
      			close(sock_fd);
      			exit(1);
      		}
      	}
      
      	close(sock_fd);
      	return 0;
      }
      Signed-off-by: default avatarWeiping Pan <wpan@redhat.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      2a181c85
    • Li Zhong's avatar
      Fix a dead loop in async_synchronize_full() · 5b5f4aa5
      Li Zhong authored
      [Fixed upstream by commits 2955b47d and
      a4683487 from Dan Williams, but they are much
      more intrusive than this tiny fix, according to Andrew - gregkh]
      
      This patch tries to fix a dead loop in  async_synchronize_full(), which
      could be seen when preemption is disabled on a single cpu machine.
      
      void async_synchronize_full(void)
      {
              do {
                      async_synchronize_cookie(next_cookie);
              } while (!list_empty(&async_running) || !
      list_empty(&async_pending));
      }
      
      async_synchronize_cookie() calls async_synchronize_cookie_domain() with
      &async_running as the default domain to synchronize.
      
      However, there might be some works in the async_pending list from other
      domains. On a single cpu system, without preemption, there is no chance
      for the other works to finish, so async_synchronize_full() enters a dead
      loop.
      
      It seems async_synchronize_full() wants to synchronize all entries in
      all running lists(domains), so maybe we could just check the entry_count
      to know whether all works are finished.
      
      Currently, async_synchronize_cookie_domain() expects a non-NULL running
      list ( if NULL, there would be NULL pointer dereference ), so maybe a
      NULL pointer could be used as an indication for the functions to
      synchronize all works in all domains.
      Reported-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Signed-off-by: default avatarLi Zhong <zhong@linux.vnet.ibm.com>
      Tested-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Tested-by: default avatarChristian Kujau <lists@nerdbynature.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Dan Williams <dan.j.williams@gmail.com>
      Cc: Christian Kujau <lists@nerdbynature.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Cong Wang <xiyou.wangcong@gmail.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      5b5f4aa5
    • Rustad, Mark D's avatar
      net: Statically initialize init_net.dev_base_head · 954f8352
      Rustad, Mark D authored
      commit 734b6541 upstream.
      
      This change eliminates an initialization-order hazard most
      recently seen when netprio_cgroup is built into the kernel.
      
      With thanks to Eric Dumazet for catching a bug.
      Signed-off-by: default avatarMark Rustad <mark.d.rustad@intel.com>
      Acked-by: default avatarEric Dumazet <edumazet@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      954f8352
    • Henrik Rydberg's avatar
      Bluetooth: Add support for Apple vendor-specific devices · f4df2d0a
      Henrik Rydberg authored
      commit 1fa6535f upstream.
      
      As pointed out by Gustavo and Marcel, all Apple-specific Broadcom
      devices seen so far have the same interface class, subclass and
      protocol numbers. This patch adds an entry which matches all of them,
      using the new USB_VENDOR_AND_INTERFACE_INFO() macro.
      
      In particular, this patch adds support for the MacBook Pro Retina
      (05ac:8286), which is not in the present list.
      Signed-off-by: default avatarHenrik Rydberg <rydberg@euromail.se>
      Tested-by: default avatarShea Levy <shea@shealevy.com>
      Acked-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f4df2d0a
    • Gustavo Padovan's avatar
      Bluetooth: Use USB_VENDOR_AND_INTERFACE() for Broadcom devices · c05a5031
      Gustavo Padovan authored
      commit 92c385f4 upstream.
      
      Many Broadcom devices has a vendor specific devices class, with this rule
      we match all existent and future controllers with this behavior.
      
      We also remove old rules to that matches product id for Broadcom devices.
      Tested-by: default avatarJohn Hommel <john.hommel@hp.com>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      c05a5031
    • Manoj Iyer's avatar
      Bluetooth: btusb: Add vendor specific ID (0a5c:21f4) BCM20702A0 · 2b3cbfc6
      Manoj Iyer authored
      commit 61c964ba upstream.
      
      Patch adds support for BCM20702A0 device id (0a5c:21f4).
      
      usb-devices after patch was applied:
      T: Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
      D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
      P: Vendor=0a5c ProdID=21f4 Rev=01.12
      S: Manufacturer=Broadcom Corp
      S: Product=BCM20702A0
      S: SerialNumber=E4D53DF154D6
      C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
      I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
      I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=btusb
      I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
      
      usb-devices before patch was applied:
      T: Bus=03 Lev=01 Prnt=01 Port=01 Cnt=01 Dev#= 2 Spd=12 MxCh= 0
      D: Ver= 2.00 Cls=ff(vend.) Sub=01 Prot=01 MxPS=64 #Cfgs= 1
      P: Vendor=0a5c ProdID=21f4 Rev=01.12
      S: Manufacturer=Broadcom Corp
      S: Product=BCM20702A0
      S: SerialNumber=E4D53DF154D6
      C: #Ifs= 4 Cfg#= 1 Atr=e0 MxPwr=0mA
      I: If#= 0 Alt= 0 #EPs= 3 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
      I: If#= 1 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=01 Prot=01 Driver=(none)
      I: If#= 2 Alt= 0 #EPs= 2 Cls=ff(vend.) Sub=ff Prot=ff Driver=(none)
      I: If#= 3 Alt= 0 #EPs= 0 Cls=fe(app. ) Sub=01 Prot=01 Driver=(none)
      Signed-off-by: default avatarManoj Iyer <manoj.iyer@canonical.com>
      Tested-by: default avatarChris Gagnon <chris.gagnon@canonical.com>
      Signed-off-by: default avatarGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      2b3cbfc6
    • Corentin Chary's avatar
      004ee938
    • Alan Stern's avatar
      USB: Fix race condition when removing host controllers · 0ecf1c24
      Alan Stern authored
      commit 0d00dc26 upstream.
      
      This patch (as1607) fixes a race that can occur if a USB host
      controller is removed while a process is reading the
      /sys/kernel/debug/usb/devices file.
      
      The usb_device_read() routine uses the bus->root_hub pointer to
      determine whether or not the root hub is registered.  The is not a
      valid test, because the pointer is set before the root hub gets
      registered and remains set even after the root hub is unregistered and
      deallocated.  As a result, usb_device_read() or usb_device_dump() can
      access freed memory, causing an oops.
      
      The patch changes the test to use the hcd->rh_registered flag, which
      does get set and cleared at the appropriate times.  It also makes sure
      to hold the usb_bus_list_lock mutex while setting the flag, so that
      usb_device_read() will become aware of new root hubs as soon as they
      are registered.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-by: default avatarDon Zickus <dzickus@redhat.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      0ecf1c24
    • NeilBrown's avatar
      md/raid10: fix "enough" function for detecting if array is failed. · 4e19de3b
      NeilBrown authored
      commit 80b48124 upstream.
      
      The 'enough' function is written to work with 'near' arrays only
      in that is implicitly assumes that the offset from one 'group' of
      devices to the next is the same as the number of copies.
      In reality it is the number of 'near' copies.
      
      So change it to make this number explicit.
      
      This bug makes it possible to run arrays without enough drives
      present, which is dangerous.
      It is appropriate for an -stable kernel, but will almost certainly
      need to be modified for some of them.
      Reported-by: default avatarJakub Husák <jakub@gooseman.cz>
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      [bwh: Backported to 3.2: s/geo->/conf->/]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      4e19de3b
    • Milan Broz's avatar
      dm table: clear add_random unless all devices have it set · e3dd7a09
      Milan Broz authored
      commit c3c4555e upstream.
      
      Always clear QUEUE_FLAG_ADD_RANDOM if any underlying device does not
      have it set. Otherwise devices with predictable characteristics may
      contribute entropy.
      
      QUEUE_FLAG_ADD_RANDOM specifies whether or not queue IO timings
      contribute to the random pool.
      
      For bio-based targets this flag is always 0 because such devices have no
      real queue.
      
      For request-based devices this flag was always set to 1 by default.
      
      Now set it according to the flags on underlying devices. If there is at
      least one device which should not contribute, set the flag to zero: If a
      device, such as fast SSD storage, is not suitable for supplying entropy,
      a request-based queue stacked over it will not be either.
      
      Because the checking logic is exactly same as for the rotational flag,
      share the iteration function with device_is_nonrot().
      Signed-off-by: default avatarMilan Broz <mbroz@redhat.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e3dd7a09
    • Mike Snitzer's avatar
      dm: handle requests beyond end of device instead of using BUG_ON · 1bd66696
      Mike Snitzer authored
      commit ba1cbad9 upstream.
      
      The access beyond the end of device BUG_ON that was introduced to
      dm_request_fn via commit 29e4013d ("dm: implement
      REQ_FLUSH/FUA support for request-based dm") was an overly
      drastic (but simple) response to this situation.
      
      I have received a report that this BUG_ON was hit and now think
      it would be better to use dm_kill_unmapped_request() to fail the clone
      and original request with -EIO.
      
      map_request() will assign the valid target returned by
      dm_table_find_target to tio->ti.  But when the target
      isn't valid tio->ti is never assigned (because map_request isn't
      called); so add a check for tio->ti != NULL to dm_done().
      Reported-by: default avatarMike Christie <michaelc@cs.wisc.edu>
      Signed-off-by: default avatarMike Snitzer <snitzer@redhat.com>
      Signed-off-by: default avatarJun'ichi Nomura <j-nomura@ce.jp.nec.com>
      Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      1bd66696
    • Mauro Carvalho Chehab's avatar
      sb_edac: Avoid overflow errors at memory size calculation · b39bfb4c
      Mauro Carvalho Chehab authored
      commit deb09dda upstream.
      
      Sandy bridge EDAC is calculating the memory size with overflow.
      Basically, the size field and the integer calculation is using 32 bits.
      More bits are needed, when the DIMM memories have high density.
      
      The net result is that memories are improperly reported there, when
      high-density DIMMs are used:
      
      EDAC DEBUG: in drivers/edac/sb_edac.c, line at 591: mc#0: channel 0, dimm 0, -16384 Mb (-4194304 pages) bank: 8, rank: 2, row: 0x10000, col: 0x800
      EDAC DEBUG: in drivers/edac/sb_edac.c, line at 591: mc#0: channel 1, dimm 0, -16384 Mb (-4194304 pages) bank: 8, rank: 2, row: 0x10000, col: 0x800
      
      As the number of pages value is handled at the EDAC core as unsigned
      ints, the driver shows the 16 GB memories at sysfs interface as 16760832
      MB! The fix is simple: calculate the number of pages as unsigned 64-bits
      integer.
      
      After the patch, the memory size (16 GB) is properly detected:
      
      EDAC DEBUG: in drivers/edac/sb_edac.c, line at 592: mc#0: channel 0, dimm 0, 16384 Mb (4194304 pages) bank: 8, rank: 2, row: 0x10000, col: 0x800
      EDAC DEBUG: in drivers/edac/sb_edac.c, line at 592: mc#0: channel 1, dimm 0, 16384 Mb (4194304 pages) bank: 8, rank: 2, row: 0x10000, col: 0x800
      Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
      [bwh: Backported to 3.2:
       - Adjust context
       - Debug log function is debugf0(), not edac_dbg()]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b39bfb4c
    • Roland Stigge's avatar
      gpio-lpc32xx: Fix value handling of gpio_direction_output() · 247a9ca1
      Roland Stigge authored
      commit b1268d37 upstream.
      
      For GPIOs of gpio-lpc32xx, gpio_direction_output() ignores the value argument
      (initial value of output). This patch fixes this by setting the level
      accordingly.
      Signed-off-by: default avatarRoland Stigge <stigge@antcom.de>
      Acked-by: default avatarAlexandre Pereira da Silva <aletes.xgr@gmail.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      247a9ca1
    • Konrad Rzeszutek Wilk's avatar
      xen/boot: Disable NUMA for PV guests. · 9109ae15
      Konrad Rzeszutek Wilk authored
      commit 8d54db79 upstream.
      
      The hypervisor is in charge of allocating the proper "NUMA" memory
      and dealing with the CPU scheduler to keep them bound to the proper
      NUMA node. The PV guests (and PVHVM) have no inkling of where they
      run and do not need to know that right now. In the future we will
      need to inject NUMA configuration data (if a guest spans two or more
      NUMA nodes) so that the kernel can make the right choices. But those
      patches are not yet present.
      
      In the meantime, disable the NUMA capability in the PV guest, which
      also fixes a bootup issue. Andre says:
      
      "we see Dom0 crashes due to the kernel detecting the NUMA topology not
      by ACPI, but directly from the northbridge (CONFIG_AMD_NUMA).
      
      This will detect the actual NUMA config of the physical machine, but
      will crash about the mismatch with Dom0's virtual memory. Variation of
      the theme: Dom0 sees what it's not supposed to see.
      
      This happens with the said config option enabled and on a machine where
      this scanning is still enabled (K8 and Fam10h, not Bulldozer class)
      
      We have this dump then:
      NUMA: Warning: node ids are out of bound, from=-1 to=-1 distance=10
      Scanning NUMA topology in Northbridge 24
      Number of physical nodes 4
      Node 0 MemBase 0000000000000000 Limit 0000000040000000
      Node 1 MemBase 0000000040000000 Limit 0000000138000000
      Node 2 MemBase 0000000138000000 Limit 00000001f8000000
      Node 3 MemBase 00000001f8000000 Limit 0000000238000000
      Initmem setup node 0 0000000000000000-0000000040000000
        NODE_DATA [000000003ffd9000 - 000000003fffffff]
      Initmem setup node 1 0000000040000000-0000000138000000
        NODE_DATA [0000000137fd9000 - 0000000137ffffff]
      Initmem setup node 2 0000000138000000-00000001f8000000
        NODE_DATA [00000001f095e000 - 00000001f0984fff]
      Initmem setup node 3 00000001f8000000-0000000238000000
      Cannot find 159744 bytes in node 3
      BUG: unable to handle kernel NULL pointer dereference at (null)
      IP: [<ffffffff81d220e6>] __alloc_bootmem_node+0x43/0x96
      Pid: 0, comm: swapper Not tainted 3.3.6 #1 AMD Dinar/Dinar
      RIP: e030:[<ffffffff81d220e6>]  [<ffffffff81d220e6>] __alloc_bootmem_node+0x43/0x96
      .. snip..
        [<ffffffff81d23024>] sparse_early_usemaps_alloc_node+0x64/0x178
        [<ffffffff81d23348>] sparse_init+0xe4/0x25a
        [<ffffffff81d16840>] paging_init+0x13/0x22
        [<ffffffff81d07fbb>] setup_arch+0x9c6/0xa9b
        [<ffffffff81683954>] ? printk+0x3c/0x3e
        [<ffffffff81d01a38>] start_kernel+0xe5/0x468
        [<ffffffff81d012cf>] x86_64_start_reservations+0xba/0xc1
        [<ffffffff81007153>] ? xen_setup_runstate_info+0x2c/0x36
        [<ffffffff81d050ee>] xen_start_kernel+0x565/0x56c
      "
      
      so we just disable NUMA scanning by setting numa_off=1.
      Reported-and-Tested-by: default avatarAndre Przywara <andre.przywara@amd.com>
      Acked-by: default avatarAndre Przywara <andre.przywara@amd.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      9109ae15
    • Andreas Herrmann's avatar
      hwmon: (fam15h_power) Tweak runavg_range on resume · 9a98a72f
      Andreas Herrmann authored
      commit 5f0ecb90 upstream.
      
      The quirk introduced with commit
      00250ec9 (hwmon: fam15h_power: fix
      bogus values with current BIOSes) is not only required during driver
      load but also when system resumes from suspend. The BIOS might set the
      previously recommended (but unsuitable) initilization value for the
      running average range register during resume.
      Signed-off-by: default avatarAndreas Herrmann <andreas.herrmann3@amd.com>
      Tested-by: default avatarAndreas Hartmann <andihartmann@01019freenet.de>
      Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      9a98a72f
    • Nestor Lopez Casado's avatar
      HID: Fix logitech-dj: missing Unifying device issue · e189acb1
      Nestor Lopez Casado authored
      commit 59626408 upstream.
      
      This patch fixes an issue introduced after commit 4ea54542
      ("HID: Fix race condition between driver core and ll-driver").
      
      After that commit, hid-core discards any incoming packet that arrives while
      hid driver's probe function is being executed.
      
      This broke the enumeration process of hid-logitech-dj, that must receive
      control packets in-band with the mouse and keyboard packets. Discarding mouse
      or keyboard data at the very begining is usually fine, but it is not the case
      for control packets.
      
      This patch forces a re-enumeration of the paired devices when a packet arrives
      that comes from an unknown device.
      
      Based on a patch originally written by Benjamin Tissoires.
      Signed-off-by: default avatarNestor Lopez Casado <nlopezcasad@logitech.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e189acb1
    • Alan Cox's avatar
      dj: memory scribble in logi_dj · b457f467
      Alan Cox authored
      commit 8a55ade7 upstream.
      
      Allocate a structure not a pointer to it !
      Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b457f467
    • Marc Dionne's avatar
      HID: logitech: don't use stack based dj_report structures · 01d35d12
      Marc Dionne authored
      commit d8dc3494 upstream.
      
      On a system with a logitech wireless keyboard/mouse and DMA-API debugging
      enabled, this warning appears at boot:
      
      kernel: WARNING: at lib/dma-debug.c:929 check_for_stack.part.12+0x70/0xa7()
      kernel: Hardware name: MS-7593
      kernel: uhci_hcd 0000:00:1d.1: DMA-API: device driver maps memory fromstack [addr=ffff8801b0079c29]
      
      Make logi_dj_recv_query_paired_devices and logi_dj_recv_switch_to_dj_mode
      use a structure allocated with kzalloc rather than a stack based one.
      Signed-off-by: default avatarMarc Dionne <marc.c.dionne@gmail.com>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      01d35d12
    • Nestor Lopez Casado's avatar
      HID: logitech: fix mask to enable DJ mode · b66c949a
      Nestor Lopez Casado authored
      commit 76503166 upstream.
      
      The user can only experience the bug if she pairs 6 devices to a Unifying
      receiver. The sixth paired device would not work.
      
      The value changed is actually a bitmask that enables reporting from each
      paired device. As the sixth bit was not set, the sixth device reports are
      ignored by the receiver and never get to the driver.
      Signed-off-by: default avatarNestor Lopez Casado <nlopezcasad@logitech.com>
      
       drivers/hid/hid-logitech-dj.c |    2 +-
       1 files changed, 1 insertions(+), 1 deletions(-)
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b66c949a
    • Marc Kleine-Budde's avatar
      can: ti_hecc: fix oops during rmmod · 3d66356b
      Marc Kleine-Budde authored
      commit ab04c8bd upstream.
      
      This patch fixes an oops which occurs when unloading the driver, while the
      network interface is still up. The problem is that first the io mapping is
      teared own, then the CAN device is unregistered, resulting in accessing the
      hardware's iomem:
      
      [  172.744232] Unable to handle kernel paging request at virtual address c88b0040
      [  172.752441] pgd = c7be4000
      [  172.755645] [c88b0040] *pgd=87821811, *pte=00000000, *ppte=00000000
      [  172.762207] Internal error: Oops: 807 [#1] PREEMPT ARM
      [  172.767517] Modules linked in: ti_hecc(-) can_dev
      [  172.772430] CPU: 0    Not tainted  (3.5.0alpha-00037-g3554cc0 #126)
      [  172.778961] PC is at ti_hecc_close+0xb0/0x100 [ti_hecc]
      [  172.784423] LR is at __dev_close_many+0x90/0xc0
      [  172.789123] pc : [<bf00c768>]    lr : [<c033be58>]    psr: 60000013
      [  172.789123] sp : c5c1de68  ip : 00040081  fp : 00000000
      [  172.801025] r10: 00000001  r9 : c5c1c000  r8 : 00100100
      [  172.806457] r7 : c5d0a48c  r6 : c5d0a400  r5 : 00000000  r4 : c5d0a000
      [  172.813232] r3 : c88b0000  r2 : 00000001  r1 : c5d0a000  r0 : c5d0a000
      [  172.820037] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment user
      [  172.827423] Control: 10c5387d  Table: 87be4019  DAC: 00000015
      [  172.833404] Process rmmod (pid: 600, stack limit = 0xc5c1c2f0)
      [  172.839447] Stack: (0xc5c1de68 to 0xc5c1e000)
      [  172.843994] de60:                   bf00c6b8 c5c1dec8 c5d0a000 c5d0a000 00200200 c033be58
      [  172.852478] de80: c5c1de44 c5c1dec8 c5c1dec8 c033bf2c c5c1de90 c5c1de90 c5d0a084 c5c1de44
      [  172.860992] dea0: c5c1dec8 c033c098 c061d3dc c5d0a000 00000000 c05edf28 c05edb34 c000d724
      [  172.869476] dec0: 00000000 c033c2f8 c5d0a084 c5d0a084 00000000 c033c370 00000000 c5d0a000
      [  172.877990] dee0: c05edb00 c033c3b8 c5d0a000 bf00d3ac c05edb00 bf00d7c8 bf00d7c8 c02842dc
      [  172.886474] df00: c02842c8 c0282f90 c5c1c000 c05edb00 bf00d7c8 c0283668 bf00d7c8 00000000
      [  172.894989] df20: c0611f98 befe2f80 c000d724 c0282d10 bf00d804 00000000 00000013 c0068a8c
      [  172.903472] df40: c5c538e8 685f6974 00636365 c61571a8 c5cb9980 c61571a8 c6158a20 c00c9bc4
      [  172.911987] df60: 00000000 00000000 c5cb9980 00000000 c5cb9980 00000000 c7823680 00000006
      [  172.920471] df80: bf00d804 00000880 c5c1df8c 00000000 000d4267 befe2f80 00000001 b6d90068
      [  172.928985] dfa0: 00000081 c000d5a0 befe2f80 00000001 befe2f80 00000880 b6d90008 00000008
      [  172.937469] dfc0: befe2f80 00000001 b6d90068 00000081 00000001 00000000 befe2eac 00000000
      [  172.945983] dfe0: 00000000 befe2b18 00023ba4 b6e6addc 60000010 befe2f80 a8e00190 86d2d344
      [  172.954498] [<bf00c768>] (ti_hecc_close+0xb0/0x100 [ti_hecc]) from [<c033be58>] (__dev__registered_many+0xc0/0x2a0)
      [  172.984161] [<c033c098>] (rollback_registered_many+0xc0/0x2a0) from [<c033c2f8>] (rollback_registered+0x20/0x30)
      [  172.994750] [<c033c2f8>] (rollback_registered+0x20/0x30) from [<c033c370>] (unregister_netdevice_queue+0x68/0x98)
      [  173.005401] [<c033c370>] (unregister_netdevice_queue+0x68/0x98) from [<c033c3b8>] (unregister_netdev+0x18/0x20)
      [  173.015899] [<c033c3b8>] (unregister_netdev+0x18/0x20) from [<bf00d3ac>] (ti_hecc_remove+0x60/0x80 [ti_hecc])
      [  173.026245] [<bf00d3ac>] (ti_hecc_remove+0x60/0x80 [ti_hecc]) from [<c02842dc>] (platform_drv_remove+0x14/0x18)
      [  173.036712] [<c02842dc>] (platform_drv_remove+0x14/0x18) from [<c0282f90>] (__device_release_driver+0x7c/0xbc)
      
      Cc: Anant Gole <anantgole@ti.com>
      Tested-by: default avatarJan Luebbe <jlu@pengutronix.de>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      3d66356b
    • Ira W. Snyder's avatar
      can: janz-ican3: fix support for older hardware revisions · df186ac1
      Ira W. Snyder authored
      commit e21093ef upstream.
      
      The Revision 1.0 Janz CMOD-IO Carrier Board does not have support for
      the reset registers. To support older hardware, the code is changed to
      use the hardware reset register on the Janz VMOD-ICAN3 hardware itself.
      Signed-off-by: default avatarIra W. Snyder <iws@ovro.caltech.edu>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      df186ac1
    • Wen Congyang's avatar
      tracing: Don't call page_to_pfn() if page is NULL · b72a2bd8
      Wen Congyang authored
      commit 85f2a2ef upstream.
      
      When allocating memory fails, page is NULL. page_to_pfn() will
      cause the kernel panicked if we don't use sparsemem vmemmap.
      
      Link: http://lkml.kernel.org/r/505AB1FF.8020104@cn.fujitsu.com
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarMel Gorman <mel@csn.ul.ie>
      Reviewed-by: default avatarMinchan Kim <minchan@kernel.org>
      Signed-off-by: default avatarWen Congyang <wency@cn.fujitsu.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b72a2bd8
    • Anisse Astier's avatar
      Input: i8042 - disable mux on Toshiba C850D · b0162ce5
      Anisse Astier authored
      commit 8669cf67 upstream.
      
      On Toshiba Satellite C850D, the touchpad and the keyboard might randomly
      not work at boot. Preventing MUX mode activation solves this issue.
      Signed-off-by: default avatarAnisse Astier <anisse@astier.eu>
      Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      b0162ce5
    • Søren holm's avatar
      asix: Support DLink DUB-E100 H/W Ver C1 · 75c747ec
      Søren holm authored
      commit ed3770a9 upstream.
      Signed-off-by: default avatarSøren Holm <sgh@sgh.dk>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      [bwh: Backported to 3.2: adjust filename]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      75c747ec
    • Konrad Rzeszutek Wilk's avatar
      xen/boot: Disable BIOS SMP MP table search. · 0a193b14
      Konrad Rzeszutek Wilk authored
      commit bd49940a upstream.
      
      As the initial domain we are able to search/map certain regions
      of memory to harvest configuration data. For all low-level we
      use ACPI tables - for interrupts we use exclusively ACPI _PRT
      (so DSDT) and MADT for INT_SRC_OVR.
      
      The SMP MP table is not used at all. As a matter of fact we do
      not even support machines that only have SMP MP but no ACPI tables.
      
      Lets follow how Moorestown does it and just disable searching
      for BIOS SMP tables.
      
      This also fixes an issue on HP Proliant BL680c G5 and DL380 G6:
      
      9f->100 for 1:1 PTE
      Freeing 9f-100 pfn range: 97 pages freed
      1-1 mapping on 9f->100
      .. snip..
      e820: BIOS-provided physical RAM map:
      Xen: [mem 0x0000000000000000-0x000000000009efff] usable
      Xen: [mem 0x000000000009f400-0x00000000000fffff] reserved
      Xen: [mem 0x0000000000100000-0x00000000cfd1dfff] usable
      .. snip..
      Scan for SMP in [mem 0x00000000-0x000003ff]
      Scan for SMP in [mem 0x0009fc00-0x0009ffff]
      Scan for SMP in [mem 0x000f0000-0x000fffff]
      found SMP MP-table at [mem 0x000f4fa0-0x000f4faf] mapped at [ffff8800000f4fa0]
      (XEN) mm.c:908:d0 Error getting mfn 100 (pfn 5555555555555555) from L1 entry 0000000000100461 for l1e_owner=0, pg_owner=0
      (XEN) mm.c:4995:d0 ptwr_emulate: could not get_page_from_l1e()
      BUG: unable to handle kernel NULL pointer dereference at           (null)
      IP: [<ffffffff81ac07e2>] xen_set_pte_init+0x66/0x71
      . snip..
      Pid: 0, comm: swapper Not tainted 3.6.0-rc6upstream-00188-gb6fb969-dirty #2 HP ProLiant BL680c G5
      .. snip..
      Call Trace:
       [<ffffffff81ad31c6>] __early_ioremap+0x18a/0x248
       [<ffffffff81624731>] ? printk+0x48/0x4a
       [<ffffffff81ad32ac>] early_ioremap+0x13/0x15
       [<ffffffff81acc140>] get_mpc_size+0x2f/0x67
       [<ffffffff81acc284>] smp_scan_config+0x10c/0x136
       [<ffffffff81acc2e4>] default_find_smp_config+0x36/0x5a
       [<ffffffff81ac3085>] setup_arch+0x5b3/0xb5b
       [<ffffffff81624731>] ? printk+0x48/0x4a
       [<ffffffff81abca7f>] start_kernel+0x90/0x390
       [<ffffffff81abc356>] x86_64_start_reservations+0x131/0x136
       [<ffffffff81abfa83>] xen_start_kernel+0x65f/0x661
      (XEN) Domain 0 crashed: 'noreboot' set - not rebooting.
      
      which is that ioremap would end up mapping 0xff using _PAGE_IOMAP
      (which is what early_ioremap sticks as a flag) - which meant
      we would get MFN 0xFF (pte ff461, which is OK), and then it would
      also map 0x100 (b/c ioremap tries to get page aligned request, and
      it was trying to map 0xf4fa0 + PAGE_SIZE - so it mapped the next page)
      as _PAGE_IOMAP. Since 0x100 is actually a RAM page, and the _PAGE_IOMAP
      bypasses the P2M lookup we would happily set the PTE to 1000461.
      Xen would deny the request since we do not have access to the
      Machine Frame Number (MFN) of 0x100. The P2M[0x100] is for example
      0x80140.
      
      Fixes-Oracle-Bugzilla: https://bugzilla.oracle.com/bugzilla/show_bug.cgi?id=13665Acked-by: default avatarJan Beulich <jbeulich@suse.com>
      Signed-off-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      0a193b14
    • Luis R. Rodriguez's avatar
      cfg80211: fix possible circular lock on reg_regdb_search() · 22a40bd6
      Luis R. Rodriguez authored
      commit a85d0d7f upstream.
      
      When call_crda() is called we kick off a witch hunt search
      for the same regulatory domain on our internal regulatory
      database and that work gets kicked off on a workqueue, this
      is done while the cfg80211_mutex is held. If that workqueue
      kicks off it will first lock reg_regdb_search_mutex and
      later cfg80211_mutex but to ensure two CPUs will not contend
      against cfg80211_mutex the right thing to do is to have the
      reg_regdb_search() wait until the cfg80211_mutex is let go.
      
      The lockdep report is pasted below.
      
      cfg80211: Calling CRDA to update world regulatory domain
      
      ======================================================
      [ INFO: possible circular locking dependency detected ]
      3.3.8 #3 Tainted: G           O
      -------------------------------------------------------
      kworker/0:1/235 is trying to acquire lock:
       (cfg80211_mutex){+.+...}, at: [<816468a4>] set_regdom+0x78c/0x808 [cfg80211]
      
      but task is already holding lock:
       (reg_regdb_search_mutex){+.+...}, at: [<81646828>] set_regdom+0x710/0x808 [cfg80211]
      
      which lock already depends on the new lock.
      
      the existing dependency chain (in reverse order) is:
      
      -> #2 (reg_regdb_search_mutex){+.+...}:
             [<800a8384>] lock_acquire+0x60/0x88
             [<802950a8>] mutex_lock_nested+0x54/0x31c
             [<81645778>] is_world_regdom+0x9f8/0xc74 [cfg80211]
      
      -> #1 (reg_mutex#2){+.+...}:
             [<800a8384>] lock_acquire+0x60/0x88
             [<802950a8>] mutex_lock_nested+0x54/0x31c
             [<8164539c>] is_world_regdom+0x61c/0xc74 [cfg80211]
      
      -> #0 (cfg80211_mutex){+.+...}:
             [<800a77b8>] __lock_acquire+0x10d4/0x17bc
             [<800a8384>] lock_acquire+0x60/0x88
             [<802950a8>] mutex_lock_nested+0x54/0x31c
             [<816468a4>] set_regdom+0x78c/0x808 [cfg80211]
      
      other info that might help us debug this:
      
      Chain exists of:
        cfg80211_mutex --> reg_mutex#2 --> reg_regdb_search_mutex
      
       Possible unsafe locking scenario:
      
             CPU0                    CPU1
             ----                    ----
        lock(reg_regdb_search_mutex);
                                     lock(reg_mutex#2);
                                     lock(reg_regdb_search_mutex);
        lock(cfg80211_mutex);
      
       *** DEADLOCK ***
      
      3 locks held by kworker/0:1/235:
       #0:  (events){.+.+..}, at: [<80089a00>] process_one_work+0x230/0x460
       #1:  (reg_regdb_work){+.+...}, at: [<80089a00>] process_one_work+0x230/0x460
       #2:  (reg_regdb_search_mutex){+.+...}, at: [<81646828>] set_regdom+0x710/0x808 [cfg80211]
      
      stack backtrace:
      Call Trace:
      [<80290fd4>] dump_stack+0x8/0x34
      [<80291bc4>] print_circular_bug+0x2ac/0x2d8
      [<800a77b8>] __lock_acquire+0x10d4/0x17bc
      [<800a8384>] lock_acquire+0x60/0x88
      [<802950a8>] mutex_lock_nested+0x54/0x31c
      [<816468a4>] set_regdom+0x78c/0x808 [cfg80211]
      Reported-by: default avatarFelix Fietkau <nbd@openwrt.org>
      Tested-by: default avatarFelix Fietkau <nbd@openwrt.org>
      Signed-off-by: default avatarLuis R. Rodriguez <mcgrof@do-not-panic.com>
      Reviewed-by: default avatarJohannes Berg <johannes@sipsolutions.net>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      22a40bd6
    • Jeff Layton's avatar
      cifs: fix return value in cifsConvertToUTF16 · f2efd134
      Jeff Layton authored
      commit c73f6939 upstream.
      
      This function returns the wrong value, which causes the callers to get
      the length of the resulting pathname wrong when it contains non-ASCII
      characters.
      
      This seems to fix https://bugzilla.samba.org/show_bug.cgi?id=6767Reported-by: default avatarBaldvin Kovacs <baldvin.kovacs@gmail.com>
      Reported-and-Tested-by: default avatarNicolas Lefebvre <nico.lefebvre@gmail.com>
      Signed-off-by: default avatarJeff Layton <jlayton@redhat.com>
      Signed-off-by: default avatarSteve French <smfrench@gmail.com>
      [bwh: Backported to 3.2: adjust context]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      f2efd134
    • Guenter Roeck's avatar
      hwmon: (ad7314) Add 'name' sysfs attribute · 69102700
      Guenter Roeck authored
      commit 3ceefe43 upstream.
      
      The 'name' sysfs attribute is mandatory for hwmon devices, but was missing
      in this driver.
      
      Cc: Jonathan Cameron <jic23@cam.ac.uk>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Acked-by: default avatarJean Delvare <khali@linux-fr.org>
      Acked-by: default avatarJonathan Cameron <jic23@cam.ac.uk>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      69102700
    • Stephen M. Cameron's avatar
      hpsa: fix handling of protocol error · e95d3285
      Stephen M. Cameron authored
      commit 256d0eaa upstream.
      
      If a command status of CMD_PROTOCOL_ERR is received, this
      information should be conveyed to the SCSI mid layer, not
      dropped on the floor.  CMD_PROTOCOL_ERR may be received
      from the Smart Array for any commands destined for an external
      RAID controller such as a P2000, or commands destined for tape
      drives or CD/DVD-ROM drives, if for instance a cable is
      disconnected.  This mostly affects multipath configurations, as
      disconnecting a cable on a non-multipath configuration is not
      going to do anything good regardless of whether CMD_PROTOCOL_ERR
      is handled correctly or not.  Not handling CMD_PROTOCOL_ERR
      correctly in a multipath configaration involving external RAID
      controllers may cause data corruption, so this is quite a serious
      bug.  This bug should not normally cause a problem for direct
      attached disk storage.
      Signed-off-by: default avatarStephen M. Cameron <scameron@beardog.cce.hp.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      e95d3285
    • Sachin Kamat's avatar
      DMA: PL330: Check the pointer returned by kzalloc · cd2ff826
      Sachin Kamat authored
      commit 61c6e753 upstream.
      
      kzalloc could return NULL. Hence add a check to avoid
      NULL pointer dereference.
      Signed-off-by: default avatarSachin Kamat <sachin.kamat@linaro.org>
      Acked-by: default avatarJassi Brar <jassisinghbrar@gmail.com>
      Signed-off-by: default avatarVinod Koul <vinod.koul@linux.intel.com>
      [bwh: Backported to 3.2: adjust context and error label]
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      cd2ff826
    • Guenter Roeck's avatar
      hwmon: (ads7871) Add 'name' sysfs attribute · d912bb41
      Guenter Roeck authored
      commit 4e21f4ea upstream.
      
      The 'name' sysfs attribute is mandatory for hwmon devices, but was missing
      in this driver.
      
      Cc: Paul Thomas <pthomas8589@gmail.com>
      Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
      Acked-by: default avatarJean Delvare <khali@linux-fr.org>
      Acked-by: default avatarPaul Thomas <pthomas8589@gmail.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      d912bb41
    • sreekanth.reddy@lsi.com's avatar
      mpt2sas: Fix for issue - Unable to boot from the drive connected to HBA · 8756f652
      sreekanth.reddy@lsi.com authored
      commit 10cce6d8 upstream.
      
      This patch checks whether HBA is SAS2008 B0 controller.
      if it is a SAS2008 B0 controller then it use IO-APIC interrupt instead of MSIX,
      as SAS2008 B0 controller doesn't support MSIX interrupts.
      
      [jejb: fix whitespace problems]
      Signed-off-by: default avatarSreekanth Reddy <sreekanth.reddy@lsi.com>
      Signed-off-by: default avatarJames Bottomley <JBottomley@Parallels.com>
      Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
      8756f652