Skip to content

Commit d90c470

Browse files
committed
Merge tag 'nvme-7.0-2026-03-04' of git://git.infradead.org/nvme into block-7.0
Pull NVMe fixes from Keith: "- Improve quirk visibility and configurability (Maurizio) - Fix runtime user modification to queue setup (Keith) - Fix multipath leak on try_module_get failure (Keith) - Ignore ambiguous spec definitions for better atomics support (John) - Fix admin queue leak on controller reset (Ming) - Fix large allocation in persistent reservation read keys (Sungwoo Kim) - Fix fcloop callback handling (Justin) - Securely free DHCHAP secrets (Daniel) - Various cleanups and typo fixes (John, Wilfred)" * tag 'nvme-7.0-2026-03-04' of git://git.infradead.org/nvme: nvme: fix memory allocation in nvme_pr_read_keys() nvme-multipath: fix leak on try_module_get failure nvmet-fcloop: Check remoteport port_state before calling done callback nvme-pci: do not try to add queue maps at runtime nvme-pci: cap queue creation to used queues nvme-pci: ensure we're polling a polled queue nvme: fix memory leak in quirks_param_set() nvme: correct comment about nvme_ns_remove() nvme: stop setting namespace gendisk device driver data nvme: add support for dynamic quirk configuration via module parameter nvme: fix admin queue leak on controller reset nvme-fabrics: use kfree_sensitive() for DHCHAP secrets nvme: stop using AWUPF nvme: expose active quirks in sysfs nvme/host: fixup some typos
2 parents 8da8df4 + c332015 commit d90c470

10 files changed

Lines changed: 312 additions & 37 deletions

File tree

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
TPM TPM drivers are enabled.
7575
UMS USB Mass Storage support is enabled.
7676
USB USB support is enabled.
77+
NVME NVMe support is enabled
7778
USBHID USB Human Interface Device support is enabled.
7879
V4L Video For Linux support is enabled.
7980
VGA The VGA console has been enabled.
@@ -4787,6 +4788,18 @@ Kernel parameters
47874788
This can be set from sysctl after boot.
47884789
See Documentation/admin-guide/sysctl/vm.rst for details.
47894790

4791+
nvme.quirks= [NVME] A list of quirk entries to augment the built-in
4792+
nvme quirk list. List entries are separated by a
4793+
'-' character.
4794+
Each entry has the form VendorID:ProductID:quirk_names.
4795+
The IDs are 4-digits hex numbers and quirk_names is a
4796+
list of quirk names separated by commas. A quirk name
4797+
can be prefixed by '^', meaning that the specified
4798+
quirk must be disabled.
4799+
4800+
Example:
4801+
nvme.quirks=7710:2267:bogus_nid,^identify_cns-9900:7711:broken_msi
4802+
47904803
ohci1394_dma=early [HW,EARLY] enable debugging via the ohci1394 driver.
47914804
See Documentation/core-api/debugging-via-ohci1394.rst for more
47924805
info.

drivers/nvme/host/core.c

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2046,14 +2046,10 @@ static u32 nvme_configure_atomic_write(struct nvme_ns *ns,
20462046
if (id->nabspf)
20472047
boundary = (le16_to_cpu(id->nabspf) + 1) * bs;
20482048
} else {
2049-
/*
2050-
* Use the controller wide atomic write unit. This sucks
2051-
* because the limit is defined in terms of logical blocks while
2052-
* namespaces can have different formats, and because there is
2053-
* no clear language in the specification prohibiting different
2054-
* values for different controllers in the subsystem.
2055-
*/
2056-
atomic_bs = (1 + ns->ctrl->subsys->awupf) * bs;
2049+
if (ns->ctrl->awupf)
2050+
dev_info_once(ns->ctrl->device,
2051+
"AWUPF ignored, only NAWUPF accepted\n");
2052+
atomic_bs = bs;
20572053
}
20582054

20592055
lim->atomic_write_hw_max = atomic_bs;
@@ -3222,7 +3218,6 @@ static int nvme_init_subsystem(struct nvme_ctrl *ctrl, struct nvme_id_ctrl *id)
32223218
memcpy(subsys->model, id->mn, sizeof(subsys->model));
32233219
subsys->vendor_id = le16_to_cpu(id->vid);
32243220
subsys->cmic = id->cmic;
3225-
subsys->awupf = le16_to_cpu(id->awupf);
32263221

32273222
/* Versions prior to 1.4 don't necessarily report a valid type */
32283223
if (id->cntrltype == NVME_CTRL_DISC ||
@@ -3655,6 +3650,7 @@ static int nvme_init_identify(struct nvme_ctrl *ctrl)
36553650
dev_pm_qos_expose_latency_tolerance(ctrl->device);
36563651
else if (!ctrl->apst_enabled && prev_apst_enabled)
36573652
dev_pm_qos_hide_latency_tolerance(ctrl->device);
3653+
ctrl->awupf = le16_to_cpu(id->awupf);
36583654
out_free:
36593655
kfree(id);
36603656
return ret;
@@ -4186,13 +4182,6 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, struct nvme_ns_info *info)
41864182
nvme_mpath_add_disk(ns, info->anagrpid);
41874183
nvme_fault_inject_init(&ns->fault_inject, ns->disk->disk_name);
41884184

4189-
/*
4190-
* Set ns->disk->device->driver_data to ns so we can access
4191-
* ns->head->passthru_err_log_enabled in
4192-
* nvme_io_passthru_err_log_enabled_[store | show]().
4193-
*/
4194-
dev_set_drvdata(disk_to_dev(ns->disk), ns);
4195-
41964185
return;
41974186

41984187
out_cleanup_ns_from_list:
@@ -4865,6 +4854,13 @@ int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
48654854
if (ret)
48664855
return ret;
48674856

4857+
/*
4858+
* If a previous admin queue exists (e.g., from before a reset),
4859+
* put it now before allocating a new one to avoid orphaning it.
4860+
*/
4861+
if (ctrl->admin_q)
4862+
blk_put_queue(ctrl->admin_q);
4863+
48684864
ctrl->admin_q = blk_mq_alloc_queue(set, &lim, NULL);
48694865
if (IS_ERR(ctrl->admin_q)) {
48704866
ret = PTR_ERR(ctrl->admin_q);

drivers/nvme/host/fabrics.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,8 +1290,8 @@ void nvmf_free_options(struct nvmf_ctrl_options *opts)
12901290
kfree(opts->subsysnqn);
12911291
kfree(opts->host_traddr);
12921292
kfree(opts->host_iface);
1293-
kfree(opts->dhchap_secret);
1294-
kfree(opts->dhchap_ctrl_secret);
1293+
kfree_sensitive(opts->dhchap_secret);
1294+
kfree_sensitive(opts->dhchap_ctrl_secret);
12951295
kfree(opts);
12961296
}
12971297
EXPORT_SYMBOL_GPL(nvmf_free_options);

drivers/nvme/host/multipath.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1300,7 +1300,7 @@ void nvme_mpath_remove_disk(struct nvme_ns_head *head)
13001300
mutex_lock(&head->subsys->lock);
13011301
/*
13021302
* We are called when all paths have been removed, and at that point
1303-
* head->list is expected to be empty. However, nvme_remove_ns() and
1303+
* head->list is expected to be empty. However, nvme_ns_remove() and
13041304
* nvme_init_ns_head() can run concurrently and so if head->delayed_
13051305
* removal_secs is configured, it is possible that by the time we reach
13061306
* this point, head->list may no longer be empty. Therefore, we recheck
@@ -1310,13 +1310,11 @@ void nvme_mpath_remove_disk(struct nvme_ns_head *head)
13101310
if (!list_empty(&head->list))
13111311
goto out;
13121312

1313-
if (head->delayed_removal_secs) {
1314-
/*
1315-
* Ensure that no one could remove this module while the head
1316-
* remove work is pending.
1317-
*/
1318-
if (!try_module_get(THIS_MODULE))
1319-
goto out;
1313+
/*
1314+
* Ensure that no one could remove this module while the head
1315+
* remove work is pending.
1316+
*/
1317+
if (head->delayed_removal_secs && try_module_get(THIS_MODULE)) {
13201318
mod_delayed_work(nvme_wq, &head->remove_work,
13211319
head->delayed_removal_secs * HZ);
13221320
} else {

drivers/nvme/host/nvme.h

Lines changed: 56 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,60 @@ enum nvme_quirks {
180180
NVME_QUIRK_DMAPOOL_ALIGN_512 = (1 << 22),
181181
};
182182

183+
static inline char *nvme_quirk_name(enum nvme_quirks q)
184+
{
185+
switch (q) {
186+
case NVME_QUIRK_STRIPE_SIZE:
187+
return "stripe_size";
188+
case NVME_QUIRK_IDENTIFY_CNS:
189+
return "identify_cns";
190+
case NVME_QUIRK_DEALLOCATE_ZEROES:
191+
return "deallocate_zeroes";
192+
case NVME_QUIRK_DELAY_BEFORE_CHK_RDY:
193+
return "delay_before_chk_rdy";
194+
case NVME_QUIRK_NO_APST:
195+
return "no_apst";
196+
case NVME_QUIRK_NO_DEEPEST_PS:
197+
return "no_deepest_ps";
198+
case NVME_QUIRK_QDEPTH_ONE:
199+
return "qdepth_one";
200+
case NVME_QUIRK_MEDIUM_PRIO_SQ:
201+
return "medium_prio_sq";
202+
case NVME_QUIRK_IGNORE_DEV_SUBNQN:
203+
return "ignore_dev_subnqn";
204+
case NVME_QUIRK_DISABLE_WRITE_ZEROES:
205+
return "disable_write_zeroes";
206+
case NVME_QUIRK_SIMPLE_SUSPEND:
207+
return "simple_suspend";
208+
case NVME_QUIRK_SINGLE_VECTOR:
209+
return "single_vector";
210+
case NVME_QUIRK_128_BYTES_SQES:
211+
return "128_bytes_sqes";
212+
case NVME_QUIRK_SHARED_TAGS:
213+
return "shared_tags";
214+
case NVME_QUIRK_NO_TEMP_THRESH_CHANGE:
215+
return "no_temp_thresh_change";
216+
case NVME_QUIRK_NO_NS_DESC_LIST:
217+
return "no_ns_desc_list";
218+
case NVME_QUIRK_DMA_ADDRESS_BITS_48:
219+
return "dma_address_bits_48";
220+
case NVME_QUIRK_SKIP_CID_GEN:
221+
return "skip_cid_gen";
222+
case NVME_QUIRK_BOGUS_NID:
223+
return "bogus_nid";
224+
case NVME_QUIRK_NO_SECONDARY_TEMP_THRESH:
225+
return "no_secondary_temp_thresh";
226+
case NVME_QUIRK_FORCE_NO_SIMPLE_SUSPEND:
227+
return "force_no_simple_suspend";
228+
case NVME_QUIRK_BROKEN_MSI:
229+
return "broken_msi";
230+
case NVME_QUIRK_DMAPOOL_ALIGN_512:
231+
return "dmapool_align_512";
232+
}
233+
234+
return "unknown";
235+
}
236+
183237
/*
184238
* Common request structure for NVMe passthrough. All drivers must have
185239
* this structure as the first member of their request-private data.
@@ -410,6 +464,8 @@ struct nvme_ctrl {
410464

411465
enum nvme_ctrl_type cntrltype;
412466
enum nvme_dctype dctype;
467+
468+
u16 awupf; /* 0's based value. */
413469
};
414470

415471
static inline enum nvme_ctrl_state nvme_ctrl_state(struct nvme_ctrl *ctrl)
@@ -442,7 +498,6 @@ struct nvme_subsystem {
442498
u8 cmic;
443499
enum nvme_subsys_type subtype;
444500
u16 vendor_id;
445-
u16 awupf; /* 0's based value. */
446501
struct ida ns_ida;
447502
#ifdef CONFIG_NVME_MULTIPATH
448503
enum nvme_iopolicy iopolicy;

0 commit comments

Comments
 (0)