Received: by 10.213.65.68 with SMTP id h4csp150562imn; Mon, 12 Mar 2018 22:35:42 -0700 (PDT) X-Google-Smtp-Source: AG47ELuH7nXJTe1yoEr3C8rTF3SLc+JY29i0l5X1nXvsRHrgZ2NA/DiRhEoyjqOwVsLSuMxDxAIW X-Received: by 2002:a17:902:47aa:: with SMTP id r39-v6mr10689404pld.72.1520919342232; Mon, 12 Mar 2018 22:35:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520919342; cv=none; d=google.com; s=arc-20160816; b=n6OFAVs6kCJsc1skdFvSOTpQBjC/ujObdwvVjcd2ATqj+9sEjOvzn/YwajfWUIsmMO 8zbUOD7MYF3EjllI3jWaxi6RpirUW7yU1FrtK858+fzrYzZYTHzouxP3hzjvHoQvtxnK 9QY/gI8z16dnV37AfU6c6y/G+iQ8c4HrmdVBtSJPnFRwrlwApxKAwI7+B5E6F/n1NacU lsVshsNyfsSEc6g6oYVw0i3SR0R3m63OHfpsGvBhgdlGYXi51QgyjyV7xX4WstPmRBa6 2KNipg8UUrE3la94n3QZkAKb+IXn6/tg4D44r6YVd6OxDQr17Lc6zIPEXHcJLa18uEZN tI+w== 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:arc-authentication-results; bh=Z0JucVFm4WV/JHg4+hrfKdoKq8m9tzvF6B+Bu2p/5C0=; b=Px06z1twSBMO12uCH54O6DNHGlot5kRbZqk/lamYvkcH6I3TjqxdTaGerxLqh0ro19 rBiHVTxSiuUgnkOvxixh7cq8eXqiepOMgJNfg4S8jAazxmOuL5tXu9JJzAHwJGrIZNcK be7fX3zBV5Z6sCae8Und9GW5HFcixthJZduzQrS/2R9yt3uesx585b3CDtnLGGv3CBhv DyEgZeS1S2ZzSunc4NriQGPMbcZDvMQk6QRnf8HwgS8jchnrsjI9NGkeCVD1V36GL6xB 6yvx1RTHyefZUtl07bl8N6YWG7VFBFDdyxcHLDUzwYB4CO5ofR1NMBXJPri/nBGyK6aL +4ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@appneta.com header.s=google header.b=OUIwOXqX; 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 u19-v6si7284850plq.120.2018.03.12.22.35.25; Mon, 12 Mar 2018 22:35:42 -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=OUIwOXqX; 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 S1751538AbeCMFeb (ORCPT + 99 others); Tue, 13 Mar 2018 01:34:31 -0400 Received: from mail-pl0-f47.google.com ([209.85.160.47]:36230 "EHLO mail-pl0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751338AbeCMFe3 (ORCPT ); Tue, 13 Mar 2018 01:34:29 -0400 Received: by mail-pl0-f47.google.com with SMTP id 61-v6so10741699plf.3 for ; Mon, 12 Mar 2018 22:34:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=appneta.com; s=google; h=from:to:cc:subject:date:message-id; bh=Z0JucVFm4WV/JHg4+hrfKdoKq8m9tzvF6B+Bu2p/5C0=; b=OUIwOXqX2doSkIw7nBwHE4BbOMWECPaCQw8OsHf5a032z5XXH3ldF2XW5HUSsqqgzu g2vTk4kPo8B8g45K5YiBJRwhM3v6h+X7u38idqMN/dujA5Bp8zXDL0jTxcZq2F90TP4/ gzvUlxRagA4OevMs/zLyovoVV9XukBQFPEO/E= 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=Z0JucVFm4WV/JHg4+hrfKdoKq8m9tzvF6B+Bu2p/5C0=; b=MpGiNlQyrThljrVYqqWQkjf9oEIivpT3EkZQDj4YEqaM12Rbty8evZerp5FQ+6cXNm 7bFqfL9MNNrIiyllSEXOsBKCHZ0L+oWUmbfkACNCzgTvI5DkWCXPtfB+U+Cso5lkcw0j QlDbWuNRxmEk4ulcRB0kB+97hRHe+3IS24F0Swl69EnafKrPvPl4S7RTbbOsL5UuPgB0 yv5ETvpt8EATrr7Y3k4RhLIHTXHJCmj0YBM22IKA+viYMF+BpOXvlT7XHfOUDcz5jC4W L9g/2Y0LdI4IxgzUpmTzrPx3Z4/zjmDiDgcXywFSpuoMes28Pe5LtGek1QVXGCa5vJKK 9heQ== X-Gm-Message-State: AElRT7FMM6YhQbowWa27QgIPYQswj2vI4YrQytHAMxRdAXQ0UatHAHaP i4IVl5yDxzSsDh2kZYfmIJhG X-Received: by 2002:a17:902:6717:: with SMTP id f23-v6mr10785321plk.188.1520919268726; Mon, 12 Mar 2018 22:34:28 -0700 (PDT) Received: from debian8-stable-jae.jaalam.net (d173-180-161-165.bchsia.telus.net. [173.180.161.165]) by smtp.gmail.com with ESMTPSA id c14sm16695807pfn.185.2018.03.12.22.34.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 12 Mar 2018 22:34:27 -0700 (PDT) From: Josh Elsasser To: davem@davemloft.net Cc: Josh Elsasser , Greg Kroah-Hartman , Eric Dumazet , Willem de Bruijn , Cong Wang , =?UTF-8?q?Michal=20Kube=C4=8Dek?= , Vlad Yasevich , netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 0/1] net: avoid a kernel panic during sk_busy_loop Date: Mon, 12 Mar 2018 22:31:59 -0700 Message-Id: <20180313053248.13654-1-jelsasser@appneta.com> X-Mailer: git-send-email 2.11.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org V2: just check napi->dev->netdev_ops instead of getting clever with the netdev registration state. Original cover letter: Hi Dave, I stumbled across a reproducible kernel panic while playing around with busy_poll on a Linux 4.9.86 kernel. There's an unfortunate interaction between init_dummy_netdev, which doesn't bother to fill in netdev_ops, and sk_busy_loop, which assumed netdev_ops is a valid pointer. To reproduce on the device under test (DUT), I did: $ ip addr show dev wlan0 8: wlan0: mtu 1500 qdisc mq [...] inet 172.16.122.6/23 brd 172.16.123.255 scope global wlan0 $ sysctl -w net.core.busy_read=50 $ nc -l 172.16.122.6 5001 Then transmitted some data to this socket from a second host: $ echo "foo" | nc 172.16.122.6 5001 The DUT immediately hits a kernel panic. I've attached a patch that applies cleanly to the 4.9.87 stable release. This fix isn't necessary for net/net-next (ndo_busy_poll was removed in linux-4.11), but a further backport of this commit is likely required for any stable releases older than linux-4.5. I hope this is the right way to raise something like this. I couldn't find a clear answer from the -stable and netdev on how to handle bugs in features that no longer exist in mainline. Thanks, Josh