Skip to contentSkip to conversation

Staging: ozwpan: prevent bogus dereference

PATCH In review Dan Carpenter 2 participants 2 messages Mar 2, 2012

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

PATCH 1/1 Staging: ozwpan: prevent bogus dereference

app_id comes from the network and can't be trusted. If it's zero then it will lead to a kernel crash.

drivers/staging/ozwpan/ozpd.c +1 -1
index 8c460f0..e3381ad 100644
@@ -806,7 +806,7 @@ void oz_apps_term(void)
 void oz_handle_app_elt(struct oz_pd *pd, u8 app_id, struct oz_elt *elt)
 {
 	struct oz_app_if *ai;
-	if (app_id > OZ_APPID_MAX)
+	if (app_id = 0 || app_id > OZ_APPID_MAX)
 		return;
 	ai = &g_app_if[app_id-1];
 	ai->rx(pd, elt);
Acked-by on v1 1/1
#1 lore raw
Quoted 3 lines · Dan Carpenter

app_id comes from the network and can't be trusted. If it's zero then it will lead to a kernel crash.

Many thanks
Chris

Quoted 10 lines
drivers/staging/ozwpan/ozpd.c +1 -1
@@ -806,7 +806,7 @@ void oz_apps_term(void)  void oz_handle_app_elt(struct oz_pd *pd, u8 app_id, struct > > oz_elt *elt)  {
 	struct oz_app_if *ai;
-	if (app_id > OZ_APPID_MAX)
+	if (app_id = 0 || app_id > OZ_APPID_MAX)
 		return;
 	ai = &g_app_if[app_id-1];
 	ai->rx(pd, elt);