From patchwork Fri Sep 28 12:32:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paulius Zaleckas X-Patchwork-Id: 187777 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 554AE2C00A6 for ; Fri, 28 Sep 2012 22:33:06 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757247Ab2I1MdE (ORCPT ); Fri, 28 Sep 2012 08:33:04 -0400 Received: from mail-wi0-f172.google.com ([209.85.212.172]:54298 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755400Ab2I1MdC (ORCPT ); Fri, 28 Sep 2012 08:33:02 -0400 Received: by wibhq12 with SMTP id hq12so7809390wib.1 for ; Fri, 28 Sep 2012 05:33:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:date:message-id:user-agent:mime-version :content-type:content-transfer-encoding; bh=37Zccm+Zy8rZ7sTnGdSsxDgVYmS1+NWms3/D8A9NECw=; b=WyQwZ80jHFpQj017lWq4KxdiFVZQqGXKzyFBbGe4dhzLvyanmkQ3yv7iH3RMak6rWG vHbDYmfkmp1kK+TMgrE33loCatdUHekpN6hHqqai4uPLSmfi5IpGNQkA1JSajORPTVQs iwZ+t+NfdB4btVLNGCcRG0YzzlS7cZRUTT47f07yFkVmnSLG49l2hrTKP2Lell1BLID4 UifEnKsDSOcTKCJFfXzgRCJpGs/DejOPzV2ezFCN0kV4UL3/y1ENxmztQ6PNuC5lJqUu kXIBX7XY0/YftYn9HRofpqxg6AXAY2xPJ3hz6ANO9vYL+d+0K4xr5vV0gR9jOttQhO+k 4/rg== Received: by 10.216.197.41 with SMTP id s41mr3177605wen.205.1348835581276; Fri, 28 Sep 2012 05:33:01 -0700 (PDT) Received: from localhost.localdomain (82-135-139-249.static.zebra.lt. [82.135.139.249]) by mx.google.com with ESMTPS id dm3sm19144712wib.3.2012.09.28.05.32.59 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 28 Sep 2012 05:33:00 -0700 (PDT) From: Paulius Zaleckas Subject: [PATCH] vlan: Make it possible to add vlan with id 4095 To: kaber@trash.net, netdev@vger.kernel.org Date: Fri, 28 Sep 2012 15:32:58 +0300 Message-ID: <20120928123258.9454.95197.stgit@localhost.localdomain> User-Agent: StGIT/0.14.3 MIME-Version: 1.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org vconfig help tells that vlan_id should be 0-4095, but fails with 4095. There is an off-by-one bug while evaluating vlan_id. Fix it by evaluating against count(4096), not mask(0x0fff = 4095). Signed-off-by: Paulius Zaleckas --- net/8021q/vlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 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 --git a/net/8021q/vlan.c b/net/8021q/vlan.c index 9096bcb..9e528bf 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -199,7 +199,7 @@ static int register_vlan_device(struct net_device *real_dev, u16 vlan_id) char name[IFNAMSIZ]; int err; - if (vlan_id >= VLAN_VID_MASK) + if (vlan_id >= VLAN_N_VID) return -ERANGE; err = vlan_check_real_dev(real_dev, vlan_id);