From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.5 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 853D7C282C4 for ; Tue, 12 Feb 2019 09:35:59 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4FAA82186A for ; Tue, 12 Feb 2019 09:35:59 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=resnulli-us.20150623.gappssmtp.com header.i=@resnulli-us.20150623.gappssmtp.com header.b="pKqhKSW6" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727248AbfBLJf6 (ORCPT ); Tue, 12 Feb 2019 04:35:58 -0500 Received: from mail-wm1-f52.google.com ([209.85.128.52]:37199 "EHLO mail-wm1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726026AbfBLJf6 (ORCPT ); Tue, 12 Feb 2019 04:35:58 -0500 Received: by mail-wm1-f52.google.com with SMTP id x10so2192827wmg.2 for ; Tue, 12 Feb 2019 01:35:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=resnulli-us.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=hvsaMSX7PCMPjfIJ1yqDp1mwl8gqwgu7oio9BeofZaQ=; b=pKqhKSW63hRJlw8NLuIm25FrwD9Caz1XSumi6dTzDbiWE8oUPJFtWKy1/bFPvH1gxh Bu/iH23bjOjsV41Sn/pxBBB7lkFX90mC8vhAREVq4KQdp3+7YNDHIw+R7B9hf6/v/tqm N7JbEZVIdNuK6+yQ3OJG18JMDbsWyfMZImi6y988CtwyMcaL9SCWw9jdPEDEXC6BBZF/ bLjGHngOBeV3DWfGgX2JLioQvQQNjcd2o1iJ3DaYtqNYeMzNY7/hNV7PFfWLs9jNMNaA gls1DSctE9DrsqanpoQq9o08l+gb8Fbut1Uh6XLqe4mF3x+FBa8wh3llovo0fzrcYijv +WDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=hvsaMSX7PCMPjfIJ1yqDp1mwl8gqwgu7oio9BeofZaQ=; b=EPKFVYF2T4NCxegr1JLxRBnNwlVUuaajEtBkqrFkrHdwWHPk/5DjjRgzfkA1OPoY5y I9kGKYom+AL3WiweHuiOhmlZh3u+B10hJIg9/swneg7xo5ofsXXoxkzUF0xSJKfcvF9a sl5f7hxBXEU40bxosykvsL11SAkBJpHRqzg+3sVd4SczG0QExfU9igUbYbx1HLdtUBoI 8Q8bb2e5Nfd/d5nTmmm55aLHbP62APjH92GmMSDcAW79LVekIB40vm+YbJBHZmDPwf3z ExKTrHgMiGQYuH9QQTvBBePby1Qndm5jZz3VVweO/7sPbVPKuPkK30usPa7fUdl+3KOz nmFg== X-Gm-Message-State: AHQUAuZkbOlu8LulHa0YtINNgxVrhBAVmw39G2OVhLVcEv6rjl9Akmd3 wWqPLD1LZHX5ItH+k/LJjUSa+w== X-Google-Smtp-Source: AHgI3IaHxpo0BX7VeqEsQO7j+SKYwt1lP8jgqhIYwvH42HTjtfVtbMeGadqkOREH3S/syzQRKl0DeA== X-Received: by 2002:a7b:c2a9:: with SMTP id c9mr2275832wmk.44.1549964156281; Tue, 12 Feb 2019 01:35:56 -0800 (PST) Received: from localhost (mail.chocen-mesto.cz. [85.163.43.2]) by smtp.gmail.com with ESMTPSA id l12sm8365018wrt.87.2019.02.12.01.35.55 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 12 Feb 2019 01:35:55 -0800 (PST) Date: Tue, 12 Feb 2019 10:26:31 +0100 From: Jiri Pirko To: Cong Wang Cc: netdev@vger.kernel.org, syzbot+4d4af685432dc0e56c91@syzkaller.appspotmail.com, syzbot+68ee510075cf64260cc4@syzkaller.appspotmail.com, Paolo Abeni Subject: Re: [Patch net] team: avoid complex list operations in team_nl_cmd_options_set() Message-ID: <20190212092631.GF2881@nanopsycho> References: <20190212055951.6712-1-xiyou.wangcong@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190212055951.6712-1-xiyou.wangcong@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org Tue, Feb 12, 2019 at 06:59:51AM CET, xiyou.wangcong@gmail.com wrote: >The current opt_inst_list operations inside team_nl_cmd_options_set() >is too complex to track: > > LIST_HEAD(opt_inst_list); > nla_for_each_nested(...) { > list_for_each_entry(opt_inst, &team->option_inst_list, list) { > if (__team_option_inst_tmp_find(&opt_inst_list, opt_inst)) > continue; > list_add(&opt_inst->tmp_list, &opt_inst_list); > } > } > team_nl_send_event_options_get(team, &opt_inst_list); > >as while we retrieve 'opt_inst' from team->option_inst_list, it could >be added to the local 'opt_inst_list' for multiple times. The >__team_option_inst_tmp_find() doesn't work, as the setter >team_mode_option_set() still calls team->ops.exit() which uses >->tmp_list too in __team_options_change_check(). > >Simplify the list operations by moving the 'opt_inst_list' and >team_nl_send_event_options_get() into the nla_for_each_nested() loop so >that it can be guranteed that we won't insert a same list entry for >multiple times. Therefore, __team_option_inst_tmp_find() can be removed >too. > >Fixes: 4fb0534fb7bb ("team: avoid adding twice the same option to the event list") >Fixes: 2fcdb2c9e659 ("team: allow to send multiple set events in one message") >Reported-by: syzbot+4d4af685432dc0e56c91@syzkaller.appspotmail.com >Reported-by: syzbot+68ee510075cf64260cc4@syzkaller.appspotmail.com >Cc: Jiri Pirko >Cc: Paolo Abeni >Signed-off-by: Cong Wang Acked-by: Jiri Pirko Thanks!