Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) (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 57D903B9927 for ; Tue, 26 May 2026 07:52:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.44 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779781961; cv=none; b=a23GLXkNV/AExBvl0mPkH3Z1OCSO3wW+xEmh8Qn2orri9sbf6bVF4sCZj4S7uUmVffHcoJsfgC4Gb2+aANp02X/Q3MyUrcAxO8z5Z6YFtGS0Vo90CSBNfGXODwWGbJ/A6Ujh8C76nndF1BPhV9fBh1tI/JLICpFAwLaW/P+EsiA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1779781961; c=relaxed/simple; bh=UFopUPykd1bI74pDe8Mgp3GD7nBQ4Ono3664xzU8KoY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=Y5AOuAvV0n/1bakI3Bq3LaVX05b+7GtNByGxwHBqxEVAaSiwrUae2i5/r+/nSQNiCNYfIsp9McaJ6b+YlGJbYZS+BN6ihbe7gm5qHABduC3FMSRKlWucwzSn/pa1c4BLfmUTqCR8yVNGFa0wQwlpWlWQL1SCsmOqhtXr4YjgDGQ= 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=bFTrHgMV; arc=none smtp.client-ip=209.85.128.44 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="bFTrHgMV" Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4903d730b1fso38754905e9.2 for ; Tue, 26 May 2026 00:52:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1779781959; x=1780386759; 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; bh=pbYIBGOEmwzLz4cPeDZTCHq1J54eRqPgjWFbvt/fJSk=; b=bFTrHgMVRoCj6ggw2wRvm9MqTRxU+x/9dWCkl6Mt4taMBGvqT2LF4ZTp+hlQjK4EHW pxOkITRdzs2DsYv1+YoaFuLJVAHOT2fOg4008AXX3GO4xeul87HpY37WG4K/g1rQNFzH GhPTL9u1fHoaX3iOZKJf//TelxfwHlbH+UGar3ShZW1CmlIUkNXbk9izsWgdgWqIBIUc PWXsYaHeeyqR+J0KofCBkVORDMdtLrbX6mKMSZialQV4mwJmVkzaL3Vr3I7RvGafqNrS EUJ6sC+mM9XmFrNBhGzXJaRzwFR788DhBoNur5pcw14Qxxb9Q31GnbhIKdo2+mWp0CaX FPGw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779781959; x=1780386759; 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; bh=pbYIBGOEmwzLz4cPeDZTCHq1J54eRqPgjWFbvt/fJSk=; b=EChVBVnoPZMkK0lOgJA5uZ1uoSPfaY/FU4yZzF5bhsf7l64C6ew6+zNKr9Vkm3Sdwk JgCabqespSaSQFyZ6l9V75+CquvcyuxRoTj7BAQX330i/6lTzVseCCLB1F7bzpXTUrTE 6h6T6tkKH5YthIC0IVAOSzPNPJueLSML9thdOJdly3P7SBqQEhef7d27n2c1F9LXfQ6t d78vDvVf4GQIntDDPhJjVFHiCWIQhPRUrf5mdZgk2P8UdaKD14MLbTgrbHMjVcO0vSly Ti8bVJs1meFo1DtMYGIlLt8g9zrpOcLiZZ9lhYZifEhAWA8Tdc9yA+o8BwMKpXarO1AO lWtw== X-Forwarded-Encrypted: i=1; AFNElJ+imgPVKbf9STgYIfsgj+0YxOEWdyPqEF3g/qXIP+5EqkrUGcR1wdOnf83I3s3ckYy6DH9zMaNGoTJrPVM=@vger.kernel.org X-Gm-Message-State: AOJu0Yz2Z1O3WcCac+7//hIRHmUt+RUTMyv09sOVTT9Pe1C8e7BnUwCo hbov0VtzNtY+dsV1D8xvR6XlC2gbsiTFaosVBi2n4V/x9HVKkXeGa+hh X-Gm-Gg: Acq92OGbPu1puvsdJy95aTgC4OgecqTzJeByJ2LAdOMxUrE+Mq0nRd323FygLR7Lxh2 W21nZ5J3oPQmDKpGhbNNCBzHKuDWspYDEJrdE/CtZl9rUZ18rZ54bM9kX8VwkxPG7U/jt6eM6YL hMfZi30uQnOvEvXiWuahHZJc+UpwPiHeW7WPaW0YB6DQZeyN+RIpEvxBteCIX6VL7XWfVCUq2R7 wsoX4QAlqgZmjMzWp8g5CSk14RtDPqcs7EJKd56HZKYCqL5rPubgbk6iHBxQPSLsi50DPdft+m1 +/gHwrRUbZ45UB1OK3UzcrpByO5/yWmSuj+XuAT2BAs7n3aFn82F6mXLswlig+Xmr9AfAe/0D1j pCnbJPGPFsBmYEx6LFB3rrAv+pACEqZ2393QA9PVc69SqtX85BVto/Fft7K11FCz7Sqz/pUbN6r WRYFH1iSEOrZsbrMVNbZh7eHrD5Fwv X-Received: by 2002:a05:600c:a213:b0:48e:8741:fd42 with SMTP id 5b1f17b1804b1-490424ada3bmr187126135e9.12.1779781958408; Tue, 26 May 2026 00:52:38 -0700 (PDT) Received: from [127.0.1.1] ([2a09:bac5:3803:1cdc::2e0:83]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4904526c926sm540682825e9.1.2026.05.26.00.52.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2026 00:52:38 -0700 (PDT) From: liuxixin To: linux-nvme@lists.infradead.org Cc: kbusch@kernel.org, axboe@kernel.dk, hch@lst.de, sagi@grimberg.me, linux-kernel@vger.kernel.org Subject: [PATCH v1 0/1] nvme: fix FDP configuration log parsing (NUMFDPC / fdpcidx) Date: Tue, 26 May 2026 15:52:35 +0800 Message-ID: <177978195555.4106423.1566684328319724660@gmail.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=UTF-8 Content-Transfer-Encoding: 8bit X-Mailer: send-local.py Hi, NUMFDPC in the FDP Configurations log (NVMe Base Specification, Figure 279) is a 0-based count of configuration descriptors. Valid fdpcidx values are 0 through the NUMFDPC field value inclusive. Since commit 30b5f20bb2dd (nvme: register fdp parameters with the block layer), the host driver used: n = NUMFDPC + 1; if (fdp_idx > n) which incorrectly accepts fdpcidx == NUMFDPC+1. When forcing fdpcidx=1 on a namespace that reports a single FDP configuration (NUMFDPC field 0), the unfixed driver proceeds into the descriptor walk and reports: FDP invalid config descriptor list This patch fixes the bounds check and also validates descriptor sizes while walking the descriptor list so dsze == 0 or a descriptor past the log end cannot cause unbounded iteration or reads past the buffer. ## Test plan - Build: make M=drivers/nvme -j12 - Repro/validation (lab): Tested on linux-next 7.1.0-rc4-next-20260521 with QEMU 8.2 nvme-subsys,fdp=on. With a single FDP configuration (NUMFDPC field 0), forcing fdpcidx=1 triggers FDP invalid config descriptor list on the unfixed driver, while the fix rejects it early with FDP index:1 out of range:0 and skips stream registration. Thanks, liuxixin