]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
libmount: check for errors from prep-options hooks
authorChris Webb <chris@arachsys.com>
Sun, 23 Apr 2023 16:05:07 +0000 (17:05 +0100)
committerChris Webb <chris@arachsys.com>
Sun, 23 Apr 2023 16:05:07 +0000 (17:05 +0100)
fix_optstr() in context_mount.c calls the MNT_STAGE_PREP_OPTIONS hooks
but discards returned errors. This suppresses error messages and can
make invalid option strings 'fail open' in surprising ways. Handle error
returns from these hooks correctly.

No other callers of mnt_context_call_hooks() discard the return value,
so other hooks aren't affected.

Signed-off-by: Chris Webb <chris@arachsys.com>
libmount/src/context_mount.c

index b8499471af52b14b07daada62ba3e08a18fffba1..5aae4bea0f344d3bfdc61d00509d68bf7166820f 100644 (file)
@@ -135,7 +135,7 @@ static int fix_optstr(struct libmnt_context *cxt)
                }
        }
 #endif
-       mnt_context_call_hooks(cxt, MNT_STAGE_PREP_OPTIONS);
+       rc = mnt_context_call_hooks(cxt, MNT_STAGE_PREP_OPTIONS);
 done:
        DBG(CXT, ul_debugobj(cxt, "<-- preparing options done [rc=%d]", rc));
        cxt->flags |= MNT_FL_MOUNTOPTS_FIXED;