From patchwork Fri Mar 8 02:21:45 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Asias He X-Patchwork-Id: 2234351 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 6CFE93FCF6 for ; Fri, 8 Mar 2013 02:22:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933413Ab3CHCW0 (ORCPT ); Thu, 7 Mar 2013 21:22:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:14770 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933164Ab3CHCWZ (ORCPT ); Thu, 7 Mar 2013 21:22:25 -0500 Received: from int-mx12.intmail.prod.int.phx2.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r282MMLn005378 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 7 Mar 2013 21:22:23 -0500 Received: from hj.localdomain.com (vpn1-113-139.nay.redhat.com [10.66.113.139]) by int-mx12.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id r282M1HL032390; Thu, 7 Mar 2013 21:22:18 -0500 From: Asias He To: Nicholas Bellinger Cc: Paolo Bonzini , Stefan Hajnoczi , "Michael S. Tsirkin" , Rusty Russell , kvm@vger.kernel.org, virtualization@lists.linux-foundation.org, target-devel@vger.kernel.org, Asias He Subject: [PATCH V2 4/6] tcm_vhost: Fix vs->vs_endpoint checking in vhost_scsi_handle_vq() Date: Fri, 8 Mar 2013 10:21:45 +0800 Message-Id: <1362709307-12554-5-git-send-email-asias@redhat.com> In-Reply-To: <1362709307-12554-1-git-send-email-asias@redhat.com> References: <1362709307-12554-1-git-send-email-asias@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.25 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org vs->vs_endpoint is protected by the vs->dev.mutex. Use tcm_vhost_check_endpoint() to do check. The helper does the needed locking for us. Signed-off-by: Asias He --- drivers/vhost/tcm_vhost.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vhost/tcm_vhost.c b/drivers/vhost/tcm_vhost.c index b71e946..6739d67 100644 --- a/drivers/vhost/tcm_vhost.c +++ b/drivers/vhost/tcm_vhost.c @@ -606,7 +606,7 @@ static void vhost_scsi_handle_vq(struct vhost_scsi *vs, u8 target; /* Must use ioctl VHOST_SCSI_SET_ENDPOINT */ - if (unlikely(!vs->vs_endpoint)) + if (!tcm_vhost_check_endpoint(vs)) return; mutex_lock(&vq->mutex);