aboutsummaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorAndra Paraschiv2020-12-14 18:11:20 +0200
committerJakub Kicinski2020-12-14 19:33:39 -0800
commitcada7ccd9dc75fc73de9342ae1dd0374e8fb1056 (patch)
treed8d8aacf674acabf6f46f028627cf6e5ac7b00d9 /net
parentcaaf95e0f23f9ed240b02251aab0f6fdb652b33d (diff)
vsock_addr: Check for supported flag values
Check if the provided flags value from the vsock address data structure includes the supported flags in the corresponding kernel version. The first byte of the "svm_zero" field is used as "svm_flags", so add the flags check instead. Changelog v3 -> v4 * New patch in v4. Signed-off-by: Andra Paraschiv <andraprs@amazon.com> Reviewed-by: Stefano Garzarella <sgarzare@redhat.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/vmw_vsock/vsock_addr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/net/vmw_vsock/vsock_addr.c b/net/vmw_vsock/vsock_addr.c
index 909de26cb0e7..223b9660a759 100644
--- a/net/vmw_vsock/vsock_addr.c
+++ b/net/vmw_vsock/vsock_addr.c
@@ -22,13 +22,15 @@ EXPORT_SYMBOL_GPL(vsock_addr_init);
int vsock_addr_validate(const struct sockaddr_vm *addr)
{
+ __u8 svm_valid_flags = VMADDR_FLAG_TO_HOST;
+
if (!addr)
return -EFAULT;
if (addr->svm_family != AF_VSOCK)
return -EAFNOSUPPORT;
- if (addr->svm_zero[0] != 0)
+ if (addr->svm_flags & ~svm_valid_flags)
return -EINVAL;
return 0;