diff mbox series

[2/2] vsock: fix the error return when an invalid ioctl command is used

Message ID 20201027090942.14916-3-colin.king@canonical.com
State New
Headers show
Series vsock: minor clean up of ioctl error handling | expand

Commit Message

Colin King Oct. 27, 2020, 9:09 a.m. UTC
From: Colin Ian King <colin.king@canonical.com>

Currently when an invalid ioctl command is used the error return
is -EINVAL.  Fix this by returning the correct error -ENOIOCTLCMD.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 net/vmw_vsock/af_vsock.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stefano Garzarella Oct. 27, 2020, 9:18 a.m. UTC | #1
On Tue, Oct 27, 2020 at 09:09:42AM +0000, Colin King wrote:
>From: Colin Ian King <colin.king@canonical.com>

>

>Currently when an invalid ioctl command is used the error return

>is -EINVAL.  Fix this by returning the correct error -ENOIOCTLCMD.

>

>Signed-off-by: Colin Ian King <colin.king@canonical.com>

>---

> net/vmw_vsock/af_vsock.c | 2 +-

> 1 file changed, 1 insertion(+), 1 deletion(-)


Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>


>

>diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c

>index 865331b809e4..597c86413089 100644

>--- a/net/vmw_vsock/af_vsock.c

>+++ b/net/vmw_vsock/af_vsock.c

>@@ -2072,7 +2072,7 @@ static long vsock_dev_do_ioctl(struct file *filp,

> 		break;

>

> 	default:

>-		retval = -EINVAL;

>+		retval = -ENOIOCTLCMD;

> 	}

>

> 	return retval;

>-- 

>2.27.0

>
diff mbox series

Patch

diff --git a/net/vmw_vsock/af_vsock.c b/net/vmw_vsock/af_vsock.c
index 865331b809e4..597c86413089 100644
--- a/net/vmw_vsock/af_vsock.c
+++ b/net/vmw_vsock/af_vsock.c
@@ -2072,7 +2072,7 @@  static long vsock_dev_do_ioctl(struct file *filp,
 		break;
 
 	default:
-		retval = -EINVAL;
+		retval = -ENOIOCTLCMD;
 	}
 
 	return retval;