Fix obexd crash for empty listing invalid cache
PATCH v2 1/1 Fix obexd crash for empty listing invalid cache
This fixes obexd crash in 3-way calling scenario when listing response is empty. Valid cache and empty pbap buffer mean that cache was already attempted to be created within a single session, but no data was available. Hence, it is not notified and no such file error returned. New cache is not created within current obex session or unless path is changed. Such removes necessity of querying and filtering contacts for each incoming call in the other case, which is extensive for large phone books. On the other hand, if user updates contacts, cache will not be renewed till obex session is closed or path is changed. Therefore TODO: note is added that clear of cache should be defined besides of end of session or change of path.
--- plugins/pbap.c | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
plugins/pbap.c +14 -0
@@ -751,6 +751,20 @@ static void *vobject_list_open(const char *name, int oflag, mode_t mode,/* PullvCardListing always get the contacts from the cache */ if (pbap->cache.valid) { +/* +* Valid cache and empty buffer mean that cache was already +* created within a single session, but no data is available. +* New cache will not be created in current obex session or +* unless path is changed. If user updates contacts, cache +* will not be renewed, and, therefore: +* TODO: Define clear cache besides end of session or change +* of path. +*/ +if (!pbap->buffer) { + ret = -ENOENT ; + goto fail; + } +cache_ready_notify (pbap); goto done; }
Signature · 1 line
1.7.0.4
Hi Dmitriy,
Quoted 10 lines · Dmitriy Paliy
This fixes obexd crash in 3-way calling scenario when listing response is empty. Valid cache and empty pbap buffer mean that cache was already attempted to be created within a single session, but no data was available. Hence, it is not notified and no such file error returned. New cache is not created within current obex session or unless path is changed. Such removes necessity of querying and filtering contacts for each incoming call in the other case, which is extensive for large phone books. On the other hand, if user updates contacts, cache will not be renewed till obex session is closed or path is changed. Therefore TODO: note is added that clear of cache should be defined besides of end of session or change of path.
The commit message seems to have a max width of 78 characters which means that it's not viewable with git log on a 80 character terminal (git log indents the output by 4 characters). Please keep the max commit message width to 74 characters or so. Also, if possible try to split it up into multiple paragraphs. Paragraphs longer than 6 lines tend to be a bit harder to follow.
plugins/pbap.c static void *vobject_list_open(const char *name, int oflag, mode_t mode, · line 761
Quoted 2 lines
plugins/pbap.c +2
-0+* TODO: Define clear cache besides end of session or change +* of path.
That doesn't sound like proper english to me and I'm not sure what you're trying to say. Should it be "Define a clear distinction between end of session and change of path"?
Johan
Hi Johan,
Quoted 21 lines · ext Johan Hedberg
Hi Dmitriy,
Quoted 10 lines · Dmitriy Paliy
This fixes obexd crash in 3-way calling scenario when listing response is empty. Valid cache and empty pbap buffer mean that cache was already attempted to be created within a single session, but no data was available. Hence, it is not notified and no such file error returned. New cache is not created within current obex session or unless path is changed. Such removes necessity of querying and filtering contacts for each incoming call in the other case, which is extensive for large phone books. On the other hand, if user updates contacts, cache will not be renewed till obex session is closed or path is changed. Therefore TODO: note is added that clear of cache should be defined besides of end of session or change of path.
The commit message seems to have a max width of 78 characters which means that it's not viewable with git log on a 80 character terminal (git log indents the output by 4 characters). Please keep the max commit message width to 74 characters or so. Also, if possible try to split it up into multiple paragraphs. Paragraphs longer than 6 lines tend to be a bit harder to follow.
Quoted 6 lines
plugins/pbap.c static void *vobject_list_open(const char *name, int oflag, mode_t mode, · line 761
Quoted 2 lines
plugins/pbap.c +2
-0+* TODO: Define clear cache besides end of session or change +* of path. That doesn't sound like proper english to me and I'm not sure what you're trying to say. Should it be "Define a clear distinction between end of session and change of path"?
Thanks for comments. What I meant is following. Cache is created at the moment when there is an incoming call in the middle of another ongoing call. Clear cache and create a new one when the call is retried, which is one of possible solutions to fix this bug, looks inefficient to me. Therefore, already created cache is valid either till session is closed or path is changed. However, if user updates his contacts, then changes will not affect cache within these limits. What I was trying to say in the todo note is that in order to improve logic when cache is created and cleared, besides two facts written above (end of session and change of path), another way to renew cache should be defined.
Br,
Dmitriy