1. 02 Oct, 2012 40 commits
    • Daniel J Blueman's avatar
      libata: Prevent interface errors with Seagate FreeAgent GoFlex · 894682fd
      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 avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      894682fd
    • Weiping Pan's avatar
      rds: set correct msg_namelen · 25dee10e
      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 avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      25dee10e
    • Li Zhong's avatar
      Fix a dead loop in async_synchronize_full() · 45516ddc
      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>
      45516ddc
    • Rustad, Mark D's avatar
      net: Statically initialize init_net.dev_base_head · b64295e8
      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 avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b64295e8
    • Henrik Rydberg's avatar
      Bluetooth: Add support for Apple vendor-specific devices · 41ed10ac
      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 avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      41ed10ac
    • Gustavo Padovan's avatar
      Bluetooth: Use USB_VENDOR_AND_INTERFACE() for Broadcom devices · 4d94c8ce
      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 avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4d94c8ce
    • Manoj Iyer's avatar
      Bluetooth: btusb: Add vendor specific ID (0a5c:21f4) BCM20702A0 · d10d2f0a
      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 avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d10d2f0a
    • Alan Cox's avatar
      x86: Fix boot on Twinhead H12Y · b69eba70
      Alan Cox authored
      commit 80b3e557 upstream.
      
      Despite lots of investigation into why this is needed we don't
      know or have an elegant cure. The only answer found on this
      laptop is to mark a problem region as used so that Linux doesn't
      put anything there.
      
      Currently all the users add reserve= command lines and anyone
      not knowing this needs to find the magic page that documents it.
      Automate it instead.
      Signed-off-by: default avatarAlan Cox <alan@linux.intel.com>
      Tested-and-bugfixed-by: default avatarArne Fitzenreiter <arne@fitzenreiter.de>
      Resolves-bug: https://bugzilla.kernel.org/show_bug.cgi?id=10231
      Link: http://lkml.kernel.org/r/20120515174347.5109.94551.stgit@bluebookSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b69eba70
    • Lai Jiangshan's avatar
      workqueue: UNBOUND -> REBIND morphing in rebind_workers() should be atomic · bc713e26
      Lai Jiangshan authored
      commit 96e65306 upstream.
      
      The compiler may compile the following code into TWO write/modify
      instructions.
      
      	worker->flags &= ~WORKER_UNBOUND;
      	worker->flags |= WORKER_REBIND;
      
      so the other CPU may temporarily see worker->flags which doesn't have
      either WORKER_UNBOUND or WORKER_REBIND set and perform local wakeup
      prematurely.
      
      Fix it by using single explicit assignment via ACCESS_ONCE().
      
      Because idle workers have another WORKER_NOT_RUNNING flag, this bug
      doesn't exist for them; however, update it to use the same pattern for
      consistency.
      
      tj: Applied the change to idle workers too and updated comments and
          patch description a bit.
      Signed-off-by: default avatarLai Jiangshan <laijs@cn.fujitsu.com>
      Signed-off-by: default avatarTejun Heo <tj@kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      bc713e26
    • Wang Xingchao's avatar
      drm/i915: HDMI - Clear Audio Enable bit for Hot Plug · e2471ec3
      Wang Xingchao authored
      commit b98b6016 upstream.
      
      Clear Audio Enable bit to trigger unsolicated event to notify Audio
      Driver part the HDMI hot plug change. The patch fixed the bug when
      remove HDMI cable the bit was not cleared correctly.
      
      In intel_hdmi_dpms(), if intel_hdmi->has_audio been true, the "Audio enable bit" will
      be set to trigger unsolicated event to notify Alsa driver the change.
      
      intel_hdmi->has_audio will be reset to false from intel_hdmi_detect() after
      remove the hdmi cable, here's debug log:
      
      [  187.494153] [drm:output_poll_execute], [CONNECTOR:17:HDMI-A-1] status updated from 1 to 2
      [  187.525349] [drm:intel_hdmi_detect], HDMI: has_audio = 0
      
      so when comes back to intel_hdmi_dpms(), the "Audio enable bit" will not be cleared. And this
      cause the eld infomation and pin presence doesnot update accordingly in alsa driver side.
      
      This patch will also trigger unsolicated event to alsa driver to notify the hot plug event:
      
      [  187.853159] ALSA sound/pci/hda/patch_hdmi.c:772 HDMI hot plug event: Codec=3 Pin=5 Presence_Detect=0 ELD_Valid=1
      [  187.853268] ALSA sound/pci/hda/patch_hdmi.c:990 HDMI status: Codec=3 Pin=5 Presence_Detect=0 ELD_Valid=0
      Signed-off-by: default avatarWang Xingchao <xingchao.wang@intel.com>
      Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e2471ec3
    • AceLan Kao's avatar
      asus-nb-wmi: add some video toggle keys · 7693ca13
      AceLan Kao authored
      commit 3766054f upstream.
      
      There are some new video switch keys that used by newer machines.
      0xA0 - SDSP HDMI only
      0xA1 - SDSP LCD + HDMI
      0xA2 - SDSP CRT + HDMI
      0xA3 - SDSP TV + HDMI
      But in Linux, there is no suitable userspace application to handle this,
      so, mapping them all to KEY_SWITCHVIDEOMODE.
      Signed-off-by: default avatarAceLan Kao <acelan.kao@canonical.com>
      Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
      Cc: Tim Gardner <tim.gardner@canonical.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      7693ca13
    • Corentin Chary's avatar
    • Tvrtko Ursulin's avatar
      drm/radeon/kms: extend the Fujitsu D3003-S2 board connector quirk to cover later silicon stepping · 062a59ee
      Tvrtko Ursulin authored
      commit 52e9b39d upstream.
      
      There is a more recent APU stepping with a new PCI ID
      shipping in the same board by Fujitsu which needs the
      same quirk to correctly mark the back plane connectors.
      Signed-off-by: default avatarTvrtko Ursulin <tvrtko.ursulin@onelan.co.uk>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      062a59ee
    • Dave Airlie's avatar
      fbcon: fix race condition between console lock and cursor timer (v1.1) · eafd7bd3
      Dave Airlie authored
      commit d8636a27 upstream.
      
      So we've had a fair few reports of fbcon handover breakage between
      efi/vesafb and i915 surface recently, so I dedicated a couple of
      days to finding the problem.
      
      Essentially the last thing we saw was the conflicting framebuffer
      message and that was all.
      
      So after much tracing with direct netconsole writes (printks
      under console_lock not so useful), I think I found the race.
      
      Thread A (driver load)    Thread B (timer thread)
        unbind_con_driver ->              |
        bind_con_driver ->                |
        vc->vc_sw->con_deinit ->          |
        fbcon_deinit ->                   |
        console_lock()                    |
            |                             |
            |                       fbcon_flashcursor timer fires
            |                       console_lock() <- blocked for A
            |
            |
      fbcon_del_cursor_timer ->
        del_timer_sync
        (BOOM)
      
      Of course because all of this is under the console lock,
      we never see anything, also since we also just unbound the active
      console guess what we never see anything.
      
      Hopefully this fixes the problem for anyone seeing vesafb->kms
      driver handoff.
      
      v1.1: add comment suggestion from Alan.
      Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
      Acked-by: default avatarAlan Cox <alan@lxorguk.ukuu.org.uk>
      Tested-by: default avatarJosh Boyer <jwboyer@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      eafd7bd3
    • Robin Holt's avatar
      drivers/misc/sgi-xp/xpc_uv.c: SGI XPC fails to load when cpu 0 is out of IRQ resources · 9b3746b3
      Robin Holt authored
      commit 7838f994 upstream.
      
      On many of our larger systems, CPU 0 has had all of its IRQ resources
      consumed before XPC loads.  Worst cases on machines with multiple 10
      GigE cards and multiple IB cards have depleted the entire first socket
      of IRQs.
      
      This patch makes selecting the node upon which IRQs are allocated (as
      well as all the other GRU Message Queue structures) specifiable as a
      module load param and has a default behavior of searching all nodes/cpus
      for an available resources.
      
      [akpm@linux-foundation.org: fix build: include cpu.h and module.h]
      Signed-off-by: default avatarRobin Holt <holt@sgi.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      9b3746b3
    • Rafael J. Wysocki's avatar
      PM / Runtime: Clear power.deferred_resume on success in rpm_suspend() · d6163c4d
      Rafael J. Wysocki authored
      commit 58a34de7 upstream.
      
      The power.deferred_resume can only be set if the runtime PM status
      of device is RPM_SUSPENDING and it should be cleared after its
      status has been changed, regardless of whether or not the runtime
      suspend has been successful.  However, it only is cleared on
      suspend failure, while it may remain set on successful suspend and
      is happily leaked to rpm_resume() executed in that case.
      
      That shouldn't happen, so if power.deferred_resume is set in
      rpm_suspend() after the status has been changed to RPM_SUSPENDED,
      clear it before calling rpm_resume().  Then, it doesn't need to be
      cleared before changing the status to RPM_SUSPENDING any more,
      because it's always cleared after the status has been changed to
      either RPM_SUSPENDED (on success) or RPM_ACTIVE (on failure).
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d6163c4d
    • Rafael J. Wysocki's avatar
      PM / Runtime: Fix rpm_resume() return value for power.no_callbacks set · 5af14b89
      Rafael J. Wysocki authored
      commit 7f321c26 upstream.
      
      For devices whose power.no_callbacks flag is set, rpm_resume()
      should return 1 if the device's parent is already active, so that
      the callers of pm_runtime_get() don't think that they have to wait
      for the device to resume (asynchronously) in that case (the core
      won't queue up an asynchronous resume in that case, so there's
      nothing to wait for anyway).
      
      Modify the code accordingly (and make sure that an idle notification
      will be queued up on success, even if 1 is to be returned).
      Signed-off-by: default avatarRafael J. Wysocki <rjw@sisk.pl>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5af14b89
    • Atsushi Nemoto's avatar
      drivers/rtc/rtc-rs5c348.c: fix hour decoding in 12-hour mode · f20560e8
      Atsushi Nemoto authored
      commit 7dbfb315 upstream.
      
      Correct the offset by subtracting 20 from tm_hour before taking the
      modulo 12.
      
      [ "Why 20?" I hear you ask. Or at least I did.
      
        Here's the reason why: RS5C348_BIT_PM is 32, and is - stupidly -
        included in the RS5C348_HOURS_MASK define.  So it's really subtracting
        out that bit to get "hour+12".  But then because it does things modulo
        12, it needs to add the 12 in again afterwards anyway.
      
        This code is confused.  It would be much clearer if RS5C348_HOURS_MASK
        just didn't include the RS5C348_BIT_PM bit at all, then it wouldn't
        need to do the silly subtract either.
      
        Whatever. It's all just math, the end result is the same.   - Linus ]
      Reported-by: default avatarJames Nute <newten82@gmail.com>
      Tested-by: default avatarJames Nute <newten82@gmail.com>
      Signed-off-by: default avatarAtsushi Nemoto <anemo@mba.ocn.ne.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f20560e8
    • Will Deacon's avatar
      mutex: Place lock in contended state after fastpath_lock failure · d0179ca8
      Will Deacon authored
      commit 0bce9c46 upstream.
      
      ARM recently moved to asm-generic/mutex-xchg.h for its mutex
      implementation after the previous implementation was found to be missing
      some crucial memory barriers. However, this has revealed some problems
      running hackbench on SMP platforms due to the way in which the
      MUTEX_SPIN_ON_OWNER code operates.
      
      The symptoms are that a bunch of hackbench tasks are left waiting on an
      unlocked mutex and therefore never get woken up to claim it. This boils
      down to the following sequence of events:
      
              Task A        Task B        Task C        Lock value
      0                                                     1
      1       lock()                                        0
      2                     lock()                          0
      3                     spin(A)                         0
      4       unlock()                                      1
      5                                   lock()            0
      6                     cmpxchg(1,0)                    0
      7                     contended()                    -1
      8       lock()                                        0
      9       spin(C)                                       0
      10                                  unlock()          1
      11      cmpxchg(1,0)                                  0
      12      unlock()                                      1
      
      At this point, the lock is unlocked, but Task B is in an uninterruptible
      sleep with nobody to wake it up.
      
      This patch fixes the problem by ensuring we put the lock into the
      contended state if we fail to acquire it on the fastpath, ensuring that
      any blocked waiters are woken up when the mutex is released.
      Signed-off-by: default avatarWill Deacon <will.deacon@arm.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Chris Mason <chris.mason@fusionio.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Reviewed-by: default avatarNicolas Pitre <nico@linaro.org>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/n/tip-6e9lrw2avczr0617fzl5vqb8@git.kernel.orgSigned-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d0179ca8
    • Sarah Sharp's avatar
      xhci: Fix bug after deq ptr set to link TRB. · e3439be1
      Sarah Sharp authored
      commit 50d0206f upstream.
      
      This patch fixes a particularly nasty bug that was revealed by the ring
      expansion patches.  The bug has been present since the very beginning of
      the xHCI driver history, and could have caused general protection faults
      from bad memory accesses.
      
      The first thing to note is that a Set TR Dequeue Pointer command can
      move the dequeue pointer to a link TRB, if the canceled or stalled
      transfer TD ended just before a link TRB.  The function to increment the
      dequeue pointer, inc_deq, was written before cancellation and stall
      support was added.  It assumed that the dequeue pointer could never
      point to a link TRB.  It would unconditionally increment the dequeue
      pointer at the start of the function, check if the pointer was now on a
      link TRB, and move it to the top of the next segment if so.
      
      This means that if a Set TR Dequeue Point command moved the dequeue
      pointer to a link TRB, a subsequent call to inc_deq() would move the
      pointer off the segment and into la-la-land.  It would then read from
      that memory to determine if it was a link TRB.  Other functions would
      often call inc_deq() until the dequeue pointer matched some other
      pointer, which means this function would quite happily read all of
      system memory before wrapping around to the right pointer value.
      
      Often, there would be another endpoint segment from a different ring
      allocated from the same DMA pool, which would be contiguous to the
      segment inc_deq just stepped off of.  inc_deq would eventually find the
      link TRB in that segment, and blindly move the dequeue pointer back to
      the top of the correct ring segment.
      
      The only reason the original code worked at all is because there was
      only one ring segment.  With the ring expansion patches, the dequeue
      pointer would eventually wrap into place, but the dequeue segment would
      be out-of-sync.  On the second TD after the dequeue pointer was moved to
      a link TRB, trb_in_td() would fail (because the dequeue pointer and
      dequeue segment were out-of-sync), and this message would appear:
      
      ERROR Transfer event TRB DMA ptr not part of current TD
      
      This fixes bugzilla entry 4333 (option-based modem unhappy on USB 3.0
      port: "Transfer event TRB DMA ptr not part of current TD", "rejecting
      I/O to offline device"),
      
      	https://bugzilla.kernel.org/show_bug.cgi?id=43333
      
      and possibly other general protection fault bugs as well.
      
      This patch should be backported to kernels as old as 2.6.31.  A separate
      patch will be created for kernels older than 3.4, since inc_deq was
      modified in 3.4 and this patch will not apply.
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Tested-by: default avatarJames Ettle <theholyettlz@googlemail.com>
      Tested-by: default avatarMatthew Hall <mhall@mhcomputing.net>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e3439be1
    • Moiz Sonasath's avatar
      usb: host: xhci: fix compilation error for non-PCI based stacks · d8ec66c5
      Moiz Sonasath authored
      commit 29636578 upstream.
      
      For non PCI-based stacks, this function call
      usb_disable_xhci_ports(to_pci_dev(hcd->self.controller));
      made from xhci_shutdown is not applicable.
      
      Ideally, we wouldn't have any PCI-specific code on
      a generic driver such as the xHCI stack, but it looks
      like we should just stub usb_disable_xhci_ports() out
      for non-PCI devices.
      
      [ balbi@ti.com: slight improvement to commit log ]
      
      This patch should be backported to kernels as old as 3.0, since the
      commit it fixes (e95829f4 "xhci: Switch
      PPT ports to EHCI on shutdown.") was marked for stable.
      
      Signed-off-by: Moiz Sonasath<m-sonasath@ti.com>
      Signed-off-by: default avatarRuchika Kharwar <ruchika@ti.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d8ec66c5
    • Manoj Iyer's avatar
      xhci: Recognize USB 3.0 devices as superspeed at powerup · b1e81baa
      Manoj Iyer authored
      commit 29d21457 upstream.
      
      On Intel Panther Point chipset USB 3.0 devices show up as
      high-speed devices on powerup, but after an s3 cycle they are
      correctly recognized as SuperSpeed. At powerup switch the port
      to xHCI so that USB 3.0 devices are correctly recognized.
      
      BugLink: http://bugs.launchpad.net/bugs/1000424
      
      This patch should be backported to kernels as old as 3.0, that contain
      commit ID 69e848c2 "Intel xhci: Support
      EHCI/xHCI port switching."
      Signed-off-by: default avatarManoj Iyer <manoj.iyer@canonical.com>
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b1e81baa
    • Matthew Garrett's avatar
      xhci: Make handover code more robust · f78e6ad4
      Matthew Garrett authored
      commit e955a1cd upstream.
      
      My test platform (Intel DX79SI) boots reliably under BIOS, but frequently
      crashes when booting via UEFI. I finally tracked this down to the xhci
      handoff code. It seems that reads from the device occasionally just return
      0xff, resulting in xhci_find_next_cap_offset generating a value that's
      larger than the resource region. We then oops when attempting to read the
      value. Sanity checking that value lets us avoid the crash.
      
      I've no idea what's causing the underlying problem, and xhci still doesn't
      actually *work* even with this, but the machine at least boots which will
      probably make further debugging easier.
      
      This should be backported to kernels as old as 2.6.31, that contain the
      commit 66d4eadd "USB: xhci: BIOS handoff
      and HW initialization."
      Signed-off-by: default avatarMatthew Garrett <mjg@redhat.com>
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      f78e6ad4
    • Dan Carpenter's avatar
      xhci: Fix a logical vs bitwise AND bug · c0a168c0
      Dan Carpenter authored
      commit 052c7f9f upstream.
      
      The intent was to test whether the flag was set.
      
      This patch should be backported to stable kernels as old as 3.0, since
      it fixes a bug in commit e95829f4 "xhci:
      Switch PPT ports to EHCI on shutdown.", which was marked for stable.
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      c0a168c0
    • Keng-Yu Lin's avatar
      Intel xhci: Only switch the switchable ports · 4a4c06b8
      Keng-Yu Lin authored
      commit a96874a2 upstream.
      
      With a previous patch to enable the EHCI/XHCI port switching, it switches
      all the available ports.
      
      The assumption is not correct because the BIOS may expect some ports
      not switchable by the OS.
      
      There are two more registers that contains the information of the switchable
      and non-switchable ports.
      
      This patch adds the checking code for the two register so that only the
      switchable ports are altered.
      
      This patch should be backported to kernels as old as 3.0, that contain
      commit ID 69e848c2 "Intel xhci: Support
      EHCI/xHCI port switching."
      Signed-off-by: default avatarKeng-Yu Lin <kengyu@canonical.com>
      Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4a4c06b8
    • Alan Stern's avatar
      USB: add device quirk for Joss Optical touchboard · d515ad3c
      Alan Stern authored
      commit 92fc7a8b upstream.
      
      This patch (as1604) adds a CONFIG_INTF_STRINGS quirk for the Joss
      infrared touchboard device.  The device doesn't like to be asked for
      its interface strings.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Reported-by: default avataradam ? <adam3337@wp.pl>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d515ad3c
    • Éric Piel's avatar
      USB: ftdi-sio: add support for more Physik Instrumente devices · 15e87566
      Éric Piel authored
      commit dafc4f7b upstream.
      
      Commit b69cc672 added support for the E-861.  After acquiring a C-867, I
      realised that every Physik Instrumente's device has a different PID. They are
      listed in the Windows device driver's .inf file. So here are all PIDs for the
      current (and probably future) USB devices from Physik Instrumente.
      
      Compiled, but only actually tested on the E-861 and C-867.
      Signed-off-by: default avatarÉric Piel <piel@delmic.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      15e87566
    • Bjørn Mork's avatar
      USB: ftdi_sio: do not claim CDC ACM function · 0c361a31
      Bjørn Mork authored
      commit f08dea73 upstream.
      
      The Microchip vid:pid 04d8:000a is used for their CDC ACM
      demo firmware application.  This is a device with a single
      function conforming to the CDC ACM specification and with
      the intention of demonstrating CDC ACM class firmware and
      driver interaction.  The demo is used on a number of
      development boards, and may also be used unmodified by
      vendors using Microchip hardware.
      
      Some vendors have re-used this vid:pid for other types of
      firmware, emulating FTDI chips. Attempting to continue to
      support such devices without breaking class based
      applications that by matching on interface
      class/subclass/proto being ff/ff/00.  I have no information
      about the actual device or interface descriptors, but this
      will at least make the proper CDC ACM devices work again.
      Anyone having details of the offending device's descriptors
      should update this entry with the details.
      Reported-by: default avatarFlorian Wöhrl <fw@woehrl.biz>
      Reported-by: default avatarXiaofan Chen <xiaofanc@gmail.com>
      Cc: Alan Cox <alan@linux.intel.com>
      Cc: Bruno Thomsen <bruno.thomsen@gmail.com>
      Signed-off-by: default avatarBjørn Mork <bjorn@mork.no>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0c361a31
    • Horst Schirmeier's avatar
      USB: ftdi_sio: PID for NZR SEM 16+ USB · a16bd7c7
      Horst Schirmeier authored
      commit 26a538b9 upstream.
      
      This adds the USB PID for the NZR SEM 16+ USB energy monitor device
      <http://www.nzr.de>.  It works perfectly with the GPL software on
      <http://schou.dk/linux/sparometer/>.
      Signed-off-by: default avatarHorst Schirmeier <horst@schirmeier.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      a16bd7c7
    • Pavankumar Kondeti's avatar
      EHCI: Update qTD next pointer in QH overlay region during unlink · ebf16a5b
      Pavankumar Kondeti authored
      commit 3d037774 upstream.
      
      There is a possibility of QH overlay region having reference to a stale
      qTD pointer during unlink.
      
      Consider an endpoint having two pending qTD before unlink process begins.
      The endpoint's QH queue looks like this.
      
      qTD1 --> qTD2 --> Dummy
      
      To unlink qTD2, QH is removed from asynchronous list and Asynchronous
      Advance Doorbell is programmed.  The qTD1's next qTD pointer is set to
      qTD2'2 next qTD pointer and qTD2 is retired upon controller's doorbell
      interrupt.  If QH's current qTD pointer points to qTD1, transfer overlay
      region still have reference to qTD2. But qtD2 is just unlinked and freed.
      This may cause EHCI system error.  Fix this by updating qTD next pointer
      in QH overlay region with the qTD next pointer of the current qTD.
      Signed-off-by: default avatarPavankumar Kondeti <pkondeti@codeaurora.org>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ebf16a5b
    • Weston Andros Adamson's avatar
      NFS: return error from decode_getfh in decode open · 863f36bf
      Weston Andros Adamson authored
      commit 01913b49 upstream.
      
      If decode_getfh failed, nfs4_xdr_dec_open would return 0 since the last
      decode_* call must have succeeded.
      Signed-off-by: default avatarWeston Andros Adamson <dros@netapp.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      863f36bf
    • Trond Myklebust's avatar
      NFS: Fix a problem with the legacy binary mount code · d351ebe9
      Trond Myklebust authored
      commit 872ece86 upstream.
      
      Apparently, am-utils is still using the legacy binary mountdata interface,
      and is having trouble parsing /proc/mounts due to the 'port=' field being
      incorrectly set.
      
      The following patch should fix up the regression.
      Reported-by: default avatarMarius Tolzmann <tolzmann@molgen.mpg.de>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d351ebe9
    • Trond Myklebust's avatar
      NFS: Fix the initialisation of the readdir 'cookieverf' array · 839e17b7
      Trond Myklebust authored
      commit c3f52af3 upstream.
      
      When the NFS_COOKIEVERF helper macro was converted into a static
      inline function in commit 99fadcd7 (nfs: convert NFS_*(inode)
      helpers to static inline), we broke the initialisation of the
      readdir cookies, since that depended on doing a memset with an
      argument of 'sizeof(NFS_COOKIEVERF(inode))' which therefore
      changed from sizeof(be32 cookieverf[2]) to sizeof(be32 *).
      
      At this point, NFS_COOKIEVERF seems to be more of an obfuscation
      than a helper, so the best thing would be to just get rid of it.
      
      Also see: https://bugzilla.kernel.org/show_bug.cgi?id=46881Reported-by: default avatarAndi Kleen <andi@firstfloor.org>
      Reported-by: default avatarDavid Binderman <dcb314@hotmail.com>
      Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      839e17b7
    • Gertjan van Wingerde's avatar
      rt2x00: Fix rfkill polling prior to interface start. · b4395a14
      Gertjan van Wingerde authored
      commit a396e100 upstream.
      
      We need to program the rfkill switch GPIO pin direction to input at
      device initialization time, not only when the interface is brought up.
      Doing this only when the interface is brought up could lead to rfkill
      detecting the switch is turned on erroneously and inability to create
      the interface and bringing it up.
      Reported-and-tested-by: default avatarAndreas Messer <andi@bastelmap.de>
      Signed-off-by: default avatarGertjan van Wingerde <gwingerde@gmail.com>
      Acked-by: default avatarIvo Van Doorn <ivdoorn@gmail.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b4395a14
    • Gertjan van Wingerde's avatar
      rt2x00: Fix word size of rt2500usb MAC_CSR19 register. · d89abc3c
      Gertjan van Wingerde authored
      commit 6ced58a5 upstream.
      
      The register is 16 bits wide, not 32.
      Signed-off-by: default avatarGertjan van Wingerde <gwingerde@gmail.com>
      Acked-by: default avatarIvo Van Doorn <ivdoorn@gmail.com>
      Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d89abc3c
    • Nicolas Ferre's avatar
      dmaengine: at_hdmac: check that each sg data length is non-null · e24fd513
      Nicolas Ferre authored
      commit c4567976 upstream.
      
      Avoid the construction of a malformed DMA request sent to
      the DMA controller.
      Log message is for debug only because this condition is unlikely to
      append and may only trigger at driver development time.
      Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: default avatarVinod Koul <vinod.koul@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      e24fd513
    • Nicolas Ferre's avatar
      dmaengine: at_hdmac: fix comment in atc_prep_slave_sg() · 5b77c2c7
      Nicolas Ferre authored
      commit c618a9be upstream.
      
      s/dma_memcpy/slave_sg/ and it is sg length that we are
      talking about.
      Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
      Signed-off-by: default avatarVinod Koul <vinod.koul@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      5b77c2c7
    • Luis R. Rodriguez's avatar
      cfg80211: fix possible circular lock on reg_regdb_search() · 2cfb6b1d
      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 avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2cfb6b1d
    • Ira W. Snyder's avatar
      can: janz-ican3: fix support for older hardware revisions · cf90cf86
      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 avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      cf90cf86
    • Marc Kleine-Budde's avatar
      can: ti_hecc: fix oops during rmmod · 2704f7f5
      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)
      Tested-by: default avatarJan Luebbe <jlu@pengutronix.de>
      Cc: Anant Gole <anantgole@ti.com>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      2704f7f5