* [PATCH AUTOSEL 5.15 4/9] sctp: handle invalid error codes without calling BUG() [not found] <20230829133316.520410-1-sashal@kernel.org> @ 2023-08-29 13:33 ` Sasha Levin 0 siblings, 0 replies; 2+ messages in thread From: Sasha Levin @ 2023-08-29 13:33 UTC (permalink / raw) To: linux-kernel, stable Cc: Dan Carpenter, David S . Miller, Sasha Levin, vyasevich, nhorman, marcelo.leitner, edumazet, kuba, pabeni, linux-sctp, netdev From: Dan Carpenter <dan.carpenter@linaro.org> [ 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: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org> --- net/sctp/sm_sideeffect.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index 463c4a58d2c36..970c6a486a9b0 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c @@ -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; } -- 2.40.1 ^ permalink raw reply related [flat|nested] 2+ messages in thread
[parent not found: <20230626215057.179363-1-sashal@kernel.org>]
* [PATCH AUTOSEL 5.15 4/9] sctp: handle invalid error codes without calling BUG() [not found] <20230626215057.179363-1-sashal@kernel.org> @ 2023-06-26 21:50 ` Sasha Levin 0 siblings, 0 replies; 2+ messages in thread From: Sasha Levin @ 2023-06-26 21:50 UTC (permalink / raw) To: linux-kernel, stable Cc: Dan Carpenter, David S . Miller, Sasha Levin, marcelo.leitner, lucien.xin, edumazet, kuba, pabeni, linux-sctp, netdev From: Dan Carpenter <dan.carpenter@linaro.org> [ 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: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org> --- net/sctp/sm_sideeffect.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/net/sctp/sm_sideeffect.c b/net/sctp/sm_sideeffect.c index 463c4a58d2c36..970c6a486a9b0 100644 --- a/net/sctp/sm_sideeffect.c +++ b/net/sctp/sm_sideeffect.c @@ -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; } -- 2.39.2 ^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-08-29 13:34 UTC | newest] Thread overview: 2+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- [not found] <20230829133316.520410-1-sashal@kernel.org> 2023-08-29 13:33 ` [PATCH AUTOSEL 5.15 4/9] sctp: handle invalid error codes without calling BUG() Sasha Levin [not found] <20230626215057.179363-1-sashal@kernel.org> 2023-06-26 21:50 ` Sasha Levin
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).