In gb_bootrom_get_firmware(), the 'fw' pointer could be NULL if the
function jumps to the 'unlock' label. The execution flow continues
into the 'queue_work' block where 'fw->size' is accessed, leading to
a null pointer dereference.
Fix this by adding a NULL check for 'fw' before accessing its members.
Signed-off-by: Oarora Etimis <OaroraEtimis(a)gmail.com>
---
drivers/staging/greybus/bootrom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/greybus/bootrom.c b/drivers/staging/greybus/bootrom.c
index 83921d90c322..50c80475d241 100644
--- a/drivers/staging/greybus/bootrom.c
+++ b/drivers/staging/greybus/bootrom.c
@@ -298,7 +298,7 @@ static int gb_bootrom_get_firmware(struct gb_operation *op)
queue_work:
/* Refresh timeout */
- if (!ret && (offset + size == fw->size))
+ if (!ret && fw && (offset + size == fw->size))
next_request = NEXT_REQ_READY_TO_BOOT;
else
next_request = NEXT_REQ_GET_FIRMWARE;
--
2.47.3
In gb_bootrom_get_firmware(), the 'fw' pointer could be NULL if the
function jumps to the 'unlock' label. The execution flow continues
into the 'queue_work' block where 'fw->size' is accessed, leading to
a null pointer dereference.
Fix this by adding a NULL check for 'fw' before accessing its members.
Signed-off-by: Oarora Etimis <OaroraEtimis(a)gmail.com>
---
Changes in v2:
- Rebased onto the latest staging-next branch to resolve merge conflicts.
- No logical code changes.
drivers/staging/greybus/bootrom.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/greybus/bootrom.c b/drivers/staging/greybus/bootrom.c
index 83921d90c322..50c80475d241 100644
--- a/drivers/staging/greybus/bootrom.c
+++ b/drivers/staging/greybus/bootrom.c
@@ -298,7 +298,7 @@ static int gb_bootrom_get_firmware(struct gb_operation *op)
queue_work:
/* Refresh timeout */
- if (!ret && (offset + size == fw->size))
+ if (!ret && fw && (offset + size == fw->size))
next_request = NEXT_REQ_READY_TO_BOOT;
else
next_request = NEXT_REQ_GET_FIRMWARE;
--
2.47.3
The gb_dev_loopback_ro_attr macro accepted a 'conn' argument which
was never used in its expansion. Remove it from both the macro
definition and its invocation.
Signed-off-by: Giacomo Di Clerico <giacomodiclerico(a)gmail.com>
---
drivers/staging/greybus/loopback.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/greybus/loopback.c b/drivers/staging/greybus/loopback.c
index aa9c73cb0ae5..855d5051c55d 100644
--- a/drivers/staging/greybus/loopback.c
+++ b/drivers/staging/greybus/loopback.c
@@ -193,7 +193,7 @@ static ssize_t field##_store(struct device *dev, \
} \
static DEVICE_ATTR_RW(field)
-#define gb_dev_loopback_ro_attr(field, conn) \
+#define gb_dev_loopback_ro_attr(field) \
static ssize_t field##_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
@@ -305,7 +305,7 @@ gb_dev_loopback_rw_attr(us_wait, d);
/* Maximum iterations for a given operation: 1-(2^32-1), 0 implies infinite */
gb_dev_loopback_rw_attr(iteration_max, u);
/* The current index of the for (i = 0; i < iteration_max; i++) loop */
-gb_dev_loopback_ro_attr(iteration_count, false);
+gb_dev_loopback_ro_attr(iteration_count);
/* A flag to indicate synchronous or asynchronous operations */
gb_dev_loopback_rw_attr(async, u);
/* Timeout of an individual asynchronous request */
--
2.53.0
From: Markus Elfring <elfring(a)users.sourceforge.net>
Date: Sat, 14 Mar 2026 16:00:20 +0100
The device's last busy timestamp was set in a wrapper function since
the commit 18c1fe53d186867243f4cf17f4eef60737a16c4c ("PM: runtime:
Mark last busy stamp in pm_request_autosuspend()").
Thus delete a pm_runtime_mark_last_busy() call before
two pm_request_autosuspend() calls.
The source code was transformed by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring(a)users.sourceforge.net>
---
drivers/greybus/bundle.c | 1 -
drivers/greybus/interface.c | 1 -
2 files changed, 2 deletions(-)
diff --git a/drivers/greybus/bundle.c b/drivers/greybus/bundle.c
index d1831d0986e9..d8d8e9ba7869 100644
--- a/drivers/greybus/bundle.c
+++ b/drivers/greybus/bundle.c
@@ -155,7 +155,6 @@ static int gb_bundle_resume(struct device *dev)
static int gb_bundle_idle(struct device *dev)
{
- pm_runtime_mark_last_busy(dev);
pm_request_autosuspend(dev);
return 0;
diff --git a/drivers/greybus/interface.c b/drivers/greybus/interface.c
index 4ee4bda4a267..ed56f90369d1 100644
--- a/drivers/greybus/interface.c
+++ b/drivers/greybus/interface.c
@@ -753,7 +753,6 @@ static int gb_interface_resume(struct device *dev)
static int gb_interface_runtime_idle(struct device *dev)
{
- pm_runtime_mark_last_busy(dev);
pm_request_autosuspend(dev);
return 0;
--
2.53.0
From: Markus Elfring <elfring(a)users.sourceforge.net>
Date: Sat, 14 Mar 2026 15:35:09 +0100
The device's last busy timestamp was set in a wrapper function since
the commit 18c1fe53d186867243f4cf17f4eef60737a16c4c ("PM: runtime:
Mark last busy stamp in pm_request_autosuspend()").
Thus delete a pm_runtime_mark_last_busy() call before
a pm_request_autosuspend() call.
The source code was transformed by using the Coccinelle software.
Signed-off-by: Markus Elfring <elfring(a)users.sourceforge.net>
---
drivers/staging/greybus/gbphy.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/drivers/staging/greybus/gbphy.c b/drivers/staging/greybus/gbphy.c
index bdb0f5164a6f..949656e75e8b 100644
--- a/drivers/staging/greybus/gbphy.c
+++ b/drivers/staging/greybus/gbphy.c
@@ -53,7 +53,6 @@ static void gbphy_dev_release(struct device *dev)
#ifdef CONFIG_PM
static int gb_gbphy_idle(struct device *dev)
{
- pm_runtime_mark_last_busy(dev);
pm_request_autosuspend(dev);
return 0;
}
--
2.53.0