Skip to contentSkip to conversation

atm: null pointer dereference when both entry and holding_time are NULL.

PATCH In review [email protected] 3 participants 3 messages Mar 14, 2025 – Mar 20, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 atm: null pointer dereference when both entry and holding_time are NULL.

From: Minjoong Kim <[email protected]>

When MPOA_cache_impos_rcvd() receives the msg, it can trigger Null Pointer Dereference Vulnerability if both entry and holding_time are NULL. Because there is only for the situation where entry is NULL and holding_time exists, it can be passed when both entry and holding_time are NULL. If these are NULL, the entry will be passd to eg_cache_put() as parameter and it is referenced by entry->use code in it.

Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")
---
 net/atm/mpc.c | 3 +++
 1 file changed, 3 insertions(+)
net/atm/mpc.c +3 -0
index 324e3ab96bb3..7fb854ea47dc 100644
@@ -1314,6 +1314,9 @@ static void MPOA_cache_impos_rcvd(struct k_message *msg,
 	holding_time = msg->content.eg_info.holding_time;
 	dprintk("(%s) entry = %p, holding_time = %u\n",
 		mpc->dev->name, entry, holding_time);
+	if (entry == NULL && !holding_time) {
+		return;
+	}
 	if (entry == NULL && holding_time) {
 		entry = mpc->eg_ops->add_entry(msg, mpc);
 		mpc->eg_ops->put(entry);
Signature · 1 line
2.34.1
reviewer
#1 lore raw
Quoted 10 lines · On Fri, Mar 14, 2025 at 12:34:04AM +0000, [email protected] wrote:

From: Minjoong Kim <[email protected]>

When MPOA_cache_impos_rcvd() receives the msg, it can trigger Null Pointer Dereference Vulnerability if both entry and holding_time are NULL. Because there is only for the situation where entry is NULL and holding_time exists, it can be passed when both entry and holding_time are NULL. If these are NULL, the entry will be passd to eg_cache_put() as parameter and it is referenced by entry->use code in it.

Quoted 2 lines
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")

Hi,

I agree this is a theoretical possibility, but can it occur in practice? Have you observed this problem? I think some analysis of that is warranted.

Also, Smatch tells me that there is a potential dereference of mpc while NULL. Perhaps you could look at making a patch for that too?

maintainer
#2 lore raw
In reply to [email protected]
Quoted 10 lines · On 3/14/25 1:34 AM, [email protected] wrote:

From: Minjoong Kim <[email protected]>

When MPOA_cache_impos_rcvd() receives the msg, it can trigger Null Pointer Dereference Vulnerability if both entry and holding_time are NULL. Because there is only for the situation where entry is NULL and holding_time exists, it can be passed when both entry and holding_time are NULL. If these are NULL, the entry will be passd to eg_cache_put() as parameter and it is referenced by entry->use code in it.

Quoted 2 lines
Fixes 1da177e4c3f4 ("Linux-2.6.12-rc2")

Please include the full splat for such UaF in the commit message

Quoted 9 lines
---
 net/atm/mpc.c | 3 +++
 1 file changed, 3 insertions(+)
net/atm/mpc.c +0 -0
index 324e3ab96bb3..7fb854ea47dc 100644

net/atm/mpc.c static void MPOA_cache_impos_rcvd(struct k_message *msg, · line 1318

Quoted 5 lines
net/atm/mpc.c +2 -0
@@ -1314,6 +1314,9 @@ static void MPOA_cache_impos_rcvd(struct k_message *msg,
 	holding_time = msg->content.eg_info.holding_time;
 	dprintk("(%s) entry = %p, holding_time = %u\n",
 		mpc->dev->name, entry, holding_time);
+	if (entry == NULL && !holding_time) {
+		return;

Brackets are unneeded here.

Thanks,

Paolo