From: Wujiahai wujiahai@huawei.com
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: ea190d90c609 ("Huawei BMA: Adding Huawei BMA driver: host_edma_drv") Signed-off-by: Wujiahai wujiahai@huawei.com --- drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c | 2 +- drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.c | 10 ++++++++-- drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.h | 2 +- drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c | 9 --------- .../net/ethernet/huawei/bma/kbox_drv/kbox_include.h | 2 +- drivers/net/ethernet/huawei/bma/veth_drv/veth_hb.h | 2 +- 6 files changed, 12 insertions(+), 15 deletions(-)
diff --git a/drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c b/drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c index 4be8a4fc6cec..275c2cdfe5db 100644 --- a/drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c +++ b/drivers/net/ethernet/huawei/bma/cdev_drv/bma_cdev.c @@ -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 diff --git a/drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.c b/drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.c index 556130ab8a65..baa65b8885ff 100644 --- a/drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.c +++ b/drivers/net/ethernet/huawei/bma/edma_drv/bma_devintf.c @@ -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,8 +422,8 @@ EXPORT_SYMBOL(bma_intf_int_to_bmc);
int bma_intf_is_link_ok(void) { - if ((&g_bma_dev->edma_host != NULL) && - (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; } @@ -432,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"); @@ -440,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;
diff --git a/drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.h b/drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.h index d1c62a77a434..7639b11a3f50 100644 --- a/drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.h +++ b/drivers/net/ethernet/huawei/bma/edma_drv/bma_pci.h @@ -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 diff --git a/drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c b/drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c index 4641e359e8fc..d9da64b94eb9 100644 --- a/drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c +++ b/drivers/net/ethernet/huawei/bma/edma_drv/edma_host.c @@ -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); diff --git a/drivers/net/ethernet/huawei/bma/kbox_drv/kbox_include.h b/drivers/net/ethernet/huawei/bma/kbox_drv/kbox_include.h index 8371903e2c33..0d82ee6f7c83 100644 --- a/drivers/net/ethernet/huawei/bma/kbox_drv/kbox_include.h +++ b/drivers/net/ethernet/huawei/bma/kbox_drv/kbox_include.h @@ -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) diff --git a/drivers/net/ethernet/huawei/bma/veth_drv/veth_hb.h b/drivers/net/ethernet/huawei/bma/veth_drv/veth_hb.h index f03e6eccde6c..242d3ec128d3 100644 --- a/drivers/net/ethernet/huawei/bma/veth_drv/veth_hb.h +++ b/drivers/net/ethernet/huawei/bma/veth_drv/veth_hb.h @@ -31,7 +31,7 @@ extern "C" { #ifdef DRV_VERSION #define VETH_VERSION MICRO_TO_STR(DRV_VERSION) #else -#define VETH_VERSION "0.3.8" +#define VETH_VERSION "0.3.10" #endif
#define MODULE_NAME "veth"
反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/14748 邮件列表地址:https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/E...
FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/14748 Mailing list address: https://mailweb.openeuler.org/hyperkitty/list/kernel@openeuler.org/message/E...