Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752987AbcLGHer (ORCPT ); Wed, 7 Dec 2016 02:34:47 -0500 Received: from p3plsmtps2ded02.prod.phx3.secureserver.net ([208.109.80.59]:46820 "EHLO p3plsmtps2ded02.prod.phx3.secureserver.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752005AbcLGHeo (ORCPT ); Wed, 7 Dec 2016 02:34:44 -0500 x-originating-ip: 72.167.245.219 From: kys@exchange.microsoft.com To: gregkh@linuxfoundation.org, linux-kernel@vger.kernel.org, devel@linuxdriverproject.org, olaf@aepfle.de, apw@canonical.com, vkuznets@redhat.com, jasowang@redhat.com, leann.ogasawara@canonical.com Cc: "K. Y. Srinivasan" , Subject: [PATCH 5/5] Drivers: hv: vmbus: Prevent sending data on a rescinded channel Date: Wed, 7 Dec 2016 01:16:28 -0800 Message-Id: <1481102188-4414-5-git-send-email-kys@exchange.microsoft.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1481102188-4414-1-git-send-email-kys@exchange.microsoft.com> References: <1481102113-4365-1-git-send-email-kys@exchange.microsoft.com> <1481102188-4414-1-git-send-email-kys@exchange.microsoft.com> Reply-To: kys@microsoft.com X-CMAE-Envelope: MS4wfHQoBW7G7FMT+0MoOjWVo3CyhffduMMHCu1Smf7yldK1o9BXN+QPkks3q9Bz7m3D3c8GKIF2YcOkR8G5Bn1SxbPJGbDyO+8Jknf2GEUyolmJZg6A36u1 gMTt2Y49+sLA2tXw8HAxg87kvJjVz1bfd/LuQgZJKNs2TDyRhxZt4O9e/EAwBUrHNX9UjFJOWA83nJ3QMWLxW9ZpboSj1YMJ2012O28E78zwm+g32tmX2jTe uUm+wFmm00cgodvnFiMKA+hAP7RVa1tNBUWYbwa/+x8Ckbxui8gbj7QNdGoUE5q7zClvjSc9iRr4PDH0RpRodkJ/YcpwPPEjanh4EqJzkg0d66Yxe/L7krsC KV2KGsUK6ixTwBDF7B/8E8KnK+2oDi3Vn66MhiO2cYw/hf9PzDMU8LJuw5BU6eH1xM3HpVCFezYFapWgH3QK25InKCY78qGDVhHE8M7qJe12Hj+hkF0iy/q8 n56rjSdQu3Q/xjUde0LhBvNsY1yA3KZhtV0lnQ== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1311 Lines: 41 From: K. Y. Srinivasan After the channel is rescinded, the host does not read from the rescinded channel. Fail writes to a channel that has already been rescinded. If we permit writes on a rescinded channel, since the host will not respond we will have situations where we will be unable to unload vmbus drivers that cannot have any outstanding requests to the host at the point they are unoaded. Signed-off-by: K. Y. Srinivasan Cc: --- drivers/hv/ring_buffer.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index cd49cb1..2cd4029 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -298,6 +298,9 @@ int hv_ringbuffer_write(struct vmbus_channel *channel, unsigned long flags = 0; struct hv_ring_buffer_info *outring_info = &channel->outbound; + if (channel->rescind) + return -ENODEV; + for (i = 0; i < kv_count; i++) totalbytes_towrite += kv_list[i].iov_len; @@ -350,6 +353,10 @@ int hv_ringbuffer_write(struct vmbus_channel *channel, spin_unlock_irqrestore(&outring_info->ring_lock, flags); hv_signal_on_write(old_write, channel, kick_q); + + if (channel->rescind) + return -ENODEV; + return 0; } -- 1.7.4.1