From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from a2nlsmtp01-02.prod.iad2.secureserver.net ([198.71.225.36]:34630 "EHLO a2nlsmtp01-02.prod.iad2.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726144AbeKZNXh (ORCPT ); Mon, 26 Nov 2018 08:23:37 -0500 From: kys@linuxonhyperv.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, jasowang@redhat.com, sthemmin@microsoft.com, Michael.H.Kelley@microsoft.com, vkuznets@redhat.com Cc: Dexuan Cui , "K . Y . Srinivasan" , Haiyang Zhang , stable@vger.kernel.org Subject: [PATCH 1/2] Drivers: hv: vmbus: check the creation_status in vmbus_establish_gpadl() Date: Mon, 26 Nov 2018 02:29:56 +0000 Message-Id: <20181126022958.11320-1-kys@linuxonhyperv.com> In-Reply-To: <20181126022821.11269-1-kys@linuxonhyperv.com> References: <20181126022821.11269-1-kys@linuxonhyperv.com> MIME-Version: 1.0 Reply-To: kys@microsoft.com Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: From: Dexuan Cui This is a longstanding issue: if the vmbus upper-layer drivers try to consume too many GPADLs, the host may return with an error 0xC0000044 (STATUS_QUOTA_EXCEEDED), but currently we forget to check the creation_status, and hence we can pass an invalid GPADL handle into the OPEN_CHANNEL message, and get an error code 0xc0000225 in open_info->response.open_result.status, and finally we hang in vmbus_open() -> "goto error_free_info" -> vmbus_teardown_gpadl(). With this patch, we can exit gracefully on STATUS_QUOTA_EXCEEDED. Cc: Stephen Hemminger Cc: K. Y. Srinivasan Cc: Haiyang Zhang Cc: stable@vger.kernel.org Signed-off-by: Dexuan Cui Signed-off-by: K. Y. Srinivasan --- drivers/hv/channel.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index f96a77b18bb9..ce0ba2062723 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -516,6 +516,14 @@ int vmbus_establish_gpadl(struct vmbus_channel *channel, void *kbuffer, } wait_for_completion(&msginfo->waitevent); + if (msginfo->response.gpadl_created.creation_status != 0) { + pr_err("Failed to establish GPADL: err = 0x%x\n", + msginfo->response.gpadl_created.creation_status); + + ret = -EDQUOT; + goto cleanup; + } + if (channel->rescind) { ret = -ENODEV; goto cleanup; -- 2.19.1