From: Andy King Date: Thu, 10 Jan 2013 23:41:40 +0000 (-0800) Subject: VMCI: Fix deref before NULL-check of queuepair ptr X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=32b083a3fd1452b9d5aba8e781ca95b566f3e054;p=linux-beck.git VMCI: Fix deref before NULL-check of queuepair ptr Check for a valid queuepair ptr before trying to lock the queuepair (which will deref it). Reported-by: Dan Carpenter Signed-off-by: Andy King Signed-off-by: Dmitry Torokhov Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/misc/vmw_vmci/vmci_queue_pair.c b/drivers/misc/vmw_vmci/vmci_queue_pair.c index da47e457e158..6417a26df8d8 100644 --- a/drivers/misc/vmw_vmci/vmci_queue_pair.c +++ b/drivers/misc/vmw_vmci/vmci_queue_pair.c @@ -3355,11 +3355,11 @@ ssize_t vmci_qpair_dequev(struct vmci_qp *qpair, { ssize_t result; - qp_lock(qpair); - if (!qpair || !iov) return VMCI_ERROR_INVALID_ARGS; + qp_lock(qpair); + do { result = qp_dequeue_locked(qpair->produce_q, qpair->consume_q,