All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dbus: Use KDBUS_CMD_FREE after kdbus hello
@ 2016-04-01  2:41 Andrew Zaborowski
  2016-04-01  2:41 ` [PATCH] dbus: Return the bloom parameters in _dbus_kernel_hello Andrew Zaborowski
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Andrew Zaborowski @ 2016-04-01  2:41 UTC (permalink / raw)
  To: ell

[-- Attachment #1: Type: text/plain, Size: 1730 bytes --]

---
 ell/dbus-kernel.c | 25 +++++++++++++++++++------
 1 file changed, 19 insertions(+), 6 deletions(-)

diff --git a/ell/dbus-kernel.c b/ell/dbus-kernel.c
index 9bc99d7..1c0fbb6 100644
--- a/ell/dbus-kernel.c
+++ b/ell/dbus-kernel.c
@@ -237,6 +237,7 @@ int _dbus_kernel_hello(int fd, const char *connection_name,
 	struct kdbus_cmd_hello *hello;
 	struct kdbus_item *item;
 	int ret;
+	struct kdbus_cmd_free cmd_free;
 
 	size = align_len(sizeof(struct kdbus_cmd_hello), 8);
 	size += KDBUS_ITEM_SIZE(len + 1);
@@ -256,18 +257,23 @@ int _dbus_kernel_hello(int fd, const char *connection_name,
 	strcpy(item->str, connection_name);
 
 	ret = ioctl(fd, KDBUS_CMD_HELLO, hello);
-	if (ret < 0)
-		return -errno;
+	if (ret < 0) {
+		ret = -errno;
+		goto done;
+	}
 
         /* Check for incompatible flags (upper 32 bits) */
         if (hello->bus_flags > 0xFFFFFFFFULL ||
-			hello->flags > 0xFFFFFFFFULL)
-                return -ENOTSUP;
+			hello->flags > 0xFFFFFFFFULL) {
+		ret = -ENOTSUP;
+		goto done;
+	}
 
 	*pool = mmap(NULL, KDBUS_POOL_SIZE, PROT_READ, MAP_SHARED, fd, 0);
 	if (*pool == MAP_FAILED) {
 		*pool = NULL;
-		return -errno;
+		ret = -errno;
+		goto done;
 	}
 
 	*bloom_size = DEFAULT_BLOOM_SIZE;
@@ -286,7 +292,14 @@ int _dbus_kernel_hello(int fd, const char *connection_name,
 				hello->id128[12], hello->id128[13],
 				hello->id128[14], hello->id128[15]);
 
-	return 0;
+done:
+	memset(&cmd_free, 0, sizeof(cmd_free));
+	cmd_free.size = sizeof(cmd_free);
+	cmd_free.offset = hello->offset;
+
+	ioctl(fd, KDBUS_CMD_FREE, &cmd_free);
+
+	return ret;
 }
 
 int _dbus_kernel_send(int fd, size_t bloom_size, uint8_t bloom_n_hash,
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2016-04-04 19:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-04-01  2:41 [PATCH] dbus: Use KDBUS_CMD_FREE after kdbus hello Andrew Zaborowski
2016-04-01  2:41 ` [PATCH] dbus: Return the bloom parameters in _dbus_kernel_hello Andrew Zaborowski
2016-04-04 19:22   ` Denis Kenzior
2016-04-01  2:41 ` [PATCH] dbus: Set a 30s kdbus method call timeout Andrew Zaborowski
2016-04-04 19:22   ` Denis Kenzior
2016-04-01  2:41 ` [PATCH] dbus: Fix _dbus_kernel_calculate_bloom for multiple arguments Andrew Zaborowski
2016-04-04 19:22   ` Denis Kenzior
2016-04-04 19:22 ` [PATCH] dbus: Use KDBUS_CMD_FREE after kdbus hello Denis Kenzior

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.