All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ciprian Regus via B4 Relay"
	<devnull+ciprian.regus.analog.com@kernel.org>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH net-next v2 03/10] net: ethernet: oa_tc6: add OA_TC6_BROKEN_PHY quirk flag
Date: Sat, 30 May 2026 00:49:15 +0000	[thread overview]
Message-ID: <20260530004915.BE8311F00899@smtp.kernel.org> (raw)
In-Reply-To: <20260527-adin1140-driver-v2-3-37e5c8d4e0a0@analog.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:

Pre-existing issues:
- [High] A use-after-free can occur in `oa_tc6_exit` due to calling `kthread_stop` on a potentially exited SPI thread.
--

commit 2df5842f4d484126d9bd25fecac7f531ed8e5916
Author: Ciprian Regus <ciprian.regus@analog.com>

net: ethernet: oa_tc6: add OA_TC6_BROKEN_PHY quirk flag

This commit adds the OA_TC6_BROKEN_PHY quirk flag, allowing drivers to manage
the PHY manually by skipping oa_tc6's internal PHY initialization. It also
converts oa_tc6_init() to take a configuration structure to avoid extending
the function signature in the future.

> diff --git a/drivers/net/ethernet/oa_tc6.c b/drivers/net/ethernet/oa_tc6.c
> index baba5aad84dfa..7ae3639beaddd 100644
> --- a/drivers/net/ethernet/oa_tc6.c
> +++ b/drivers/net/ethernet/oa_tc6.c
[ ... ]
> @@ -1277,24 +1284,28 @@ static int oa_tc6_check_ctrl_protection(struct oa_tc6 *tc6)
>  
>  /**
>   * oa_tc6_init - allocates and initializes oa_tc6 structure.
> - * @spi: device with which data will be exchanged.
> - * @netdev: network device interface structure.
> + * @config: pointer to a caller-filled structure describing the MACPHY
> + *          (SPI device, net_device, and config flags).
>   *
>   * Return: pointer reference to the oa_tc6 structure if the MAC-PHY
>   * initialization is successful otherwise NULL.
>   */
> -struct oa_tc6 *oa_tc6_init(struct spi_device *spi, struct net_device *netdev)
> +struct oa_tc6 *oa_tc6_init(struct oa_tc6_config *config)
>  {

[Severity: High]
This is a pre-existing issue, but can calling kthread_stop() in oa_tc6_exit()
lead to a use-after-free?

In oa_tc6_spi_thread_handler(), if oa_tc6_try_spi_transfer() returns an
error, the kthread function returns. This causes the kthread to exit and its
task_struct to be automatically freed.

Later, if the driver is unloaded or an error handling path invokes
oa_tc6_exit(), it unconditionally calls kthread_stop(tc6->spi_thread).

Since kthread_run() does not acquire an extra reference for the caller,
could kthread_stop() dereference the freed task_struct, potentially leading
to a kernel panic?

[ ... ]

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260527-adin1140-driver-v2-0-37e5c8d4e0a0@analog.com?part=3

  parent reply	other threads:[~2026-05-30  0:49 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 21:51 [PATCH net-next v2 00/10] net: Add ADIN1140 support Ciprian Regus
2026-05-26 21:51 ` Ciprian Regus via B4 Relay
2026-05-26 21:51 ` [PATCH net-next v2 01/10] dt-bindings: net: Add ADIN1140 Ciprian Regus
2026-05-26 21:51   ` Ciprian Regus via B4 Relay
2026-05-27 15:11   ` Conor Dooley
2026-05-28 16:46     ` Regus, Ciprian
2026-05-28 17:18       ` Conor Dooley
2026-05-26 21:51 ` [PATCH net-next v2 02/10] net: ethernet: oa_tc6: Handle the OA TC6 SPI protected mode Ciprian Regus
2026-05-26 21:51   ` Ciprian Regus via B4 Relay
2026-05-30  0:49   ` sashiko-bot
2026-05-26 21:51 ` [PATCH net-next v2 03/10] net: ethernet: oa_tc6: add OA_TC6_BROKEN_PHY quirk flag Ciprian Regus
2026-05-26 21:51   ` Ciprian Regus via B4 Relay
2026-05-28  2:12   ` Andrew Lunn
2026-05-30  0:49   ` sashiko-bot [this message]
2026-05-26 21:51 ` [PATCH net-next v2 04/10] net: ethernet: oa_tc6: Export the C45 access functions Ciprian Regus
2026-05-26 21:51   ` Ciprian Regus via B4 Relay
2026-05-28  2:13   ` Andrew Lunn
2026-05-30  0:49   ` sashiko-bot
2026-05-26 21:51 ` [PATCH net-next v2 05/10] net: ethernet: oa_tc6: Export standard defined registers Ciprian Regus
2026-05-26 21:51   ` Ciprian Regus via B4 Relay
2026-05-28  2:21   ` Andrew Lunn
2026-05-26 21:51 ` [PATCH net-next v2 06/10] net: ethernet: oa_tc6: Add MMS register formatting macro Ciprian Regus
2026-05-26 21:51   ` Ciprian Regus via B4 Relay
2026-05-28  2:31   ` Andrew Lunn
2026-05-26 21:51 ` [PATCH net-next v2 07/10] net: phy: add generic helpers for direct C45 MMD access Ciprian Regus
2026-05-26 21:51   ` Ciprian Regus via B4 Relay
2026-05-28  2:33   ` Andrew Lunn
2026-05-26 21:51 ` [PATCH net-next v2 08/10] net: phy: microchip-t1s: use generic C45 MMD access helpers Ciprian Regus
2026-05-26 21:51   ` Ciprian Regus via B4 Relay
2026-05-28  2:33   ` Andrew Lunn
2026-05-26 21:51 ` [PATCH net-next v2 09/10] net: phy: Add support for the ADIN1140 PHY Ciprian Regus
2026-05-26 21:51   ` Ciprian Regus via B4 Relay
2026-05-28  2:50   ` Andrew Lunn
2026-05-26 21:51 ` [PATCH net-next v2 10/10] net: ethernet: adi: Add a driver for the ADIN1140 MACPHY Ciprian Regus
2026-05-26 21:51   ` Ciprian Regus via B4 Relay
2026-05-28  3:10   ` Andrew Lunn
2026-05-28 12:43     ` Regus, Ciprian
2026-05-28 14:05       ` Andrew Lunn
2026-05-29  9:21   ` Nuno Sá
2026-05-29 13:03     ` Andrew Lunn
2026-06-01  9:17       ` Nuno Sá
2026-05-30  0:49   ` sashiko-bot

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=20260530004915.BE8311F00899@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=devnull+ciprian.regus.analog.com@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.