Message ID | AS8P193MB128517ADB5EFF29E04389EDAE4752@AS8P193MB1285.EURP193.PROD.OUTLOOK.COM (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6F8F3C47DD3 for <linux-mm@archiver.kernel.org>; Mon, 22 Jan 2024 18:33:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DF2746B0092; Mon, 22 Jan 2024 13:33:28 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id DA2B26B0093; Mon, 22 Jan 2024 13:33:28 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C1BB66B0096; Mon, 22 Jan 2024 13:33:28 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id AF4356B0092 for <linux-mm@kvack.org>; Mon, 22 Jan 2024 13:33:28 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 89C68A1DB1 for <linux-mm@kvack.org>; Mon, 22 Jan 2024 18:33:28 +0000 (UTC) X-FDA: 81707794896.02.90A1BB3 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05olkn2046.outbound.protection.outlook.com [40.92.89.46]) by imf11.hostedemail.com (Postfix) with ESMTP id ED8924000F for <linux-mm@kvack.org>; Mon, 22 Jan 2024 18:33:24 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of bernd.edlinger@hotmail.de designates 40.92.89.46 as permitted sender) smtp.mailfrom=bernd.edlinger@hotmail.de; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=hotmail.de ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1705948405; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=WkLkCMGS0Kslf9FUZQDS7mtYKmevNVfHKUnmnRDYttI=; b=etRB9C1zANEShYsmBHmaTCmZa/5WfQD2HYD3LgCqp2M6rl0LZ5VD0/dVGV9BI1Rbb0nZSC 1giymnLQKvAmz0d+TylcDzvpOE0jVyWxl0PdkL8uLa9zfECHFGuaAxEzlNkDixXqW5cS0B 593itBtUTLH1iuFy4J76TyOzYyZx5fQ= ARC-Authentication-Results: i=2; imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of bernd.edlinger@hotmail.de designates 40.92.89.46 as permitted sender) smtp.mailfrom=bernd.edlinger@hotmail.de; arc=pass ("microsoft.com:s=arcselector9901:i=1"); dmarc=pass (policy=none) header.from=hotmail.de ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1705948405; a=rsa-sha256; cv=pass; b=ohWoAsMycD+VQQmoNfhepmAt/ZGcwC0qIK4JijO+G2Rc+G9YDt0w9LEPeQbFd1pNqFOT+R eOFc8/21EwaUhfedepQqRdF5IPvLkvtaHxc0yYhuJQH4z0T0XAvFGCV4Ok4zT4EcD2zkiR 2HUgNz5xa4wb3dtTQQu24iBOpPXZels= ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jkOdTRwSE6+PIQIH4NYVDoXe90P+bT856Eg6iELqh+OIu0gWDikP0T19jJ1uPF1EWcvW0qVvgBwkNR1ZolQOupqP1B6QxbCJaltt4ocofTVUdE7BTBRfW2p3t/6knwFeEguQe+VLZN9y6Rr1XybMJwrgvoXC6CKydKmUadXo724EV7CDQqk/EEye5c4mtwKIc3uJTl8E/CDVINNH5rOb3En8YFX3k4gLa1tirXiZwLFRDw+H9AnLJskwhVXf1+yJjN4RR68g9TyKXwldQKzNlPEUqUXyC6WWXsejGY6XmHe/LN6XnFvwCIJL3LGOy9KHn4pXBOHJJ/A9flUuGJytAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=WkLkCMGS0Kslf9FUZQDS7mtYKmevNVfHKUnmnRDYttI=; b=hbDK0LcsR7lawkduQtpnV63zn7KkogsCdg1k6N6x6Vl6Z2CyEVs6tBDZCTDRP0VHA4Cdf2hLNpUxtr4/UA7EKbugBjki2ggzoBinPM5qLa0n+5YbUFaPIKMnFRTUGh1J6Iy9ze2+uQiu/j/ILngLD1X5c2mXhez5m7gCXxKKMx6VBCvBjIHW9EF23EamhaxtH0+FaKe/QDms+UVTp6s7sC/xmKgGIE9bIJlYULEtf9LeFRTojTLLTG6bvN23nKs8ECqtkQgrze6DOyaOfJgYhzqfMdiVd+pju4UvLU0pP0WB+aHnsUPHPQOJapT0h1WRbiF8tzepiGrCLC/s9RJ1sw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none Received: from AS8P193MB1285.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:333::21) by AS8P193MB2111.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:44d::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.32; Mon, 22 Jan 2024 18:33:22 +0000 Received: from AS8P193MB1285.EURP193.PROD.OUTLOOK.COM ([fe80::897e:cfd5:b29b:c611]) by AS8P193MB1285.EURP193.PROD.OUTLOOK.COM ([fe80::897e:cfd5:b29b:c611%6]) with mapi id 15.20.7202.031; Mon, 22 Jan 2024 18:33:22 +0000 Message-ID: <AS8P193MB128517ADB5EFF29E04389EDAE4752@AS8P193MB1285.EURP193.PROD.OUTLOOK.COM> Date: Mon, 22 Jan 2024 19:34:21 +0100 User-Agent: Mozilla Thunderbird Subject: [PATCH v3] Fix error handling in begin_new_exec From: Bernd Edlinger <bernd.edlinger@hotmail.de> To: Alexander Viro <viro@zeniv.linux.org.uk>, Christian Brauner <brauner@kernel.org>, Kees Cook <keescook@chromium.org>, "Eric W. Biederman" <ebiederm@xmission.com>, "linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>, linux-mm@kvack.org, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Andrew Morton <akpm@linux-foundation.org> References: <AM8PR10MB47081071E64EAAB343196D5AE4399@AM8PR10MB4708.EURPRD10.PROD.OUTLOOK.COM> <AS8P193MB1285304CE97348D62021C878E46C2@AS8P193MB1285.EURP193.PROD.OUTLOOK.COM> Content-Language: en-US In-Reply-To: <AS8P193MB1285304CE97348D62021C878E46C2@AS8P193MB1285.EURP193.PROD.OUTLOOK.COM> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-TMN: [FGDY1yHzdZc6FFv+Zt52tbL3ygr+LKpoOcr/HFmWL0igZMlPLETmsvVpaEXSjg6t] X-ClientProxiedBy: BE1P281CA0479.DEUP281.PROD.OUTLOOK.COM (2603:10a6:b10:7e::23) To AS8P193MB1285.EURP193.PROD.OUTLOOK.COM (2603:10a6:20b:333::21) X-Microsoft-Original-Message-ID: <1656ab24-26f4-4572-8bfc-663b533db78b@hotmail.de> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P193MB1285:EE_|AS8P193MB2111:EE_ X-MS-Office365-Filtering-Correlation-Id: 59987384-b291-4ad9-0ba0-08dc1b789cad X-Microsoft-Antispam: BCL:0; X-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iZiH7Ys3KXR/yvE2+fjTL/CtMfrFG9f6d5m+x05es88Xgsjy0Mwo15?= =?utf-8?q?tbu2ksghhS3zwWhIzo5IO7Agj0zaalL1gsTjfm/95h/UyhavO8ZZ4Mbt61ig=3D?= X-OriginatorOrg: sct-15-20-4755-11-msonline-outlook-80ceb.templateTenant X-MS-Exchange-CrossTenant-Network-Message-Id: 59987384-b291-4ad9-0ba0-08dc1b789cad X-MS-Exchange-CrossTenant-AuthSource: AS8P193MB1285.EURP193.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Jan 2024 18:33:22.0774 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8P193MB2111 X-Rspamd-Queue-Id: ED8924000F X-Rspam-User: X-Stat-Signature: ybouzjudcupzjg9nrfqbwk75dtjbasab X-Rspamd-Server: rspam01 X-HE-Tag: 1705948404-610618 X-HE-Meta: U2FsdGVkX191i2pG9VF1YaW/u13MmibC0JY4pSESortvQC+Q4o9qmbyBb/SuS5lrUUg+ykcEPufp1ObwPdLV9PzhqIMNC4iAaJrZW458QDEb8q5KJfGNxgA0R9x4EmcrvFkTTujC45SvFFYDJyJkT2YY68p81lnrGyku3Jr+SiGbn1e6h8PZmZrgH92F0O+GfraY1mdhZxZEfAwa8sVvrQsPKJ59DCQ1VuwGXGLyLy1B9gvwRt0cvjNAkoe3Lq/3BZpnmvmCXYmuNKvCAUpSsB4CORbaFs0P1P7BDXpEhEzGGtvvq0FcOZyvJIJLNzqnFEL+BE9ksKcoqiMAgwbJAAZXn3YzBlRDSk10k0lU7348WxIXviXgcGQCObYhS3Soa4eRAyyw9Lm9HxOFcw+bWYEsiCZI8YC9A8bdq9FGZcEfvAoWM2F6jEHdF+NQhpdUR9YCl1qKtDKM9oEH4qHaZ71ixvrIaAcHFZnCu4AfMgDRMf8ibSKrgXzEhZdS7+0xvYHK77D4o5Csg4EEHB1OSR0a1jalFMef4UpaPZ+4KpRMfK2oIVaH3UGi4bC9F1NPLJV2hay+kT0Hdsw+KmAoxyOugGXgMIF1nwoCEvDyeM0abJaXmoGVZhwc596K/yHFt49ylymPTWp+PJu7AW6lidrfO22/tXwlH5Kn/tiybwgrPULtJ2fkmRc7oUnGCNofPuF7SEubM1UxiTHpm2X3LlSWUlbBl9MvYCwgaRiJAuAuIODlZoLOFTLxRqQzKR/mDG5fqRAc0rMvuX1cJE1f2hyyVKgAxRtYc/B3cfBJTcs0Rfw3yjAQadnlQBgUViqib2FUn5KRMDHhlBr12rA3bY+GnI+NKzoVjNlQVQ/CGh+KRTb4LKTCP1XzzzeCqwvNK+s8eFJP/FRlxIAsspTYLA+c2/Yk1HJMDRSY8OHUR5VpR6LEyzjf9N7bvtDPug6mKBQ15ZD/WzU0d7eLyC5 unA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
[v3] Fix error handling in begin_new_exec
|
expand
|
On Mon, 22 Jan 2024 19:34:21 +0100, Bernd Edlinger wrote: > If get_unused_fd_flags() fails, the error handling is incomplete > because bprm->cred is already set to NULL, and therefore > free_bprm will not unlock the cred_guard_mutex. > Note there are two error conditions which end up here, > one before and one after bprm->cred is cleared. > > > [...] Applied to for-next/execve, thanks! [1/1] Fix error handling in begin_new_exec https://git.kernel.org/kees/c/84c39ec57d40 Take care,
diff --git a/fs/exec.c b/fs/exec.c index 8cdd5b2dd09c..e88249a1ce07 100644 --- a/fs/exec.c +++ b/fs/exec.c @@ -1409,6 +1409,9 @@ int begin_new_exec(struct linux_binprm * bprm) out_unlock: up_write(&me->signal->exec_update_lock); + if (!bprm->cred) + mutex_unlock(&me->signal->cred_guard_mutex); + out: return retval; }