Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3930948pxf; Mon, 29 Mar 2021 15:56:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwiQBadXhhZx0Chs2Me+qW2mi7Z5RXoneVzswlQcWhIIg3KAWpq5Jd8CY64sRn1vO9Y5TI6 X-Received: by 2002:a05:6402:2ce:: with SMTP id b14mr30704352edx.13.1617058597000; Mon, 29 Mar 2021 15:56:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617058596; cv=none; d=google.com; s=arc-20160816; b=m2GyiI3WPrlyyT8VdnIJEVa47vUlezUckrA+qFJ3gdij0UWYS/OAPQ/NxrhwN/2vef zyyMVDe1h3OCNs5RQg99tBGAo9E3FSqlI68ISSM29Adg+pkxN4y8ZOEWmxhAxGe4R401 gYgVkF/Bq7p4ZYtkDC7REqQp5TREd2vbmHCyu6+vQQCauX+WoqvKIPeBVY6cu9Tkd2tJ pJ2EyfJM+JVBu86Oo/MnOlk9cyRdEZMaxPF33nTNgjr3HZS+zpY4v7yjO+p1F+BsD9Yz fN2uKOBzu1qXrVgqhzkFcSht1sAGysTMErfHvCfVBnvFmX5vY2uJXai7vRBX6qpe0oJ3 bEHg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=Ht62GGZPRnyS8dvd4NCjkjT07Q4MqTk+km0I1yZhWTY=; b=SXmLSbmnay8y2l/A6T1E+z5iZkuOQG15UwmYK9sRKuoLWJbfH5z0gjOCEUiGzMZQA5 Lyy8INdvYep34GU8yb9jEi2U5vpiRkeYMKDdNc39q+CgcBI35EAJEoSekTdBDpRgCDtR fgPdPnWlEZ1ACK7MLMoJFJZibHpbfOavKXRFbZ+ELObY/5KPFQpDscXL1N8vwoCnfQNU lZ8NoYAS68VOxOVCFpDRrebd918Kzlha/LPuT9oeNtOZ0kzI1PR8hJj1J/bbKqJ0m5fo udhuqSkm8k43qdSaEfYHkCLFDwBfIMFM0F4SZjnFTcFuinBv4bjSu1CyB4uJoVW9eeZZ RBZQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=HwyKgNOi; 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 hr30si12782039ejc.545.2021.03.29.15.56.14; Mon, 29 Mar 2021 15:56:36 -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=HwyKgNOi; 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 S231925AbhC2WzT (ORCPT + 99 others); Mon, 29 Mar 2021 18:55:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231194AbhC2WzP (ORCPT ); Mon, 29 Mar 2021 18:55:15 -0400 Received: from mail-pg1-x543.google.com (mail-pg1-x543.google.com [IPv6:2607:f8b0:4864:20::543]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 797EFC061762; Mon, 29 Mar 2021 15:55:15 -0700 (PDT) Received: by mail-pg1-x543.google.com with SMTP id f10so10350795pgl.9; Mon, 29 Mar 2021 15:55:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=Ht62GGZPRnyS8dvd4NCjkjT07Q4MqTk+km0I1yZhWTY=; b=HwyKgNOitGx/3X7ftcJLmz7W9668uErAtDYuhHInKoBmXdsQdqtXksyArLTbW4gLfS Fs59KOvFP10YSWfZiW5I7mR6evMZd2chJ6sFtBl8A8cqdiP8wGkPL9nUD6nA33uiAjnt KTUfTi+4pvSfU2Xd59kb0BiKkZGNNZhrdnmb67HoupJmrx3LPrIrrKu/v8KuUGtypocB 3vy1f9gPqzXdqED1429Q7k0bWWI9PMq5r/6CthXx675HN4qvbuYQ1oWaH7OncTC3863E PR6RXYtvj5Ee1pOKKNHIwz7hSqgp7N8+sdSw8nDig08Uv5bvhofSnEhLj8Mgza4nI5YW KmJQ== 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; bh=Ht62GGZPRnyS8dvd4NCjkjT07Q4MqTk+km0I1yZhWTY=; b=GEmySfAsorGBrOCq6OaXixCCU3a2RJmxqoBqvj3BClo/nlNtN71lUWVDNtxY3myRSK U0lSBCe8x/kadPGRDz7IBUVG6KmkrOli2fN4OHSjMeiLu/8ufUNk6ACwnRsbCxxhSA+I t4ActhSa69iQ/EFTqv9cXufcEgihu1TGh9K6Q/ImCHL+Zd6E0a9g90iy29xB2ECZDzNH C+OGeq3a++YcM2T1rkbSsUMVvTmXSD3Pu/IfqyeFScdGLkd07k+U9zl3to7wMGtiGB8u 5yuWBxmFtDokKGlriLePodeSgOD6o3B0WkImFysZ89xJaVHOff5pbMOmKKe2TQEzJCie 12Fg== X-Gm-Message-State: AOAM530i3X9OBRdIJyCP2WzRLXbkFjUphKT2kJIFv5lJ+cKO9J8qf/MU E/hs832oPj6Ru2IvFDYMD4w4vtdfuIXJug== X-Received: by 2002:a63:3507:: with SMTP id c7mr1791074pga.204.1617058515010; Mon, 29 Mar 2021 15:55:15 -0700 (PDT) Received: from localhost ([112.79.230.77]) by smtp.gmail.com with ESMTPSA id s12sm17303672pgj.70.2021.03.29.15.55.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 15:55:14 -0700 (PDT) Date: Tue, 30 Mar 2021 04:25:12 +0530 From: Kumar Kartikeya Dwivedi To: Vlad Buslov Cc: netdev@vger.kernel.org, Vlad Buslov , Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= , "David S. Miller" , Jakub Kicinski , Jamal Hadi Salim , Cong Wang , Jiri Pirko , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] net: sched: extend lifetime of new action in replace mode Message-ID: <20210329225512.voaibzkfmyodcxv6@apollo> References: <20210328064555.93365-1-memxor@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 29, 2021 at 02:35:12PM IST, Vlad Buslov wrote: > it seems that there are two ways actions are overwritten/deleted: > > 1. Directly through action API, which is still serialized by rtnl lock. > > 2. Classifier API, which doesn't use rtnl lock anymore and can execute > concurrently. > > Actions created by path 2 also have their bind count incremented which > prevents them from being deleted by path 1 and cls API can only deleted > them together with classifier that points to them. > > [...] > So, what happens here is actions were 'deleted' concurrently (their > tcfa_refcnt decremented by 1)? tcf_action_put_many() will decrement > refcnt again, it will reach 0, actions get actually deleted and > tcf_exts_validate() returns with non-error code, but exts->actions > pointing to freed memory? Doesn't look like the patches fixes the > described issue, unless I'm missing something. > Thanks for the review and comments. You are absolutely right. This patch was totally broken. Your feedback however was quite helpful in understanding the code. I sent a v2, please lmk if it's correct (also with a hopefully thorough description of the problem & solution). -- Kartikeya