diff options
| author | Maxim Dounin <mdounin@mdounin.ru> | 2012-11-13 11:24:14 +0000 |
|---|---|---|
| committer | Maxim Dounin <mdounin@mdounin.ru> | 2012-11-13 11:24:14 +0000 |
| commit | 13cda62555b28dd1afb927705eeff0c5f66cdbaf (patch) | |
| tree | 2759f5ccd171607a9b8ef3be7d526c62eb66921e /src/http/ngx_http_upstream.c | |
| parent | 1954cf149aa79ba2bb1ce0b7b20422ab2ca6c93a (diff) | |
| download | nginx-13cda62555b28dd1afb927705eeff0c5f66cdbaf.tar.gz nginx-13cda62555b28dd1afb927705eeff0c5f66cdbaf.tar.bz2 | |
Merge of r4896: event pipe: fixed handling of buf_to_file data.
Input filter might free a buffer if there is no data in it, and in case
of first buffer (used for cache header and request header, aka p->buf_to_file)
this resulted in cache corruption. Buffer memory was reused to read upstream
response before headers were written to disk.
Fix is to avoid moving pointers in ngx_event_pipe_add_free_buf() to a buffer
start if we were asked to free a buffer used by p->buf_to_file.
This fixes occasional cache file corruption, usually resulted
in "cache file ... has md5 collision" alerts.
Reported by Anatoli Marinov.
Diffstat (limited to 'src/http/ngx_http_upstream.c')
| -rw-r--r-- | src/http/ngx_http_upstream.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c index 6c34f39d6..75ef64e55 100644 --- a/src/http/ngx_http_upstream.c +++ b/src/http/ngx_http_upstream.c @@ -2287,6 +2287,7 @@ ngx_http_upstream_send_response(ngx_http_request_t *r, ngx_http_upstream_t *u) return; } + p->buf_to_file->start = u->buffer.start; p->buf_to_file->pos = u->buffer.start; p->buf_to_file->last = u->buffer.pos; p->buf_to_file->temporary = 1; |
