From patchwork Tue Mar 24 15:36:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 11455813 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 790CE6CA for ; Tue, 24 Mar 2020 15:37:54 +0000 (UTC) Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.kernel.org (Postfix) with SMTP id D659120774 for ; Tue, 24 Mar 2020 15:37:53 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="GyC+w6VY" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D659120774 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kernel-hardening-return-18162-patchwork-kernel-hardening=patchwork.kernel.org@lists.openwall.com Received: (qmail 26081 invoked by uid 550); 24 Mar 2020 15:37:16 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 25978 invoked from network); 24 Mar 2020 15:37:15 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585064223; bh=tpwxeWGxCRW2edSpkeAxy800Wtnff4M8NvYgHsczp9I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GyC+w6VY0uSmE3ApXjwUpwX5/upSsRk4J8nsl07WC3p5tqV2i8jPvEAuKAlK6VLOA 6h8GgVtcwHzQNW0BOcMkN5/RquTjZm8tEQE+LAKF/f/euL8+wROPI3BYs1MoQnllOt 1IdzcQkQe3HLHySmnXBvNborGuNtuj9/B5bZ0U5g= From: Will Deacon To: linux-kernel@vger.kernel.org Cc: Will Deacon , Eric Dumazet , Jann Horn , Kees Cook , Maddie Stone , Marco Elver , "Paul E . McKenney" , Peter Zijlstra , Thomas Gleixner , kernel-team@android.com, kernel-hardening@lists.openwall.com Subject: [RFC PATCH 05/21] list: Comment missing WRITE_ONCE() in __list_del() Date: Tue, 24 Mar 2020 15:36:27 +0000 Message-Id: <20200324153643.15527-6-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200324153643.15527-1-will@kernel.org> References: <20200324153643.15527-1-will@kernel.org> MIME-Version: 1.0 Although __list_del() is called from the RCU list implementation, it omits WRITE_ONCE() when updating the 'prev' pointer for the 'next' node. This is reasonable because concurrent RCU readers only access the 'next' pointers. Although it's obvious after reading the code, add a comment. Cc: Paul E. McKenney Cc: Peter Zijlstra Signed-off-by: Will Deacon Reviewed-by: Paul E. McKenney --- include/linux/list.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/linux/list.h b/include/linux/list.h index 4d9f5f9ed1a8..ec1f780d1449 100644 --- a/include/linux/list.h +++ b/include/linux/list.h @@ -109,6 +109,7 @@ static inline void list_add_tail(struct list_head *new, struct list_head *head) */ static inline void __list_del(struct list_head * prev, struct list_head * next) { + /* RCU readers don't read the 'prev' pointer */ next->prev = prev; WRITE_ONCE(prev->next, next); }