[ovs-dev] [PATCH] datapath: Immediately exit on error in ovs_vport_cmd_set().
Pravin Shelar
pshelar at nicira.com
Thu May 2 17:38:33 UTC 2013
On Thu, May 2, 2013 at 10:20 AM, Jesse Gross <jesse at nicira.com> wrote:
> It is an error to try to change the type of a vport using the set
> command. However, while we check that this is an error, we still
> proceed to allocate memory which then gets freed immediately.
> This stops processing after noticing the error, which does not
> actually fix a bug but is more correct.
>
> Signed-off-by: Jesse Gross <jesse at nicira.com>
> ---
> datapath/datapath.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/datapath/datapath.c b/datapath/datapath.c
> index cf901d2..c0b8849 100644
> --- a/datapath/datapath.c
> +++ b/datapath/datapath.c
> @@ -2107,8 +2107,10 @@ static int ovs_vport_cmd_set(struct sk_buff *skb, struct genl_info *info)
>
> err = 0;
No need to set it.
> if (a[OVS_VPORT_ATTR_TYPE] &&
> - nla_get_u32(a[OVS_VPORT_ATTR_TYPE]) != vport->ops->type)
> + nla_get_u32(a[OVS_VPORT_ATTR_TYPE]) != vport->ops->type) {
> err = -EINVAL;
> + goto exit_unlock;
> + }
>
We can also remove err check done later which is always true now.
otherwise looks good.
Acked-by: Pravin B Shelar <pshelar at nicira.com>
> reply = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
> if (!reply) {
> --
> 1.7.10.4
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
More information about the dev
mailing list