{
struct svc_msg *svc_msg;
- /* A new SVC communication channel, let's verify it was for us */
+ /* A new SVC communication channel, let's verify a supported version */
+ if ((handshake->version_major != GREYBUS_VERSION_MAJOR) &&
+ (handshake->version_minor != GREYBUS_VERSION_MINOR)) {
+ dev_dbg(hd->parent, "received invalid greybus version %d:%d\n",
+ handshake->version_major, handshake->version_minor);
+ return;
+ }
+
+ /* Validate that the handshake came from the SVC */
if (handshake->handshake_type != SVC_HANDSHAKE_SVC_HELLO) {
/* we don't know what to do with this, log it and return */
dev_dbg(hd->parent, "received invalid handshake type %d\n",
svc_msg = (struct svc_msg *)ap_msg->data;
- /* Verify the version is something we can handle with this code */
- if ((svc_msg->header.version_major != GREYBUS_VERSION_MAJOR) &&
- (svc_msg->header.version_minor != GREYBUS_VERSION_MINOR))
- return NULL;
-
return svc_msg;
}
struct svc_msg_header {
__u8 function_id; /* enum svc_function_id */
__u8 message_type;
- __u8 version_major;
- __u8 version_minor;
__le16 payload_length;
};
};
struct svc_function_handshake {
+ __u8 version_major;
+ __u8 version_minor;
__u8 handshake_type; /* enum svc_function_handshake_type */
};