From 01ed0468bcc130154fcf380c73d0f98dbdfe0e4b Mon Sep 17 00:00:00 2001 From: Chris Webb Date: Sun, 23 Apr 2023 17:05:07 +0100 Subject: [PATCH] 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 --- libmount/src/context_mount.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.47.2