]> git.baikalelectronics.ru Git - kernel.git/commitdiff
atm: idt77252: fix null-ptr-dereference
authorTong Zhang <ztong0001@gmail.com>
Mon, 8 Mar 2021 03:25:30 +0000 (22:25 -0500)
committerDavid S. Miller <davem@davemloft.net>
Mon, 8 Mar 2021 23:16:30 +0000 (15:16 -0800)
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>
drivers/atm/idt77105.c

index 3c081b6171a8fc39ffd3ac2535533861ffc14d9f..bfca7b8a6f31e8c04b3dd6be960c45bbb8029021 100644 (file)
@@ -262,7 +262,7 @@ static int idt77105_start(struct atm_dev *dev)
 {
        unsigned long flags;
 
-       if (!(dev->dev_data = kmalloc(sizeof(struct idt77105_priv),GFP_KERNEL)))
+       if (!(dev->phy_data = kmalloc(sizeof(struct idt77105_priv),GFP_KERNEL)))
                return -ENOMEM;
        PRIV(dev)->dev = dev;
        spin_lock_irqsave(&idt77105_priv_lock, flags);
@@ -337,7 +337,7 @@ static int idt77105_stop(struct atm_dev *dev)
                 else
                     idt77105_all = walk->next;
                dev->phy = NULL;
-                dev->dev_data = NULL;
+                dev->phy_data = NULL;
                 kfree(walk);
                 break;
             }