From patchwork Sun Aug 12 20:24:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Aring X-Patchwork-Id: 956734 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=mojatatu.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=mojatatu-com.20150623.gappssmtp.com header.i=@mojatatu-com.20150623.gappssmtp.com header.b="MYWwe91V"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 41pW100Hjqz9sCR for ; Mon, 13 Aug 2018 06:39:00 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728136AbeHLXEV (ORCPT ); Sun, 12 Aug 2018 19:04:21 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:51992 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728114AbeHLXEU (ORCPT ); Sun, 12 Aug 2018 19:04:20 -0400 Received: by mail-it0-f67.google.com with SMTP id e14-v6so9821603itf.1 for ; Sun, 12 Aug 2018 13:25:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mojatatu-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=EuxOagbufZpaczbwGAs9gpCfhV8T7uXfLBHrwvuM5AQ=; b=MYWwe91VolNYRAL5k2HIIipiLTpPmrj0Cay8ZQxl9hTOHzh0iJmLbrCuVlZ6B75UKB fxVDQQil9aKN5Uos/uCLSU3M7k6z0YCJkh6UyQ6QhvuW+thnN/VuqGFWclGoUOV6fImR m6PQW5F6NJtgbLJch1RO/uIG0d3o33wjksvnRFlJQvNY0wsUCsK9GI7JaVblFZchEu83 sYoogdFMSQJ4Y3Eq8aExnSp0UFQDtJFMfov2uNhDIQSTn64rOUto1yA/9Azrt9Qnia+T X1bd1xDSF/qkDq1nazGNJEDi5ZPxOkyarN5EAMZM6+wOhMZxyZMClTIjgZ0F3TX2xeWN 58NA== 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=EuxOagbufZpaczbwGAs9gpCfhV8T7uXfLBHrwvuM5AQ=; b=nSLKhMY2bqr5E6s+A2sCtnSlcjR5VgeMi2ydKkautwElpbAEYnSf0nVZxB4lMECaL3 DCtVnq3Z46MoiiJxUNy4pmOWwbn8cywkGlqdZnLRb/kURjXxK1J/eU74B3K31lVr1J1y xdV8PSXrbnJyG/WE6bRn5jsTiwip+9MROpaTzv3BuCwQf6FGOfVHQshFSX3XgcmcIsNA 1LJbyleYLJY8zon8z/4difzD8kWBAGxZE6Bc6zgxwCoyaPhiicQjuqVp/GQHAzezq37c ttxhVdfN+6a8Pprr1lobindX+fFLr1M32ZnmkmGpLAQsfPv70pHAftCCiNa7n5ITKkYA wfBQ== X-Gm-Message-State: AOUpUlFvqL+44j9fhRZVJoQMCywOIacchP5vID6N7F1KPI3UEo7rLHjm r9N8hgkmDaGDxduuAVNLWSYg1cKGyD0= X-Google-Smtp-Source: AA+uWPyDWsTujDiyz01jNSy+sM68gzs+XJhaZRGpim2Bul/8BJQ0eHltst6Wm3xUUmcWHhCajiu0Lw== X-Received: by 2002:a24:dd88:: with SMTP id t130-v6mr8374438itf.129.1534105510566; Sun, 12 Aug 2018 13:25:10 -0700 (PDT) Received: from x220t.lan ([64.26.149.125]) by smtp.gmail.com with ESMTPSA id v3-v6sm4902806ita.6.2018.08.12.13.25.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 12 Aug 2018 13:25:09 -0700 (PDT) From: Alexander Aring To: netdev@vger.kernel.org Cc: linux-wpan@vger.kernel.org, kernel@mojatatu.com, Alexander Aring , Stefan Schmidt Subject: [PATCH net-next] ieee802154: hwsim: using right kind of iteration Date: Sun, 12 Aug 2018 16:24:56 -0400 Message-Id: <20180812202456.22317-1-aring@mojatatu.com> X-Mailer: git-send-email 2.11.0 Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org This patch fixes the error path to unsubscribe all other phy's from current phy. The actually code using a wrong kind of list iteration may copied from the case to unsubscribe the current phy from all other phy's. Cc: Stefan Schmidt Reported-by: Dan Carpenter Fixes: f25da51fdc38 ("ieee802154: hwsim: add replacement for fakelb") Signed-off-by: Alexander Aring --- drivers/net/ieee802154/mac802154_hwsim.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c index 07a493dea11e..bf70ab892e69 100644 --- a/drivers/net/ieee802154/mac802154_hwsim.c +++ b/drivers/net/ieee802154/mac802154_hwsim.c @@ -735,10 +735,12 @@ static int hwsim_subscribe_all_others(struct hwsim_phy *phy) return 0; me_fail: - list_for_each_entry(phy, &hwsim_phys, list) { + rcu_read_lock(); + list_for_each_entry_rcu(e, &phy->edges, list) { list_del_rcu(&e->list); hwsim_free_edge(e); } + rcu_read_unlock(); sub_fail: hwsim_edge_unsubscribe_me(phy); return -ENOMEM;