lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1670145780-13111-2-git-send-email-quic_jprakash@quicinc.com>
Date:   Sun, 4 Dec 2022 14:53:00 +0530
From:   Jishnu Prakash <quic_jprakash@...cinc.com>
To:     <agross@...nel.org>, <bjorn.andersson@...aro.org>,
        <devicetree@...r.kernel.org>, <robh+dt@...nel.org>,
        <linus.walleij@...aro.org>, <quic_kamalw@...cinc.com>,
        <quic_jestar@...cinc.com>, <sboyd@...nel.org>,
        <quic_subbaram@...cinc.com>, <quic_collinsd@...cinc.com>,
        <linux-kernel@...r.kernel.org>
CC:     <linux-arm-msm@...r.kernel.org>,
        <linux-arm-msm-owner@...r.kernel.org>,
        Jishnu Prakash <quic_jprakash@...cinc.com>
Subject: [PATCH] spmi: Add check for remove callback in spmi_drv_remove API

Add a check for remove callback presence before calling it for a
spmi driver, to avoid NULL pointer dereference error if remove callback
has not been specified for that SPMI driver.

Signed-off-by: Jishnu Prakash <quic_jprakash@...cinc.com>
---
 drivers/spmi/spmi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/spmi/spmi.c b/drivers/spmi/spmi.c
index a456ce5..6b34356 100644
--- a/drivers/spmi/spmi.c
+++ b/drivers/spmi/spmi.c
@@ -350,7 +350,8 @@ static void spmi_drv_remove(struct device *dev)
 	const struct spmi_driver *sdrv = to_spmi_driver(dev->driver);
 
 	pm_runtime_get_sync(dev);
-	sdrv->remove(to_spmi_device(dev));
+	if (sdrv->remove)
+		sdrv->remove(to_spmi_device(dev));
 	pm_runtime_put_noidle(dev);
 
 	pm_runtime_disable(dev);
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ