From: Chris Webb Date: Sun, 23 Apr 2023 16:05:07 +0000 (+0100) Subject: libmount: check for errors from prep-options hooks X-Git-Tag: v2.39~64 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=01ed0468bcc130154fcf380c73d0f98dbdfe0e4b;p=thirdparty%2Futil-linux.git libmount: check for errors from prep-options hooks 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 --- diff --git a/libmount/src/context_mount.c b/libmount/src/context_mount.c index b8499471af..5aae4bea0f 100644 --- a/libmount/src/context_mount.c +++ b/libmount/src/context_mount.c @@ -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;