From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (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 BB1DB334C1C for ; Thu, 5 Mar 2026 12:44:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772714676; cv=none; b=EKBrH3J/BvrxDkRrLw17/UgRa4/dDjbiILC6ri+Wj9JO3V+DOwoAGZozuAZCeFZq5B6bRoirrQbQXFCEVxZufhVSvTo9pKkO1cuhBziB0s8xBBLWmI0ncqVInvhtCxP4EabFxO/PLDl4VDUXP+BbxucoX8D/U5xQf6O8jtPHYV4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772714676; c=relaxed/simple; bh=GSag5Q4jCngGqf98CXuJLR1x9DuqSRMDC68HgCORpnQ=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=qh+nKUYgkQYsx/saPQi+OMnSXdTZ6vtOF4wXG3PelOiaO4sypqj2/kGaNEpfA9TIbBgpM4lB4ASowHc6/jpAN99T88MszHXaTkybdOUMuo5ivweG5qmY/vF9pH7xQp9VwIPD0/Ia7XpvjWcRHeHYUFGmyoOXEjgg8EtNjptFcBU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=WHQNoay6; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="WHQNoay6" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-48334ee0aeaso66740285e9.1 for ; Thu, 05 Mar 2026 04:44:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1772714673; x=1773319473; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=sCltzBpa6o/UQP6jnCo3U251jlEDoBoIotp3CYCoQ0g=; b=WHQNoay6jvYiv2aA9GsH1XIN/QyT2hyxJyCY5K7lOtLd2UNmr9xT4u140F9B9Mp5DR efpuCTh9I120nVEOh8rt2i0EfKDYVpQoN956LAvRB6lySmgrXMNTGVRXHsjv3Tbuyvsu JyzJeJPRuQWCjrZRZiZZZ+z7/QIkRdDau+X6tompzzzRtkoz/JbNZdW63n5xvFZ/sfeA mLO8LypWKCPbxU/xjs/k2lw2IdHd6uyoNL+CWRM/tAHwQiQ0cx0hem1UctoyrZi+i8aW ui5M75QDyGMn0LLio17fIwK2q3tduZSkbPz+tjHBPy4uduwvnpvjupwH5Tbur2qDYIeT Dobw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772714673; x=1773319473; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=sCltzBpa6o/UQP6jnCo3U251jlEDoBoIotp3CYCoQ0g=; b=DpVpbevhJVmpwePJ/5jCzFTE7nQ1pBZFpRLnQgHhvH9TESw09nrwCZ3MmkUcEY52jP 8lJCatWtYNYWP4KLeFOBP5zSn7MqJZ0NRuf0ehEc2DbpA/O3gpKTSkSKP/4f/ssCs5b/ WfX/BdioC1B4QzpHJ2WR2t9Doa7U89FjppYKPBNSCOe/cTRZFgY4g1r0kVT9Bc9AnZ+w YoJxUDGRhJ0AQJjVwFuk8jThTKejgT7yD6Pjq/KjpTs4oE094gtDpo/CS/YBUeeMdQBP zxLGGLkNYeKtPH65DjTSGVPDycSr4fr9RHPpoN0RqeqX16W4vT04oZO3CL4VJUXDEO2m ncyA== X-Forwarded-Encrypted: i=1; AJvYcCX8nsE6lGToWsZxJbEHytI/R3vOnfUt1P72/MS2iqa4rjsieCWUHaOu85oBj5GgcxAHDzEKOnPJs6iLdLo=@vger.kernel.org X-Gm-Message-State: AOJu0Yxxu1AKC+l+8AFqkoYOPPQcs+FEJUDmRpwqMSJGXjPyTPJW/88q cehFww4z6L6wUvjWOaeEervraKYceoaJYCpe01BemjjLOxq9NsaA1w8ECSdg/1qULY8= X-Gm-Gg: ATEYQzz1V35SPIzL31o//GdT3DT9tN+Kxj/+kC2c1c/rRBcC5V+JSYO/EOmlnijPB8x 0FoQbTtAhHuWn3YjzX6qtow4e0a2wsCbEGYtbmou0BdO6UktfveyCjzQ5psstYVxsSoZTQ4/0QU I2OorBqXgnDP3qIJzcTR5TExKRuSj1MAw+366UYCMu6RegyqGRpkwDGE52+GMzShOwP9+mxjgZ/ 3O9BXKCgXlC8zX6wGCWuuQkdeMmgNVk1LaXQhkovPJhNgPYzbwiv6UJ91V1lfqyAemem1sYf50R AKGeBbRX8jQF+O4HUQqRtKW+ZoVMpxqVFdbLMJ8V2MlQOBjlMDpadEEbnaZn0Dnrndttd739nLp fePqxoxPk/U0svH5remD1axy/17gLWwB+24GVww+mHl5Fjm01S2TebZJFqoRyAOlly4FNHPYqSi BpzfHJPXQCjOgtt3eUjWOnOysshPw4SyENm/q7PkUeOYNowcXRZcE+hRWCIw4yGN5iYO8= X-Received: by 2002:a05:600c:4503:b0:483:709e:f239 with SMTP id 5b1f17b1804b1-48519899450mr91113005e9.22.1772714673216; Thu, 05 Mar 2026 04:44:33 -0800 (PST) Received: from ?IPV6:2001:a61:1363:9e01:43f1:e533:276c:e9a1? ([2001:a61:1363:9e01:43f1:e533:276c:e9a1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4851ad2b26dsm41681205e9.31.2026.03.05.04.44.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 05 Mar 2026 04:44:32 -0800 (PST) Message-ID: <678e1fc6-356d-426a-aec0-f0bf46c7d3af@suse.com> Date: Thu, 5 Mar 2026 13:44:31 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [BUG] usb: cdc-wdm: Missing barriers in ad-hoc lockless buffer To: Gui-Dong Han , Oliver Neukum Cc: Greg KH , robert.hodaszi@digi.com, kees@kernel.org, linux-usb@vger.kernel.org, LKML , Jia-Ju Bai References: Content-Language: en-US From: Oliver Neukum In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 05.03.26 13:28, Gui-Dong Han wrote: > Specifically, wdm_read() accesses ->length and then ->flags, often > without holding ->iuspin. Similarly, wdm_in_callback() involves > multiple accesses to both. > > I am indeed nervous about this pattern. Without barriers, changes to > these associated fields made on one CPU might be observed in a > completely different order on another CPU. OK, I rechecked. And indeed it seems to me like setting WDM_OVERFLOW and WDM_READ could be reordered with respect to each other in wdm_in_callback() and that must not happen. What do you think? Regards Oliver