1. 19 Feb, 2015 40 commits
    • Brian King's avatar
      ipr: wait for aborted command responses · 1c2687ac
      Brian King authored
      commit 6cdb0817 upstream.
      
      Fixes a race condition in abort handling that was injected
      when multiple interrupt support was added. When only a single
      interrupt is present, the adapter guarantees it will send
      responses for aborted commands prior to the response for the
      abort command itself. With multiple interrupts, these responses
      generally come back on different interrupts, so we need to
      ensure the abort thread waits until the aborted command is
      complete so we don't perform a double completion. This race
      condition was being hit frequently in environments which
      were triggering command timeouts, which was resulting in
      a double completion causing a kernel oops.
      Signed-off-by: default avatarBrian King <brking@linux.vnet.ibm.com>
      Reviewed-by: default avatarWendy Xiong <wenxiong@linux.vnet.ibm.com>
      Tested-by: default avatarWendy Xiong <wenxiong@linux.vnet.ibm.com>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      1c2687ac
    • Al Viro's avatar
      fix deadlock in cifs_ioctl_clone() · 6cdb2760
      Al Viro authored
      commit 378ff1a5 upstream.
      
      It really needs to check that src is non-directory *and* use
      {un,}lock_two_nodirectories().  As it is, it's trivial to cause
      double-lock (ioctl(fd, CIFS_IOC_COPYCHUNK_FILE, fd)) and if the
      last argument is an fd of directory, we are asking for trouble
      by violating the locking order - all directories go before all
      non-directories.  If the last argument is an fd of parent
      directory, it has 50% odds of locking child before parent,
      which will cause AB-BA deadlock if we race with unlink().
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      6cdb2760
    • Jason Lee Cragg's avatar
      14b7dbdb
    • Hans Holmberg's avatar
      gpiolib: of: Correct error handling in of_get_named_gpiod_flags · bd3e9770
      Hans Holmberg authored
      commit 7b8792bb upstream.
      
      of_get_named_gpiod_flags fails with -EPROBE_DEFER in cases
      where the gpio chip is available and the GPIO translation fails.
      
      This causes drivers to be re-probed erroneusly, and hides the
      real problem(i.e. the GPIO number being out of range).
      Signed-off-by: default avatarHans Holmberg <hans.holmberg@intel.com>
      Reviewed-by: default avatarAlexandre Courbot <acourbot@nvidia.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      bd3e9770
    • Johan Hovold's avatar
      gpio: sysfs: fix gpio device-attribute leak · 16bcbc28
      Johan Hovold authored
      commit 0915e6fe upstream.
      
      The gpio device attributes were never destroyed when the gpio was
      unexported (or on export failures).
      
      Use device_create_with_groups() to create the default device attributes
      of the gpio class device. Note that this also fixes the
      attribute-creation race with userspace for these attributes.
      
      Remove contingent attributes in export error path and on unexport.
      
      Fixes: d8f388d8 ("gpio: sysfs interface")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      [ luis: backported to 3.16:
        - file rename: drivers/gpio/gpiolib-sysfs.c -> drivers/gpio/gpiolib.c ]
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      16bcbc28
    • Johan Hovold's avatar
      gpio: sysfs: fix gpio-chip device-attribute leak · 1cd1d2c0
      Johan Hovold authored
      commit 121b6a79 upstream.
      
      The gpio-chip device attributes were never destroyed when the device was
      removed.
      
      Fix by using device_create_with_groups() to create the device attributes
      of the chip class device.
      
      Note that this also fixes the attribute-creation race with userspace.
      
      Fixes: d8f388d8 ("gpio: sysfs interface")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      [ luis: backported to 3.16:
        - file rename: drivers/gpio/gpiolib-sysfs.c -> drivers/gpio/gpiolib.c ]
      Signed-off-by: default avatarLuis Henriques <luis.henriques@canonical.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      1cd1d2c0
    • Ahmed S. Darwish's avatar
      can: kvaser_usb: Don't send a RESET_CHIP for non-existing channels · f4b04bd8
      Ahmed S. Darwish authored
      commit 5e7e6e0c upstream.
      
      Recent Leaf firmware versions (>= 3.1.557) do not allow to send
      commands for non-existing channels.  If a command is sent for a
      non-existing channel, the firmware crashes.
      Reported-by: default avatarChristopher Storah <Christopher.Storah@invetech.com.au>
      Signed-off-by: default avatarOlivier Sobrie <olivier@sobrie.be>
      Signed-off-by: default avatarAhmed S. Darwish <ahmed.darwish@valeo.com>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      f4b04bd8
    • Ahmed S. Darwish's avatar
      can: kvaser_usb: Reset all URB tx contexts upon channel close · c99247dd
      Ahmed S. Darwish authored
      commit 889b77f7 upstream.
      
      Flooding the Kvaser CAN to USB dongle with multiple reads and
      writes in very high frequency (*), closing the CAN channel while
      all the transmissions are on (#), opening the device again (@),
      then sending a small number of packets would make the driver
      enter an almost infinite loop of:
      
      [....]
      [15959.853988] kvaser_usb 4-3:1.0 can0: cannot find free context
      [15959.853990] kvaser_usb 4-3:1.0 can0: cannot find free context
      [15959.853991] kvaser_usb 4-3:1.0 can0: cannot find free context
      [15959.853993] kvaser_usb 4-3:1.0 can0: cannot find free context
      [15959.853994] kvaser_usb 4-3:1.0 can0: cannot find free context
      [15959.853995] kvaser_usb 4-3:1.0 can0: cannot find free context
      [....]
      
      _dragging the whole system down_ in the process due to the
      excessive logging output.
      
      Initially, this has caused random panics in the kernel due to a
      buggy error recovery path.  That got fixed in an earlier commit.(%)
      This patch aims at solving the root cause. -->
      
      16 tx URBs and contexts are allocated per CAN channel per USB
      device. Such URBs are protected by:
      
      a) A simple atomic counter, up to a value of MAX_TX_URBS (16)
      b) A flag in each URB context, stating if it's free
      c) The fact that ndo_start_xmit calls are themselves protected
         by the networking layers higher above
      
      After grabbing one of the tx URBs, if the driver noticed that all
      of them are now taken, it stops the netif transmission queue.
      Such queue is worken up again only if an acknowedgment was received
      from the firmware on one of our earlier-sent frames.
      
      Meanwhile, upon channel close (#), the driver sends a CMD_STOP_CHIP
      to the firmware, effectively closing all further communication.  In
      the high traffic case, the atomic counter remains at MAX_TX_URBS,
      and all the URB contexts remain marked as active.  While opening
      the channel again (@), it cannot send any further frames since no
      more free tx URB contexts are available.
      
      Reset all tx URB contexts upon CAN channel close.
      
      (*) 50 parallel instances of `cangen0 -g 0 -ix`
      (#) `ifconfig can0 down`
      (@) `ifconfig can0 up`
      (%) "can: kvaser_usb: Don't free packets when tight on URBs"
      Signed-off-by: default avatarAhmed S. Darwish <ahmed.darwish@valeo.com>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      c99247dd
    • Ahmed S. Darwish's avatar
      can: kvaser_usb: Don't free packets when tight on URBs · a0624173
      Ahmed S. Darwish authored
      commit b442723f upstream.
      
      Flooding the Kvaser CAN to USB dongle with multiple reads and
      writes in high frequency caused seemingly-random panics in the
      kernel.
      
      On further inspection, it seems the driver erroneously freed the
      to-be-transmitted packet upon getting tight on URBs and returning
      NETDEV_TX_BUSY, leading to invalid memory writes and double frees
      at a later point in time.
      
      Note:
      
      Finding no more URBs/transmit-contexts and returning NETDEV_TX_BUSY
      is a driver bug in and out of itself: it means that our start/stop
      queue flow control is broken.
      
      This patch only fixes the (buggy) error handling code; the root
      cause shall be fixed in a later commit.
      Acked-by: default avatarOlivier Sobrie <olivier@sobrie.be>
      Signed-off-by: default avatarAhmed S. Darwish <ahmed.darwish@valeo.com>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      a0624173
    • Oliver Hartkopp's avatar
      can: dev: fix crtlmode_supported check · 4c1df703
      Oliver Hartkopp authored
      commit 9b1087aa upstream.
      
      When changing flags in the CAN drivers ctrlmode the provided new content has to
      be checked whether the bits are allowed to be changed. The bits that are to be
      changed are given as a bitfield in cm->mask. Therefore checking against
      cm->flags is wrong as the content can hold any kind of values.
      
      The iproute2 tool sets the bits in cm->mask and cm->flags depending on the
      detected command line options. To be robust against bogus user space
      applications additionally sanitize the provided flags with the provided mask.
      
      Cc: Wolfgang Grandegger <wg@grandegger.com>
      Signed-off-by: default avatarOliver Hartkopp <socketcan@hartkopp.net>
      Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      4c1df703
    • Johan Hovold's avatar
      gpio: fix sleep-while-atomic in gpiochip_remove · c28e1cd7
      Johan Hovold authored
      commit 6798acaa upstream.
      
      Move direct and indirect calls to gpiochip_remove_pin_ranges outside of
      spin lock as they can end up taking a mutex in pinctrl_remove_gpio_range.
      
      Note that the pin ranges are already added outside of the lock.
      
      Fixes: 9ef0d6f7 ("gpiolib: call pin removal in chip removal function")
      Fixes: f23f1516 ("gpiolib: provide provision to register pin ranges")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      c28e1cd7
    • Johan Hovold's avatar
      gpio: fix memory and reference leaks in gpiochip_add error path · db679c11
      Johan Hovold authored
      commit 5539b3c9 upstream.
      
      Memory allocated and references taken by of_gpiochip_add and
      acpi_gpiochip_add were never released on errors in gpiochip_add (e.g.
      failure to find free gpio range).
      
      Fixes: 391c970c ("of/gpio: add default of_xlate function if device
      has a node pointer")
      Fixes: 664e3e5a ("gpio / ACPI: register to ACPI events
      automatically")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      db679c11
    • Mika Westerberg's avatar
      gpio / ACPI: register to ACPI events automatically · 09188ff9
      Mika Westerberg authored
      commit 664e3e5a upstream.
      
      Instead of asking each driver to register to ACPI events we can just call
      acpi_gpiochip_register_interrupts() for each chip that has an ACPI handle.
      The function checks chip->to_irq and if it is set to NULL (a GPIO driver
      that doesn't do interrupts) the function does nothing.
      
      We also add the a new header drivers/gpio/gpiolib.h that is used for
      functions internal to gpiolib and add ACPI GPIO chip registering functions
      to that header.
      
      Once that is done we can remove call to acpi_gpiochip_register_interrupts()
      from its only user, pinctrl-baytrail.c
      Signed-off-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
      Acked-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      09188ff9
    • Jim Lin's avatar
      pinctrl: Fix two deadlocks · 65762807
      Jim Lin authored
      commit db93facf upstream.
      
      This patch is to fix two deadlock cases.
      Deadlock 1:
      CPU #1
       pinctrl_register-> pinctrl_get ->
       create_pinctrl
       (Holding lock pinctrl_maps_mutex)
       -> get_pinctrl_dev_from_devname
       (Trying to acquire lock pinctrldev_list_mutex)
      CPU #0
       pinctrl_unregister
       (Holding lock pinctrldev_list_mutex)
       -> pinctrl_put ->> pinctrl_free ->
       pinctrl_dt_free_maps -> pinctrl_unregister_map
       (Trying to acquire lock pinctrl_maps_mutex)
      
      Simply to say
      CPU#1 is holding lock A and trying to acquire lock B,
      CPU#0 is holding lock B and trying to acquire lock A.
      
      Deadlock 2:
      CPU #3
       pinctrl_register-> pinctrl_get ->
       create_pinctrl
       (Holding lock pinctrl_maps_mutex)
       -> get_pinctrl_dev_from_devname
       (Trying to acquire lock pinctrldev_list_mutex)
      CPU #2
       pinctrl_unregister
       (Holding lock pctldev->mutex)
       -> pinctrl_put ->> pinctrl_free ->
       pinctrl_dt_free_maps -> pinctrl_unregister_map
       (Trying to acquire lock pinctrl_maps_mutex)
      CPU #0
       tegra_gpio_request
       (Holding lock pinctrldev_list_mutex)
       -> pinctrl_get_device_gpio_range
       (Trying to acquire lock pctldev->mutex)
      
      Simply to say
      CPU#3 is holding lock A and trying to acquire lock D,
      CPU#2 is holding lock B and trying to acquire lock A,
      CPU#0 is holding lock D and trying to acquire lock B.
      Signed-off-by: default avatarJim Lin <jilin@nvidia.com>
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      65762807
    • Alex Deucher's avatar
      drm/radeon: add si dpm quirk list · 69c2a2b1
      Alex Deucher authored
      commit 5615f890 upstream.
      
      This adds a quirks list to fix stability problems with
      certain SI boards.
      
      bug:
      https://bugs.freedesktop.org/show_bug.cgi?id=76490Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      69c2a2b1
    • Chris Wilson's avatar
      drm/i915: Fix mutex->owner inspection race under DEBUG_MUTEXES · fd49a169
      Chris Wilson authored
      commit 226e5ae9 upstream.
      
      If CONFIG_DEBUG_MUTEXES is set, the mutex->owner field is only cleared
      if the mutex debugging is enabled which introduces a race in our
      mutex_is_locked_by() - i.e. we may inspect the old owner value before it
      is acquired by the new task.
      
      This is the root cause of this error:
      
       diff --git a/kernel/locking/mutex-debug.c b/kernel/locking/mutex-debug.c
       index 5cf6731..3ef3736 100644
       --- a/kernel/locking/mutex-debug.c
       +++ b/kernel/locking/mutex-debug.c
       @@ -80,13 +80,13 @@ void debug_mutex_unlock(struct mutex *lock)
       			DEBUG_LOCKS_WARN_ON(lock->owner != current);
      
       		DEBUG_LOCKS_WARN_ON(!lock->wait_list.prev && !lock->wait_list.next);
       -		mutex_clear_owner(lock);
       	}
      
       	/*
       	 * __mutex_slowpath_needs_to_unlock() is explicitly 0 for debug
       	 * mutexes so that we can do it here after we've verified state.
       	 */
       +	mutex_clear_owner(lock);
       	atomic_set(&lock->count, 1);
        }
      
      Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=87955Signed-off-by: default avatarChris Wilson <chris@chris-wilson.co.uk>
      Reviewed-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
      Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      fd49a169
    • Dmitry Torokhov's avatar
      Input: I8042 - add Acer Aspire 7738 to the nomux list · a6814d10
      Dmitry Torokhov authored
      commit 9333caea upstream.
      
      When KBC is in active multiplexing mode the touchpad on this laptop does
      not work.
      Reported-by: default avatarBilal Koc <koc.bilo@googlemail.com>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      a6814d10
    • Sam hung's avatar
      Input: elantech - support new ICs types for version 4 · 197dc62f
      Sam hung authored
      commit 810aa091 upstream.
      
      This change allows the driver to recognize newer Elantech touchpads.
      Signed-off-by: default avatarYi ju Hong <sam.hung@emc.com.tw>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      [ kamal: backport to 3.13-stable: picked up case 9 also ]
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      197dc62f
    • Alex Deucher's avatar
      drm/radeon: add a dpm quirk list · d5238979
      Alex Deucher authored
      commit 4369a69e upstream.
      
      Disable dpm on certain problematic boards rather than
      disabling dpm for the entire chip family since most
      boards work fine.
      
      https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1386534
      https://bugzilla.kernel.org/show_bug.cgi?id=83731Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      d5238979
    • Alex Deucher's avatar
      drm/radeon: fix VM flush on CIK (v3) · dffabb48
      Alex Deucher authored
      commit 3a01fd36 upstream.
      
      We need to wait for the GPUVM flush to complete.  There
      was some confusion as to how this mechanism was supposed
      to work.  The operation is not atomic.  For GPU initiated
      invalidations you need to read back a VM register to
      introduce enough latency for the update to complete.
      
      v2: drop gart changes
      v3: just read back rather than polling
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      dffabb48
    • Alex Deucher's avatar
      drm/radeon: fix VM flush on SI (v3) · c33e9d16
      Alex Deucher authored
      commit d474ea7e upstream.
      
      We need to wait for the GPUVM flush to complete.  There
      was some confusion as to how this mechanism was supposed
      to work.  The operation is not atomic.  For GPU initiated
      invalidations you need to read back a VM register to
      introduce enough latency for the update to complete.
      
      v2: drop gart changes
      v3: just read back rather than polling
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      [ kamal: backport to 3.13-stable: vm->id ]
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      c33e9d16
    • Alex Deucher's avatar
      drm/radeon: fix VM flush on cayman/aruba (v3) · 28f57662
      Alex Deucher authored
      commit cbfc35b9 upstream.
      
      We need to wait for the GPUVM flush to complete.  There
      was some confusion as to how this mechanism was supposed
      to work.  The operation is not atomic.  For GPU initiated
      invalidations you need to read back a VM register to
      introduce enough latency for the update to complete.
      
      v2: drop gart changes
      v3: just read back rather than polling
      Reviewed-by: default avatarChristian König <christian.koenig@amd.com>
      Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      28f57662
    • Srihari Vijayaraghavan's avatar
      Input: i8042 - reset keyboard to fix Elantech touchpad detection · 873875c2
      Srihari Vijayaraghavan authored
      commit 148e9a71 upstream.
      
      On some laptops, keyboard needs to be reset in order to successfully detect
      touchpad (e.g., some Gigabyte laptop models with Elantech touchpads).
      Without resettin keyboard touchpad pretends to be completely dead.
      
      Based on the original patch by Mateusz Jończyk this version has been
      expanded to include DMI based detection & application of the fix
      automatically on the affected models of laptops. This has been confirmed to
      fix problem by three users already on three different models of laptops.
      
      Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=81331Signed-off-by: default avatarSrihari Vijayaraghavan <linux.bug.reporting@gmail.com>
      Acked-by: default avatarMateusz Jończyk <mat.jonczyk@o2.pl>
      Tested-by: default avatarSrihari Vijayaraghavan <linux.bug.reporting@gmail.com>
      Tested by: Zakariya Dehlawi <zdehlawi@gmail.com>
      Tested-by: default avatarGuillaum Bouchard <guillaum.bouchard@gmail.com>
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      873875c2
    • Sasha Levin's avatar
      time: settimeofday: Validate the values of tv from user · 1ae5a092
      Sasha Levin authored
      commit 6ada1fc0 upstream.
      
      An unvalidated user input is multiplied by a constant, which can result in
      an undefined behaviour for large values. While this is validated later,
      we should avoid triggering undefined behaviour.
      
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarSasha Levin <sasha.levin@oracle.com>
      [jstultz: include trivial milisecond->microsecond correction noticed
      by Andy]
      Signed-off-by: default avatarJohn Stultz <john.stultz@linaro.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      1ae5a092
    • Tobias Jakobi's avatar
      clocksource: exynos_mct: Fix bitmask regression for exynos4_mct_write · 872ab1ce
      Tobias Jakobi authored
      commit 8c38d28b upstream.
      
      EXYNOS4_MCT_L_MASK is defined as 0xffffff00, so applying this bitmask
      produces a number outside the range 0x00 to 0xff, which always results
      in execution of the default switch statement.
      
      Obviously this is wrong and git history shows that the bitmask inversion
      was incorrectly set during a refactoring of the MCT code.
      
      Fix this by putting the inversion at the correct position again.
      Acked-by: default avatarKukjin Kim <kgene.kim@samsung.com>
      Reported-by: default avatarGP Orcullo <kinsamanka@gmail.com>
      Reviewed-by: default avatarDoug Anderson <dianders@chromium.org>
      Signed-off-by: default avatarTobias Jakobi <tjakobi@math.uni-bielefeld.de>
      Signed-off-by: default avatarDaniel Lezcano <daniel.lezcano@linaro.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      872ab1ce
    • Steven Rostedt (Red Hat)'s avatar
      ftrace/jprobes/x86: Fix conflict between jprobes and function graph tracing · 386a83dc
      Steven Rostedt (Red Hat) authored
      commit 237d28db upstream.
      
      If the function graph tracer traces a jprobe callback, the system will
      crash. This can easily be demonstrated by compiling the jprobe
      sample module that is in the kernel tree, loading it and running the
      function graph tracer.
      
       # modprobe jprobe_example.ko
       # echo function_graph > /sys/kernel/debug/tracing/current_tracer
       # ls
      
      The first two commands end up in a nice crash after the first fork.
      (do_fork has a jprobe attached to it, so "ls" just triggers that fork)
      
      The problem is caused by the jprobe_return() that all jprobe callbacks
      must end with. The way jprobes works is that the function a jprobe
      is attached to has a breakpoint placed at the start of it (or it uses
      ftrace if fentry is supported). The breakpoint handler (or ftrace callback)
      will copy the stack frame and change the ip address to return to the
      jprobe handler instead of the function. The jprobe handler must end
      with jprobe_return() which swaps the stack and does an int3 (breakpoint).
      This breakpoint handler will then put back the saved stack frame,
      simulate the instruction at the beginning of the function it added
      a breakpoint to, and then continue on.
      
      For function tracing to work, it hijakes the return address from the
      stack frame, and replaces it with a hook function that will trace
      the end of the call. This hook function will restore the return
      address of the function call.
      
      If the function tracer traces the jprobe handler, the hook function
      for that handler will not be called, and its saved return address
      will be used for the next function. This will result in a kernel crash.
      
      To solve this, pause function tracing before the jprobe handler is called
      and unpause it before it returns back to the function it probed.
      
      Some other updates:
      
      Used a variable "saved_sp" to hold kcb->jprobe_saved_sp. This makes the
      code look a bit cleaner and easier to understand (various tries to fix
      this bug required this change).
      
      Note, if fentry is being used, jprobes will change the ip address before
      the function graph tracer runs and it will not be able to trace the
      function that the jprobe is probing.
      
      Link: http://lkml.kernel.org/r/20150114154329.552437962@goodmis.orgAcked-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      386a83dc
    • Amit Virdi's avatar
      usb: dwc3: gadget: Stop TRB preparation after limit is reached · aea7c1c4
      Amit Virdi authored
      commit 39e60635 upstream.
      
      DWC3 gadget sets up a pool of 32 TRBs for each EP during initialization. This
      means, the max TRBs that can be submitted for an EP is fixed to 32. Since the
      request queue for an EP is a linked list, any number of requests can be queued
      to it by the gadget layer.  However, the dwc3 driver must not submit TRBs more
      than the pool it has created for. This limit wasn't respected when SG was used
      resulting in submitting more than the max TRBs, eventually leading to
      non-transfer of the TRBs submitted over the max limit.
      
      Root cause:
      When SG is used, there are two loops iterating to prepare TRBs:
       - Outer loop over the request_list
       - Inner loop over the SG list
      The code was missing break to get out of the outer loop.
      
      Fixes: eeb720fb (usb: dwc3: gadget: add support for SG lists)
      Signed-off-by: default avatarAmit Virdi <amit.virdi@st.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      aea7c1c4
    • Amit Virdi's avatar
      usb: dwc3: gadget: Fix TRB preparation during SG · 2ae25721
      Amit Virdi authored
      commit ec512fb8 upstream.
      
      When scatter gather (SG) is used, multiple TRBs are prepared from one DWC3
      request (dwc3_request). So while preparing TRBs, the 'last' flag should be set
      only when it is the last TRB being prepared from the last dwc3_request entry.
      
      The current implementation uses list_is_last to check if the dwc3_request is the
      last entry from the request_list. However, list_is_last returns false for the
      last entry too. This is because, while preparing the first TRB from a request,
      the function dwc3_prepare_one_trb modifies the request's next and prev pointers
      while moving the URB to req_queued. Hence, list_is_last always returns false no
      matter what.
      
      The correct way is not to access the modified pointers of dwc3_request but to
      use list_empty macro instead.
      
      Fixes: e5ba5ec8 (usb: dwc3: gadget: fix scatter gather implementation)
      Signed-off-by: default avatarAmit Virdi <amit.virdi@st.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      2ae25721
    • Krzysztof Kozlowski's avatar
      mmc: sdhci: Fix sleep in atomic after inserting SD card · 7e57a79c
      Krzysztof Kozlowski authored
      commit 2836766a upstream.
      
      Sleep in atomic context happened on Trats2 board after inserting or
      removing SD card because mmc_gpio_get_cd() was called under spin lock.
      
      Fix this by moving card detection earlier, before acquiring spin lock.
      The mmc_gpio_get_cd() call does not have to be protected by spin lock
      because it does not access any sdhci internal data.
      The sdhci_do_get_cd() call access host flags (SDHCI_DEVICE_DEAD). After
      moving it out side of spin lock it could theoretically race with driver
      removal but still there is no actual protection against manual card
      eject.
      
      Dmesg after inserting SD card:
      [   41.663414] BUG: sleeping function called from invalid context at drivers/gpio/gpiolib.c:1511
      [   41.670469] in_atomic(): 1, irqs_disabled(): 128, pid: 30, name: kworker/u8:1
      [   41.677580] INFO: lockdep is turned off.
      [   41.681486] irq event stamp: 61972
      [   41.684872] hardirqs last  enabled at (61971): [<c0490ee0>] _raw_spin_unlock_irq+0x24/0x5c
      [   41.693118] hardirqs last disabled at (61972): [<c04907ac>] _raw_spin_lock_irq+0x18/0x54
      [   41.701190] softirqs last  enabled at (61648): [<c0026fd4>] __do_softirq+0x234/0x2c8
      [   41.708914] softirqs last disabled at (61631): [<c00273a0>] irq_exit+0xd0/0x114
      [   41.716206] Preemption disabled at:[<  (null)>]   (null)
      [   41.721500]
      [   41.722985] CPU: 3 PID: 30 Comm: kworker/u8:1 Tainted: G        W      3.18.0-rc5-next-20141121 #883
      [   41.732111] Workqueue: kmmcd mmc_rescan
      [   41.735945] [<c0014d2c>] (unwind_backtrace) from [<c0011c80>] (show_stack+0x10/0x14)
      [   41.743661] [<c0011c80>] (show_stack) from [<c0489d14>] (dump_stack+0x70/0xbc)
      [   41.750867] [<c0489d14>] (dump_stack) from [<c0228b74>] (gpiod_get_raw_value_cansleep+0x18/0x30)
      [   41.759628] [<c0228b74>] (gpiod_get_raw_value_cansleep) from [<c03646e8>] (mmc_gpio_get_cd+0x38/0x58)
      [   41.768821] [<c03646e8>] (mmc_gpio_get_cd) from [<c036d378>] (sdhci_request+0x50/0x1a4)
      [   41.776808] [<c036d378>] (sdhci_request) from [<c0357934>] (mmc_start_request+0x138/0x268)
      [   41.785051] [<c0357934>] (mmc_start_request) from [<c0357cc8>] (mmc_wait_for_req+0x58/0x1a0)
      [   41.793469] [<c0357cc8>] (mmc_wait_for_req) from [<c0357e68>] (mmc_wait_for_cmd+0x58/0x78)
      [   41.801714] [<c0357e68>] (mmc_wait_for_cmd) from [<c0361c00>] (mmc_io_rw_direct_host+0x98/0x124)
      [   41.810480] [<c0361c00>] (mmc_io_rw_direct_host) from [<c03620f8>] (sdio_reset+0x2c/0x64)
      [   41.818641] [<c03620f8>] (sdio_reset) from [<c035a3d8>] (mmc_rescan+0x254/0x2e4)
      [   41.826028] [<c035a3d8>] (mmc_rescan) from [<c003a0e0>] (process_one_work+0x180/0x3f4)
      [   41.833920] [<c003a0e0>] (process_one_work) from [<c003a3bc>] (worker_thread+0x34/0x4b0)
      [   41.841991] [<c003a3bc>] (worker_thread) from [<c003fed8>] (kthread+0xe4/0x104)
      [   41.849285] [<c003fed8>] (kthread) from [<c000f268>] (ret_from_fork+0x14/0x2c)
      [   42.038276] mmc0: new high speed SDHC card at address 1234
      Signed-off-by: default avatarKrzysztof Kozlowski <k.kozlowski@samsung.com>
      Fixes: 94144a46 ("mmc: sdhci: add get_cd() implementation")
      Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      7e57a79c
    • Johan Hovold's avatar
      USB: console: fix potential use after free · 78612ff3
      Johan Hovold authored
      commit 32a4bf2e upstream.
      
      Use tty kref to release the fake tty in usb_console_setup to avoid use
      after free if the underlying serial driver has acquired a reference.
      
      Note that using the tty destructor release_one_tty requires some more
      state to be initialised.
      
      Fixes: 4a90f09b ("tty: usb-serial krefs")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      78612ff3
    • Johan Hovold's avatar
      USB: console: fix uninitialised ldisc semaphore · cd471b62
      Johan Hovold authored
      commit d269d443 upstream.
      
      The USB console currently allocates a temporary fake tty which is used
      to pass terminal settings to the underlying serial driver.
      
      The tty struct is not fully initialised, something which can lead to a
      lockdep warning (or worse) if a serial driver tries to acquire a
      line-discipline reference:
      
      	usbserial: USB Serial support registered for pl2303
      	pl2303 1-2.1:1.0: pl2303 converter detected
      	usb 1-2.1: pl2303 converter now attached to ttyUSB0
      	INFO: trying to register non-static key.
      	the code is fine but needs lockdep annotation.
      	turning off the locking correctness validator.
      	CPU: 0 PID: 68 Comm: udevd Tainted: G        W      3.18.0-rc5 #10
      	[<c0016f04>] (unwind_backtrace) from [<c0013978>] (show_stack+0x20/0x24)
      	[<c0013978>] (show_stack) from [<c0449794>] (dump_stack+0x24/0x28)
      	[<c0449794>] (dump_stack) from [<c006f730>] (__lock_acquire+0x1e50/0x2004)
      	[<c006f730>] (__lock_acquire) from [<c0070128>] (lock_acquire+0xe4/0x18c)
      	[<c0070128>] (lock_acquire) from [<c027c6f8>] (ldsem_down_read_trylock+0x78/0x90)
      	[<c027c6f8>] (ldsem_down_read_trylock) from [<c027a1cc>] (tty_ldisc_ref+0x24/0x58)
      	[<c027a1cc>] (tty_ldisc_ref) from [<c0340760>] (usb_serial_handle_dcd_change+0x48/0xe8)
      	[<c0340760>] (usb_serial_handle_dcd_change) from [<bf000484>] (pl2303_read_int_callback+0x210/0x220 [pl2303])
      	[<bf000484>] (pl2303_read_int_callback [pl2303]) from [<c031624c>] (__usb_hcd_giveback_urb+0x80/0x140)
      	[<c031624c>] (__usb_hcd_giveback_urb) from [<c0316fc0>] (usb_giveback_urb_bh+0x98/0xd4)
      	[<c0316fc0>] (usb_giveback_urb_bh) from [<c0042e44>] (tasklet_hi_action+0x9c/0x108)
      	[<c0042e44>] (tasklet_hi_action) from [<c0042380>] (__do_softirq+0x148/0x42c)
      	[<c0042380>] (__do_softirq) from [<c00429cc>] (irq_exit+0xd8/0x114)
      	[<c00429cc>] (irq_exit) from [<c007ae58>] (__handle_domain_irq+0x84/0xdc)
      	[<c007ae58>] (__handle_domain_irq) from [<c000879c>] (omap_intc_handle_irq+0xd8/0xe0)
      	[<c000879c>] (omap_intc_handle_irq) from [<c0014544>] (__irq_svc+0x44/0x7c)
      	Exception stack(0xdf4e7f08 to 0xdf4e7f50)
      	7f00:                   debc0b80 df4e7f5c 00000000 00000000 debc0b80 be8da96c
      	7f20: 00000000 00000128 c000fc84 df4e6000 00000000 df4e7f94 00000004 df4e7f50
      	7f40: c038ebc0 c038d74c 600f0013 ffffffff
      	[<c0014544>] (__irq_svc) from [<c038d74c>] (___sys_sendmsg.part.29+0x0/0x2e0)
      	[<c038d74c>] (___sys_sendmsg.part.29) from [<c038ec08>] (SyS_sendmsg+0x18/0x1c)
      	[<c038ec08>] (SyS_sendmsg) from [<c000fa00>] (ret_fast_syscall+0x0/0x48)
      	console [ttyUSB0] enabled
      
      Fixes: 36697529 ("tty: Replace ldisc locking with ldisc_sem")
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      cd471b62
    • Songjun Wu's avatar
      usb: gadget: udc: atmel: fix possible oops when unloading module · 83014855
      Songjun Wu authored
      commit 5fb694f9 upstream.
      
      When unloading the module 'g_hid.ko', the urb request will be dequeued and the
      completion routine will be excuted. If there is no urb packet, the urb request
      will not be added to the endpoint queue and the completion routine pointer in
      urb request is NULL.
      
      Accessing to this NULL function pointer will cause the Oops issue reported
      below.
      
      Add the code to check if the urb request is in the endpoint queue
      or not. If the urb request is not in the endpoint queue, a negative
      error code will be returned.
      
      Here is the Oops log:
      
      Unable to handle kernel NULL pointer dereference at virtual address 00000000
      pgd = dedf0000
      [00000000] *pgd=3ede5831, *pte=00000000, *ppte=00000000
      Internal error: Oops: 80000007 [#1] ARM
      Modules linked in: g_hid(-) usb_f_hid libcomposite
      CPU: 0 PID: 923 Comm: rmmod Not tainted 3.18.0+ #2
      Hardware name: Atmel SAMA5 (Device Tree)
      task: df6b1100 ti: dedf6000 task.ti: dedf6000
      PC is at 0x0
      LR is at usb_gadget_giveback_request+0xc/0x10
      pc : [<00000000>]    lr : [<c02ace88>]    psr: 60000093
      sp : dedf7eb0  ip : df572634  fp : 00000000
      r10: 00000000  r9 : df52e210  r8 : 60000013
      r7 : df6a9858  r6 : df52e210  r5 : df6a9858  r4 : df572600
      r3 : 00000000  r2 : ffffff98  r1 : df572600  r0 : df6a9868
      Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment user
      Control: 10c53c7d  Table: 3edf0059  DAC: 00000015
      Process rmmod (pid: 923, stack limit = 0xdedf6230)
      Stack: (0xdedf7eb0 to 0xdedf8000)
      7ea0:                                     00000000 c02adbbc df572580 deced608
      7ec0: df572600 df6a9868 df572634 c02aed3c df577c00 c01b8608 00000000 df6be27c
      7ee0: 00200200 00100100 bf0162f4 c000e544 dedf6000 00000000 00000000 bf010c00
      7f00: bf0162cc bf00159c 00000000 df572980 df52e218 00000001 df5729b8 bf0031d0
      [..]
      [<c02ace88>] (usb_gadget_giveback_request) from [<c02adbbc>] (request_complete+0x64/0x88)
      [<c02adbbc>] (request_complete) from [<c02aed3c>] (usba_ep_dequeue+0x70/0x128)
      [<c02aed3c>] (usba_ep_dequeue) from [<bf010c00>] (hidg_unbind+0x50/0x7c [usb_f_hid])
      [<bf010c00>] (hidg_unbind [usb_f_hid]) from [<bf00159c>] (remove_config.isra.6+0x98/0x9c [libcomposite])
      [<bf00159c>] (remove_config.isra.6 [libcomposite]) from [<bf0031d0>] (__composite_unbind+0x34/0x98 [libcomposite])
      [<bf0031d0>] (__composite_unbind [libcomposite]) from [<c02acee0>] (usb_gadget_remove_driver+0x50/0x78)
      [<c02acee0>] (usb_gadget_remove_driver) from [<c02ad570>] (usb_gadget_unregister_driver+0x64/0x94)
      [<c02ad570>] (usb_gadget_unregister_driver) from [<bf0160c0>] (hidg_cleanup+0x10/0x34 [g_hid])
      [<bf0160c0>] (hidg_cleanup [g_hid]) from [<c0056748>] (SyS_delete_module+0x118/0x19c)
      [<c0056748>] (SyS_delete_module) from [<c000e3c0>] (ret_fast_syscall+0x0/0x30)
      Code: bad PC value
      Signed-off-by: default avatarSongjun Wu <songjun.wu@atmel.com>
      [nicolas.ferre@atmel.com: reworked the commit message]
      Signed-off-by: default avatarNicolas Ferre <nicolas.ferre@atmel.com>
      Fixes: 914a3f3b ("USB: add atmel_usba_udc driver")
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      83014855
    • Nicholas Bellinger's avatar
      target: Drop arbitrary maximum I/O size limit · 0703140a
      Nicholas Bellinger authored
      commit 046ba642 upstream.
      
      This patch drops the arbitrary maximum I/O size limit in sbc_parse_cdb(),
      which currently for fabric_max_sectors is hardcoded to 8192 (4 MB for 512
      byte sector devices), and for hw_max_sectors is a backend driver dependent
      value.
      
      This limit is problematic because Linux initiators have only recently
      started to honor block limits MAXIMUM TRANSFER LENGTH, and other non-Linux
      based initiators (eg: MSFT Fibre Channel) can also generate I/Os larger
      than 4 MB in size.
      
      Currently when this happens, the following message will appear on the
      target resulting in I/Os being returned with non recoverable status:
      
        SCSI OP 28h with too big sectors 16384 exceeds fabric_max_sectors: 8192
      
      Instead, drop both [fabric,hw]_max_sector checks in sbc_parse_cdb(),
      and convert the existing hw_max_sectors into a purely informational
      attribute used to represent the granuality that backend driver and/or
      subsystem code is splitting I/Os upon.
      
      Also, update FILEIO with an explicit FD_MAX_BYTES check in fd_execute_rw()
      to deal with the one special iovec limitiation case.
      
      v2 changes:
        - Drop hw_max_sectors check in sbc_parse_cdb()
      Reported-by: default avatarLance Gropper <lance.gropper@qosserver.com>
      Reported-by: default avatarStefan Priebe <s.priebe@profihost.ag>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Roland Dreier <roland@purestorage.com>
      Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
      [ kamal: backport to 3.13-stable: context ]
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      0703140a
    • Alexander Usyskin's avatar
      mei: clean reset bit before reset · 0b4d6316
      Alexander Usyskin authored
      commit b13a65ef upstream.
      
      H_RST bit in H_CSR register may be found lit before reset is started,
      for example if preceding reset flow hasn't completed.
      In that case asserting H_RST will be ignored, therefore we need to clean
      H_RST bit to start a successful reset sequence.
      Signed-off-by: default avatarAlexander Usyskin <alexander.usyskin@intel.com>
      Signed-off-by: default avatarTomas Winkler <tomas.winkler@intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      [ kamal: backport to 3.13-stable: dev member access ]
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      0b4d6316
    • Arseny Solokha's avatar
      OHCI: add a quirk for ULi M5237 blocking on reset · 7b7ec972
      Arseny Solokha authored
      commit 56abcab8 upstream.
      
      Commit 8dccddbc ("OHCI: final fix for NVIDIA problems (I hope)")
      introduced into 3.1.9 broke boot on e.g. Freescale P2020DS development
      board. The code path that was previously specific to NVIDIA controllers
      had then become taken for all chips.
      
      However, the M5237 installed on the board wedges solid when accessing
      its base+OHCI_FMINTERVAL register, making it impossible to boot any
      kernel newer than 3.1.8 on this particular and apparently other similar
      machines.
      
      Don't readl() and writel() base+OHCI_FMINTERVAL on PCI ID 10b9:5237.
      
      The patch is suitable for the -next tree as well as all maintained
      kernels up to 3.2 inclusive.
      Signed-off-by: default avatarArseny Solokha <asolokha@kb.kras.ru>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      7b7ec972
    • Alan Stern's avatar
      USB: EHCI: fix initialization bug in iso_stream_schedule() · 4110c313
      Alan Stern authored
      commit 6d89252a upstream.
      
      Commit c3ee9b76 (EHCI: improved logic for isochronous scheduling)
      introduced the idea of using ehci->last_iso_frame as the origin (or
      base) for the circular calculations involved in modifying the
      isochronous schedule.  However, the new code it added used
      ehci->last_iso_frame before the value was properly initialized.  This
      patch rectifies the mistake by moving the initialization lines earlier
      in iso_stream_schedule().
      
      This fixes Bugzilla #72891.
      Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Fixes: c3ee9b76Reported-by: default avatarJoe Bryant <tenminjoe@yahoo.com>
      Tested-by: default avatarJoe Bryant <tenminjoe@yahoo.com>
      Tested-by: default avatarMartin Long <martin@longhome.co.uk>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      4110c313
    • Reinhard Speyerer's avatar
      USB: qcserial/option: make AT URCs work for Sierra Wireless MC73xx · efed6c9f
      Reinhard Speyerer authored
      commit d80c0d14 upstream.
      
      As has been discussed in the thread starting with
      https://lkml.kernel.org/g/549748e9.d+SiJzqu50f1r4lSAL043YSc@arcor.de
      Sierra Wireless MC73xx devices with USB VID/PID 0x1199:0x68c0 require the
      option_send_setup() code to be used on the USB interface for the AT port
      to make unsolicited response codes work correctly. Move these devices from
      the qcserial driver where they have been added by commit
      70a3615f ("usb: qcserial: add Sierra Wireless
      MC73xx") to the option driver and add a MC73xx-specific blacklist
      to ensure that
      1. the sendsetup code is not used for the DIAG/DM and NMEA interfaces
      2. the option driver does not attach to the QMI/network interfaces
      Signed-off-by: default avatarReinhard Speyerer <rspmn@arcor.de>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      [ kamal: backport to 3.13-stable: context ]
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      efed6c9f
    • David Peterson's avatar
      USB: cp210x: add IDs for CEL USB sticks and MeshWorks devices · 72f27a47
      David Peterson authored
      commit 1ae78a48 upstream.
      
      Added virtual com port VID/PID entries for CEL USB sticks and MeshWorks
      devices.
      Signed-off-by: default avatarDavid Peterson <david.peterson@cel.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      72f27a47
    • Trond Myklebust's avatar
      NFSv4.1: Fix client id trunking on Linux · 1959b1b7
      Trond Myklebust authored
      commit 1fc0703a upstream.
      
      Currently, our trunking code will check for session trunking, but will
      fail to detect client id trunking. This is a problem, because it means
      that the client will fail to recognise that the two connections represent
      shared state, even if they do not permit a shared session.
      By removing the check for the server minor id, and only checking the
      major id, we will end up doing the right thing in both cases: we close
      down the new nfs_client and fall back to using the existing one.
      
      Fixes: 05f4c350 ("NFS: Discover NFSv4 server trunking when mounting")
      Cc: Chuck Lever <chuck.lever@oracle.com>
      Tested-by: default avatarChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      1959b1b7
    • Trond Myklebust's avatar
      LOCKD: Fix a race when initialising nlmsvc_timeout · 1185361f
      Trond Myklebust authored
      commit 06bed7d1 upstream.
      
      This commit fixes a race whereby nlmclnt_init() first starts the lockd
      daemon, and then calls nlm_bind_host() with the expectation that
      nlmsvc_timeout has already been initialised. Unfortunately, there is no
      no synchronisation between lockd() and lockd_up() to guarantee that this
      is the case.
      
      Fix is to move the initialisation of nlmsvc_timeout into lockd_create_svc
      
      Fixes: 9a1b6bf8 ("LOCKD: Don't call utsname()->nodename...")
      Cc: Bruce Fields <bfields@fieldses.org>
      Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
      Signed-off-by: default avatarKamal Mostafa <kamal@canonical.com>
      1185361f