Skip to content

Commit 4a47d3a

Browse files
author
Nicholas Bellinger
committed
vhost/scsi: Use GFP_ATOMIC with percpu_ida_alloc for obtaining tag
Fix GFP_KERNEL -> GFP_ATOMIC usage of percpu_ida_alloc() within vhost_scsi_get_tag(), as this code is expected to be called directly from interrupt context. v2 changes: - Handle possible tag < 0 failure with GFP_ATOMIC Acked-by: Michael S. Tsirkin <[email protected]> Acked-by: Asias He <[email protected]> Cc: Kent Overstreet <[email protected]> Signed-off-by: Nicholas Bellinger <[email protected]>
1 parent 0b41d6c commit 4a47d3a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

drivers/vhost/scsi.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,12 @@ vhost_scsi_get_tag(struct vhost_virtqueue *vq,
728728
}
729729
se_sess = tv_nexus->tvn_se_sess;
730730

731-
tag = percpu_ida_alloc(&se_sess->sess_tag_pool, GFP_KERNEL);
731+
tag = percpu_ida_alloc(&se_sess->sess_tag_pool, GFP_ATOMIC);
732+
if (tag < 0) {
733+
pr_err("Unable to obtain tag for tcm_vhost_cmd\n");
734+
return ERR_PTR(-ENOMEM);
735+
}
736+
732737
cmd = &((struct tcm_vhost_cmd *)se_sess->sess_cmd_map)[tag];
733738
sg = cmd->tvc_sgl;
734739
pages = cmd->tvc_upages;

0 commit comments

Comments
 (0)