From: Nicholas Bellinger Date: Mon, 23 Sep 2013 18:42:28 +0000 (-0700) Subject: vhost/scsi: Use GFP_ATOMIC with percpu_ida_alloc for obtaining tag X-Git-Tag: v5.15~19106^2~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4a47d3a1ff10e564bf04f27ac14552df64f60cdf;p=platform%2Fkernel%2Flinux-starfive.git 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 Acked-by: Asias He Cc: Kent Overstreet Signed-off-by: Nicholas Bellinger --- diff --git a/drivers/vhost/scsi.c b/drivers/vhost/scsi.c index 592b316..ce5221f 100644 --- a/drivers/vhost/scsi.c +++ b/drivers/vhost/scsi.c @@ -728,7 +728,12 @@ vhost_scsi_get_tag(struct vhost_virtqueue *vq, } se_sess = tv_nexus->tvn_se_sess; - tag = percpu_ida_alloc(&se_sess->sess_tag_pool, GFP_KERNEL); + tag = percpu_ida_alloc(&se_sess->sess_tag_pool, GFP_ATOMIC); + if (tag < 0) { + pr_err("Unable to obtain tag for tcm_vhost_cmd\n"); + return ERR_PTR(-ENOMEM); + } + cmd = &((struct tcm_vhost_cmd *)se_sess->sess_cmd_map)[tag]; sg = cmd->tvc_sgl; pages = cmd->tvc_upages;