From: Alex Wang Date: Tue, 17 Dec 2013 22:37:10 +0000 (-0800) Subject: dpif-linux: Do not call nl_sock_pid() on NULL sock pointer. X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;ds=sidebyside;h=48380ae607d4c170108c980efb8afe267f6a37dc;p=sliver-openvswitch.git dpif-linux: Do not call nl_sock_pid() on NULL sock pointer. This commit adds check of sock pointer in dpif_linux_port_get_pid(). If the pointer is NULL, do not call nl_sock_pid(). Signed-off-by: Alex Wang Signed-off-by: Ben Pfaff --- diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c index 52c3f6584..ea2300a81 100644 --- a/lib/dpif-linux.c +++ b/lib/dpif-linux.c @@ -688,7 +688,8 @@ dpif_linux_port_get_pid(const struct dpif *dpif_, odp_port_t port_no) /* The ODPP_NONE "reserved" port number uses the "ovs-system"'s * channel, since it is not heavily loaded. */ uint32_t idx = port_idx >= dpif->uc_array_size ? 0 : port_idx; - pid = nl_sock_pid(dpif->channels[idx].sock); + const struct nl_sock *sock = dpif->channels[idx].sock; + pid = sock ? nl_sock_pid(sock) : 0; } ovs_mutex_unlock(&dpif->upcall_lock);