/* * helper functions for HDMI models (Xonar HDAV1.3/HDAV1.3 Slim) * * Copyright (c) Clemens Ladisch * * * This driver is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2. * * This driver is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this driver; if not, see . */ #include #include #include #include #include #include #include #include #include "xonar.h" static void hdmi_write_command(struct oxygen *chip, u8 command, unsigned int count, const u8 *params) { unsigned int i; u8 checksum; oxygen_write_uart(chip, 0xfb); oxygen_write_uart(chip, 0xef); oxygen_write_uart(chip, command); oxygen_write_uart(chip, count); for (i = 0; i < count; ++i) oxygen_write_uart(chip, params[i]); checksum = 0xfb + 0xef + command + count; for (i = 0; i < count; ++i) checksum += params[i]; oxygen_write_uart(chip, checksum); } static void xonar_hdmi_init_commands(struct oxygen *chip, struct xonar_hdmi *hdmi) { u8 param; oxygen_reset_uart(chip); param = 0; hdmi_write_command(chip, 0x61, 1, ¶m); param = 1; hdmi_write_command(chip, 0x74, 1, ¶m); hdmi_write_command(chip, 0x54, 5, hdmi->params); } void xonar_hdmi_init(struct oxygen *chip, struct xonar_hdmi *hdmi) { hdmi->params[1] = IEC958_AES3_CON_FS_48000; hdmi->params[4] = 1; xonar_hdmi_init_commands(chip, hdmi); } void xonar_hdmi_cleanup(struct oxygen *chip) { u8 param = 0; hdmi_write_command(chip, 0x74, 1, ¶m); } void xonar_hdmi_resume(struct oxygen *chip, struct xonar_hdmi *hdmi) { xonar_hdmi_init_commands(chip, hdmi); } void xonar_hdmi_pcm_hardware_filter(unsigned int channel, struct snd_pcm_hardware *hardware) { if (channel == PCM_MULTICH) { hardware->rates = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000; hardware->rate_min = 44100; } } void xonar_set_hdmi_params(struct oxygen *chip, struct xonar_hdmi *hdmi, struct snd_pcm_hw_params *params) { hdmi->params[0] = 0; /* 1 = non-audio */ switch (params_rate(params)) { case 44100: hdmi->params[1] = IEC958_AES3_CON_FS_44100; break; case 48000: hdmi->params[1] = IEC958_AES3_CON_FS_48000; break; default: /* 96000 */ hdmi->params[1] = IEC958_AES3_CON_FS_96000; break; case 192000: hdmi->params[1] = IEC958_AES3_CON_FS_192000; break; } hdmi->params[2] = params_channels(params) / 2 - 1; if (params_format(params) == SNDRV_PCM_FORMAT_S16_LE) hdmi->params[3] = 0; else hdmi->params[3] = 0xc0; hdmi->params[4] = 1; /* ? */ hdmi_write_command(chip, 0x54, 5, hdmi->params); } void xonar_hdmi_uart_input(struct oxygen *chip) { if (chip->uart_input_count >= 2 && chip->uart_input[chip->uart_input_count - 2] == 'O' && chip->uart_input[chip->uart_input_count - 1] == 'K') { dev_dbg(chip->card->dev, "message from HDMI chip received:\n"); print_hex_dump_bytes("", DUMP_PREFIX_OFFSET, chip->uart_input, chip->uart_input_count); chip->uart_input_count = 0; } } 8bd43cd&id2=d98e0929071e7ef63d35c1838b0ad0805ae366dd'>pcsp/pcsp_input.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/drivers/pcsp/pcsp_input.c')
n='2' class='oid'>a76a82a3e38c8d3fb6499e3dfaeb0949241ab588 (patch)
treeb5bc906278fe1ac66d75de984d26bf59b43b3ed8 /tools/testing/selftests/powerpc/dscr/dscr_inherit_test.c
parent566cf877a1fcb6d6dc0126b076aad062054c2637 (diff)
perf/core: Fix use-after-free bug
Dmitry reported a KASAN use-after-free on event->group_leader. It turns out there's a hole in perf_remove_from_context() due to event_function_call() not calling its function when the task associated with the event is already dead. In this case the event will have been detached from the task, but the grouping will have been retained, such that group operations might still work properly while there are live child events etc. This does however mean that we can miss a perf_group_detach() call when the group decomposes, this in turn can then lead to use-after-free. Fix it by explicitly doing the group detach if its still required. Reported-by: Dmitry Vyukov <dvyukov@google.com> Tested-by: Dmitry Vyukov <dvyukov@google.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com> Cc: Arnaldo Carvalho de Melo <acme@kernel.org> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: stable@vger.kernel.org # v4.5+ Cc: syzkaller <syzkaller@googlegroups.com> Fixes: 63b6da39bb38 ("perf: Fix perf_event_exit_task() race") Link: http://lkml.kernel.org/r/20170126153955.GD6515@twins.programming.kicks-ass.net Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/testing/selftests/powerpc/dscr/dscr_inherit_test.c')