summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorSven Eckelmann <sven@narfation.org>2021-08-08 20:56:17 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-04-08 15:40:42 +0300
commit73f7cbb15191298ec58c0bee3202690d54aa72de (patch)
treef5d11cdac984286634fdbebb2d8d550a12cce230 /mm
parentf6da750bfaf40816139c073227df30ad0a11158e (diff)
downloadlinux-73f7cbb15191298ec58c0bee3202690d54aa72de.tar.xz
batman-adv: Check ptr for NULL before reducing its refcnt
commit 6340dcbd619450c1bb55eb999e554e4f0e6dab0a upstream. The commit b37a46683739 ("netdevice: add the case if dev is NULL") changed the way how the NULL check for net_devices have to be handled when trying to reduce its reference counter. Before this commit, it was the responsibility of the caller to check whether the object is NULL or not. But it was changed to behave more like kfree. Now the callee has to handle the NULL-case. The batman-adv code was scanned via cocinelle for similar places. These were changed to use the paradigm @@ identifier E, T, R, C; identifier put; @@ void put(struct T *E) { + if (!E) + return; kref_put(&E->C, R); } Functions which were used in other sources files were moved to the header to allow the compiler to inline the NULL check and the kref_put call. Signed-off-by: Sven Eckelmann <sven@narfation.org> Signed-off-by: Simon Wunderlich <sw@simonwunderlich.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm')
0 files changed, 0 insertions, 0 deletions