Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2331781imm; Mon, 24 Sep 2018 02:26:51 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYSL0F0jFpZHz8ov0JesaDY3EBpxG/jkXVsAbYtwUXNWByrg2FytsB0FFtWaPvUAnl8FT4x X-Received: by 2002:a62:670a:: with SMTP id b10-v6mr8298121pfc.243.1537781211069; Mon, 24 Sep 2018 02:26:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537781211; cv=none; d=google.com; s=arc-20160816; b=KXGVYLPzBOat1aQ2t/mD3iqE8IxwR90EmFUmbzrHrrqSBPkx5uy+waXyGzC5eTI77p EM7RjAlIdCRkc40S+Ng/LpSYkehfZSoB/lo+qzY3h6pX6URRd7flEcvMCrqHWe8iX22I JfDR0f90vMcb4LSAIXF6UsIRtwsFxb7wpI7NhEYTmu3kFQFNx2KEC8a90y2fx8/FEG55 8eKGQ2yhDrVqAR4E9csQijCHxqYaDzJ5LcnBSWPEOg1VxLmw4emq7rzGZ2KELQQhOD7H o5Y6wbe3J+CUGHX5oU6W574OCkAw83CZTaixbB3EdPsVOuMDnV7+ZR6QZSvUMyd4Ucpj PhEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=BrRpFzFJjzQrImQjoUXPmBNlVd6+3YpOq/NmUCbfCp0=; b=m9To7Oayj5DlF0erLGkZtPkR4FQ1BQkolZy7FJmLP1xdusQXJ3w7xvWGcZOvBUpNRr KGm0Kcr1x8lEDjYdmhsKbWyH4K87jlCz9/SEdBnFPEwjSmOuy00yCUNI0S6n/LhtJNbt T6JY+BsPTQhw1JfZnFUoWi3w2tNyGNUm1QzANs9d7I9cJfUfM747rEKXu0ufputNwkPp wkX1Echm+ZJkDxDcDjKWuNvbd+twdtKcRmRSgHKWLMykxTFwPPgn7MrTX7HBriipf52D J04GFb2838j/Oh+g9y0q6BUpPBIC9h5DCOPfQsAWDPsa5EmCp/wElRRN+x0VdFBpQh3W lcpQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 33-v6si7477929pla.475.2018.09.24.02.26.35; Mon, 24 Sep 2018 02:26:51 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728374AbeIXP1R (ORCPT + 99 others); Mon, 24 Sep 2018 11:27:17 -0400 Received: from mx2.suse.de ([195.135.220.15]:35134 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725935AbeIXP1R (ORCPT ); Mon, 24 Sep 2018 11:27:17 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 6831AAD94; Mon, 24 Sep 2018 09:26:07 +0000 (UTC) Date: Mon, 24 Sep 2018 11:26:06 +0200 (CEST) From: Jiri Kosina To: Jia-Ju Bai cc: benjamin.tissoires@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2] hid: hid-core: Fix a sleep-in-atomic-context bug in __hid_request() In-Reply-To: <20180913033432.16336-1-baijiaju1990@gmail.com> Message-ID: References: <20180913033432.16336-1-baijiaju1990@gmail.com> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 13 Sep 2018, Jia-Ju Bai wrote: > hid_alloc_report_buf() has to be called with GFP_ATOMIC in > __hid_request(), because there are the following callchains > leading to __hid_request() being an atomic context: > > picolcd_send_and_wait (acquire a spinlock) > hid_hw_request > __hid_request > hid_alloc_report_buf(GFP_KERNEL) > > picolcd_reset (acquire a spinlock) > hid_hw_request > __hid_request > hid_alloc_report_buf(GFP_KERNEL) > > lg4ff_play (acquire a spinlock) > hid_hw_request > __hid_request > hid_alloc_report_buf(GFP_KERNEL) > > lg4ff_set_autocenter_ffex (acquire a spinlock) > hid_hw_request > __hid_request > hid_alloc_report_buf(GFP_KERNEL) Hm, so it's always drivers calling out into core in atomic context. So either we take this, and put our bets on being able to allocate the buffer without sleeping, or actually fix the few drivers (it's just lg4ff and picolcd at the end of the day) not to do that, and explicitly anotate __hid_request() with might_sleep(). Hmm? Thanks, -- Jiri Kosina SUSE Labs