From 5f41d4a8d3367ccd8c8a3a92002e500e7d4f3838 Mon Sep 17 00:00:00 2001 From: Alexander Usyskin Date: Mon, 29 Oct 2018 00:39:45 +0200 Subject: [PATCH] dm: mei: check return value of vmei_host_client_to_vmei() vmei_host_client_to_vmei() may return NULL we need to check for the return value. Tracked-On: #1630 Signed-off-by: Alexander Usyskin Signed-off-by: Tomas Winkler --- devicemodel/hw/pci/virtio/virtio_mei.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/devicemodel/hw/pci/virtio/virtio_mei.c b/devicemodel/hw/pci/virtio/virtio_mei.c index dab889fb5..3e7e6a2b4 100644 --- a/devicemodel/hw/pci/virtio/virtio_mei.c +++ b/devicemodel/hw/pci/virtio/virtio_mei.c @@ -962,6 +962,9 @@ vmei_host_client_native_connect(struct vmei_host_client *hclient) struct vmei_me_client *mclient; struct mei_connect_client_data_vtag connection_data; + if (!vmei) + return MEI_HBM_REJECTED; + mclient = hclient->mclient; /* open mei node */ @@ -1637,6 +1640,9 @@ vmei_host_client_native_read(struct vmei_host_client *hclient) struct virtio_mei *vmei = vmei_host_client_to_vmei(hclient); ssize_t len; + if (!vmei) + return -1; + if (hclient->client_fd < 0) { HCL_WARN(hclient, "RX: invalid client fd\n"); return -1;