]> git.ipfire.org Git - thirdparty/kernel/stable.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Sep 2019 08:23:47 +0000 (10:23 +0200)
commit0a6caa4e3f21032cc98812db307386f462698269
treeafb6f19ff22dcb6f034167bdb48c4fffb906d086
parent3e3bf9dfdaf4e3c5c00faa77bf5feac64ca4a860
bus: hisi_lpc: Unregister logical PIO range to avoid potential use-after-free

commit 1b15a5632a809ab57d403fd972ca68785363b654 upstream.

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: adf38bb0b595 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/bus/hisi_lpc.c