[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 27/34] can-host: Fix crash when 'canbus' property is not set
From: |
Kevin Wolf |
Subject: |
[PULL 27/34] can-host: Fix crash when 'canbus' property is not set |
Date: |
Fri, 11 Dec 2020 18:08:05 +0100 |
Providing the 'if' property, but not 'canbus' segfaults like this:
#0 0x0000555555b0f14d in can_bus_insert_client (bus=0x0,
client=0x555556aa9af0) at ../net/can/can_core.c:88
#1 0x00005555559c3803 in can_host_connect (ch=0x555556aa9ac0,
errp=0x7fffffffd568) at ../net/can/can_host.c:62
#2 0x00005555559c386a in can_host_complete (uc=0x555556aa9ac0,
errp=0x7fffffffd568) at ../net/can/can_host.c:72
#3 0x0000555555d52de9 in user_creatable_complete (uc=0x555556aa9ac0,
errp=0x7fffffffd5c8) at ../qom/object_interfaces.c:23
Add the missing NULL check.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20201130105615.21799-5-kwolf@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
net/can/can_host.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/net/can/can_host.c b/net/can/can_host.c
index be4547d913..ba7f163d0a 100644
--- a/net/can/can_host.c
+++ b/net/can/can_host.c
@@ -53,6 +53,11 @@ static void can_host_connect(CanHostState *ch, Error **errp)
CanHostClass *chc = CAN_HOST_GET_CLASS(ch);
Error *local_err = NULL;
+ if (ch->bus == NULL) {
+ error_setg(errp, "'canbus' property not set");
+ return;
+ }
+
chc->connect(ch, &local_err);
if (local_err) {
error_propagate(errp, local_err);
--
2.29.2
- [PULL 15/34] iotests: Derive image names from $TEST_IMG, (continued)
- [PULL 15/34] iotests: Derive image names from $TEST_IMG, Kevin Wolf, 2020/12/11
- [PULL 14/34] iotests/046: Avoid renaming images, Kevin Wolf, 2020/12/11
- [PULL 17/34] iotests: Restrict some Python tests to file, Kevin Wolf, 2020/12/11
- [PULL 18/34] iotests: Let _make_test_img guess $TEST_IMG_FILE, Kevin Wolf, 2020/12/11
- [PULL 20/34] storage-daemon: Call bdrv_close_all() on exit, Kevin Wolf, 2020/12/11
- [PULL 16/34] iotests/091: Use _cleanup_qemu instad of "wait", Kevin Wolf, 2020/12/11
- [PULL 26/34] iotests/221: Discard image before qemu-img map, Kevin Wolf, 2020/12/11
- [PULL 24/34] iotests/308: Add test for FUSE exports, Kevin Wolf, 2020/12/11
- [PULL 19/34] iotests/287: Clean up subshell test image, Kevin Wolf, 2020/12/11
- [PULL 25/34] file-posix: check the use_lock before setting the file lock, Kevin Wolf, 2020/12/11
- [PULL 27/34] can-host: Fix crash when 'canbus' property is not set,
Kevin Wolf <=
- [PULL 22/34] iotests: Allow testing FUSE exports, Kevin Wolf, 2020/12/11
- [PULL 21/34] iotests: Give access to the qemu-storage-daemon, Kevin Wolf, 2020/12/11
- [PULL 23/34] iotests: Enable fuse for many tests, Kevin Wolf, 2020/12/11
- [PULL 28/34] block/file-posix: fix workaround in raw_do_pwrite_zeroes(), Kevin Wolf, 2020/12/11
- [PULL 29/34] block/io: bdrv_refresh_limits(): use ERRP_GUARD, Kevin Wolf, 2020/12/11
- [PULL 31/34] block: introduce BDRV_MAX_LENGTH, Kevin Wolf, 2020/12/11
- [PULL 34/34] block: Fix deadlock in bdrv_co_yield_to_drain(), Kevin Wolf, 2020/12/11
- [PULL 32/34] block: Simplify qmp_block_resize() error paths, Kevin Wolf, 2020/12/11
- [PULL 33/34] block: Fix locking in qmp_block_resize(), Kevin Wolf, 2020/12/11
- [PULL 30/34] block/io: bdrv_check_byte_request(): drop bdrv_is_inserted(), Kevin Wolf, 2020/12/11