diff options
author | Dan Carpenter <dan.carpenter@linaro.org> | 2023-06-09 14:04:43 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2023-06-12 09:36:27 +0100 |
commit | a0067dfcd9418fd3b0632bc59210d120d038a9c6 (patch) | |
tree | 4b623bd0686fac08075b288c9cb55932eb3dc493 /net | |
parent | ce57adc222aba32431c42632b396e9213d0eb0b8 (diff) |
sctp: handle invalid error codes without calling BUG()
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>
Diffstat (limited to 'net')
-rw-r--r-- | net/sctp/sm_sideeffect.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index 7fbeb99d8d32..23d6633966b1 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c @@ -1250,7 +1250,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; } |