Re: [PATCH 1/2] io_uring: fix UAF for personality_idr

From
Stefan Metzmacher <metze@samba.org>
Date
2021-03-08 13:58:51
Reply to
Matthew Wilcox, 2021-03-08
Hi Matthew,
quoted hunk ↗ jump to hunk
-	ret = idr_alloc_cyclic(&ctx->personality_idr, (void *) creds, 1,
-				USHRT_MAX, GFP_KERNEL);
-	if (ret < 0)
-		put_cred(creds);
+	ret = xa_alloc_cyclic(&ctx->personalities, &id, (void *)creds,
+			XA_LIMIT(0, USHRT_MAX), &ctx->pers_next, GFP_KERNEL);
+	if (!ret)
+		return id;
+	put_cred(creds);
 	return ret;
I guess this should be XA_LIMIT(1, USHRT_MAX) instead?
'0' should not be a valid id.

metze
Thread (8 messages) 8 messages, 4 authors, last reply 2021-03-08
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help