mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
dpif-netlink: Fix null pointer.
In dpif_netlink_port_add__(), socksp could be NULL, because
vport_socksp_to_pids() would allocate a new array and return a single
zero element.
Following vport_socksp_to_pids() removal, a NULL pointer can happen when
dpif_netlink_port_add__() is called and dpif->handlers is 0.
Restore the old behaviour of using a zero pid when dpif->handlers is 0.
Fixes: 69c51582f
("dpif-netlink: don't allocate per thread netlink sockets")
Reported-by: Flavio Leitner <fbl@redhat.com>
Reported-by: Guru Shetty <guru@ovn.org>
Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Ben Pfaff <blp@ovn.org>
This commit is contained in:
@@ -712,7 +712,7 @@ dpif_netlink_port_add__(struct dpif_netlink *dpif, const char *name,
|
||||
struct dpif_netlink_vport request, reply;
|
||||
struct ofpbuf *buf;
|
||||
struct nl_sock *socksp = NULL;
|
||||
uint32_t upcall_pids;
|
||||
uint32_t upcall_pids = 0;
|
||||
int error = 0;
|
||||
|
||||
if (dpif->handlers) {
|
||||
@@ -728,7 +728,9 @@ dpif_netlink_port_add__(struct dpif_netlink *dpif, const char *name,
|
||||
request.name = name;
|
||||
|
||||
request.port_no = *port_nop;
|
||||
upcall_pids = nl_sock_pid(socksp);
|
||||
if (socksp) {
|
||||
upcall_pids = nl_sock_pid(socksp);
|
||||
}
|
||||
request.n_upcall_pids = 1;
|
||||
request.upcall_pids = &upcall_pids;
|
||||
|
||||
|
Reference in New Issue
Block a user