From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754307AbbCQCqW (ORCPT ); Mon, 16 Mar 2015 22:46:22 -0400 Received: from out3-smtp.messagingengine.com ([66.111.4.27]:60564 "EHLO out3-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932065AbbCQCqR (ORCPT ); Mon, 16 Mar 2015 22:46:17 -0400 X-Sasl-enc: PbgBSKl/SKuXppFgsCbpH9c7BuDNNP/ptCVDEMMrkiid 1426560376 Subject: [RFC PATCH v4 11/12] KEYS - use correct memory allocation flag in call_usermodehelper_keys() From: Ian Kent To: Kernel Mailing List Cc: David Howells , Oleg Nesterov , Trond Myklebust , "J. Bruce Fields" , Benjamin Coddington , Al Viro , Jeff Layton , "Eric W. Biederman" Date: Tue, 17 Mar 2015 10:46:02 +0800 Message-ID: <20150317024601.24592.13162.stgit@pluto.fritz.box> In-Reply-To: <20150317022308.24592.35785.stgit@pluto.fritz.box> References: <20150317022308.24592.35785.stgit@pluto.fritz.box> User-Agent: StGit/0.17-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ian Kent When call_usermodehelper_keys() is called it assumes it won't be called with the flag UMH_NO_WAIT. Currently that's always the case. Change this to check the flag and use the correct kernel memory allocation flag to guard against future changes. Signed-off-by: Ian Kent Cc: Benjamin Coddington Cc: Al Viro Cc: J. Bruce Fields Cc: David Howells Cc: Trond Myklebust Cc: Oleg Nesterov Cc: Eric W. Biederman Cc: Jeff Layton --- security/keys/request_key.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/security/keys/request_key.c b/security/keys/request_key.c index 486ef6f..e865f9f 100644 --- a/security/keys/request_key.c +++ b/security/keys/request_key.c @@ -76,8 +76,10 @@ static int call_usermodehelper_keys(char *path, char **argv, char **envp, struct key *session_keyring, int wait) { struct subprocess_info *info; + unsigned int gfp_mask = (wait & UMH_NO_WAIT) ? + GFP_ATOMIC : GFP_KERNEL; - info = call_usermodehelper_setup(path, argv, envp, GFP_KERNEL, + info = call_usermodehelper_setup(path, argv, envp, gfp_mask, umh_keys_init, umh_keys_cleanup, session_keyring); if (!info)