patches.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: stable@vger.kernel.org
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	patches@lists.linux.dev, Jiasheng Jiang <jiasheng@iscas.ac.cn>,
	AngeloGioacchino Del Regno
	<angelogioacchino.delregno@collabora.com>,
	Stephen Boyd <sboyd@kernel.org>, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 4.19 23/88] clk: mediatek: clk-mt6797: Add check for mtk_alloc_clk_data
Date: Wed, 15 Nov 2023 15:35:35 -0500	[thread overview]
Message-ID: <20231115191427.583675663@linuxfoundation.org> (raw)
In-Reply-To: <20231115191426.221330369@linuxfoundation.org>

4.19-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Jiasheng Jiang <jiasheng@iscas.ac.cn>

[ Upstream commit 606f6366a35a3329545e38129804d65ef26ed7d2 ]

Add the check for the return value of mtk_alloc_clk_data() in order to
avoid NULL pointer dereference.

Fixes: 96596aa06628 ("clk: mediatek: add clk support for MT6797")
Signed-off-by: Jiasheng Jiang <jiasheng@iscas.ac.cn>
Link: https://lore.kernel.org/r/20230912093407.21505-3-jiasheng@iscas.ac.cn
Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
Signed-off-by: Stephen Boyd <sboyd@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/clk/mediatek/clk-mt6797.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/clk/mediatek/clk-mt6797.c b/drivers/clk/mediatek/clk-mt6797.c
index 5702bc974ed99..1ee45f32c1d4e 100644
--- a/drivers/clk/mediatek/clk-mt6797.c
+++ b/drivers/clk/mediatek/clk-mt6797.c
@@ -396,6 +396,8 @@ static int mtk_topckgen_init(struct platform_device *pdev)
 		return PTR_ERR(base);
 
 	clk_data = mtk_alloc_clk_data(CLK_TOP_NR);
+	if (!clk_data)
+		return -ENOMEM;
 
 	mtk_clk_register_factors(top_fixed_divs, ARRAY_SIZE(top_fixed_divs),
 				 clk_data);
@@ -554,6 +556,8 @@ static void mtk_infrasys_init_early(struct device_node *node)
 
 	if (!infra_clk_data) {
 		infra_clk_data = mtk_alloc_clk_data(CLK_INFRA_NR);
+		if (!infra_clk_data)
+			return;
 
 		for (i = 0; i < CLK_INFRA_NR; i++)
 			infra_clk_data->clks[i] = ERR_PTR(-EPROBE_DEFER);
@@ -578,6 +582,8 @@ static int mtk_infrasys_init(struct platform_device *pdev)
 
 	if (!infra_clk_data) {
 		infra_clk_data = mtk_alloc_clk_data(CLK_INFRA_NR);
+		if (!infra_clk_data)
+			return -ENOMEM;
 	} else {
 		for (i = 0; i < CLK_INFRA_NR; i++) {
 			if (infra_clk_data->clks[i] == ERR_PTR(-EPROBE_DEFER))
-- 
2.42.0




  parent reply	other threads:[~2023-11-15 20:45 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-15 20:35 [PATCH 4.19 00/88] 4.19.299-rc1 review Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 01/88] vfs: fix readahead(2) on block devices Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 02/88] genirq/matrix: Exclude managed interrupts in irq_matrix_allocated() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 03/88] i40e: fix potential memory leaks in i40e_remove() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 04/88] tcp_metrics: add missing barriers on delete Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 05/88] tcp_metrics: properly set tp->snd_ssthresh in tcp_init_metrics() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 06/88] tcp_metrics: do not create an entry from tcp_init_metrics() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 07/88] wifi: rtlwifi: fix EDCA limit set by BT coexistence Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 08/88] can: dev: move driver related infrastructure into separate subdir Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 09/88] can: dev: can_restart(): dont crash kernel if carrier is OK Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 10/88] can: dev: can_restart(): fix race condition between controller restart and netif_carrier_on() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 11/88] thermal: core: prevent potential string overflow Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 12/88] chtls: fix tp->rcv_tstamp initialization Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 13/88] ACPI: sysfs: Fix create_pnp_modalias() and create_of_modalias() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 14/88] ipv6: avoid atomic fragment on GSO packets Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 15/88] macsec: Fix traffic counters/statistics Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 16/88] macsec: use DEV_STATS_INC() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 17/88] net: add DEV_STATS_READ() helper Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 18/88] ipvlan: properly track tx_errors Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 19/88] regmap: debugfs: Fix a erroneous check after snprintf() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 20/88] clk: qcom: clk-rcg2: Fix clock rate overflow for high parent frequencies Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 21/88] clk: keystone: pll: fix a couple NULL vs IS_ERR() checks Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 22/88] clk: npcm7xx: Fix incorrect kfree Greg Kroah-Hartman
2023-11-15 20:35 ` Greg Kroah-Hartman [this message]
2023-11-15 20:35 ` [PATCH 4.19 24/88] clk: mediatek: clk-mt2701: Add check for mtk_alloc_clk_data Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 25/88] platform/x86: wmi: Fix probe failure when failing to register WMI devices Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 26/88] platform/x86: wmi: remove unnecessary initializations Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 27/88] platform/x86: wmi: Fix opening of char device Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 28/88] hwmon: (coretemp) Fix potentially truncated sysfs attribute name Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 29/88] drm/rockchip: vop: Fix reset of state in duplicate state crtc funcs Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 30/88] drm/radeon: possible buffer overflow Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 31/88] drm/rockchip: cdn-dp: Fix some error handling paths in cdn_dp_probe() Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 32/88] ARM: dts: qcom: mdm9615: populate vsdcc fixed regulator Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 33/88] firmware: ti_sci: Mark driver as non removable Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 34/88] clk: scmi: Free scmi_clk allocated when the clocks with invalid info are skipped Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 35/88] hwrng: geode - fix accessing registers Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 36/88] sched/rt: Provide migrate_disable/enable() inlines Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 37/88] nd_btt: Make BTT lanes preemptible Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 38/88] HID: cp2112: Use irqchip template Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 39/88] hid: cp2112: Fix duplicate workqueue initialization Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 40/88] ARM: 9321/1: memset: cast the constant byte to unsigned char Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 41/88] ext4: move ix sanity check to corrent position Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 42/88] RDMA/hfi1: Workaround truncation compilation error Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 43/88] sh: bios: Revive earlyprintk support Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 44/88] ASoC: Intel: Skylake: Fix mem leak when parsing UUIDs fails Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 45/88] ASoC: ams-delta.c: use component after check Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 46/88] mfd: dln2: Fix double put in dln2_probe Greg Kroah-Hartman
2023-11-15 20:35 ` [PATCH 4.19 47/88] leds: pwm: simplify if condition Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 48/88] leds: pwm: convert to atomic PWM API Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 49/88] leds: pwm: Dont disable the PWM when the LED should be off Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 50/88] ledtrig-cpu: Limit to 8 CPUs Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 51/88] leds: trigger: ledtrig-cpu:: Fix output may be truncated issue for cpu Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 52/88] tty: tty_jobctrl: fix pid memleak in disassociate_ctty() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 53/88] usb: dwc2: fix possible NULL pointer dereference caused by driver concurrency Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 54/88] dmaengine: ti: edma: handle irq_of_parse_and_map() errors Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 55/88] misc: st_core: Do not call kfree_skb() under spin_lock_irqsave() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 56/88] tools: iio: privatize globals and functions in iio_generic_buffer.c file Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 57/88] tools: iio: iio_generic_buffer: Fix some integer type and calculation Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 58/88] tools: iio: iio_generic_buffer ensure alignment Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 59/88] USB: usbip: fix stub_dev hub disconnect Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 60/88] dmaengine: pxa_dma: Remove an erroneous BUG_ON() in pxad_free_desc() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 61/88] f2fs: fix to initialize map.m_pblk in f2fs_precache_extents() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 62/88] pcmcia: cs: fix possible hung task and memory leak pccardd() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 63/88] pcmcia: ds: fix refcount leak in pcmcia_device_add() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 64/88] pcmcia: ds: fix possible name leak in error path " Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 65/88] media: bttv: fix use after free error due to btv->timeout timer Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 66/88] media: s3c-camif: Avoid inappropriate kfree() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 67/88] media: dvb-usb-v2: af9035: fix missing unlock Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 68/88] pwm: sti: Avoid conditional gotos Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 69/88] pwm: sti: Reduce number of allocations and drop usage of chip_data Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 70/88] pwm: brcmstb: Utilize appropriate clock APIs in suspend/resume Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 71/88] Input: synaptics-rmi4 - fix use after free in rmi_unregister_function() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 72/88] llc: verify mac len before reading mac header Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 73/88] tipc: Change nla_policy for bearer-related names to NLA_NUL_STRING Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 74/88] dccp: Call security_inet_conn_request() after setting IPv4 addresses Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 75/88] dccp/tcp: Call security_inet_conn_request() after setting IPv6 addresses Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 76/88] r8169: improve rtl_set_rx_mode Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 77/88] net: r8169: Disable multicast filter for RTL8168H and RTL8107E Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 78/88] net/smc: postpone release of clcsock Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 79/88] net/smc: wait for pending work before clcsock release_sock Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 80/88] net/smc: fix dangling sock under state SMC_APPFINCLOSEWAIT Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 81/88] tg3: power down device only on SYSTEM_POWER_OFF Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 82/88] r8169: respect userspace disabling IFF_MULTICAST Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 83/88] netfilter: xt_recent: fix (increase) ipv6 literal buffer length Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 84/88] fbdev: imsttfb: Fix error path of imsttfb_probe() Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 85/88] fbdev: imsttfb: fix a resource leak in probe Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 86/88] fbdev: fsl-diu-fb: mark wr_reg_wa() static Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 87/88] Revert "mmc: core: Capture correct oemid-bits for eMMC cards" Greg Kroah-Hartman
2023-11-15 20:36 ` [PATCH 4.19 88/88] btrfs: use u64 for buffer sizes in the tree search ioctls Greg Kroah-Hartman
2023-11-16 11:13 ` [PATCH 4.19 00/88] 4.19.299-rc1 review Naresh Kamboju
2023-11-17  4:24 ` Guenter Roeck
2023-11-17 17:00 ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231115191427.583675663@linuxfoundation.org \
    --to=gregkh@linuxfoundation.org \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=jiasheng@iscas.ac.cn \
    --cc=patches@lists.linux.dev \
    --cc=sashal@kernel.org \
    --cc=sboyd@kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).