Skip to contentSkip to conversation

Possible Use-After-Free Vulnerability in ether3 Driver Due to Race Condition

BUG Russell King (Oracle) 3 participants 3 messages Sep 2, 2024 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive
Quoted 6 lines · Wentai Deng

In the ether3_probe function, a timer is initialized with a callback function ether3_ledoff, bound to &prev(dev)->timer. Once the timer is started, there is a risk of a race condition if the module or device is removed, triggering the ether3_remove function to perform cleanup. The sequence of operations that may lead to a UAF bug is as follows:

CPU0                            CPU1

Quoted 7 lines

                            |   ether3_ledoff
ether3_remove               |
    free_netdev(dev);       |
    put_device              |
    kfree(dev);             |
                            |       ether3_outw(priv(dev)->regs.config2 |= CFG2_CTRLO, REG_CONFIG2);                             |       // use dev

This is unreadable.

Quoted 4 lines

Request for Review:

We would appreciate your expert insight to confirm whether this vulnerability indeed poses a risk to the system, and if the proposed fix is appropriate.

Please resend without the HTML junk in the plain text part.

Signature · 6 lines
*** please note that I probably will only be occasionally responsive
*** for an unknown period of time due to recent eye surgery making
*** reading quite difficult.

RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!
#2 lore raw

Apologies for sending the email in the wrong format. I'll correct it and resend it shortly.

------------------ Original ------------------From: "Russell King (Oracle)"<[email protected]>;Date: Mon, Sep 2, 2024 05:23 PMTo: "Wentai Deng"<[email protected]>; Cc: "davem"<[email protected]>; "edumazet"<[email protected]>; "kuba"<[email protected]>; "pabeni"<[email protected]>; "linux-arm-kernel"<[email protected]>; "netdev"<[email protected]>; "linux-kernel"<[email protected]>; "杜雪盈"<[email protected]>; Subject: Re: [BUG] Possible Use-After-Free Vulnerability in ether3 Driver Due to Race Condition On Mon, Sep 02, 2024 at 01:19:43PM +0800, Wentai Deng wrote:> In the ether3_probe function, a timer is initialized with a callback function ether3_ledoff, bound to &amp;prev(dev)-&gt;timer. Once the timer is started, there is a risk of a race condition if the module or device is removed, triggering the ether3_remove function to perform cleanup. The sequence of operations that may lead to a UAF bug is as follows:> > > CPU0&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CPU1> > > &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp;ether3_ledoff> ether3_remove&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|> &nbsp; &nbsp; free_netdev(dev);&nbsp; &nbsp; &nbsp; &nbsp;|> &nbsp; &nbsp; put_device&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |> &nbsp; &nbsp; kfree(dev);&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;|> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp;ether3_outw(priv(dev)-&gt;regs.config2 |= CFG2_CTRLO, REG_CONFIG2);> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; |&nbsp; &nbsp; &nbsp; &nbsp;// use devThis is unreadable.> Request for Review:> > > We would appreciate your expert insight to confirm whether this vulnerability indeed poses a risk to the system, and if the proposed fix is appropriate.Please resend without the HTML junk in the plain text part.-- *** please note that I probably will only be occasionally responsive*** for an unknown period of time due to recent eye surgery making*** reading quite difficult.RMK's Patch system: https://www.armlinux.org.uk/developer/patches/FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

#3 lore raw
Quoted 1 line · Wentai Deng

Apologies for sending the email in the wrong format. I'll correct it and resend it shortly.

Please don't top post.

Quoted 1 line

------------------ Original ------------------From: "Russell King (Oracle)"<[email protected]>;Date: Mon, Sep 2, 2024 05:23 PMTo: "Wentai Deng"<[email protected]>; Cc: "davem"<[email protected]>; "edumazet"<[email protected]>; "kuba"<[email protected]>; "pabeni"<[email protected]>; "linux-arm-kernel"<[email protected]>; "netdev"<[email protected]>; "linux-kernel"<[email protected]>; "杜雪盈"<[email protected]>; Subject: Re: [BUG] Possible Use-After-Free Vulnerability in ether3 Driver Due to Race Condition

You have also mangled Russels reply. Plain text only please.

Andrew