]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
pps: add an error check in parport_attach
authorMa Ke <make24@iscas.ac.cn>
Wed, 28 Aug 2024 13:18:14 +0000 (21:18 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 4 Oct 2024 14:29:58 +0000 (16:29 +0200)
commit73c1928a007617acf6bfd23297440c99aea0cc16
tree06b12522c0d5606c0b63e7218ff1cdb608359d4e
parent8b48ea27185d8ce6c2ccfb2b714e54facfb1c5d9
pps: add an error check in parport_attach

[ Upstream commit 62c5a01a5711c8e4be8ae7b6f0db663094615d48 ]

In parport_attach, the return value of ida_alloc is unchecked, witch leads
to the use of an invalid index value.

To address this issue, index should be checked. When the index value is
abnormal, the device should be freed.

Found by code review, compile tested only.

Cc: stable@vger.kernel.org
Fixes: fb56d97df70e ("pps: client: use new parport device model")
Signed-off-by: Ma Ke <make24@iscas.ac.cn>
Acked-by: Rodolfo Giometti <giometti@enneenne.com>
Link: https://lore.kernel.org/r/20240828131814.3034338-1-make24@iscas.ac.cn
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/pps/clients/pps_parport.c