Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp482305pxx; Wed, 28 Oct 2020 09:19:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHnYMObZ1Jgkiw16lRu2D7qIgI6p9QQP5WsroGQppv7TLDI+LJ/dcNh6lfOfYx9abI6MuZ X-Received: by 2002:a17:906:a195:: with SMTP id s21mr8037637ejy.146.1603901954623; Wed, 28 Oct 2020 09:19:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603901954; cv=none; d=google.com; s=arc-20160816; b=RCu4N6NedkhDpv2Er0d2jS7U40oaY/vtiNyen0JAgWLPR1k5CtKfucCNFx1ilJyJ8T y7cJuGrf3yPfrAT3j2HTjke7HqNj5nLShtwNLI2+16s3YnJvq7xuEl/oTL4HH1aPqQ5J TfGRMuokhNLYHHzteRvkyw7wWQ1jvEEgfiQwfYGaEKRGC8D4EgLew/j7VUFxT8zk0PIB OYWHIh0WImWZ6iHH/QMeWSle8PvHGASUfe7S6yw3UrViGSsDhs4rIIViJivg1C5PhCmW MUJp+vHttTG5bMwdiLFEORysR5HsiZfywW6BPdpzFReYbf2Z0MOVvPufunRUgBv9Ppco oLJA== 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=+X9RwGjvAqVuPKMV2Rm8Ja6d/kp3ZVVEtwTRJMQX4Vk=; b=bZf6yQVctbJaqNZFeeTjsgezcC3iLuv0Tm3hU+ZXUuF/yH8QKzmcDgJKdYcdqhkYYs sXUtZ6Tyrr3XKoo7AXcB3h6/JPfGfd4hL4wpRgQetBeZEX9lyXEcdPwfZP/qUYwTRk6B rFvw+Js3qQ2YwLmKgDeCF8cIJU2RYtmVsqpppPQ6gmnaaOOpCff9fHePbh1Oru0q5te6 YqhcpDKaMVtibI9YPSRhWZyk87oR5q8wGooky4E8x9L14K/h/8+h/kAlacBePPRdq5ZK uj7W7Pj9RByWcrqzJLmsa6hW7lE5+RfhCjbBhwxXovZfZot8PzjSZ/rhd7GQ8+n9qg3S sp6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=v7pxIDB4; 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 dm2si3793647ejc.295.2020.10.28.09.18.51; Wed, 28 Oct 2020 09:19:14 -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=v7pxIDB4; 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 S1815699AbgJ0REe (ORCPT + 99 others); Tue, 27 Oct 2020 13:04:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:41394 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1793586AbgJ0PHS (ORCPT ); Tue, 27 Oct 2020 11:07:18 -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 48ACA21D24; Tue, 27 Oct 2020 15:07:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603811238; bh=MDb6D/+EPwT024XRbziP/5eSlZjL68o4s8lTYj9nSNU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v7pxIDB4NUOD3HQzY6jozrD2fo6lS9z0AnkDIm7HnwhxvSGyAI7qIFPCIjRNmms8M 2tRvGrJBI+CGXnepGFiXFzRV2odUuCCVaAHfwIQ08j/MrjquhBf03cdQXbBauA2l4B 8GIr5ZvBt9mvgyFvou/N93tIzeZ0XrPREjdqVD5A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jing Xiangfeng , Andrew Morton , Dan Carpenter , Matt Porter , Alexandre Bounine , "Gustavo A. R. Silva" , John Hubbard , Kees Cook , Madhuparna Bhowmik , Linus Torvalds , Sasha Levin Subject: [PATCH 5.8 423/633] rapidio: fix the missed put_device() for rio_mport_add_riodev Date: Tue, 27 Oct 2020 14:52:46 +0100 Message-Id: <20201027135542.560487722@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135522.655719020@linuxfoundation.org> References: <20201027135522.655719020@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: Jing Xiangfeng [ Upstream commit 85094c05eeb47d195a74a25366a2db066f1c9d47 ] rio_mport_add_riodev() misses to call put_device() when the device already exists. Add the missed function call to fix it. Fixes: e8de370188d0 ("rapidio: add mport char device driver") Signed-off-by: Jing Xiangfeng Signed-off-by: Andrew Morton Reviewed-by: Dan Carpenter Cc: Matt Porter Cc: Alexandre Bounine Cc: Gustavo A. R. Silva Cc: John Hubbard Cc: Kees Cook Cc: Madhuparna Bhowmik Link: https://lkml.kernel.org/r/20200922072525.42330-1-jingxiangfeng@huawei.com Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- drivers/rapidio/devices/rio_mport_cdev.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/rapidio/devices/rio_mport_cdev.c b/drivers/rapidio/devices/rio_mport_cdev.c index 438cbf994c57f..152946e033d17 100644 --- a/drivers/rapidio/devices/rio_mport_cdev.c +++ b/drivers/rapidio/devices/rio_mport_cdev.c @@ -1680,6 +1680,7 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv, struct rio_dev *rdev; struct rio_switch *rswitch = NULL; struct rio_mport *mport; + struct device *dev; size_t size; u32 rval; u32 swpinfo = 0; @@ -1694,8 +1695,10 @@ static int rio_mport_add_riodev(struct mport_cdev_priv *priv, rmcd_debug(RDEV, "name:%s ct:0x%x did:0x%x hc:0x%x", dev_info.name, dev_info.comptag, dev_info.destid, dev_info.hopcount); - if (bus_find_device_by_name(&rio_bus_type, NULL, dev_info.name)) { + dev = bus_find_device_by_name(&rio_bus_type, NULL, dev_info.name); + if (dev) { rmcd_debug(RDEV, "device %s already exists", dev_info.name); + put_device(dev); return -EEXIST; } -- 2.25.1