Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 35ea4352 authored by Deepak Kumar Singh's avatar Deepak Kumar Singh
Browse files

net: qrtr: mhi: check whether ul pkt list is empty



list_first_entry should not be called for empty list.

Add check for empty list before calling list_first_entry.

CRs-Fixed: 2596626
Change-Id: Ie6be42f6aa4915e1495b87faf5a0d933086b9d01
Signed-off-by: default avatarDeepak Kumar Singh <deesin@codeaurora.org>
parent 7764f1a9
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0-only
/* Copyright (c) 2018-2019, The Linux Foundation. All rights reserved. */
/* Copyright (c) 2018-2020, The Linux Foundation. All rights reserved. */

#include <linux/module.h>
#include <linux/skbuff.h>
@@ -63,6 +63,11 @@ static void qcom_mhi_qrtr_ul_callback(struct mhi_device *mhi_dev,
	unsigned long flags;

	spin_lock_irqsave(&qdev->ul_lock, flags);
	if (list_empty(&qdev->ul_pkts)) {
		spin_unlock_irqrestore(&qdev->ul_lock, flags);
		dev_err(qdev->dev, "ul_pkt list is empty\n");
		return;
	}
	pkt = list_first_entry(&qdev->ul_pkts, struct qrtr_mhi_pkt, node);
	list_del(&pkt->node);
	complete_all(&pkt->done);