Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2197270iof; Tue, 7 Jun 2022 22:56:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1A68c5HCqpxey95JuKzyUUtskc3feEujET9M+xxNISibRrCtsf4PPeAsDOl9O8HJDKiYv X-Received: by 2002:a05:6a00:2342:b0:51c:441:1575 with SMTP id j2-20020a056a00234200b0051c04411575mr18078547pfj.28.1654667764935; Tue, 07 Jun 2022 22:56:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654667764; cv=none; d=google.com; s=arc-20160816; b=Zf5gmcMp6PeqcP9cmbTU7r+8Tek8Ooy/9aWG6ZU8sTEhQOyX2S1Y6EsDJiXIioQY9N 0j2yN/jcmkObqxXa2wQmJ7cc3J7j6rvYdtfc4a7LDaC2laNgtloNLb4iRC4+fvE/wSwR CNdkRNVsB0TOMfEr/eHHX9WBwWsQbE3Lqw/qM/7LaagWVWCiz0oKhsArRQj8zp+racL2 arc+8xhVih4UK0VckzjvKSjbfGQ6YFU4z+yfZ9WMZLS3ILHT3pB8wcYidk6ddXuzzWnX f2IWQ23qZ/BEi8vSzntbHIluPfb7K9wyr6tVzr8yzmP5pyWs5tD+L4tQiQBsLbVj5nsa 4a4Q== 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=GhROgTDCo/HqIJNQI6UOkedVPpj+JE2kzLXN4X4u8p0=; b=dkXgRBo6I4alygg+jLf4c+021ytCIT8gRqKkwjTil6AH33SrvtiW6xLYAhBc1TGbHF bh7gQI3agAzuHsCXANmaK2fcfl3h9DwE1om2JeslIpJ18XjGw9P7ROWOfS5psP/UrpGE QBADUS3OxzFbVhj1b4uKGC3afWaEHVaTstD1yerwCw6HQINsNJkVdcedIubpk8dosQnr oZYik1DYdq643/9pRT0xE6c8Vw3yxM6H2RXKJP+Gh81s2MiOB8dYt2+JAt9JxP1/B8Qz u+T+qs3B1DJrIVk7tMZtKrup1i45coqhKeH6iAhIkXtjEw0uam0Y7maznL2/tRqlJO0X 3snw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SCV0chrC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id lp8-20020a17090b4a8800b001e073312c32si21569064pjb.8.2022.06.07.22.56.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:56:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=SCV0chrC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1: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: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 8D3884B09AE; Tue, 7 Jun 2022 22:22:12 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1384352AbiFHA7c (ORCPT + 99 others); Tue, 7 Jun 2022 20:59:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1385098AbiFGWU7 (ORCPT ); Tue, 7 Jun 2022 18:20:59 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E25E6263DFF; Tue, 7 Jun 2022 12:20:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 081D2B8237B; Tue, 7 Jun 2022 19:20:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 73378C385A2; Tue, 7 Jun 2022 19:20:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629654; bh=hmOnrUcH7670N2tE92uyQ8lRAcXD4hwB3zS1oR7mbno=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SCV0chrCyrjb5WV7CPJEK4uGp7kah22FnuDzdayKqXW21Gu/EtoHg22foeCMdwqtU eOFIGJEy2BN9bQEq6m6i/L3MYDt35jruIN2rR8LIm7E+DJXVDstkMM/2070mu3hhpP QXVSgf7JGZdnmQpDJFOYCcEW0J8aqihTPpW9eM5c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sven Schnelle , Heiko Carstens Subject: [PATCH 5.18 762/879] s390/stp: clock_delta should be signed Date: Tue, 7 Jun 2022 19:04:40 +0200 Message-Id: <20220607165024.982490421@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sven Schnelle commit 5ace65ebb5ce9fe1cc8fdbdd97079fb566ef0ea4 upstream. clock_delta is declared as unsigned long in various places. However, the clock sync delta can be negative. This would add a huge positive offset in clock_sync_global where clock_delta is added to clk.eitod which is a 72 bit integer. Declare it as signed long to fix this. Cc: stable@vger.kernel.org Signed-off-by: Sven Schnelle Reviewed-by: Heiko Carstens Signed-off-by: Heiko Carstens Signed-off-by: Greg Kroah-Hartman --- arch/s390/include/asm/cio.h | 2 +- arch/s390/kernel/time.c | 8 ++++---- drivers/s390/cio/chsc.c | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) --- a/arch/s390/include/asm/cio.h +++ b/arch/s390/include/asm/cio.h @@ -369,7 +369,7 @@ void cio_gp_dma_destroy(struct gen_pool struct gen_pool *cio_gp_dma_create(struct device *dma_dev, int nr_pages); /* Function from drivers/s390/cio/chsc.c */ -int chsc_sstpc(void *page, unsigned int op, u16 ctrl, u64 *clock_delta); +int chsc_sstpc(void *page, unsigned int op, u16 ctrl, long *clock_delta); int chsc_sstpi(void *page, void *result, size_t size); int chsc_stzi(void *page, void *result, size_t size); int chsc_sgib(u32 origin); --- a/arch/s390/kernel/time.c +++ b/arch/s390/kernel/time.c @@ -364,7 +364,7 @@ static inline int check_sync_clock(void) * Apply clock delta to the global data structures. * This is called once on the CPU that performed the clock sync. */ -static void clock_sync_global(unsigned long delta) +static void clock_sync_global(long delta) { unsigned long now, adj; struct ptff_qto qto; @@ -400,7 +400,7 @@ static void clock_sync_global(unsigned l * Apply clock delta to the per-CPU data structures of this CPU. * This is called for each online CPU after the call to clock_sync_global. */ -static void clock_sync_local(unsigned long delta) +static void clock_sync_local(long delta) { /* Add the delta to the clock comparator. */ if (S390_lowcore.clock_comparator != clock_comparator_max) { @@ -424,7 +424,7 @@ static void __init time_init_wq(void) struct clock_sync_data { atomic_t cpus; int in_sync; - unsigned long clock_delta; + long clock_delta; }; /* @@ -544,7 +544,7 @@ static int stpinfo_valid(void) static int stp_sync_clock(void *data) { struct clock_sync_data *sync = data; - u64 clock_delta, flags; + long clock_delta, flags; static int first; int rc; --- a/drivers/s390/cio/chsc.c +++ b/drivers/s390/cio/chsc.c @@ -1255,7 +1255,7 @@ exit: EXPORT_SYMBOL_GPL(css_general_characteristics); EXPORT_SYMBOL_GPL(css_chsc_characteristics); -int chsc_sstpc(void *page, unsigned int op, u16 ctrl, u64 *clock_delta) +int chsc_sstpc(void *page, unsigned int op, u16 ctrl, long *clock_delta) { struct { struct chsc_header request; @@ -1266,7 +1266,7 @@ int chsc_sstpc(void *page, unsigned int unsigned int rsvd2[5]; struct chsc_header response; unsigned int rsvd3[3]; - u64 clock_delta; + s64 clock_delta; unsigned int rsvd4[2]; } *rr; int rc;