From patchwork Mon Sep 21 14:34:34 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Hellwig X-Patchwork-Id: 11790019 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 78DC86CB for ; Mon, 21 Sep 2020 14:35:13 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 356482220C for ; Mon, 21 Sep 2020 14:35:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="dy92xMt8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 356482220C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=lst.de Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 75CEC900080; Mon, 21 Sep 2020 10:34:47 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6DFA190007D; Mon, 21 Sep 2020 10:34:47 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 58378900080; Mon, 21 Sep 2020 10:34:47 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 271EB900069 for ; Mon, 21 Sep 2020 10:34:47 -0400 (EDT) Received: from smtpin28.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id D683F181AEF15 for ; Mon, 21 Sep 2020 14:34:46 +0000 (UTC) X-FDA: 77287314972.28.unit59_000902f27145 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin28.hostedemail.com (Postfix) with ESMTP id A6DAA6C05; Mon, 21 Sep 2020 14:34:46 +0000 (UTC) X-Spam-Summary: 1,0,0,2c877dbb404f4e3a,d41d8cd98f00b204,batv+776a1a22abff015854b2+6238+infradead.org+hch@casper.srs.infradead.org,,RULES_HIT:41:69:355:379:541:800:960:966:973:988:989:1260:1311:1314:1345:1359:1437:1515:1535:1543:1711:1730:1747:1777:1792:2196:2199:2393:2559:2562:2693:2894:2902:3138:3139:3140:3141:3142:3354:3865:3866:3867:3868:3871:3874:4321:4385:4605:5007:6261:6653:6742:6743:8660:9592:10004:11026:11473:11658:11914:12043:12114:12160:12296:12297:12438:12517:12519:12555:12683:12895:12986:13141:13148:13230:13894:14096:14110:14181:14394:14721:21080:21451:21627:21740:21939:21990:30051:30054:30080,0,RBL:90.155.50.34:@casper.srs.infradead.org:.lbl8.mailshell.net-64.201.201.201 62.8.15.100;04yfnwsjcnjckfxfe7d87ict7gdh7ycred5tyamw8k3gbc8etex77zno7ijiiqf.9df6o64r161d89yshowpku795hqexk189b1jwkm3qbyjuj47q4mzpbusz81rfo4.h-lbl8.mailshell.net-223.238.255.100,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:neutral,Custom_rules:0:0: 0,LFtime X-HE-Tag: unit59_000902f27145 X-Filterd-Recvd-Size: 5503 Received: from casper.infradead.org (casper.infradead.org [90.155.50.34]) by imf15.hostedemail.com (Postfix) with ESMTP; Mon, 21 Sep 2020 14:34:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=7X3/qUs2y75UUlnvdA2vy1FAPs/IUNMhWXsjmEB0AzE=; b=dy92xMt8/hhoU3g/sIuxnNLbl+ Nnj6ERvpkc1IlL4sj5dIfssSenGvxA+3UGeocqvvW0bK5nqyD87xGywyHMO50b64xETvy6f5C7+jz 1ZJdm/VV09ZRLwsDyyLcMHfrELH2D1eYj+5bsTBZ25lWk1XsOFQFh/AQieGYsKfS5OUz5LASsN8I6 rzYxMMIXRXL89rVEiOUMrkOHhm1UEwQ9++bKqy6M9HdkYA+B0GjI6rNatMh1zg7somA/Qq96o55Q6 DVSHIhrhVnj3cQpJ/EO6vPX4LRYcTqqLU1MH8+ta4C+5jNV0FqKzNBOSq9JjyuaCqWmJpW60ZG8SO wRMk55nw==; Received: from p4fdb0c34.dip0.t-ipconnect.de ([79.219.12.52] helo=localhost) by casper.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1kKMtm-0007tU-EZ; Mon, 21 Sep 2020 14:34:34 +0000 From: Christoph Hellwig To: Alexander Viro Cc: Andrew Morton , Jens Axboe , Arnd Bergmann , David Howells , David Laight , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, sparclinux@vger.kernel.org, linux-block@vger.kernel.org, linux-scsi@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-aio@kvack.org, io-uring@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, netdev@vger.kernel.org, keyrings@vger.kernel.org, linux-security-module@vger.kernel.org Subject: [PATCH 11/11] security/keys: remove compat_keyctl_instantiate_key_iov Date: Mon, 21 Sep 2020 16:34:34 +0200 Message-Id: <20200921143434.707844-12-hch@lst.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921143434.707844-1-hch@lst.de> References: <20200921143434.707844-1-hch@lst.de> MIME-Version: 1.0 X-SRS-Rewrite: SMTP reverse-path rewritten from by casper.infradead.org. See http://www.infradead.org/rpr.html 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: Now that import_iovec handles compat iovecs, the native version of keyctl_instantiate_key_iov can be used for the compat case as well. Signed-off-by: Christoph Hellwig --- security/keys/compat.c | 36 ++---------------------------------- security/keys/internal.h | 5 ----- security/keys/keyctl.c | 2 +- 3 files changed, 3 insertions(+), 40 deletions(-) diff --git a/security/keys/compat.c b/security/keys/compat.c index 7ae531db031cf8..1545efdca56227 100644 --- a/security/keys/compat.c +++ b/security/keys/compat.c @@ -11,38 +11,6 @@ #include #include "internal.h" -/* - * Instantiate a key with the specified compatibility multipart payload and - * link the key into the destination keyring if one is given. - * - * The caller must have the appropriate instantiation permit set for this to - * work (see keyctl_assume_authority). No other permissions are required. - * - * If successful, 0 will be returned. - */ -static long compat_keyctl_instantiate_key_iov( - key_serial_t id, - const struct compat_iovec __user *_payload_iov, - unsigned ioc, - key_serial_t ringid) -{ - struct iovec iovstack[UIO_FASTIOV], *iov = iovstack; - struct iov_iter from; - long ret; - - if (!_payload_iov) - ioc = 0; - - ret = import_iovec(WRITE, (const struct iovec __user *)_payload_iov, - ioc, ARRAY_SIZE(iovstack), &iov, &from); - if (ret < 0) - return ret; - - ret = keyctl_instantiate_key_common(id, &from, ringid); - kfree(iov); - return ret; -} - /* * The key control system call, 32-bit compatibility version for 64-bit archs */ @@ -113,8 +81,8 @@ COMPAT_SYSCALL_DEFINE5(keyctl, u32, option, return keyctl_reject_key(arg2, arg3, arg4, arg5); case KEYCTL_INSTANTIATE_IOV: - return compat_keyctl_instantiate_key_iov( - arg2, compat_ptr(arg3), arg4, arg5); + return keyctl_instantiate_key_iov(arg2, compat_ptr(arg3), arg4, + arg5); case KEYCTL_INVALIDATE: return keyctl_invalidate_key(arg2); diff --git a/security/keys/internal.h b/security/keys/internal.h index 338a526cbfa516..9b9cf3b6fcbb4d 100644 --- a/security/keys/internal.h +++ b/security/keys/internal.h @@ -262,11 +262,6 @@ extern long keyctl_instantiate_key_iov(key_serial_t, const struct iovec __user *, unsigned, key_serial_t); extern long keyctl_invalidate_key(key_serial_t); - -struct iov_iter; -extern long keyctl_instantiate_key_common(key_serial_t, - struct iov_iter *, - key_serial_t); extern long keyctl_restrict_keyring(key_serial_t id, const char __user *_type, const char __user *_restriction); diff --git a/security/keys/keyctl.c b/security/keys/keyctl.c index 9febd37a168fd0..e26bbccda7ccee 100644 --- a/security/keys/keyctl.c +++ b/security/keys/keyctl.c @@ -1164,7 +1164,7 @@ static int keyctl_change_reqkey_auth(struct key *key) * * If successful, 0 will be returned. */ -long keyctl_instantiate_key_common(key_serial_t id, +static long keyctl_instantiate_key_common(key_serial_t id, struct iov_iter *from, key_serial_t ringid) {