Skip to content

Commit a0067df

Browse files
Dan Carpenterdavem330
authored andcommitted
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>
1 parent ce57adc commit a0067df

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

net/sctp/sm_sideeffect.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,10 @@ static int sctp_side_effects(enum sctp_event_type event_type,
12501250
default:
12511251
pr_err("impossible disposition %d in state %d, event_type %d, event_id %d\n",
12521252
status, state, event_type, subtype.chunk);
1253-
BUG();
1253+
error = status;
1254+
if (error >= 0)
1255+
error = -EINVAL;
1256+
WARN_ON_ONCE(1);
12541257
break;
12551258
}
12561259

0 commit comments

Comments
 (0)