[LU-15056] Overflow when setting a tbf rule name Created: 04/Oct/21  Updated: 07/Jan/22  Resolved: 06/Jan/22

Status: Resolved
Project: Lustre
Component/s: None
Affects Version/s: None
Fix Version/s: Lustre 2.15.0

Type: Bug Priority: Major
Reporter: Etienne Aujames Assignee: Etienne Aujames
Resolution: Fixed Votes: 0
Labels: None
Environment:

VMs with lustre 2.14.53


Issue Links:
Related
is related to LUDOC-496 Format of TBF rule name field is not ... Open
Severity: 3
Rank (Obsolete): 9223372036854775807

 Description   

A tbf rule name length is limited to 16 characters (MAX_TBF_NAME).
This length is never checked. This can cause an overflow inside the following code:

static int
nrs_tbf_rule_start(struct ptlrpc_nrs_policy *policy,
                   struct nrs_tbf_head *head,
                   struct nrs_tbf_cmd *start)
{
        struct nrs_tbf_rule     *rule;
        struct nrs_tbf_rule     *tmp_rule;
        struct nrs_tbf_rule     *next_rule;
        char                    *next_name = start->u.tc_start.ts_next_name;
        int                      rc;

        rule = nrs_tbf_rule_find(head, start->tc_name);
        if (rule) {
                nrs_tbf_rule_put(rule);
                return -EEXIST;
        }

        OBD_CPT_ALLOC_PTR(rule, nrs_pol2cptab(policy), nrs_pol2cptid(policy));
        if (rule == NULL)
                return -ENOMEM;

        memcpy(rule->tr_name, start->tc_name, strlen(start->tc_name));    <---------------------


 Comments   
Comment by Gerrit Updater [ 04/Oct/21 ]

"Etienne AUJAMES <eaujames@ddn.com>" uploaded a new patch: https://review.whamcloud.com/45124
Subject: LU-15056 nrs: length of a tbf rule should be checked
Project: fs/lustre-release
Branch: master
Current Patch Set: 1
Commit: 8c8f574b02c720607c9ca73493af3735a13f88b7

Comment by Gerrit Updater [ 06/Jan/22 ]

"Oleg Drokin <green@whamcloud.com>" merged in patch https://review.whamcloud.com/45124/
Subject: LU-15056 nrs: length of a tbf rule should be checked
Project: fs/lustre-release
Branch: master
Current Patch Set:
Commit: 1937c6cd75a2346b353f4cb6aacda8d0b6df804d

Comment by Peter Jones [ 06/Jan/22 ]

Landed for 2.15

Comment by Gerrit Updater [ 07/Jan/22 ]

"Etienne AUJAMES <eaujames@ddn.com>" uploaded a new patch: https://review.whamcloud.com/46003
Subject: LU-15056 nrs: length of a tbf rule should be checked
Project: fs/lustre-release
Branch: b2_12
Current Patch Set: 1
Commit: 927f6af5564f5da839a4f2190379c6b091d872e1

Generated at Sat Feb 10 03:15:04 UTC 2024 using Jira 9.4.14#940014-sha1:734e6822bbf0d45eff9af51f82432957f73aa32c.