Received: by 2002:a89:413:0:b0:1fd:dba5:e537 with SMTP id m19csp768687lqs; Fri, 14 Jun 2024 05:23:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU4KwBWHTpvlaoS2No1Y7fBkShKy92iOnx4On1vaoCgfrJu2D5vXo1483OqXzq5RLFwPZRcFNG8mRfup7iB8DaVmcZyi8OJ/K0rT+kwMg== X-Google-Smtp-Source: AGHT+IFp+LLbKLBzxyg2F4oCpS3i7VEX6uNc2bWjkiEqJNhtfV9DW9WYMCbf+ZqmCyEMCSO2r2rb X-Received: by 2002:a05:6871:5b14:b0:258:42c8:7f69 with SMTP id 586e51a60fabf-25842c8813bmr2482793fac.23.1718367833654; Fri, 14 Jun 2024 05:23:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718367833; cv=pass; d=google.com; s=arc-20160816; b=FdairHU4BCDtheKnuPsj+v71NC7Pk/wuqTZEhn+D8t3UZink3Duo19uQzaeGL18qcM i2OABG47Bav+hz0zMcgiM+f3STXNEcI6Ki1UCzo64s/yqY9uIGMIv6cfTvlV3kvw5bwK xMnWcuJQVM/XEQ3Y1QDVkg9ulpc/u6gR9mKDKvFGAEv4SnFocV0CZ2+Yxhb2cyovuunH oO3XvjOl9E1U37wxLuwWt2YDvlwjJ9Tq7Jh/PNoxxWS6ae46OV85ltGOHqFLWu3bGe+4 sVCn62G+/mneG4jKKmujBXomGfB3rva7A+6bVhhJ/9t7gIePCETuHGoWmbNW4winaGyU qVNQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=/mRV0zer/4Bb0AOhZlZRDrtv8JkycCtbheq2qL/0MQ8=; fh=Hc6nWH1UOnkO8+RdWd0B9EM+lcwy3QCqiwp2hsZ77Tg=; b=bfVqbaTynFcqxGPUdJqgPXX4GyZVUeZ/BqWvqCDLdGTbOohx8WjUePzbLAdrvINZRB MlyTTGcrAHcYpd6vEyQ4TcWjg2AdBSlbD4hzGsjFg59np9pxSUwNLHmsk5F7xYrXI0g2 hrQfN934Aaf2KQ+6NVpggGx3en9k8au4Ik6egda9xw39pvZU3PQ5fhzxAGZP1J4UpHze GZakZB9QYdMvhv0X0KSfqrx0Z5PfWGucVYupDdA1r6IY9fOeg7pvnapL5ONVId2CJDKI iwgQvlQQVblweHfM5Idaam5evc6W0AupdvpW2NcKLqVuu7YmjvrqZ0S/2xYB5lSo9UFo 3FNw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=efNlWAtJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-214889-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214889-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-705ccb3d35asi3530102b3a.144.2024.06.14.05.23.53 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 05:23:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-214889-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=efNlWAtJ; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-214889-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-214889-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 39522282537 for ; Fri, 14 Jun 2024 12:23:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 01435197A8A; Fri, 14 Jun 2024 12:23:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="efNlWAtJ" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1F38B195F00; Fri, 14 Jun 2024 12:23:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718367825; cv=none; b=ktUszs0Pxrfpn6FsxPJpX/rtcD9fd9y8hasLjMmWKMuSzq/S3XHh6xf+P9SCLdBl0/9IoJdVUw3S43QJOp5/jmQ2KaMgCWMcrXQUiKQIYqWkymtOfcEVH66ie0J2wevT0ViEH9lyXhUALEmQT0DoxFz5dqJRX6OlhC49K55FDZk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718367825; c=relaxed/simple; bh=Wq0QL9TTeA8hyJFpC958b1J5yiGHR5mzwTwtihL+rwI=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gZnPwLpIFqkKIyaRq9RQFUwak2AeP93+vl4ENBJ8heSW4sTCM53jSn5ejcqyGjOZgTf/jFCbyQcoBUgW2usu/Hcj2JyWEqA57e+BNefar2D+DvdyeVLpwkcy6l1qrHuuJQjVe4NTmYKg5eWe89HYvgTlXA92snvoGXlnR858Hu0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=efNlWAtJ; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6291CC4AF1A; Fri, 14 Jun 2024 12:23:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1718367824; bh=Wq0QL9TTeA8hyJFpC958b1J5yiGHR5mzwTwtihL+rwI=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=efNlWAtJj1AqHSkLjjao0ysXiog2A6Cni2zjA4KCUQNFJtOEjO5RMkFt0Do+73mXF 7Uf47F+/GY6pS651dNy0ejIWP24xxOKKUUPIsgncQUZUKXHQS+nwPNRJBiG67HK6YJ hmzhRhkbOE+1Vr51Du6rbWqYHmXYMsNPaePyMWz9bOpAoCwSYiztw2FyC7pNY03Kcf WK3Cw8mP93h70zcLqgZSjIkrXB+RZqpUFg5KCB2aQ9/TBlR4Cku7YnnAhz4Kc0L8Iy aefGsNoCywEpHClQUKs5s7AtiYMWfqLhlvliMYHGvuY89fmuBRxIzd/ShQYNXGkZDL D7BNFMtYtxjaA== Date: Fri, 14 Jun 2024 13:23:41 +0100 From: Simon Horman To: Gui-Dong Han Cc: 3chas3@gmail.com, linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, baijiaju1990@gmail.com Subject: Re: [PATCH] atm/fore200e: Consolidate available cell rate update to prevent race condition Message-ID: <20240614122341.GK8447@kernel.org> References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Jun 11, 2024 at 11:54:10AM +0800, Gui-Dong Han wrote: > In fore200e_change_qos, there is a race condition due to two consecutive > updates to the 'available_cell_rate' variable. If a read operation > occurs between these updates, an intermediate value might be read, > leading to potential bugs. > > To fix this issue, 'available_cell_rate' should be adjusted in a single > operation, ensuring consistency and preventing any intermediate states > from being read. > > Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2") > Signed-off-by: Gui-Dong Han Hi Gui-Dong Han, If there is a race involving writing and reading available_cell_rate, then I believe there is still a race after your patch: if nothing protects to protect available_cell_rate from being read while it is written then that is true both before and after this patch. Also, I would suggest that this is a very old and possibly unused driver. If you wish to spend time on it I'd suggest that time go into investigating if it is appropriate to remove the driver entirely.