]> www.infradead.org Git - users/jedix/linux-maple.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)
committerJack Vogel <jack.vogel@oracle.com>
Wed, 31 May 2017 02:49:21 +0000 (19:49 -0700)
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>
Orabug: 25970637
(cherry picked from commit b9830d120cbe155863399f25eaef6aa8353e767f)
Signed-off-by: Jack Vogel <jack.vogel@oracle.com>
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 bdadbce904c8930341a67738360530a88d9ddb3b..3ed4fcde0b7e8c853cef60ae5e7dfb15f01296ed 100644 (file)
@@ -638,7 +638,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;
 
@@ -687,6 +686,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 eee011dea67bfb601edccfc3b3cf3e14c2b39605..5efb7a2350f9ffe6100dee8bafc2cb466de3f16d 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;
 
@@ -332,6 +331,7 @@ int
 hv_vss_init(struct hv_util_service *srv)
 {
        recv_buffer = srv->recv_buffer;
+       vss_transaction.recv_channel = srv->channel;
 
        /*
         * When this driver loads, the user level daemon that
index 41f5896224bd4723db7f87179c7466df423238a7..9dc63725363d2a90b2e7ae78d375709a7d29a5ad 100644 (file)
@@ -326,6 +326,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 cbcbce9402c112dc0cd3b3b688d853b02a566ffa..858da5086268038f148c800d799f9df6bec0ba5a 100644 (file)
@@ -1191,6 +1191,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);