From patchwork Wed Sep 30 17:48:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shannon Nelson X-Patchwork-Id: 289277 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D242CC4741F for ; Wed, 30 Sep 2020 17:49:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8CCFC2076A for ; Wed, 30 Sep 2020 17:49:02 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=pensando.io header.i=@pensando.io header.b="XNgATelF" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731405AbgI3RtB (ORCPT ); Wed, 30 Sep 2020 13:49:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35766 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726992AbgI3RtA (ORCPT ); Wed, 30 Sep 2020 13:49:00 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 45AFBC061755 for ; Wed, 30 Sep 2020 10:49:00 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id y14so1507496pgf.12 for ; Wed, 30 Sep 2020 10:49:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pensando.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=fU2c4c7iM/48MX+o4q+fyiFqE7snGU7LBCYm26MndCc=; b=XNgATelFyYMwnBU/kuhCeEYiPiLyRxoEs4FW7+vKX+eQBim9AmrSwCXWbsGIH7PGAx grJa2rGSrYpW+jZke4HYnUpYjYOLzMr+gEOp51VHFrjFNGBdCoidOWhaCVnB0cxiyB35 TVm7RVwKAfXK5CJUNlMj7/dDM8xtP7CE/iwt3NJLVa7dyiZr3nqRpB7UpdTZWPqi6YTw D/EyUBfW5qk9wQ8KsnuB9JG4Lnty3386gVL+Hcncd/+MHGZ/d1WHQRf3Pr7WgayX7iJT Yp9uiFUmln2OXenx6OY/cVsA//nYSjFd4xO+QpL5oJrM0BkbFhow28LyE05kEuYzEHBS CXBg== 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:in-reply-to :references; bh=fU2c4c7iM/48MX+o4q+fyiFqE7snGU7LBCYm26MndCc=; b=WK/Hd0hFCUUwEEekpmxUoaLdj/fDVv2uS7h4MyRMdklVbHk122AnTVFlUg3etbytps EtCTuuJvwskOH8Nzv1Y3qqdNYhNUHiyagoAF19t3a8/k0t5KfzjwGW7TsB/STLqAzYdi 4Qh+aseBzbWX/WVh6ncVTOdBnGSenH7gJ1Yi/s9ia1qjwlyCPZjsgSI/6ixhBqMi04DH I+dTBRzG3uLuFzKmaVgAxZaBeJtJAK5tK+72JRAauselFwb7GuG07q4WZgIwCZrZiE+3 Fss+fIiFigrAypkKe3QrvguqcsypdPcWzm7Q5q8SyAYelMVtSO/PFT6YfqQjCnlMPk4E hpKQ== X-Gm-Message-State: AOAM530u7cPjOPpS28C/cpQoTYD9s1nKXi79czNIayXzwRnSrA8ECnn9 7CQWeoTb2n6T+bzJQyHL7sqTLl+8GuwCrQ== X-Google-Smtp-Source: ABdhPJyYsA0PSOzhF89XtPAjVJ2jIzmJ9Z9e/T7P1idei/kKH+fzHcJrh8UVEjEnrDtOL1JODZJwfA== X-Received: by 2002:a63:f961:: with SMTP id q33mr2832800pgk.95.1601488139510; Wed, 30 Sep 2020 10:48:59 -0700 (PDT) Received: from driver-dev1.pensando.io ([12.226.153.42]) by smtp.gmail.com with ESMTPSA id l13sm2993974pgq.33.2020.09.30.10.48.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 30 Sep 2020 10:48:59 -0700 (PDT) From: Shannon Nelson To: netdev@vger.kernel.org, davem@davemloft.net Cc: Shannon Nelson Subject: [PATCH v2 net-next 2/2] ionic: prevent early watchdog check Date: Wed, 30 Sep 2020 10:48:28 -0700 Message-Id: <20200930174828.39657-3-snelson@pensando.io> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200930174828.39657-1-snelson@pensando.io> References: <20200930174828.39657-1-snelson@pensando.io> Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org In one corner case scenario, the driver device lif setup can get delayed such that the ionic_watchdog_cb() timer goes off before the ionic->lif is set, thus causing a NULL pointer panic. We catch the problem by checking for a NULL lif just a little earlier in the callback. Signed-off-by: Shannon Nelson --- drivers/net/ethernet/pensando/ionic/ionic_dev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c index 16b6b65e8319..545c99b15df8 100644 --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c @@ -19,9 +19,12 @@ static void ionic_watchdog_cb(struct timer_list *t) mod_timer(&ionic->watchdog_timer, round_jiffies(jiffies + ionic->watchdog_period)); + if (!ionic->lif) + return; + hb = ionic_heartbeat_check(ionic); - if (hb >= 0 && ionic->lif) + if (hb >= 0) ionic_link_status_check_request(ionic->lif, false); }