Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp702497pxf; Thu, 11 Mar 2021 12:45:04 -0800 (PST) X-Google-Smtp-Source: ABdhPJxmYZvaI1QzioEcWWQOKUK1YKgSyFpyAdTPwUufMD8OAMOTXKlJM9VnK2A0/qBEONLXu+Ev X-Received: by 2002:aa7:da46:: with SMTP id w6mr10543234eds.40.1615495504182; Thu, 11 Mar 2021 12:45:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615495504; cv=none; d=google.com; s=arc-20160816; b=YKsktH9uQbdCy9YUXKw8BUl0UlCfMq1tZlNL9mtOPdY5NOLYMrS0ysf8QzrsbGcnx4 p8Vo+eLgC3W0XQ3fKnAcvvZ2w1+RpryDX266fUXtNAP+FKQ+VT24MMDL9g/Qk+fKVgnL N9roEJlqHC+iULZFR9iB3SQRfvYcqj7oAtUlFQ1cDFjQIOu28xH9H8VpAimHehvfOUWU tb+Oz9txozBq2hNwneTCeyY4Bj0aFys+OFJZVeDh2FYxZ3IjyoqtQvxqX9kIQpmDG/C9 0v/0xal1Rt85EjFlTlhGxAkAcYdOCMUgpqhmmKLeEzRB9ddC3+HZomjkQGGNdvhFUeA2 DPAw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=fs/5uz7qVKO8QPUHCgLRzfCztft7qavmsx5C0VTSHrk=; b=S53xjQyxuTmlMLAPXTP8xpMQ3v7ZtLHq4oRMSorNkkd5U1Um9z5I+C0RDtcCmbMi0Y XZJtuvA9ypUDWP6uoJWxCzNlscPz6MnSMz9RSe21kuuUUhFskUzGwP7RSTePRbN9GsHn 9WgbT1dxw/jaYLwPY2G7ohqj8B342oWodMw5R/cDJfB5MEwh2zVOlFqUlvK+cGzoZSgS d5AAVMr+8o2ts+ehhuqEvm8DPejgT3opvbDVhOMjwPF2b+1YFjPejNwp1jZSCj+Rv4lM STIc+cWzWVvLK+j1c/LHbWA/wLXw7EpFqn53fMFhjaAg/ayu9sKeCmsGTomyLK4kAcm8 ZsKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jygzY1rR; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r20si2359241ejd.746.2021.03.11.12.44.39; Thu, 11 Mar 2021 12:45:04 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b=jygzY1rR; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229900AbhCKUno (ORCPT + 99 others); Thu, 11 Mar 2021 15:43:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:54156 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229490AbhCKUnL (ORCPT ); Thu, 11 Mar 2021 15:43:11 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 844AF64F85; Thu, 11 Mar 2021 20:43:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1615495390; bh=lACAyzgyWnB0qDdJmwRNuIg9HZ/bFs2tkjMU1/F663M=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=jygzY1rRtsVGwjNNJ8o9zfl+B5X/stcV78bX4sE+faSz2JjoSXOJ3oLk7wwA2OeAS sAIvIyainCGFTtRCs4yu4RBnIbZe471ktRhC+k+Tl3zVY/YGOObhY26RLhx09ZbU+8 y2kpNk+J/GS/I0e4aYlU86gpoFILypwhTa+6K/sEavd526rPX7a+u/9FqoJi7SE1Tn cQhNPkn7M1fFaejJzxVWwKBIJevjmzdpNu1OdwHdppiAXmfITt4rj5kJvbRWxBoaJy bMPvrgkvC0zvqfCDh4TPsVV0F0GX44JTQ6G8MuBSbVka2p6T+Hz9fzGxRmJm7lxlWA J5oo+qUdLDCBQ== Date: Thu, 11 Mar 2021 12:43:09 -0800 From: Jakub Kicinski To: Xie He Cc: Martin Schiller , "David S. Miller" , linux-x25@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net] net: lapbether: Prevent racing when checking whether the netif is running Message-ID: <20210311124309.5ee0ef02@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: <20210311072311.2969-1-xie.he.0141@gmail.com> References: <20210311072311.2969-1-xie.he.0141@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 10 Mar 2021 23:23:09 -0800 Xie He wrote: > There are two "netif_running" checks in this driver. One is in > "lapbeth_xmit" and the other is in "lapbeth_rcv". They serve to make > sure that the LAPB APIs called in these functions are called before > "lapb_unregister" is called by the "ndo_stop" function. > > However, these "netif_running" checks are unreliable, because it's > possible that immediately after "netif_running" returns true, "ndo_stop" > is called (which causes "lapb_unregister" to be called). > > This patch adds locking to make sure "lapbeth_xmit" and "lapbeth_rcv" can > reliably check and ensure the netif is running while doing their work. > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Signed-off-by: Xie He Is this a theoretical issues or do you see a path where it triggers? Who are the callers sending frames to a device which went down?