mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tong Zhang <ztong0001@gmail.com>
To: Chas Williams <3chas3@gmail.com>,
	linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org
Cc: ztong0001@gmail.com
Subject: [PATCH 3/3] atm: idt77252: fix null-ptr-dereference
Date: Sun,  7 Mar 2021 22:25:30 -0500	[thread overview]
Message-ID: <20210308032529.435224-4-ztong0001@gmail.com> (raw)
In-Reply-To: <20210308032529.435224-1-ztong0001@gmail.com>

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>
---
 drivers/atm/idt77105.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/atm/idt77105.c b/drivers/atm/idt77105.c
index 3c081b6171a8..bfca7b8a6f31 100644
--- a/drivers/atm/idt77105.c
+++ b/drivers/atm/idt77105.c
@@ -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;
             }
-- 
2.25.1


  parent reply	other threads:[~2021-03-08  3:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08  3:25 [PATCH 0/3] fix a couple of atm->phy_data related issues Tong Zhang
2021-03-08  3:25 ` [PATCH 1/3] atm: fix a typo in the struct description Tong Zhang
2021-03-08  3:25 ` [PATCH 2/3] atm: uPD98402: fix incorrect allocation Tong Zhang
2021-03-08  3:25 ` Tong Zhang [this message]
2021-03-08 17:47 ` [PATCH 0/3] fix a couple of atm->phy_data related issues Alexander Duyck
2021-03-08 17:54   ` Tong Zhang
2021-03-08 18:06     ` Alexander Duyck
2021-03-08 18:20       ` Tong Zhang
2021-03-08 23:30 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210308032529.435224-4-ztong0001@gmail.com \
    --to=ztong0001@gmail.com \
    --cc=3chas3@gmail.com \
    --cc=linux-atm-general@lists.sourceforge.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®