lkml.org 
[lkml]   [2013]   [Sep]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/1] Drivers: hv: util: Fix a bug in version negotiation code for util services
On Tue, Jul 02, K. Y. Srinivasan wrote:

> The current code picked the highest version advertised by the host. WS2012 R2
> has implemented a protocol version for KVP that is not compatible with prior
> protocol versions of KVP. Fix the bug in the current code by explicitly specifying
> the protocol version that the guest can support.

> -void vmbus_prep_negotiate_resp(struct icmsg_hdr *icmsghdrp,
> +bool vmbus_prep_negotiate_resp(struct icmsg_hdr *icmsghdrp,
> struct icmsg_negotiate *negop, u8 *buf,
> - int max_fw_version, int max_srv_version)
> + int fw_version, int srv_version)

> +fw_error:
> + if (!found_match) {
> + negop->icframe_vercnt = 0;
> + negop->icmsg_vercnt = 0;
> + } else {
> + negop->icframe_vercnt = 1;
> + negop->icmsg_vercnt = 1;
> + }
> +
> + negop->icversion_data[0].major = icframe_major;
> + negop->icversion_data[0].minor = icframe_minor;
> + negop->icversion_data[1].major = icmsg_major;
> + negop->icversion_data[1].minor = icmsg_minor;
> + return found_match;
> }

The new vmbus_prep_negotiate_resp function modifies the *negop buffer if
no match is found. If called twice from hv_kvp_onchannelcallback, the
second call uses the modified buffer from the the first call. As a
result the matching will fail for both calls. If I leave the buffer
alone, kvp works again on ws2008.

I suggest to let callers deal with error handling. Also as a cleanup,
vmbus_prep_negotiate_resp does not make use of the negop passed to it.
So that arg can be removed.


Olaf


\
 
 \ /
  Last update: 2013-09-04 16:21    [W:0.065 / U:1.396 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site