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 8B3ABC43381 for ; Tue, 19 Mar 2019 18:18:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 612892082F for ; Tue, 19 Mar 2019 18:18:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553019482; bh=UF/yHbqEwuU5XxANzijekRAuZpVyEfhCvBgZ/GHYo6Y=; h=Subject:To:Cc:From:Date:List-ID:From; b=GSFMFHiXk+2zs0OCcALFJcXrUI0Kb/mqygH0WEB+EmExVubOfgkmcKN6PCKv1xbQd HBpQxby5gvcw7rOBwd7VBhZCF0VjRzF5pwTnQQ7bpeChu2sKuMrejDBftgRPyNc/fE hUICBQFXz9mkMHcgcRauAdfCU7KAh42cBc4695zw= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726768AbfCSSSC (ORCPT ); Tue, 19 Mar 2019 14:18:02 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:53427 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726707AbfCSSSB (ORCPT ); Tue, 19 Mar 2019 14:18:01 -0400 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 9A9E022044; Tue, 19 Mar 2019 14:18:00 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Tue, 19 Mar 2019 14:18:00 -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=rYjDQg EpBgCWbtEpU6DIb4Pc/qx2trMnGi/KR5T65/o=; b=xoQIHlLzsQdY+r8HOnQhm5 fXA1Bp8pK6GiryDHQFlC0oc5unUJmy7i3wwyCSQo9w/Az/XYtL/IwY6pU2F4kYw/ 58XlgK6l3T9X/MpBtMPG/junBLhs7EaSDHfYDFXB4aoPJomcZRobqXCwbuCRnTRS XeW1EIWfdpK6Ip3EtlDXFX2982UWHMuxbsai2lSSGPj7rICOVJa+WRFYnlPjRlKL 8KvOPVM9JkrQ2T+J29sQi9SI05JWbWORSk1bI7eunxnhMSKjf9I8Tf7UFH3sOgFU JeGivN7JMWmKJHv453rDw/vdjbv+x5hY0Js0LTBUIVqYA3u/HvEURNXRASxUP1TQ == 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 21ED5E41BB; Tue, 19 Mar 2019 14:18:00 -0400 (EDT) Subject: FAILED: patch "[PATCH] stm class: Prevent division by zero" failed to apply to 4.9-stable tree To: alexander.shishkin@linux.intel.com Cc: From: Date: Tue, 19 Mar 2019 19:17:50 +0100 Message-ID: <155301947024893@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.9-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;