The existing code was not taking into consideration that when the
table of ECBs needs to be expanded, the memory allocation can fail.
This could lead to a NULL pointer access, and a kernel crash. We
now check the result of the allocation, and bail out if it fails.
Orabug:
26503342
Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com>
Reviewed-by: Tomas Jedlicka <tomas.jedlicka@oracle.com>
}
ecbs = vzalloc(necbs * sizeof(*ecbs));
+ if (ecbs == NULL) {
+ kfree(ecb);
+ return NULL;
+ }
+
if (oecbs != NULL)
memcpy(ecbs, oecbs, state->dts_necbs * sizeof(*ecbs));
ASSERT(state != NULL);
ecb = dtrace_ecb_add(state, probe);
+ if (ecb == NULL)
+ return NULL;
+
ecb->dte_uarg = desc->dted_uarg;
if ((pred = desc->dted_pred.dtpdd_predicate) != NULL) {