Skip to content

Commit

Permalink
sctp: handle invalid error codes without calling BUG()
Browse files Browse the repository at this point in the history
[ Upstream commit a0067df ]

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: Dan Carpenter <dan.carpenter@linaro.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
Dan Carpenter authored and gregkh committed Sep 13, 2023
1 parent fbd3ae6 commit dcfd75b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion net/sctp/sm_sideeffect.c
Expand Up @@ -1251,7 +1251,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;
}

Expand Down

0 comments on commit dcfd75b

Please sign in to comment.