• John Garry's avatar
    bus: hisi_lpc: Unregister logical PIO range to avoid potential use-after-free · 1b15a563
    John Garry authored
    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: adf38bb0 ("HISI LPC: Support the LPC host on Hip06/Hip07 with DT bindings")
    Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
    Signed-off-by: default avatarWei Xu <xuwei5@hisilicon.com>
    1b15a563
hisi_lpc.c 16.7 KB