From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DCE63A9001 for ; Thu, 19 Mar 2026 08:18:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773908340; cv=none; b=M93t+Fv3S+jct/UuMjpiclVsHHtqlrgibYwNKY7a4wDvIxIRO4oPMvJ45z+TJCTlLYuj574aQHlxNHx91f6mqm///Lg1KPyRmJjP2lTYig+Y7+UqQEkkxWPwIqORUCyIO3gFR5JXP2tz7bBZ4JBQc544SLxJRO5WFYBN+SZsR2o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773908340; c=relaxed/simple; bh=yYPFeR+9rZHguoj4BB9SHq5TLXklflUZ5MPugf3pC5I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=DoJ3oTAcwCVnpnXzN2tAT5Cm2fTFSEs9r1LzpMRx11B+hzrg2oSyjF3WBwzZDCqzNsBH8r1KGAAiPfDEiwZXb4cFkOaAJuAUdDav9mOU3F/AfH49+3avMX90vOm1QuXWIJH17vbxCpjYtGRlNs3tt++KJscsLixFhJZsusxcx28= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=ZxynHTCp; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ZxynHTCp" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-43b4d73463dso423647f8f.3 for ; Thu, 19 Mar 2026 01:18:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1773908338; x=1774513138; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=amjYQZfBKkEkQUzU1vC0opHZdoT0Y5MlykYOj+Aru5k=; b=ZxynHTCptHXxSs2/1U25EyRYQWQI2AM3E7IznlWnCWIVGkP4LZLEK5FJ8m5Z1aJ/Or T2xJFRTDKvz91gUF6TFic+OShxhZLqELCKbGO+2YTAP0ZNfVIj10kNxmCsoOztkqk8YO 9BOavq+Q2zZMp5beOcHWtKOknSvAJgKw6bbu+nSW6u6dWdbtzNyHs3UlHe/SphjjAEQh n2UO+rRD3pdtshkC97ol60ijMJ/GiSUB/IZy+n1BkcHnYXFzIQqAXa5AsU1USN19b1AT fgkh25qNThQ5t4fLolDPqkWinJ7WavaSN4r+tOAHQcdJcMq7+PEc9sSQP3jFA/AltDIP z8UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773908338; x=1774513138; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=amjYQZfBKkEkQUzU1vC0opHZdoT0Y5MlykYOj+Aru5k=; b=a0NQwKmhcib//lmD3k4rIVs2zLzFLS0SHqov/9ZV5tIvQGrCkj3D2wpAYVif0LN17T HFnuxxgx+FNmmRmD7zXaQxHJI7NJaABY9X0ychTgMMb+EXzH8MDp2LR7c1lFnAsWGNv5 OmRpI+KuZHMgKELRDgQyVpcNJGkyCW/MAhLdCW185v5vCy5jeFdLwAaeXIPlO/bHLgjI uy+4QH5NKZgOCk5tW2A9ZmW7otIezliGcHH+LfiDhKi22WgQYhv3u8pZ0mbFH7MjwbjX JdrNl2QkdhO4kYxEZicSHHSltRCMV8dXFH/VipiRZz3mLpLTG1Q8ZeCjLAZcSVbTgIVw HLHQ== X-Forwarded-Encrypted: i=1; AJvYcCW4OwStsiglUR8RKys2GBkD9DyA+JccwvWW03NvE9MBBZdMuFZubS0W+YFUotCrNxY9I7bKeCNN/NVFWRw=@vger.kernel.org X-Gm-Message-State: AOJu0YxZaWYR8p6RL7PptTQ5SM+uJi59vBCqAigujJOjokjWaz64Jc0h LIDcgyRo7jy+coxlQ/aRF3uEvtwWiVEbBzw1nf6KKLR492WCQUkTq0lJ9wsvau7la5vfF0OCYM5 26T+5 X-Gm-Gg: ATEYQzz9IA7exVuTusOW//y9QEYEAmbZPjjEw1dXBmxl9PtCdLDLWX3Hecyc8PvYn7b eK+CHTv7CGeC3T/6cufTA4r+F3jaZwmAHNq1jACnoViTOCwPUBYlcmM7F3I2C24PwORvLa1T6if mVYlp1LYOPZcpqrZdsCHT+OcCwaK9mjIgbk8VesqrwkmPIdnb5eQ3T9jogINdvioUwJ89sEkTA0 k8U4aUhRwwnfSv3AhmoiIPEJTQ1zWmZPfl1JqwK95UQtx+y/I+DxDRIUjJK2dyF5/Y27dJCSGEg 7Xq3DlQMyiwi44nuc0qIgjAN7xAfqOAoDDsbIZN6VQCuekgXnfmvhf+Xj1WesbCjG4rEqaKHTfU 9DtR4khe4F//1aM50KbjTnG5vIcJivC8Q4TqWe3MxUjG7793gnA0exl3wzKkKJ3IahsY7u9KFx3 HTOHqTI6/Fg2HXQMpqw/6yKYgL5Bf6 X-Received: by 2002:a05:6000:2011:b0:439:b486:ba6b with SMTP id ffacd0b85a97d-43b527ccd84mr10947850f8f.39.1773908337569; Thu, 19 Mar 2026 01:18:57 -0700 (PDT) Received: from localhost ([196.207.164.177]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-43b51899622sm16181985f8f.28.2026.03.19.01.18.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Mar 2026 01:18:56 -0700 (PDT) Date: Thu, 19 Mar 2026 11:18:53 +0300 From: Dan Carpenter To: Minu Jin Cc: parthiban.veerasooran@microchip.com, christian.gromm@microchip.com, gregkh@linuxfoundation.org, kees@kernel.org, ethantidmore06@gmail.com, linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [PATCH v3] staging: most: dim2: fix race condition in network info delivery Message-ID: References: <20260318164906.262225-1-s9430939@naver.com> 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: <20260318164906.262225-1-s9430939@naver.com> On Thu, Mar 19, 2026 at 01:49:06AM +0900, Minu Jin wrote: > The previous implementation could lead to race conditions between > deliver_netinfo_thread() and retrieve_netinfo(). > Additionally, multiple interrupts could lead to event loss. > > 1. Using local variables to store a snapshot of the network > information under a spinlock. This prevents race conditions between > deliver_netinfo_thread() and retrieve_netinfo(). > > 2. Invoking the on_netinfo() callback outside the spinlock. Since > callbacks may sleep or take other locks, it must be called after > releasing the spinlock, using the previously captured local variables. > > 3. Introducing an 'is_netinfo_pending' flag to track the delivery > status. This avoids redundant wake-ups of the delivery > thread when multiple interrupts occur. > > Fixes: ba3d7ddfb5c6 ("Staging: most: add MOST driver's hdm-dim2 module") > Signed-off-by: Minu Jin > --- > Changes in v3: > - No code chages: resend to include missing mailing lists. > > Changes in v2: > - Add 'is_netinfo_pending' flag to prevent redundant wake-ups. > - Add Fixes tag. > > Test Note: > - Compiled success, with no error. > - Verified with Smatch, no new warnings. > I had really hoped this was tested... It's difficult to know just from looking at it if it's correct. We could add a FIXME in the code: /* FIXME: This is racy. See: * https://lore.kernel.org/all/20260318164906.262225-1-s9430939@naver.com/ */ We wouldn't need is_netinfo_pending because we already have dev->deliver_netinfo. But I'm not sure that this patch is correct. Probably it's less correct than the current behavior which will eventually set it to the right thing even if it goes through a corrupted step first. regards, dan carpenter