Trying to run izlisten (from lowpan-tools tests) on a device that does not
exists I got the oops below. The problem is that we are using get_dev_by_name
without checking if we really get a device back. We don't in this case and
writing to dev->type generates this oops.

[18267.078271] NET: Registered protocol family 36
[18267.078487] Unsupported ieee802154 address type: 0
[18267.078509] BUG: unable to handle kernel NULL pointer dereference at
0000000000000180
[18267.078513] IP: [<ffffffffa0048256>] ieee802154_sock_ioctl+0xa7/0x12b
[af_802154]
[18267.078519] PGD 125c29067 PUD 13a2ae067 PMD 0
[18267.078523] Oops: 0000 [#1] PREEMPT SMP
[18267.078526] last sysfs file:
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
[18267.078529] CPU 0
[18267.078530] Modules linked in: af_802154 ipt_MASQUERADE iptable_nat nf_nat
nf_conntrack_ipv4 nf_conntrack nf_defrag_ipv4 ip_tables x_tables cdc_subset
ftdi_sio usbserial sco bridge stp llc bnep rfcomm l2cap crc16 bluetooth
kvm_intel kvm ipv6 microcode acpi_cpufreq cpufreq_stats binfmt_misc uinput fuse
zaurus cdc_ether usbnet cdc_acm mii cdc_wdm ext2 loop snd_hda_codec_conexant
snd_hda_intel snd_hda_codec snd_pcm_oss arc4 snd_mixer_oss ecb snd_pcm
snd_seq_dummy thinkpad_acpi snd_seq_oss snd_seq_midi snd_rawmidi
snd_seq_midi_event snd_seq iwlagn iwlcore snd_timer snd_seq_device mac80211 snd
cfg80211 soundcore snd_page_alloc tpm_tis led_class rfkill psmouse ac battery
tpm nvram serio_raw evdev i2c_i801 processor tpm_bios ext3 jbd mbcache
sha256_generic aes_x86_64 aes_generic cbc dm_crypt dm_mod sd_mod ahci libata
scsi_mod thermal uhci_hcd ehci_hcd e1000e [last unloaded: scsi_wait_scan]
[18267.078596]
[18267.078599] Pid: 8196, comm: izlisten Tainted: G        W
2.6.34-rc4-fairlight #339 74663RG/74663RG
[18267.078601] RIP: 0010:[<ffffffffa0048256>]  [<ffffffffa0048256>]
ieee802154_sock_ioctl+0xa7/0x12b [af_802154]
[18267.078606] RSP: 0018:ffff8800b3a05dc8  EFLAGS: 00010292
[18267.078608] RAX: 0000000000000000 RBX: 00000000fffffff2 RCX: 0000000000000303
[18267.078610] RDX: ffff8800b3a05dcd RSI: ffff8800b3a05dcd RDI: 0000000000000001
[18267.078612] RBP: ffff8800b3a05e28 R08: 00007f2502fb66f0 R09: 00007f2502b86dd7
[18267.078615] R10: 00000000fffffff2 R11: 0000000000000246 R12: 0000000000008915
[18267.078617] R13: 00007fff5c0e38b0 R14: 0000000000000000 R15: ffff8800b3a05dc8
[18267.078620] FS:  00007f2502fb66f0(0000) GS:ffff880001800000(0000)
knlGS:0000000000000000
[18267.078622] CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[18267.078624] CR2: 0000000000000180 CR3: 000000004e492000 CR4: 00000000000006f0
[18267.078627] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[18267.078629] DR3: 0000000000000000 DR6: 00000000ffff0ff0 DR7: 0000000000000400
[18267.078632] Process izlisten (pid: 8196, threadinfo ffff8800b3a04000, task
ffff8800b3b50900)
[18267.078633] Stack:
[18267.078635]  000000306e617077 0000000000000000 0000000000000000
0000000000000000
[18267.078638] <0> 0000000000000000 ffff88004e50c8c8 ffff8800b3a05e28
0000000000008915
[18267.078642] <0> 00007fff5c0e38b0 00007fff5c0e38b0 00007fff5c0e38b0
0000000000000000
[18267.078646] Call Trace:
[18267.078652]  [<ffffffff8126082c>] T.1039+0x13/0x32
[18267.078656]  [<ffffffff81260bf4>] sock_ioctl+0x1f8/0x202
[18267.078660]  [<ffffffff810d2171>] vfs_ioctl+0x2d/0xa1
[18267.078663]  [<ffffffff810d2692>] do_vfs_ioctl+0x436/0x47c
[18267.078668]  [<ffffffff810aa5d5>] ? remove_vma+0x69/0x71
[18267.078671]  [<ffffffff810ab800>] ? do_munmap+0x2ee/0x310
[18267.078674]  [<ffffffff810d2729>] sys_ioctl+0x51/0x74
[18267.078678]  [<ffffffff81002a42>] system_call_fastpath+0x16/0x1b
[18267.078680] Code: 0f 85 98 00 00 00 4c 89 fe 48 c7 c7 e0 2e 66 81 c6 45 af 00
e8 a0 7e 22 e1 4c 89 fe 48 c7 c7 e0 2e 66 81 e8 5d 40 22 e1 49 89 c6 <66> 81 b8
80 01 00 00 24 03 75 3d 48 8b 80 58 01 00 00 48 8b 40
[18267.078712] RIP  [<ffffffffa0048256>] ieee802154_sock_ioctl+0xa7/0x12b
[af_802154]
[18267.078716]  RSP <ffff8800b3a05dc8>
[18267.078718] CR2: 0000000000000180
[18267.078739] ---[ end trace ea76fd3c58d10429 ]---

Signed-off-by: Stefan Schmidt <[email protected]>

---

Dmitry, I reproduced this on a laptop with .34-rc4 without any IEEE802154
hardware. Might be good to bring this in as fix during this rc phase.

 net/ieee802154/af_ieee802154.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/net/ieee802154/af_ieee802154.c b/net/ieee802154/af_ieee802154.c
index bad1c49..72340dd 100644
--- a/net/ieee802154/af_ieee802154.c
+++ b/net/ieee802154/af_ieee802154.c
@@ -147,6 +147,9 @@ static int ieee802154_dev_ioctl(struct sock *sk, struct 
ifreq __user *arg,
        dev_load(sock_net(sk), ifr.ifr_name);
        dev = dev_get_by_name(sock_net(sk), ifr.ifr_name);
 
+       if (!dev)
+               return -ENODEV;
+
        if (dev->type == ARPHRD_IEEE802154 && dev->netdev_ops->ndo_do_ioctl)
                ret = dev->netdev_ops->ndo_do_ioctl(dev, &ifr, cmd);
 
-- 
1.7.0.4


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Linux-zigbee-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel

Reply via email to