Skip to content

Commit

Permalink
netdev: Fix crash when interface option is changed to invalid value.
Browse files Browse the repository at this point in the history
When trying to modify an interface option (e.g. remote IP of a GRE port) to
an invalid value, the vswitchd does crash. For instance:
 ovs-vsctl add-br br0
 ovs-vsctl add-port br0 gre0 -- set interface gre0 type=gre \
           options:remote_ip=10.0.0.2
 ovs-vsctl set interface gre0 options:remote_ip=9.9.9

The bug is caused by trying to dereference a NULL pointer. It was introduced
by the commit 9fff138. Before that, the NULL pointer was handled by the
VLOG_WARN_BUF macro.

Signed-off-by: Zoltán Balogh <[email protected]>
CC: Daniele Di Proietto <[email protected]>
Fixes: 9fff138 ("netdev: Add 'errp' to set_config().")
Signed-off-by: Ben Pfaff <[email protected]>
  • Loading branch information
zoltanbalogheth authored and blp committed Jul 12, 2017
1 parent a3aa871 commit 429be0e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,11 @@ netdev_set_config(struct netdev *netdev, const struct smap *args, char **errp)
"%s: could not set configuration (%s)",
netdev_get_name(netdev), ovs_strerror(error));
if (verbose_error) {
*errp = verbose_error;
if (errp) {
*errp = verbose_error;
} else {
free(verbose_error);
}
}
}
return error;
Expand Down

0 comments on commit 429be0e

Please sign in to comment.