public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring: fix invalid error check after malloc
@ 2021-04-25 23:16 Pavel Begunkov
  2021-04-26 12:52 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2021-04-25 23:16 UTC (permalink / raw)
  To: Jens Axboe, io-uring; +Cc: kernel test robot

Now we allocate io_mapped_ubuf instead of bvec, so we clearly have to
check its address after allocation.

Fixes: 41edf1a5ec967 ("io_uring: keep table of pointers to ubufs")
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Pavel Begunkov <[email protected]>
---

Would be great if folded in

 fs/io_uring.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 1cdc9b7c5c8c..261279f56838 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -8265,7 +8265,7 @@ static int io_sqe_buffer_register(struct io_ring_ctx *ctx, struct iovec *iov,
 		goto done;
 
 	imu = kvmalloc(struct_size(imu, bvec, nr_pages), GFP_KERNEL);
-	if (!imu->bvec)
+	if (!imu)
 		goto done;
 
 	ret = 0;
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-26 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-25 23:16 [PATCH] io_uring: fix invalid error check after malloc Pavel Begunkov
2021-04-26 12:52 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox