bugfix: the scheduler template (dn_schk) for the round robin scheduler

is followed by another structure (rr_schk) whose size must be set
in the schk_datalen field of the descriptor.
Not allocating the memory may cause other memory to be overwritten
(though dn_schk is 192 bytes and rr_schk only 12 so we may be lucky
and end up in the padding after the dn_schk).

This is a merge candidate for stable and 10.3

MFC after:	3 days
This commit is contained in:
Luigi Rizzo 2016-01-27 02:08:30 +00:00
parent 5444d429b9
commit 788c0c66ab
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=294879

View File

@ -294,7 +294,7 @@ static struct dn_alg rr_desc = {
_SI( .name = ) "RR",
_SI( .flags = ) DN_MULTIQUEUE,
_SI( .schk_datalen = ) 0,
_SI( .schk_datalen = ) sizeof(struct rr_schk),
_SI( .si_datalen = ) sizeof(struct rr_si),
_SI( .q_datalen = ) sizeof(struct rr_queue) - sizeof(struct dn_queue),
@ -311,5 +311,6 @@ static struct dn_alg rr_desc = {
_SI( .free_queue = ) rr_free_queue,
};
_Static_assert(sizeof(struct dn_schk) < 193, "a");
DECLARE_DNSCHED_MODULE(dn_rr, &rr_desc);