summaryrefslogtreecommitdiff
path: root/handle.c
diff options
context:
space:
mode:
authorDaniel Mack <daniel@zonque.org>2014-12-08 10:28:00 +0100
committerDaniel Mack <daniel@zonque.org>2014-12-08 10:28:00 +0100
commit3b2fffd644e009aa93b4554ace4276244b44bfd4 (patch)
tree0ed5b263b4c578636e15178b178d004585c65fe3 /handle.c
parent939db15e726af38eb5978f1aa1927634e9118cdb (diff)
downloadkdbus-bus-3b2fffd644e009aa93b4554ace4276244b44bfd4.tar.gz
kdbus-bus-3b2fffd644e009aa93b4554ace4276244b44bfd4.tar.bz2
kdbus-bus-3b2fffd644e009aa93b4554ace4276244b44bfd4.zip
resources: make sure vec sources are not accessed illegally
VEC source addresses are no longer valid after the SEND ioctl returns. Add a boolean flag to track that, and BUG_ON() in case someone calls kdbus_kmsg_make_vec_slice() from invalid contexts. Signed-off-by: Daniel Mack <daniel@zonque.org>
Diffstat (limited to 'handle.c')
-rw-r--r--handle.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/handle.c b/handle.c
index 68ac7ae1010..de5c4f057cd 100644
--- a/handle.c
+++ b/handle.c
@@ -615,6 +615,12 @@ static long handle_ep_ioctl_connected(struct file *file, unsigned int cmd,
ret = -EFAULT;
}
+ /*
+ * Once the ioctl returns, the src_addr pointers stored in
+ * the message resources are no longer valid. Make sure
+ * nobody accesses them by accident.
+ */
+ kmsg->res->vec_src_valid = false;
kdbus_kmsg_free(kmsg);
break;
}