Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2297553imm; Thu, 7 Jun 2018 08:22:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKI+05Hg4d+N3HLU92S2Suw+FgSGcem0NOrg2lbt0C/BKEa5sTA0d4mZ5JOR3TZGwS1xPxMR X-Received: by 2002:a63:87c8:: with SMTP id i191-v6mr1992911pge.124.1528384945414; Thu, 07 Jun 2018 08:22:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528384945; cv=none; d=google.com; s=arc-20160816; b=HyWHoj3FWMxZBPxgDVPzDd50rbh+9qXv/fCyaIHKFlvjmdGQ4xtq9h8z8dIJqt+Qa2 3WTjB6D7JLf6U77eTk28/bP8dE6/bbuj3+dK5KaRHpr8hnN9QNgqFp12QWFkAbaX5qg3 GC3qHliBXr5VuO/kx6WzuLwiCnGO6I0MKb/QpiZ5MSYsQFZJXUHkoC2OK8xdR6xrlvCg Ey3w3c29+820/BE/HAQaFtyWjRJCFyTgoRr9HpKFfuTHg+48xd+owkviXqyLFdneYUem sIht7mFY2U9QlciPjPVI94oUALWl/dOOi8W5zMr01UTGeq1/hpSanQ5/nF/MEH3CyCMf Pt5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition :arc-authentication-results; bh=YzfcrrEWlVmXLOnsSX8kbhiEemV00+kyKj0yT5NfVyY=; b=HGA6kSdNesxWIBrRNFuC8Ww0w7hfwqxsoTxDl1MeWR/Sq6+XO6tY59hi00aiRGL98M Jr1QI2anuzXCZvqWWDiZc5i5k4lJRWtCRZZfAKwhYrMyGl4VS6ovJSSFyykBXAXqFS3E 9wzXBwlgb5g7c65D+YbsLPWj3dVy3y9vYnr2UL5fEYYF2M6aMRO3YFPGPyBu/m7fZ42K 3gujkMDXdNN6vCJMpDMuOaFWcIPe5zZ7ounM68h04VMLNRcHLzEJ53GJxxiqiOZ0s34I FZQYJXqBslQagc4ne8mvK4P3dqYbwgSWxH9DD26W0tgHoGZlqqmfPKpCG8EioNAlHEaD xi0w== 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 u2-v6si32313781plr.598.2018.06.07.08.22.10; Thu, 07 Jun 2018 08:22:25 -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 S935669AbeFGO7Z (ORCPT + 99 others); Thu, 7 Jun 2018 10:59:25 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:41263 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935647AbeFGO7S (ORCPT ); Thu, 7 Jun 2018 10:59:18 -0400 Received: from [148.252.241.226] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1fQvbd-0005a0-HL; Thu, 07 Jun 2018 15:09:37 +0100 Received: from ben by deadeye with local (Exim 4.91) (envelope-from ) id 1fQvb7-00033w-Ou; Thu, 07 Jun 2018 15:09:05 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Greg Kroah-Hartman" , "Shuah Khan" Date: Thu, 07 Jun 2018 15:05:21 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) Subject: [PATCH 3.16 241/410] usbip: keep usbip_device sockfd state in sync with tcp_socket In-Reply-To: X-SA-Exim-Connect-IP: 148.252.241.226 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.57-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Shuah Khan commit 009f41aed4b3e11e6dc1e3c07377a10c20f1a5ed upstream. Keep usbip_device sockfd state in sync with tcp_socket. When tcp_socket is reset to null, reset sockfd to -1 to keep it in sync. Signed-off-by: Shuah Khan Signed-off-by: Greg Kroah-Hartman [bwh: Backported to 3.16: adjust filenames] Signed-off-by: Ben Hutchings --- drivers/staging/usbip/stub_dev.c | 3 +++ drivers/staging/usbip/vhci_hcd.c | 2 ++ 2 files changed, 5 insertions(+) --- a/drivers/staging/usbip/stub_dev.c +++ b/drivers/staging/usbip/stub_dev.c @@ -114,6 +114,7 @@ static ssize_t store_sockfd(struct devic goto err; sdev->ud.tcp_socket = socket; + sdev->ud.sockfd = sockfd; spin_unlock_irq(&sdev->ud.lock); @@ -213,6 +214,7 @@ static void stub_shutdown_connection(str if (ud->tcp_socket) { sockfd_put(ud->tcp_socket); ud->tcp_socket = NULL; + ud->sockfd = -1; } /* 3. free used data */ @@ -307,6 +309,7 @@ static struct stub_device *stub_device_a sdev->ud.status = SDEV_ST_AVAILABLE; spin_lock_init(&sdev->ud.lock); sdev->ud.tcp_socket = NULL; + sdev->ud.sockfd = -1; INIT_LIST_HEAD(&sdev->priv_init); INIT_LIST_HEAD(&sdev->priv_tx); --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c @@ -786,6 +786,7 @@ static void vhci_shutdown_connection(str if (vdev->ud.tcp_socket) { sockfd_put(vdev->ud.tcp_socket); vdev->ud.tcp_socket = NULL; + vdev->ud.sockfd = -1; } pr_info("release socket\n"); @@ -833,6 +834,7 @@ static void vhci_device_reset(struct usb if (ud->tcp_socket) { sockfd_put(ud->tcp_socket); ud->tcp_socket = NULL; + ud->sockfd = -1; } ud->status = VDEV_ST_NULL;