All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 1/1] driver: ipvlan: Add the sanity check for ipvlan mode
@ 2016-11-28 13:23 fgao
  2016-11-28 19:08 ` Mahesh Bandewar (महेश बंडेवार)
       [not found] ` <CAF2d9ji2_JhiNv9P9aUt7wV2Vfjv+z_q-MWSKKH8tzO_1THobg@mail.gmail.com>
  0 siblings, 2 replies; 4+ messages in thread
From: fgao @ 2016-11-28 13:23 UTC (permalink / raw)
  To: davem, maheshb, edumazet, netdev, gfree.wind; +Cc: Gao Feng

From: Gao Feng <fgao@ikuai8.com>

The ipvlan mode variable "nval" is from userspace, so the ipvlan codes
should check if the mode variable "nval" is valid.

Signed-off-by: Gao Feng <fgao@ikuai8.com>
---
 drivers/net/ipvlan/ipvlan_main.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
index ab90b22..537b5a9 100644
--- a/drivers/net/ipvlan/ipvlan_main.c
+++ b/drivers/net/ipvlan/ipvlan_main.c
@@ -65,6 +65,9 @@ static int ipvlan_set_port_mode(struct ipvl_port *port, u16 nval)
 	struct net_device *mdev = port->dev;
 	int err = 0;
 
+	if (nval >= IPVLAN_MODE_MAX)
+		return -EINVAL;
+
 	ASSERT_RTNL();
 	if (port->mode != nval) {
 		if (nval == IPVLAN_MODE_L3S) {
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 1/1] driver: ipvlan: Add the sanity check for ipvlan mode
  2016-11-28 13:23 [PATCH net-next 1/1] driver: ipvlan: Add the sanity check for ipvlan mode fgao
@ 2016-11-28 19:08 ` Mahesh Bandewar (महेश बंडेवार)
       [not found] ` <CAF2d9ji2_JhiNv9P9aUt7wV2Vfjv+z_q-MWSKKH8tzO_1THobg@mail.gmail.com>
  1 sibling, 0 replies; 4+ messages in thread
From: Mahesh Bandewar (महेश बंडेवार) @ 2016-11-28 19:08 UTC (permalink / raw)
  To: fgao; +Cc: David Miller, Eric Dumazet, linux-netdev, gfree.wind

On Mon, Nov 28, 2016 at 5:23 AM,  <fgao@ikuai8.com> wrote:
> From: Gao Feng <fgao@ikuai8.com>
>
> The ipvlan mode variable "nval" is from userspace, so the ipvlan codes
> should check if the mode variable "nval" is valid.
>
> Signed-off-by: Gao Feng <fgao@ikuai8.com>
> ---
>  drivers/net/ipvlan/ipvlan_main.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_main.c
> index ab90b22..537b5a9 100644
> --- a/drivers/net/ipvlan/ipvlan_main.c
> +++ b/drivers/net/ipvlan/ipvlan_main.c
> @@ -65,6 +65,9 @@ static int ipvlan_set_port_mode(struct ipvl_port *port, u16 nval)
>         struct net_device *mdev = port->dev;
>         int err = 0;
>
> +       if (nval >= IPVLAN_MODE_MAX)
> +               return -EINVAL;
> +
I'm curious to know how you encountered this issue? The values are
validated in ipvlan_nl_validate() and it should fail at that time
itself.
>         ASSERT_RTNL();
>         if (port->mode != nval) {
>                 if (nval == IPVLAN_MODE_L3S) {
> --
> 1.9.1
>
>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 1/1] driver: ipvlan: Add the sanity check for ipvlan mode
       [not found] ` <CAF2d9ji2_JhiNv9P9aUt7wV2Vfjv+z_q-MWSKKH8tzO_1THobg@mail.gmail.com>
@ 2016-11-28 20:08   ` David Miller
  2016-11-29  1:06     ` Feng Gao
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2016-11-28 20:08 UTC (permalink / raw)
  To: maheshb; +Cc: fgao, edumazet, netdev, gfree.wind

From: Mahesh Bandewar (महेश बंडेवार) <maheshb@google.com>
Date: Mon, 28 Nov 2016 11:02:45 -0800

> On Mon, Nov 28, 2016 at 5:23 AM, <fgao@ikuai8.com> wrote:
> 
>> From: Gao Feng <fgao@ikuai8.com>
>>
>> The ipvlan mode variable "nval" is from userspace, so the ipvlan codes
>> should check if the mode variable "nval" is valid.
>>
>> Signed-off-by: Gao Feng <fgao@ikuai8.com>
>> ---
>>  drivers/net/ipvlan/ipvlan_main.c | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_
>> main.c
>> index ab90b22..537b5a9 100644
>> --- a/drivers/net/ipvlan/ipvlan_main.c
>> +++ b/drivers/net/ipvlan/ipvlan_main.c
>> @@ -65,6 +65,9 @@ static int ipvlan_set_port_mode(struct ipvl_port *port,
>> u16 nval)
>>         struct net_device *mdev = port->dev;
>>         int err = 0;
>>
>> +       if (nval >= IPVLAN_MODE_MAX)
>> +               return -EINVAL;
>> +
>>
> I'm curious to know how you encountered this issue? The values are
> validated in ipvlan_nl_validate() and it should fail at that time itself.

I'm not applying this without at least a better explanation.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next 1/1] driver: ipvlan: Add the sanity check for ipvlan mode
  2016-11-28 20:08   ` David Miller
@ 2016-11-29  1:06     ` Feng Gao
  0 siblings, 0 replies; 4+ messages in thread
From: Feng Gao @ 2016-11-29  1:06 UTC (permalink / raw)
  To: David Miller
  Cc: Mahesh Bandewar, Eric Dumazet, Linux Kernel Network Developers

Hi David & Mahesh,

On Tue, Nov 29, 2016 at 4:08 AM, David Miller <davem@davemloft.net> wrote:
> From: Mahesh Bandewar (महेश बंडेवार) <maheshb@google.com>
> Date: Mon, 28 Nov 2016 11:02:45 -0800
>
>> On Mon, Nov 28, 2016 at 5:23 AM, <fgao@ikuai8.com> wrote:
>>
>>> From: Gao Feng <fgao@ikuai8.com>
>>>
>>> The ipvlan mode variable "nval" is from userspace, so the ipvlan codes
>>> should check if the mode variable "nval" is valid.
>>>
>>> Signed-off-by: Gao Feng <fgao@ikuai8.com>
>>> ---
>>>  drivers/net/ipvlan/ipvlan_main.c | 3 +++
>>>  1 file changed, 3 insertions(+)
>>>
>>> diff --git a/drivers/net/ipvlan/ipvlan_main.c b/drivers/net/ipvlan/ipvlan_
>>> main.c
>>> index ab90b22..537b5a9 100644
>>> --- a/drivers/net/ipvlan/ipvlan_main.c
>>> +++ b/drivers/net/ipvlan/ipvlan_main.c
>>> @@ -65,6 +65,9 @@ static int ipvlan_set_port_mode(struct ipvl_port *port,
>>> u16 nval)
>>>         struct net_device *mdev = port->dev;
>>>         int err = 0;
>>>
>>> +       if (nval >= IPVLAN_MODE_MAX)
>>> +               return -EINVAL;
>>> +
>>>
>> I'm curious to know how you encountered this issue? The values are
>> validated in ipvlan_nl_validate() and it should fail at that time itself.
>
> I'm not applying this without at least a better explanation.

Sorry, I didn't find the function "ipvlan_nl_validate" during reading
the ipvlan codes.

Regards
Feng

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-29  1:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-28 13:23 [PATCH net-next 1/1] driver: ipvlan: Add the sanity check for ipvlan mode fgao
2016-11-28 19:08 ` Mahesh Bandewar (महेश बंडेवार)
     [not found] ` <CAF2d9ji2_JhiNv9P9aUt7wV2Vfjv+z_q-MWSKKH8tzO_1THobg@mail.gmail.com>
2016-11-28 20:08   ` David Miller
2016-11-29  1:06     ` Feng Gao

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.