From a4e81d806e1e80004bea313ba015bd524c2a121b Mon Sep 17 00:00:00 2001 From: Djalal Harouni Date: Tue, 5 Aug 2014 02:09:09 +0100 Subject: [PATCH] handle: return -EOPNOTSUPP instead of -EPERM if an operation is not supported If userspace calls in with the wrong connection type, just return -EOPNOTSUPP instead of -EPERM. This will not confuse unprivileged and privileged processes, and permits to identify legitimate -EPERM errors. This just converts errors introduced in commit 7015a1e6746 Signed-off-by: Djalal Harouni --- handle.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/handle.c b/handle.c index 4b8376c..2e6502b 100644 --- a/handle.c +++ b/handle.c @@ -537,7 +537,7 @@ static long kdbus_handle_ioctl_ep_connected(struct file *file, unsigned int cmd, switch (cmd) { case KDBUS_CMD_BYEBYE: if (conn->type != KDBUS_CONN_CONNECTED) { - ret = -EPERM; + ret = -EOPNOTSUPP; break; } @@ -548,7 +548,7 @@ static long kdbus_handle_ioctl_ep_connected(struct file *file, unsigned int cmd, /* acquire a well-known name */ if (conn->type != KDBUS_CONN_CONNECTED) { - ret = -EPERM; + ret = -EOPNOTSUPP; break; } @@ -573,7 +573,7 @@ static long kdbus_handle_ioctl_ep_connected(struct file *file, unsigned int cmd, /* release a well-known name */ if (conn->type != KDBUS_CONN_CONNECTED) { - ret = -EPERM; + ret = -EOPNOTSUPP; break; } @@ -638,7 +638,7 @@ static long kdbus_handle_ioctl_ep_connected(struct file *file, unsigned int cmd, /* update the properties of a connection */ if (conn->type != KDBUS_CONN_CONNECTED) { - ret = -EPERM; + ret = -EOPNOTSUPP; break; } @@ -657,7 +657,7 @@ static long kdbus_handle_ioctl_ep_connected(struct file *file, unsigned int cmd, if (conn->type != KDBUS_CONN_CONNECTED && conn->type != KDBUS_CONN_MONITOR) { - ret = -EPERM; + ret = -EOPNOTSUPP; break; } @@ -676,7 +676,7 @@ static long kdbus_handle_ioctl_ep_connected(struct file *file, unsigned int cmd, if (conn->type != KDBUS_CONN_CONNECTED && conn->type != KDBUS_CONN_MONITOR) { - ret = -EPERM; + ret = -EOPNOTSUPP; break; } @@ -694,7 +694,7 @@ static long kdbus_handle_ioctl_ep_connected(struct file *file, unsigned int cmd, struct kdbus_kmsg *kmsg = NULL; if (conn->type != KDBUS_CONN_CONNECTED) { - ret = -EPERM; + ret = -EOPNOTSUPP; break; } @@ -727,7 +727,7 @@ static long kdbus_handle_ioctl_ep_connected(struct file *file, unsigned int cmd, if (conn->type != KDBUS_CONN_CONNECTED && conn->type != KDBUS_CONN_MONITOR) { - ret = -EPERM; + ret = -EOPNOTSUPP; break; } @@ -754,7 +754,7 @@ static long kdbus_handle_ioctl_ep_connected(struct file *file, unsigned int cmd, u64 cookie; if (conn->type != KDBUS_CONN_CONNECTED) { - ret = -EPERM; + ret = -EOPNOTSUPP; break; } @@ -775,7 +775,7 @@ static long kdbus_handle_ioctl_ep_connected(struct file *file, unsigned int cmd, if (conn->type != KDBUS_CONN_CONNECTED && conn->type != KDBUS_CONN_MONITOR) { - ret = -EPERM; + ret = -EOPNOTSUPP; break; } -- 2.34.1