aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitry Torokhov <dtor@vmware.com>2014-01-09 19:02:33 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2014-01-09 19:16:15 -0500
commit782f24453536460482f9dd14d3677ade910b1fd1 (patch)
tree9d7fb7c6897c0f6d47637675f7e466791f3c9817
parent52cb6a205c9750353cbb58dbf7eea1e046c89819 (diff)
VMCI: fix error handling path when registering guest driver
When host capabilities check failed or when we were unable to register doorbell bitmap we were forgetting to set error code and were returning 0 which would make upper layers believe that probe was successful. Reported-by: Julia Lawall <julia.lawall@lip6.fr> Acked-by: Andy King <acking@vmware.com> Signed-off-by: Dmitry Torokhov <dtor@vmware.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/misc/vmw_vmci/vmci_guest.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/misc/vmw_vmci/vmci_guest.c b/drivers/misc/vmw_vmci/vmci_guest.c
index c98b03b99353..d35cda06b5e8 100644
--- a/drivers/misc/vmw_vmci/vmci_guest.c
+++ b/drivers/misc/vmw_vmci/vmci_guest.c
@@ -165,7 +165,7 @@ static void vmci_guest_cid_update(u32 sub_id,
165 * true if required hypercalls (or fallback hypercalls) are 165 * true if required hypercalls (or fallback hypercalls) are
166 * supported by the host, false otherwise. 166 * supported by the host, false otherwise.
167 */ 167 */
168static bool vmci_check_host_caps(struct pci_dev *pdev) 168static int vmci_check_host_caps(struct pci_dev *pdev)
169{ 169{
170 bool result; 170 bool result;
171 struct vmci_resource_query_msg *msg; 171 struct vmci_resource_query_msg *msg;
@@ -176,7 +176,7 @@ static bool vmci_check_host_caps(struct pci_dev *pdev)
176 check_msg = kmalloc(msg_size, GFP_KERNEL); 176 check_msg = kmalloc(msg_size, GFP_KERNEL);
177 if (!check_msg) { 177 if (!check_msg) {
178 dev_err(&pdev->dev, "%s: Insufficient memory\n", __func__); 178 dev_err(&pdev->dev, "%s: Insufficient memory\n", __func__);
179 return false; 179 return -ENOMEM;
180 } 180 }
181 181
182 check_msg->dst = vmci_make_handle(VMCI_HYPERVISOR_CONTEXT_ID, 182 check_msg->dst = vmci_make_handle(VMCI_HYPERVISOR_CONTEXT_ID,
@@ -196,7 +196,7 @@ static bool vmci_check_host_caps(struct pci_dev *pdev)
196 __func__, result ? "PASSED" : "FAILED"); 196 __func__, result ? "PASSED" : "FAILED");
197 197
198 /* We need the vector. There are no fallbacks. */ 198 /* We need the vector. There are no fallbacks. */
199 return result; 199 return result ? 0 : -ENXIO;
200} 200}
201 201
202/* 202/*
@@ -564,12 +564,14 @@ static int vmci_guest_probe_device(struct pci_dev *pdev,
564 dev_warn(&pdev->dev, 564 dev_warn(&pdev->dev,
565 "VMCI device unable to register notification bitmap with PPN 0x%x\n", 565 "VMCI device unable to register notification bitmap with PPN 0x%x\n",
566 (u32) bitmap_ppn); 566 (u32) bitmap_ppn);
567 error = -ENXIO;
567 goto err_remove_vmci_dev_g; 568 goto err_remove_vmci_dev_g;
568 } 569 }
569 } 570 }
570 571
571 /* Check host capabilities. */ 572 /* Check host capabilities. */
572 if (!vmci_check_host_caps(pdev)) 573 error = vmci_check_host_caps(pdev);
574 if (error)
573 goto err_remove_bitmap; 575 goto err_remove_bitmap;
574 576
575 /* Enable device. */ 577 /* Enable device. */