[syzbot] KASAN: null-ptr-deref Read in phy_disconnect

5 messages, 4 authors, 2021-08-31 · open the first message on its own page

[syzbot] KASAN: null-ptr-deref Read in phy_disconnect

From: syzbot <hidden>
Date: 2021-08-31 10:36:45

Hello,

syzbot found the following issue on:

HEAD commit:    9c1587d99f93 usb: isp1760: otg control register access
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
console output: https://syzkaller.appspot.com/x/log.txt?x=16907291300000
kernel config:  https://syzkaller.appspot.com/x/.config?x=24756feea212a6b0
dashboard link: https://syzkaller.appspot.com/bug?extid=6a916267d9bc5fa2d9a6
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.1
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=166de449300000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12c5ddce300000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+6a916267d9bc5fa2d9a6@syzkaller.appspotmail.com

asix 1-1:0.0 eth1: register 'asix' at usb-dummy_hcd.0-1, ASIX AX88178 USB 2.0 Ethernet, 8a:c0:d1:1e:27:4c
usb 1-1: USB disconnect, device number 2
asix 1-1:0.0 eth1: unregister 'asix' usb-dummy_hcd.0-1, ASIX AX88178 USB 2.0 Ethernet
general protection fault, probably for non-canonical address 0xdffffc00000000c3: 0000 [#1] SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000618-0x000000000000061f]
CPU: 1 PID: 32 Comm: kworker/1:1 Not tainted 5.14.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: usb_hub_wq hub_event
RIP: 0010:phy_is_started include/linux/phy.h:947 [inline]
RIP: 0010:phy_disconnect+0x22/0x110 drivers/net/phy/phy_device.c:1097
Code: 0f 1f 84 00 00 00 00 00 55 48 89 fd 53 e8 46 33 68 fe 48 8d bd 18 06 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e c5 00 00 00 8b 9d 18 06 00 00
RSP: 0018:ffffc900001a7780 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: ffff88811a410bc0 RCX: 0000000000000000
RDX: 00000000000000c3 RSI: ffffffff82d9305a RDI: 0000000000000618
RBP: 0000000000000000 R08: 0000000000000055 R09: 0000000000000000
R10: ffffffff814c05fb R11: 0000000000000000 R12: ffff8881063cc300
R13: ffffffff83870d90 R14: ffffffff86805a20 R15: ffffffff868059e0
FS:  0000000000000000(0000) GS:ffff8881f6900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fb4c30b3008 CR3: 00000001021e1000 CR4: 00000000001506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 ax88772_unbind+0x51/0x90 drivers/net/usb/asix_devices.c:816
 usbnet_disconnect+0x103/0x270 drivers/net/usb/usbnet.c:1618
 usb_unbind_interface+0x1d8/0x8d0 drivers/usb/core/driver.c:458
 __device_release_driver+0x3bd/0x6f0 drivers/base/dd.c:1201
 device_release_driver_internal drivers/base/dd.c:1232 [inline]
 device_release_driver+0x26/0x40 drivers/base/dd.c:1255
 bus_remove_device+0x2eb/0x5a0 drivers/base/bus.c:529
 device_del+0x502/0xd40 drivers/base/core.c:3543
 usb_disable_device+0x35b/0x7b0 drivers/usb/core/message.c:1419
 usb_disconnect.cold+0x27a/0x78e drivers/usb/core/hub.c:2225
 hub_port_connect drivers/usb/core/hub.c:5199 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5488 [inline]
 port_event drivers/usb/core/hub.c:5634 [inline]
 hub_event+0x1c9c/0x4330 drivers/usb/core/hub.c:5716
 process_one_work+0x98d/0x15b0 kernel/workqueue.c:2276
 process_scheduled_works kernel/workqueue.c:2338 [inline]
 worker_thread+0x85c/0x11f0 kernel/workqueue.c:2424
 kthread+0x3c0/0x4a0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
Modules linked in:
---[ end trace d08c08ba92f8f06f ]---
RIP: 0010:phy_is_started include/linux/phy.h:947 [inline]
RIP: 0010:phy_disconnect+0x22/0x110 drivers/net/phy/phy_device.c:1097
Code: 0f 1f 84 00 00 00 00 00 55 48 89 fd 53 e8 46 33 68 fe 48 8d bd 18 06 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e c5 00 00 00 8b 9d 18 06 00 00
RSP: 0018:ffffc900001a7780 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: ffff88811a410bc0 RCX: 0000000000000000
RDX: 00000000000000c3 RSI: ffffffff82d9305a RDI: 0000000000000618
RBP: 0000000000000000 R08: 0000000000000055 R09: 0000000000000000
R10: ffffffff814c05fb R11: 0000000000000000 R12: ffff8881063cc300
R13: ffffffff83870d90 R14: ffffffff86805a20 R15: ffffffff868059e0
FS:  0000000000000000(0000) GS:ffff8881f6900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fb4c30b3008 CR3: 00000001021e1000 CR4: 00000000001506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	0f 1f 84 00 00 00 00 	nopl   0x0(%rax,%rax,1)
   7:	00
   8:	55                   	push   %rbp
   9:	48 89 fd             	mov    %rdi,%rbp
   c:	53                   	push   %rbx
   d:	e8 46 33 68 fe       	callq  0xfe683358
  12:	48 8d bd 18 06 00 00 	lea    0x618(%rbp),%rdi
  19:	48 b8 00 00 00 00 00 	movabs $0xdffffc0000000000,%rax
  20:	fc ff df
  23:	48 89 fa             	mov    %rdi,%rdx
  26:	48 c1 ea 03          	shr    $0x3,%rdx
* 2a:	0f b6 04 02          	movzbl (%rdx,%rax,1),%eax <-- trapping instruction
  2e:	84 c0                	test   %al,%al
  30:	74 08                	je     0x3a
  32:	3c 03                	cmp    $0x3,%al
  34:	0f 8e c5 00 00 00    	jle    0xff
  3a:	8b 9d 18 06 00 00    	mov    0x618(%rbp),%ebx


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

Re: [syzbot] KASAN: null-ptr-deref Read in phy_disconnect

From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-08-31 13:49:07

On Tue, 31 Aug 2021 03:36:23 -0700 syzbot wrote:
Hello,

syzbot found the following issue on:

HEAD commit:    9c1587d99f93 usb: isp1760: otg control register access
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
console output: https://syzkaller.appspot.com/x/log.txt?x=16907291300000
kernel config:  https://syzkaller.appspot.com/x/.config?x=24756feea212a6b0
dashboard link: https://syzkaller.appspot.com/bug?extid=6a916267d9bc5fa2d9a6
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.1
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=166de449300000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12c5ddce300000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+6a916267d9bc5fa2d9a6@syzkaller.appspotmail.com

asix 1-1:0.0 eth1: register 'asix' at usb-dummy_hcd.0-1, ASIX AX88178 USB 2.0 Ethernet, 8a:c0:d1:1e:27:4c
usb 1-1: USB disconnect, device number 2
asix 1-1:0.0 eth1: unregister 'asix' usb-dummy_hcd.0-1, ASIX AX88178 USB 2.0 Ethernet
general protection fault, probably for non-canonical address 0xdffffc00000000c3: 0000 [#1] SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000618-0x000000000000061f]
CPU: 1 PID: 32 Comm: kworker/1:1 Not tainted 5.14.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: usb_hub_wq hub_event
RIP: 0010:phy_is_started include/linux/phy.h:947 [inline]
RIP: 0010:phy_disconnect+0x22/0x110 drivers/net/phy/phy_device.c:1097
Code: 0f 1f 84 00 00 00 00 00 55 48 89 fd 53 e8 46 33 68 fe 48 8d bd 18 06 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e c5 00 00 00 8b 9d 18 06 00 00
RSP: 0018:ffffc900001a7780 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: ffff88811a410bc0 RCX: 0000000000000000
RDX: 00000000000000c3 RSI: ffffffff82d9305a RDI: 0000000000000618
RBP: 0000000000000000 R08: 0000000000000055 R09: 0000000000000000
R10: ffffffff814c05fb R11: 0000000000000000 R12: ffff8881063cc300
R13: ffffffff83870d90 R14: ffffffff86805a20 R15: ffffffff868059e0
FS:  0000000000000000(0000) GS:ffff8881f6900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fb4c30b3008 CR3: 00000001021e1000 CR4: 00000000001506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 ax88772_unbind+0x51/0x90 drivers/net/usb/asix_devices.c:816
 usbnet_disconnect+0x103/0x270 drivers/net/usb/usbnet.c:1618
 usb_unbind_interface+0x1d8/0x8d0 drivers/usb/core/driver.c:458
 __device_release_driver+0x3bd/0x6f0 drivers/base/dd.c:1201
 device_release_driver_internal drivers/base/dd.c:1232 [inline]
 device_release_driver+0x26/0x40 drivers/base/dd.c:1255
 bus_remove_device+0x2eb/0x5a0 drivers/base/bus.c:529
 device_del+0x502/0xd40 drivers/base/core.c:3543
 usb_disable_device+0x35b/0x7b0 drivers/usb/core/message.c:1419
 usb_disconnect.cold+0x27a/0x78e drivers/usb/core/hub.c:2225
 hub_port_connect drivers/usb/core/hub.c:5199 [inline]
 hub_port_connect_change drivers/usb/core/hub.c:5488 [inline]
 port_event drivers/usb/core/hub.c:5634 [inline]
 hub_event+0x1c9c/0x4330 drivers/usb/core/hub.c:5716
 process_one_work+0x98d/0x15b0 kernel/workqueue.c:2276
 process_scheduled_works kernel/workqueue.c:2338 [inline]
 worker_thread+0x85c/0x11f0 kernel/workqueue.c:2424
 kthread+0x3c0/0x4a0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
Modules linked in:
---[ end trace d08c08ba92f8f06f ]---
RIP: 0010:phy_is_started include/linux/phy.h:947 [inline]
RIP: 0010:phy_disconnect+0x22/0x110 drivers/net/phy/phy_device.c:1097
Code: 0f 1f 84 00 00 00 00 00 55 48 89 fd 53 e8 46 33 68 fe 48 8d bd 18 06 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e c5 00 00 00 8b 9d 18 06 00 00
RSP: 0018:ffffc900001a7780 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: ffff88811a410bc0 RCX: 0000000000000000
RDX: 00000000000000c3 RSI: ffffffff82d9305a RDI: 0000000000000618
RBP: 0000000000000000 R08: 0000000000000055 R09: 0000000000000000
R10: ffffffff814c05fb R11: 0000000000000000 R12: ffff8881063cc300
R13: ffffffff83870d90 R14: ffffffff86805a20 R15: ffffffff868059e0
FS:  0000000000000000(0000) GS:ffff8881f6900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fb4c30b3008 CR3: 00000001021e1000 CR4: 00000000001506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	0f 1f 84 00 00 00 00 	nopl   0x0(%rax,%rax,1)
   7:	00
   8:	55                   	push   %rbp
   9:	48 89 fd             	mov    %rdi,%rbp
   c:	53                   	push   %rbx
   d:	e8 46 33 68 fe       	callq  0xfe683358
  12:	48 8d bd 18 06 00 00 	lea    0x618(%rbp),%rdi
  19:	48 b8 00 00 00 00 00 	movabs $0xdffffc0000000000,%rax
  20:	fc ff df
  23:	48 89 fa             	mov    %rdi,%rdx
  26:	48 c1 ea 03          	shr    $0x3,%rdx
* 2a:	0f b6 04 02          	movzbl (%rdx,%rax,1),%eax <-- trapping instruction
  2e:	84 c0                	test   %al,%al
  30:	74 08                	je     0x3a
  32:	3c 03                	cmp    $0x3,%al
  34:	0f 8e c5 00 00 00    	jle    0xff
  3a:	8b 9d 18 06 00 00    	mov    0x618(%rbp),%ebx


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches
Oleksij may know.

Re: [syzbot] KASAN: null-ptr-deref Read in phy_disconnect

From: Andrew Lunn <andrew@lunn.ch>
Date: 2021-08-31 14:21:03

On Tue, Aug 31, 2021 at 06:48:45AM -0700, Jakub Kicinski wrote:
On Tue, 31 Aug 2021 03:36:23 -0700 syzbot wrote:
quoted
Hello,

syzbot found the following issue on:

HEAD commit:    9c1587d99f93 usb: isp1760: otg control register access
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
console output: https://syzkaller.appspot.com/x/log.txt?x=16907291300000
kernel config:  https://syzkaller.appspot.com/x/.config?x=24756feea212a6b0
dashboard link: https://syzkaller.appspot.com/bug?extid=6a916267d9bc5fa2d9a6
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.1
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=166de449300000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12c5ddce300000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+6a916267d9bc5fa2d9a6@syzkaller.appspotmail.com

asix 1-1:0.0 eth1: register 'asix' at usb-dummy_hcd.0-1, ASIX AX88178 USB 2.0 Ethernet, 8a:c0:d1:1e:27:4c
usb 1-1: USB disconnect, device number 2
asix 1-1:0.0 eth1: unregister 'asix' usb-dummy_hcd.0-1, ASIX AX88178 USB 2.0 Ethernet
general protection fault, probably for non-canonical address 0xdffffc00000000c3: 0000 [#1] SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000618-0x000000000000061f]
CPU: 1 PID: 32 Comm: kworker/1:1 Not tainted 5.14.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: usb_hub_wq hub_event
RIP: 0010:phy_is_started include/linux/phy.h:947 [inline]
RIP: 0010:phy_disconnect+0x22/0x110 drivers/net/phy/phy_device.c:1097
Code: 0f 1f 84 00 00 00 00 00 55 48 89 fd 53 e8 46 33 68 fe 48 8d bd 18 06 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e c5 00 00 00 8b 9d 18 06 00 00
RSP: 0018:ffffc900001a7780 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: ffff88811a410bc0 RCX: 0000000000000000
RDX: 00000000000000c3 RSI: ffffffff82d9305a RDI: 0000000000000618
RBP: 0000000000000000 R08: 0000000000000055 R09: 0000000000000000
R10: ffffffff814c05fb R11: 0000000000000000 R12: ffff8881063cc300
R13: ffffffff83870d90 R14: ffffffff86805a20 R15: ffffffff868059e0
FS:  0000000000000000(0000) GS:ffff8881f6900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fb4c30b3008 CR3: 00000001021e1000 CR4: 00000000001506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 ax88772_unbind+0x51/0x90 drivers/net/usb/asix_devices.c:816
Looking at the console messages:

[   36.456221][   T32] usb 1-1: new high-speed USB device number 2 using dummy_hcd
[   36.976035][   T32] usb 1-1: New USB device found, idVendor=0df6, idProduct=0056, bcdDevice=42.6c
[   36.985338][   T32] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   36.993579][   T32] usb 1-1: Product: syz
[   36.997817][   T32] usb 1-1: Manufacturer: syz
[   37.002423][   T32] usb 1-1: SerialNumber: syz
[   37.013578][   T32] usb 1-1: config 0 descriptor??
[   37.276018][   T32] asix 1-1:0.0 (unnamed net_device) (uninitialized): invalid hw address, using random
executing program
[   37.715517][   T32] asix 1-1:0.0 (unnamed net_device) (uninitialized): Failed to write reg index 0x0000: -71
[   37.725693][   T32] asix 1-1:0.0 (unnamed net_device) (uninitialized): Failed to send software reset: ffffffb9
[   37.925418][   T32] asix 1-1:0.0 (unnamed net_device) (uninitialized): Failed to write reg index 0x0000: -71
[   37.936461][   T32] asix 1-1:0.0 (unnamed net_device) (uninitialized): Failed to send software reset: ffffffb9
[   38.119561][   T32] asix 1-1:0.0 eth1: register 'asix' at usb-dummy_hcd.0-1, ASIX AX88178 USB 2.0 Ethernet, 8a:c0:d1:1e:27:4c
[   38.138828][   T32] usb 1-1: USB disconnect, device number 2
[   38.150689][   T32] asix 1-1:0.0 eth1: unregister 'asix' usb-dummy_hcd.0-1, ASIX AX88178 USB 2.0 Ethernet

So this is a AX88178, and you would expect it to use
ax88178_bind(). That function never calls ax88772_init_phy() which is
what connects the PHY to the MAC, and sets priv->phydev.

static void ax88772_unbind(struct usbnet *dev, struct usb_interface *intf)
{
        struct asix_common_private *priv = dev->driver_priv;

        phy_disconnect(priv->phydev);

So this passes a NULL pointer.

static const struct driver_info ax88178_info = {
        .description = "ASIX AX88178 USB 2.0 Ethernet",
        .bind = ax88178_bind,
        .unbind = ax88772_unbind,
        .status = asix_status,

You cannot pair ax88178_bind with ax88772_unbind. Either a
ax88178_unbind is needed, or ax88772_unbind needs to check for a NULL
pointer.

	Andrew

Re: [syzbot] KASAN: null-ptr-deref Read in phy_disconnect

From: Oleksij Rempel <hidden>
Date: 2021-08-31 15:31:42

Am 31.08.21 um 16:20 schrieb Andrew Lunn:
On Tue, Aug 31, 2021 at 06:48:45AM -0700, Jakub Kicinski wrote:
quoted
On Tue, 31 Aug 2021 03:36:23 -0700 syzbot wrote:
quoted
Hello,

syzbot found the following issue on:

HEAD commit:    9c1587d99f93 usb: isp1760: otg control register access
git tree:       https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing
console output: https://syzkaller.appspot.com/x/log.txt?x=16907291300000
kernel config:  https://syzkaller.appspot.com/x/.config?x=24756feea212a6b0
dashboard link: https://syzkaller.appspot.com/bug?extid=6a916267d9bc5fa2d9a6
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.1
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=166de449300000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=12c5ddce300000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+6a916267d9bc5fa2d9a6@syzkaller.appspotmail.com

asix 1-1:0.0 eth1: register 'asix' at usb-dummy_hcd.0-1, ASIX AX88178 USB 2.0 Ethernet, 8a:c0:d1:1e:27:4c
usb 1-1: USB disconnect, device number 2
asix 1-1:0.0 eth1: unregister 'asix' usb-dummy_hcd.0-1, ASIX AX88178 USB 2.0 Ethernet
general protection fault, probably for non-canonical address 0xdffffc00000000c3: 0000 [#1] SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000618-0x000000000000061f]
CPU: 1 PID: 32 Comm: kworker/1:1 Not tainted 5.14.0-rc7-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: usb_hub_wq hub_event
RIP: 0010:phy_is_started include/linux/phy.h:947 [inline]
RIP: 0010:phy_disconnect+0x22/0x110 drivers/net/phy/phy_device.c:1097
Code: 0f 1f 84 00 00 00 00 00 55 48 89 fd 53 e8 46 33 68 fe 48 8d bd 18 06 00 00 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <0f> b6 04 02 84 c0 74 08 3c 03 0f 8e c5 00 00 00 8b 9d 18 06 00 00
RSP: 0018:ffffc900001a7780 EFLAGS: 00010206
RAX: dffffc0000000000 RBX: ffff88811a410bc0 RCX: 0000000000000000
RDX: 00000000000000c3 RSI: ffffffff82d9305a RDI: 0000000000000618
RBP: 0000000000000000 R08: 0000000000000055 R09: 0000000000000000
R10: ffffffff814c05fb R11: 0000000000000000 R12: ffff8881063cc300
R13: ffffffff83870d90 R14: ffffffff86805a20 R15: ffffffff868059e0
FS:  0000000000000000(0000) GS:ffff8881f6900000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fb4c30b3008 CR3: 00000001021e1000 CR4: 00000000001506e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 ax88772_unbind+0x51/0x90 drivers/net/usb/asix_devices.c:816
Looking at the console messages:

[   36.456221][   T32] usb 1-1: new high-speed USB device number 2 using dummy_hcd
[   36.976035][   T32] usb 1-1: New USB device found, idVendor=0df6, idProduct=0056, bcdDevice=42.6c
[   36.985338][   T32] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   36.993579][   T32] usb 1-1: Product: syz
[   36.997817][   T32] usb 1-1: Manufacturer: syz
[   37.002423][   T32] usb 1-1: SerialNumber: syz
[   37.013578][   T32] usb 1-1: config 0 descriptor??
[   37.276018][   T32] asix 1-1:0.0 (unnamed net_device) (uninitialized): invalid hw address, using random
executing program
[   37.715517][   T32] asix 1-1:0.0 (unnamed net_device) (uninitialized): Failed to write reg index 0x0000: -71
[   37.725693][   T32] asix 1-1:0.0 (unnamed net_device) (uninitialized): Failed to send software reset: ffffffb9
[   37.925418][   T32] asix 1-1:0.0 (unnamed net_device) (uninitialized): Failed to write reg index 0x0000: -71
[   37.936461][   T32] asix 1-1:0.0 (unnamed net_device) (uninitialized): Failed to send software reset: ffffffb9
[   38.119561][   T32] asix 1-1:0.0 eth1: register 'asix' at usb-dummy_hcd.0-1, ASIX AX88178 USB 2.0 Ethernet, 8a:c0:d1:1e:27:4c
[   38.138828][   T32] usb 1-1: USB disconnect, device number 2
[   38.150689][   T32] asix 1-1:0.0 eth1: unregister 'asix' usb-dummy_hcd.0-1, ASIX AX88178 USB 2.0 Ethernet

So this is a AX88178, and you would expect it to use
ax88178_bind(). That function never calls ax88772_init_phy() which is
what connects the PHY to the MAC, and sets priv->phydev.

static void ax88772_unbind(struct usbnet *dev, struct usb_interface *intf)
{
        struct asix_common_private *priv = dev->driver_priv;

        phy_disconnect(priv->phydev);

So this passes a NULL pointer.

static const struct driver_info ax88178_info = {
        .description = "ASIX AX88178 USB 2.0 Ethernet",
        .bind = ax88178_bind,
        .unbind = ax88772_unbind,
        .status = asix_status,

You cannot pair ax88178_bind with ax88772_unbind. Either a
ax88178_unbind is needed, or ax88772_unbind needs to check for a NULL
pointer.

	Andrew
Yes, this was fixed following patch:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/drivers/net/usb/asix_devices.c?id=1406e8cb4b05fdc67692b1af2da39d7ca5278713

--
Regards,
Oleksij

Re: [syzbot] KASAN: null-ptr-deref Read in phy_disconnect

From: Jakub Kicinski <kuba@kernel.org>
Date: 2021-08-31 15:34:51

On Tue, 31 Aug 2021 17:30:19 +0200 Oleksij Rempel wrote:
Am 31.08.21 um 16:20 schrieb Andrew Lunn:
quoted
On Tue, Aug 31, 2021 at 06:48:45AM -0700, Jakub Kicinski wrote:  
quoted
On Tue, 31 Aug 2021 03:36:23 -0700 syzbot wrote:  
 [...]  
quoted
Looking at the console messages:

[   36.456221][   T32] usb 1-1: new high-speed USB device number 2 using dummy_hcd
[   36.976035][   T32] usb 1-1: New USB device found, idVendor=0df6, idProduct=0056, bcdDevice=42.6c
[   36.985338][   T32] usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[   36.993579][   T32] usb 1-1: Product: syz
[   36.997817][   T32] usb 1-1: Manufacturer: syz
[   37.002423][   T32] usb 1-1: SerialNumber: syz
[   37.013578][   T32] usb 1-1: config 0 descriptor??
[   37.276018][   T32] asix 1-1:0.0 (unnamed net_device) (uninitialized): invalid hw address, using random
executing program
[   37.715517][   T32] asix 1-1:0.0 (unnamed net_device) (uninitialized): Failed to write reg index 0x0000: -71
[   37.725693][   T32] asix 1-1:0.0 (unnamed net_device) (uninitialized): Failed to send software reset: ffffffb9
[   37.925418][   T32] asix 1-1:0.0 (unnamed net_device) (uninitialized): Failed to write reg index 0x0000: -71
[   37.936461][   T32] asix 1-1:0.0 (unnamed net_device) (uninitialized): Failed to send software reset: ffffffb9
[   38.119561][   T32] asix 1-1:0.0 eth1: register 'asix' at usb-dummy_hcd.0-1, ASIX AX88178 USB 2.0 Ethernet, 8a:c0:d1:1e:27:4c
[   38.138828][   T32] usb 1-1: USB disconnect, device number 2
[   38.150689][   T32] asix 1-1:0.0 eth1: unregister 'asix' usb-dummy_hcd.0-1, ASIX AX88178 USB 2.0 Ethernet

So this is a AX88178, and you would expect it to use
ax88178_bind(). That function never calls ax88772_init_phy() which is
what connects the PHY to the MAC, and sets priv->phydev.

static void ax88772_unbind(struct usbnet *dev, struct usb_interface *intf)
{
        struct asix_common_private *priv = dev->driver_priv;

        phy_disconnect(priv->phydev);

So this passes a NULL pointer.

static const struct driver_info ax88178_info = {
        .description = "ASIX AX88178 USB 2.0 Ethernet",
        .bind = ax88178_bind,
        .unbind = ax88772_unbind,
        .status = asix_status,

You cannot pair ax88178_bind with ax88772_unbind. Either a
ax88178_unbind is needed, or ax88772_unbind needs to check for a NULL
pointer.

	Andrew
 
Yes, this was fixed following patch:
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/drivers/net/usb/asix_devices.c?id=1406e8cb4b05fdc67692b1af2da39d7ca5278713
#syz fix: net: usb: asix: do not call phy_disconnect() for ax88178
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help