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

Commit f31618e4 authored by Dan Carpenter's avatar Dan Carpenter Committed by Greg Kroah-Hartman
Browse files

sctp: handle invalid error codes without calling BUG()



[ Upstream commit a0067dfcd9418fd3b0632bc59210d120d038a9c6 ]

The sctp_sf_eat_auth() function is supposed to return enum sctp_disposition
values but if the call to sctp_ulpevent_make_authkey() fails, it returns
-ENOMEM.

This results in calling BUG() inside the sctp_side_effects() function.
Calling BUG() is an over reaction and not helpful.  Call WARN_ON_ONCE()
instead.

This code predates git.

Signed-off-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 8d7395d0
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -1240,7 +1240,10 @@ static int sctp_side_effects(enum sctp_event_type event_type,
	default:
		pr_err("impossible disposition %d in state %d, event_type %d, event_id %d\n",
		       status, state, event_type, subtype.chunk);
		BUG();
		error = status;
		if (error >= 0)
			error = -EINVAL;
		WARN_ON_ONCE(1);
		break;
	}