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

Ben Pfaff blp at nicira.com
Thu Apr 16 21:38:36 UTC 2015


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




More information about the dev mailing list