Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp577265img; Fri, 22 Mar 2019 04:24:22 -0700 (PDT) X-Google-Smtp-Source: APXvYqxkkxzTlWlO9T5ZYGw32fCLbYrall31FX8VUUeHxkhAtHQyytwEbW1lqkPuGMNKr+hZqVhU X-Received: by 2002:a17:902:846:: with SMTP id 64mr8948595plk.266.1553253861945; Fri, 22 Mar 2019 04:24:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553253861; cv=none; d=google.com; s=arc-20160816; b=i0iAqn/1Rb4GGfZaCmS1appQi8ix8MUD//He4piRFfEwbm1mYS6rOzi09s690/4AgI tXk01na/Uknitd8upmQm6eEVTsrnuHFXWdu1RCarnUMcHPLd7JdfCs9ROcJSW9lZ9iF9 3RyIEAvOWruDds6VXCzEGLllSj00ITPAI8LURcwUPEjjv8upouEH8FaGNhl5BW+Sjnit hbdXh3ELTXw5HQbvMc1zffuCkPcAs4sIokuCwRIZa5+4QP/fTkb9oYmMqTek8CitECs3 eUojPbJseV4kess04uakG7qxMNk/w3/27NusFRPmHbr4Zgbg0SBCteoEL5q6skk+51wg gYRw== 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:dkim-signature; bh=7Ef5GpvaL2eAYP3xz4jRqRuyNun2q8yHPixnkAVKTYk=; b=yWZnof4NHOEF3yuVeFEyfR3avhDbxuwH0NHJssWyE5klsGhen114xR4HkOcFTsW1K5 RIPd10giwtqxpA56BZ+9VGZzUVR1snH52HqLwpBIb7cR9iold0/8n2+pKIpAlDGso8rz AKysk/vY2V8DBUXYr6qDpTRl6tVbc3+/S0yJt4L0qrwnSMUWDs2CVTtmBiHB/DbPqaC2 zKRfvtFRSmT5Wo83WGuvC3I8GEEdUPSdY1MsB12uB38ggYtHSldnTi2ZuZsBqHt5XcQt Owkprmr2fF99fv3Trn0WFSPHvI7ZKgbeTROQBkf7K7axs7Z7I+3i+Kb7eCSZjLcvyZoc Kwfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="a/Fkwhtx"; 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 o86si2937239pfa.270.2019.03.22.04.24.06; Fri, 22 Mar 2019 04:24:21 -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=@kernel.org header.s=default header.b="a/Fkwhtx"; 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 S1728653AbfCVLVo (ORCPT + 99 others); Fri, 22 Mar 2019 07:21:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:48216 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728645AbfCVLVm (ORCPT ); Fri, 22 Mar 2019 07:21:42 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 6BF8E218A2; Fri, 22 Mar 2019 11:21:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553253701; bh=LD1IhDGEnOubhUA8t2aT3Xv5nnN6s9j2pdSKaQvip60=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=a/FkwhtxM+bbR4MTTSWFqndO7UiiHR5SAlXWFK1rAlqQfifzRhXw4l70raUJoaU/P 0JhT9xK1idETwVuxG/JngfcU95/RKajS5YUuidtVIZ5CKZgxQ4rW5bBp8NysMMsczX Co2benC3D6tsf8EINBnG9TCjg6D0PhA7u0ehGswE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Kristian H. Kristensen" , Rob Clark , Sasha Levin Subject: [PATCH 3.18 027/134] drm/msm: Unblock writer if reader closes file Date: Fri, 22 Mar 2019 12:14:00 +0100 Message-Id: <20190322111211.752019502@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190322111210.465931067@linuxfoundation.org> References: <20190322111210.465931067@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 3.18-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 99c66bc051e7407fe0bf0607b142ec0be1a1d1dd ] Prevents deadlock when fifo is full and reader closes file. Signed-off-by: Kristian H. Kristensen Signed-off-by: Rob Clark Signed-off-by: Sasha Levin --- drivers/gpu/drm/msm/msm_rd.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_rd.c b/drivers/gpu/drm/msm/msm_rd.c index 9a78c48817c6a..909a52b21ebe7 100644 --- a/drivers/gpu/drm/msm/msm_rd.c +++ b/drivers/gpu/drm/msm/msm_rd.c @@ -103,7 +103,9 @@ static void rd_write(struct msm_rd_state *rd, const void *buf, int sz) char *fptr = &fifo->buf[fifo->head]; int n; - wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0); + wait_event(rd->fifo_event, circ_space(&rd->fifo) > 0 || !rd->open); + if (!rd->open) + return; n = min(sz, circ_space_to_end(&rd->fifo)); memcpy(fptr, ptr, n); @@ -192,7 +194,10 @@ static int rd_open(struct inode *inode, struct file *file) static int rd_release(struct inode *inode, struct file *file) { struct msm_rd_state *rd = inode->i_private; + rd->open = false; + wake_up_all(&rd->fifo_event); + return 0; } -- 2.19.1