Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-RAN
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lizhongxiao
OpenXG-RAN
Commits
d442e21f
Commit
d442e21f
authored
Oct 23, 2023
by
Robert Schmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Deep-copy PUSCH&PUCCH_ConfigCommon to prevent double-free
parent
38a6e92f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
3 deletions
+38
-3
openair2/RRC/NR/nr_rrc_config.c
openair2/RRC/NR/nr_rrc_config.c
+38
-3
No files found.
openair2/RRC/NR/nr_rrc_config.c
View file @
d442e21f
...
...
@@ -52,6 +52,40 @@ static NR_BWP_t clone_generic_parameters(const NR_BWP_t *gp)
return
clone
;
}
static
NR_SetupRelease_PUSCH_ConfigCommon_t
*
clone_pusch_configcommon
(
const
NR_SetupRelease_PUSCH_ConfigCommon_t
*
pcc
)
{
if
(
pcc
==
NULL
||
pcc
->
present
==
NR_SetupRelease_PUSCH_ConfigCommon_PR_NOTHING
)
return
NULL
;
NR_SetupRelease_PUSCH_ConfigCommon_t
*
clone
=
calloc_or_fail
(
1
,
sizeof
(
*
clone
));
clone
->
present
=
pcc
->
present
;
if
(
clone
->
present
==
NR_SetupRelease_PUSCH_ConfigCommon_PR_release
)
return
clone
;
uint8_t
buf
[
1024
];
asn_enc_rval_t
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_PUSCH_ConfigCommon
,
NULL
,
pcc
->
choice
.
setup
,
buf
,
sizeof
(
buf
));
AssertFatal
(
enc_rval
.
encoded
>
0
&&
enc_rval
.
encoded
<
sizeof
(
buf
),
"could not clone NR_PUSCH_ConfigCommon: problem while encoding
\n
"
);
asn_dec_rval_t
dec_rval
=
uper_decode
(
NULL
,
&
asn_DEF_NR_PUSCH_ConfigCommon
,
(
void
**
)
&
clone
->
choice
.
setup
,
buf
,
enc_rval
.
encoded
,
0
,
0
);
AssertFatal
(
dec_rval
.
code
==
RC_OK
&&
dec_rval
.
consumed
==
enc_rval
.
encoded
,
"could not clone NR_PUSCH_ConfigCommon: problem while decoding
\n
"
);
return
clone
;
}
static
NR_SetupRelease_PUCCH_ConfigCommon_t
*
clone_pucch_configcommon
(
const
NR_SetupRelease_PUCCH_ConfigCommon_t
*
pcc
)
{
if
(
pcc
==
NULL
||
pcc
->
present
==
NR_SetupRelease_PUCCH_ConfigCommon_PR_NOTHING
)
return
NULL
;
NR_SetupRelease_PUCCH_ConfigCommon_t
*
clone
=
calloc_or_fail
(
1
,
sizeof
(
*
clone
));
clone
->
present
=
pcc
->
present
;
if
(
clone
->
present
==
NR_SetupRelease_PUCCH_ConfigCommon_PR_release
)
return
clone
;
uint8_t
buf
[
1024
];
asn_enc_rval_t
enc_rval
=
uper_encode_to_buffer
(
&
asn_DEF_NR_PUCCH_ConfigCommon
,
NULL
,
pcc
->
choice
.
setup
,
buf
,
sizeof
(
buf
));
AssertFatal
(
enc_rval
.
encoded
>
0
&&
enc_rval
.
encoded
<
sizeof
(
buf
),
"could not clone NR_PUCCH_ConfigCommon: problem while encoding
\n
"
);
asn_dec_rval_t
dec_rval
=
uper_decode
(
NULL
,
&
asn_DEF_NR_PUCCH_ConfigCommon
,
(
void
**
)
&
clone
->
choice
.
setup
,
buf
,
enc_rval
.
encoded
,
0
,
0
);
AssertFatal
(
dec_rval
.
code
==
RC_OK
&&
dec_rval
.
consumed
==
enc_rval
.
encoded
,
"could not clone NR_PUCCH_ConfigCommon: problem while decoding
\n
"
);
return
clone
;
}
static
NR_SearchSpace_t
*
rrc_searchspace_config
(
bool
is_common
,
int
searchspaceid
,
int
coresetid
)
{
...
...
@@ -1284,7 +1318,7 @@ static void config_uplinkBWP(NR_BWP_Uplink_t *ubwp,
int
curr_bwp
=
NRRIV2BW
(
ubwp
->
bwp_Common
->
genericParameters
.
locationAndBandwidth
,
MAX_BWP_SIZE
);
ubwp
->
bwp_Common
->
rach_ConfigCommon
=
is_SA
?
NULL
:
scc
->
uplinkConfigCommon
->
initialUplinkBWP
->
rach_ConfigCommon
;
ubwp
->
bwp_Common
->
pusch_ConfigCommon
=
scc
->
uplinkConfigCommon
->
initialUplinkBWP
->
pusch_ConfigCommon
;
ubwp
->
bwp_Common
->
pusch_ConfigCommon
=
clone_pusch_configcommon
(
scc
->
uplinkConfigCommon
->
initialUplinkBWP
->
pusch_ConfigCommon
)
;
ubwp
->
bwp_Common
->
pucch_ConfigCommon
=
CALLOC
(
1
,
sizeof
(
struct
NR_SetupRelease_PUCCH_ConfigCommon
));
ubwp
->
bwp_Common
->
pucch_ConfigCommon
->
present
=
NR_SetupRelease_PUCCH_ConfigCommon_PR_setup
;
ubwp
->
bwp_Common
->
pucch_ConfigCommon
->
choice
.
setup
=
CALLOC
(
1
,
sizeof
(
struct
NR_PUCCH_ConfigCommon
));
...
...
@@ -1910,10 +1944,11 @@ NR_BCCH_DL_SCH_Message_t *get_SIB1_NR(const NR_ServingCellConfigCommon_t *scc, c
UL
->
initialUplinkBWP
.
genericParameters
=
clone_generic_parameters
(
&
scc
->
uplinkConfigCommon
->
initialUplinkBWP
->
genericParameters
);
UL
->
initialUplinkBWP
.
rach_ConfigCommon
=
scc
->
uplinkConfigCommon
->
initialUplinkBWP
->
rach_ConfigCommon
;
UL
->
initialUplinkBWP
.
pusch_ConfigCommon
=
scc
->
uplinkConfigCommon
->
initialUplinkBWP
->
pusch_ConfigCommon
;
UL
->
initialUplinkBWP
.
pusch_ConfigCommon
=
clone_pusch_configcommon
(
scc
->
uplinkConfigCommon
->
initialUplinkBWP
->
pusch_ConfigCommon
);
free
(
UL
->
initialUplinkBWP
.
pusch_ConfigCommon
->
choice
.
setup
->
groupHoppingEnabledTransformPrecoding
);
UL
->
initialUplinkBWP
.
pusch_ConfigCommon
->
choice
.
setup
->
groupHoppingEnabledTransformPrecoding
=
NULL
;
UL
->
initialUplinkBWP
.
pucch_ConfigCommon
=
scc
->
uplinkConfigCommon
->
initialUplinkBWP
->
pucch_ConfigCommon
;
UL
->
initialUplinkBWP
.
pucch_ConfigCommon
=
clone_pucch_configcommon
(
scc
->
uplinkConfigCommon
->
initialUplinkBWP
->
pucch_ConfigCommon
)
;
UL
->
timeAlignmentTimerCommon
=
NR_TimeAlignmentTimer_infinity
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment