dpif-linux: Avoid segfault on netdev_get_stats() without kernel module.
authorBen Pfaff <blp@nicira.com>
Fri, 8 Apr 2011 23:37:22 +0000 (16:37 -0700)
committerBen Pfaff <blp@nicira.com>
Mon, 11 Apr 2011 17:55:52 +0000 (10:55 -0700)
commit8996f83642d6bd73a72d5864a1c6a66448b49214
tree89bd2e45d1480f27225253de112db0b326e04c7d
parent002d4a3c44a7a42fdfe5f40185fe3af0ed697454
dpif-linux: Avoid segfault on netdev_get_stats() without kernel module.

netdev_linux_get_stats() calls into netdev_vport_get_stats(), which in
turn attempts a transaction on genl_sock.  If the kernel module isn't
loaded, then genl_sock won't be there, and in any case there's nothing that
guarantees that it's been initialized yet.

This fixes the problem by ensuring that dpif_linux was initialized properly
before attempting a transaction on genl_sock.

Reported-by: Aaron Rosen <arosen@clemson.edu>
lib/dpif-linux.c