From: Junxin Chen chenjunxin1@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
----------------------------------
Nowadays, we have checked device name at user tool, and have limited length of device name at kernel driver. But when get_netdev_by_ifname return NULL, it would cause print device name without check terminator.
This patch fixes this bug, when device name's last character isn't a '\0', kernel driver would return -EINVAL to user.
Signed-off-by: Junxin Chen chenjunxin1@huawei.com Reviewed-by: Weiwei Deng dengweiwei@huawei.com Reviewed-by: Shengzui You youshengzui@huawei.com Reviewed-by: Zhaohui Zhong zhongzhaohui@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_init.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_init.c b/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_init.c index 7c084a6fbe18..1e012917e010 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_init.c +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_init.c @@ -335,6 +335,11 @@ static long hns3_cae_k_unlocked_ioctl(struct file *pfile, unsigned int cmd, * code yet, so we don't need lock. */ rtnl_lock(); + if (nt_msg.device_name[IFNAMSIZ - 1] != '\0') { + pr_err("the device name is invalid.\n"); + ret = -EINVAL; + goto out_invalid; + } ret = hns3_cae_k_get_netdev_by_ifname(nt_msg.device_name, &nic_dev); if (ret) { pr_err("can not get the netdevice correctly\n");
From: Shengzui You youshengzui@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
--------------------------------
This patch is used to update driver version to 1.9.38.1.
Signed-off-by: Shengzui You youshengzui@huawei.com Reviewed-by: Weiwei Deng dengweiwei@huawei.com Reviewed-by: Zhaohui Zhong zhongzhaohui@huawei.com Reviewed-by: Junxin Chen chenjunxin1@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/net/ethernet/hisilicon/hns3/hnae3.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_version.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3_enet.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h | 2 +- drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hns3/hnae3.h b/drivers/net/ethernet/hisilicon/hns3/hnae3.h index 0d38826c3299..fef4dd656bc3 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hnae3.h +++ b/drivers/net/ethernet/hisilicon/hns3/hnae3.h @@ -30,7 +30,7 @@ #include <linux/pci.h> #include <linux/types.h>
-#define HNAE3_MOD_VERSION "1.9.38.0" +#define HNAE3_MOD_VERSION "1.9.38.1"
#define HNAE3_MIN_VECTOR_NUM 2 /* first one for misc, another for IO */
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_version.h b/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_version.h index d8dbc6206048..be9b3e1d9919 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_version.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_cae/hns3_cae_version.h @@ -4,7 +4,7 @@ #ifndef __HNS3_CAE_VERSION_H__ #define __HNS3_CAE_VERSION_H__
-#define HNS3_CAE_MOD_VERSION "1.9.38.0" +#define HNS3_CAE_MOD_VERSION "1.9.38.1"
#define CMT_ID_LEN 8 #define RESV_LEN 3 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h index 850679145d76..158e6264dc7b 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3_enet.h @@ -8,7 +8,7 @@
#include "hnae3.h"
-#define HNS3_MOD_VERSION "1.9.38.0" +#define HNS3_MOD_VERSION "1.9.38.1"
extern char hns3_driver_version[];
diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h index 14e6e8a7d288..2a6cc2388cb0 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3pf/hclge_main.h @@ -12,7 +12,7 @@ #include "hclge_cmd.h" #include "hnae3.h"
-#define HCLGE_MOD_VERSION "1.9.38.0" +#define HCLGE_MOD_VERSION "1.9.38.1" #define HCLGE_DRIVER_NAME "hclge"
#define HCLGE_MAX_PF_NUM 8 diff --git a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h index 864b1f8607de..51fc8d98df04 100644 --- a/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h +++ b/drivers/net/ethernet/hisilicon/hns3/hns3vf/hclgevf_main.h @@ -10,7 +10,7 @@ #include "hclgevf_cmd.h" #include "hnae3.h"
-#define HCLGEVF_MOD_VERSION "1.9.38.0" +#define HCLGEVF_MOD_VERSION "1.9.38.1" #define HCLGEVF_DRIVER_NAME "hclgevf"
#define HCLGEVF_MAX_VLAN_ID 4095
From: Yu'an Wang wangyuan46@huawei.com
driver inclusion category: bugfix bugzilla: NA CVE: NA
In this patch, we try to add parameter check of uacce_hw_err_isolate/ uacce_wake_up/uacce_register, which can avoid risk.
Signed-off-by: Yu'an Wang wangyuan46@huawei.com Reviewed-by: Weiwei Deng dengweiwei@huawei.com Reviewed-by: Cheng Hu hucheng.hu@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- drivers/uacce/uacce.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/drivers/uacce/uacce.c b/drivers/uacce/uacce.c index 35c721826104..5b48a688768d 100644 --- a/drivers/uacce/uacce.c +++ b/drivers/uacce/uacce.c @@ -79,10 +79,14 @@ EXPORT_SYMBOL_GPL(dev_to_uacce); */ int uacce_hw_err_isolate(struct uacce *uacce) { - struct uacce_err_isolate *isolate = uacce->isolate; struct uacce_hw_err *err, *tmp, *hw_err; + struct uacce_err_isolate *isolate; u32 count = 0;
+ if (!uacce) + return -EINVAL; + isolate = uacce->isolate; + #define SECONDS_PER_HOUR 3600
/* all the hw errs are processed by PF driver */ @@ -134,7 +138,9 @@ EXPORT_SYMBOL_GPL(uacce_qfrt_str); */ void uacce_wake_up(struct uacce_queue *q) { - dev_dbg(&q->uacce->dev, "wake up\n"); + if (!q) + return; + wake_up_interruptible(&q->wait); } EXPORT_SYMBOL_GPL(uacce_wake_up); @@ -1249,13 +1255,17 @@ static int uacce_default_start_queue(struct uacce_queue *q) */ int uacce_register(struct uacce *uacce) { - struct device *dev = uacce->pdev; + struct device *dev; int ret;
- if (!dev) { + if (!uacce) + return -ENODEV; + + if (!uacce->pdev) { pr_err("uacce parent device not set\n"); return -ENODEV; } + dev = uacce->pdev;
if (uacce->flags & UACCE_DEV_NOIOMMU) { add_taint(TAINT_CRAP, LOCKDEP_STILL_OK);