From: Daniel Mack Date: Fri, 9 Jan 2015 18:03:34 +0000 (+0100) Subject: names: fix total length of kvecs X-Git-Tag: upstream/0.20150129.081441utc~53 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=1b9eb6b14afa9ffa96bd1245b1dc6ec9e4d86bbe;p=platform%2Fcore%2Fsystem%2Fkdbus-bus.git 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 --- 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);