Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Loic Poulain" <loic.poulain@oss.qualcomm.com>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v7 5/9] block: implement NVMEM provider
Date: Thu, 02 Jul 2026 16:01:25 +0000	[thread overview]
Message-ID: <20260702160125.7BA2D1F00A3A@smtp.kernel.org> (raw)
In-Reply-To: <20260701-block-as-nvmem-v7-5-3fe8205ef0a8@oss.qualcomm.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Unhandled error pointer leads to kernel crash during device teardown.
--

Note: The format of this review is altered to provide a free-form summary of
the findings rather than inline patch quotes, due to code recitation
restrictions.

commit 14d86ba6622184a8e17868cd135ba0bd9e1e05b2
Author: Daniel Golle <daniel@makrotopia.org>
Subject: block: implement NVMEM provider

This patch allows block devices or partitions to act as NVMEM providers.
It registers an NVMEM device based on the block device's OF node layout.
It hooks into the disk addition and deletion paths to register and
unregister the NVMEM device.

[Severity: High]
In block/blk-nvmem.c:blk_nvmem_add(), if nvmem_register() fails, it returns an
error pointer which is directly assigned to bdev->bd_nvmem. The function
then returns the error code via dev_err_probe() but leaves bdev->bd_nvmem
holding the error pointer instead of resetting it to NULL.

Since add_disk_final() in block/genhd.c calls blk_nvmem_add() without
checking its return value, the disk is successfully added even if the NVMEM
registration fails.

Later, when the disk is removed, __del_gendisk() calls blk_nvmem_del(),
which passes bdev->bd_nvmem to nvmem_unregister(). Because
nvmem_unregister() only checks if the pointer is NULL and not if it is an
error pointer, won't this result in a kernel panic when it attempts to
dereference the invalid error pointer?

Could this be avoided by explicitly setting bdev->bd_nvmem to NULL on the
failure path inside blk_nvmem_add() before returning?

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260701-block-as-nvmem-v7-0-3fe8205ef0a8@oss.qualcomm.com?part=5

  reply	other threads:[~2026-07-02 16:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-01 16:00 [PATCH v7 0/9] Support for block device NVMEM providers Loic Poulain
2026-07-01 16:00 ` [PATCH v7 1/9] dt-bindings: mmc: Document fixed-layout NVMEM provider support Loic Poulain
2026-07-01 16:00 ` [PATCH v7 2/9] dt-bindings: net: wireless: qcom,ath10k: Document NVMEM cells Loic Poulain
2026-07-01 16:00 ` [PATCH v7 3/9] dt-bindings: bluetooth: qcom: Add NVMEM BD address cell Loic Poulain
2026-07-01 16:00 ` [PATCH v7 4/9] nvmem: layouts: Support fixed-layout as the nvmem device node itself Loic Poulain
2026-07-01 16:00 ` [PATCH v7 5/9] block: implement NVMEM provider Loic Poulain
2026-07-02 16:01   ` sashiko-bot [this message]
2026-07-01 16:00 ` [PATCH v7 6/9] net: of_net: Add of_get_nvmem_eui48() helper for EUI-48 lookup Loic Poulain
2026-07-02 16:01   ` sashiko-bot
2026-07-01 16:00 ` [PATCH v7 7/9] Bluetooth: hci_sync: Add NVMEM-backed BD address retrieval Loic Poulain
2026-07-02 16:01   ` sashiko-bot
2026-07-01 16:00 ` [PATCH v7 8/9] Bluetooth: qca: Set NVMEM BD address quirks when address is invalid Loic Poulain
2026-07-02 16:01   ` sashiko-bot
2026-07-01 16:00 ` [PATCH v7 9/9] arm64: dts: qcom: arduino-imola: Describe NVMEM layout for WiFi/BT addresses Loic Poulain

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=20260702160125.7BA2D1F00A3A@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=loic.poulain@oss.qualcomm.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox