Skip to content

Commit a3a6cab

Browse files
haiyangzdavem330
authored andcommitted
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: Haiyang Zhang <haiyangz@microsoft.com> Reviewed-by: K. Y. Srinivasan <kys@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 63f6921 commit a3a6cab

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

drivers/net/hyperv/rndis_filter.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,19 @@
3232
#include "hyperv_net.h"
3333

3434

35+
#define RNDIS_EXT_LEN 100
3536
struct rndis_request {
3637
struct list_head list_ent;
3738
struct completion wait_event;
3839

40+
struct rndis_message response_msg;
3941
/*
40-
* FIXME: We assumed a fixed size response here. If we do ever need to
41-
* handle a bigger response, we can either define a max response
42-
* message or add a response buffer variable above this field
42+
* The buffer for extended info after the RNDIS response message. It's
43+
* referenced based on the data offset in the RNDIS message. Its size
44+
* is enough for current needs, and should be sufficient for the near
45+
* future.
4346
*/
44-
struct rndis_message response_msg;
47+
u8 response_ext[RNDIS_EXT_LEN];
4548

4649
/* Simplify allocation by having a netvsc packet inline */
4750
struct hv_netvsc_packet pkt;
@@ -50,12 +53,10 @@ struct rndis_request {
5053

5154
struct rndis_message request_msg;
5255
/*
53-
* The buffer for the extended info after the RNDIS message. It's
54-
* referenced based on the data offset in the RNDIS message. Its size
55-
* is enough for current needs, and should be sufficient for the near
56-
* future.
56+
* The buffer for the extended info after the RNDIS request message.
57+
* It is referenced and sized in a similar way as response_ext.
5758
*/
58-
u8 ext[100];
59+
u8 request_ext[RNDIS_EXT_LEN];
5960
};
6061

6162
static void rndis_filter_send_completion(void *ctx);
@@ -274,7 +275,8 @@ static void rndis_filter_receive_response(struct rndis_device *dev,
274275
spin_unlock_irqrestore(&dev->request_lock, flags);
275276

276277
if (found) {
277-
if (resp->msg_len <= sizeof(struct rndis_message)) {
278+
if (resp->msg_len <=
279+
sizeof(struct rndis_message) + RNDIS_EXT_LEN) {
278280
memcpy(&request->response_msg, resp,
279281
resp->msg_len);
280282
} else {

0 commit comments

Comments
 (0)