Commit 388fd34d authored by Wujiahai's avatar Wujiahai Committed by Peng Zhang
Browse files

BMA: Fix Oops and spin lock deadlock problem, and change the version number.

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IBD74A


CVE: NA

-----------------------------------------

1. Prevents iBMA driver from causing Oops problems.
2. The spin lock deadlock bug of the ibma iBMA is fixed.
3. Change the iBMA driver version.

Fixes: f0db1bf5 ("Huawei BMA: Adding Huawei BMA driver: host_edma_drv")
Signed-off-by: default avatarWujiahai <wujiahai@huawei.com>
parent 0e868d3d
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@
#ifdef DRV_VERSION
#define CDEV_VERSION		MICRO_TO_STR(DRV_VERSION)
#else
#define CDEV_VERSION		"0.3.8"
#define CDEV_VERSION		"0.3.10"
#endif

#define CDEV_DEFAULT_NUM	4
+8 −1
Original line number Diff line number Diff line
@@ -135,6 +135,7 @@ static void bma_priv_clean_up(struct bma_priv_data_s *bma_priv)
	int i = 0;
	struct bma_priv_data_s *priv = bma_priv;
	struct edma_recv_msg_s *msg = NULL;
	unsigned long flags = 0;

	if (!priv)
		return;
@@ -144,6 +145,7 @@ static void bma_priv_clean_up(struct bma_priv_data_s *bma_priv)
		return;
	}

	spin_lock_irqsave(&priv->recv_msg_lock, flags);
	for (i = 0; i < priv->user.max_recvmsg_nums; i++) {
		ret = edma_host_recv_msg(&g_bma_dev->edma_host, priv, &msg);
		if (ret)
@@ -151,6 +153,7 @@ static void bma_priv_clean_up(struct bma_priv_data_s *bma_priv)

		kfree(msg);
	}
	spin_unlock_irqrestore(&priv->recv_msg_lock, flags);

	priv->user.type = TYPE_UNKNOWN;
	priv->user.sub_type = 0;
@@ -419,7 +422,8 @@ EXPORT_SYMBOL(bma_intf_int_to_bmc);

int bma_intf_is_link_ok(void)
{
	if (g_bma_dev->edma_host.statistics.remote_status == REGISTERED)
	if (g_bma_dev &&
	    g_bma_dev->edma_host.statistics.remote_status == REGISTERED)
		return 1;
	return 0;
}
@@ -431,6 +435,7 @@ int bma_cdev_recv_msg(void *handle, char __user *data, size_t count)
	struct edma_recv_msg_s *msg = NULL;
	int result = 0;
	int len = 0;
	unsigned long flags = 0;

	if (!handle || !data || count == 0) {
		BMA_LOG(DLOG_DEBUG, "input NULL point!\n");
@@ -439,7 +444,9 @@ int bma_cdev_recv_msg(void *handle, char __user *data, size_t count)

	priv = (struct bma_priv_data_s *)handle;

	spin_lock_irqsave(&priv->recv_msg_lock, flags);
	result = edma_host_recv_msg(&g_bma_dev->edma_host, priv, &msg);
	spin_unlock_irqrestore(&priv->recv_msg_lock, flags);
	if (result != 0)
		return -ENODATA;

+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ struct bma_pci_dev_s {
#ifdef DRV_VERSION
#define BMA_VERSION MICRO_TO_STR(DRV_VERSION)
#else
#define BMA_VERSION "0.3.8"
#define BMA_VERSION "0.3.10"
#endif

#ifdef CONFIG_ARM64
+0 −9
Original line number Diff line number Diff line
@@ -1069,21 +1069,14 @@ int edma_host_recv_msg(struct edma_host_s *edma_host,
		       struct bma_priv_data_s *priv,
		       struct edma_recv_msg_s **msg)
{
	unsigned long flags = 0;
	struct list_head *entry = NULL;
	struct edma_recv_msg_s *msg_tmp = NULL;
	struct bma_dev_s *bma_dev = NULL;

	if (!edma_host || !priv || !msg)
		return -EAGAIN;

	bma_dev = list_entry(edma_host, struct bma_dev_s, edma_host);

	spin_lock_irqsave(&bma_dev->priv_list_lock, flags);

	if (list_empty(&priv->recv_msgs)) {
		priv->user.cur_recvmsg_nums = 0;
		spin_unlock_irqrestore(&bma_dev->priv_list_lock, flags);
		BMA_LOG(DLOG_DEBUG, "recv msgs empty\n");
		return -EAGAIN;
	}
@@ -1095,8 +1088,6 @@ int edma_host_recv_msg(struct edma_host_s *edma_host,
	if (priv->user.cur_recvmsg_nums > 0)
		priv->user.cur_recvmsg_nums--;

	spin_unlock_irqrestore(&bma_dev->priv_list_lock, flags);

	*msg = msg_tmp;

	BMA_LOG(DLOG_DEBUG, "msg->msg_len = %d\n", (int)msg_tmp->msg_len);
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
#ifdef DRV_VERSION
#define KBOX_VERSION MICRO_TO_STR(DRV_VERSION)
#else
#define KBOX_VERSION "0.3.8"
#define KBOX_VERSION "0.3.10"
#endif

#define UNUSED(x) (x = x)
Loading