Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp4537421imm; Mon, 17 Sep 2018 16:05:31 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZQENXO4T8I2g7xzaQx54re28LgTkJYXvQq0LvWwtRGuYLNKVm23T1u0XqNKLS+4iRHsaLr X-Received: by 2002:a63:91c2:: with SMTP id l185-v6mr25700450pge.321.1537225531848; Mon, 17 Sep 2018 16:05:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537225531; cv=none; d=google.com; s=arc-20160816; b=eXZOlbCXcxyKJ61okSniemnksPsyxvWpkVo2XiP0QFJBoPhAK1x8cigoBFUwevzzUS tUzHi3U3GswPJCPJ0uBv6/gCTC9QwOzrFm+sasf78PZLe6EIwA81CeHHF8wxFY9GQFcF 4Rvu+cbr1ntPgIZ1uBW3hfp+jgchMF4y9A3e1PMSV/yvbGumR6MGQI8gb6w+aIJEcawr YcTBpVdThG71NAto8NU/obTHiu5J6sgrKSLd4qMuN2o1dvPUz0DZAtmsMlTmoaHwPP/X NDBjQYuys0A0ZsYVQVzuxJFu8stsnFPw3kxkx/y0kE6K0CpCrKA1fP5dqf90X3EXg0uL /EGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=NN3bgjotEY/Jg9nkWhux7SjPKvM307Jq5uaggFW//Vo=; b=iijGzepwPUBNKFBwWMNJ+3TKE8FSfnSrXxgsZYjaiLnvLZNjQYcMa804Z8puQFhGHG Z10/XExKjYCzkuZl1z6RjgvLrpS1j1guvavH2qQn7DVE36eNCidgaredvyHtatDYgbp/ kkKOcA/i65oM3O0RutHAsYPtQRODcl6GoA79pAcyN70AylL7+l0WxhfSB4wOsc05wKvV 8Jh+0s6dxjbTgSF4e4EAbFlWTC8W6auAjDOcOjKs0RZ5t14PfswYdy8rDQR5PPq5U32w zj9QoFmw2dBEKfrf3Xw716O2eueWMUW1uZ/guq318FpwgHpGhFg+UgxDO1NeEZsXyhRL sjTw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1-v6si16478511pgg.643.2018.09.17.16.05.16; Mon, 17 Sep 2018 16:05:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730682AbeIREdO (ORCPT + 99 others); Tue, 18 Sep 2018 00:33:14 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:48980 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727202AbeIREdN (ORCPT ); Tue, 18 Sep 2018 00:33:13 -0400 Received: from localhost (li1825-44.members.linode.com [172.104.248.44]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id CE35DC7D; Mon, 17 Sep 2018 23:03:44 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Petr Machata , Ido Schimmel , "David S. Miller" , Sasha Levin Subject: [PATCH 4.14 076/126] net: dcb: For wild-card lookups, use priority -1, not 0 Date: Tue, 18 Sep 2018 00:42:04 +0200 Message-Id: <20180917211709.184759170@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180917211703.481236999@linuxfoundation.org> References: <20180917211703.481236999@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Petr Machata [ Upstream commit 08193d1a893c802c4b807e4d522865061f4e9f4f ] The function dcb_app_lookup walks the list of specified DCB APP entries, looking for one that matches a given criteria: ifindex, selector, protocol ID and optionally also priority. The "don't care" value for priority is set to 0, because that priority has not been allowed under CEE regime, which predates the IEEE standardization. Under IEEE, 0 is a valid priority number. But because dcb_app_lookup considers zero a wild card, attempts to add an APP entry with priority 0 fail when other entries exist for a given ifindex / selector / PID triplet. Fix by changing the wild-card value to -1. Signed-off-by: Petr Machata Signed-off-by: Ido Schimmel Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/dcb/dcbnl.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) --- a/net/dcb/dcbnl.c +++ b/net/dcb/dcbnl.c @@ -1765,7 +1765,7 @@ static struct dcb_app_type *dcb_app_look if (itr->app.selector == app->selector && itr->app.protocol == app->protocol && itr->ifindex == ifindex && - (!prio || itr->app.priority == prio)) + ((prio == -1) || itr->app.priority == prio)) return itr; } @@ -1800,7 +1800,8 @@ u8 dcb_getapp(struct net_device *dev, st u8 prio = 0; spin_lock_bh(&dcb_lock); - if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) + itr = dcb_app_lookup(app, dev->ifindex, -1); + if (itr) prio = itr->app.priority; spin_unlock_bh(&dcb_lock); @@ -1828,7 +1829,8 @@ int dcb_setapp(struct net_device *dev, s spin_lock_bh(&dcb_lock); /* Search for existing match and replace */ - if ((itr = dcb_app_lookup(new, dev->ifindex, 0))) { + itr = dcb_app_lookup(new, dev->ifindex, -1); + if (itr) { if (new->priority) itr->app.priority = new->priority; else { @@ -1861,7 +1863,8 @@ u8 dcb_ieee_getapp_mask(struct net_devic u8 prio = 0; spin_lock_bh(&dcb_lock); - if ((itr = dcb_app_lookup(app, dev->ifindex, 0))) + itr = dcb_app_lookup(app, dev->ifindex, -1); + if (itr) prio |= 1 << itr->app.priority; spin_unlock_bh(&dcb_lock);