From patchwork Mon Apr 1 08:15:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xin Long X-Patchwork-Id: 10879311 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B428B15AC for ; Mon, 1 Apr 2019 08:15:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A0AE7286C4 for ; Mon, 1 Apr 2019 08:15:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94BFA287C2; Mon, 1 Apr 2019 08:15:39 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from bastion.fedoraproject.org (bastion01.fedoraproject.org [209.132.181.2]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 28421286C4 for ; Mon, 1 Apr 2019 08:15:38 +0000 (UTC) Received: from mailman01.phx2.fedoraproject.org (mailman01.phx2.fedoraproject.org [10.5.126.36]) by bastion01.phx2.fedoraproject.org (Postfix) with ESMTP id 9E62B607970F; Mon, 1 Apr 2019 08:15:37 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 bastion01.phx2.fedoraproject.org 9E62B607970F Received: from mailman01.phx2.fedoraproject.org (localhost [IPv6:::1]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id 897814F051E6B; Mon, 1 Apr 2019 08:15:37 +0000 (UTC) Received: by mailman01.phx2.fedoraproject.org (Postfix, from userid 991) id 139FC4F051E6A; Mon, 1 Apr 2019 08:15:35 +0000 (UTC) Received: from smtp-mm-ib01.fedoraproject.org (smtp-mm-ib01.vpn.fedoraproject.org [192.168.1.83]) by mailman01.phx2.fedoraproject.org (Postfix) with ESMTP id D1A144F051E5E for ; Mon, 1 Apr 2019 08:15:33 +0000 (UTC) Received: from mail-pg1-f194.google.com (mail-pg1-f194.google.com [209.85.215.194]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by smtp-mm-ib01.fedoraproject.org (Postfix) with ESMTPS id 6ABBE606694C for ; Mon, 1 Apr 2019 08:15:33 +0000 (UTC) Received: by mail-pg1-f194.google.com with SMTP id b12so4380071pgk.0 for ; Mon, 01 Apr 2019 01:15:33 -0700 (PDT) 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=g2YH6pJJIL04SnT6iPXDCIBUAywbzFM0PBNHDO4X/2U=; b=fFyWfo0lYL55sv19iZK39YeLoMUjJIkqmh7ioD21ZNL6faEXhjbe5NA4vsBnbjsCXY MbmO3z/GP2OhhWkFQd6bkd27I5qCHkPV8YTuYJRpkwK/qu2pQmePIbLzaUA996XKQtSV M0E5+f013iMyQU61tYU0PxBq9bkK/LeZx+Eiadfd4Ocn2SihRjdxMRJJUWs4Gz03C+Aj dwhHd5DFkXDqOrYRFKwyCPMTWgBsGAZTlMV1gumU3igJZBpf1RLTOxBhFP10Jy+wMG/k +Q/qQipbajco7XhOb+J5a4MPQCwNkQ9PP7kjIudYsBBDAy8sB5O6TglppM3sL81dU2Jk 7sqA== X-Gm-Message-State: APjAAAXctZ3DDBkbREaqPf1a9UFoIyR2lnLuxv53/Abizmo6RtxluQHi czcCKh0ArxabetGO/nojegPaWAs47RA= X-Google-Smtp-Source: APXvYqz2v4vu+djWZ4Q5Uf3dT4x0Wm8ivvFAC4CzUWl/O+xlWB+HYSrR8zGvvGFBfZaI6qH88MPJNA== X-Received: by 2002:aa7:8589:: with SMTP id w9mr61009976pfn.97.1554106531977; Mon, 01 Apr 2019 01:15:31 -0700 (PDT) Received: from localhost ([209.132.188.80]) by smtp.gmail.com with ESMTPSA id v1sm13608198pff.81.2019.04.01.01.15.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Apr 2019 01:15:31 -0700 (PDT) From: Xin Long To: libteam@lists.fedorahosted.org Subject: [PATCH] teamd: tdport has to exist if item->per_port is set in __find_by_item_path Date: Mon, 1 Apr 2019 16:15:24 +0800 Message-Id: <1c250a41df7bedb3ede446d891a317b491df092f.1554106524.git.lucien.xin@gmail.com> X-Mailer: git-send-email 2.1.0 Message-ID-Hash: FUH3HGJ2LZ63Y6ALGIW7VLVRQ6GKRQ2N X-Message-ID-Hash: FUH3HGJ2LZ63Y6ALGIW7VLVRQ6GKRQ2N X-MailFrom: lucien.xin@gmail.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-config-1; header-match-config-2; header-match-config-3; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; suspicious-header CC: Jiri Pirko X-Mailman-Version: 3.1.1 Precedence: list List-Id: Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Virus-Scanned: ClamAV using ClamSMTP The issue can be reproduced by: # teamd -c '{"device":"team0", "runner":{"name":"lacp"}}' & # teamdctl team0 state item set runner.aggregator.selected true teamd process will abort in lacp_port_state_aggregator_selected_set() as gsc->info.tdport was set to NULL in teamd_state_item_value_set() The item 'runner.aggregator.selected' is of per_port = true, and it shouldn't allow to call its setter/getter(). This patch is to add the check for it in __find_by_item_path() called by teamd_state_item_value_get/set(). Fixes: 6c00aaf02553 ("teamd: add support for state item write operation") Signed-off-by: Xin Long --- teamd/teamd_state.c | 1 + 1 file changed, 1 insertion(+) diff --git a/teamd/teamd_state.c b/teamd/teamd_state.c index ab64db9..0714880 100644 --- a/teamd/teamd_state.c +++ b/teamd/teamd_state.c @@ -333,6 +333,7 @@ static int __find_by_item_path(struct teamd_state_val_item **p_item, list_for_each_node_entry(item, &ctx->state_val_list, list) { /* item->subpath[0] == '.' */ if (!strcmp(item->subpath + 1, subpath) && + (!item->per_port || tdport) && (!item->tdport || item->tdport == tdport)) { *p_item = item; *p_tdport = tdport;