1. 26 May, 2015 8 commits
    • Michael Trimarchi's avatar
      usb: gadget: f_uac1: check return code from config_ep_by_speed · ca4de53c
      Michael Trimarchi authored
      Not checking config_ep_by_speed could lead to a kernel
      NULL pointer dereference error in usb_ep_enable
      
      Cc: Felipe Balbi <balbi@ti.com>
      Signed-off-by: default avatarMichael Trimarchi <michael@amarulasolutions.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      ca4de53c
    • Krzysztof Opasiak's avatar
      usb: gadget: ffs: fix: Always call ffs_closed() in ffs_data_clear() · 49a79d8b
      Krzysztof Opasiak authored
      Originally FFS_FL_CALL_CLOSED_CALLBACK flag has been used to
      indicate if we should call ffs_closed_callback().
      
      Commit 4b187fce ("usb: gadget: FunctionFS: add devices
      management code") changed its semantic to indicate if we should
      call ffs_closed() function which does a little bit more.
      
      This situation leads to:
      
      [  122.362269] ------------[ cut here ]------------
      [  122.362287] WARNING: CPU: 2 PID: 2384 at drivers/usb/gadget/function/f_fs.c:3417 ffs_ep0_write+0x730/0x810 [usb_f_fs]()
      [  122.362292] Modules linked in:
      [  122.362555] CPU: 2 PID: 2384 Comm: adbd Tainted: G        W       4.1.0-0.rc4.git0.1.1.fc22.i686 #1
      [  122.362561] Hardware name: To be filled by O.E.M. To be filled by O.E.M./Aptio CRB, BIOS 5.6.5 07/25/2014
      [  122.362567]  c0d1f947 415badfa 00000000 d1029e64 c0a86e54 00000000 d1029e94 c045b937
      [  122.362584]  c0c37f94 00000002 00000950 f9b313d4 00000d59 f9b2ebf0 f9b2ebf0 fffffff0
      [  122.362600]  00000003 deb53d00 d1029ea4 c045ba42 00000009 00000000 d1029f08 f9b2ebf0
      [  122.362617] Call Trace:
      [  122.362633]  [<c0a86e54>] dump_stack+0x41/0x52
      [  122.362645]  [<c045b937>] warn_slowpath_common+0x87/0xc0
      [  122.362658]  [<f9b2ebf0>] ? ffs_ep0_write+0x730/0x810 [usb_f_fs]
      [  122.362668]  [<f9b2ebf0>] ? ffs_ep0_write+0x730/0x810 [usb_f_fs]
      [  122.362678]  [<c045ba42>] warn_slowpath_null+0x22/0x30
      [  122.362689]  [<f9b2ebf0>] ffs_ep0_write+0x730/0x810 [usb_f_fs]
      [  122.362702]  [<f9b2e4c0>] ? ffs_ep0_read+0x380/0x380 [usb_f_fs]
      [  122.362712]  [<c05a1c1f>] __vfs_write+0x2f/0x100
      [  122.362722]  [<c05a42f2>] ? __sb_start_write+0x52/0x110
      [  122.362731]  [<c05a2534>] vfs_write+0x94/0x1b0
      [  122.362740]  [<c0a8a1c0>] ? mutex_lock+0x10/0x30
      [  122.362749]  [<c05a2f41>] SyS_write+0x51/0xb0
      [  122.362759]  [<c0a8c71f>] sysenter_do_call+0x12/0x12
      [  122.362766] ---[ end trace 0673d3467cecf8db ]---
      
      in some cases (reproduction path below). This commit get back
      semantic of that flag and ensures that ffs_closed() is called
      always when needed but ffs_closed_callback() is called only
      if this flag is set.
      
      Reproduction path:
      Compile kernel without any UDC driver or bound some gadget
      to existing one and then:
      
      $ modprobe g_ffs
      $ mount none -t functionfs mount_point
      $ ffs-example mount_point
      
      This will fail with -ENODEV as there is no udc.
      
      $ ffs-example mount_point
      
      This will fail with -EBUSY because ffs_data has not been
      properly cleaned up.
      Signed-off-by: default avatarKrzysztof Opasiak <k.opasiak@samsung.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      49a79d8b
    • Krzysztof Opasiak's avatar
      usb: gadget: g_ffs: Fix counting of missing_functions · c41b33c5
      Krzysztof Opasiak authored
      Returning non-zero value from ready callback makes ffs instance
      return error from writing strings and enter FFS_CLOSING state.
      This means that this this function is not truly ready and
      close callback will not be called. This commit fix
      ffs_ready_callback() to undo all side effects of this function
      in case of error.
      Signed-off-by: default avatarKrzysztof Opasiak <k.opasiak@samsung.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      c41b33c5
    • Sergiy Kibrik's avatar
      usb: s3c2410_udc: correct reversed pullup logic · 10f09580
      Sergiy Kibrik authored
      For some reason the code has always been disabling pullup
      when asked to do the opposite. According to surrounding code
      and gadget API this seems to be a mistake. This fix allows
      UDC to be detected by host controller on recent kernels.
      Signed-off-by: default avatarSergiy Kibrik <sakib@meta.ua>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      10f09580
    • Subbaraya Sundeep Bhatta's avatar
      usb: dwc3: gadget: Fix incorrect DEPCMD and DGCMD status macros · 459e210c
      Subbaraya Sundeep Bhatta authored
      Fixed the incorrect macro definitions correctly as per databook.
      Signed-off-by: default avatarSubbaraya Sundeep Bhatta <sbhatta@xilinx.com>
      Fixes: b09bb642 (usb: dwc3: gadget: implement Global Command support)
      Cc: <stable@vger.kernel.org> #v3.5+
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      459e210c
    • Fabio Estevam's avatar
      usb: phy: tahvo: Pass the IRQF_ONESHOT flag · a81df9ee
      Fabio Estevam authored
      Since commit 1c6c6952 ("genirq: Reject bogus threaded irq requests")
      threaded IRQs without a primary handler need to be requested with
      IRQF_ONESHOT, otherwise the request will fail.
      
      So pass the IRQF_ONESHOT flag in this case.
      
      The semantic patch that makes this change is available
      in scripts/coccinelle/misc/irqf_oneshot.cocci.
      Signed-off-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      a81df9ee
    • Fabio Estevam's avatar
      usb: phy: ab8500-usb: Pass the IRQF_ONESHOT flag · 2b129789
      Fabio Estevam authored
      Since commit 1c6c6952 ("genirq: Reject bogus threaded irq requests")
      threaded IRQs without a primary handler need to be requested with
      IRQF_ONESHOT, otherwise the request will fail.
      
      So pass the IRQF_ONESHOT flag in this case.
      
      The semantic patch that makes this change is available
      in scripts/coccinelle/misc/irqf_oneshot.cocci.
      Signed-off-by: default avatarFabio Estevam <fabio.estevam@freescale.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      2b129789
    • Yoshihiro Shimoda's avatar
      usb: renesas_usbhs: Revise the binding document about the dma-names · 7cc99f1e
      Yoshihiro Shimoda authored
      Since the DT should describe the hardware (not the driver limitation),
      This patch revises the binding document about the dma-names to change
      simple numbering as "ch%d" instead of "tx<n>" and "rx<n>".
      
      Also this patch fixes the actual code of renesas_usbhs driver to handle
      the new dma-names.
      Signed-off-by: default avatarYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
      Acked-by: default avatarMark Rutland <mark.rutland@arm.com>
      Acked-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      7cc99f1e
  2. 14 May, 2015 1 commit
    • Pawel Szewczyk's avatar
      usb: gadget: f_midi: fix segfault when reading empty id · a25a23cc
      Pawel Szewczyk authored
      When midi function is created, 'id' attribute is initialized with
      SNDRV_DEFAULT_STR1, which is NULL pointer. Trying to read this attribute
      before filling it ends up with segmentation fault.
      
      This commit fix this issue by preventing null pointer dereference. Now
      f_midi_opts_id_show() returns empty string when id is a null pointer.
      
      Reproduction path:
      
      $ mkdir functions/midi.0
      $ cat functions/midi.0/id
      
      [   53.130132] Unable to handle kernel NULL pointer dereference at
      virtual address 00000000
      [   53.132630] pgd = ec6cc000
      [   53.135308] [00000000] *pgd=6b759831, *pte=00000000, *ppte=00000000
      [   53.141530] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
      [   53.146904] Modules linked in: usb_f_midi snd_rawmidi libcomposite
      [   53.153071] CPU: 1 PID: 2936 Comm: cat Not tainted
      3.19.0-00041-gcf4b216 #7
      [   53.160010] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      [   53.166088] task: ee234c80 ti: ec764000 task.ti: ec764000
      [   53.171482] PC is at strlcpy+0x8/0x60
      [   53.175128] LR is at f_midi_opts_id_show+0x28/0x3c [usb_f_midi]
      [   53.181019] pc : [<c0222a9c>]    lr : [<bf01bed0>]    psr: 60000053
      [   53.181019] sp : ec765ef8  ip : 00000141  fp : 00000000
      [   53.192474] r10: 00019000  r9 : ed7546c0  r8 : 00010000
      [   53.197682] r7 : ec765f80  r6 : eb46a000  r5 : eb46a000  r4 :
      ed754734
      [   53.204192] r3 : ee234c80  r2 : 00001000  r1 : 00000000  r0 :
      eb46a000
      [   53.210704] Flags: nZCv  IRQs on  FIQs off  Mode SVC_32  ISA ARM
      Segment user
      [   53.217907] Control: 10c5387d  Table: 6c6cc04a  DAC: 00000015
      [   53.223636] Process cat (pid: 2936, stack limit = 0xec764238)
      [   53.229364] Stack: (0xec765ef8 to 0xec766000)
      [   53.233706] 5ee0:
      ed754734 ed7546c0
      [   53.241866] 5f00: eb46a000 bf01bed0 eb753b80 bf01cc44 eb753b98
      bf01b0a4 bf01b08c c0125dd0
      [   53.250025] 5f20: 00002f19 00000000 ec432e00 bf01cce8 c0530c00
      00019000 00010000 ec765f80
      [   53.258184] 5f40: 00010000 ec764000 00019000 c00cc4ac ec432e00
      c00cc55c 00000017 000081a4
      [   53.266343] 5f60: 00000001 00000000 00000000 ec432e00 ec432e00
      00010000 00019000 c00cc620
      [   53.274502] 5f80: 00000000 00000000 00000000 00010000 ffff1000
      00019000 00000003 c000e9a8
      [   53.282662] 5fa0: 00000000 c000e7e0 00010000 ffff1000 00000003
      00019000 00010000 00019000
      [   53.290821] 5fc0: 00010000 ffff1000 00019000 00000003 7fffe000
      00000001 00000000 00000000
      [   53.298980] 5fe0: 00000000 be8c68d4 0000b995 b6f0e3e6 40000070
      00000003 00000000 00000000
      [   53.307157] [<c0222a9c>] (strlcpy) from [<bf01bed0>]
      (f_midi_opts_id_show+0x28/0x3c [usb_f_midi])
      [   53.316006] [<bf01bed0>] (f_midi_opts_id_show [usb_f_midi]) from
      [<bf01b0a4>] (f_midi_opts_attr_show+0x18/0x24 )
      [   53.327209] [<bf01b0a4>] (f_midi_opts_attr_show [usb_f_midi]) from
      [<c0125dd0>] (configfs_read_file+0x9c/0xec)
      [   53.337180] [<c0125dd0>] (configfs_read_file) from [<c00cc4ac>]
      (__vfs_read+0x18/0x4c)
      [   53.345073] [<c00cc4ac>] (__vfs_read) from [<c00cc55c>]
      (vfs_read+0x7c/0x100)
      [   53.352190] [<c00cc55c>] (vfs_read) from [<c00cc620>]
      (SyS_read+0x40/0x8c)
      [   53.359056] [<c00cc620>] (SyS_read) from [<c000e7e0>]
      (ret_fast_syscall+0x0/0x34)
      [   53.366513] Code: ebffe3d3 e8bd8008 e92d4070 e1a05000 (e5d14000)
      [   53.372641] ---[ end trace e4f53a4e233d98d0 ]---
      Signed-off-by: default avatarPawel Szewczyk <p.szewczyk@samsung.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      a25a23cc
  3. 27 Apr, 2015 16 commits
    • Arnd Bergmann's avatar
      usb: gadget: remove incorrect __init/__exit annotations · c94e289f
      Arnd Bergmann authored
      A recent change introduced a link error for the composite
      printer gadget driver:
      
      `printer_unbind' referenced in section `.ref.data' of drivers/built-in.o: defined in discarded section `.exit.text' of drivers/built-in.o
      
      Evidently the unbind function should not be marked __exit here,
      because it is called through a callback pointer that is not necessarily
      discarded, __composite_unbind() is indeed called from the error path of
      composite_bind(), which can never work for a built-in driver.
      
      Looking at the surrounding code, I found the same problem in all other
      composite gadget drivers in both the bind and unbind functions, as
      well as the udc platform driver 'remove' functions. Those will break
      if anyone uses the 'unbind' sysfs attribute to detach a device from a
      built-in driver.
      
      This patch removes the incorrect annotations from all the gadget
      drivers.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      c94e289f
    • Arnd Bergmann's avatar
      usb: phy: isp1301: work around tps65010 dependency · 197d0bdf
      Arnd Bergmann authored
      The isp1301-omap driver contains special hooks for the TPS65010
      power management controller. It provides its own 'tps65010_set_vbus_draw'
      wrapper in case that driver is not enabled through Kconfig, but
      fails to handle the case where isp1301-omap is built-in but TPS65010
      is a loadable module, which currently results in a link error:
      
      drivers/built-in.o: In function `isp1301_set_power':
      :(.text+0x14e188): undefined reference to `tps65010_set_vbus_draw'
      
      This is a workaround to use the same trick as before also when
      tps65010 is a module. Doing a proper fix would require much larger
      changes to the driver that is not really worth it when the usb-phy
      drivers are going to eventually get replaced with generic-phy
      drivers.
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      197d0bdf
    • Philip Oberstaller's avatar
      usb: gadget: serial: fix re-ordering of tx data · 3e9d3d2e
      Philip Oberstaller authored
      When a single thread is sending out data over the gadget serial port,
      gs_start_tx() will be called both from the sender context and from the
      write completion. Since the port lock is released before the packet is
      queued, the order in which the URBs are submitted is not guaranteed.
      E.g.
      
        sending thread                      completion (interrupt)
      
        gs_write()
          LOCK
                                            gs_write_complete()
                                              LOCK (wait)
          gs_start_tx()
            req1 = list_entry(pool->next)
            UNLOCK
                                              LOCK (acquired)
                                              gs_start_tx()
                                                req2 = list_entry(pool->next)
                                                UNLOCK
                                                usb_ep_queue(req2)
            usb_ep_queue(req1)
      
      I.e., req2 is submitted before req1 but it contains the data that
      comes after req1.
      
      To reproduce, use SMP with sending thread and completion pinned to
      different CPUs, or use PREEMPT_RT, and add the following delay just
      before the call to usb_ep_queue():
      
      		if (port->write_started > 0 && !list_empty(pool))
      			udelay(1000);
      
      To work around this problem, make sure that only one thread is running
      through the gs_start_tx() loop with an extra flag write_busy. Since
      gs_start_tx() is always called with the port lock held, no further
      synchronisation is needed. The original caller will continue through
      the loop when the request was successfully submitted.
      Signed-off-by: default avatarPhilip Oberstaller <Philip.Oberstaller@septentrio.com>
      Signed-off-by: default avatarArnout Vandecappelle (Essensium/Mind) <arnout@mind.be>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      3e9d3d2e
    • Krzysztof Opasiak's avatar
      usb: gadget: hid: Fix static variable usage · f286d487
      Krzysztof Opasiak authored
      If we have multiple instances of hid function, each of
      them may have different report descriptor, also their
      length may be different.
      
      Currently we are using static hidg_desc varable which
      is being filled in hidg_bind(). Then we send its content
      to host in hidg_setup() function. This content may
      have been already overwriten if another instance
      has executed hidg_bind().
      Signed-off-by: default avatarKrzysztof Opasiak <k.opasiak@samsung.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      f286d487
    • Krzysztof Opasiak's avatar
      usb: gadget: configfs: Fix interfaces array NULL-termination · 903124fe
      Krzysztof Opasiak authored
      memset() to 0 interfaces array before reusing
      usb_configuration structure.
      
      This commit fix bug:
      
      ln -s functions/acm.1 configs/c.1
      ln -s functions/acm.2 configs/c.1
      ln -s functions/acm.3 configs/c.1
      echo "UDC name" > UDC
      echo "" > UDC
      rm configs/c.1/acm.*
      rmdir functions/*
      mkdir functions/ecm.usb0
      ln -s functions/ecm.usb0 configs/c.1
      echo "UDC name" > UDC
      
      [   82.220969] Unable to handle kernel NULL pointer dereference at virtual address 00000000
      [   82.229009] pgd = c0004000
      [   82.231698] [00000000] *pgd=00000000
      [   82.235260] Internal error: Oops: 17 [#1] PREEMPT SMP ARM
      [   82.240638] Modules linked in:
      [   82.243681] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.0.0-rc2 #39
      [   82.249926] Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      [   82.256003] task: c07cd2f0 ti: c07c8000 task.ti: c07c8000
      [   82.261393] PC is at composite_setup+0xe3c/0x1674
      [   82.266073] LR is at composite_setup+0xf20/0x1674
      [   82.270760] pc : [<c03510d4>]    lr : [<c03511b8>]    psr: 600001d3
      [   82.270760] sp : c07c9df0  ip : c0806448  fp : ed8c9c9c
      [   82.282216] r10: 00000001  r9 : 00000000  r8 : edaae918
      [   82.287425] r7 : ed551cc0  r6 : 00007fff  r5 : 00000000  r4 : ed799634
      [   82.293934] r3 : 00000003  r2 : 00010002  r1 : edaae918  r0 : 0000002e
      [   82.300446] Flags: nZCv  IRQs off  FIQs off  Mode SVC_32  ISA ARM  Segment kernel
      [   82.307910] Control: 10c5387d  Table: 6bc1804a  DAC: 00000015
      [   82.313638] Process swapper/0 (pid: 0, stack limit = 0xc07c8210)
      [   82.319627] Stack: (0xc07c9df0 to 0xc07ca000)
      [   82.323969] 9de0:                                     00000000 c06e65f4 00000000 c07c9f68
      [   82.332130] 9e00: 00000067 c07c59ac 000003f7 edaae918 ed8c9c98 ed799690 eca2f140 200001d3
      [   82.340289] 9e20: ee79a2d8 c07c9e88 c07c5304 ffff55db 00010002 edaae810 edaae860 eda96d50
      [   82.348448] 9e40: 00000009 ee264510 00000007 c07ca444 edaae860 c0340890 c0827a40 ffff55e0
      [   82.356607] 9e60: c0827a40 eda96e40 ee264510 edaae810 00000000 edaae860 00000007 c07ca444
      [   82.364766] 9e80: edaae860 c0354170 c03407dc c033db4c edaae810 00000000 00000000 00000010
      [   82.372925] 9ea0: 00000032 c0341670 00000000 00000000 00000001 eda96e00 00000000 00000000
      [   82.381084] 9ec0: 00000000 00000032 c0803a23 ee1aa840 00000001 c005d54c 249e2450 00000000
      [   82.389244] 9ee0: 200001d3 ee1aa840 ee1aa8a0 ed84f4c0 00000000 c07c9f68 00000067 c07c59ac
      [   82.397403] 9f00: 00000000 c005d688 ee1aa840 ee1aa8a0 c07db4b4 c006009c 00000032 00000000
      [   82.405562] 9f20: 00000001 c005ce20 c07c59ac c005cf34 f002000c c07ca780 c07c9f68 00000057
      [   82.413722] 9f40: f0020000 413fc090 00000001 c00086b4 c000f804 60000053 ffffffff c07c9f9c
      [   82.421880] 9f60: c0803a20 c0011fc0 00000000 00000000 c07c9fb8 c001bee0 c07ca4f0 c057004c
      [   82.430040] 9f80: c07ca4fc c0803a20 c0803a20 413fc090 00000001 00000000 01000000 c07c9fb0
      [   82.438199] 9fa0: c000f800 c000f804 60000053 ffffffff 00000000 c0050e70 c0803bc0 c0783bd8
      [   82.446358] 9fc0: ffffffff ffffffff c0783664 00000000 00000000 c07b13e8 00000000 c0803e54
      [   82.454517] 9fe0: c07ca480 c07b13e4 c07ce40c 4000406a 00000000 40008074 00000000 00000000
      [   82.462689] [<c03510d4>] (composite_setup) from [<c0340890>] (s3c_hsotg_complete_setup+0xb4/0x418)
      [   82.471626] [<c0340890>] (s3c_hsotg_complete_setup) from [<c0354170>] (usb_gadget_giveback_request+0xc/0x10)
      [   82.481429] [<c0354170>] (usb_gadget_giveback_request) from [<c033db4c>] (s3c_hsotg_complete_request+0xcc/0x12c)
      [   82.491583] [<c033db4c>] (s3c_hsotg_complete_request) from [<c0341670>] (s3c_hsotg_irq+0x4fc/0x558)
      [   82.500614] [<c0341670>] (s3c_hsotg_irq) from [<c005d54c>] (handle_irq_event_percpu+0x50/0x150)
      [   82.509291] [<c005d54c>] (handle_irq_event_percpu) from [<c005d688>] (handle_irq_event+0x3c/0x5c)
      [   82.518145] [<c005d688>] (handle_irq_event) from [<c006009c>] (handle_fasteoi_irq+0xd4/0x18c)
      [   82.526650] [<c006009c>] (handle_fasteoi_irq) from [<c005ce20>] (generic_handle_irq+0x20/0x30)
      [   82.535242] [<c005ce20>] (generic_handle_irq) from [<c005cf34>] (__handle_domain_irq+0x6c/0xdc)
      [   82.543923] [<c005cf34>] (__handle_domain_irq) from [<c00086b4>] (gic_handle_irq+0x2c/0x6c)
      [   82.552256] [<c00086b4>] (gic_handle_irq) from [<c0011fc0>] (__irq_svc+0x40/0x74)
      [   82.559716] Exception stack(0xc07c9f68 to 0xc07c9fb0)
      [   82.564753] 9f60:                   00000000 00000000 c07c9fb8 c001bee0 c07ca4f0 c057004c
      [   82.572913] 9f80: c07ca4fc c0803a20 c0803a20 413fc090 00000001 00000000 01000000 c07c9fb0
      [   82.581069] 9fa0: c000f800 c000f804 60000053 ffffffff
      [   82.586113] [<c0011fc0>] (__irq_svc) from [<c000f804>] (arch_cpu_idle+0x30/0x3c)
      [   82.593491] [<c000f804>] (arch_cpu_idle) from [<c0050e70>] (cpu_startup_entry+0x128/0x1a4)
      [   82.601740] [<c0050e70>] (cpu_startup_entry) from [<c0783bd8>] (start_kernel+0x350/0x3bc)
      [   82.609890] Code: 0a000002 e3530005 05975010 15975008 (e5953000)
      [   82.615965] ---[ end trace f57d5f599a5f1bfa ]---
      
      Most of kernel code assume that interface array in
      struct usb_configuration is NULL terminated.
      
      When gadget is composed with configfs configuration
      structure may be reused for different functions set.
      
      This bug happens because purge_configs_funcs() sets
      only next_interface_id to 0. Interface array still
      contains pointers to already freed interfaces. If in
      second try we add less interfaces than earlier we
      may access unallocated memory when trying to get
      interface descriptors.
      Signed-off-by: default avatarKrzysztof Opasiak <k.opasiak@samsung.com>
      Cc: <stable@vger.kernel.org> # 3.10+
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      903124fe
    • Vladimir Zapolskiy's avatar
      usb: gadget: xilinx: fix devm_ioremap_resource() check · 49bce159
      Vladimir Zapolskiy authored
      devm_ioremap_resource() returns IOMEM_ERR_PTR() and it never
      returns NULL, fix the check to prevent access to invalid
      virtual address.
      Signed-off-by: default avatarVladimir Zapolskiy <vz@mleia.com>
      Reviewed-by: default avatarSören Brinkmann <soren.brinkmann@xilinx.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      49bce159
    • Bin Liu's avatar
      usb: dwc3: dwc3-omap: correct the register macros · 22832190
      Bin Liu authored
      The macros related to register UTMI_OTG_CTRL and UTMI_OTG_STATUS are
      swapped. Correct them for readability.
      Signed-off-by: default avatarBin Liu <b-liu@ti.com>
      Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
      22832190
    • Linus Torvalds's avatar
      Linux 4.1-rc1 · b787f68c
      Linus Torvalds authored
      b787f68c
    • Andy Lutomirski's avatar
      x86_64, asm: Work around AMD SYSRET SS descriptor attribute issue · 61f01dd9
      Andy Lutomirski authored
      AMD CPUs don't reinitialize the SS descriptor on SYSRET, so SYSRET with
      SS == 0 results in an invalid usermode state in which SS is apparently
      equal to __USER_DS but causes #SS if used.
      
      Work around the issue by setting SS to __KERNEL_DS __switch_to, thus
      ensuring that SYSRET never happens with SS set to NULL.
      
      This was exposed by a recent vDSO cleanup.
      
      Fixes: e7d6eefa x86/vdso32/syscall.S: Do not load __USER32_DS to %ss
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Cc: Peter Anvin <hpa@zytor.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Denys Vlasenko <vda.linux@googlemail.com>
      Cc: Brian Gerst <brgerst@gmail.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      61f01dd9
    • Linus Torvalds's avatar
      Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux · 1190944f
      Linus Torvalds authored
      Pull intel drm fixes from Dave Airlie.
      
      * 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
        drm/i915: vlv: fix save/restore of GFX_MAX_REQ_COUNT reg
        drm/i915: Workaround to avoid lite restore with HEAD==TAIL
        drm/i915: cope with large i2c transfers
      1190944f
    • Linus Torvalds's avatar
      Merge git://git.infradead.org/intel-iommu · 9f86262d
      Linus Torvalds authored
      Pull intel iommu updates from David Woodhouse:
       "This lays a little of the groundwork for upcoming Shared Virtual
        Memory support — fixing some bogus #defines for capability bits and
        adding the new ones, and starting to use the new wider page tables
        where we can, in anticipation of actually filling in the new fields
        therein.
      
        It also allows graphics devices to be assigned to VM guests again.
        This got broken in 3.17 by disallowing assignment of RMRR-afflicted
        devices.  Like USB, we do understand why there's an RMRR for graphics
        devices — and unlike USB, it's actually sane.  So we can make an
        exception for graphics devices, just as we do USB controllers.
      
        Finally, tone down the warning about the X2APIC_OPT_OUT bit, due to
        persistent requests.  X2APIC_OPT_OUT was added to the spec as a nasty
        hack to allow broken BIOSes to forbid us from using X2APIC when they
        do stupid and invasive things and would break if we did.
      
        Someone noticed that since Windows doesn't have full IOMMU support for
        DMA protection, setting the X2APIC_OPT_OUT bit made Windows avoid
        initialising the IOMMU on the graphics unit altogether.
      
        This means that it would be available for use in "driver mode", where
        the IOMMU registers are made available through a BAR of the graphics
        device and the graphics driver can do SVM all for itself.
      
        So they started setting the X2APIC_OPT_OUT bit on *all* platforms with
        SVM capabilities.  And even the platforms which *might*, if the
        planets had been aligned correctly, possibly have had SVM capability
        but which in practice actually don't"
      
      * git://git.infradead.org/intel-iommu:
        iommu/vt-d: support extended root and context entries
        iommu/vt-d: Add new extended capabilities from v2.3 VT-d specification
        iommu/vt-d: Allow RMRR on graphics devices too
        iommu/vt-d: Print x2apic opt out info instead of printing a warning
        iommu/vt-d: kill bogus ecap_niotlb_iunits()
      9f86262d
    • Linus Torvalds's avatar
      Merge branch 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux · 85f2901b
      Linus Torvalds authored
      Pull i2c fixes from Wolfram Sang:
       "This has a mixture of merge window cleanups and bugfixes"
      
      * 'i2c/for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
        i2c: st: add include for pinctrl
        i2c: mux: use proper dev when removing "channel-X" symlinks
        i2c: digicolor: remove duplicate include
        i2c: Mark adapter devices with pm_runtime_no_callbacks
        i2c: pca-platform: fix broken email address
        i2c: mxs: fix broken email address
        i2c: rk3x: report number of messages transmitted
      85f2901b
    • Linus Torvalds's avatar
      Merge branch 'for-linus-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs · f583381f
      Linus Torvalds authored
      Pull btrfs fixes from Chris Mason:
       "Filipe hit two problems in my block group cache patches.  We finalized
        the fixes last week and ran through more tests"
      
      * 'for-linus-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
        Btrfs: prevent list corruption during free space cache processing
        Btrfs: fix inode cache writeout
      f583381f
    • Dave Airlie's avatar
      Merge tag 'drm-intel-next-fixes-2015-04-25' of... · 59fd7e4b
      Dave Airlie authored
      Merge tag 'drm-intel-next-fixes-2015-04-25' of git://anongit.freedesktop.org/drm-intel into drm-fixes
      
      three fixes for i915.
      
      * tag 'drm-intel-next-fixes-2015-04-25' of git://anongit.freedesktop.org/drm-intel:
        drm/i915: vlv: fix save/restore of GFX_MAX_REQ_COUNT reg
        drm/i915: Workaround to avoid lite restore with HEAD==TAIL
        drm/i915: cope with large i2c transfers
      59fd7e4b
    • Linus Torvalds's avatar
      Merge tag 'nfs-for-4.1-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs · 59953fba
      Linus Torvalds authored
      Pull NFS client updates from Trond Myklebust:
       "Another set of mainly bugfixes and a couple of cleanups.  No new
        functionality in this round.
      
        Highlights include:
      
        Stable patches:
         - Fix a regression in /proc/self/mountstats
         - Fix the pNFS flexfiles O_DIRECT support
         - Fix high load average due to callback thread sleeping
      
        Bugfixes:
         - Various patches to fix the pNFS layoutcommit support
         - Do not cache pNFS deviceids unless server notifications are enabled
         - Fix a SUNRPC transport reconnection regression
         - make debugfs file creation failure non-fatal in SUNRPC
         - Another fix for circular directory warnings on NFSv4 "junctioned"
           mountpoints
         - Fix locking around NFSv4.2 fallocate() support
         - Truncating NFSv4 file opens should also sync O_DIRECT writes
         - Prevent infinite loop in rpcrdma_ep_create()
      
        Features:
         - Various improvements to the RDMA transport code's handling of
           memory registration
         - Various code cleanups"
      
      * tag 'nfs-for-4.1-1' of git://git.linux-nfs.org/projects/trondmy/linux-nfs: (55 commits)
        fs/nfs: fix new compiler warning about boolean in switch
        nfs: Remove unneeded casts in nfs
        NFS: Don't attempt to decode missing directory entries
        Revert "nfs: replace nfs_add_stats with nfs_inc_stats when add one"
        NFS: Rename idmap.c to nfs4idmap.c
        NFS: Move nfs_idmap.h into fs/nfs/
        NFS: Remove CONFIG_NFS_V4 checks from nfs_idmap.h
        NFS: Add a stub for GETDEVICELIST
        nfs: remove WARN_ON_ONCE from nfs_direct_good_bytes
        nfs: fix DIO good bytes calculation
        nfs: Fetch MOUNTED_ON_FILEID when updating an inode
        sunrpc: make debugfs file creation failure non-fatal
        nfs: fix high load average due to callback thread sleeping
        NFS: Reduce time spent holding the i_mutex during fallocate()
        NFS: Don't zap caches on fallocate()
        xprtrdma: Make rpcrdma_{un}map_one() into inline functions
        xprtrdma: Handle non-SEND completions via a callout
        xprtrdma: Add "open" memreg op
        xprtrdma: Add "destroy MRs" memreg op
        xprtrdma: Add "reset MRs" memreg op
        ...
      59953fba
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs · 9ec3a646
      Linus Torvalds authored
      Pull fourth vfs update from Al Viro:
       "d_inode() annotations from David Howells (sat in for-next since before
        the beginning of merge window) + four assorted fixes"
      
      * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
        RCU pathwalk breakage when running into a symlink overmounting something
        fix I_DIO_WAKEUP definition
        direct-io: only inc/dec inode->i_dio_count for file systems
        fs/9p: fix readdir()
        VFS: assorted d_backing_inode() annotations
        VFS: fs/inode.c helpers: d_inode() annotations
        VFS: fs/cachefiles: d_backing_inode() annotations
        VFS: fs library helpers: d_inode() annotations
        VFS: assorted weird filesystems: d_inode() annotations
        VFS: normal filesystems (and lustre): d_inode() annotations
        VFS: security/: d_inode() annotations
        VFS: security/: d_backing_inode() annotations
        VFS: net/: d_inode() annotations
        VFS: net/unix: d_backing_inode() annotations
        VFS: kernel/: d_inode() annotations
        VFS: audit: d_backing_inode() annotations
        VFS: Fix up some ->d_inode accesses in the chelsio driver
        VFS: Cachefiles should perform fs modifications on the top layer only
        VFS: AF_UNIX sockets should call mknod on the top layer only
      9ec3a646
  4. 26 Apr, 2015 8 commits
    • Linus Torvalds's avatar
      Merge tag 'pm+acpi-4.1-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm · c8b3fd0c
      Linus Torvalds authored
      Pull more power management and ACPI updates from Rafael Wysocki:
       "These are fixes mostly (intel_pstate, ACPI core, ACPI EC driver,
        cpupower tool), a new CPU ID for the Intel RAPL driver and one
        intel_pstate driver improvement that didn't make it to my previous
        pull requests due to timing.
      
        Specifics:
      
         - Fix a build warning in the intel_pstate driver showing up in
           non-SMP builds (Borislav Petkov)
      
         - Change one of the intel_pstate's P-state selection parameters for
           Baytrail and Cherrytrail CPUs to significantly improve performance
           at the cost of a small increase in energy consumption (Kristen
           Carlson Accardi)
      
         - Fix a NULL pointer dereference in the ACPI EC driver due to an
           unsafe list walk in the query handler removal routine (Chris
           Bainbridge)
      
         - Get rid of a false-positive lockdep warning in the ACPI container
           hot-remove code (Rafael J Wysocki)
      
         - Prevent the ACPI device enumeration code from creating device
           objects of a wrong type in some cases (Rafael J Wysocki)
      
         - Add Skylake processors support to the Intel RAPL power capping
           driver (Brian Bian)
      
         - Drop the stale MAINTAINERS entry for the ACPI dock driver that is
           regarded as part of the ACPI core and maintained along with it now
           (Chao Yu)
      
         - Fix cpupower tool breakage caused by a library API change in libpci
           3.3.0 (Lucas Stach)"
      
      * tag 'pm+acpi-4.1-rc1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
        ACPI / scan: Add a scan handler for PRP0001
        ACPI / scan: Annotate physical_node_lock in acpi_scan_is_offline()
        ACPI / EC: fix NULL pointer dereference in acpi_ec_remove_query_handler()
        MAINTAINERS: remove maintainship entry of docking station driver
        powercap / RAPL: Add support for Intel Skylake processors
        cpufreq: intel_pstate: Fix an annoying !CONFIG_SMP warning
        intel_pstate: Change the setpoint for Atom params
        cpupower: fix breakage from libpci API change
      c8b3fd0c
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6 · d89b3e19
      Linus Torvalds authored
      Pull crypto fixes from Herbert Xu:
       "This push fixes a build problem with img-hash under non-standard
        configurations and a serious regression with sha512_ssse3 which can
        lead to boot failures"
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
        crypto: img-hash - CRYPTO_DEV_IMGTEC_HASH should depend on HAS_DMA
        crypto: x86/sha512_ssse3 - fixup for asm function prototype change
      d89b3e19
    • Linus Torvalds's avatar
      Merge tag 'platform-drivers-x86-v4.1-1' of... · 78d42567
      Linus Torvalds authored
      Merge tag 'platform-drivers-x86-v4.1-1' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86
      
      Pull x86 platform driver updates from Darren Hart:
       "This series includes significant updates to the toshiba_acpi driver
        and the reintroduction of the dell-laptop keyboard backlight additions
        I had to revert previously.  Also included are various fixes for
        typos, warnings, correctness, and minor bugs.
      
        Specifics:
      
        dell-laptop:
           - add support for keyboard backlight.
      
        toshiba_acpi:
           - adaptive keyboard, hotkey, USB sleep and charge, and backlight
             updates.  Update sysfs documentation.
      
        toshiba_bluetooth:
           - fix enabling/disabling loop on recent devices
      
        apple-gmux:
           - lock iGP IO to protect from vgaarb changes
      
        other:
           - Fix typos, clear gcc warnings, clarify pr_* messages, correct
             return types, update MAINTAINERS"
      
      * tag 'platform-drivers-x86-v4.1-1' of git://git.infradead.org/users/dvhart/linux-platform-drivers-x86: (25 commits)
        toshiba_acpi: Do not register vendor backlight when acpi_video bl is available
        MAINTAINERS: Add me on list of Dell laptop drivers
        platform: x86: dell-laptop: Add support for keyboard backlight
        Documentation/ABI: Update sysfs-driver-toshiba_acpi entry
        toshiba_acpi: Fix pr_* messages from USB Sleep Functions
        toshiba_acpi: Update and fix USB Sleep and Charge modes
        wmi: Use bool function return values of true/false not 1/0
        toshiba_bluetooth: Fix enabling/disabling loop on recent devices
        toshiba_bluetooth: Clean up *_add function and disable BT device at removal
        toshiba_bluetooth: Add three new functions to the driver
        toshiba_acpi: Fix the enabling of the Special Functions
        toshiba_acpi: Use the Hotkey Event Type function for keymap choosing
        toshiba_acpi: Add Hotkey Event Type function and definitions
        x86/wmi: delete unused wmi_data_lock mutex causing gcc warning
        apple-gmux: lock iGP IO to protect from vgaarb changes
        MAINTAINERS: Add missing Toshiba devices and add myself as maintainer
        toshiba_acpi: Update events in toshiba_acpi_notify
        intel-oaktrail: Fix trivial typo in comment
        thinkpad_acpi: off by one in adaptive_keyboard_hotkey_notify_hotkey()
        thinkpad_acpi: signedness bugs getting current_mode
        ...
      78d42567
    • Linus Torvalds's avatar
      Merge tag 'chrome-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform · 36a8032d
      Linus Torvalds authored
      Pull chrome platform updates from Olof Johansson:
       "Here's a set of updates to the Chrome OS platform drivers for this
        merge window.
      
        Main new things this cycle is:
      
         - Driver changes to expose the lightbar to users.  With this, you can
           make your own blinkenlights on Chromebook Pixels.
      
         - Changes in the way that the atmel_mxt trackpads are probed.  The
           laptop driver is trying to be smart and not instantiate the devices
           that don't answer to probe.  For the trackpad that can come up in
           two modes (bootloader or regular), this gets complicated since the
           driver already knows how to handle the two modes including the
           actual addresses used.  So now the laptop driver needs to know more
           too, instantiating the regular address even if the bootloader one
           is the probe that passed.
      
         - mfd driver improvements by Javier Martines Canillas, and a few
           bugfixes from him, kbuild and myself"
      
      * tag 'chrome-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/olof/chrome-platform:
        platform/chrome: chromeos_laptop - instantiate Atmel at primary address
        platform/chrome: cros_ec_lpc - Depend on X86 || COMPILE_TEST
        platform/chrome: cros_ec_lpc - Include linux/io.h header file
        platform/chrome: fix platform_no_drv_owner.cocci warnings
        platform/chrome: cros_ec_lightbar - fix duplicate const warning
        platform/chrome: cros_ec_dev - fix Unknown escape '%' warning
        platform/chrome: Expose Chrome OS Lightbar to users
        platform/chrome: Create sysfs attributes for the ChromeOS EC
        mfd: cros_ec: Instantiate ChromeOS EC character device
        platform/chrome: Add Chrome OS EC userspace device interface
        platform/chrome: Add cros_ec_lpc driver for x86 devices
        mfd: cros_ec: Add char dev and virtual dev pointers
        mfd: cros_ec: Use fixed size arrays to transfer data with the EC
      36a8032d
    • Linus Torvalds's avatar
      Merge tag 'cris-for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/jesper/cris · 7f9f4430
      Linus Torvalds authored
      Pull arch/cris updates from Jesper Nilsson:
       "Some much needed love for the CRIS-port.
      
        There's a bunch of changes this time, giving the CRISv32 port a bit of
        modern makeover with device-tree, irq domain and gpiolib support, and
        more switchover to generic frameworks.
      
        Some small fixes and removal of the theoretical SMP support brings up
        the rear"
      
      * tag 'cris-for-4.1' of git://git.kernel.org/pub/scm/linux/kernel/git/jesper/cris:
        cris: fix integer overflow in ELF_ET_DYN_BASE
        CRISv32: use GENERIC_SCHED_CLOCK
        CRISv32: use MMIO clocksource
        CRISv32: use generic clockevents
        CRIS: use generic headers via Kbuild
        CRIS: use generic cmpxchg.h
        CRIS: use generic atomic.h
        CRIS: use generic atomic bitops
        CRISv10: remove redundant macros from system.h
        CRIS: remove SMP code
        CRISv32: don't enable irqs in INIT_THREAD
        CRISv32: handle multiple signals
        CRISv32: prevent bogus restarts on sigreturn
        CRISv32: don't attempt syscall restart on irq exit
        Add binding documentation for CRIS
        CRIS: add Axis 88 board device tree
        CRISv32: add device tree support
        CRISv32: add irq domains support
        CRIS: enable GPIOLIB
      7f9f4430
    • Linus Torvalds's avatar
      Merge tag 'powerpc-4.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux · 63905bba
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
      
       - fix for mm_dec_nr_pmds() from Scott.
      
       - fixes for oopses seen with KVM + THP from Aneesh.
      
       - build fixes from Aneesh & Shreyas.
      
      * tag 'powerpc-4.1-2' of git://git.kernel.org/pub/scm/linux/kernel/git/mpe/linux:
        powerpc/mm: Fix build error with CONFIG_PPC_TRANSACTIONAL_MEM disabled
        powerpc/kvm: Fix ppc64_defconfig + PPC_POWERNV=n build error
        powerpc/mm/thp: Return pte address if we find trans_splitting.
        powerpc/mm/thp: Make page table walk safe against thp split/collapse
        KVM: PPC: Remove page table walk helpers
        KVM: PPC: Use READ_ONCE when dereferencing pte_t pointer
        powerpc/hugetlb: Call mm_dec_nr_pmds() in hugetlb_free_pmd_range()
      63905bba
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · eadf16a9
      Linus Torvalds authored
      Pull second batch of KVM changes from Paolo Bonzini:
       "This mostly includes the PPC changes for 4.1, which this time cover
        Book3S HV only (debugging aids, minor performance improvements and
        some cleanups).  But there are also bug fixes and small cleanups for
        ARM, x86 and s390.
      
        The task_migration_notifier revert and real fix is still pending
        review, but I'll send it as soon as possible after -rc1"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (29 commits)
        KVM: arm/arm64: check IRQ number on userland injection
        KVM: arm: irqfd: fix value returned by kvm_irq_map_gsi
        KVM: VMX: Preserve host CR4.MCE value while in guest mode.
        KVM: PPC: Book3S HV: Use msgsnd for signalling threads on POWER8
        KVM: PPC: Book3S HV: Translate kvmhv_commence_exit to C
        KVM: PPC: Book3S HV: Streamline guest entry and exit
        KVM: PPC: Book3S HV: Use bitmap of active threads rather than count
        KVM: PPC: Book3S HV: Use decrementer to wake napping threads
        KVM: PPC: Book3S HV: Don't wake thread with no vcpu on guest IPI
        KVM: PPC: Book3S HV: Get rid of vcore nap_count and n_woken
        KVM: PPC: Book3S HV: Move vcore preemption point up into kvmppc_run_vcpu
        KVM: PPC: Book3S HV: Minor cleanups
        KVM: PPC: Book3S HV: Simplify handling of VCPUs that need a VPA update
        KVM: PPC: Book3S HV: Accumulate timing information for real-mode code
        KVM: PPC: Book3S HV: Create debugfs file for each guest's HPT
        KVM: PPC: Book3S HV: Add ICP real mode counters
        KVM: PPC: Book3S HV: Move virtual mode ICP functions to real-mode
        KVM: PPC: Book3S HV: Convert ICS mutex lock to spin lock
        KVM: PPC: Book3S HV: Add guest->host real mode completion counters
        KVM: PPC: Book3S HV: Add helpers for lock/unlock hpte
        ...
      eadf16a9
    • Stephen Rothwell's avatar
  5. 25 Apr, 2015 1 commit
    • Dmitry Torokhov's avatar
      platform/chrome: chromeos_laptop - instantiate Atmel at primary address · 96cba9b0
      Dmitry Torokhov authored
      The new Atmel MXT driver expects i2c client's address contain the
      primary (main address) of the chip, and calculates the expected
      bootloader address form the primary address. Unfortunately chrome_laptop
      does probe the devices and if touchpad (or touchscreen, or both) comes
      up in bootloader mode the i2c device gets instantiated with the
      bootloader address which confuses the driver.
      
      To work around this issue let's probe the primary address first. If the
      device is not detected at the primary address we'll probe alternative
      addresses as "dummy" devices. If any of them are found, destroy the
      dummy client and instantiate client with proper name at primary address
      still.
      Signed-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      Signed-off-by: default avatarOlof Johansson <olof@lixom.net>
      96cba9b0
  6. 24 Apr, 2015 6 commits
    • Al Viro's avatar
      RCU pathwalk breakage when running into a symlink overmounting something · 3cab989a
      Al Viro authored
      Calling unlazy_walk() in walk_component() and do_last() when we find
      a symlink that needs to be followed doesn't acquire a reference to vfsmount.
      That's fine when the symlink is on the same vfsmount as the parent directory
      (which is almost always the case), but it's not always true - one _can_
      manage to bind a symlink on top of something.  And in such cases we end up
      with excessive mntput().
      
      Cc: stable@vger.kernel.org # since 2.6.39
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      3cab989a
    • Eric Sandeen's avatar
      fix I_DIO_WAKEUP definition · ac74d8d6
      Eric Sandeen authored
      I_DIO_WAKEUP is never directly used, but fix it up anyway.
      Signed-off-by: default avatarEric Sandeen <sandeen@redhat.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      ac74d8d6
    • Jens Axboe's avatar
      direct-io: only inc/dec inode->i_dio_count for file systems · fe0f07d0
      Jens Axboe authored
      do_blockdev_direct_IO() increments and decrements the inode
      ->i_dio_count for each IO operation. It does this to protect against
      truncate of a file. Block devices don't need this sort of protection.
      
      For a capable multiqueue setup, this atomic int is the only shared
      state between applications accessing the device for O_DIRECT, and it
      presents a scaling wall for that. In my testing, as much as 30% of
      system time is spent incrementing and decrementing this value. A mixed
      read/write workload improved from ~2.5M IOPS to ~9.6M IOPS, with
      better latencies too. Before:
      
      clat percentiles (usec):
       |  1.00th=[   33],  5.00th=[   34], 10.00th=[   34], 20.00th=[   34],
       | 30.00th=[   34], 40.00th=[   34], 50.00th=[   35], 60.00th=[   35],
       | 70.00th=[   35], 80.00th=[   35], 90.00th=[   37], 95.00th=[   80],
       | 99.00th=[   98], 99.50th=[  151], 99.90th=[  155], 99.95th=[  155],
       | 99.99th=[  165]
      
      After:
      
      clat percentiles (usec):
       |  1.00th=[   95],  5.00th=[  108], 10.00th=[  129], 20.00th=[  149],
       | 30.00th=[  155], 40.00th=[  161], 50.00th=[  167], 60.00th=[  171],
       | 70.00th=[  177], 80.00th=[  185], 90.00th=[  201], 95.00th=[  270],
       | 99.00th=[  390], 99.50th=[  398], 99.90th=[  418], 99.95th=[  422],
       | 99.99th=[  438]
      
      In other setups, Robert Elliott reported seeing good performance
      improvements:
      
      https://lkml.org/lkml/2015/4/3/557
      
      The more applications accessing the device, the worse it gets.
      
      Add a new direct-io flags, DIO_SKIP_DIO_COUNT, which tells
      do_blockdev_direct_IO() that it need not worry about incrementing
      or decrementing the inode i_dio_count for this caller.
      
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Theodore Ts'o <tytso@mit.edu>
      Cc: Elliott, Robert (Server Storage) <elliott@hp.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: default avatarJens Axboe <axboe@fb.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      fe0f07d0
    • Johannes Berg's avatar
      fs/9p: fix readdir() · 8e3c5005
      Johannes Berg authored
      Al Viro's IOV changes broke 9p readdir() because the new code
      didn't abort the read when it returned nothing. The original
      code checked if the combined error/length was <= 0 but in the
      new code that accidentally got changed to just an error check.
      
      Add back the return from the function when nothing is read.
      
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Fixes: e1200fe6 ("9p: switch p9_client_read() to passing struct iov_iter *")
      Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      8e3c5005
    • Chris Mason's avatar
      Btrfs: prevent list corruption during free space cache processing · a3bdccc4
      Chris Mason authored
      __btrfs_write_out_cache is holding the ctl->tree_lock while it prepares
      a list of bitmaps to record in the free space cache.  It was dropping
      the lock while it worked on other components, which made a window for
      free_bitmap() to free the bitmap struct without removing it from the
      list.
      
      This changes things to hold the lock the whole time, and also makes sure
      we hold the lock during enospc cleanup.
      Reported-by: default avatarFilipe Manana <fdmanana@suse.com>
      Signed-off-by: default avatarChris Mason <clm@fb.com>
      a3bdccc4
    • Hans de Goede's avatar
      toshiba_acpi: Do not register vendor backlight when acpi_video bl is available · 358d6a2c
      Hans de Goede authored
      commit a39f46df ("toshiba_acpi: Fix regression caused by backlight extra
      check code") causes the backlight to no longer work on the Toshiba Z30,
      reverting that commit fixes this but restores the original issue fixed
      by that commit.
      
      Looking at the toshiba_acpi backlight code for a fix for this I noticed that
      the toshiba code is the only code under platform/x86 which unconditionally
      registers a vendor acpi backlight interface, without checking for acpi_video
      backlight support first.
      
      This commit adds the necessary checks bringing toshiba_acpi in line with the
      other drivers, and fixing the Z30 regression without needing to revert the
      commit causing it.
      
      Chances are that there will be some Toshiba models which have a non working
      acpi-video implementation while the toshiba vendor backlight interface does
      work, this commit adds an empty dmi_id table where such systems can be added,
      this is identical to how other drivers handle such systems.
      
      BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1206036
      BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=86521Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Reviewed-and-tested-by: default avatarAzael Avalos <coproscefalo@gmail.com>
      Signed-off-by: default avatarDarren Hart <dvhart@linux.intel.com>
      358d6a2c