Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp802263imm; Mon, 21 May 2018 14:46:02 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrwJf6CwCAq6NqTE97QC26aUkBxIFjnL/ovCB2X6nr9gX1jGk7wI9721KXPdCg/k0M+ulKw X-Received: by 2002:a62:568f:: with SMTP id h15-v6mr21662441pfj.131.1526939162736; Mon, 21 May 2018 14:46:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526939162; cv=none; d=google.com; s=arc-20160816; b=K4f//0YE4nn6r4ldC2zZO9P7AbZ8RdrrSCi5FNGHfYX5AykVm8Xeu4j3D/VkmXkkGt VHMmqxHjKif2xMU512GRuxBYXIzFzLwlySLr0bh2HDiJUR1t+G+SGWqRS6vtyagc/A4o hXvT37wo4PQ91OvWqpc6fLIQ2Ucfm25ZGbHmZhuHN7hjKh/aa80WWO+xNyECS4Yr6grS Td85MgnXagvyNT2IRQbUXVXyRfKJGUzhwYj600wUuC+9NpJV2aSzGOYquFtSlHDf9rzE 8j1/97vhxj+KoysnVq2+bT35IbkaieR9Td+C8tcVgm6yeEjFnaVObdqW5neXolrOgY7T kXdA== 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=fQj77HYFB9KP5nHAsLxPJwUZNS+2cChzr3mTy8+9+98=; b=Y/of5fkln39RpBhwHgnCkNwY8vJZKbNKz35DoOgTq+Z5tP21eh9pj20m1WZlfyOEHN u4n2BOskM55M4rjyBVa7yqiw4fcUwl9xD3Qd/4A4u7GEroLvwJSnuRbMmHNSvkVkZEks kXoYC6yhOjkcN1PUsaNH/hX7QAtlbAspcrVreySnjVeF6RiZADdSiJwDuE+H+HFnEU81 kumwbgk/pu0ofvDRlHBHEaWwPresfAjd//KPt3foDYOKH7xG9ZscpsCQ5fBOXY02P6K8 Q5EZerCcJfDVUZCd39PoEbgTMMRPoB+m0Z16tcXCzcJqIOlGpQDD2oAk4/MoH/nnzCen KyUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jYz9inbU; 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 1-v6si14691037plv.16.2018.05.21.14.45.48; Mon, 21 May 2018 14:46:02 -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=jYz9inbU; 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 S1754371AbeEUVYB (ORCPT + 99 others); Mon, 21 May 2018 17:24:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:38672 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754362AbeEUVXs (ORCPT ); Mon, 21 May 2018 17:23:48 -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 D5C7C20871; Mon, 21 May 2018 21:23:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1526937828; bh=OkWbuNkPdCI5SU2N/c1ovoWoWNiox4ejo/P3r1Da7J4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jYz9inbUqtEjUJHeM9mqWQm+WX+dPXilDb28n9h3uIfN1nRehj1j4o+Mv+hX7RhkI LZbEMKir0iDUElTB9OuhE7bfD89hnqczrGHsiG4S0Ca5KiBuGtwJ+BSlCzcH+QcEdj 0u1bCeL4qdqzzCEzh+Jt7wMvQvv7M/6THKhjTo54= 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.16 041/110] s390/cpum_sf: ensure sample frequency of perf event attributes is non-zero Date: Mon, 21 May 2018 23:11:38 +0200 Message-Id: <20180521210507.731353876@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180521210503.823249477@linuxfoundation.org> References: <20180521210503.823249477@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.16-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 @@ -753,6 +753,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;