Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 228399
b: refs/heads/master
c: bf6506f
h: refs/heads/master
i:
  228397: e5a4618
  228395: afd354f
  228391: e91b283
  228383: ac36618
v: v3
  • Loading branch information
Timo Teräs authored and Greg Kroah-Hartman committed Dec 16, 2010
1 parent 4e5f99d commit 19339eb
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: f4528696d803749892eac27422a6fd7748cffee1
refs/heads/master: bf6506f60c46c8a709df534408cc6d470df657ff
4 changes: 0 additions & 4 deletions trunk/drivers/staging/hv/channel_mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,6 @@ void vmbus_onmessage(void *context)
hdr->msgtype, size);
print_hex_dump_bytes("", DUMP_PREFIX_NONE,
(unsigned char *)msg->u.payload, size);
kfree(msg);
return;
}

Expand All @@ -762,9 +761,6 @@ void vmbus_onmessage(void *context)
else
DPRINT_ERR(VMBUS, "Unhandled channel message type %d",
hdr->msgtype);

/* Free the msg that was allocated in VmbusOnMsgDPC() */
kfree(msg);
}

/*
Expand Down
28 changes: 21 additions & 7 deletions trunk/drivers/staging/hv/vmbus_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,21 @@ static void VmbusOnCleanup(struct hv_driver *drv)
hv_cleanup();
}

struct onmessage_work_context {
struct work_struct work;
struct hv_message msg;
};

static void vmbus_onmessage_work(struct work_struct *work)
{
struct onmessage_work_context *ctx;

ctx = container_of(work, struct onmessage_work_context,
work);
vmbus_onmessage(&ctx->msg);
kfree(ctx);
}

/*
* vmbus_on_msg_dpc - DPC routine to handle messages from the hypervisior
*/
Expand All @@ -212,20 +227,19 @@ static void vmbus_on_msg_dpc(struct hv_driver *drv)
void *page_addr = hv_context.synic_message_page[cpu];
struct hv_message *msg = (struct hv_message *)page_addr +
VMBUS_MESSAGE_SINT;
struct hv_message *copied;
struct onmessage_work_context *ctx;

while (1) {
if (msg->header.message_type == HVMSG_NONE) {
/* no msg */
break;
} else {
copied = kmemdup(msg, sizeof(*copied), GFP_ATOMIC);
if (copied == NULL)
ctx = kmalloc(sizeof(*ctx), GFP_ATOMIC);
if (ctx == NULL)
continue;

osd_schedule_callback(gVmbusConnection.WorkQueue,
vmbus_onmessage,
(void *)copied);
INIT_WORK(&ctx->work, vmbus_onmessage_work);
memcpy(&ctx->msg, msg, sizeof(*msg));
queue_work(gVmbusConnection.WorkQueue, &ctx->work);
}

msg->header.message_type = HVMSG_NONE;
Expand Down

0 comments on commit 19339eb

Please sign in to comment.