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

Commit d55b4c63 authored by Adrian Bunk's avatar Adrian Bunk Committed by David S. Miller
Browse files

[TIPC] net/tipc/port.c: fix NULL dereference



The correct order is: NULL check before dereference

Spotted by the Coverity checker.

Signed-off-by: default avatarAdrian Bunk <bunk@stusta.de>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3ccfc65c
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -1136,11 +1136,12 @@ int tipc_publish(u32 ref, unsigned int scope, struct tipc_name_seq const *seq)
	int res = -EINVAL;

	p_ptr = tipc_port_lock(ref);
	if (!p_ptr)
		return -EINVAL;

	dbg("tipc_publ %u, p_ptr = %x, conn = %x, scope = %x, "
	    "lower = %u, upper = %u\n",
	    ref, p_ptr, p_ptr->publ.connected, scope, seq->lower, seq->upper);
	if (!p_ptr)
		return -EINVAL;
	if (p_ptr->publ.connected)
		goto exit;
	if (seq->lower > seq->upper)