From patchwork Wed Jul 31 21:17:58 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Hurley X-Patchwork-Id: 2836578 X-Patchwork-Delegate: jikos@jikos.cz 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CC7D6C0319 for ; Wed, 31 Jul 2013 21:34:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A6A6E200E3 for ; Wed, 31 Jul 2013 21:34:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A5512200E1 for ; Wed, 31 Jul 2013 21:34:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757719Ab3GaVew (ORCPT ); Wed, 31 Jul 2013 17:34:52 -0400 Received: from mailout01.c08.mtsvc.net ([205.186.168.189]:40734 "EHLO mailout01.c08.mtsvc.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753653Ab3GaVev (ORCPT ); Wed, 31 Jul 2013 17:34:51 -0400 X-Greylist: delayed 976 seconds by postgrey-1.27 at vger.kernel.org; Wed, 31 Jul 2013 17:34:51 EDT Received: from n18.c08.mtsvc.net ([205.186.176.18]) by mailout01.c08.mtsvc.net with esmtp (Exim 4.72) (envelope-from ) id 1V4dn0-000292-3i; Wed, 31 Jul 2013 14:18:34 -0700 Received: from 66-189-93-236.dhcp.oxfr.ma.charter.com ([66.189.93.236]:36493 helo=thor.lan) by n18.c08.mtsvc.net with esmtpsa (TLS1.1:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.80.1) (envelope-from ) id 1V4dmy-00074C-7H; Wed, 31 Jul 2013 14:18:33 -0700 From: Peter Hurley To: Jiri Kosina Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, Peter Hurley Subject: [PATCH linux-next] hid/logitech-dj: Fix non-atomic kmalloc in logi_dj_ll_input_event() Date: Wed, 31 Jul 2013 17:17:58 -0400 Message-Id: <1375305478-26754-1-git-send-email-peter@hurleysoftware.com> X-Mailer: git-send-email 1.8.1.2 X-Authenticated-User: 125194 peter@hurleysoftware.com X-Spam-Status: No, score=-8.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Level: Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ll_driver's .hidinput_input_event() method is called from atomic context [1]. Use GFP_ATOMIC for allocation of the synthesized hid report. Signed-off-by: Peter Hurley [1] BUG: sleeping function called from invalid context at /home/peter/src/kernels/next/mm/slub.c:941 in_atomic(): 1, irqs_disabled(): 1, pid: 2095, name: Xorg INFO: lockdep is turned off. irq event stamp: 1502178 hardirqs last enabled at (1502177): [] _raw_spin_unlock_irqrestore+0x65/0x80 hardirqs last disabled at (1502178): [] common_interrupt+0x6a/0x6f softirqs last enabled at (1501802): [] __do_softirq+0x183/0x420 softirqs last disabled at (1501799): [] irq_exit+0xb5/0xc0 CPU: 3 PID: 2095 Comm: Xorg Not tainted 3.11-next-20130725-xeon+lockdep #20130725 Hardware name: Dell Inc. Precision WorkStation T5400 /0RW203, BIOS A11 04/30/2012 ffffffff81a662e0 ffff8802adcf9ca8 ffffffff8177c330 0000000000000000 ffff8802a76d2440 ffff8802adcf9cd8 ffffffff810867d0 ffff8802a7ac8000 0000000000000010 00000000ffffffff 00000000000000d0 ffff8802adcf9d38 Call Trace: [] dump_stack+0x4f/0x84 [] __might_sleep+0x140/0x1f0 [] __kmalloc+0x6b/0x2e0 [] ? hid_alloc_report_buf+0x28/0x30 [hid] [] hid_alloc_report_buf+0x28/0x30 [hid] [] logi_dj_ll_input_event+0xb0/0x1b0 [hid_logitech_dj] [] input_handle_event+0x8e/0x540 [] ? input_inject_event+0x5d/0x220 [] input_inject_event+0x1c0/0x220 [] ? input_inject_event+0x44/0x220 [] ? might_fault+0xa0/0xb0 [] ? might_fault+0x57/0xb0 [] evdev_write+0xde/0x160 [] vfs_write+0xc8/0x1f0 [] SyS_write+0x55/0xa0 [] system_call_fastpath+0x16/0x1b --- drivers/hid/hid-logitech-dj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-logitech-dj.c b/drivers/hid/hid-logitech-dj.c index 510fa8f..e7ad88e 100644 --- a/drivers/hid/hid-logitech-dj.c +++ b/drivers/hid/hid-logitech-dj.c @@ -591,7 +591,7 @@ static int logi_dj_ll_input_event(struct input_dev *dev, unsigned int type, } hid_set_field(field, offset, value); - data = hid_alloc_report_buf(field->report, GFP_KERNEL); + data = hid_alloc_report_buf(field->report, GFP_ATOMIC); if (!data) { dev_warn(&dev->dev, "failed to allocate report buf memory\n"); return -1;