]> git.baikalelectronics.ru Git - kernel.git/commit
bus: hisi_lpc: Unregister logical PIO range to avoid potential use-after-free
authorJohn Garry <john.garry@huawei.com>
Tue, 30 Jul 2019 13:29:55 +0000 (21:29 +0800)
committerWei Xu <xuwei5@hisilicon.com>
Tue, 13 Aug 2019 06:54:28 +0000 (14:54 +0800)
commit0887926326c6c9713798ec5d40e901def6d630e6
tree375b953135e98f173555d13711187bf123c62cd1
parentd402ea9bb68da8827fecf93350de1de5648b7db2
bus: hisi_lpc: Unregister logical PIO range to avoid potential use-after-free

If, after registering a logical PIO range, the driver probe later fails,
the logical PIO range memory will be released automatically.

This causes an issue, in that the logical PIO range is not unregistered
and the released range memory may be later referenced.

Fix by unregistering the logical PIO range.

And since we now unregister the logical PIO range for probe failure, avoid
the special ordering of setting logical PIO range ops, which was the
previous (poor) attempt at a safeguard against this.

Cc: stable@vger.kernel.org
Fixes: 84d09107bf2f ("HISI LPC: Support the LPC host on Hip06/Hip07 with DT bindings")
Signed-off-by: John Garry <john.garry@huawei.com>
Signed-off-by: Wei Xu <xuwei5@hisilicon.com>
drivers/bus/hisi_lpc.c