Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp718406imm; Thu, 13 Sep 2018 06:46:47 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaRJRLfZhSlhDlrrefd15ep6MnMeZIBOeK3qiyd8kRrshRgPLvHUsi+oPRSVHoSh1AOx/ea X-Received: by 2002:a17:902:7e09:: with SMTP id b9-v6mr7350631plm.221.1536846407079; Thu, 13 Sep 2018 06:46:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536846407; cv=none; d=google.com; s=arc-20160816; b=HM9VhjNKIXoc6DG+GOzft9BUxH7h5yUFMSArZZYQPPWrXqYm2hEDnIuHrhfHWrEcwy xyl2Yw4tzXg5j91mfogQ7zKUwe7/rsWOFmt7gJOATbIeXtSmS57hucpHt+SChsGGUpDC jBpd9m3mEQcEg33oD2nYUPzowtA4Vc4uwfUEQD0AVcw/3x+tDIJ3kjGeRSmJ+BUNYnJy FHeNrnYWre/48rPQacbB/gBKvs8uTAX+CBoCsZpGhk4A4L7S9nQG4Kg2x9vK83d429jm XQKagXilz51007BxXwuCExglT6tE6qyy4XbB4Umb9/Nhhfjkco+9vQKCKBufCxKZpq4i jj2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=5hkgcIE4/K05VzTWCeZuYEJGR7vbx0aQtj9dEzYEXRY=; b=g+oa4KjiejKkEsBmfpIkxZDSCR33ctoCyAEbU0MVsPH/kFFDbO5oP2GCsQn5yIkk5Q ZGdluHad5aVt0nJ3oGu5rEaVrH+33QKMLjFvVPNoLgaV8VPkF/aYAqsFBbJ81ST4Az37 qliX5Ug7pCFk84fUD/Nehri0blSZ8jaSJVHUoooaIlp5KBHSuPErEuya7FzR1atg5oGp ECKxa3JODR3SVv31Cvb4N2l/F9ENiVZ7cc5NXp2QGZZS0jvPCal5C4DxBrm7/a3MosdI aAMvCrNsErpueR9wYevIZI0UH/xRtK0gjggkbG3rz7/46CEuV8EKBFnOQAu5ux5FI4gQ 3RMQ== ARC-Authentication-Results: i=1; mx.google.com; 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 t31-v6si3272172pga.167.2018.09.13.06.46.30; Thu, 13 Sep 2018 06:46:47 -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; 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 S1730115AbeIMSyl (ORCPT + 99 others); Thu, 13 Sep 2018 14:54:41 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60664 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729717AbeIMSyl (ORCPT ); Thu, 13 Sep 2018 14:54:41 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 35AA0D19; Thu, 13 Sep 2018 13:45:08 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dmitry Vyukov , Dmitry Torokhov , Sasha Levin Subject: [PATCH 4.14 062/115] Input: do not use WARN() in input_alloc_absinfo() Date: Thu, 13 Sep 2018 15:31:22 +0200 Message-Id: <20180913131827.525452650@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180913131823.327472833@linuxfoundation.org> References: <20180913131823.327472833@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dmitry Torokhov [ Upstream commit 100294cee9a98bfd4d6cb2d1c8a8aef0e959b0c4 ] Some of fuzzers set panic_on_warn=1 so that they can handle WARN()ings the same way they handle full-blown kernel crashes. We used WARN() in input_alloc_absinfo() to get a better idea where memory allocation failed, but since then kmalloc() and friends started dumping call stack on memory allocation failures anyway, so we are not getting anything extra from WARN(). Because of the above, let's replace WARN with dev_err(). We use dev_err() instead of simply removing message and relying on kcalloc() to give us stack dump so that we'd know the instance of hardware device to which we were trying to attach input device. Reported-by: Dmitry Vyukov Acked-by: Dmitry Vyukov Signed-off-by: Dmitry Torokhov Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/input/input.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -480,11 +480,19 @@ EXPORT_SYMBOL(input_inject_event); */ void input_alloc_absinfo(struct input_dev *dev) { - if (!dev->absinfo) - dev->absinfo = kcalloc(ABS_CNT, sizeof(*dev->absinfo), - GFP_KERNEL); + if (dev->absinfo) + return; - WARN(!dev->absinfo, "%s(): kcalloc() failed?\n", __func__); + dev->absinfo = kcalloc(ABS_CNT, sizeof(*dev->absinfo), GFP_KERNEL); + if (!dev->absinfo) { + dev_err(dev->dev.parent ?: &dev->dev, + "%s: unable to allocate memory\n", __func__); + /* + * We will handle this allocation failure in + * input_register_device() when we refuse to register input + * device with ABS bits but without absinfo. + */ + } } EXPORT_SYMBOL(input_alloc_absinfo);