02 May, 2018

1 commit

  • commit 7f054a5bee0987f1e2d4e59daea462421c76f2cb upstream.

    As recently Smatch suggested, one place in OPL3 driver may expand the
    array directly from the user-space value with speculation:
    sound/drivers/opl3/opl3_synth.c:476 snd_opl3_set_voice() warn: potential spectre issue 'snd_opl3_regmap'

    This patch puts array_index_nospec() for hardening against it.

    BugLink: https://marc.info/?l=linux-kernel&m=152411496503418&w=2
    Reported-by: Dan Carpenter
    Cc:
    Signed-off-by: Takashi Iwai
    Signed-off-by: Greg Kroah-Hartman

    Takashi Iwai
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

31 Aug, 2017

1 commit


13 Aug, 2017

1 commit


28 Jun, 2017

1 commit

  • In the commit 3d774d5ef066 ("ALSA: seq: Allow the tristate build of
    OSS emulation") we changed CONFIG_SND_SEQUENCER_OSS to tristate, but a
    couple of places were forgotten, namely, opl3 and emux Makefile.
    These contain the line like
    snd-opl3-synth-$(CONFIG_SND_SEQUENCER_OSS) += opl3_oss.o
    and this doesn't work any longer as expected because snd-opl3-synth
    can be built-in while CONFIG_SND_SEQUENCER_OSS=m.

    This patch fixes these places to build properly for the new kconfig
    dependency. In the end, we had to use ifneq() to satisfy the
    requirement. It's a bit ugly, but lesser evil.

    Fixes: 3d774d5ef066 ("ALSA: seq: Allow the tristate build of OSS emulation")
    Reported-by: kbuild test robot
    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

12 Jun, 2017

1 commit

  • Many drivers bind the sequencer stuff in off-load by another driver
    module, so that it's loaded only on demand. In the current code, this
    mechanism doesn't work when the driver is built-in while the sequencer
    is module. We check with IS_REACHABLE() and enable only when the
    sequencer is in the same level of build.

    However, this is basically a overshoot. The binder code
    (snd-seq-device) is an individual module from the sequencer core
    (snd-seq), and we just have to make the former a built-in while
    keeping the latter a module for allowing the scenario like the above.

    This patch achieves that by rewriting Kconfig slightly. Now, a driver
    that provides the manual sequencer device binding should select
    CONFIG_SND_SEQ_DEVICE in a way as
    select SND_SEQ_DEVICE if SND_SEQUENCER != n

    Note that the "!=n" is needed here to avoid the influence of the
    sequencer core is module while the driver is built-in.

    Also, since rawmidi.o may be linked with snd_seq_device.o when
    built-in, we have to shuffle the code to make the linker happy.
    (the kernel linker isn't smart enough yet to handle such a case.)
    That is, snd_seq_device.c is moved to sound/core from sound/core/seq,
    as well as Makefile.

    Last but not least, the patch replaces the code using IS_REACHABLE()
    with IS_ENABLED(), since now the condition meets always when enabled.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

10 Jun, 2017

1 commit

  • Currently OSS sequencer emulation is tied with ALSA sequencer core,
    both are built in the same level; i.e. when CONFIG_SND_SEQUENCER=y,
    the OSS sequencer emulation is also always built-in, even though the
    functionality can be built as an individual module.

    This patch changes the rule and allows users to build snd-seq-oss
    module while others are built-in. Essentially, it's just a few simple
    changes in Kconfig and Makefile. Some driver codes like opl3 need to
    convert from the simple ifdef to IS_ENABLED(). But that's all.

    You might wonder how about the dependency: right, it can be messy, but
    it still works. Since we rewrote the sequencer binding with the
    standard bus, the driver can be bound at any time on demand. So, the
    synthesizer driver module can be loaded individually from the OSS
    emulation core before/after it.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

17 May, 2017

1 commit


12 Nov, 2016

1 commit


09 Mar, 2015

1 commit


06 Mar, 2015

1 commit

  • There is a missing lower bound check on "pitchbend" so it means we can
    read up to 6 elements before the start of the opl3_note_table[] array.

    Thanks to Clemens Ladisch for his help with this patch.

    Signed-off-by: Dan Carpenter
    Signed-off-by: Takashi Iwai

    Dan Carpenter
     

12 Feb, 2015

1 commit

  • This patch moves the driver object initialization and allocation to
    each driver's module init/exit code like other normal drivers. The
    snd_seq_driver struct is now published in seq_device.h, and each
    driver is responsible to define it with proper driver attributes
    (name, probe and remove) with snd_seq_driver specific attributes as id
    and argsize fields. The helper functions snd_seq_driver_register(),
    snd_seq_driver_unregister() and module_snd_seq_driver() are used for
    simplifying codes.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

28 Jan, 2015

1 commit


19 Jan, 2015

1 commit


12 Feb, 2014

1 commit


10 Feb, 2014

1 commit

  • Replace the lengthy #if defined(XXX) || defined(XXX_MODULE) with the
    new IS_ENABLED() macro.

    The patch still doesn't cover all ifdefs. For example, the dependency
    on CONFIG_GAMEPORT is still open-coded because this also has an extra
    dependency on MODULE. Similarly, an open-coded ifdef in pcm_oss.c and
    some sequencer-related stuff are left untouched.

    Signed-off-by: Takashi Iwai

    Takashi Iwai
     

29 Oct, 2013

1 commit


06 Oct, 2012

1 commit

  • A simplified version of the semantic patch that finds this problem is as
    follows: (http://coccinelle.lip6.fr/)

    //
    @r1@
    statement S;
    position p,p1;
    @@
    S@p1;@p

    @script:python r2@
    p << r1.p;
    p1 << r1.p1;
    @@
    if p[0].line != p1[0].line_end:
    cocci.include_match(False)
    @@
    position r1.p;
    @@
    -;@p
    //

    Signed-off-by: Peter Senna Tschudin
    Signed-off-by: Takashi Iwai

    Peter Senna Tschudin
     

19 Dec, 2011

1 commit

  • module_param(bool) used to counter-intuitively take an int. In
    fddd5201 (mid-2009) we allowed bool or int/unsigned int using a messy
    trick.

    It's time to remove the int/unsigned int option. For this version
    it'll simply give a warning, but it'll break next kernel version.

    Signed-off-by: Rusty Russell
    Signed-off-by: Takashi Iwai

    Rusty Russell
     

01 Nov, 2011

2 commits


30 Mar, 2010

1 commit

  • …it slab.h inclusion from percpu.h

    percpu.h is included by sched.h and module.h and thus ends up being
    included when building most .c files. percpu.h includes slab.h which
    in turn includes gfp.h making everything defined by the two files
    universally available and complicating inclusion dependencies.

    percpu.h -> slab.h dependency is about to be removed. Prepare for
    this change by updating users of gfp and slab facilities include those
    headers directly instead of assuming availability. As this conversion
    needs to touch large number of source files, the following script is
    used as the basis of conversion.

    http://userweb.kernel.org/~tj/misc/slabh-sweep.py

    The script does the followings.

    * Scan files for gfp and slab usages and update includes such that
    only the necessary includes are there. ie. if only gfp is used,
    gfp.h, if slab is used, slab.h.

    * When the script inserts a new include, it looks at the include
    blocks and try to put the new include such that its order conforms
    to its surrounding. It's put in the include block which contains
    core kernel includes, in the same order that the rest are ordered -
    alphabetical, Christmas tree, rev-Xmas-tree or at the end if there
    doesn't seem to be any matching order.

    * If the script can't find a place to put a new include (mostly
    because the file doesn't have fitting include block), it prints out
    an error message indicating which .h file needs to be added to the
    file.

    The conversion was done in the following steps.

    1. The initial automatic conversion of all .c files updated slightly
    over 4000 files, deleting around 700 includes and adding ~480 gfp.h
    and ~3000 slab.h inclusions. The script emitted errors for ~400
    files.

    2. Each error was manually checked. Some didn't need the inclusion,
    some needed manual addition while adding it to implementation .h or
    embedding .c file was more appropriate for others. This step added
    inclusions to around 150 files.

    3. The script was run again and the output was compared to the edits
    from #2 to make sure no file was left behind.

    4. Several build tests were done and a couple of problems were fixed.
    e.g. lib/decompress_*.c used malloc/free() wrappers around slab
    APIs requiring slab.h to be added manually.

    5. The script was run on all .h files but without automatically
    editing them as sprinkling gfp.h and slab.h inclusions around .h
    files could easily lead to inclusion dependency hell. Most gfp.h
    inclusion directives were ignored as stuff from gfp.h was usually
    wildly available and often used in preprocessor macros. Each
    slab.h inclusion directive was examined and added manually as
    necessary.

    6. percpu.h was updated not to include slab.h.

    7. Build test were done on the following configurations and failures
    were fixed. CONFIG_GCOV_KERNEL was turned off for all tests (as my
    distributed build env didn't work with gcov compiles) and a few
    more options had to be turned off depending on archs to make things
    build (like ipr on powerpc/64 which failed due to missing writeq).

    * x86 and x86_64 UP and SMP allmodconfig and a custom test config.
    * powerpc and powerpc64 SMP allmodconfig
    * sparc and sparc64 SMP allmodconfig
    * ia64 SMP allmodconfig
    * s390 SMP allmodconfig
    * alpha SMP allmodconfig
    * um on x86_64 SMP allmodconfig

    8. percpu.h modifications were reverted so that it could be applied as
    a separate patch and serve as bisection point.

    Given the fact that I had only a couple of failures from tests on step
    6, I'm fairly confident about the coverage of this conversion patch.
    If there is a breakage, it's likely to be something in one of the arch
    headers which should be easily discoverable easily on most builds of
    the specific arch.

    Signed-off-by: Tejun Heo <tj@kernel.org>
    Guess-its-ok-by: Christoph Lameter <cl@linux-foundation.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Lee Schermerhorn <Lee.Schermerhorn@hp.com>

    Tejun Heo
     

08 Oct, 2009

1 commit

  • Fix following circular locking in the opl3 driver.

    =======================================================
    [ INFO: possible circular locking dependency detected ]
    2.6.32-rc3 #87
    -------------------------------------------------------
    swapper/0 is trying to acquire lock:
    (&opl3->voice_lock){..-...}, at: [] snd_opl3_note_off+0x1e/0xe0 [snd_opl3_synth]

    but task is already holding lock:
    (&opl3->sys_timer_lock){..-...}, at: [] snd_opl3_timer_func+0x19/0xc0 [snd_opl3_synth]

    which lock already depends on the new lock.

    the existing dependency chain (in reverse order) is:

    -> #1 (&opl3->sys_timer_lock){..-...}:
    [] validate_chain+0xa25/0x1040
    [] __lock_acquire+0x2da/0xab0
    [] lock_acquire+0x7a/0xa0
    [] _spin_lock_irqsave+0x40/0x60
    [] snd_opl3_note_on+0x686/0x790 [snd_opl3_synth]
    [] snd_midi_process_event+0x322/0x590 [snd_seq_midi_emul]
    [] snd_opl3_synth_event_input+0x15/0x20 [snd_opl3_synth]
    [] snd_seq_deliver_single_event+0x100/0x200 [snd_seq]
    [] snd_seq_deliver_event+0x47/0x1f0 [snd_seq]
    [] snd_seq_dispatch_event+0x3b/0x140 [snd_seq]
    [] snd_seq_check_queue+0x10c/0x120 [snd_seq]
    [] snd_seq_enqueue_event+0x6b/0xe0 [snd_seq]
    [] snd_seq_client_enqueue_event+0xdd/0x100 [snd_seq]
    [] snd_seq_write+0xea/0x190 [snd_seq]
    [] vfs_write+0x96/0x160
    [] sys_write+0x3d/0x70
    [] syscall_call+0x7/0xb

    -> #0 (&opl3->voice_lock){..-...}:
    [] validate_chain+0x1036/0x1040
    [] __lock_acquire+0x2da/0xab0
    [] lock_acquire+0x7a/0xa0
    [] _spin_lock_irqsave+0x40/0x60
    [] snd_opl3_note_off+0x1e/0xe0 [snd_opl3_synth]
    [] snd_opl3_timer_func+0xa0/0xc0 [snd_opl3_synth]
    [] run_timer_softirq+0x166/0x1e0
    [] __do_softirq+0x78/0x110
    [] do_softirq+0x46/0x50
    [] irq_exit+0x36/0x40
    [] do_IRQ+0x42/0xb0
    [] common_interrupt+0x2e/0x40
    [] apm_cpu_idle+0x10f/0x290
    [] cpu_idle+0x21/0x40
    [] rest_init+0x4d/0x60
    [] start_kernel+0x235/0x280
    [] i386_start_kernel+0x66/0x70

    other info that might help us debug this:

    2 locks held by swapper/0:
    #0: (&opl3->tlist){+.-...}, at: [] run_timer_softirq+0xf0/0x1e0
    #1: (&opl3->sys_timer_lock){..-...}, at: [] snd_opl3_timer_func+0x19/0xc0 [snd_opl3_synth]

    stack backtrace:
    Pid: 0, comm: swapper Not tainted 2.6.32-rc3 #87
    Call Trace:
    [] print_circular_bug+0xc8/0xd0
    [] validate_chain+0x1036/0x1040
    [] ? check_usage_forwards+0x54/0xd0
    [] __lock_acquire+0x2da/0xab0
    [] lock_acquire+0x7a/0xa0
    [] ? snd_opl3_note_off+0x1e/0xe0 [snd_opl3_synth]
    [] _spin_lock_irqsave+0x40/0x60
    [] ? snd_opl3_note_off+0x1e/0xe0 [snd_opl3_synth]
    [] snd_opl3_note_off+0x1e/0xe0 [snd_opl3_synth]
    [] ? _spin_lock_irqsave+0x47/0x60
    [] snd_opl3_timer_func+0xa0/0xc0 [snd_opl3_synth]
    [] run_timer_softirq+0x166/0x1e0
    [] ? run_timer_softirq+0xf0/0x1e0
    [] ? snd_opl3_timer_func+0x0/0xc0 [snd_opl3_synth]
    [] __do_softirq+0x78/0x110
    [] ? _spin_unlock+0x1d/0x20
    [] ? handle_level_irq+0xaf/0xe0
    [] do_softirq+0x46/0x50
    [] irq_exit+0x36/0x40
    [] do_IRQ+0x42/0xb0
    [] ? trace_hardirqs_on_caller+0x12c/0x180
    [] common_interrupt+0x2e/0x40
    [] ? default_idle+0x38/0x50
    [] apm_cpu_idle+0x10f/0x290
    [] cpu_idle+0x21/0x40
    [] rest_init+0x4d/0x60
    [] start_kernel+0x235/0x280
    [] ? unknown_bootoption+0x0/0x210
    [] i386_start_kernel+0x66/0x70

    Signed-off-by: Krzysztof Helt
    Signed-off-by: Takashi Iwai

    Krzysztof Helt
     

29 May, 2009

1 commit


05 Feb, 2009

1 commit


13 Aug, 2008

1 commit


23 Feb, 2008

1 commit


01 Feb, 2008

3 commits


20 Oct, 2007

1 commit


16 Oct, 2007

2 commits


23 Jun, 2006

3 commits


22 Mar, 2006

2 commits


25 Feb, 2006

1 commit


04 Jan, 2006

1 commit