Skip to content

Commit

Permalink
modem: cmux: Prevent NULL deref in dlci_close_handler
Browse files Browse the repository at this point in the history
Prevent unlikely item == NULL scenario identifed by CID
323104

(cherry picked from commit 793c507)

Original-Signed-off-by: Bjarki Arge Andreasen <bjarki@arge-andreasen.me>
GitOrigin-RevId: 793c507
Change-Id: If57c55ee9916cbd14f14e35ddbdf386fe114ed75
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/zephyr/+/5299388
Commit-Queue: Fabio Baltieri <fabiobaltieri@google.com>
Reviewed-by: Fabio Baltieri <fabiobaltieri@google.com>
Tested-by: Fabio Baltieri <fabiobaltieri@google.com>
Tested-by: ChromeOS Prod (Robot) <chromeos-ci-prod@chromeos-bot.iam.gserviceaccount.com>
  • Loading branch information
bjarki-andreasen authored and Chromeos LUCI committed Feb 15, 2024
1 parent 9448a26 commit de34462
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions subsys/modem/modem_cmux.c
Original file line number Diff line number Diff line change
Expand Up @@ -1042,14 +1042,18 @@ static void modem_cmux_dlci_open_handler(struct k_work *item)

static void modem_cmux_dlci_close_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, close_work);
struct modem_cmux *cmux = dlci->cmux;
struct k_work_delayable *dwork;
struct modem_cmux_dlci *dlci;
struct modem_cmux *cmux;

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

dwork = k_work_delayable_from_work(item);
dlci = CONTAINER_OF(dwork, struct modem_cmux_dlci, close_work);
cmux = dlci->cmux;

dlci->state = MODEM_CMUX_DLCI_STATE_CLOSING;

struct modem_cmux_frame frame = {
Expand Down

0 comments on commit de34462

Please sign in to comment.