Skip to content

Commit

Permalink
modem: cmux: Prevent NULL deref in dlci_open_handler
Browse files Browse the repository at this point in the history
Prevent unlikely item == NULL scenario (CID 323102) and remove
superflous cmux == NULL check (CID 334903)

(cherry picked from commit cc3076b)

Original-Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
GitOrigin-RevId: cc3076b
Change-Id: I910d3e00bac478894de13a48380d0f3ffb50dfbc
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5299387
Tested-by: Fabio Baltieri <fabiobaltieri@google.com>
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com>
  • Loading branch information
bjarki-andreasen authored and Chromeos LUCI committed Feb 15, 2024
1 parent 139bff6 commit 9448a26
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions subsys/modem/modem_cmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1015,13 +1015,16 @@ struct modem_pipe_api modem_cmux_dlci_pipe_api = {

static void modem_cmux_dlci_open_handler(struct k_work *item)
{
struct k_work_delayable *dwork = k_work_delayable_from_work(item);
struct modem_cmux_dlci *dlci = CONTAINER_OF(dwork, struct modem_cmux_dlci, open_work);
struct k_work_delayable *dwork;
struct modem_cmux_dlci *dlci;

if (dlci == NULL) {
if (item == NULL) {
return;
}

dwork = k_work_delayable_from_work(item);
dlci = CONTAINER_OF(dwork, struct modem_cmux_dlci, open_work);

dlci->state = MODEM_CMUX_DLCI_STATE_OPENING;

struct modem_cmux_frame frame = {
Expand Down

0 comments on commit 9448a26

Please sign in to comment.