From: Jesse Gross Date: Wed, 15 Sep 2010 23:52:48 +0000 (-0700) Subject: datapath: Check IS_ERR() in do_execute(). X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8ba1fd2fb9eb616ec028027e303c1664185c88e7;p=openvswitch 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 5ee91574..fe37ec1e 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,