Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

atm: idt77252: fix null-ptr-dereference

this one is similar to the phy_data allocation fix in uPD98402, the
driver allocate the idt77105_priv and store to dev_data but later
dereference using dev->dev_data, which will cause null-ptr-dereference.

fix this issue by changing dev_data to phy_data so that PRIV(dev) can
work correctly.

Signed-off-by: Tong Zhang <ztong0001@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Tong Zhang and committed by
David S. Miller
4416e985 3153724f

+2 -2
+2 -2
drivers/atm/idt77105.c
··· 262 262 { 263 263 unsigned long flags; 264 264 265 - if (!(dev->dev_data = kmalloc(sizeof(struct idt77105_priv),GFP_KERNEL))) 265 + if (!(dev->phy_data = kmalloc(sizeof(struct idt77105_priv),GFP_KERNEL))) 266 266 return -ENOMEM; 267 267 PRIV(dev)->dev = dev; 268 268 spin_lock_irqsave(&idt77105_priv_lock, flags); ··· 337 337 else 338 338 idt77105_all = walk->next; 339 339 dev->phy = NULL; 340 - dev->dev_data = NULL; 340 + dev->phy_data = NULL; 341 341 kfree(walk); 342 342 break; 343 343 }