Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3289505pxk; Mon, 21 Sep 2020 09:48:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzWrrUgNUXnOL9OhApTC4o13LnJrDBhQCqRJJGg3ejB5bisP0wTFQU5nOCR31iLjfjr7Z3q X-Received: by 2002:a17:906:3e08:: with SMTP id k8mr337258eji.480.1600706882593; Mon, 21 Sep 2020 09:48:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600706882; cv=none; d=google.com; s=arc-20160816; b=DY+U+BiGVOD1gX7XC1dgK2ayhc8SyqETjAFJyJz/7nBHi395soZ3MjWzSfXMvjmUqJ YAjMegm7BFujXB8n9UHyX7/rP0RSZ0C2IENJt5u0wCDb9FpMea/AFV/kpca53y0C5nxj 7+hq0jz5ZjFqhvAgDUypBDsmDNitmdblE/UVaAC+Tl/0+s3+ow3huPG4Jtz+9KsH1dQN nbwjna2ZNSQ/HL+yp4QVGwvtcQrI2IRFyZNOhe8lF3/Dt4PH8Vv/u6rrPOQvAkv++kLO yj6gMxy8RdQ/Vl91yLrs2OUjdzIk6z7O8Pza97FIjVIekGHjtOJIUFJss4VDPu7pbzhf SBHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8cLHZ0zOczkaiqySzpj3DGIpBU09E3k82g/PrWESZVM=; b=XWC7AdxPBtnlM7FCacV6f7Tac1UyoTQ0Ew3+MZUs4LYzBC9PppnlEQ2BRBaaKapEXm qWFflOPTfSzNknN5sSTyQiTTwbG7Cc+38YGvTW5rW1eWWS22MuNK6Db0y1Ip/oR4y2aN 1jLflFMmETp8VJG8Btp+YtITxWlV+6agWCjVo7htIhFHRsnIUts8wUWq0TVhSC8mKAP+ U/tpWNla6JVTHoV36KZTwg1T+pZFVNDb+Fhx12bsdET+Yqsvx3MnQdvNH2seynW5euTc mnWfheAH/5qF/nLHLGyhbjTxugufsk6XX5EDscmz1Glgca+rt53dHcQFet5RLWIW4cB/ K48Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YyiSJbCt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y10si8572982eds.17.2020.09.21.09.47.37; Mon, 21 Sep 2020 09:48:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YyiSJbCt; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727262AbgIUQqi (ORCPT + 99 others); Mon, 21 Sep 2020 12:46:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:52792 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727900AbgIUQqa (ORCPT ); Mon, 21 Sep 2020 12:46:30 -0400 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id B5D472388B; Mon, 21 Sep 2020 16:46:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706790; bh=4h2vGnKA21+C4oRjiw99zQjWCk1lgfV63y1n2Te5HM8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YyiSJbCt/Wp/vge8JINL1jEoCYiofWo9YxEm2mKs7KjmDGSsDBSou5bpsThxZR5JD fvIR5FJogCluFC0P5TW6RezK08FzM4hRh5kMtcYOntA09ux7WUx/5Gdo4Dcd9vajES aHNhuDYjqbGfg8kyNzAcDrw0CG3TsjT/xAbk/0G8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Oliver Neukum , syzbot+be5b5f86a162a6c281e6@syzkaller.appspotmail.com Subject: [PATCH 5.8 088/118] usblp: fix race between disconnect() and read() Date: Mon, 21 Sep 2020 18:28:20 +0200 Message-Id: <20200921162040.443193883@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162036.324813383@linuxfoundation.org> References: <20200921162036.324813383@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Oliver Neukum commit 9cdabcb3ef8c24ca3a456e4db7b012befb688e73 upstream. read() needs to check whether the device has been disconnected before it tries to talk to the device. Signed-off-by: Oliver Neukum Reported-by: syzbot+be5b5f86a162a6c281e6@syzkaller.appspotmail.com Link: https://lore.kernel.org/r/20200917103427.15740-1-oneukum@suse.com Cc: stable --- drivers/usb/class/usblp.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c @@ -827,6 +827,11 @@ static ssize_t usblp_read(struct file *f if (rv < 0) return rv; + if (!usblp->present) { + count = -ENODEV; + goto done; + } + if ((avail = usblp->rstatus) < 0) { printk(KERN_ERR "usblp%d: error %d reading from printer\n", usblp->minor, (int)avail);