From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B1E72C432C0 for ; Wed, 27 Nov 2019 21:38:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7C7D520869 for ; Wed, 27 Nov 2019 21:38:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574890729; bh=5W9Egi4zKehIZf+zXK06b5qupqNkKPfecanbW4wj9z8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QouiEaaumRt4wiNQnHzS6RIwxMSEaRKI1LixvetlqId3hXcQmR0Kfygx+wrQoDfwe JGLEkfZWb74L8QTUvexk25cXFDnucROhUczdKrI+WzvGZEpAd9DyeBD4Qy054cIqDC wM30h3UXuy58IL8UmU9NL3x2G+gSAYhnj7vP/SKA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728400AbfK0Vim (ORCPT ); Wed, 27 Nov 2019 16:38:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:55636 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728220AbfK0UpM (ORCPT ); Wed, 27 Nov 2019 15:45:12 -0500 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 895A0217BC; Wed, 27 Nov 2019 20:45:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574887512; bh=5W9Egi4zKehIZf+zXK06b5qupqNkKPfecanbW4wj9z8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=iliAc86YCcibNHQGOzatS33tSIHBw8ojHVtYxsX1JV9+b+XZxMRqJFynypve8Mbew HIEMvf4cePt4nictKsYNvdbXd18TQY5yJbiKKCoBLiyREidw98doVwZaJd5UdRe4ML xAtUXFF/2dZ8faLA+8Z6OADxDG0Ap9Q1ic+9dImA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hewenliang Subject: [PATCH 4.9 139/151] usbip: tools: fix fd leakage in the function of read_attr_usbip_status Date: Wed, 27 Nov 2019 21:32:02 +0100 Message-Id: <20191127203046.982958231@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203000.773542911@linuxfoundation.org> References: <20191127203000.773542911@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Hewenliang commit 26a4d4c00f85cb844dd11dd35e848b079c2f5e8f upstream. We should close the fd before the return of read_attr_usbip_status. Fixes: 3391ba0e2792 ("usbip: tools: Extract generic code to be shared with vudc backend") Signed-off-by: Hewenliang Cc: stable Link: https://lore.kernel.org/r/20191025043515.20053-1-hewenliang4@huawei.com Signed-off-by: Greg Kroah-Hartman --- tools/usb/usbip/libsrc/usbip_host_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/tools/usb/usbip/libsrc/usbip_host_common.c +++ b/tools/usb/usbip/libsrc/usbip_host_common.c @@ -69,7 +69,7 @@ static int32_t read_attr_usbip_status(st } value = atoi(status); - + close(fd); return value; }