Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3286205pxk; Mon, 21 Sep 2020 09:42:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwAUFYzxynhcDAJDdctqfsi1VLPQGbG6PIyuxE+pGiCYQEENhZ7vRUBjiCRYQPqVzoZ+NP+ X-Received: by 2002:a17:906:3e90:: with SMTP id a16mr267104ejj.363.1600706578008; Mon, 21 Sep 2020 09:42:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600706578; cv=none; d=google.com; s=arc-20160816; b=iEIqc3CS8OsexxRoQFtFCrdgQpTtcx0cOVg5TJksnsGnmr+q6vX672ZpPbgZq92mqM 5XEwHxhCbYijZcOZtwknazmiTKxminOpkEUUDdYlvMquMqreOtLXscxRvgfu4Q8YOKnq mOO/NwTKKWlG7NW4Y1w7fB4UhJ8pBIoBCOq7Pr9mIXIYF3dQCmQiw+U4bH1i0ivTDCl6 gMoGvhZibyguyHYN95aZGXcuNqssI40p/szlSH5r+igvMUF1jZfT3NoXQPM7HtkzS0jQ MeMTnMI31Krxt09mkmtW9TJPavnn7PLHWNUbSd7lYsr6qH4hHNjKUbP51Qcge70EhAQa wEsw== 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=iqjRKfGlpi9EOOxYmyvNKWkUidP2QIG1EroeulGGkgE=; b=nT2arY8fB5zHa2JyGUrasWBSUq4sQ4bOjGtfBySWmD8dW91v7M1BSgo/AEw92m+ayX NtbScd2p2wJEQ8Ltee2i/s+Tg+HbX6XPoBH+pyH2iSe1Nd2vDxJfJO9NTV1irYcA2tbi LsTs0I5ADro2U6OWUoc/r/p2Qz2gvc+F0S45jnaaXIOv/WHh0exLDNGzsSAu+hhRqsJx SAx29SW+44HtGAa80b+bI4wncKVH1UFA2VKC4nGvTrwqvhpIPt3YNU+6DGLNqzAWmt4m lOnILavNfQAPGIzAM7vHzrK1shbgc6/FWyRWZCXAd2ASU4Fp4KcXd0PbHIBAXCxONN5W zVyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="eAlwQrP/"; 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 n10si8517706ejb.405.2020.09.21.09.42.34; Mon, 21 Sep 2020 09:42:57 -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="eAlwQrP/"; 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 S1729369AbgIUQks (ORCPT + 99 others); Mon, 21 Sep 2020 12:40:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:43788 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729081AbgIUQkq (ORCPT ); Mon, 21 Sep 2020 12:40:46 -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 476D52067D; Mon, 21 Sep 2020 16:40:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600706445; bh=nytHhs1yA1AvcsTxj5uamZxrJnbcOkR2fIPjetwmxlI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eAlwQrP/O47tzYDhEVkmaNnZKXHBfg1HXkPB2GtdmfAwNSMJIxlJrw/f3xZ8hRuTe GSFOtSx49TQ2bVhWwgAJk7zxyLzreuHYsZ3IIynIHCKFuFlV+kE62ATwfQKlpmasEf 6wqlrPIqLa5cXgWo/FIUmmKXQzU+xOuJvjFK/ZTk= 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 4.14 86/94] usblp: fix race between disconnect() and read() Date: Mon, 21 Sep 2020 18:28:13 +0200 Message-Id: <20200921162039.493510136@linuxfoundation.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200921162035.541285330@linuxfoundation.org> References: <20200921162035.541285330@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 Signed-off-by: Greg Kroah-Hartman --- drivers/usb/class/usblp.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/usb/class/usblp.c +++ b/drivers/usb/class/usblp.c @@ -840,6 +840,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);