Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp2040527imm; Thu, 24 May 2018 04:59:38 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqsqseRLu1z7lE6h9KOh6PXCrmxbqM4QCrytBqtwK+Iu0TUB1JQfqnvkC6e0WSAUqDm90Q2 X-Received: by 2002:a17:902:d882:: with SMTP id b2-v6mr6854805plz.220.1527163178849; Thu, 24 May 2018 04:59:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527163178; cv=none; d=google.com; s=arc-20160816; b=zPv2Lt3WxG857zPwrOtOu+joASm0ReXlHHR1XN4DlqIxx5u+anACsHeg2ciyYAXcDP 7cN7KSjI3CifG5rDK8tW8t8vPtRjW7qvRa3xDcEYmqFAH6Z5AeadylvuzY0yq8L3HqyP N6Z6hzxx6WaCCSc/6DsnMBJv0jE0r1DVaE1ruT5MDfZJot5vqvW1bbx9o3jym4a1yWWH GgFB60kEA1h7TIyHuBbyayjLxVAoole9RWDDoXmLxCXCYqFud/LcMCLscLYuio9y+eKg LLFwhhR1TaLXxGzPuKJAd0KI7/C2B64mJowVUCDy9M62TE3n/bQR2hIqwoJc4HV/+inm nGBQ== 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=uBbtckGVBDkV+yKpcbPuuRxAD+3hpJAm+GlP/eCckxk=; b=VMa+uHQS/2KTIbIZTyRngVQkC9e3uYcDVuDgnf4MVxYyDk2zs9W3QP9CwNPUhtpgA5 AajVbPcexaWylRYBVDK08Ii3lqbSgcpke14ZZd663XzS46SQnuaNP3SOTxsVG7rD4bRM cLbBznw42TKH5F6g1ibwop4aZzf7CU5Kp99LhnYRrBkfW2NLM+GoXHuuw/RKudgc2f6i Vxwr7WKKv3GNaw6DwNaYTf4p47dECyszAMK4SI+Aj8hDJcyE1RUokxlqnRXvM6xIVeR3 Ousq/8KpvTygON2d/jwVu6d9Kos7cSsIhkByA81YuNOHm9ePdSbderVzM0o+FjnfSJP9 IznA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=NkG2/em4; 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 u1-v6si16581813pgc.388.2018.05.24.04.59.24; Thu, 24 May 2018 04:59:38 -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=NkG2/em4; 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 S966771AbeEXJpT (ORCPT + 99 others); Thu, 24 May 2018 05:45:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:56358 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966749AbeEXJpK (ORCPT ); Thu, 24 May 2018 05:45:10 -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 725AC208CD; Thu, 24 May 2018 09:45:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527155110; bh=IUKhRyNwzkhtU+jvCc0zeIiy1oQHFjFIf35hXyAiFlc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NkG2/em4cJwz3qRPL/hDnvVcZjsfZR+PUeQL1xb8AKhMwjuKyqifEXceK/KWj6TqH 18EKiVx6I2//l72W3yOpppS5xb06mL3oiAHU2uwy6LEG0wUBNQd5M7T7ZraNOF+s+M uLhtzeKMQTFD5GCjhhi8HdXrMyoDDu1qb5N5SDK8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Heiko Carstens , Hendrik Brueckner , Martin Schwidefsky Subject: [PATCH 4.4 59/92] s390/cpum_sf: ensure sample frequency of perf event attributes is non-zero Date: Thu, 24 May 2018 11:38:36 +0200 Message-Id: <20180524093204.984626877@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: Hendrik Brueckner commit 4bbaf2584b86b0772413edeac22ff448f36351b1 upstream. Correct a trinity finding for the perf_event_open() system call with a perf event attribute structure that uses a frequency but has the sampling frequency set to zero. This causes a FP divide exception during the sample rate initialization for the hardware sampling facility. Fixes: 8c069ff4bd606 ("s390/perf: add support for the CPU-Measurement Sampling Facility") Cc: stable@vger.kernel.org # 3.14+ Reviewed-by: Heiko Carstens Signed-off-by: Hendrik Brueckner Signed-off-by: Martin Schwidefsky Signed-off-by: Greg Kroah-Hartman --- arch/s390/kernel/perf_cpum_sf.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/arch/s390/kernel/perf_cpum_sf.c +++ b/arch/s390/kernel/perf_cpum_sf.c @@ -744,6 +744,10 @@ static int __hw_perf_event_init(struct p */ rate = 0; if (attr->freq) { + if (!attr->sample_freq) { + err = -EINVAL; + goto out; + } rate = freq_to_sample_rate(&si, attr->sample_freq); rate = hw_limit_rate(&si, rate); attr->freq = 0;