Patch "net/sched: act_pedit: Add size check for TCA_PEDIT_PARMS_EX" has been added to the 5.10-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    net/sched: act_pedit: Add size check for TCA_PEDIT_PARMS_EX

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     net-sched-act_pedit-add-size-check-for-tca_pedit_par.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit e1a0c6f3b277986e3b359681e7e6609ebc1a156c
Author: Lin Ma <linma@xxxxxxxxxx>
Date:   Mon Jul 3 19:08:42 2023 +0800

    net/sched: act_pedit: Add size check for TCA_PEDIT_PARMS_EX
    
    [ Upstream commit 30c45b5361d39b4b793780ffac5538090b9e2eb1 ]
    
    The attribute TCA_PEDIT_PARMS_EX is not be included in pedit_policy and
    one malicious user could fake a TCA_PEDIT_PARMS_EX whose length is
    smaller than the intended sizeof(struct tc_pedit). Hence, the
    dereference in tcf_pedit_init() could access dirty heap data.
    
    static int tcf_pedit_init(...)
    {
      // ...
      pattr = tb[TCA_PEDIT_PARMS]; // TCA_PEDIT_PARMS is included
      if (!pattr)
        pattr = tb[TCA_PEDIT_PARMS_EX]; // but this is not
    
      // ...
      parm = nla_data(pattr);
    
      index = parm->index; // parm is able to be smaller than 4 bytes
                           // and this dereference gets dirty skb_buff
                           // data created in netlink_sendmsg
    }
    
    This commit adds TCA_PEDIT_PARMS_EX length in pedit_policy which avoid
    the above case, just like the TCA_PEDIT_PARMS.
    
    Fixes: 71d0ed7079df ("net/act_pedit: Support using offset relative to the conventional network headers")
    Signed-off-by: Lin Ma <linma@xxxxxxxxxx>
    Reviewed-by: Pedro Tammela <pctammela@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20230703110842.590282-1-linma@xxxxxxxxxx
    Signed-off-by: Paolo Abeni <pabeni@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/sched/act_pedit.c b/net/sched/act_pedit.c
index db0d3bff19eba..a44101b2f4419 100644
--- a/net/sched/act_pedit.c
+++ b/net/sched/act_pedit.c
@@ -26,6 +26,7 @@ static struct tc_action_ops act_pedit_ops;
 
 static const struct nla_policy pedit_policy[TCA_PEDIT_MAX + 1] = {
 	[TCA_PEDIT_PARMS]	= { .len = sizeof(struct tc_pedit) },
+	[TCA_PEDIT_PARMS_EX]	= { .len = sizeof(struct tc_pedit) },
 	[TCA_PEDIT_KEYS_EX]   = { .type = NLA_NESTED },
 };
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux