cache: make sure the user has specified a callback
In cache_include(), the user callback is used even though one might not have been specified, leading to a crash. This happens, for example, when NetworkManager calls nl_cache_include() with the change_cb argument set to NULL. Fix it by making sure the callback points to a valid address. Signed-off-by: Mihai Dontu <mihai.dontu@gmail.com> Signed-off-by: Thomas Graf <tgraf@suug.ch>
This commit is contained in:
parent
00a5879e6e
commit
ba38f39198
1 changed files with 2 additions and 1 deletions
|
@ -752,7 +752,8 @@ static int cache_include(struct nl_cache *cache, struct nl_object *obj,
|
|||
* Handle them first.
|
||||
*/
|
||||
if (nl_object_update(old, obj) == 0) {
|
||||
cb(cache, old, NL_ACT_CHANGE, data);
|
||||
if (cb)
|
||||
cb(cache, old, NL_ACT_CHANGE, data);
|
||||
nl_object_put(old);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue