]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
Drivers: hv: util: Pass the channel information during the init call
authorK. Y. Srinivasan <kys@microsoft.com>
Fri, 26 Feb 2016 23:13:19 +0000 (15:13 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 2 Mar 2016 00:57:20 +0000 (16:57 -0800)
Pass the channel information to the util drivers that need to defer
reading the channel while they are processing a request. This would address
the following issue reported by Vitaly:

Commit 3cace4a61610 ("Drivers: hv: utils: run polling callback always in
interrupt context") removed direct *_transaction.state = HVUTIL_READY
assignments from *_handle_handshake() functions introducing the following
race: if a userspace daemon connects before we get first non-negotiation
request from the server hv_poll_channel() won't set transaction state to
HVUTIL_READY as (!channel) condition will fail, we set it to non-NULL on
the first real request from the server.

Signed-off-by: K. Y. Srinivasan <kys@microsoft.com>
Reported-by: Vitaly Kuznetsov <vkuznets@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/hv/hv_fcopy.c
drivers/hv/hv_kvp.c
drivers/hv/hv_snapshot.c
drivers/hv/hv_util.c
include/linux/hyperv.h

index c37a71e13de093ada851cf91c9e9851bb964f68a..23c70799ad8ace23b5c83ae4a47d1e781d623313 100644 (file)
@@ -251,7 +251,6 @@ void hv_fcopy_onchannelcallback(void *context)
                 */
 
                fcopy_transaction.recv_len = recvlen;
-               fcopy_transaction.recv_channel = channel;
                fcopy_transaction.recv_req_id = requestid;
                fcopy_transaction.fcopy_msg = fcopy_msg;
 
@@ -317,6 +316,7 @@ static void fcopy_on_reset(void)
 int hv_fcopy_init(struct hv_util_service *srv)
 {
        recv_buffer = srv->recv_buffer;
+       fcopy_transaction.recv_channel = srv->channel;
 
        /*
         * When this driver loads, the user level daemon that
index d4ab81bcd51509505beda71c0beac8aa78ddaf8a..9b9b370fe22a8b4295fd217e745bd9bde15c1f9e 100644 (file)
@@ -639,7 +639,6 @@ void hv_kvp_onchannelcallback(void *context)
                         */
 
                        kvp_transaction.recv_len = recvlen;
-                       kvp_transaction.recv_channel = channel;
                        kvp_transaction.recv_req_id = requestid;
                        kvp_transaction.kvp_msg = kvp_msg;
 
@@ -688,6 +687,7 @@ int
 hv_kvp_init(struct hv_util_service *srv)
 {
        recv_buffer = srv->recv_buffer;
+       kvp_transaction.recv_channel = srv->channel;
 
        /*
         * When this driver loads, the user level daemon that
index 67def4a831c80461bd50c9ae867b112f12af414a..3fba14e88f038ffeee4f256c87bdc66fafc01b07 100644 (file)
@@ -263,7 +263,6 @@ void hv_vss_onchannelcallback(void *context)
                         */
 
                        vss_transaction.recv_len = recvlen;
-                       vss_transaction.recv_channel = channel;
                        vss_transaction.recv_req_id = requestid;
                        vss_transaction.msg = (struct hv_vss_msg *)vss_msg;
 
@@ -337,6 +336,7 @@ hv_vss_init(struct hv_util_service *srv)
                return -ENOTSUPP;
        }
        recv_buffer = srv->recv_buffer;
+       vss_transaction.recv_channel = srv->channel;
 
        /*
         * When this driver loads, the user level daemon that
index 7994ec2e4151b085bbcb596d8ddbd4d8765b939e..d5acaa2d8e61d0a63f8dfcf65023c3aee6aa40b3 100644 (file)
@@ -322,6 +322,7 @@ static int util_probe(struct hv_device *dev,
        srv->recv_buffer = kmalloc(PAGE_SIZE * 4, GFP_KERNEL);
        if (!srv->recv_buffer)
                return -ENOMEM;
+       srv->channel = dev->channel;
        if (srv->util_init) {
                ret = srv->util_init(srv);
                if (ret) {
index d23dab0d770ba8bcbe269ac294519716cd2c5e4f..aa0fadce9308c3d03a090e84dced8fdde2afe5fa 100644 (file)
@@ -1251,6 +1251,7 @@ u64 hv_do_hypercall(u64 control, void *input, void *output);
 
 struct hv_util_service {
        u8 *recv_buffer;
+       void *channel;
        void (*util_cb)(void *);
        int (*util_init)(struct hv_util_service *);
        void (*util_deinit)(void);