[ovs-dev] [PATCH] netdev-dummy: Fix null pointer deref in dummy_packet_conn_set_config().

Andy Zhou azhou at nicira.com
Tue Apr 21 18:41:38 UTC 2015


Acked-by: Andy Zhou <azhou at nicira.com>

On Thu, Apr 16, 2015 at 2:38 PM, Ben Pfaff <blp at nicira.com> wrote:
> This would trigger if someone tried to switch a dummy device between
> active and passive connections.  It's not very important because dummy
> devices are only enabled during testing.
>
> Found by LLVM scan-build.
>
> Reported-by: Kevin Lo <kevlo at FreeBSD.org>
> Signed-off-by: Ben Pfaff <blp at nicira.com>
> ---
>  lib/netdev-dummy.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/lib/netdev-dummy.c b/lib/netdev-dummy.c
> index 24c91c2..6a1a308 100644
> --- a/lib/netdev-dummy.c
> +++ b/lib/netdev-dummy.c
> @@ -342,13 +342,15 @@ dummy_packet_conn_set_config(struct dummy_packet_conn *conn,
>
>      switch (conn->type) {
>      case PASSIVE:
> -        if (!strcmp(pstream_get_name(conn->u.pconn.pstream), pstream)) {
> +        if (pstream &&
> +            !strcmp(pstream_get_name(conn->u.pconn.pstream), pstream)) {
>              return;
>          }
>          dummy_packet_conn_close(conn);
>          break;
>      case ACTIVE:
> -        if (!strcmp(stream_get_name(conn->u.rconn.rstream->stream), stream)) {
> +        if (stream &&
> +            !strcmp(stream_get_name(conn->u.rconn.rstream->stream), stream)) {
>              return;
>          }
>          dummy_packet_conn_close(conn);
> --
> 2.1.3
>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev



More information about the dev mailing list