Received: by 10.213.65.68 with SMTP id h4csp932618imn; Sun, 18 Mar 2018 07:54:15 -0700 (PDT) X-Google-Smtp-Source: AG47ELvFNNx/HWFH5vEAx1Z9BF84n/9uKyiczPaRUOnp3wf4r7RzxZt1W8+UcUSj5iT4urwNpyLj X-Received: by 2002:a17:902:59c9:: with SMTP id d9-v6mr9293504plj.251.1521384855610; Sun, 18 Mar 2018 07:54:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521384855; cv=none; d=google.com; s=arc-20160816; b=yFsX+TE0eSxyOdotggZj+ZOzQjtJ2svPF6PhFT75yjLOxx0M4v7vh8D0lCExdMw27K PmENbk2bbcIdJVXT0dAg6XL2FYxfe5nE1MWQf0nluLnzmBzy5AjWDh/qhBGoKpGtQLxr jrQq0buWTr79kZILQzkwoIFiWebT2EzFVBaYqX+FDOKJspEjCKOV60eUdVaEpQAm1DcB WYl4LdUXkoYr8nzG4wFrQzPjYeSurbMNxXjaoOdGQE2ul0g2hjjhndvmslGBs8uSRD18 2NEG0u2G9CHAAqgA49BDJPUGWPFfyhVLORU0omoQ13m7fI/OFkvM9rLy3iYMv3c7gnXE RmcQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=VrR3Uk9n+OoC8u32rFwOhOGe52UsUw0ZmNAfBB9sos8=; b=AMePoHkVCZN4iAKDjgbz0AmZzXDDs25lGdfmE/ImHvvje29yDzknWD3mZ0AO3LLbjt QtJ6ejXWwUBNugIt1Cgh7WTyI3V6/F0lhGuT2iw6JbSbU+d1kJyhnq4BSWNo4UxL0QYG 12wFfNZPTDlBkBZdYA+xx8AMqTHBc0c1kYf/JES70g+kgAs+x8+p1zsHX5j7csG/gQdR mhxJk3+XwdO6nWCgCn2eUqHCQ7paiBsWf9diyfdCAY/ZMoi6vbl5Do2DijjMRCqWCUbK +olPs9Dn5VnL+CIQBLsaDBgvR9aHAzZhTu91WoikEFtUnWuCBusGTd5Rk1eWt79HXobr djqA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=JTgj46FB; 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 f6si5673630pgr.690.2018.03.18.07.54.01; Sun, 18 Mar 2018 07:54:15 -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=JTgj46FB; 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 S1754447AbeCROwW (ORCPT + 99 others); Sun, 18 Mar 2018 10:52:22 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:45206 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754275AbeCROwV (ORCPT ); Sun, 18 Mar 2018 10:52:21 -0400 Received: by mail-pl0-f68.google.com with SMTP id n15-v6so977533plp.12 for ; Sun, 18 Mar 2018 07:52:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=VrR3Uk9n+OoC8u32rFwOhOGe52UsUw0ZmNAfBB9sos8=; b=JTgj46FBdcGAjFjTlXfbTlydkRQ1nHi9pVtAkQMuU0H/ESSiDkxZu1AsmO6HmvNEyo CYSoyUX5Q30v/2RSgkbSbaSdwE6PxbdVociVSnxwkmG9WajyYizRy6oU6wdQ5nIFgHPA 86Swdyd6Ou4qeNiUGtwFzblQQYhG1pNOwAuH97Rk052tdgUHNdbMYrmmtmgEzEa/I9Xr 8XlFuOvS72dW/AMpm/Coo5dMW6Es4j4zxgBhTUvO4IUb4raMMs1Nfmo7k7ND34yVhpAi GFjQQE05h4gWzU+fmfobdWeen0BXMK+UEW6KFLodwA/Qzz7t/ymOSEKNbKZFAWuaSQR/ 3DlA== 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; bh=VrR3Uk9n+OoC8u32rFwOhOGe52UsUw0ZmNAfBB9sos8=; b=bVEMGLU3q5oVAYfLTjLvtfQs2Cq+FqVXyNP2tpb/sTmk7c64YSF02yOiFiSglp180L rhnPPSAzDExHC0XSKRrklGkCI7xw1m1izBxuVC0EAMmofg7gu7sznLhI04WnkRYvBotc aAeJpQmtcz3MEoWZE4oBxX0uoH2i3GFZemnYgVb15aX6IPoCIWMj3MCmDT2zXA36Da0h VvnwH6n2LO/Kjjv9NLbNsDKFkZAfUpAbeRCAOdvCkX1q42z9U4XVRZM2GO63VKkTAdFh jzfvkckTAT2bdBRLh0shvEIQlG0mYt9l7eG0S4o0wts5oOMdD24TEJ88a9MHxTTU1ABc 1Uug== X-Gm-Message-State: AElRT7E4muk5TeUpOh2qWlWt0E0AxzDcaw5aYfm1m+4Hg0tqFjxS5609 EP3xyjzdeXbmo9vbsPs770k= X-Received: by 2002:a17:902:30f:: with SMTP id 15-v6mr8891786pld.365.1521384741151; Sun, 18 Mar 2018 07:52:21 -0700 (PDT) Received: from oslab.tsinghua.edu.cn ([2402:f000:1:4413:2c7e:2fdc:f812:6df0]) by smtp.gmail.com with ESMTPSA id g186sm23630705pfb.168.2018.03.18.07.52.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 18 Mar 2018 07:52:20 -0700 (PDT) From: Jia-Ju Bai To: perex@perex.cz, tiwai@suse.com Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 3/3] sound: usb: line6: Replace GFP_ATOMIC with GFP_KERNEL in line6_alloc_sysex_buffer Date: Sun, 18 Mar 2018 22:52:15 +0800 Message-Id: <1521384735-23469-1-git-send-email-baijiaju1990@gmail.com> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org line6_alloc_sysex_buffer() is never called in atomic context. The call chain ending up at line6_alloc_sysex_buffer() are: [1] line6_alloc_sysex_buffer() <- pod_alloc_sysex_buffer() <- pod_set_system_param_int() <- snd_pod_control_monitor_put() snd_pod_control_monitor_put() is only set as ".put" in snd_kcontrol_new structure "pod_control_monitor". And ->put() is called in snd_ctl_elem_write() (sound/core/control.c) snd_ctl_elem_write() are called in ctl_elem_write_user() and snd_ctl_elem_write_user(). These functions are not called in atomic context. Despite never getting called from atomic context, line6_alloc_sysex_buffer() calls kmalloc with GFP_ATOMIC, which waits busily for allocation. GFP_ATOMIC is not necessary and can be replaced with GFP_KERNEL to avoid busy waiting. This is found by a static analysis tool named DCNS written by myself. Signed-off-by: Jia-Ju Bai --- sound/usb/line6/driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/usb/line6/driver.c b/sound/usb/line6/driver.c index 0ff5a7d..70a509e 100644 --- a/sound/usb/line6/driver.c +++ b/sound/usb/line6/driver.c @@ -265,7 +265,7 @@ int line6_send_sysex_message(struct usb_line6 *line6, const char *buffer, char *line6_alloc_sysex_buffer(struct usb_line6 *line6, int code1, int code2, int size) { - char *buffer = kmalloc(size + SYSEX_EXTRA_SIZE, GFP_ATOMIC); + char *buffer = kmalloc(size + SYSEX_EXTRA_SIZE, GFP_KERNEL); if (!buffer) return NULL; -- 1.9.1