mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Selvamani Rajagopal <Selvamani.Rajagopal@onsemi.com>
To: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Andrew Lunn <andrew@lunn.ch>, Andrew Lunn <andrew+netdev@lunn.ch>,
	Piergiorgio Beruto <Pier.Beruto@onsemi.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>
Subject: RE: [PATCH net v4 1/3] net: ethernet: oa_tc6: Protect skb pointer used by two different kernel instances
Date: Mon, 27 Jul 2026 00:26:27 +0000	[thread overview]
Message-ID: <DM5PR02MB33696E45FEF9C356B64D9CAF83CC2@DM5PR02MB3369.namprd02.prod.outlook.com> (raw)
In-Reply-To: <43382111-f55c-4ed2-bcad-586a51b3e413@microchip.com>


> -----Original Message-----
> From: Parthiban Veerasooran <parthiban.veerasooran@microchip.com>
> Sent: Wednesday, July 22, 2026 3:09 AM

> > result, it might leak skb buffer, particularly threaded IRQ
> > runs in the middle of tranmsmit path, near skb_linearize.
> Typo: "tranmsmit" -> "transmit"

Fixed. Thanks.

> > void oa_tc6_exit(struct oa_tc6 *tc6)
> > {
> > + spin_lock_bh(&tc6->tx_skb_lock);
> > tc6->disable_traffic = true;


> I don't know whether this is the right place to provide this comment,
> but FYI: the disable_traffic read/check in the hard-IRQ handler
> (oa_tc6_macphy_isr()) is not protected, while it may be written in
> oa_tc6_exit() under tx_skb_lock.

Yes. I agree. Ideal way is to protect disable_traffic is to use spin_lock_irq.

But disable_traffic flag is just one-way ticket to stop the device from working,
Worst case scenario is one more interrupt would come after this is set by those
functions, which is harmless, in my view.

I am open to changing it. If you (or anyone who reviews) want to protect this flag 
with spin_lock_irq, I can change it.

> 
> Of course, spin_lock_bh() cannot be used in hard-IRQ context, so perhaps
> a different synchronization approach is needed?
> 
> Best regards,
> Parthiban V
> > + spin_unlock_bh(&tc6->tx_skb_lock);
> > disable_irq(tc6->spi->irq);
> > oa_tc6_phy_exit(tc6);
> > oa_tc6_free_pending_skbs(tc6);


  reply	other threads:[~2026-07-27  0:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-21  2:20 [PATCH net v4 0/3] Fix to possible skb leak due to race condtion in tx path Selvamani Rajagopal via B4 Relay
2026-07-21  2:20 ` [PATCH net v4 1/3] net: ethernet: oa_tc6: Protect skb pointer used by two different kernel instances Selvamani Rajagopal via B4 Relay
2026-07-22 10:08   ` Parthiban Veerasooran
2026-07-27  0:26     ` Selvamani Rajagopal [this message]
2026-07-21  2:20 ` [PATCH net v4 2/3] net: ethernet: oa_tc6: Improvements to error recovery Selvamani Rajagopal via B4 Relay
2026-07-22 10:09   ` Parthiban Veerasooran
2026-07-27  0:06     ` Selvamani Rajagopal
2026-07-21  2:20 ` [PATCH net v4 3/3] net: ethernet: oa_tc6: Disabled tx queues when disable_traffic is set Selvamani Rajagopal via B4 Relay
2026-07-22 10:09   ` Parthiban Veerasooran
2026-07-26 22:59     ` Selvamani Rajagopal

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=DM5PR02MB33696E45FEF9C356B64D9CAF83CC2@DM5PR02MB3369.namprd02.prod.outlook.com \
    --to=selvamani.rajagopal@onsemi.com \
    --cc=Pier.Beruto@onsemi.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=parthiban.veerasooran@microchip.com \
    /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

all inboxes | Powered by JetHome®