1. 29 Nov, 2016 4 commits
  2. 25 Nov, 2016 1 commit
  3. 24 Nov, 2016 2 commits
  4. 18 Nov, 2016 1 commit
    • Takashi Sakamoto's avatar
      ALSA: bebob: compare whole string for model name so that readers are not confused · 2e57069c
      Takashi Sakamoto authored
      A modalias of 'ieee1394:ven00000D6Cmo00010060sp' hits units for M-Audio
      FireWire Audiophile only. However the unit has two states relevant to
      loaded firmware. Initial firmware returns 'FW Audiophile Bootloader',
      while functional firmware returns 'FW Audiophile'.
      
      ALSA bebob driver compares the units' model name to strings of 24 characters
      by the first 15 characters. This is shorter way to differentiate these two
      states but confusing to readers.
      
      This commit improves the code for this point. Kernel stack is consumed more in
      call of check_audiophile_booted() by a bit.
      
      With initial firmware:
      $ ./linux-firewire-utils/src/crpp < /sys/bus/firewire/devices/fw1/config_rom
                     ROM header and bus information block
                     -----------------------------------------------------------------
      400  04276da6  bus_info_length 4, crc_length 39, crc 28070
      404  31333934  bus_name "1394"
      408  006481f2  irmc 0, cmc 0, isc 0, bmc 0, pmc 0, cyc_clk_acc 100,
                     max_rec 8 (512), max_rom 1, gen 15, spd 2 (S400)
      40c  000d6c03  company_id 000d6c     |
      410  102b7e2e  device_id 03102b7e2e  | EUI-64 000d6c03102b7e2e
      
                     root directory
                     -----------------------------------------------------------------
      414  00067414  directory_length 6, crc 29716
      418  0c0083c0  node capabilities per IEEE 1394
      41c  03000d6c  vendor
      420  81000009  --> descriptor leaf at 444
      424  17010060  model
      428  8100000c  --> descriptor leaf at 458
      42c  d1000001  --> unit directory at 430
      
                     unit directory at 430
                     -----------------------------------------------------------------
      430  00049da1  directory_length 4, crc 40353 (should be 48611)
      434  1200a02d  specifier id: 1394 TA
      438  13014001  version: Vender Unique and AV/C
      43c  17010060  model
      440  8100000f  --> descriptor leaf at 47c
      
                     descriptor leaf at 444
                     -----------------------------------------------------------------
      444  0004073e  leaf_length 4, crc 1854
      448  00000000  textual descriptor
      44c  00000000  minimal ASCII
      450  4d2d4155  "M-AU"
      454  44494f00  "DIO"
      
                     descriptor leaf at 458
                     -----------------------------------------------------------------
      458  00086f21  leaf_length 8, crc 28449
      45c  00000000  textual descriptor
      460  00000000  minimal ASCII
      464  46572041  "FW A"
      468  7564696f  "udio"
      46c  7068696c  "phil"
      470  6520426f  "e Bo"
      474  6f746c6f  "otlo"
      478  61646572  "ader"
      
                     descriptor leaf at 47c
                     -----------------------------------------------------------------
      47c  00086f21  leaf_length 8, crc 28449
      480  00000000  textual descriptor
      484  00000000  minimal ASCII
      488  46572041  "FW A"
      48c  7564696f  "udio"
      490  7068696c  "phil"
      494  6520426f  "e Bo"
      498  6f746c6f  "otlo"
      49c  61646572  "ader"
      
      With functional firmware:
      $ ./linux-firewire-utils/src/crpp < /sys/bus/firewire/devices/fw1/config_rom
                     ROM header and bus information block
                     -----------------------------------------------------------------
      400  042de16f  bus_info_length 4, crc_length 45, crc 57711
      404  31333934  bus_name "1394"
      408  f0648122  irmc 1, cmc 1, isc 1, bmc 1, pmc 0, cyc_clk_acc 100,
                     max_rec 8 (512), max_rom 1, gen 2, spd 2 (S400)
      40c  000d6c03  company_id 000d6c     |
      410  002b7e2e  device_id 03002b7e2e  | EUI-64 000d6c03002b7e2e
      
                     root directory
                     -----------------------------------------------------------------
      414  0009dac4  directory_length 9, crc 56004
      418  0400000d  hardware version
      41c  0c0083c0  node capabilities per IEEE 1394
      420  03000d6c  vendor
      424  81000012  --> descriptor leaf at 46c
      428  17010060  model
      42c  81000015  --> descriptor leaf at 480
      430  13ffffff  version
      434  d1000002  --> unit directory at 43c
      438  d4000006  --> dependent info directory at 450
      
                     unit directory at 43c
                     -----------------------------------------------------------------
      43c  00041eb9  directory_length 4, crc 7865
      440  1200a02d  specifier id: 1394 TA
      444  13014001  version: Vender Unique and AV/C
      448  17010060  model
      44c  81000014  --> descriptor leaf at 49c
      
                     dependent info directory at 450
                     -----------------------------------------------------------------
      450  000637c7  directory_length 6, crc 14279
      454  120007f5  specifier id
      458  13000001  version
      45c  3affffc7  (immediate value)
      460  3b100000  (immediate value)
      464  3cffffc7  (immediate value)
      468  3d600000  (immediate value)
      
                     descriptor leaf at 46c
                     -----------------------------------------------------------------
      46c  0004b8e4  leaf_length 4, crc 47332
      470  00000000  textual descriptor
      474  00000000  minimal ASCII
      478  4d2d4175  "M-Au"
      47c  64696f00  "dio"
      
                     descriptor leaf at 480
                     -----------------------------------------------------------------
      480  0006194b  leaf_length 6, crc 6475
      484  00000000  textual descriptor
      488  00000000  minimal ASCII
      48c  46572041  "FW A"
      490  7564696f  "udio"
      494  7068696c  "phil"
      498  65000000  "e"
      
                     descriptor leaf at 49c
                     -----------------------------------------------------------------
      49c  0006194b  leaf_length 6, crc 6475
      4a0  00000000  textual descriptor
      4a4  00000000  minimal ASCII
      4a8  46572041  "FW A"
      4ac  7564696f  "udio"
      4b0  7068696c  "phil"
      4b4  65000000  "e"
      Reported-by: default avatarNicolas Iooss <nicolas.iooss_linux@m4x.org>
      Reported-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarTakashi Sakamoto <o-takashi@sakamocchi.jp>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      2e57069c
  5. 15 Nov, 2016 6 commits
    • Takashi Iwai's avatar
      ALSA: emu10k1: Use workqueue instead of kthread for emu1010 fw polling · aeaa6203
      Takashi Iwai authored
      This patch is a cleanup of EMU1010 dock probing code in emu10k1 driver
      to use work instead of kthread in a loop.  The work is lighter and
      easier to control than kthread, in general.
      
      Instead of a loop with the explicit sleep, we do simply
      delayed-schedule the work.  At suspend/resume callbacks, the work is
      canceled and restarted, respectively.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      aeaa6203
    • Takashi Iwai's avatar
      ALSA: emu10k1: Simplify firmware loader code · 4e4dfe4c
      Takashi Iwai authored
      The EMU1010 support in emu10k1 driver has two request_firmware()
      calls, one for the main board and one for the dock.  Both call
      patterns are fairly similar, and we can simplify it by introducing a
      helper function and a table instead of the open switch/case.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      4e4dfe4c
    • Takashi Iwai's avatar
      ALSA: emu10k1: Fix emu1010 dock attach check · e8c44abe
      Takashi Iwai authored
      The emu1010_firmware_thread() checks the previous dock status, but a
      wrong register is recorded as the last status when the dock is plugged
      in.  Usually this isn't a big issue since this value gets overwritten
      by the next loop after one second.  But when a dock is unplugged
      immediately after plugging, it means essentially missing undock
      handling.
      
      This patch addresses it by remembering the correct register value.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      e8c44abe
    • Takashi Iwai's avatar
      ALSA: core: Fix kernel-doc warnings · 43e575fa
      Takashi Iwai authored
      Several lines in sound/core.h get the kernel-doc warnings like
      
        ./include/sound/core.h:323: warning: No description found for parameter '...'
      
      where we use define like foo(x, args...) and "args" isn't mentioned in
      the comments.  As an easy workaround, use simple __VA_ARGS__ for VLA
      in macros.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      43e575fa
    • Takashi Iwai's avatar
      ALSA: compress: Fix kernel-doc warnings · f84551e4
      Takashi Iwai authored
      Some fields in struct snd_compr have no corresponding comments, and
      the kernel-doc complains like:
      
        ./include/sound/compress_driver.h:162: warning: No description found for parameter 'id[64]'
        ./include/sound/compress_driver.h:162: warning: No description found for parameter 'proc_root'
        ./include/sound/compress_driver.h:162: warning: No description found for parameter 'proc_info_entry'
      
      Actually all these are internal elements, just put "private:" comment
      so that they will be ignored.
      Acked-by: default avatarVinod Koul <vinod.koul@intel.com>
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      f84551e4
    • Takashi Iwai's avatar
      ALSA: ac97: Fix kernel-doc error with sphinx formatter · 1936f004
      Takashi Iwai authored
      Sphinx takes a word like (*foo)->bar in the kernel-doc comments as a
      part of the emphasized marker, and complains like
      
        ./sound/pci/ac97/ac97_codec.c:1908: WARNING: Inline emphasis start-string without end-string.
      
      For avoiding this, wrap it with the quotes (``) in the comment.
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      1936f004
  6. 14 Nov, 2016 1 commit
    • Takashi Iwai's avatar
      ALSA: usb-audio: Fix use-after-free of usb_device at disconnect · 6ff1a253
      Takashi Iwai authored
      The usb-audio driver implements the deferred device disconnection for
      the device in use.  In this mode, the disconnection callback returns
      immediately while the actual ALSA card object removal happens later
      when all files get closed.  As Shuah reported, this code flow,
      however, leads to a use-after-free, detected by KASAN:
      
       BUG: KASAN: use-after-free in snd_usb_audio_free+0x134/0x160 [snd_usb_audio] at addr ffff8801c863ce10
       Write of size 8 by task pulseaudio/2244
       Call Trace:
        [<ffffffff81b31473>] dump_stack+0x67/0x94
        [<ffffffff81564ef1>] kasan_object_err+0x21/0x70
        [<ffffffff8156518a>] kasan_report_error+0x1fa/0x4e0
        [<ffffffff81564ad7>] ? kasan_slab_free+0x87/0xb0
        [<ffffffff81565733>] __asan_report_store8_noabort+0x43/0x50
        [<ffffffffa0fc0f54>] ? snd_usb_audio_free+0x134/0x160 [snd_usb_audio]
        [<ffffffffa0fc0f54>] snd_usb_audio_free+0x134/0x160 [snd_usb_audio]
        [<ffffffffa0fc0fb1>] snd_usb_audio_dev_free+0x31/0x40 [snd_usb_audio]
        [<ffffffff8243c78a>] __snd_device_free+0x12a/0x210
        [<ffffffff8243d1f5>] snd_device_free_all+0x85/0xd0
        [<ffffffff8242cae4>] release_card_device+0x34/0x130
        [<ffffffff81ef1846>] device_release+0x76/0x1e0
        [<ffffffff81b37ad7>] kobject_release+0x107/0x370
        .....
       Object at ffff8801c863cc80, in cache kmalloc-2048 size: 2048
       Allocated:
        [<ffffffff810804eb>] save_stack_trace+0x2b/0x50
        [<ffffffff81564296>] save_stack+0x46/0xd0
        [<ffffffff8156450d>] kasan_kmalloc+0xad/0xe0
        [<ffffffff81560d1a>] kmem_cache_alloc_trace+0xfa/0x240
        [<ffffffff8214ea47>] usb_alloc_dev+0x57/0xc90
        [<ffffffff8216349d>] hub_event+0xf1d/0x35f0
        ....
       Freed:
        [<ffffffff810804eb>] save_stack_trace+0x2b/0x50
        [<ffffffff81564296>] save_stack+0x46/0xd0
        [<ffffffff81564ac1>] kasan_slab_free+0x71/0xb0
        [<ffffffff81560929>] kfree+0xd9/0x280
        [<ffffffff8214de6e>] usb_release_dev+0xde/0x110
        [<ffffffff81ef1846>] device_release+0x76/0x1e0
        ....
      
      It's the code trying to clear drvdata of the assigned usb_device where
      the usb_device itself was already released in usb_release_dev() after
      the disconnect callback.
      
      This patch fixes it by checking whether the code path is via the
      disconnect callback, i.e. chip->shutdown flag is set.
      
      Fixes: 79289e24 ('ALSA: usb-audio: Refer to chip->usb_id for quirks...')
      Reported-and-tested-by: default avatarShuah Khan <shuahkh@osg.samsung.com>
      Cc: <stable@vger.kernel.org> # v4.6+
      Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
      6ff1a253
  7. 13 Nov, 2016 1 commit
  8. 12 Nov, 2016 3 commits
  9. 11 Nov, 2016 15 commits
  10. 10 Nov, 2016 6 commits