]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - drivers/clk/clk.c
clk: check ops pointer on clock register
authorJerome Brunet <jbrunet@baylibre.com>
Tue, 19 Dec 2017 08:33:29 +0000 (09:33 +0100)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Mon, 26 Mar 2018 12:16:28 +0000 (09:16 -0300)
commit0690e62baf448163a161af41e5ca5094e6675572
treed84ebb8fe86f024262547037f733f78b4330c86c
parentfd7de34f76b84039e414cd1e9598da867297fbe0
clk: check ops pointer on clock register

BugLink: http://bugs.launchpad.net/bugs/1758886
[ Upstream commit 29fd2a34ef8d863e48183bd473ba57c8d7839e25 ]

Nothing really prevents a provider from (trying to) register a clock
without providing the clock ops structure.

We do check the individual fields before using them, but not the
structure pointer itself. This may have the usual nasty consequences when
the pointer is dereferenced, most likely when checking one the field
during the initialization.

This is fixed by returning an error on clock register if the ops pointer
is NULL.

Signed-off-by: Jerome Brunet <jbrunet@baylibre.com>
Signed-off-by: Michael Turquette <mturquette@baylibre.com>
Link: lkml.kernel.org/r/20171219083329.24746-1-jbrunet@baylibre.com
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
drivers/clk/clk.c