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 A93D8C43381 for ; Tue, 19 Mar 2019 18:17:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6D33E2082F for ; Tue, 19 Mar 2019 18:17:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553019475; bh=KfXqZeXj3CD6xUwK0sBfqyrnSOm3Vdd1bBXGp0QXioM=; h=Subject:To:Cc:From:Date:List-ID:From; b=sMKfv+jyZcgKbCfkMyEcroc022UP6vI3yKtpZ1Iwc6npbk2lc+qKjvzfJ2IA7AmhI Bgf2sdYbwO7kNMsx8ZDeK5P1p+CU6UHDrUFUTTMs2uQxbIlrD51DHe2SFBdho/LG8F E710KR0RNP6YlUxtb+AUiapehXpFRkwZZk3Mn5IM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726751AbfCSSRz (ORCPT ); Tue, 19 Mar 2019 14:17:55 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:36939 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726707AbfCSSRy (ORCPT ); Tue, 19 Mar 2019 14:17:54 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id B698E2202C; Tue, 19 Mar 2019 14:17:53 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 19 Mar 2019 14:17:53 -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=c9Bjpe Bm+xHW8++PeSwfhPqmWdIXnNScUDnGXNUzwME=; b=Kv+/IW7h300aH6kMf9oo7l dZrmnoVs02GX43j/eoL0kPejeXOro/onhbCYgqXM8BzuSXRd8P2eqa9IrkyBjOBq cZVFMqghLpfNsEajoFyoOlHfRsylDc6w9T5DbOQK04CyNZptNvxDybHANtqT7BoB D2LCZWJIO+yQGdOmjz9+nhERBxepouxtaSDOrnuidq3yjwZXVGVPXx2DvrWU/I8n RatnR9KQCZ/U0fxMhDfcGdFSrkwijZHrbFEMQ/xoKRq48X/rKDDBp+3D1eu9DzYm EWsuEwEMNXdxvj+/ihsWhrnUHCsoUGpUQx+Of+5SijRxp+VumAOGd+8XLdpzbrqw == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedutddrieeggdduudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtlfenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecukfhppeekfedrkeeirdekledruddtjeenucfrrghrrghmpehmrghilhhfrhhomh epghhrvghgsehkrhhorghhrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd 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 6DE00E4581; Tue, 19 Mar 2019 14:17:52 -0400 (EDT) Subject: FAILED: patch "[PATCH] stm class: Prevent division by zero" failed to apply to 4.4-stable tree To: alexander.shishkin@linux.intel.com Cc: From: Date: Tue, 19 Mar 2019 19:17:50 +0100 Message-ID: <15530194708093@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.4-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;