[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201214170722.hzv3lc3iqk2p6rsv@steredhat>
Date: Mon, 14 Dec 2020 18:07:22 +0100
From: Stefano Garzarella <sgarzare@...hat.com>
To: Andra Paraschiv <andraprs@...zon.com>
Cc: netdev <netdev@...r.kernel.org>,
linux-kernel <linux-kernel@...r.kernel.org>,
"David S . Miller" <davem@...emloft.net>,
David Duncan <davdunc@...zon.com>,
Dexuan Cui <decui@...rosoft.com>,
Alexander Graf <graf@...zon.de>,
Jorgen Hansen <jhansen@...are.com>,
Jakub Kicinski <kuba@...nel.org>,
Stefan Hajnoczi <stefanha@...hat.com>,
Vitaly Kuznetsov <vkuznets@...hat.com>
Subject: Re: [PATCH net-next v4 3/5] vsock_addr: Check for supported flag
values
On Mon, Dec 14, 2020 at 06:11:20PM +0200, Andra Paraschiv wrote:
>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@...zon.com>
>---
> net/vmw_vsock/vsock_addr.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by: Stefano Garzarella <sgarzare@...hat.com>
>
>diff --git a/net/vmw_vsock/vsock_addr.c b/net/vmw_vsock/vsock_addr.c
>index 909de26cb0e70..223b9660a759f 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;
>--
>2.20.1 (Apple Git-117)
>
>
>
>
>Amazon Development Center (Romania) S.R.L. registered office: 27A Sf. Lazar Street, UBC5, floor 2, Iasi, Iasi County, 700045, Romania. Registered in Romania. Registration number J22/2621/2005.
>
Powered by blists - more mailing lists