lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190311063343.20188-1-kjlu@umn.edu>
Date:   Mon, 11 Mar 2019 01:33:43 -0500
From:   Kangjie Lu <kjlu@....edu>
To:     kjlu@....edu
Cc:     pakki001@....edu, Saeed Mahameed <saeedm@...lanox.com>,
        Leon Romanovsky <leon@...nel.org>,
        "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
        linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] net: mlx5: fix a potential NULL pointer dereference

In case skb_header_pointer fails, the fix issues a warning.

A better fix requires modifying the signature of mlx5e_get_fcs to
pass an error code upstream.

Signed-off-by: Kangjie Lu <kjlu@....edu>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_rx.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
index be396e5e4e39..6ec1c110e4be 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rx.c
@@ -719,6 +719,8 @@ static u32 mlx5e_get_fcs(const struct sk_buff *skb)
 
 	fcs_bytes = skb_header_pointer(skb, skb->len - ETH_FCS_LEN,
 				       ETH_FCS_LEN, &_fcs_bytes);
+	if (unlikely(!fcs_bytes))
+		pr_warn_once("skb_header_pointer returns NULL\n");
 
 	return __get_unaligned_cpu32(fcs_bytes);
 }
-- 
2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ