Commit a3a6cab5 authored by Haiyang Zhang's avatar Haiyang Zhang Committed by David S. Miller

hyperv: Add buffer for extended info after the RNDIS response message.

In some response messages, there may be some extended info after the
message.
Signed-off-by: default avatarHaiyang Zhang <haiyangz@microsoft.com>
Reviewed-by: default avatarK. Y. Srinivasan <kys@microsoft.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 63f6921d
...@@ -32,16 +32,19 @@ ...@@ -32,16 +32,19 @@
#include "hyperv_net.h" #include "hyperv_net.h"
#define RNDIS_EXT_LEN 100
struct rndis_request { struct rndis_request {
struct list_head list_ent; struct list_head list_ent;
struct completion wait_event; struct completion wait_event;
struct rndis_message response_msg;
/* /*
* FIXME: We assumed a fixed size response here. If we do ever need to * The buffer for extended info after the RNDIS response message. It's
* handle a bigger response, we can either define a max response * referenced based on the data offset in the RNDIS message. Its size
* message or add a response buffer variable above this field * is enough for current needs, and should be sufficient for the near
* future.
*/ */
struct rndis_message response_msg; u8 response_ext[RNDIS_EXT_LEN];
/* Simplify allocation by having a netvsc packet inline */ /* Simplify allocation by having a netvsc packet inline */
struct hv_netvsc_packet pkt; struct hv_netvsc_packet pkt;
...@@ -50,12 +53,10 @@ struct rndis_request { ...@@ -50,12 +53,10 @@ struct rndis_request {
struct rndis_message request_msg; struct rndis_message request_msg;
/* /*
* The buffer for the extended info after the RNDIS message. It's * The buffer for the extended info after the RNDIS request message.
* referenced based on the data offset in the RNDIS message. Its size * It is referenced and sized in a similar way as response_ext.
* is enough for current needs, and should be sufficient for the near
* future.
*/ */
u8 ext[100]; u8 request_ext[RNDIS_EXT_LEN];
}; };
static void rndis_filter_send_completion(void *ctx); static void rndis_filter_send_completion(void *ctx);
...@@ -274,7 +275,8 @@ static void rndis_filter_receive_response(struct rndis_device *dev, ...@@ -274,7 +275,8 @@ static void rndis_filter_receive_response(struct rndis_device *dev,
spin_unlock_irqrestore(&dev->request_lock, flags); spin_unlock_irqrestore(&dev->request_lock, flags);
if (found) { if (found) {
if (resp->msg_len <= sizeof(struct rndis_message)) { if (resp->msg_len <=
sizeof(struct rndis_message) + RNDIS_EXT_LEN) {
memcpy(&request->response_msg, resp, memcpy(&request->response_msg, resp,
resp->msg_len); resp->msg_len);
} else { } else {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment