linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] block: add sanity check for uid in syscall of ioprio_get()
@ 2019-01-01 13:35 Chengguang Xu
  0 siblings, 0 replies; only message in thread
From: Chengguang Xu @ 2019-01-01 13:35 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, Chengguang Xu

It better to validate uid info which is from userspace.

Signed-off-by: Chengguang Xu <cgxu519@gmx.com>
---
 block/ioprio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/block/ioprio.c b/block/ioprio.c
index f9821080c92c..b59397662da6 100644
--- a/block/ioprio.c
+++ b/block/ioprio.c
@@ -218,6 +218,8 @@ SYSCALL_DEFINE2(ioprio_get, int, which, int, who)
 			break;
 		case IOPRIO_WHO_USER:
 			uid = make_kuid(current_user_ns(), who);
+			if (!uid_valid(uid))
+				break;
 			if (!who)
 				user = current_user();
 			else
-- 
2.17.2


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-01-01 13:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-01 13:35 [PATCH] block: add sanity check for uid in syscall of ioprio_get() Chengguang Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).