Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758037AbcDAArS (ORCPT ); Thu, 31 Mar 2016 20:47:18 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:36523 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757789AbcDAArQ (ORCPT ); Thu, 31 Mar 2016 20:47:16 -0400 From: Peter Hurley To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, linux-next@vger.kernel.org, Stephen Rothwell , Peter Hurley Subject: [PATCH] tty: Fix merge of "tty: Refactor tty_open()" Date: Thu, 31 Mar 2016 17:47:07 -0700 Message-Id: <1459471627-20669-1-git-send-email-peter@hurleysoftware.com> X-Mailer: git-send-email 2.8.0 In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1142 Lines: 35 Commit e9036d066236 ("tty: Drop krefs for interrupted tty lock") fixed a tty reference counting problem introduced in commit 0bfd464d3fdd ("tty: Wait interruptibly for tty lock on reopen"), so v4.5.0 is correct. However, commit d6203d0c7b73 ("tty: Refactor tty_open()") moved the relevant code for 4.6-rc1; correct the merge. Signed-off-by: Peter Hurley --- drivers/tty/tty_io.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 8d26ed7..c14c45f 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@ -2049,14 +2049,13 @@ static struct tty_struct *tty_open_by_driver(dev_t device, struct inode *inode, if (tty) { mutex_unlock(&tty_mutex); retval = tty_lock_interruptible(tty); + tty_kref_put(tty); /* drop kref from tty_driver_lookup_tty() */ if (retval) { if (retval == -EINTR) retval = -ERESTARTSYS; tty = ERR_PTR(retval); goto out; } - /* safe to drop the kref from tty_driver_lookup_tty() */ - tty_kref_put(tty); retval = tty_reopen(tty); if (retval < 0) { tty_unlock(tty); -- 2.8.0