Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp826069imc; Sun, 10 Mar 2019 23:34:38 -0700 (PDT) X-Google-Smtp-Source: APXvYqxOIGB4jmlDJjesWKcn3qX88TDMKrS9J0m38r9Jlo1AEECNjsBTJXoyovzUqqGteli8cUKu X-Received: by 2002:a17:902:2a69:: with SMTP id i96mr32216393plb.58.1552286078458; Sun, 10 Mar 2019 23:34:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552286078; cv=none; d=google.com; s=arc-20160816; b=lwgSxJFb3XyHEzvXJjIwrjLiPW2sAJG4HgU8cbfQb0qlm4SDrNNqums/fJBT7zmIpM U9WgamBNjunRMlUYIUbDk7RtoW+bXYHgJ+Kz5pW08mScZF2t49CgePlvuTlTVmzNKfsV xGNyaexp1WHFveEanlhy8SOLLRFVp/LMPL4BtyuezMsJxegrX5eybZ9Z8k0O08aGZ2+S uEg38ScnGrJaHS/fVyXrbv3NekJVsDGDj9CHhYdg6F0MQTXZhPjNjS4Wq4tR7NQLobdO Ngc2BkLR3VG1I0svokrR5TAQuHudLQXFh/BCq9uytEJPgY8GiO//ctxCNcTM0kDo1j9H +2tg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=HC/jRjq2phMSTGGfJQP8OUUC/tIZ0jS+Ie8QCGCbJJI=; b=xnwsn5tSH2G6tcodK7flChvDWQdRjWVxntHoyCLXqfx1wTM9nVHAtND8nVa232No0x 2265cWqcemU8IUBVvc2lFxE0Uxt+Q9NQ+gSxeyRsNzR0qj3/RIW9/RL9BYH6uCv7q2sT h18nR8K6Jt/phET1uM+iOuerCW9dA7zQvND+XiruFEb2R4AUvmsAAf3qL2NdLMBw6g11 6x/YwW/5JBhVI7v7xBJ77brgz0iwBxraW9x5RN5HPTIYi8GtjuX0C2yJZ06yJrkmqNzA Yhodcsugy0h2oTuKctofa2j+kDcPt1YOnjK6rnM2wjWUwGzm1eao83JFidpXYMefPNTr wn+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umn.edu header.s=google header.b=osfwyC+O; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j9si4640019plk.359.2019.03.10.23.34.22; Sun, 10 Mar 2019 23:34:38 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@umn.edu header.s=google header.b=osfwyC+O; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=umn.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725850AbfCKGeC (ORCPT + 99 others); Mon, 11 Mar 2019 02:34:02 -0400 Received: from mta-p8.oit.umn.edu ([134.84.196.208]:47334 "EHLO mta-p8.oit.umn.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725831AbfCKGeB (ORCPT ); Mon, 11 Mar 2019 02:34:01 -0400 Received: from localhost (unknown [127.0.0.1]) by mta-p8.oit.umn.edu (Postfix) with ESMTP id 46CEA98E for ; Mon, 11 Mar 2019 06:34:00 +0000 (UTC) X-Virus-Scanned: amavisd-new at umn.edu Received: from mta-p8.oit.umn.edu ([127.0.0.1]) by localhost (mta-p8.oit.umn.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id U_x31AY2hxov for ; Mon, 11 Mar 2019 01:34:00 -0500 (CDT) Received: from mail-io1-f71.google.com (mail-io1-f71.google.com [209.85.166.71]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mta-p8.oit.umn.edu (Postfix) with ESMTPS id 1D4A693A for ; Mon, 11 Mar 2019 01:34:00 -0500 (CDT) Received: by mail-io1-f71.google.com with SMTP id n15so3468696ioc.0 for ; Sun, 10 Mar 2019 23:34:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umn.edu; s=google; h=from:to:cc:subject:date:message-id; bh=HC/jRjq2phMSTGGfJQP8OUUC/tIZ0jS+Ie8QCGCbJJI=; b=osfwyC+OhFdcJQ+zllgvpJo6IXVSuwBO3tCffNA00sHPH1xyrKHnzSF2tPjLfS7xci +FZTFDjDbPfPS9zvpI7qo2zY9zL9XaAewhDYO7wGOX/91FA8Rai9I/bLIBTputhe2DWB 30mK6boCHHfxVQnvrNT3G2rZ1jarFcD/Ym+K2inHxjjDNkZjsOpmn4GULLz83lDItYAv fMHoVJR1YmMocGfNAbxaKvv26vOLrhtAPT/pgmDXL+yWTRjOiZwXu+xANJZ0jp34MKR0 H3dUIyiv3X5PdoCiwrhgEZHib1YxLlcC7/9Fdtqp6jJLAb53SJbyJvDiW30MzQw57dgg rbaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=HC/jRjq2phMSTGGfJQP8OUUC/tIZ0jS+Ie8QCGCbJJI=; b=Viy2zA3U9f7fR7wBJnHLIWlyTizUz/+DPFHnI+/JWF3g67B87Ca14PFWzQxjN/kD01 HPzzT4elisnb+MbcquxdlEKPHZq4hFujoUOl4jUrii9W5G8dZBRSG0cgmpnBzdaZE3+p rNErB2VEROYDN8KRSNnD0q08y7dHRssXd+xhB8a8VTL4skYastr17rgyvlBdaqp+GicI fg4qL87cQioEDDtBpxUjoTo1Yu1Ae23ySuF5a1Fi7UfNuHb7lxFfACQtxeJ9HtrAjwPA 1ZP2ezAvOY6YGGMcSD9+ZXKB7oI2F7Dy7eIXKTXWDlYP8U88soYUfiUTZnsVsx6itEwh NtrA== X-Gm-Message-State: APjAAAWKLVB2B6Y/uV3o9BiO/dNC0qQ5/wxFk3/cEM8PUAx0tKcemYif Ao8Qs0mwhbt9xMblLiXBefv92BUq4+56RetSWxnZZPBca7b0nU3pXQjFAMeCeHV/Iej1oJvXrz0 wQEk8W+X7XtruJ2BCxg3X0MPbIt77 X-Received: by 2002:a5d:88c1:: with SMTP id i1mr14782588iol.50.1552286039700; Sun, 10 Mar 2019 23:33:59 -0700 (PDT) X-Received: by 2002:a5d:88c1:: with SMTP id i1mr14782578iol.50.1552286039428; Sun, 10 Mar 2019 23:33:59 -0700 (PDT) Received: from bee.dtc.umn.edu (cs-bee-u.cs.umn.edu. [128.101.106.63]) by smtp.gmail.com with ESMTPSA id u196sm9342507itu.34.2019.03.10.23.33.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 10 Mar 2019 23:33:58 -0700 (PDT) From: Kangjie Lu To: kjlu@umn.edu Cc: pakki001@umn.edu, Saeed Mahameed , Leon Romanovsky , "David S. Miller" , netdev@vger.kernel.org, linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] net: mlx5: fix a potential NULL pointer dereference Date: Mon, 11 Mar 2019 01:33:43 -0500 Message-Id: <20190311063343.20188-1-kjlu@umn.edu> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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