diff options
author | ylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68> | 2022-01-07 16:05:27 +0000 |
---|---|---|
committer | ylavic <ylavic@13f79535-47bb-0310-9956-ffa450edef68> | 2022-01-07 16:05:27 +0000 |
commit | 7edf721d836e53c598c145e13aaaa5e528ca1fd4 (patch) | |
tree | efbf905c4ab3e8316a47a7f81c43037abbbafb9e | |
parent | 3d52c895b8d99bbf8fdedd0a12db5b52cb5a12b6 (diff) | |
download | libapr-7edf721d836e53c598c145e13aaaa5e528ca1fd4.tar.gz |
apr_buckets_file: Always use the given pool for FILE buckets set aside.
Using an ancestor pool might race if the bucket is reopened (XTHREAD) or
mmap()ed later in file_bucket_read(), while there is nothing wrong with
both the bucket and the file having the given/same lifetime.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@1896812 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r-- | buckets/apr_buckets_file.c | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/buckets/apr_buckets_file.c b/buckets/apr_buckets_file.c index be0bda0d8..f0eab5a18 100644 --- a/buckets/apr_buckets_file.c +++ b/buckets/apr_buckets_file.c @@ -239,18 +239,15 @@ static apr_status_t file_bucket_setaside(apr_bucket *b, apr_pool_t *reqpool) new = apr_bucket_alloc(sizeof(*new), b->list); memcpy(new, a, sizeof(*new)); new->refcount.refcount = 1; - new->readpool = reqpool; a->refcount.refcount--; a = b->data = new; } else { apr_file_setaside(&fd, f, reqpool); - if (!apr_pool_is_ancestor(a->readpool, reqpool)) { - a->readpool = reqpool; - } } a->fd = fd; + a->readpool = reqpool; return APR_SUCCESS; } |