1
0
Fork 0
alistair23-linux/net/atm
Sasha Levin 34f5b00664 atm: deal with setting entry before mkip was called
If we didn't call ATMARP_MKIP before ATMARP_ENCAP the VCC descriptor is
non-existant and we'll end up dereferencing a NULL ptr:

[1033173.491930] kasan: GPF could be caused by NULL-ptr deref or user memory accessirq event stamp: 123386
[1033173.493678] general protection fault: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC KASAN
[1033173.493689] Modules linked in:
[1033173.493697] CPU: 9 PID: 23815 Comm: trinity-c64 Not tainted 4.2.0-next-20150911-sasha-00043-g353d875-dirty #2545
[1033173.493706] task: ffff8800630c4000 ti: ffff880063110000 task.ti: ffff880063110000
[1033173.493823] RIP: clip_ioctl (net/atm/clip.c:320 net/atm/clip.c:689)
[1033173.493826] RSP: 0018:ffff880063117a88  EFLAGS: 00010203
[1033173.493828] RAX: dffffc0000000000 RBX: 0000000000000000 RCX: 000000000000000c
[1033173.493830] RDX: 0000000000000002 RSI: ffffffffb3f10720 RDI: 0000000000000014
[1033173.493832] RBP: ffff880063117b80 R08: ffff88047574d9a4 R09: 0000000000000000
[1033173.493834] R10: 0000000000000000 R11: 0000000000000000 R12: 1ffff1000c622f53
[1033173.493836] R13: ffff8800cb905500 R14: ffff8808d6da2000 R15: 00000000fffffdfd
[1033173.493840] FS:  00007fa56b92d700(0000) GS:ffff880478000000(0000) knlGS:0000000000000000
[1033173.493843] CS:  0010 DS: 0000 ES: 0000 CR0: 000000008005003b
[1033173.493845] CR2: 0000000000000000 CR3: 00000000630e8000 CR4: 00000000000006a0
[1033173.493855] Stack:
[1033173.493862]  ffffffffb0b60444 000000000000eaea 0000000041b58ab3 ffffffffb3c3ce32
[1033173.493867]  ffffffffb0b6f3e0 ffffffffb0b60444 ffffffffb5ea2e50 1ffff1000c622f5e
[1033173.493873]  ffff8800630c4cd8 00000000000ee09a ffffffffb3ec4888 ffffffffb5ea2de8
[1033173.493874] Call Trace:
[1033173.494108] do_vcc_ioctl (net/atm/ioctl.c:170)
[1033173.494113] vcc_ioctl (net/atm/ioctl.c:189)
[1033173.494116] svc_ioctl (net/atm/svc.c:605)
[1033173.494200] sock_do_ioctl (net/socket.c:874)
[1033173.494204] sock_ioctl (net/socket.c:958)
[1033173.494244] do_vfs_ioctl (fs/ioctl.c:43 fs/ioctl.c:607)
[1033173.494290] SyS_ioctl (fs/ioctl.c:622 fs/ioctl.c:613)
[1033173.494295] entry_SYSCALL_64_fastpath (arch/x86/entry/entry_64.S:186)
[1033173.494362] Code: fa 48 c1 ea 03 80 3c 02 00 0f 85 50 09 00 00 49 8b 9e 60 06 00 00 48 b8 00 00 00 00 00 fc ff df 48 8d 7b 14 48 89 fa 48 c1 ea 03 <0f> b6 04 02 48 89 fa 83 e2 07 38 d0 7f 08 84 c0 0f 85 14 09 00
All code

========
   0:   fa                      cli
   1:   48 c1 ea 03             shr    $0x3,%rdx
   5:   80 3c 02 00             cmpb   $0x0,(%rdx,%rax,1)
   9:   0f 85 50 09 00 00       jne    0x95f
   f:   49 8b 9e 60 06 00 00    mov    0x660(%r14),%rbx
  16:   48 b8 00 00 00 00 00    movabs $0xdffffc0000000000,%rax
  1d:   fc ff df
  20:   48 8d 7b 14             lea    0x14(%rbx),%rdi
  24:   48 89 fa                mov    %rdi,%rdx
  27:   48 c1 ea 03             shr    $0x3,%rdx
  2b:*  0f b6 04 02             movzbl (%rdx,%rax,1),%eax               <-- trapping instruction
  2f:   48 89 fa                mov    %rdi,%rdx
  32:   83 e2 07                and    $0x7,%edx
  35:   38 d0                   cmp    %dl,%al
  37:   7f 08                   jg     0x41
  39:   84 c0                   test   %al,%al
  3b:   0f 85 14 09 00 00       jne    0x955

Code starting with the faulting instruction
===========================================
   0:   0f b6 04 02             movzbl (%rdx,%rax,1),%eax
   4:   48 89 fa                mov    %rdi,%rdx
   7:   83 e2 07                and    $0x7,%edx
   a:   38 d0                   cmp    %dl,%al
   c:   7f 08                   jg     0x16
   e:   84 c0                   test   %al,%al
  10:   0f 85 14 09 00 00       jne    0x92a
[1033173.494366] RIP clip_ioctl (net/atm/clip.c:320 net/atm/clip.c:689)
[1033173.494368]  RSP <ffff880063117a88>

Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2015-09-17 22:13:32 -07:00
..
Kconfig [ATM]: atm is no longer experimental 2008-01-28 15:00:11 -08:00
Makefile [ATM]: Kill ipcommon.[ch] 2006-12-02 21:32:08 -08:00
addr.c include cleanup: Update gfp.h and slab.h includes to prepare for breaking implicit slab.h inclusion from percpu.h 2010-03-30 22:02:32 +09:00
addr.h atm: use const where reasonable 2008-06-17 16:20:06 -07:00
atm_misc.c atm: eliminate atm_guess_pdu2truesize() 2011-11-26 16:40:30 -05:00
atm_sysfs.c atm: use scnprintf() instead of sprintf() 2012-12-17 20:50:51 -08:00
br2684.c br2684: Remove unnecessary formatting macros b1 and bs 2015-07-31 15:25:52 -07:00
clip.c atm: deal with setting entry before mkip was called 2015-09-17 22:13:32 -07:00
common.c net: Pass kern from net_proto_family.create to sk_alloc 2015-05-11 10:50:17 -04:00
common.h net: Pass kern from net_proto_family.create to sk_alloc 2015-05-11 10:50:17 -04:00
ioctl.c net: Convert net_ratelimit uses to net_<level>_ratelimited 2012-05-15 13:45:03 -04:00
lec.c atm: Use eth_<foo>_addr instead of memset 2015-03-03 17:01:37 -05:00
lec.h net: add ETH_P_802_3_MIN 2013-03-28 01:20:42 -04:00
lec_arpc.h [ATM]: [lec] add reference counting to lec_arp entries 2006-09-29 17:16:48 -07:00
mpc.c net: Pass a "more" indication down into netdev_start_xmit() code paths. 2014-09-01 17:39:55 -07:00
mpc.h atm: convert mpc device to using netdev_ops 2009-03-21 19:19:12 -07:00
mpoa_caches.c net: Remove unnecessary returns from void function()s 2010-05-17 23:23:14 -07:00
mpoa_caches.h [NET] ATM: Fix whitespace errors. 2007-02-10 23:19:16 -08:00
mpoa_proc.c treewide: Fix typo in printk messages 2015-03-06 23:04:40 +01:00
pppoatm.c arch: Mass conversion of smp_mb__*() 2014-04-18 14:20:48 +02:00
proc.c procfs: new helper - PDE_DATA(inode) 2013-04-09 14:13:32 -04:00
protocols.h
pvc.c net: Pass kern from net_proto_family.create to sk_alloc 2015-05-11 10:50:17 -04:00
raw.c net: Fix use after free by removing length arg from sk_data_ready callbacks. 2014-04-11 16:15:36 -04:00
resources.c net🏧fix up ENOIOCTLCMD error handling 2012-08-31 16:14:33 -04:00
resources.h atm: correct sysfs 'device' link creation and parent relationships 2010-12-10 15:45:05 -08:00
signaling.c net/atm/signaling.c: remove WAIT_FOR_DEMON code 2015-03-03 14:22:11 -05:00
signaling.h [NET] ATM: Fix whitespace errors. 2007-02-10 23:19:16 -08:00
svc.c net: Pass kern from net_proto_family.create to sk_alloc 2015-05-11 10:50:17 -04:00