From patchwork Wed May 18 21:32:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 9122661 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id AA041BF29F for ; Wed, 18 May 2016 21:32:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CAC092034E for ; Wed, 18 May 2016 21:32:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F30D62034B for ; Wed, 18 May 2016 21:32:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752299AbcERVct (ORCPT ); Wed, 18 May 2016 17:32:49 -0400 Received: from mail-pf0-f196.google.com ([209.85.192.196]:33545 "EHLO mail-pf0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752008AbcERVcs (ORCPT ); Wed, 18 May 2016 17:32:48 -0400 Received: by mail-pf0-f196.google.com with SMTP id y7so6067947pfb.0 for ; Wed, 18 May 2016 14:32:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=9+qqprcEBs5DG8u7r3NvtGJ8EDi2rKd0BwyN5VNPi5w=; b=tWkfh4p0i9nH/uyBKho1d2cyydK1h6hphtwHExJlDM9TijKeh2+1XrSXpQ5iC2KmMZ Z2XfRImWFmVP6TH0CeVJ1WfO3CfuCbWrraeszVY0q66VBmJbDCnZui+FzPfhH7N1a1Sx WDfcwOzNQ21Zi+sX0s0egmEa+mCwMudauSywZmqjTrti43IDwbCJAlskrXkY3Fq3bSon Satx8tN8Kk9aCI7EWmYOGP51mfgXoTg6qqiWWF3z3CHFnzsqHeDLAD+yXc2FL/MLGcRK RhrAHBRyJh8CByH398ns4pGpd1WuMtPpfFYkfBNMy3I6ronrhve/WgXONHFSCRtXxZeh k10w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=9+qqprcEBs5DG8u7r3NvtGJ8EDi2rKd0BwyN5VNPi5w=; b=bg1NKqAjdGwEZz7OGNt50Wc6zVDE2+ecBuc/jQpImU4HTaz4OK2jXF7r/D/oz5zvy9 zNvHfp3VvzNXPh0Ef31QRIf6YKQFLxQLTZ73piySYY+SLR7OfLkjNtFSfZeH2I6yZ/gW rAufKSYywgMO6PAyJKLkZuOQBTbQgtD6J0b8mrPz0FhklPopouBqMgYKrxCj+4kyYRzL 75Ud+4C2V+gMgQ5d/P7Op4tnZVyZQXOGsaMuJH3f4gvzTcygvGWv2cyOPRaqqHsFertC 3pt7FyUa9w3EO3Z29JB+5WiL5/ENIP/tYphScQhK6kSrTZIg7vkqCHm8FodXAxPM7e78 n2Sg== X-Gm-Message-State: AOPr4FWQhLVh71c6/OCzCM5rx5MSNN7iucUz+ejQ9zlzcQrFF5/w7bTPp5aH72ND4gxUOA== X-Received: by 10.98.75.154 with SMTP id d26mr13932866pfj.72.1463607167507; Wed, 18 May 2016 14:32:47 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1311:9db4:a536:1581:46a0]) by smtp.gmail.com with ESMTPSA id ym8sm14455990pab.22.2016.05.18.14.32.46 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 18 May 2016 14:32:46 -0700 (PDT) Date: Wed, 18 May 2016 14:32:44 -0700 From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Jiri Kosina , Benjamin Tissoires , Henrik Rydberg , djkurtz@chromium.org Subject: [PATCH] Input: feed more data into entropy pool Message-ID: <20160518213244.GA3167@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Commit 4369c64c79a22 ("Input: Send events one packet at a time") significantly reduced amount of entropy input core was feeding to the rest of the system, because only the very first event in the event block would be used as source of entropy. With this change we will be calling add_input_randomness() for every event that is not filtered by the input core as a duplicate. In addition, all EV_SYN events are ignored. Signed-off-by: Dmitry Torokhov Acked-by: Henrik Rydberg Acked-by: Benjamin Tissoires --- drivers/input/input.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/input/input.c b/drivers/input/input.c index b87ffbd..d95c34e 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -153,8 +153,6 @@ static void input_pass_values(struct input_dev *dev, rcu_read_unlock(); - add_input_randomness(vals->type, vals->code, vals->value); - /* trigger auto repeat for key events */ if (test_bit(EV_REP, dev->evbit) && test_bit(EV_KEY, dev->evbit)) { for (v = vals; v != vals + count; v++) { @@ -371,9 +369,10 @@ static int input_get_disposition(struct input_dev *dev, static void input_handle_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) { - int disposition; + int disposition = input_get_disposition(dev, type, code, &value); - disposition = input_get_disposition(dev, type, code, &value); + if (disposition != INPUT_IGNORE_EVENT && type != EV_SYN) + add_input_randomness(type, code, value); if ((disposition & INPUT_PASS_TO_DEVICE) && dev->event) dev->event(dev, type, code, value);