Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2514754imm; Mon, 28 May 2018 09:31:45 -0700 (PDT) X-Google-Smtp-Source: AB8JxZp6D1BBDJtMNQEuHrtEd85wSEkXPGGqCoVFL9gH0tTboRIVUq5sx5Fn3joMTO3ykIh7qLiM X-Received: by 2002:a17:902:2924:: with SMTP id g33-v6mr14448789plb.26.1527525105829; Mon, 28 May 2018 09:31:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527525105; cv=none; d=google.com; s=arc-20160816; b=P4AGn0Po0T31lTFtpOODIZa47NTLgDbPpL8t0JLXk+bSqA2GlaZMyXWEr2UWr02l/c i7YnbCN3tOVwWC8stUuYeDc2qbnG9HKoVdSShqPbgLIL7jILzWzDsWf4m/XN37NbxdfL dpJH3ODxkEy5MiMECc9Td5Oh7TNHNzQOjuf7iDXGdaGlRYfjdbbG+dWLbtYhgopjFtRf vdzwf9RLv2Zx1rl9KT05nv05Y2COmyrsbej+RdUt+GNlElLuZA+to464MS/Ay/H9IKGC wxn25jvz2Jkhb3ilGWHtAlGhJ9BRNzAbHerHqVJwiEA2+lPFLZUiRqQp/s2pEzI2W1Rp QABQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from:dkim-signature :arc-authentication-results; bh=DI+p+hFLvxh4hYlLg9W6SuRR3qr/UTIG9NFTg4XPRCc=; b=tu8GzSl7vBbdC3wMa+jUUEST8cWhS3x2hIqgIOsFiqabl5Sx0OWMqzm57v85aMcKcD sY2nOBVm9Nt3wOBXOrD9nWE2eFC8TYkz4Dp+1r1VHmWsAsqlq1Eya/6YznFCOHRdPqc7 J1N6oMCD1yVDwM4lok3w2RuAyviD4rv4RF8xbUx/YHjx6BeibIHJWYUS9ZXBpWqNX7zh xKV2w42Sthp5bUnEZKzBMFBPf3bMOY5ALshFmMcXEGctApHrrxvcAfm6RjjIMGh8cxup vZJAhcrA0of4blGr+ahI+3oJm/WUqNqwiVWz0RFtK8MS9MO8sf2WqG7ISLpCdAzO58NX 2Dzg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jUCOq1Wp; 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 z6-v6si12273153pln.250.2018.05.28.09.31.31; Mon, 28 May 2018 09:31:45 -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=jUCOq1Wp; 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 S940110AbeE1Qa7 (ORCPT + 99 others); Mon, 28 May 2018 12:30:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:57758 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935487AbeE1KJh (ORCPT ); Mon, 28 May 2018 06:09:37 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) (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 AA5BC208AD; Mon, 28 May 2018 10:09:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1527502177; bh=rn4X4Y11M9QIpraTN68SkJWTKzeqEnxKJaAp/u+CUZM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jUCOq1WpkGnBuzXRBou4WurTfqmKqi4pKbKcH6SlQhmS3LOz4Bch1IHlhypUXNIWl JwSC85IvDBZyXh7uT1MF+yP6tqyWArwzYMFcuxI818mxQioDXc9TX+24T3cY9yKQIC PA7y2QiVma36mBLkkAIm5ECQEoW8pMvtg1FJrtTo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Arvind Yadav , Juergen Gross , Sasha Levin Subject: [PATCH 3.18 090/185] xen: xenbus: use put_device() instead of kfree() Date: Mon, 28 May 2018 12:02:11 +0200 Message-Id: <20180528100058.402001135@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180528100050.700971285@linuxfoundation.org> References: <20180528100050.700971285@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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. ------------------ From: Arvind Yadav [ Upstream commit 351b2bccede1cb673ec7957b35ea997ea24c8884 ] Never directly free @dev after calling device_register(), even if it returned an error! Always use put_device() to give up the reference initialized. Signed-off-by: Arvind Yadav Reviewed-by: Juergen Gross Signed-off-by: Juergen Gross Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/xen/xenbus/xenbus_probe.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) --- a/drivers/xen/xenbus/xenbus_probe.c +++ b/drivers/xen/xenbus/xenbus_probe.c @@ -470,8 +470,11 @@ int xenbus_probe_node(struct xen_bus_typ /* Register with generic device framework. */ err = device_register(&xendev->dev); - if (err) + if (err) { + put_device(&xendev->dev); + xendev = NULL; goto fail; + } return 0; fail: