RE: [PATCH net v4 1/3] net: ethernet: oa_tc6: Protect skb pointer used by two different kernel instances

From: Selvamani Rajagopal

Date: Sun Jul 26 2026 - 20:26:43 EST



> -----Original Message-----
> From: Parthiban Veerasooran <parthiban.veerasooran@xxxxxxxxxxxxx>
> 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);