Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp2451115ybk; Sun, 17 May 2020 22:30:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyKdEHJRC7S6q8XX6fqL8605l55CylsJpNdyylJW1scZv0LrnBAx8X45PDqMfzdFx7+ncG1 X-Received: by 2002:a17:906:5681:: with SMTP id am1mr13895792ejc.376.1589779809058; Sun, 17 May 2020 22:30:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589779809; cv=none; d=google.com; s=arc-20160816; b=Bt+T796926eXAYwxLrGPuGdF2SwyBY3970vDcOhhbdzNGQ0N+1Dm4BmZBDbS2543x0 o+FUv6oRL1SOHARyGztGlhSQs4fFHEQ8HHJNJ61r3GBcmtd0yWPFvKX0YFzGBC2uIIPj wO8QyY7oDSS+/xsq2vPmeVUV2lZUAjeIhtRzv6dpGq2uUv8IK29IEqgz525gAErtVWsL xTZBcqW+7LyuYEVHfT4h9bTWzSJ5NITVD0Zlvzfg/CiohbQnVEx8ekXHL9xoeMQWTlAG 18pxbH+NF4VL3wZ6W9v3ozelL2HOj75F2A5sNyj2C4NFrCQTH8nN4/toKpXS7JeFAZlS AFRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=WBVBIzp2b7Pg1EPe8d8y6PumURqXzl8cvQXQg0AQNAA=; b=ezuXb0rnCWOkBRAax2LJrvHPO+bK1+++F2zwmZcd+v32amqZRP/d7h7lqL4dWK/GzI GGCerk+THeWuQ+wve8UIS/RvA2mYyxVHTP62InZ1mjYulmJAeyirT05/c+sypOeSp18a QifziGauPdQK9ux3JdiDUlVgG+8ZTnWb/mWqaourJSzHCxW3tYBgu/J9yGudZ/keWlF0 z41FEaRIjbU1jUCjBuKAe/dQUqsE16gtE+NdjaJKRaXrd1NJ8P/wO6sCF3CgfaWlbjJ0 A8Zpb1rFXrxh58chgF2X9X5EJjRbhTo51Xi6lJW825riBcPRISYDVnjatZs0DD10rb9z IpzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hj4YsfGY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t19si5250266eds.141.2020.05.17.22.29.44; Sun, 17 May 2020 22:30:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hj4YsfGY; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726481AbgERF2W (ORCPT + 99 others); Mon, 18 May 2020 01:28:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726040AbgERF2V (ORCPT ); Mon, 18 May 2020 01:28:21 -0400 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C8D72C061A0C; Sun, 17 May 2020 22:28:21 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id g11so3765551plp.1; Sun, 17 May 2020 22:28:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=WBVBIzp2b7Pg1EPe8d8y6PumURqXzl8cvQXQg0AQNAA=; b=hj4YsfGYUb2YNgN2rYV/J1a6AVHr2yrndux2dSdQ3RTe+fM27+8IuY9ZsoSVS/+VDm LYZm3dti8aaUt085/HPWSnE3Qe44JtqkpAjH819QZUU2vwW5ptsjI0ReocF+a5vkc/kN GNq12gLNiOltbgqIDevqFJnXWZzOSNxGvDYlxtTgLB587i+eL9z4yDq7/If8tEx5eLrA tiRpCaCmlctzEo31p/c+bb++kSNtePaqJIaGVhlQgCQURE/Qpwx9QWeDIyvm011P6pyY uEePHDtdrlPCdbebkGvGIS0Y/wK9ZmHkUBzDBV+OWHN2jJC+YdMIeTLwiy/iXJWzPtwt jooQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=WBVBIzp2b7Pg1EPe8d8y6PumURqXzl8cvQXQg0AQNAA=; b=rx+kXlP3RwMbXnPrIZoAvJbFoEaoR9QXKy8Gj+A1tkky1uRXZ2r3vbmONywVypcB3A NAj5VNWnxLsGr49CTSpMzQti7w+3j5p4usET+6t1K2CgJEnsAW/bqUYvo2dV6dt9OfP0 ny40GN/ijW77cjUH+iZcjqrMQGHW1K4o/gNgmM4WtCZCb8DFHhbY2DiAb+PADr4avWqI 0V09ggLPf+eiObtpYGBbezezq3ClnmeAzTZu6P4JE5mHHmIx2on7Red7646Qn0l+Xt+U P6XKoPlZsEYFDB+1Xq75ZXqheS49valstDxtJ2ML5LurKNcxStIhRIO9jwMiIHck8kuP J8Rg== X-Gm-Message-State: AOAM5335SoMfYy851Ecdm9n0DrWAujw/9xYXbVPwLkMzYjasIm6FNyyA zmQfERvBQP4EREg5tlkXP8o9rmF6LoU= X-Received: by 2002:a17:902:930c:: with SMTP id bc12mr14855642plb.255.1589779701248; Sun, 17 May 2020 22:28:21 -0700 (PDT) Received: from DESKTOP-9405E5V.localdomain (h128-22-148-223.ablenetvps.ne.jp. [128.22.148.223]) by smtp.gmail.com with ESMTPSA id d124sm7572835pfa.98.2020.05.17.22.28.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 May 2020 22:28:20 -0700 (PDT) From: Huang Qijun To: davem@davemloft.net Cc: kuba@kernel.org, ap420073@gmail.com, tglx@linutronix.de, gregkh@linuxfoundation.org, allison@lohutok.net, dknightjun@gmail.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] vlan: fix the bug that cannot create vlan4095 Date: Mon, 18 May 2020 13:27:55 +0800 Message-Id: <20200518052755.27467-1-dknightjun@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org According to the 8021q standard, the VLAN id range is 1 to 4095. But in the register_vlan_device function, the range is 1 to 4094, because ">= VLAN_VID_MASK" is used to determine whether the id is illegal. This will prevent the creation of the vlan4095 interface: $ vconfig add sit0 4095 vconfig: ioctl error for add: Numerical result out of range To fix this error, this patch uses ">= VLAN_N_VID" instead to determine if the id is illegal. Signed-off-by: Huang Qijun --- net/8021q/vlan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c index d4bcfd8f95bf..5de7861ddf64 100644 --- a/net/8021q/vlan.c +++ b/net/8021q/vlan.c @@ -219,7 +219,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, htons(ETH_P_8021Q), vlan_id, -- 2.17.1