Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2472562pxj; Mon, 10 May 2021 03:57:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJydF44CTMLBUfUKvOZVjub4LaQit1pFkzGqYIEmG1HXFUphMvU3OroqqamHrWs0XxZPuBH2 X-Received: by 2002:a92:cc52:: with SMTP id t18mr9934120ilq.138.1620644256455; Mon, 10 May 2021 03:57:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620644256; cv=none; d=google.com; s=arc-20160816; b=UFqxmpqPHqDSbLLEObNnQ7sz/nZ27GglJ7nLh8d/qI9o9W297m2OeI0a0XXkWXZuGN Z1Bqt2raSFBJa8AU0fsti9h8Y6LvmDA/B4xR9ymNKg5hL0BKsc+7DdUytAyvnzKIQSxj XWXnQ9PTVEp/Pk033tNWFldtfLhMfL7Eutlw76n98lSLiMOyLcBGTD2ryNrXH7pB5AF/ c6PXnkAxGLliswAKgOm5zqlo8Pf8GFNaDWao5W6V+9lmO5yEhm6bCPyZJeswgW8GEzC5 rv9Yrq+k3STB4AdjMB4Yi1O5BjjKZ8qy4AdJbRi+gvWUSdvt/kRLCmuIiBZm5DGLJmo/ 2qmA== 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=ahqzosDDWloCeuxsgp6XpFXr/5ufvMi2V/wTZFfbUuw=; b=wRm+kH9GM3VBPX697X6TPeq03dx23LaBM2D4pjUZjpOdyZ8gR4Gji2055exi9/SWcg 95cr9MnFvAqP2qQfXtF+DC4XNY242qOMDkfNOMbxC/HKdO09ZDmbl/UUMy9SBA0zjRpj YZ9kIs/kkz2yY7ks3qFojFVw5RnnmEsjftbfgM8Yx3cDKBCCgHrC98TxA0DbqICrZJVv bczaNYnu68zQLcuz70xA8mEVTsB/eO5Bn/z+BC/X6DWriOJza5DYu8Do3qWE0b1lBtu9 wTY255BLLuY87NZt/fEed5tzuKM67JpiHNE/zcrY+Lqq4ELJNXo6tYTzvBheI1/breL5 3OUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=n7mUHYRU; 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 j15si14717484ilo.95.2021.05.10.03.57.24; Mon, 10 May 2021 03:57:36 -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=n7mUHYRU; 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 S234344AbhEJK4P (ORCPT + 99 others); Mon, 10 May 2021 06:56:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:59424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232963AbhEJKou (ORCPT ); Mon, 10 May 2021 06:44:50 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8D44F61075; Mon, 10 May 2021 10:34:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1620642863; bh=SdSFpBpRgPfkm5XJGFFr1af15UgE2cUoz/UoKCzuSdQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n7mUHYRUE+DaDvScMn5B7Szc/vmxFVzpPHxJul5YrUnnIUIjlzWnQL+Eev9RnivoD odDXS3bjxo+nfaDxHgvUyawObksw7sb52aCOPNyVI0TviCvB/Ydfrbf2c27dxM5VCZ wymGT53ab5RoneY0m/SAcuwQwxVJQQ/rbY/IDLbY= 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 5.10 048/299] posix-timers: Preserve return value in clock_adjtime32() Date: Mon, 10 May 2021 12:17:25 +0200 Message-Id: <20210510102006.451877033@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510102004.821838356@linuxfoundation.org> References: <20210510102004.821838356@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 @@ -1191,8 +1191,8 @@ SYSCALL_DEFINE2(clock_adjtime32, clockid err = do_clock_adjtime(which_clock, &ktx); - if (err >= 0) - err = put_old_timex32(utp, &ktx); + if (err >= 0 && put_old_timex32(utp, &ktx)) + return -EFAULT; return err; }