Thread (3 messages) 3 messages, 2 authors, 2025-08-28

Re: [PATCH v1 net] net: usb: rtl8150: Fix uninit-value access in set_carrier().

From: Kuniyuki Iwashima <kuniyu@google.com>
Date: 2025-08-28 03:05:49
Also in: linux-usb

On Wed, Aug 27, 2025 at 5:57 PM Andrew Lunn [off-list ref] wrote:
On Wed, Aug 27, 2025 at 11:31:02PM +0000, Kuniyuki Iwashima wrote:
quoted
syzbot reported set_carrier() accesses an uninitialised local var. [0]

get_registers() is a wrapper of usb_control_msg_recv(), which copies
data to the passed buffer only when it returns 0.

Let's check the retval before accessing tmp in set_carrier().
        do {
                get_registers(dev, PHYCNT, 1, data);
        } while ((data[0] & PHY_GO) && (i++ < MII_TIMEOUT));

        if (i <= MII_TIMEOUT) {
                get_registers(dev, PHYDAT, 2, data);
                *reg = data[0] | (data[1] << 8);



        /* Get the CR contents. */
        get_registers(dev, CR, 1, &cr);
        /* Set the WEPROM bit (eeprom write enable). */
        cr |= 0x20;
        set_registers(dev, CR, 1, &cr);


        do {
                get_registers(dev, CR, 1, &data);
        } while ((data & 0x10) && --i);

Don't these also have the same problem?
Exactly, will fix other places.

Thanks!
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help