[ovs-dev] [PATCH 1/2] ofproto-dpif-upcall: Use xzalloc to allocate memory for "struct upcall".

Jarno Rajahalme jrajahalme at nicira.com
Tue Dec 17 18:23:34 UTC 2013


On Dec 17, 2013, at 10:10 AM, Ben Pfaff <blp at nicira.com> wrote:

> On Tue, Dec 17, 2013 at 12:16:23AM -0800, Alex Wang wrote:
>> Commit da546e0 (dpif: Allow execute to modify the packet.) uninitializes
>> the "dpif_upcall.packet" of "struct upcall" when dpif_recv() returns error.
>> Since the "struct upcall" is allocated via xmalloc, this will cause SEGFAULT
>> if dpif_recv() returns error before memset the memory to all zero.
>> 
>> This commit fixes the bug by using xzalloc to allocate memory for "struct
>> upcall".
>> 
>> Signed-off-by: Alex Wang <alexw at nicira.com>
> 
> A struct upcall is quite large.  I would prefer not to clear the whole
> thing if we can avoid it.

I just sent a patch that avoids it.

  Jarno




More information about the dev mailing list