Thread (15 messages) 15 messages, 7 authors, 2023-05-04

Re: [PATCH net v2] sctp: fix a potential buffer overflow in sctp_sched_set_sched()

From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Date: 2023-05-03 12:47:49
Also in: linux-sctp, lkml

On Wed, May 03, 2023 at 09:08:17AM +0000, Gavrilov Ilia wrote:
quoted
quoted
This unnecessary test confuses a reader like sched could be over
SCTP_SS_MAX here.
It's actualy better to keep the test here and remove it from the
callers: they don't need to know the specifics, and further new calls
will be protected already.
I agree that the check should be removed, but I think it's better to
keep the test on the calling side, because params->assoc_value is set as
the default "stream schedule" for the socket and it needs to be checked too.

static int sctp_setsockopt_scheduler(..., struct sctp_assoc_value
*params, ...)
{
...
   if (params->assoc_id == SCTP_FUTURE_ASSOC ||
       params->assoc_id == SCTP_ALL_ASSOC)
       sp->default_ss = params->assoc_value;
...
}
Good point. But then, don't remove the check. Instead, just fix that
ordering and make it less confusing.  Otherwise you will be really
making it prone to the OOB if a new call gets added that doesn't
validate the parameter.

Thanks,
Marcelo
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help