Skip to content

Commit 7354850

Browse files
committed
Merge tag 'block-7.0-20260312' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux
Pull block fixes from Jens Axboe: - NVMe pull request via Keith: - Fix nvme-pci IRQ race and slab-out-of-bounds access - Fix recursive workqueue locking for target async events - Various cleanups - Fix a potential NULL pointer dereference in ublk on size setting - ublk automatic partition scanning fix - Two s390 dasd fixes * tag 'block-7.0-20260312' of git://git.kernel.org/pub/scm/linux/kernel/git/axboe/linux: nvme: Annotate struct nvme_dhchap_key with __counted_by nvme-core: do not pass empty queue_limits to blk_mq_alloc_queue() nvme-pci: Fix race bug in nvme_poll_irqdisable() nvmet: move async event work off nvmet-wq nvme-pci: Fix slab-out-of-bounds in nvme_dbbuf_set s390/dasd: Copy detected format information to secondary device s390/dasd: Move quiesce state with pprc swap ublk: don't clear GD_SUPPRESS_PART_SCAN for unprivileged daemons ublk: fix NULL pointer dereference in ublk_ctrl_set_size()
2 parents e67bf35 + 7d0abef commit 7354850

9 files changed

Lines changed: 50 additions & 13 deletions

File tree

drivers/block/ublk_drv.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4443,7 +4443,9 @@ static int ublk_ctrl_start_dev(struct ublk_device *ub,
44434443

44444444
/* Skip partition scan if disabled by user */
44454445
if (ub->dev_info.flags & UBLK_F_NO_AUTO_PART_SCAN) {
4446-
clear_bit(GD_SUPPRESS_PART_SCAN, &disk->state);
4446+
/* Not clear for unprivileged daemons, see comment above */
4447+
if (!ub->unprivileged_daemons)
4448+
clear_bit(GD_SUPPRESS_PART_SCAN, &disk->state);
44474449
} else {
44484450
/* Schedule async partition scan for trusted daemons */
44494451
if (!ub->unprivileged_daemons)
@@ -5006,15 +5008,22 @@ static int ublk_ctrl_get_features(const struct ublksrv_ctrl_cmd *header)
50065008
return 0;
50075009
}
50085010

5009-
static void ublk_ctrl_set_size(struct ublk_device *ub, const struct ublksrv_ctrl_cmd *header)
5011+
static int ublk_ctrl_set_size(struct ublk_device *ub, const struct ublksrv_ctrl_cmd *header)
50105012
{
50115013
struct ublk_param_basic *p = &ub->params.basic;
50125014
u64 new_size = header->data[0];
5015+
int ret = 0;
50135016

50145017
mutex_lock(&ub->mutex);
5018+
if (!ub->ub_disk) {
5019+
ret = -ENODEV;
5020+
goto out;
5021+
}
50155022
p->dev_sectors = new_size;
50165023
set_capacity_and_notify(ub->ub_disk, p->dev_sectors);
5024+
out:
50175025
mutex_unlock(&ub->mutex);
5026+
return ret;
50185027
}
50195028

50205029
struct count_busy {
@@ -5335,8 +5344,7 @@ static int ublk_ctrl_uring_cmd(struct io_uring_cmd *cmd,
53355344
ret = ublk_ctrl_end_recovery(ub, &header);
53365345
break;
53375346
case UBLK_CMD_UPDATE_SIZE:
5338-
ublk_ctrl_set_size(ub, &header);
5339-
ret = 0;
5347+
ret = ublk_ctrl_set_size(ub, &header);
53405348
break;
53415349
case UBLK_CMD_QUIESCE_DEV:
53425350
ret = ublk_ctrl_quiesce_dev(ub, &header);

drivers/nvme/host/core.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4834,7 +4834,6 @@ EXPORT_SYMBOL_GPL(nvme_complete_async_event);
48344834
int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
48354835
const struct blk_mq_ops *ops, unsigned int cmd_size)
48364836
{
4837-
struct queue_limits lim = {};
48384837
int ret;
48394838

48404839
memset(set, 0, sizeof(*set));
@@ -4861,7 +4860,7 @@ int nvme_alloc_admin_tag_set(struct nvme_ctrl *ctrl, struct blk_mq_tag_set *set,
48614860
if (ctrl->admin_q)
48624861
blk_put_queue(ctrl->admin_q);
48634862

4864-
ctrl->admin_q = blk_mq_alloc_queue(set, &lim, NULL);
4863+
ctrl->admin_q = blk_mq_alloc_queue(set, NULL, NULL);
48654864
if (IS_ERR(ctrl->admin_q)) {
48664865
ret = PTR_ERR(ctrl->admin_q);
48674866
goto out_free_tagset;

drivers/nvme/host/pci.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -544,7 +544,7 @@ static void nvme_dbbuf_set(struct nvme_dev *dev)
544544
/* Free memory and continue on */
545545
nvme_dbbuf_dma_free(dev);
546546

547-
for (i = 1; i <= dev->online_queues; i++)
547+
for (i = 1; i < dev->online_queues; i++)
548548
nvme_dbbuf_free(&dev->queues[i]);
549549
}
550550
}
@@ -1625,14 +1625,16 @@ static irqreturn_t nvme_irq_check(int irq, void *data)
16251625
static void nvme_poll_irqdisable(struct nvme_queue *nvmeq)
16261626
{
16271627
struct pci_dev *pdev = to_pci_dev(nvmeq->dev->dev);
1628+
int irq;
16281629

16291630
WARN_ON_ONCE(test_bit(NVMEQ_POLLED, &nvmeq->flags));
16301631

1631-
disable_irq(pci_irq_vector(pdev, nvmeq->cq_vector));
1632+
irq = pci_irq_vector(pdev, nvmeq->cq_vector);
1633+
disable_irq(irq);
16321634
spin_lock(&nvmeq->cq_poll_lock);
16331635
nvme_poll_cq(nvmeq, NULL);
16341636
spin_unlock(&nvmeq->cq_poll_lock);
1635-
enable_irq(pci_irq_vector(pdev, nvmeq->cq_vector));
1637+
enable_irq(irq);
16361638
}
16371639

16381640
static int nvme_poll(struct blk_mq_hw_ctx *hctx, struct io_comp_batch *iob)

drivers/nvme/target/admin-cmd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1585,7 +1585,7 @@ void nvmet_execute_async_event(struct nvmet_req *req)
15851585
ctrl->async_event_cmds[ctrl->nr_async_event_cmds++] = req;
15861586
mutex_unlock(&ctrl->lock);
15871587

1588-
queue_work(nvmet_wq, &ctrl->async_event_work);
1588+
queue_work(nvmet_aen_wq, &ctrl->async_event_work);
15891589
}
15901590

15911591
void nvmet_execute_keep_alive(struct nvmet_req *req)

drivers/nvme/target/core.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ static DEFINE_IDA(cntlid_ida);
2727

2828
struct workqueue_struct *nvmet_wq;
2929
EXPORT_SYMBOL_GPL(nvmet_wq);
30+
struct workqueue_struct *nvmet_aen_wq;
31+
EXPORT_SYMBOL_GPL(nvmet_aen_wq);
3032

3133
/*
3234
* This read/write semaphore is used to synchronize access to configuration
@@ -206,7 +208,7 @@ void nvmet_add_async_event(struct nvmet_ctrl *ctrl, u8 event_type,
206208
list_add_tail(&aen->entry, &ctrl->async_events);
207209
mutex_unlock(&ctrl->lock);
208210

209-
queue_work(nvmet_wq, &ctrl->async_event_work);
211+
queue_work(nvmet_aen_wq, &ctrl->async_event_work);
210212
}
211213

212214
static void nvmet_add_to_changed_ns_log(struct nvmet_ctrl *ctrl, __le32 nsid)
@@ -1956,9 +1958,14 @@ static int __init nvmet_init(void)
19561958
if (!nvmet_wq)
19571959
goto out_free_buffered_work_queue;
19581960

1961+
nvmet_aen_wq = alloc_workqueue("nvmet-aen-wq",
1962+
WQ_MEM_RECLAIM | WQ_UNBOUND, 0);
1963+
if (!nvmet_aen_wq)
1964+
goto out_free_nvmet_work_queue;
1965+
19591966
error = nvmet_init_debugfs();
19601967
if (error)
1961-
goto out_free_nvmet_work_queue;
1968+
goto out_free_nvmet_aen_work_queue;
19621969

19631970
error = nvmet_init_discovery();
19641971
if (error)
@@ -1974,6 +1981,8 @@ static int __init nvmet_init(void)
19741981
nvmet_exit_discovery();
19751982
out_exit_debugfs:
19761983
nvmet_exit_debugfs();
1984+
out_free_nvmet_aen_work_queue:
1985+
destroy_workqueue(nvmet_aen_wq);
19771986
out_free_nvmet_work_queue:
19781987
destroy_workqueue(nvmet_wq);
19791988
out_free_buffered_work_queue:
@@ -1991,6 +2000,7 @@ static void __exit nvmet_exit(void)
19912000
nvmet_exit_discovery();
19922001
nvmet_exit_debugfs();
19932002
ida_destroy(&cntlid_ida);
2003+
destroy_workqueue(nvmet_aen_wq);
19942004
destroy_workqueue(nvmet_wq);
19952005
destroy_workqueue(buffered_io_wq);
19962006
destroy_workqueue(zbd_wq);

drivers/nvme/target/nvmet.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,7 @@ extern struct kmem_cache *nvmet_bvec_cache;
501501
extern struct workqueue_struct *buffered_io_wq;
502502
extern struct workqueue_struct *zbd_wq;
503503
extern struct workqueue_struct *nvmet_wq;
504+
extern struct workqueue_struct *nvmet_aen_wq;
504505

505506
static inline void nvmet_set_result(struct nvmet_req *req, u32 result)
506507
{

drivers/nvme/target/rdma.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2087,6 +2087,7 @@ static void nvmet_rdma_remove_one(struct ib_device *ib_device, void *client_data
20872087
mutex_unlock(&nvmet_rdma_queue_mutex);
20882088

20892089
flush_workqueue(nvmet_wq);
2090+
flush_workqueue(nvmet_aen_wq);
20902091
}
20912092

20922093
static struct ib_client nvmet_rdma_ib_client = {

drivers/s390/block/dasd_eckd.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6135,6 +6135,7 @@ static void copy_pair_set_active(struct dasd_copy_relation *copy, char *new_busi
61356135
static int dasd_eckd_copy_pair_swap(struct dasd_device *device, char *prim_busid,
61366136
char *sec_busid)
61376137
{
6138+
struct dasd_eckd_private *prim_priv, *sec_priv;
61386139
struct dasd_device *primary, *secondary;
61396140
struct dasd_copy_relation *copy;
61406141
struct dasd_block *block;
@@ -6155,6 +6156,9 @@ static int dasd_eckd_copy_pair_swap(struct dasd_device *device, char *prim_busid
61556156
if (!secondary)
61566157
return DASD_COPYPAIRSWAP_SECONDARY;
61576158

6159+
prim_priv = primary->private;
6160+
sec_priv = secondary->private;
6161+
61586162
/*
61596163
* usually the device should be quiesced for swap
61606164
* for paranoia stop device and requeue requests again
@@ -6182,6 +6186,18 @@ static int dasd_eckd_copy_pair_swap(struct dasd_device *device, char *prim_busid
61826186
dev_name(&secondary->cdev->dev), rc);
61836187
}
61846188

6189+
if (primary->stopped & DASD_STOPPED_QUIESCE) {
6190+
dasd_device_set_stop_bits(secondary, DASD_STOPPED_QUIESCE);
6191+
dasd_device_remove_stop_bits(primary, DASD_STOPPED_QUIESCE);
6192+
}
6193+
6194+
/*
6195+
* The secondary device never got through format detection, but since it
6196+
* is a copy of the primary device, the format is exactly the same;
6197+
* therefore, the detected layout can simply be copied.
6198+
*/
6199+
sec_priv->uses_cdl = prim_priv->uses_cdl;
6200+
61856201
/* re-enable device */
61866202
dasd_device_remove_stop_bits(primary, DASD_STOPPED_PPRC);
61876203
dasd_device_remove_stop_bits(secondary, DASD_STOPPED_PPRC);

include/linux/nvme-auth.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
struct nvme_dhchap_key {
1212
size_t len;
1313
u8 hash;
14-
u8 key[];
14+
u8 key[] __counted_by(len);
1515
};
1616

1717
u32 nvme_auth_get_seqnum(void);

0 commit comments

Comments
 (0)