Received: by 2002:ac0:adb2:0:0:0:0:0 with SMTP id o47-v6csp7081imb; Wed, 5 Sep 2018 19:39:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdY8FXFzjGehjMlGoLf38tLG9qBnLiCVOc8924FL7BRZhh8IyWRlzwJZ+yYXS7Uzv9c+Zx9L X-Received: by 2002:a62:9f4c:: with SMTP id g73-v6mr697965pfe.142.1536201563128; Wed, 05 Sep 2018 19:39:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536201563; cv=none; d=google.com; s=arc-20160816; b=ILZn5EVOatTbNg9kH5iDrkT94Cw1OW2CTPd2CRrUDb0e68WUpCiict7IYjyhwAUQPT cymG7ubPz0IkcQ1PhqLeUFqO1lzQXbHRCJKEodkw57QKtf1LwyAwqDyXPke8tsC9+GdD coeOjx6y1d6/dVUtIS9/Yiw0eDux6wPIeidz07vpytzOFwlfTnlH9u90NMzmylUwa8jc p8nWo2dJz18NF13XF3re2uUdbhpttQKqsJKUHQ8v9COWdtxsea1rVpyd1G4vPTHwcOOL pHav8yx77C1qMsL5kSxZ+EGiPcK6k5h6UkI7Xa5q6zCEndLN0GTWKY8tvVpb+iFxkcdS YDHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=/Iy9H1VfReeHP1QihtFtb2tZ2R5LbwwkqWbqHQve00A=; b=xssypAQUJp2gXhN8XeK/Csu2JheQgtWNXgH/fQ/jPA4Ko5prt3I0Feo+Nf+3FeOWpf xcFqIBl28SOEOhXQZQaAHX2oZV08YTMbs+lT8nH4DhMk2W047CAC3roQ841nqzv0D7wA wFjKDEKVVSbdL+yMzUO6g43oGj7sPgEToWrsNHqWrL4kTe1ou+dugv5M20z/2Ccafhmh e9MAhHXsrLFXqnNgwXzZVN6nBF770aiaKGXK8iG4YOsDiYhEH2sPckgD5P0Lr6UnuGA0 cOZhKBAfWcywGXlf0x4+MJTfzs7gde4nBnJrBJQAdNTTKOsbl72SQpfpgW6Odfvl9fpb b8tA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dy68EDud; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x22-v6si3412496pfh.84.2018.09.05.19.38.37; Wed, 05 Sep 2018 19:39:23 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dy68EDud; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726598AbeIFHIX (ORCPT + 99 others); Thu, 6 Sep 2018 03:08:23 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:34792 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725781AbeIFHIW (ORCPT ); Thu, 6 Sep 2018 03:08:22 -0400 Received: by mail-pl1-f196.google.com with SMTP id f6-v6so4224206plo.1; Wed, 05 Sep 2018 19:35:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=/Iy9H1VfReeHP1QihtFtb2tZ2R5LbwwkqWbqHQve00A=; b=dy68EDudGm3V26cae9jT7OQUWCAHeZyBGAmfwcNR1H9a7Di1rrsjg1SwigTR7yuCvB QHhI3TUFw5LVYHG3dI4jfeuR00akYW9LbDkfEZUPKnSZWEt407JTs50zWRlZMsq7s7Pk eiukkC4FZwBVLupEFVZs09aIxEZ4xO8335hIRPmG1bigBFjGf/YaniCEQKSf8a3z0O41 ZZByofkGhol3nsc/rBLxx1CuDpQJGjBGXSs9B0qcPK/fqzkREsoFSPWcuwC3yIg8KGgv iE2F4Sdv/pQ3nQPwnVvyc3I9NctPipvDTWI3SNDnUMea6lnnj1b6kbDcOuRTKKMz6TZL 1OOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=/Iy9H1VfReeHP1QihtFtb2tZ2R5LbwwkqWbqHQve00A=; b=Ia9bOD35D2Yt1pxMAnRHdD3tOlIoaNXaaBZmb2N5UtZOj/NY5ix1EFQwU4BVRv9Paj 1YqAmYOg46Qvv0yyb1XUIkFdCSU5HrzFWjn2+MNPW1XDEUecETavf0akVkP2ZsfB3207 QkixC5+az4n+kLT7aybZFMu0GEtOWgg9bxC6YoAOBcFGoppQY3xxijH0B9ZHv0O+H1Et rFjb5SpqIqumotBpmvPi37EdG6FssCAVXIHdSsurXgF786HY003iOPBCdmW7fNqSdERB nz/W8LvSmwK7Dgf7Y3MjO5BDfBK9NHx50TCqtUtN/J+Nb+w2xbPGxzAm8xf1n8wLsGlP z6Xw== X-Gm-Message-State: APzg51DIlVH+dffzm+l/vCl+u+A4H450rZqv81DDSsgwtxSRdWic3ND5 oHj4dd09lFDmh1+0VBSe/T2okoTc X-Received: by 2002:a17:902:714f:: with SMTP id u15-v6mr649317plm.154.1536201319051; Wed, 05 Sep 2018 19:35:19 -0700 (PDT) Received: from ?IPv6:2402:f000:1:1501:200:5efe:166.111.71.58? ([2402:f000:1:1501:200:5efe:a66f:473a]) by smtp.gmail.com with ESMTPSA id l85-v6sm7276214pfk.34.2018.09.05.19.35.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Sep 2018 19:35:18 -0700 (PDT) Subject: Re: [PATCH] hid: hid-core: Fix a sleep-in-atomic-context bug in __hid_request() To: Jiri Kosina Cc: benjamin.tissoires@redhat.com, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org References: <20180901121659.1257-1-baijiaju1990@gmail.com> From: Jia-Ju Bai Message-ID: <6ec3d032-6d33-d2af-965f-7f3457dc8311@gmail.com> Date: Thu, 6 Sep 2018 10:35:14 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2018/9/5 16:29, Jiri Kosina wrote: > On Sat, 1 Sep 2018, Jia-Ju Bai wrote: > >> The driver may sleep with holding a spinlock. >> >> The function call paths (from bottom to top) in Linux-4.16 are: >> >> [FUNC] hid_alloc_report_buf(GFP_KERNEL) >> drivers/hid/hid-core.c, 1435: >> hid_alloc_report_buf in __hid_request >> ./include/linux/hid.h, 1023: >> __hid_request in hid_hw_request >> drivers/hid/hid-picolcd_core.c, 111: >> hid_hw_request in picolcd_send_and_wait >> drivers/hid/hid-picolcd_core.c, 100: >> _raw_spin_lock_irqsave in picolcd_send_and_wait >> >> [FUNC] hid_alloc_report_buf(GFP_KERNEL) >> drivers/hid/hid-core.c, 1435: >> hid_alloc_report_buf in __hid_request >> ./include/linux/hid.h, 1023: >> __hid_request in hid_hw_request >> drivers/hid/hid-picolcd_core.c, 245: >> hid_hw_request in picolcd_reset >> drivers/hid/hid-picolcd_core.c, 235: >> _raw_spin_lock_irqsave in picolcd_reset >> >> [FUNC] hid_alloc_report_buf(GFP_KERNEL) >> drivers/hid/hid-core.c, 1435: >> hid_alloc_report_buf in __hid_request >> ./include/linux/hid.h, 1023: >> __hid_request in hid_hw_request >> drivers/hid/hid-picolcd_fb.c, 215: >> hid_hw_request in picolcd_fb_reset >> drivers/hid/hid-picolcd_fb.c, 206: >> _raw_spin_lock_irqsave in picolcd_fb_reset >> >> [FUNC] hid_alloc_report_buf(GFP_KERNEL) >> drivers/hid/hid-core.c, 1435: >> hid_alloc_report_buf in __hid_request >> ./include/linux/hid.h, 1023: >> __hid_request in hid_hw_request >> drivers/hid/hid-lg4ff.c, 465: >> hid_hw_request in lg4ff_play >> drivers/hid/hid-lg4ff.c, 441: >> _raw_spin_lock_irqsave in lg4ff_play >> >> To fix this bug, GFP_KERNEL is replaced with GFP_ATOMIC. >> >> This bug is found by my static analysis tool DSAC. > Could you please rewrite the changelog so that it's human readable? The > above is a bit hard to understand, I think something along the lines of > "__hid_request() has to be allocating with GFP_ATOMIC because there are > the following callchains leading to __hid_request() being an atomic > context: ... a->b->c.._hid_request()" etc. > Okay, I will send a new patch. Best wishes, Jia-Ju Bai