Skip to content

Commit e98dd60

Browse files
committed
schema mount BUGFIX check for printed context
Check for printed context before trying to lock/find/create any inline sm contexts - they do not get printed so they cant be found, it would just crash.
1 parent 07f391d commit e98dd60

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/plugins_exts/schema_mount.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -718,6 +718,15 @@ schema_mount_get_ctx_inline(struct lysc_ext_instance *ext, const struct lyd_node
718718

719719
assert(sm_data && sm_data->shared);
720720

721+
if (ly_ctx_is_printed(ext->module->ctx)) {
722+
/* compiled print (::schema_mount_compiled_print()) doesnt print any inline contexts,
723+
* so they cannot be found nor created at this point
724+
* (in the future they could be printed and possibly found here and used) */
725+
lyplg_ext_compile_log(NULL, ext, LY_LLERR, LY_EVALID,
726+
"Inline-schema mount point \"%s\" not allowed in printed context.", ext->argument);
727+
return LY_EVALID;
728+
}
729+
721730
/* LOCK */
722731
if ((r = pthread_mutex_lock(&sm_data->lock))) {
723732
lyplg_ext_compile_log(NULL, ext, LY_LLERR, LY_ESYS, "Mutex lock failed (%s).", strerror(r));

0 commit comments

Comments
 (0)