/* * Copyright 2015, Michael Ellerman, IBM Corp. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. * * This test simply tests that certain syscalls are implemented. It doesn't * actually exercise their logic in any way. */ #define _GNU_SOURCE #include #include #include #include #include "utils.h" #define DO_TEST(_name, _num) \ static int test_##_name(void) \ { \ int rc; \ printf("Testing " #_name); \ errno = 0; \ rc = syscall(_num, -1, 0, 0, 0, 0, 0); \ printf("\treturned %d, errno %d\n", rc, errno); \ return errno == ENOSYS; \ } #include "ipc.h" #undef DO_TEST static int ipc_unmuxed(void) { int tests_done = 0; #define DO_TEST(_name, _num) \ FAIL_IF(test_##_name()); \ tests_done++; #include "ipc.h" #undef DO_TEST /* * If we ran no tests then it means none of the syscall numbers were * defined, possibly because we were built against old headers. But it * means we didn't really test anything, so instead of passing mark it * as a skip to give the user a clue. */ SKIP_IF(tests_done == 0); return 0; } int main(void) { return test_harness(ipc_unmuxed, "ipc_unmuxed"); } nput type='submit' value='switch'/> net-next plumbingsTobias Klauser
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRui Miguel Silva <rmfrfs@gmail.com>2017-01-23 16:32:57 +0000
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-25 11:36:59 +0100
commitb17c1bba9cec1727451b906d9a0c209774624873 (patch)
treef0a0f51d405c884e23f695695858d85f6260fec0 /drivers/usb/serial/metro-usb.c
parent9579c4dc21292f375715d7acca439dac9855b3e9 (diff)
staging: greybus: timesync: validate platform state callback
When tearingdown timesync, and not in arche platform, the state platform callback is not initialized. That will trigger the following NULL dereferencing. CallTrace: ? gb_timesync_platform_unlock_bus+0x11/0x20 [greybus] gb_timesync_teardown+0x85/0xc0 [greybus] gb_timesync_svc_remove+0xab/0x190 [greybus] gb_svc_del+0x29/0x110 [greybus] gb_hd_del+0x14/0x20 [greybus] ap_disconnect+0x24/0x60 [gb_es2] usb_unbind_interface+0x7a/0x2c0 __device_release_driver+0x96/0x150 device_release_driver+0x1e/0x30 bus_remove_device+0xe7/0x130 device_del+0x116/0x230 usb_disable_device+0x97/0x1f0 usb_disconnect+0x80/0x260 hub_event+0x5ca/0x10e0 process_one_work+0x126/0x3b0 worker_thread+0x55/0x4c0 ? process_one_work+0x3b0/0x3b0 kthread+0xc4/0xe0 ? kthread_park+0xb0/0xb0 ret_from_fork+0x22/0x30 So, fix that by adding checks before use the callback. Fixes: 970dc85bd95d ("greybus: timesync: Add timesync core driver") Cc: <stable@vger.kernel.org> # 4.9.x Signed-off-by: Rui Miguel Silva <rmfrfs@gmail.com> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Johan Hovold <johan@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/serial/metro-usb.c')