On 8/6/20 7:38 AM, Stefano Garzarella wrote: > On Thu, Aug 06, 2020 at 07:21:30AM -0600, Jens Axboe wrote: >> On 8/6/20 1:42 AM, Stefano Garzarella wrote: >>> On Wed, Aug 05, 2020 at 01:02:24PM -0600, Jens Axboe wrote: >>>> The tear down path will always unaccount the memory, so ensure that we >>>> have accounted it before hitting any of them. >>>> >>>> Signed-off-by: Jens Axboe <axboe@xxxxxxxxx> >>>> --- >>>> fs/io_uring.c | 16 ++++++++-------- >>>> 1 file changed, 8 insertions(+), 8 deletions(-) >>>> >>>> diff --git a/fs/io_uring.c b/fs/io_uring.c >>>> index 0d857f7ca507..7c42f63fbb0a 100644 >>>> --- a/fs/io_uring.c >>>> +++ b/fs/io_uring.c >>>> @@ -8341,6 +8341,14 @@ static int io_uring_create(unsigned entries, struct io_uring_params *p, >>>> ctx->user = user; >>>> ctx->creds = get_current_cred(); >>>> >>>> + /* >>>> + * Account memory _before_ installing the file descriptor. Once >>>> + * the descriptor is installed, it can get closed at any time. >>>> + */ >>> >>> What about update a bit the comment? >>> Maybe adding the commit description in this comment. >> >> I updated the comment: >> >> /* >> * Account memory _before_ installing the file descriptor. Once >> * the descriptor is installed, it can get closed at any time. Also >> * do this before hitting the general error path, as ring freeing >> * will un-account as well. >> */ > > Now it looks better! > > Reviewed-by: Stefano Garzarella <sgarzare@xxxxxxxxxx> Thanks, added. -- Jens Axboe