From: Jesse Gross Date: Wed, 15 Sep 2010 23:52:48 +0000 (-0700) Subject: datapath: Check IS_ERR() in do_execute(). X-Git-Tag: v1.0.2~18 X-Git-Url: http://git.onelab.eu/?p=sliver-openvswitch.git;a=commitdiff_plain;h=a842e7b093786019292998fa192d4ed7d228d686 datapath: Check IS_ERR() in do_execute(). flow_actions_alloc() returns an error code in the form of a pointer but we checked that the pointer was not NULL, which is always true. This caused oopses on allocation errors when we would write into an invalid pointer. NIC-234 Signed-off-by: Jesse Gross Acked-by: Ben Pfaff --- diff --git a/datapath/datapath.c b/datapath/datapath.c index 5ee915740..fe37ec1ed 100644 --- a/datapath/datapath.c +++ b/datapath/datapath.c @@ -1326,10 +1326,11 @@ static int do_execute(struct datapath *dp, const struct odp_execute *execute) if (execute->length < ETH_HLEN || execute->length > 65535) goto error; - err = -ENOMEM; actions = flow_actions_alloc(execute->n_actions); - if (!actions) + if (IS_ERR(actions)) { + err = PTR_ERR(actions); goto error; + } err = -EFAULT; if (copy_from_user(actions->actions, execute->actions,