connection: only one KDBUS_ITEM_CANCEL_FD item is allowed
authorDjalal Harouni <tixxdz@opendz.org>
Sun, 21 Dec 2014 19:14:37 +0000 (20:14 +0100)
committerDjalal Harouni <tixxdz@opendz.org>
Sun, 21 Dec 2014 19:14:37 +0000 (20:14 +0100)
Make sure that only one KDBUS_ITEM_CANCEL_FD item is passed.

Signed-off-by: Djalal Harouni <tixxdz@opendz.org>
connection.c

index 7045d92a3b372465f35c51e554b7710b36e0c83a..a0f749a7e10a5b6237bb4a9a94a895e8e89be607 100644 (file)
@@ -799,6 +799,11 @@ int kdbus_cmd_msg_send(struct kdbus_conn *conn_src,
                        break;
 
                case KDBUS_ITEM_CANCEL_FD:
+                       if (cancel_fd) {
+                               ret = -EEXIST;
+                               goto exit_put_cancelfd;
+                       }
+
                        cancel_fd = fget(item->fds[0]);
                        if (IS_ERR(cancel_fd))
                                return PTR_ERR(cancel_fd);