From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3F426C43381 for ; Tue, 19 Mar 2019 18:18:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0BADC2082F for ; Tue, 19 Mar 2019 18:18:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553019485; bh=RbPETuJlSTsV4UfmMjKM8NEHkZmfF7Qc5+DFH7d5TvQ=; h=Subject:To:Cc:From:Date:List-ID:From; b=u0LSqXPOSz+ZD7DY4OwFoJ4LbDKFEgwotFGaBRfg+bKV9My7yjQbhjg2BDurqMafR 309U6R5dnP+tMc7bZBsctaHV43FSvoFIRFZoazbbnlWXR4Ab8hKa7p2vxQXDmIzZ5/ Dz0ezUu/HL1ZVZcQxyujlCyehufpP+qPgfBnZm+k= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727013AbfCSSSE (ORCPT ); Tue, 19 Mar 2019 14:18:04 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:59855 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726707AbfCSSSE (ORCPT ); Tue, 19 Mar 2019 14:18:04 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id A206D21F01; Tue, 19 Mar 2019 14:18:03 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Tue, 19 Mar 2019 14:18:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=dxkIks TCrDoPP8oeq+KPSG6QYGl9tLfoxCzZAXutnHc=; b=F6DHtT+TKOq6qzwBLIDslB q2Ea92QEx/PBV46Bm9L/6vUi1dee1pwUeC2nWbfyWNQ0AsaMRihTIvDa2DJm8rTN b5Ev+pBzp0dae25E8yK53snos0XRmPnEN9tSpP0NK2cTZLR3QsiRPCEevrW+jqZT cZZH4w+1T/WUwey5cNLoTnBI8P/nfkUCQ3JsQq/bWIvtFsq7jr00cgmrUiaXOCqf yiugykGitXkiHlz5C0a8Pni23VkCGs8C0HZtEOymVrafQg8yYRPIv2ZgIHzh5NhV qacQIO2SECXNrSItifWzhUM8OEMY2FK1EHc4NXd5KF4WzcLJ1DfL2gauvBTC9iQQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrieeggdduudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecukfhppeekfedrkeeirdekledruddtjeenucfrrghrrghmpehmrghilhhfrhhomh epghhrvghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgepud X-ME-Proxy: Received: from localhost (5356596b.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id 1471710314; Tue, 19 Mar 2019 14:18:02 -0400 (EDT) Subject: FAILED: patch "[PATCH] stm class: Prevent division by zero" failed to apply to 4.14-stable tree To: alexander.shishkin@linux.intel.com Cc: From: Date: Tue, 19 Mar 2019 19:17:50 +0100 Message-ID: <1553019470241223@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org The patch below does not apply to the 4.14-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From bf7cbaae0831252b416f375ca9b1027ecd4642dd Mon Sep 17 00:00:00 2001 From: Alexander Shishkin Date: Thu, 21 Feb 2019 14:19:17 +0200 Subject: [PATCH] stm class: Prevent division by zero Using STP_POLICY_ID_SET ioctl command with dummy_stm device, or any STM device that supplies zero mmio channel size, will trigger a division by zero bug in the kernel. Prevent this by disallowing channel widths other than 1 for such devices. Signed-off-by: Alexander Shishkin Fixes: 7bd1d4093c2f ("stm class: Introduce an abstraction for System Trace Module devices") CC: stable@vger.kernel.org # v4.4+ diff --git a/drivers/hwtracing/stm/core.c b/drivers/hwtracing/stm/core.c index c80b064224f6..c7ba8acfd4d5 100644 --- a/drivers/hwtracing/stm/core.c +++ b/drivers/hwtracing/stm/core.c @@ -735,7 +735,7 @@ static int stm_char_policy_set_ioctl(struct stm_file *stmf, void __user *arg) struct stm_device *stm = stmf->stm; struct stp_policy_id *id; char *ids[] = { NULL, NULL }; - int ret = -EINVAL; + int ret = -EINVAL, wlimit = 1; u32 size; if (stmf->output.nr_chans) @@ -763,8 +763,10 @@ static int stm_char_policy_set_ioctl(struct stm_file *stmf, void __user *arg) if (id->__reserved_0 || id->__reserved_1) goto err_free; - if (id->width < 1 || - id->width > PAGE_SIZE / stm->data->sw_mmiosz) + if (stm->data->sw_mmiosz) + wlimit = PAGE_SIZE / stm->data->sw_mmiosz; + + if (id->width < 1 || id->width > wlimit) goto err_free; ids[0] = id->id;