Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b94bf5a7 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "net: ipc_router: Fix socket reference in IPC Router"

parents d81912f0 d40a340c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -101,6 +101,8 @@ if (msm_ipc_router_debug_mask & R2R_RAW_HDR) \
#define IPC_ROUTER_LOG_EVENT_RX         0x02
#define IPC_ROUTER_DUMMY_DEST_NODE	0xFFFFFFFF

#define ipc_port_sk(port) ((struct sock *)(port))

static LIST_HEAD(control_ports);
static DECLARE_RWSEM(control_ports_lock_lha5);

@@ -1086,6 +1088,8 @@ struct msm_ipc_port *msm_ipc_router_create_raw_port(void *endpoint,
	port_ptr->priv = priv;

	msm_ipc_router_add_local_port(port_ptr);
	if (endpoint)
		sock_hold(ipc_port_sk(endpoint));
	return port_ptr;
}

@@ -1132,6 +1136,8 @@ void ipc_router_release_port(struct kref *ref)
	}
	mutex_unlock(&port_ptr->port_rx_q_lock_lhc3);
	wakeup_source_trash(&port_ptr->port_rx_ws);
	if (port_ptr->endpoint)
		sock_put(ipc_port_sk(port_ptr->endpoint));
	kfree(port_ptr);
}

+8 −6
Original line number Diff line number Diff line
@@ -280,19 +280,21 @@ static int msm_ipc_router_create(struct net *net,
		return -ENOMEM;
	}

	sock->ops = &msm_ipc_proto_ops;
	sock_init_data(sock, sk);
	sk->sk_data_ready = NULL;
	sk->sk_rcvtimeo = DEFAULT_RCV_TIMEO;
	sk->sk_sndtimeo = DEFAULT_SND_TIMEO;

	port_ptr = msm_ipc_router_create_raw_port(sk, NULL, NULL);
	if (!port_ptr) {
		IPC_RTR_ERR("%s: port_ptr alloc failed\n", __func__);
		sk_free(sk);
		sock_put(sk);
		sock->sk = NULL;
		return -ENOMEM;
	}

	port_ptr->check_send_permissions = msm_ipc_check_send_permissions;
	sock->ops = &msm_ipc_proto_ops;
	sock_init_data(sock, sk);
	sk->sk_rcvtimeo = DEFAULT_RCV_TIMEO;
	sk->sk_sndtimeo = DEFAULT_SND_TIMEO;

	msm_ipc_sk(sk)->port = port_ptr;
	msm_ipc_sk(sk)->default_node_vote_info = NULL;