Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2512346imm; Mon, 24 Sep 2018 05:43:31 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb4jx+59uezrb1U62KitIxjAhDcwdpSVvsZmdDGJTFZxwM87b7Qk22UInue6LwwUTTi4uIv X-Received: by 2002:a62:8704:: with SMTP id i4-v6mr10207505pfe.62.1537793011825; Mon, 24 Sep 2018 05:43:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537793011; cv=none; d=google.com; s=arc-20160816; b=VDcesKiKK4bKZodF4jLxS4lf60R2UYRkEt/BhB9vMdNZ58N5H8kXajYMY01H5e9qu/ AYGt0c1Bs0qKkFpqdfj0W99c+QvWO59SlGPAIbhvKi2iQnNaCq9qQLhW4/QGPj0tpSKd 13gkHaHYjkqtScRzyEDRCWUaUvEhyjZB/VcEs+tYHonHVdad2Q+ZAi0xsYQL2E553fDJ VMt4BvdAL/vcnCT60tZ6UvOEH5K4dPgGI4kDgvZYs2h37ujaIQH8wBVTW923Bb7TmaJF opalQzLH9HmO6yRG4PoLioGAgKDyexzin5gVGxYopOjFjhpuB/xlRSttuNklkbX8g1EZ Op2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from; bh=G128DU1k8iSyttGAFmAj9DXgNUTWen39iX8IzzkSq9A=; b=YXCy9RoSyyoj8JoUwHzu2PMB9DlxmwYg0EN2u5GRMNhmzHSueCa9nenL13bmyGBsel xbXrSBdMSO0adU+SMVBE4QeeoArQLEpurnEXMgcKNYiAkv+chTQTChLm2w6gjEnVz/Mt r/ESiYxOFquzHUvzc0uE4wozLae/g1OQJRDdgm2QzL3lLxWXslui02Naz8q6nbElsuOF RQccuJP39LkcKfjF8UJZFq95fM6Xu6zybMpP4CtCQbonSYekqbImC6B013xGFmjXVfw4 iviqxvIE5BmQENj/dStNX9T+gVYL+crePWLqHjEuMYw/NmAvvE52kkvYqRBMG5Z77NgO loHA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b1-v6si33210337plc.168.2018.09.24.05.43.16; Mon, 24 Sep 2018 05:43:31 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388705AbeIXSnC (ORCPT + 99 others); Mon, 24 Sep 2018 14:43:02 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:59082 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733116AbeIXSnB (ORCPT ); Mon, 24 Sep 2018 14:43:01 -0400 Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 8266A109E; Mon, 24 Sep 2018 12:41:03 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jia-Ju Bai Subject: [PATCH 4.18 129/235] usb: misc: uss720: Fix two sleep-in-atomic-context bugs Date: Mon, 24 Sep 2018 13:51:55 +0200 Message-Id: <20180924113118.844294620@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20180924113103.999624566@linuxfoundation.org> References: <20180924113103.999624566@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.18-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jia-Ju Bai commit bc8acc214d3f1cafebcbcd101a695bbac716595d upstream. async_complete() in uss720.c is a completion handler function for the USB driver. So it should not sleep, but it is can sleep according to the function call paths (from bottom to top) in Linux-4.16. [FUNC] set_1284_register(GFP_KERNEL) drivers/usb/misc/uss720.c, 372: set_1284_register in parport_uss720_frob_control drivers/parport/ieee1284.c, 560: [FUNC_PTR]parport_uss720_frob_control in parport_ieee1284_ack_data_avail drivers/parport/ieee1284.c, 577: parport_ieee1284_ack_data_avail in parport_ieee1284_interrupt ./include/linux/parport.h, 474: parport_ieee1284_interrupt in parport_generic_irq drivers/usb/misc/uss720.c, 116: parport_generic_irq in async_complete [FUNC] get_1284_register(GFP_KERNEL) drivers/usb/misc/uss720.c, 382: get_1284_register in parport_uss720_read_status drivers/parport/ieee1284.c, 555: [FUNC_PTR]parport_uss720_read_status in parport_ieee1284_ack_data_avail drivers/parport/ieee1284.c, 577: parport_ieee1284_ack_data_avail in parport_ieee1284_interrupt ./include/linux/parport.h, 474: parport_ieee1284_interrupt in parport_generic_irq drivers/usb/misc/uss720.c, 116: parport_generic_irq in async_complete Note that [FUNC_PTR] means a function pointer call is used. To fix these bugs, GFP_KERNEL is replaced with GFP_ATOMIC. These bugs are found by my static analysis tool DSAC. Signed-off-by: Jia-Ju Bai Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/usb/misc/uss720.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/drivers/usb/misc/uss720.c +++ b/drivers/usb/misc/uss720.c @@ -369,7 +369,7 @@ static unsigned char parport_uss720_frob mask &= 0x0f; val &= 0x0f; d = (priv->reg[1] & (~mask)) ^ val; - if (set_1284_register(pp, 2, d, GFP_KERNEL)) + if (set_1284_register(pp, 2, d, GFP_ATOMIC)) return 0; priv->reg[1] = d; return d & 0xf; @@ -379,7 +379,7 @@ static unsigned char parport_uss720_read { unsigned char ret; - if (get_1284_register(pp, 1, &ret, GFP_KERNEL)) + if (get_1284_register(pp, 1, &ret, GFP_ATOMIC)) return 0; return ret & 0xf8; }