All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Markus Probst" <markus.probst@posteo.de>
Cc: robh@kernel.org, devicetree@vger.kernel.org, lee@kernel.org,
	linux-leds@vger.kernel.org, conor+dt@kernel.org,
	ojeda@kernel.org
Subject: Re: [PATCH v15 2/2] platform: Add initial synology microp driver
Date: Mon, 29 Jun 2026 14:41:05 +0000	[thread overview]
Message-ID: <20260629144105.91F581F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260629-synology_microp_initial-v15-2-4b3d7367c7cf@posteo.de>

Thank you for your contribution! Sashiko AI review found 5 potential issue(s) to consider:
- [High] The Kconfig symbol `SYNOLOGY_MICROP` depends on a non-existent symbol `RUST_SERIAL_DEV_BUS_ABSTRACTIONS`.
- [High] The driver is compiled but not linked into a loadable module when configured as `CONFIG_SYNOLOGY_MICROP=m`.
- [High] The `alert` LED's name string is allocated as a local variable and dropped before the LED device finishes its lifetime, causing a Use-After-Free.
- [High] The `power_name` string is dropped before the `power` LED device, creating a dangling pointer during teardown.
- [Medium] Writing a solid brightness value fails to disable hardware blinking.
--

commit 9541fa00c8f64528a8c6eb20d425f6bc2c90bf38
Author: Markus Probst <markus.probst@posteo.de>

platform: Add initial synology microp driver

This patch adds an initial Rust-based driver for the microcontroller found
in Synology NAS devices. It currently supports controlling the power, status,
alert, and USB LEDs.

> diff --git a/drivers/platform/synology_microp/Kconfig b/drivers/platform/synology_microp/Kconfig
> new file mode 100644
> --- /dev/null
> +++ b/drivers/platform/synology_microp/Kconfig
[ ... ]
> @@ -0,0 +1,13 @@
> +# SPDX-License-Identifier: GPL-2.0
> +
> +config SYNOLOGY_MICROP
> +	tristate "Synology Microp driver"
> +	depends on LEDS_CLASS && LEDS_CLASS_MULTICOLOR
> +	depends on RUST_SERIAL_DEV_BUS_ABSTRACTIONS

[Severity: High]
Does RUST_SERIAL_DEV_BUS_ABSTRACTIONS exist in the kernel tree? If not, this
driver cannot be enabled under any configuration and becomes dead code.

> diff --git a/drivers/platform/synology_microp/Makefile b/drivers/platform/synology_microp/Makefile
> new file mode 100644
> --- /dev/null
> +++ b/drivers/platform/synology_microp/Makefile
> @@ -0,0 +1,3 @@
> +# SPDX-License-Identifier: GPL-2.0
> +
> +obj-y += synology_microp.o

[Severity: High]
If the driver is configured as a loadable module (CONFIG_SYNOLOGY_MICROP=m),
will this obj-y assignment compile the objects into a built-in archive
instead of linking them into a .ko module?

> diff --git a/drivers/platform/synology_microp/led.rs b/drivers/platform/synology_microp/led.rs
> new file mode 100644
> --- /dev/null
> +++ b/drivers/platform/synology_microp/led.rs
[ ... ]
> @@ -21,11 +21,18 @@ use crate::{
>  
>  #[pin_data]
>  pub(crate) struct Data<'bound> {
>      #[pin]
>      status: led::MultiColorDevice<'bound, StatusLedHandler>,
>      power_name: CString,
>      #[pin]
>      power: led::Device<'bound, LedHandler>,

[Severity: High]
In Rust, struct fields are dropped top-to-bottom. Could power_name be freed
before the power LED device is unregistered? This might leave a dangling
pointer during driver teardown if the LED subsystem accesses the freed name.

[ ... ]
> @@ -71,21 +78,21 @@ impl<'bound> Data<'bound> {
>                  alert: {
>                      if let Some(color) = model.led_alert {
>                          let name = CString::try_from_fmt(fmt!(
>                              "synology:{}:alarm",
>                              color.as_c_str().to_str()?
>                          ))?;
>                          Some(KBox::pin_init(
>                              led::DeviceBuilder::new().color(color).name(&name).build(
>                                  dev,

[Severity: High]
Does passing a reference to the local name string here cause a use-after-free?

The name variable is dropped at the end of the if let block, but the kernel
LED core may retain and access the pointer after probing finishes.

[ ... ]
> @@ -167,23 +174,23 @@ impl LedOps for LedHandler {
>      fn brightness_set<'bound>(
>          &self,
>          dev: &'bound Self::Bus,
>          _classdev: &led::Device<'bound, Self>,
>          brightness: u32,
>      ) -> Result<()> {
>          let mut blink = self.blink.lock();
>          (self.command)(if brightness == 0 {
>              *blink = false;
>              State::Off
>          } else if *blink {
>              State::Blink
>          } else {
>              State::On
>          })

[Severity: Medium]
When a solid brightness (>0) is requested via sysfs, this logic preserves
the hardware blinking state. Does this violate the LED subsystem API, which
expects setting brightness to disable hardware blinking?

[ ... ]
> @@ -240,23 +247,23 @@ impl LedOps for StatusLedHandler {
>      fn brightness_set<'bound>(
>          &self,
>          dev: &'bound Self::Bus,
>          classdev: &led::MultiColorDevice<'bound, Self>,
>          brightness: u32,
>      ) -> Result<()> {
[ ... ]
>          Command::StatusLed(
>              color,
>              if subled_brightness == 0 {
>                  State::Off
>              } else if *blink {
>                  State::Blink
>              } else {
>                  State::On
>              },
>          )

[Severity: Medium]
Similarly to LedHandler, does this fail to clear the blink state when
subled_brightness > 0?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260629-synology_microp_initial-v15-0-4b3d7367c7cf@posteo.de?part=2

      reply	other threads:[~2026-06-29 14:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-29 14:21 [PATCH v15 0/2] Introduce Synology Microp driver Markus Probst
2026-06-29 14:21 ` [PATCH v15 1/2] dt-bindings: embedded-controller: Add synology microp devices Markus Probst
2026-06-29 14:26   ` sashiko-bot
2026-06-29 14:21 ` [PATCH v15 2/2] platform: Add initial synology microp driver Markus Probst
2026-06-29 14:41   ` sashiko-bot [this message]

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=20260629144105.91F581F000E9@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=lee@kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=markus.probst@posteo.de \
    --cc=ojeda@kernel.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.