From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-ed1-f46.google.com (mail-ed1-f46.google.com [209.85.208.46]) (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 5FF8D1CAA78 for ; Sat, 25 Jul 2026 13:51:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784987480; cv=none; b=aLxBogdYyXRWibEkMb47V0uC/11Vx+IjqO5huOlYa9Y8+1lGBpjrpQk30wO35ntMhPBdtBg3q+3sZHm9v+WrmUiI9BWaHTzLfuOC+r1aFh5H+m1LbAvyGZo5p+OiuPe9zwzZh97/IBTDTXcuuA4m/1Y959aSz1HFNWJPqwTX/wk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784987480; c=relaxed/simple; bh=Q2rwINsLIHuWtsN9gNQB47ul5fR6TEjP2J79aDcp0QI=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=MAehOuVuncz/y0Xc6bylVH1mbd8i1g9+0NN516C7ppbr7WvAGWnNe+FzU1Kmnn8TMTNDQSLECBz4HMMeNmJ1K9/8BQj0Osz5qB3/T6B5Vc5zKEhX1JA7p8D2jOkdeyMkd2bFKhbJrKP03KjQcsBq9DhEW5W9hQpEvs7Fr9ucmsE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=TJvJnR4r; arc=none smtp.client-ip=209.85.208.46 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="TJvJnR4r" Received: by mail-ed1-f46.google.com with SMTP id 4fb4d7f45d1cf-69f7af97316so1983235a12.0 for ; Sat, 25 Jul 2026 06:51:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784987478; x=1785592278; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=epma33FkPsF+b18kaxFsYumaC3sPMXsHXADeyJf9rV8=; b=TJvJnR4rU4I2RCyBHVYnwJuDDrDl59cT6ZvPZ/CJTeQizHGRFzyZxKs9poxRIVK5H7 bQe5qoA1Oo1h9SFC+V2PVnEsyaVaVkJRPNN8byokVFnJBjRe6sjttOvJu1u2X6XFPe4G bbGEoO4Qp0kCvbUH+qGGp/RFNI0EW/6m8f2VusBjjEG/q4X/jZ8OJK+WUWHqLcBF+3ir jIxir6ux9j3HQYt+9y7P6T3bEZwcBPsEKltYKmYJeQyv60HvedWj5l602IPWHkQX146Z yZf1ErOOOqwzBjgGO+EL2RC4lzvWQf8y3/VRJ6kY853wnSrvE742bruSju/c/VXXPPPk WoeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784987478; x=1785592278; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=epma33FkPsF+b18kaxFsYumaC3sPMXsHXADeyJf9rV8=; b=l3SHbHHana0cdgy6R+/1Nvdx8Pkx76gDLap5iqXtN7VhZlnIgb9Prafp9TpJCl6bne WDN+9SoB5U+ObPJY4+WyCJ0tHNvC53bW/uKH5yjlUGgxfk24Miv/7At258kKi/1jduqv m6zW6PnpwMhhxFNU77OvEd7oC02ucib6S7y3+Q5FqRKhYgtxamy+PNkn537Qjdggx3Et XnyPPWtwkPjIbKZiSKQy6rH65xHvhskxsp482sZIioY/0kePvl0crRxN6wQMt3GjYJRm EMAilx2t4dDU37pueWvrr0mrdtyZzuf0Wdixy3SFNbo4Srts225BuFAu0c2RBc+8dTay VAjw== X-Forwarded-Encrypted: i=1; AHgh+Rr1WeWLwiHhSYZQRrzHgtR4fFmuNDA9L4NazU2tvvfu8KQ4uT9bcQ6awcTFF78B59i+vg2v122jRwa0PBA=@vger.kernel.org X-Gm-Message-State: AOJu0Yyt0TNmcen526DBrpzrMPDpvPPxTDy0hueLTFZCldzejVifofDK ZyElz5JQx8FzK6fazEx2bsGGVWM0IlW8maVwShJrRJhTdRRh5WNoywX9 X-Gm-Gg: AR+sD12TH5nukaXGN8eZB2PoDhyXtceuz8kbc64HD7E22TUWo7Gv4eDH6K2BWuUdimi JxRDP4sYxLZQuQNNAsv0mMFoEq6UC0Epkl+ZW5KNq7VNCmA8NlvoiY2bDeIFo404n2FFEe2aLmg TQUJjfmCE1ducx8ikW2uaMQ7NTdeRIekFKn8YQFuHIbQe0q78CzrkyPmR7zpNhRD/xAP/3ttnCY UsxpkSnc66orbKs5n+oVZi1Fjq9BXUZFkExJsWgo8ObuTgj9R6Y+EQymSvl9QRLieSFOxQ1TGDw jXUrCOb/qhgwTpr0QQQs7sOSeyuARtDBAx8H38OAoxvoiHc6f44PT6rCDu3A2fAprZ+EaWup9m3 8LKQidd4C+Okr2gC5Mj9wyN05adesnOV7q0YWgDQNdFO2LNTJZEKfUOoYjmYMdUi2eYsuN/bMaz cZVS0OKPVOzc/9+RUvNNRL8gG+eeSKXs/40LVjwc65FABj0hpT9tkayqxg3IcPWk4= X-Received: by 2002:a05:6402:5244:b0:698:9ea5:d195 with SMTP id 4fb4d7f45d1cf-69fc113fd7amr815371a12.23.1784987477466; Sat, 25 Jul 2026 06:51:17 -0700 (PDT) Received: from misharu.home (2a02-a463-a071-0-7475-eec2-a79e-2db.fixed6.kpn.net. [2a02:a463:a071:0:7475:eec2:a79e:2db]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-69fb5543aacsm836431a12.14.2026.07.25.06.51.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 25 Jul 2026 06:51:15 -0700 (PDT) From: Hari Mishal To: Keith Busch , Jens Axboe , Christoph Hellwig , Sagi Grimberg Cc: Hannes Reinecke , Kanchan Joshi , Nitesh Shetty , Greg Kroah-Hartman , linux-nvme@lists.infradead.org, linux-kernel@vger.kernel.org, Hari Mishal Subject: [PATCH 0/2] nvme: fix racy access to FDP placement ID array Date: Sat, 25 Jul 2026 15:51:09 +0200 Message-ID: <20260725135111.14041-1-harimishal1@gmail.com> X-Mailer: git-send-email 2.43.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit nvme_ns_head can be shared across multiple nvme_ns paths (multipath, or dual-port/multi-controller subsystems). nvme_query_fdp_info() populates head->nr_plids/head->plids the first time a namespace's FDP configuration is registered, but nothing protects that pair from concurrent access - two paths scanning the same namespace at the same time can race to populate it, and depending on how the writes interleave a concurrent reader can hit a NULL dereference or an out-of-bounds read. Patch 1 adds a spinlock and closes the race. Patch 2 is a small, unrelated cleanup on code sitting right next to what patch 1 touches: it drops a WARN_ON_ONCE that turns out to be unreachable through any current path, since the value it guards against is already validated upstream in the block layer and F2FS before a bio ever carries it. Happy to drop this one or send it separately if you'd rather keep it out of this series. Hari Mishal (2): nvme: fix racy access to FDP placement ID array nvme: drop WARN_ON_ONCE on write_stream bounds check drivers/nvme/host/core.c | 63 ++++++++++++++++++++++++++-------------- drivers/nvme/host/nvme.h | 1 + 2 files changed, 43 insertions(+), 21 deletions(-) -- 2.43.0