[PATCH] nvme: fix racy access to FDP placement id array

Kanchan Joshi joshi.k at samsung.com
Mon Aug 17 02:22:42 PDT 2026


On 8/17/2026 1:53 PM, Christoph Hellwig wrote:
>> +	if (ctrl->ctratt & NVME_CTRL_ATTR_FDPS) {
>> +		ns->head = head;
>> +		ret = nvme_query_fdp_info(ns, info);
>> +		if (ret < 0)
>> +			goto out_clear_ns_head;
>> +	}
> The conditional assignment of ns->head here is weird.  Just pass it
> explicitly to nvme_query_fdp_info so that you don't have this issue.

ns->head is required even beyond nvme_query_fdp_info().

nvme_query_fdp_info(..)
-> nvme_submit_sync_cmd(ns->queue, &c, ruhs, size);
  -> __nvme_submit_sync_cmd(...);
   -> nvme_init_request();

Which is going to touch ns->head here:
          if (req->q->queuedata) {
                  struct nvme_ns *ns = req->q->disk->private_data;

                  logging_enabled = ns->head->passthru_err_log_enabled;
	}



More information about the Linux-nvme mailing list