Skip to content

Commit ac7460e

Browse files
committed
i3c: rtio: deal with rtio_cqe_consume() returning NULL
rtio_cqe_consume() may return NULL so we need to check before using any members of the returned struct. Fixes #90473 Fixes #90489 Fixes #90497 Signed-off-by: Daniel Leung <daniel.leung@intel.com>
1 parent 8a0530c commit ac7460e

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

drivers/i3c/i3c_rtio.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,11 @@ int i3c_rtio_configure(struct i3c_rtio *ctx, enum i3c_config_type type, void *co
182182
rtio_submit(r, 1);
183183

184184
cqe = rtio_cqe_consume(r);
185-
res = cqe->result;
185+
if (cqe != NULL) {
186+
res = cqe->result;
187+
} else {
188+
ret = -EIO;
189+
}
186190
rtio_cqe_release(r, cqe);
187191

188192
out:
@@ -214,7 +218,11 @@ int i3c_rtio_ccc(struct i3c_rtio *ctx, struct i3c_ccc_payload *payload)
214218
rtio_submit(r, 1);
215219

216220
cqe = rtio_cqe_consume(r);
217-
res = cqe->result;
221+
if (cqe != NULL) {
222+
res = cqe->result;
223+
} else {
224+
ret = -EIO;
225+
}
218226
rtio_cqe_release(r, cqe);
219227

220228
out:
@@ -245,7 +253,11 @@ int i3c_rtio_recover(struct i3c_rtio *ctx)
245253
rtio_submit(r, 1);
246254

247255
cqe = rtio_cqe_consume(r);
248-
res = cqe->result;
256+
if (cqe != NULL) {
257+
res = cqe->result;
258+
} else {
259+
ret = -EIO;
260+
}
249261
rtio_cqe_release(r, cqe);
250262

251263
out:

0 commit comments

Comments
 (0)