mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 09:14:19 +08:00
net: hns: dereference ppe_cb->ppe_common_cb if it is non-null
ppe_cb->ppe_common_cb is being dereferenced before a null check is being made on it. If ppe_cb->ppe_common_cb is null then we end up with a null pointer dereference when assigning dsaf_dev. Fix this by moving the initialisation of dsaf_dev once we know ppe_cb->ppe_common_cb is OK to dereference. Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Yisen Zhuang <yisen.zhuang@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
b628d611a2
commit
c234af5875
@ -328,9 +328,10 @@ static void hns_ppe_init_hw(struct hns_ppe_cb *ppe_cb)
|
||||
static void hns_ppe_uninit_hw(struct hns_ppe_cb *ppe_cb)
|
||||
{
|
||||
u32 port;
|
||||
struct dsaf_device *dsaf_dev = ppe_cb->ppe_common_cb->dsaf_dev;
|
||||
|
||||
if (ppe_cb->ppe_common_cb) {
|
||||
struct dsaf_device *dsaf_dev = ppe_cb->ppe_common_cb->dsaf_dev;
|
||||
|
||||
port = ppe_cb->index;
|
||||
dsaf_dev->misc_op->ppe_srst(dsaf_dev, port, 0);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user