From: Bill Pemberton Date: Wed, 5 May 2010 19:27:37 +0000 (-0400) Subject: Staging: hv: test return value of VmbusChannelEstablishGpadl() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b94ef345b26b4d75e5028617e43fb51d7dd0162b;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git Staging: hv: test return value of VmbusChannelEstablishGpadl() The return value of VmbusChannelEstablishGpadl() was not examined in Channel.c Signed-off-by: Bill Pemberton Cc: Hank Janssen Cc: Haiyang Zhang Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/hv/Channel.c b/drivers/staging/hv/Channel.c index 8c30540b725..fdd441174f2 100644 --- a/drivers/staging/hv/Channel.c +++ b/drivers/staging/hv/Channel.c @@ -175,7 +175,7 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize, void (*OnChannelCallback)(void *context), void *Context) { struct vmbus_channel_open_channel *openMsg; - struct vmbus_channel_msginfo *openInfo; + struct vmbus_channel_msginfo *openInfo = NULL; void *in, *out; unsigned long flags; int ret, err = 0; @@ -218,7 +218,11 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize, SendRingBufferSize + RecvRingBufferSize, &NewChannel->RingBufferGpadlHandle); -/* FIXME: the value of ret is not checked */ + + if (!ret) { + err = ret; + goto errorout; + } DPRINT_DBG(VMBUS, "channel %p ", @@ -250,7 +254,6 @@ int VmbusChannelOpen(struct vmbus_channel *NewChannel, u32 SendRingBufferSize, openMsg->OpenId = NewChannel->OfferMsg.ChildRelId; /* FIXME */ openMsg->ChildRelId = NewChannel->OfferMsg.ChildRelId; openMsg->RingBufferGpadlHandle = NewChannel->RingBufferGpadlHandle; - ASSERT(openMsg->RingBufferGpadlHandle); openMsg->DownstreamRingBufferPageOffset = SendRingBufferSize >> PAGE_SHIFT; openMsg->ServerContextAreaGpadlHandle = 0; /* TODO */ @@ -295,6 +298,8 @@ Cleanup: return 0; errorout: + RingBufferCleanup(&NewChannel->Outbound); + RingBufferCleanup(&NewChannel->Inbound); osd_PageFree(out, (SendRingBufferSize + RecvRingBufferSize) >> PAGE_SHIFT); kfree(openInfo);