From patchwork Fri May 26 20:17:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kees Cook X-Patchwork-Id: 9751105 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A1F1960246 for ; Fri, 26 May 2017 20:20:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9497528334 for ; Fri, 26 May 2017 20:20:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88D0028347; Fri, 26 May 2017 20:20:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 536492833E for ; Fri, 26 May 2017 20:20:14 +0000 (UTC) Received: (qmail 9371 invoked by uid 550); 26 May 2017 20:18:44 -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 9300 invoked from network); 26 May 2017 20:18:42 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=DHvr1ZFRtoUntxmvEbOhJJ8pUl5IttunFUuH2vpUybU=; b=IzbLtK9Y/Kqufr/JtVTCAVBuQ9LG/o/L6SeqWpe1dYDSOlfH2shpubWjZQwX99tay8 bdFlVksU/E/C6frt/paWbHx24dst7zAAl2SwBleCGEKYNgHH0jda/GeAHYcUBroTz+Nk i0d1eE64Ht5N8JtusgE7Oa1grGW/VSGnrB5mg= 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:in-reply-to :references; bh=DHvr1ZFRtoUntxmvEbOhJJ8pUl5IttunFUuH2vpUybU=; b=Fs3FVOiyj2eFYvRn2EFpbfnDsjExUUHWQ1qWjP9wox1E6Xfp3eiCZLBVk8aqlszJ7O gVrInZB9gTy9zqHeJlc4DCd7eQr4GgLRHlxGAMqikBQ2s7gAKz4oEeFxGOdlRsU2hcDp NeyV59gkxWF+2DidiJnvuSgBq6ClwkDMhJJgD+JdQS16vEQUvLKs8dkppTEfMFsDIr4D bWEvf3SyLzVBEU2VQZUMRu817H9PcNZpcYluGvRTwzqxuWZox16wfkFjGxkIyC+100a7 l7lLsGHOB5T4g0Omr1BEHobRZmgg1udT4WxRLUTUo/Gal8M+C481ttle+UjqOCO07WxE rtHA== X-Gm-Message-State: AODbwcDnzhRyK/UKYFH0RQIMw1UBmoIQc1Ayke7ojZUKHSDWqLIwTqba Ux4K8MqP1TecgjSU X-Received: by 10.98.55.198 with SMTP id e189mr4568192pfa.38.1495829910714; Fri, 26 May 2017 13:18:30 -0700 (PDT) From: Kees Cook To: kernel-hardening@lists.openwall.com Cc: Kees Cook , Mark Fasheh , Joel Becker , Laura Abbott , x86@kernel.org, linux-kernel@vger.kernel.org Date: Fri, 26 May 2017 13:17:21 -0700 Message-Id: <1495829844-69341-18-git-send-email-keescook@chromium.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1495829844-69341-1-git-send-email-keescook@chromium.org> References: <1495829844-69341-1-git-send-email-keescook@chromium.org> Subject: [kernel-hardening] [PATCH v2 17/20] ocfs2: Use ERR_CAST() to avoid cross-structure cast X-Virus-Scanned: ClamAV using ClamSMTP When trying to propagate an error result, the error return path attempts to retain the error, but does this with an open cast across very different types, which the upcoming structure layout randomization plugin flags as being potentially dangerous in the face of randomization. This is a false positive, but what this code actually wants to do is use ERR_CAST() to retain the error value. Cc: Mark Fasheh Cc: Joel Becker Signed-off-by: Kees Cook --- fs/ocfs2/export.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ocfs2/export.c b/fs/ocfs2/export.c index 827fc9809bc2..9f88188060db 100644 --- a/fs/ocfs2/export.c +++ b/fs/ocfs2/export.c @@ -119,7 +119,7 @@ static struct dentry *ocfs2_get_dentry(struct super_block *sb, if (IS_ERR(inode)) { mlog_errno(PTR_ERR(inode)); - result = (void *)inode; + result = ERR_CAST(inode); goto bail; }