Received: by 2002:a05:6520:4211:b029:f4:110d:56bc with SMTP id o17csp2108163lkv; Thu, 20 May 2021 03:36:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwEIpSuHwSP1VQd+B/W2FPWKpFQhTxjuPXxQPHuNRhUC23A0qpLWJrZgUlbwNxEze71ICVy X-Received: by 2002:a02:9109:: with SMTP id a9mr5174366jag.93.1621506969024; Thu, 20 May 2021 03:36:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621506969; cv=none; d=google.com; s=arc-20160816; b=Zdg9ZhC67mverKPfn+2Y+Y2YrBTB5WtOemFof9QKnOVtBWN1wVPfxNUWQ/mTaWjvck Dk3UPcAyVcvjGLHOFKpj0t0SKCu2pEBKavaaXnHNDob7JojRZGgp54kPyBD+wq0AlP76 GtR8osvF9uCjY2FrrSuXHX9/6ePOUCAWY5El0wVjR4J75KSuqm8WUN2yUSiZC0Vwqpuk dIwbcLna0ZmV4rEVXfsb37kav9w0oUEPSWisCgmVM+T0Dw/fCyLry+zB05aXaSD3so5s GgJm7pEhBkYJMw1S+H4eVqBjUHAoYRMk+8V/brGbesGtWSOSo2ehmU103sMoyPsRZMC0 a8iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=TW4cV0FkwgqNG94c/GsvvFKlWBNpUymFcRym8opcreY=; b=gCiPBzzukx0d28zGXMHHJF2koo7s6tRnYiCgaK0glT6LGXHbpVEoGtgtvJQ4ObnEqv GfjoqHgu1dR9+w3RdksKu+baRUqlknGm2pT3hHZFcpvkTOe4/WlXS1Yul+1dhSyg0glC Y9oG7+6Xbg1TZW5KPdwUs8/m5H5DcgjjKL/+qhnbt9wn3rlpLJ4heDU1KKtANzrRgS2+ GfBW0d4lRl/HUtLrWJifAOivBKZ0+1OZaf6yNUdoaIlyJXefpSUpmH4CsWu2mSSUVd7y 4pAt/hc1wh3qsNLrt1c3NwNFNprL2lUPFjAoQD45h1FYFxcuFN6w89Koahzj1mfrFPPI 0bGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qnFR4IFP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m20si1988644ioy.69.2021.05.20.03.35.52; Thu, 20 May 2021 03:36:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qnFR4IFP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237912AbhETKgE (ORCPT + 99 others); Thu, 20 May 2021 06:36:04 -0400 Received: from mail.kernel.org ([198.145.29.99]:51816 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234457AbhETKWf (ORCPT ); Thu, 20 May 2021 06:22:35 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 215A1619D4; Thu, 20 May 2021 09:48:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504098; bh=TNFGLE41deNXpFTTV+sZEvpI3K7lP4goVatkmxZkkjE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qnFR4IFPYK3Hb6bQFrkaxrGNMRXfPrj9DdbhPsZMHh2S0/KTqRGG/OmlkoI61d0Ly L+8TIx0Yx7LvQid1dj4ufSapAVShoddqfG+8vDcdOVJl5+pEnjB/1UXVZozCRMylRf XruZbOubAPzwRM296OpMaGhJqCjeMvSPyDOS3fHw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chen Jun , Thomas Gleixner , Richard Cochran Subject: [PATCH 4.14 090/323] posix-timers: Preserve return value in clock_adjtime32() Date: Thu, 20 May 2021 11:19:42 +0200 Message-Id: <20210520092123.176548218@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chen Jun commit 2d036dfa5f10df9782f5278fc591d79d283c1fad upstream. The return value on success (>= 0) is overwritten by the return value of put_old_timex32(). That works correct in the fault case, but is wrong for the success case where put_old_timex32() returns 0. Just check the return value of put_old_timex32() and return -EFAULT in case it is not zero. [ tglx: Massage changelog ] Fixes: 3a4d44b61625 ("ntp: Move adjtimex related compat syscalls to native counterparts") Signed-off-by: Chen Jun Signed-off-by: Thomas Gleixner Reviewed-by: Richard Cochran Cc: stable@vger.kernel.org Link: https://lore.kernel.org/r/20210414030449.90692-1-chenjun102@huawei.com Signed-off-by: Greg Kroah-Hartman --- kernel/time/posix-timers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c @@ -1172,8 +1172,8 @@ COMPAT_SYSCALL_DEFINE2(clock_adjtime, cl err = kc->clock_adj(which_clock, &ktx); - if (err >= 0) - err = compat_put_timex(utp, &ktx); + if (err >= 0 && compat_put_timex(utp, &ktx)) + return -EFAULT; return err; }