From patchwork Thu Oct 4 15:47:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Dumazet X-Patchwork-Id: 10626373 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7EAA91731 for ; Thu, 4 Oct 2018 15:47:57 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F1C4291EB for ; Thu, 4 Oct 2018 15:47:57 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 62FDA29228; Thu, 4 Oct 2018 15:47:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF98D291EB for ; Thu, 4 Oct 2018 15:47:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727519AbeJDWlq (ORCPT ); Thu, 4 Oct 2018 18:41:46 -0400 Received: from mail-pf1-f196.google.com ([209.85.210.196]:36355 "EHLO mail-pf1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727588AbeJDWlq (ORCPT ); Thu, 4 Oct 2018 18:41:46 -0400 Received: by mail-pf1-f196.google.com with SMTP id b7-v6so3587413pfo.3 for ; Thu, 04 Oct 2018 08:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=isN00gzYDRPSqD/Xx6NnnwdKGHJc8a7nlF+T4xqACog=; b=S/HHwBvzFwgQnr52TnMdt1qozxrdpUb/syfmQuqvyrMJZTkJY+dM9yMq+N/n0J1JFO jW4rwtXTdouPjqqnNPlVrc+8B4jiDZtj0Hyo6KuOHiZ9qewkKq8fwbaI73es5k/0VOhh 9xVZYGjyT4dgISynJ/3xjsHHbFYkjDxHpkxQeHomtNgMuMyA9egbQFxG3ezBXuVhXnN0 Oi/OMuVFReaKOvCBdeP2m6SEQLO1fT5M+/Nk9wRw1Ek+UO1d4ZIK4xHt3fxh3MdDZhW+ 6J4Zf/ijBNcu757L822JuKfjJOzZ18e6qcmVGydm8On1iI6jNyRwy5O9EkIZGwfYF1KC znFA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=isN00gzYDRPSqD/Xx6NnnwdKGHJc8a7nlF+T4xqACog=; b=VBAaJxXiVJNndtPGGhotS4zYZizwf1yH0X9CCAHOLF7kF2b8O2FoN+lfp+IimXk7S6 QRmyI6wncMw/JjqTUhm1xDQeWkDi2Q1HHWEDXGXRDas0weQ93j4S15ZSinaIeU8fpzI9 K5KuOsYj8vL1FrJsjmLEivkc74KXWuXsnTVpjq7m8dSf92dl8+A3UHI25VM7a4DEUReq 0B2DCZQIrSTnLV5a3YB7pR/Yn5PpHSbRhYleai/U0XtuHyg7XRt/XOEeGZNZ21oxkyx6 PU4z7IQiqSOwF9OmaAgvTOLfcrKB2VokCFZQxtvClgTTGb/MgmiDxJr/kVjNmEMs5O8a eMIQ== X-Gm-Message-State: ABuFfoiuLwbZ1r57S7efUbw9p+tBh+/if6Y7xuCpqNHXyKE6ox/9x/4o JVDjesDfYRtlxzUEJoLbVscdDw== X-Google-Smtp-Source: ACcGV62OVZtOVec/0c+lq5p/0+1f6wpgO2wLe6DwtMkhlJ2H6gcL815odmdQyPcLsZKmPMcNy7dkIg== X-Received: by 2002:a62:b286:: with SMTP id z6-v6mr7462366pfl.79.1538668074931; Thu, 04 Oct 2018 08:47:54 -0700 (PDT) Received: from localhost ([2620:15c:2c4:201:f5a:7eca:440a:3ead]) by smtp.gmail.com with ESMTPSA id q25-v6sm8542568pfk.154.2018.10.04.08.47.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Oct 2018 08:47:53 -0700 (PDT) From: Eric Dumazet To: linux-kernel Cc: Eric Dumazet , Eric Dumazet , Dmitry Torokhov , linux-input@vger.kernel.org Subject: [PATCH] Input: mousedev - add a schedule point in mousedev_write() Date: Thu, 4 Oct 2018 08:47:49 -0700 Message-Id: <20181004154749.111595-1-edumazet@google.com> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog MIME-Version: 1.0 Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP syzbot was able to trigger rcu stalls by calling write() with large number of bytes. Add a cond_resched() in the loop to avoid this. Link: https://lkml.org/lkml/2018/8/23/1106 Signed-off-by: Eric Dumazet Reported-by: syzbot+9436b02171ac0894d33e@syzkaller.appspotmail.com Cc: Dmitry Torokhov Cc: linux-input@vger.kernel.org Reviewed-by: Paul E. McKenney --- drivers/input/mousedev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/input/mousedev.c b/drivers/input/mousedev.c index e08228061bcdd2f97aaadece31d6c83eb7539ae5..412fa71245afe26a7a8ad75705566f83633ba347 100644 --- a/drivers/input/mousedev.c +++ b/drivers/input/mousedev.c @@ -707,6 +707,7 @@ static ssize_t mousedev_write(struct file *file, const char __user *buffer, mousedev_generate_response(client, c); spin_unlock_irq(&client->packet_lock); + cond_resched(); } kill_fasync(&client->fasync, SIGIO, POLL_IN);