From 1b9eb6b14afa9ffa96bd1245b1dc6ec9e4d86bbe Mon Sep 17 00:00:00 2001 From: Daniel Mack Date: Fri, 9 Jan 2015 19:03:34 +0100 Subject: [PATCH] names: fix total length of kvecs Don't let kdbus_pool_slice_alloc() copy the kvecs along with allocating the slice. The problem is that we only want to copy the header of the block in this case, which doesn't work when the implicit behavior is used. Hence, open-code the functionality. Fixes an Ooops on 3.19-rc3. Signed-off-by: Daniel Mack --- names.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/names.c b/names.c index 95d435f..9af3a69 100644 --- a/names.c +++ b/names.c @@ -862,13 +862,17 @@ int kdbus_cmd_name_list(struct kdbus_name_registry *reg, kvec.iov_base = &list; kvec.iov_len = sizeof(list); - slice = kdbus_pool_slice_alloc(conn->pool, list.size, &kvec, NULL, 1); + slice = kdbus_pool_slice_alloc(conn->pool, list.size, NULL, NULL, 0); if (IS_ERR(slice)) { ret = PTR_ERR(slice); slice = NULL; goto exit_unlock; } + ret = kdbus_pool_slice_copy_kvec(slice, 0, &kvec, 1, kvec.iov_len); + if (ret < 0) + goto exit_unlock; + /* copy the records */ pos = sizeof(struct kdbus_name_list); ret = kdbus_name_list_all(conn, cmd->flags, slice, &pos, true); -- 2.34.1