From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965844AbaCUAIn (ORCPT ); Thu, 20 Mar 2014 20:08:43 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37032 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965825AbaCUAIj (ORCPT ); Thu, 20 Mar 2014 20:08:39 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Edward Cree , Shradha Shah , "David S. Miller" Subject: [PATCH 3.10 09/85] sfc: check for NULL efx->ptp_data in efx_ptp_event Date: Thu, 20 Mar 2014 17:09:12 -0700 Message-Id: <20140321000559.873176591@linuxfoundation.org> X-Mailer: git-send-email 1.9.0 In-Reply-To: <20140321000558.606667505@linuxfoundation.org> References: <20140321000558.606667505@linuxfoundation.org> User-Agent: quilt/0.61-1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Edward Cree [ Upstream commit 8f355e5cee63c2c0c145d8206c4245d0189f47ff ] If we receive a PTP event from the NIC when we haven't set up PTP state in the driver, we attempt to read through a NULL pointer efx->ptp_data, triggering a panic. Signed-off-by: Edward Cree Acked-by: Shradha Shah Signed-off-by: David S. Miller Signed-off-by: Greg Kroah-Hartman --- drivers/net/ethernet/sfc/ptp.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/net/ethernet/sfc/ptp.c +++ b/drivers/net/ethernet/sfc/ptp.c @@ -1319,6 +1319,13 @@ void efx_ptp_event(struct efx_nic *efx, struct efx_ptp_data *ptp = efx->ptp_data; int code = EFX_QWORD_FIELD(*ev, MCDI_EVENT_CODE); + if (!ptp) { + if (net_ratelimit()) + netif_warn(efx, drv, efx->net_dev, + "Received PTP event but PTP not set up\n"); + return; + } + if (!ptp->enabled) return;