diff mbox

[net] vlan: allow to change type when no vlan device is hooked on netdev

Message ID 1350473856-29380-1-git-send-email-jiri@resnulli.us
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Jiri Pirko Oct. 17, 2012, 11:37 a.m. UTC
vlan_info might be present but still no vlan devices might be there.
That is in case of vlan0 automatically added.

So in that case, allow to change netdev type.

Reported-by: Jon Stanley <jstanley@rmrf.net>
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
---
 net/8021q/vlan.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Jon Stanley Oct. 17, 2012, 4:06 p.m. UTC | #1
On Wed, Oct 17, 2012 at 7:37 AM, Jiri Pirko <jiri@resnulli.us> wrote:

> vlan_info might be present but still no vlan devices might be there.
> That is in case of vlan0 automatically added.
>
> So in that case, allow to change netdev type.

Confirmed to work, thanks!
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
David Miller Oct. 18, 2012, 7:35 p.m. UTC | #2
From: Jiri Pirko <jiri@resnulli.us>
Date: Wed, 17 Oct 2012 13:37:36 +0200

> vlan_info might be present but still no vlan devices might be there.
> That is in case of vlan0 automatically added.
> 
> So in that case, allow to change netdev type.
> 
> Reported-by: Jon Stanley <jstanley@rmrf.net>
> Signed-off-by: Jiri Pirko <jiri@resnulli.us>

Applied and queued up for -stable, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c
index 9096bcb..ee07072 100644
--- a/net/8021q/vlan.c
+++ b/net/8021q/vlan.c
@@ -463,7 +463,9 @@  static int vlan_device_event(struct notifier_block *unused, unsigned long event,
 
 	case NETDEV_PRE_TYPE_CHANGE:
 		/* Forbid underlaying device to change its type. */
-		return NOTIFY_BAD;
+		if (vlan_uses_dev(dev))
+			return NOTIFY_BAD;
+		break;
 
 	case NETDEV_NOTIFY_PEERS:
 	case NETDEV_BONDING_FAILOVER: