Page MenuHomeFreeBSD

D62361.1796389173.diff
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

D62361.1796389173.diff

diff --git a/sys/powerpc/powernv/opal_async.c b/sys/powerpc/powernv/opal_async.c
--- a/sys/powerpc/powernv/opal_async.c
+++ b/sys/powerpc/powernv/opal_async.c
@@ -52,6 +52,7 @@
};
struct async_completion *completions;
+static int ntokens;
/* Setup the token pool. */
int
@@ -65,6 +66,7 @@
M_WAITOK | M_FIRSTFIT);
completions = malloc(count * sizeof(struct async_completion),
M_DEVBUF, M_WAITOK | M_ZERO);
+ ntokens = count;
EVENTHANDLER_REGISTER(OPAL_ASYNC_COMP, opal_handle_async_completion,
NULL, EVENTHANDLER_PRI_ANY);
@@ -117,9 +119,15 @@
static void opal_handle_async_completion(void *arg, struct opal_msg *msg)
{
- int token;
-
- token = msg->params[0];
+ uint64_t token;
+
+ /* OPAL messages are big-endian. */
+ token = be64toh(msg->params[0]);
+ if (token >= ntokens) {
+ printf("OPAL: async completion for bad token %ju\n",
+ (uintmax_t)token);
+ return;
+ }
memcpy(&completions[token].msg, msg, sizeof(*msg));
atomic_thread_fence_rel();
completions[token].completed = true;

File Metadata

Mime Type
text/plain
Expires
Fri, Dec 4, 12:59 PM (21 h, 27 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
42207880
Default Alt Text
D62361.1796389173.diff (1 KB)

Event Timeline