[bionic:linux-azure-4.15][PATCH 2/9] Drivers: hv: vmus: Fix the check for return value from kmsg get dump buffer

Marcelo Henrique Cerri marcelo.cerri at canonical.com
Tue Jun 16 02:58:35 UTC 2020


From: Sunil Muthuswamy <sunilmut at microsoft.com>

BugLink: http://bugs.launchpad.net/bugs/1875456

The code to support panic control message was checking the return was
checking the return value from kmsg_dump_get_buffer as error value, which
is not what the routine returns. This fixes it.

Fixes: 81b18bce48af ("Drivers: HV: Send one page worth of kmsg dump over Hyper-V during panic")

Signed-off-by: Sunil Muthuswamy <sunilmut at microsoft.com>
Signed-off-by: K. Y. Srinivasan <kys at microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
(cherry picked from commit ddcaf3ca4c3c87b955ad6f57952250030be77791)
Signed-off-by: Marcelo Henrique Cerri <marcelo.cerri at canonical.com>
---
 drivers/hv/vmbus_drv.c | 11 ++++-------
 1 file changed, 4 insertions(+), 7 deletions(-)

diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c
index f7bf7281e3ea..c83b5c253e30 100644
--- a/drivers/hv/vmbus_drv.c
+++ b/drivers/hv/vmbus_drv.c
@@ -1097,13 +1097,10 @@ static void hv_kmsg_dump(struct kmsg_dumper *dumper,
 	 * Write dump contents to the page. No need to synchronize; panic should
 	 * be single-threaded.
 	 */
-	if (!kmsg_dump_get_buffer(dumper, true, hv_panic_page,
-				  PAGE_SIZE, &bytes_written)) {
-		pr_err("Hyper-V: Unable to get kmsg data for panic\n");
-		return;
-	}
-
-	hyperv_report_panic_msg(panic_pa, bytes_written);
+	kmsg_dump_get_buffer(dumper, true, hv_panic_page, PAGE_SIZE,
+			     &bytes_written);
+	if (bytes_written)
+		hyperv_report_panic_msg(panic_pa, bytes_written);
 }
 
 static struct kmsg_dumper hv_kmsg_dumper = {
-- 
2.25.1




More information about the kernel-team mailing list