From: James Morris <jmorris@namei.org> To: David Howells <dhowells@redhat.com> Cc: keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/7] keys: Add a keyctl to move a key between keyrings Date: Tue, 28 May 2019 20:51:57 +0000 [thread overview] Message-ID: <alpine.LRH.2.21.1905290646010.31297@namei.org> (raw) In-Reply-To: <155856412507.10428.15987388402707639951.stgit@warthog.procyon.org.uk> On Wed, 22 May 2019, David Howells wrote: > + > + if (flags & ~KEYCTL_MOVE_EXCL) > + return -EINVAL; > + > + key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE, KEY_NEED_LINK); > + if (IS_ERR(key_ref)) { > + ret = PTR_ERR(key_ref); > + goto error; > + } This could probably be a simple return, as there is no cleanup. > + > + from_ref = lookup_user_key(from_ringid, 0, KEY_NEED_WRITE); > + if (IS_ERR(from_ref)) { > + ret = PTR_ERR(from_ref); > + goto error2; > + } > + > + to_ref = lookup_user_key(to_ringid, KEY_LOOKUP_CREATE, KEY_NEED_WRITE); > + if (IS_ERR(to_ref)) { > + ret = PTR_ERR(to_ref); > + goto error3; > + } > + > + ret = key_move(key_ref_to_ptr(key_ref), key_ref_to_ptr(from_ref), > + key_ref_to_ptr(to_ref), flags); > + > + key_ref_put(to_ref); > +error3: > + key_ref_put(from_ref); > +error2: > + key_ref_put(key_ref); > +error: > + return ret; > +} > + -- James Morris <jmorris@namei.org>
WARNING: multiple messages have this Message-ID (diff)
From: James Morris <jmorris@namei.org> To: David Howells <dhowells@redhat.com> Cc: keyrings@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/7] keys: Add a keyctl to move a key between keyrings Date: Wed, 29 May 2019 06:51:57 +1000 (AEST) [thread overview] Message-ID: <alpine.LRH.2.21.1905290646010.31297@namei.org> (raw) In-Reply-To: <155856412507.10428.15987388402707639951.stgit@warthog.procyon.org.uk> On Wed, 22 May 2019, David Howells wrote: > + > + if (flags & ~KEYCTL_MOVE_EXCL) > + return -EINVAL; > + > + key_ref = lookup_user_key(id, KEY_LOOKUP_CREATE, KEY_NEED_LINK); > + if (IS_ERR(key_ref)) { > + ret = PTR_ERR(key_ref); > + goto error; > + } This could probably be a simple return, as there is no cleanup. > + > + from_ref = lookup_user_key(from_ringid, 0, KEY_NEED_WRITE); > + if (IS_ERR(from_ref)) { > + ret = PTR_ERR(from_ref); > + goto error2; > + } > + > + to_ref = lookup_user_key(to_ringid, KEY_LOOKUP_CREATE, KEY_NEED_WRITE); > + if (IS_ERR(to_ref)) { > + ret = PTR_ERR(to_ref); > + goto error3; > + } > + > + ret = key_move(key_ref_to_ptr(key_ref), key_ref_to_ptr(from_ref), > + key_ref_to_ptr(to_ref), flags); > + > + key_ref_put(to_ref); > +error3: > + key_ref_put(from_ref); > +error2: > + key_ref_put(key_ref); > +error: > + return ret; > +} > + -- James Morris <jmorris@namei.org>
next prev parent reply other threads:[~2019-05-28 20:51 UTC|newest] Thread overview: 36+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-05-22 22:28 [PATCH 0/7] keys: Miscellany David Howells 2019-05-22 22:28 ` David Howells 2019-05-22 22:28 ` [PATCH 1/7] keys: sparse: Fix key_fs[ug]id_changed() David Howells 2019-05-22 22:28 ` David Howells 2019-05-24 19:38 ` James Morris 2019-05-24 19:38 ` James Morris 2019-05-22 22:28 ` [PATCH 2/7] keys: sparse: Fix incorrect RCU accesses David Howells 2019-05-22 22:28 ` David Howells 2019-05-25 3:57 ` James Morris 2019-05-25 3:57 ` James Morris 2019-05-22 22:28 ` [PATCH 3/7] keys: sparse: Fix kdoc mismatches David Howells 2019-05-22 22:28 ` David Howells 2019-05-25 3:57 ` James Morris 2019-05-25 3:57 ` James Morris 2019-05-22 22:28 ` [PATCH 4/7] keys: Break bits out of key_unlink() David Howells 2019-05-22 22:28 ` David Howells 2019-05-28 20:41 ` James Morris 2019-05-28 20:41 ` James Morris 2019-05-22 22:28 ` [PATCH 5/7] keys: Make __key_link_begin() handle lockdep nesting David Howells 2019-05-22 22:28 ` David Howells 2019-05-28 20:42 ` James Morris 2019-05-28 20:42 ` James Morris 2019-05-22 22:28 ` [PATCH 6/7] keys: Add a keyctl to move a key between keyrings David Howells 2019-05-22 22:28 ` David Howells 2019-05-28 20:51 ` James Morris [this message] 2019-05-28 20:51 ` James Morris 2019-05-29 21:34 ` David Howells 2019-05-29 21:34 ` David Howells 2019-05-29 23:25 ` Eric Biggers 2019-05-29 23:25 ` Eric Biggers 2019-05-30 13:31 ` David Howells 2019-05-30 13:31 ` David Howells 2019-05-22 22:28 ` [PATCH 7/7] keys: Grant Link permission to possessers of request_key auth keys David Howells 2019-05-22 22:28 ` David Howells 2019-05-28 21:01 ` James Morris 2019-05-28 21:01 ` James Morris
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=alpine.LRH.2.21.1905290646010.31297@namei.org \ --to=jmorris@namei.org \ --cc=dhowells@redhat.com \ --cc=keyrings@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-security-module@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.