]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
rapidio: add check for rio_add_net() in rio_scan_alloc_net()
authorHaoxiang Li <haoxiang_li2024@163.com>
Thu, 27 Feb 2025 04:11:31 +0000 (12:11 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:51:03 +0000 (12:51 +0100)
commit181d4daaefb3bceeb2f2635ba9f3781eeda9e550
tree7ea147610c0d28559140cb9db84a26f3972f62b7
parentcd1bdcb77fdc03c253137e55bae10551b3481461
rapidio: add check for rio_add_net() in rio_scan_alloc_net()

commit e842f9a1edf306bf36fe2a4d847a0b0d458770de upstream.

The return value of rio_add_net() should be checked.  If it fails,
put_device() should be called to free the memory and give up the reference
initialized in rio_add_net().

Link: https://lkml.kernel.org/r/20250227041131.3680761-1-haoxiang_li2024@163.com
Fixes: e6b585ca6e81 ("rapidio: move net allocation into core code")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
Cc: Alexandre Bounine <alex.bou9@gmail.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Dan Carpenter <dan.carpenter@linaro.org>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/rapidio/rio-scan.c