summaryrefslogtreecommitdiff
path: root/drivers/cdrom
diff options
context:
space:
mode:
authorJesper Juhl <jj@chaosbits.net>2011-01-17 13:24:57 +0300
committerDavid S. Miller <davem@davemloft.net>2011-01-19 03:13:49 +0300
commit1956cc52e73984a39252994f0beee458fc0d8909 (patch)
treeaac01b12ee07ed2f5dd03ffdd77daee08ef85461 /drivers/cdrom
parent2fdc1c8093255f9da877d7b9ce3f46c2098377dc (diff)
downloadlinux-1956cc52e73984a39252994f0beee458fc0d8909.tar.xz
ns83820: Avoid bad pointer deref in ns83820_init_one().
In drivers/net/ns83820.c::ns83820_init_one() we dynamically allocate memory via alloc_etherdev(). We then call PRIV() on the returned storage which is 'return netdev_priv()'. netdev_priv() takes the pointer it is passed and adds 'ALIGN(sizeof(struct net_device), NETDEV_ALIGN)' to it and returns it. Then we test the resulting pointer for NULL, which it is unlikely to be at this point, and later dereference it. This will go bad if alloc_etherdev() actually returned NULL. This patch reworks the code slightly so that we test for a NULL pointer (and return -ENOMEM) directly after calling alloc_etherdev(). Signed-off-by: Jesper Juhl <jj@chaosbits.net> Signed-off-by: Benjamin LaHaise <bcrl@kvack.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/cdrom')
0 files changed, 0 insertions, 0 deletions