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" <kys@microsoft.com>, <Stable@vger.kernel.org>
Subject: [PATCH 5/5] Drivers: hv: vmbus: Prevent sending data on a rescinded channel
Date: Wed, 7 Dec 2016 01:16:28 -0800 [thread overview]
Message-ID: <1481102188-4414-5-git-send-email-kys@exchange.microsoft.com> (raw)
In-Reply-To: <1481102188-4414-1-git-send-email-kys@exchange.microsoft.com>
From: K. Y. Srinivasan <kys@microsoft.com>
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 <kys@microsoft.com>
Cc: <Stable@vger.kernel.org>
---
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
prev parent reply other threads:[~2016-12-07 7:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-07 9:15 [PATCH 0/5] Drivers: hv: vmbus: Some miscellaneous fixes kys
2016-12-07 9:16 ` [PATCH 1/5] Drivers: hv: vmbus: Raise retry/wait limits in vmbus_post_msg() kys
2016-12-07 9:16 ` [PATCH 2/5] hv: allocate synic pages for all present CPUs kys
2016-12-07 9:16 ` [PATCH 3/5] hv: init percpu_list in hv_synic_alloc() kys
2016-12-07 9:16 ` [PATCH 4/5] hv: don't reset hv_context.tsc_page on crash kys
2016-12-07 9:16 ` kys [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1481102188-4414-5-git-send-email-kys@exchange.microsoft.com \
--to=kys@exchange.microsoft.com \
--cc=Stable@vger.kernel.org \
--cc=apw@canonical.com \
--cc=devel@linuxdriverproject.org \
--cc=gregkh@linuxfoundation.org \
--cc=jasowang@redhat.com \
--cc=kys@microsoft.com \
--cc=leann.ogasawara@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=olaf@aepfle.de \
--cc=vkuznets@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®