Received: by 10.213.65.68 with SMTP id h4csp145392imn; Mon, 12 Mar 2018 22:19:11 -0700 (PDT) X-Google-Smtp-Source: AG47ELvIW/AtmE66aEjRfVGU79FHpirn+byDUZ4rHkIGTi1Odn4Zs/Gre+KNIki0KTHWyrBYJ676 X-Received: by 2002:a17:902:b582:: with SMTP id a2-v6mr10814214pls.353.1520918351289; Mon, 12 Mar 2018 22:19:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520918351; cv=none; d=google.com; s=arc-20160816; b=MipF6AbITHQeJqIel+eh1usHrAd2863d///oDov2D9I7+B6USxLgF5dK6r3YzXMkac HrKQPNVpszqUz6ti21Wv3PINhABOfDLv6+jYLfS4B0w2b784ioBWGsC/DIvamXaDKX6L t/eW9j16G47PGKnyaC+4PYwHbThWuWG5XetaQtKIfP7N+HKeK4fe+9e4tmtO5HdGIoEL +VGlLEl+6imYkM/vbsJYaiei33G7VtVjx7eut/5VhjzeZwYkQZ0QibtEoSTpfD/Q1zTy UuJm+xPn6PwIhIEJf1xNNpEmqdRiJmEhLsxzFBB+jPteEHz9G4+3tq96PveUA/XsunQZ pI2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=0fU8BHKc6qdxM6D9uAz1kxmQRSyZl337IwCo36G8Fbw=; b=G8f3eSdMRgvgSlq0hU4MYD14+XlXvm94kPIcbvVq/K+zrVBsENkzsHj/zX84FjyWCU 9JkVk1BZ2KSpmkvlkHAMADR0k75GyYgBK2t/B0wjeRRRfd6llVC/NL1a2mr4b+OZmuW9 BaHcZ9O+uRk8egp/65iChvSQvLXt3iHtBVXuovd3ioaLU0d3UQyL7VysZWdP7mzgRF/L ZDNUVGLUrYBtsC6slqffZ6B15U0hrgT9EyuKklvEhZoj50PB8mLekoUUMIciHT6UA07G zAeiW1PWwrv2mY3wq4QjgGTw5TvSX/VMCARgbGW96++N30/PrXX4laOBkBzVZXD2iGEy vCpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@appneta.com header.s=google header.b=dNVkN+l1; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=appneta.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h14si6988764pfd.404.2018.03.12.22.18.56; Mon, 12 Mar 2018 22:19:11 -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=@appneta.com header.s=google header.b=dNVkN+l1; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=appneta.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751519AbeCMFSB (ORCPT + 99 others); Tue, 13 Mar 2018 01:18:01 -0400 Received: from mail-wr0-f194.google.com ([209.85.128.194]:45260 "EHLO mail-wr0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750872AbeCMFSA (ORCPT ); Tue, 13 Mar 2018 01:18:00 -0400 Received: by mail-wr0-f194.google.com with SMTP id h2so11553371wre.12 for ; Mon, 12 Mar 2018 22:17:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=appneta.com; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=0fU8BHKc6qdxM6D9uAz1kxmQRSyZl337IwCo36G8Fbw=; b=dNVkN+l1ShraK8p9xHeRZCwc9jGvxqoYCJTtp9cAL3dopsaSQqL7V1hsP1ceVi+/XC Aa6oG+IVS2EEkoNSMmeep94RVeCOkscGEnN0tTFjn4pp6ZMzdJO7VKV4B88OCUIXaNxT a5s/y++vw61yASnajPUyhomam9b4EjcxK9f5I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=0fU8BHKc6qdxM6D9uAz1kxmQRSyZl337IwCo36G8Fbw=; b=D4aCaKV6+oP96l/kr2LSRdm8CXeOXU4kgaO1rZrPWouSa4k72YUkUAHmukEXqaNCZS oAB8ddhlfh1i3AjTqdNTGxAgs3u+7+sxmLcMfg1b7UA2bie0xZP4zBC4AWkUT+eqca/H u3RThorB13XvturCt0hwNIearilO04hdrgLrGxLDoz+Zbz+vNycGkXfRzYgcQwTiwn/0 mudZQ7J+weD9AaFTVTttYQvpRJTQn5T66n8fA8jixuE5i8Mm5a+hQaVZpF6x2a4jzT2W /jwS7D/V73lE8wN181uUCT1WCA1lJgQtFsZFMG3cLFw1Rp5tA5yeLE3+uhzd1oiUSPOT dwfA== X-Gm-Message-State: AElRT7FyeusS8acWbEXKTpdfyYJ6XevXbQ7yfiLXxi+SxspRfcjdne35 guwfSpdcp49Pz4Lt9J5mhleubmaj+Rp6c/Flu1i/ X-Received: by 10.80.168.67 with SMTP id j61mr1993801edc.201.1520918278860; Mon, 12 Mar 2018 22:17:58 -0700 (PDT) MIME-Version: 1.0 Received: by 10.80.182.14 with HTTP; Mon, 12 Mar 2018 22:17:58 -0700 (PDT) In-Reply-To: References: <20180311192322.101598-1-jelsasser@appneta.com> <20180311192322.101598-2-jelsasser@appneta.com> From: Josh Elsasser Date: Mon, 12 Mar 2018 22:17:58 -0700 Message-ID: Subject: Re: [PATCH 1/1] net: check dev->reg_state before deref of napi netdev_ops To: Cong Wang Cc: David Miller , Greg Kroah-Hartman , Eric Dumazet , Sasha Levin , Willem de Bruijn , Alexander Potapenko , =?UTF-8?Q?Michal_Kube=C4=8Dek?= , Linux Kernel Network Developers , LKML Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 12, 2018 at 4:17 PM, Cong Wang wrote: > On Sun, Mar 11, 2018 at 12:22 PM, Josh Elsasser wrote: >> init_dummy_netdev() leaves its netdev_ops pointer zeroed. This leads >> to a NULL pointer dereference when sk_busy_loop fires against an iwlwifi >> wireless adapter and checks napi->dev->netdev_ops->ndo_busy_poll. >> >> Avoid this by ensuring that napi->dev is not a dummy device before >> dereferencing napi dev's netdev_ops, preventing the following panic: > > Hmm, how about just checking ->netdev_ops? Checking reg_state looks > odd, although works. Fair point. I was trying to differentiate between an unexpected NULL pointer and a dummy netdev, but I guess it was clever at the expense of readability. I'll push up a v2 that just does the obvious.