From: Dan Carpenter Date: Fri, 2 Mar 2012 06:59:55 +0000 (+0300) Subject: Staging: ozwpan: prevent bogus dereference X-Git-Tag: MMI-PSA29.97-13-9~17268^2~86 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=92a6253299d74833a36edb94d5a4bc541418b17a;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git 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. Signed-off-by: Dan Carpenter Acked-by: Chris Kelly Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/ozwpan/ozpd.c b/drivers/staging/ozwpan/ozpd.c index 8c460f075aec..e3381add51a4 100644 --- a/drivers/staging/ozwpan/ozpd.c +++ b/drivers/staging/ozwpan/ozpd.c @@ -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);