[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-aio
Subject: Re: [patch] aio: lookup_ioctx can return the wrong value when looking
From: Zach Brown <zach.brown () oracle ! com>
Date: 2009-03-18 22:28:24
Message-ID: 49C17588.4080101 () oracle ! com
[Download RAW message or body]
>> Thanks to Zach for pointing out that hlist_for_each_entry_rcu will not
>> return with a NULL tpos at the end of the loop, even if the entry was
>> not found.
>> diff --git a/fs/aio.c b/fs/aio.c
>> index 8fa77e2..07c44f0 100644
>> --- a/fs/aio.c
>> +++ b/fs/aio.c
>> @@ -571,7 +571,7 @@ int aio_put_req(struct kiocb *req)
>> static struct kioctx *lookup_ioctx(unsigned long ctx_id)
>> {
>> struct mm_struct *mm = current->mm;
>> - struct kioctx *ctx = NULL;
>> + struct kioctx *ctx, *ret = NULL;
>> struct hlist_node *n;
>>
>> rcu_read_lock();
>> @@ -579,12 +579,13 @@ static struct kioctx *lookup_ioctx(unsigned long ctx_id)
>> hlist_for_each_entry_rcu(ctx, n, &mm->ioctx_list, list) {
>> if (ctx->user_id == ctx_id && !ctx->dead) {
>> get_ioctx(ctx);
>> + ret = ctx;
>> break;
>> }
>> }
>>
>> rcu_read_unlock();
>> - return ctx;
>> + return ret;
>> }
>>
>> /*
>
> Thanks. I added your signed-off-by: to this commit.
Feel free to add my ack, too:
Acked-By: Zach Brown <zach.brown@oracle.com>
- z
--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to majordomo@kvack.org. For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic