]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
ax25: fix reference count leaks of ax25_dev
authorDuoming Zhou <duoming@zju.edu.cn>
Fri, 15 Apr 2022 16:14:16 +0000 (19:14 +0300)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 12:42:40 +0000 (14:42 +0200)
commitfa3d438dde4819d75548ba4991fc0572e2887987
tree8bce029006b50296baed9d873daf5a6f359ea8f5
parent6f59a3483ec0e935e4551609245077465f3185b9
ax25: fix reference count leaks of ax25_dev

BugLink: https://bugs.launchpad.net/bugs/1969857
commit 87563a043cef044fed5db7967a75741cc16ad2b1 upstream.

The previous commit d01ffb9eee4a ("ax25: add refcount in ax25_dev
to avoid UAF bugs") introduces refcount into ax25_dev, but there
are reference leak paths in ax25_ctl_ioctl(), ax25_fwd_ioctl(),
ax25_rt_add(), ax25_rt_del() and ax25_rt_opt().

This patch uses ax25_dev_put() and adjusts the position of
ax25_addr_ax25dev() to fix reference cout leaks of ax25_dev.

Fixes: d01ffb9eee4a ("ax25: add refcount in ax25_dev to avoid UAF bugs")
Signed-off-by: Duoming Zhou <duoming@zju.edu.cn>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Link: https://lore.kernel.org/r/20220203150811.42256-1-duoming@zju.edu.cn
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
[OP: backport to 5.15: adjust context]
Signed-off-by: Ovidiu Panait <ovidiu.panait@windriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
include/net/ax25.h
net/ax25/af_ax25.c
net/ax25/ax25_dev.c
net/ax25/ax25_route.c