Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2052853imm; Thu, 24 May 2018 05:08:14 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqBHm1m8YL4nPxbiQJfpMs95KAMPVeAhRnhE6eaPyz76R/lSozjmZc/Jz43OUi8brgEs2eB X-Received: by 2002:a17:902:3103:: with SMTP id w3-v6mr6971860plb.37.1527163694357; Thu, 24 May 2018 05:08:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527163694; cv=none; d=google.com; s=arc-20160816; b=lL6vnM2WsukTpJboTj4ThRJ/CLQDm4zkLq3Jt4X2OMtXYrUfuqf+8GCKvBeFgvgYhK DUuJo/Hdvd1vPxfYjgaBUo1YKtya03ksruiK9p0nntAtZLj5glANbeT8tamC4F/eDJhy Qx0vOoLWbBzScUl11bgLhDKCyk59v5kSuS22OMep359Of3Imb/6LVrQA4qhovVBn0Bnr kPkuk/AAhk/vyb+8VeG+HdO6TsxsSX6SljwQmKW6zX66HQhevg+mcoMxbiQHCfSMhYMl jNZd5ogIvt7JXYVqgLfLikn3GBXHoZBi+eX3HaxfC1zUYGiePUhr4hmrS9AlaX8C7ctd kmQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=bEGuFokpmJkJPl6a1bWCWwIkDA5CmU3KknEPf5Qnrno=; b=LjKEB8RqLekPtT3Tj0vgE2kjkd7Msqvv5n3N0MaVSUT3YJzcSgy9KMej0B30Ouuqs4 c1iK7yy0ZtQwuNTE1jAG5dL7MvJRkqNa5j16EdUBTdGr/rXjZd6hpsFpCrmtz0D59j56 YjSDnoCZjA2mykg7vPEgCo3Uvc5kPv+BpHIo3wouJbgEb3tgHo5e5vQ7KgdIg/ZFpCzp wOhS3fuMnF/B6uSAMLH4gF9FK7udSYs453wKtCaqWiBlNwL0MZT78TLaFm/JD8UaSNJ2 AEveuUiRe4BQ1kYDNgkwbUk4mPAU4Uz3dRa1KY1oUdhOsHf/1W34hhYuR4XdcFrG14oW RY8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=TmjPQCh+; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b66-v6si948889pgc.319.2018.05.24.05.07.58; Thu, 24 May 2018 05:08:14 -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=@kernel.org header.s=default header.b=TmjPQCh+; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1033200AbeEXMHC (ORCPT + 99 others); Thu, 24 May 2018 08:07:02 -0400 Received: from mail.kernel.org ([198.145.29.99]:55294 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966170AbeEXJn4 (ORCPT ); Thu, 24 May 2018 05:43:56 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0EB282087E; Thu, 24 May 2018 09:43:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155035; bh=lZGYDnGqct9VnVvKLEBdU/JVJM3sJ2sqlGnadmu96x8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TmjPQCh+HiMSB9b4z1NjH52FOohwr4FRjBcfM5AgEOqnt7D8d9/s7wcaLl0rSxQKb 2AfF6gn5i6OsAZk0ASNKXv4HHas1M2pd6jZMDlG6ImaXTz+dG+VlhKPy6tU2f7fV3u X7Zt0PeNprDz/9uLIhn2x1GWro+2fV6urjJg4bU8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Slaby , Ingo Molnar , Peter Zijlstra , Darren Hart , Linus Torvalds Subject: [PATCH 4.4 31/92] futex: futex_wake_op, fix sign_extend32 sign bits Date: Thu, 24 May 2018 11:38:08 +0200 Message-Id: <20180524093201.896882019@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180524093159.286472249@linuxfoundation.org> References: <20180524093159.286472249@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jiri Slaby commit d70ef22892ed6c066e51e118b225923c9b74af34 upstream. sign_extend32 counts the sign bit parameter from 0, not from 1. So we have to use "11" for 12th bit, not "12". This mistake means we have not allowed negative op and cmp args since commit 30d6e0a4190d ("futex: Remove duplicated code and fix undefined behaviour") till now. Fixes: 30d6e0a4190d ("futex: Remove duplicated code and fix undefined behaviour") Signed-off-by: Jiri Slaby Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Darren Hart Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- kernel/futex.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/futex.c +++ b/kernel/futex.c @@ -1457,8 +1457,8 @@ static int futex_atomic_op_inuser(unsign { unsigned int op = (encoded_op & 0x70000000) >> 28; unsigned int cmp = (encoded_op & 0x0f000000) >> 24; - int oparg = sign_extend32((encoded_op & 0x00fff000) >> 12, 12); - int cmparg = sign_extend32(encoded_op & 0x00000fff, 12); + int oparg = sign_extend32((encoded_op & 0x00fff000) >> 12, 11); + int cmparg = sign_extend32(encoded_op & 0x00000fff, 11); int oldval, ret; if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) {