You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@apr.apache.org by yl...@apache.org on 2022/01/07 16:05:27 UTC

svn commit: r1896812 - /apr/apr/trunk/buckets/apr_buckets_file.c

Author: ylavic
Date: Fri Jan  7 16:05:27 2022
New Revision: 1896812

URL: http://svn.apache.org/viewvc?rev=1896812&view=rev
Log:
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.


Modified:
    apr/apr/trunk/buckets/apr_buckets_file.c

Modified: apr/apr/trunk/buckets/apr_buckets_file.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/buckets/apr_buckets_file.c?rev=1896812&r1=1896811&r2=1896812&view=diff
==============================================================================
--- apr/apr/trunk/buckets/apr_buckets_file.c (original)
+++ apr/apr/trunk/buckets/apr_buckets_file.c Fri Jan  7 16:05:27 2022
@@ -239,18 +239,15 @@ static apr_status_t file_bucket_setaside
         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;
 }