From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936139AbdKPRCb (ORCPT ); Thu, 16 Nov 2017 12:02:31 -0500 Received: from mail-qt0-f195.google.com ([209.85.216.195]:45665 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759690AbdKPRCX (ORCPT ); Thu, 16 Nov 2017 12:02:23 -0500 X-Google-Smtp-Source: AGs4zMajt22r5fC/6dmSscKeHRmy8pxjV34M010jr84INmxH+712iGT8FepZ2ilW5uxMkbLAahQj1w== Date: Thu, 16 Nov 2017 12:03:34 -0500 From: Tim Hansen To: paul@paul-moore.com Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, devtimhansen@gmail.com, alexander.levin@one.verizon.com Subject: [PATCH] net/netlabel: Add list_next_rcu() in rcu_dereference(). Message-ID: <20171116170334.GA141280@debian> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add list_next_rcu() for fetching next list in rcu_deference safely. Found with sparse in linux-next tree on tag next-20171116. Signed-off-by: Tim Hansen --- net/netlabel/netlabel_addrlist.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/netlabel/netlabel_addrlist.h b/net/netlabel/netlabel_addrlist.h index d0f38bc..ac709f0 100644 --- a/net/netlabel/netlabel_addrlist.h +++ b/net/netlabel/netlabel_addrlist.h @@ -87,7 +87,7 @@ static inline struct netlbl_af4list *__af4list_valid_rcu(struct list_head *s, struct list_head *i = s; struct netlbl_af4list *n = __af4list_entry(s); while (i != h && !n->valid) { - i = rcu_dereference(i->next); + i = rcu_dereference(list_next_rcu(i)); n = __af4list_entry(i); } return n; @@ -154,7 +154,7 @@ static inline struct netlbl_af6list *__af6list_valid_rcu(struct list_head *s, struct list_head *i = s; struct netlbl_af6list *n = __af6list_entry(s); while (i != h && !n->valid) { - i = rcu_dereference(i->next); + i = rcu_dereference(list_next_rcu(i)); n = __af6list_entry(i); } return n; -- 2.1.4