X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=lib%2Fdpif-linux.c;h=a10be60cf0b6a0f60741276dbba6ff84df99b306;hb=49872bed7b294889ff430e82f4d8f57388ceee56;hp=93154a343e183397c6b0e099b946618d83945e07;hpb=02864c704ef33e3eb25ca15d812c29dee57cd80f;p=cascardo%2Fovs.git diff --git a/lib/dpif-linux.c b/lib/dpif-linux.c index 93154a343..a10be60cf 100644 --- a/lib/dpif-linux.c +++ b/lib/dpif-linux.c @@ -825,7 +825,13 @@ dpif_linux_port_get_pid__(const struct dpif_linux *dpif, odp_port_t port_no, uint32_t idx = port_idx >= dpif->uc_array_size ? 0 : port_idx; struct dpif_handler *h = &dpif->handlers[hash % dpif->n_handlers]; - pid = nl_sock_pid(h->channels[idx].sock); + /* Needs to check in case the socket pointer is changed in between + * the holding of upcall_lock. A known case happens when the main + * thread deletes the vport while the handler thread is handling + * the upcall from that port. */ + if (h->channels[idx].sock) { + pid = nl_sock_pid(h->channels[idx].sock); + } } return pid;