Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp242813imm; Sat, 1 Sep 2018 01:05:35 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYqElj5vKg5yCb/Lt+7SZTLmJzMBegYG8f1Q55e13mBMUwy21KZkcMl4wLyzwIxGridfArH X-Received: by 2002:a17:902:8345:: with SMTP id z5-v6mr18665632pln.147.1535789135227; Sat, 01 Sep 2018 01:05:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535789135; cv=none; d=google.com; s=arc-20160816; b=uze2Gqh8dwdx09SSt/XnyjSwp12GnSz0Forc/ogQ0ZHkjfae0i18VUFHvrjwCewij+ 5/6b4FGjsdGbmdQvw6ZuqQwhQouLjTsmS0ZrlmidS9qndR1aYfldeG0FhGhlaYWwRTdi tulgQ6dC/hKTdkJI4aveBIVEUzK/n0z/OeQfuekkRH2lAdvYLOPAZYTKWn9QIMXDMWaH Rx1/cC+Xmo1IBAqqowricn9lfbgez8Pb9yPDhuDfR6df9b2hWXkikZY6p1GMP1JyfYXr aUyYkwij2ozMBUFVV0eVrl622Scn50Gnq2RoZZs9g/QN+YmIu0vu4sFG8RSz4eQ+aUiD IvYA== 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=UjSByF2RvQQrN4ksixjx+//iApigN4/jp3Md/nZ2+Ds=; b=ncINRUmInO2RSpTfb9qgOD+2jG4eNOpayCHODAgqPjlixJR9KbmUNtYxWRcEo2pFVl isELMaNrAP2ZjJQ3t6kPtdfDTFvH9XTMnYZMhQhYiCm0qwaWJY60HReGEnGGvGko/n5U amk6B2h+UjX7QCubHOM/nJdvXpjROc8ZhYshvSeiY8ZE6gxj+qxOTCpOLOG0QC9R9uGa v8wqk+fdQYBZHYuEJtFryJ1+q3pAt+smbU7Zu5xjP6B0FNdI6mUaH1x0GhT2jl6aJLO6 Iyz7iNImt86c6pQAjK+Zg8N/UKI3Y9PJnBBE7FT5bd1y28VTFitqNstdi84Mq5e0r5OF MELQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b="RUvBTc/y"; 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 l9-v6si11993037pfe.11.2018.09.01.01.05.20; Sat, 01 Sep 2018 01:05:35 -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="RUvBTc/y"; 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 S1727356AbeIAMOt (ORCPT + 99 others); Sat, 1 Sep 2018 08:14:49 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:33907 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726435AbeIAMOt (ORCPT ); Sat, 1 Sep 2018 08:14:49 -0400 Received: by mail-pg1-f194.google.com with SMTP id d19-v6so6451656pgv.1; Sat, 01 Sep 2018 01:03:42 -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=UjSByF2RvQQrN4ksixjx+//iApigN4/jp3Md/nZ2+Ds=; b=RUvBTc/yXxxUbsBykj5KpSiGXIURQn7pVyl49KDzzaKMtpO4AgmUCj+oboOlH4m8GX CpURVGasldb4/1glC4eHxzXV1lTiWQf/32UGBBS1/3CSAzNqDenqMw/M7ki5VPQEgXTq vYy94s61nH78qYu5VxkPU4xFAJBhsG3cakskER7Wa4Xk9yFGKC1SORyLd0M2s+PRfxZf 3F6Z91y/paTJDajkIZFwhhy2JVbUs/Iauv4xcT+U5byRTLW3WfjLSfjBccOemjl9HeeO 2AV7ey6f1WnYDZqYO9jJ9MB+V7JyJrbCwjEjO5P463KbvEOT45sLCR2T8wwskl1fWrXB pOlA== 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=UjSByF2RvQQrN4ksixjx+//iApigN4/jp3Md/nZ2+Ds=; b=L/hgyfNaeXQEo1qzEIp3bk1TCuKhK7c/j3g1tlIUVzqg8WGgYjrOxj/cTdSnmrgWqP PYrgWsr6aW0METGqhiPuj1td68VCJMKl4jWEYo7CtefZGK5hosdIPC6lPROKSs1r+18Q +uO8VXkgKZpcVcIRvZau49OXGanKYoq8rQrjMIoFAW8SIzkTVmU6Ask2J1HOuP+MZ2F8 ApW80GjHdE3FOK0rJofOASc8cdaVPZIkmJHTGycRvealCZaD8KHXktINBeqALIUWEsle KcZny0waL+8OFT/wIHyyrPACb19JzHW5Gu2ujjfaLxzVuWfdEgI8TqZq9yTUQ0OlcFPv eMHg== X-Gm-Message-State: APzg51BTy5BpDseyxyxXq8hawfBFmTPqXBfCQ+ZuFxM5qH46l36QfTBt +Ee7tsjAU3n9WhqalAyD7CQ= X-Received: by 2002:a63:291:: with SMTP id 139-v6mr17256791pgc.365.1535789022516; Sat, 01 Sep 2018 01:03:42 -0700 (PDT) Received: from localhost.localdomain ([2402:f000:1:4414:4130:91db:5d72:621b]) by smtp.gmail.com with ESMTPSA id c1-v6sm15696789pfi.142.2018.09.01.01.03.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 01 Sep 2018 01:03:42 -0700 (PDT) From: Jia-Ju Bai To: gregkh@linuxfoundation.org, johan@kernel.org, paulmck@linux.vnet.ibm.com, mingo@kernel.org, mark.rutland@arm.com, bjorn@mork.no, viro@zeniv.linux.org.uk Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Jia-Ju Bai Subject: [PATCH] usb: cdc-wdm: Fix a sleep-in-atomic-context bug in service_outstanding_interrupt() Date: Sat, 1 Sep 2018 16:03:34 +0800 Message-Id: <20180901080334.15913-1-baijiaju1990@gmail.com> X-Mailer: git-send-email 2.17.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org wdm_in_callback() is a completion handler function for the USB driver. So it should not sleep. To fix this bug, GFP_KERNEL is replaced with GFP_ATOMIC. This bug is found by my static analysis tool DSAC. Signed-off-by: Jia-Ju Bai --- drivers/usb/class/cdc-wdm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/usb/class/cdc-wdm.c b/drivers/usb/class/cdc-wdm.c index a0d284ef3f40..632a2bfabc08 100644 --- a/drivers/usb/class/cdc-wdm.c +++ b/drivers/usb/class/cdc-wdm.c @@ -458,7 +458,7 @@ static int service_outstanding_interrupt(struct wdm_device *desc) set_bit(WDM_RESPONDING, &desc->flags); spin_unlock_irq(&desc->iuspin); - rv = usb_submit_urb(desc->response, GFP_KERNEL); + rv = usb_submit_urb(desc->response, GFP_ATOMIC); spin_lock_irq(&desc->iuspin); if (rv) { dev_err(&desc->intf->dev, -- 2.17.0