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,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 18B93C43603 for ; Sun, 15 Dec 2019 11:06:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D836520700 for ; Sun, 15 Dec 2019 11:06:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1576407966; bh=Pdzr9WHdr0N3rwDLq3TO4y3IsVtWXVZiXJdBU8AgbkA=; h=Subject:To:Cc:From:Date:List-ID:From; b=AzqbSLwaLUwiZ42IkFEJ5pDd/7lX5agfCgZQAxVjIGGY0+F/XqDKFI4Zp/7e9+skU G6yOwnf2baNYUBXNHs7TQx6oQrw7PAwOnIufXKm/A3MiT3PdK+DO6/Kncxz0GUie2G QcxZBh/owk6ks6aa5mEeyl9oLraKKcBaeaErIAsg= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726101AbfLOLGG (ORCPT ); Sun, 15 Dec 2019 06:06:06 -0500 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:60237 "EHLO wout4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726099AbfLOLGG (ORCPT ); Sun, 15 Dec 2019 06:06:06 -0500 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 343EB669; Sun, 15 Dec 2019 06:06:05 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sun, 15 Dec 2019 06:06:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:message-id:mime-version:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=RAJDjF oMBS52CNAfxTmTd4A7B1PdE0VKBSCR5wm2Fxg=; b=aoDGZMD4/LnErXtltXj51V UXQ0FkDXAWLP2Q+m2kUPITeaV2n6yuH1Hwppepniujx8lWEsyXE58bsZhF2F5Z7e 4GauAmLLUVSeNlvuVK7BSMACcLAFpPPqu/i+YHcCNrzQKj5Sc/3nDIhAwkgwuxM+ WgNUO0e95F0lCDquYhxaVdZP+DwlYaMNHk5DKvuOtn84WdWQLkTXTypDR5aAKUkr 6CN4pmL81f2h2N7bZA72klyVvJbJ9ABa1osP14CxH+0BVp/0ln+6PfZgafEcSC34 HNVaWL/VqXZ+Jsrgf4YaFvQtuwduLSdDK9QRjyi7bYi9mJuTeLDEeYMWbgSY61oQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrvddtfedgvdehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefuvffhfffkgggtgfesthekredttd dtjeenucfhrhhomhepoehgrhgvghhkhheslhhinhhugihfohhunhgurghtihhonhdrohhr gheqnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepkeefrdekiedrkeelrd dutdejnecurfgrrhgrmhepmhgrihhlfhhrohhmpehgrhgvgheskhhrohgrhhdrtghomhen ucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) by mail.messagingengine.com (Postfix) with ESMTPA id E24A88005A; Sun, 15 Dec 2019 06:06:03 -0500 (EST) Subject: FAILED: patch "[PATCH] usb: typec: fix use after free in typec_register_port()" failed to apply to 4.19-stable tree To: wenyang@linux.alibaba.com, gregkh@linuxfoundation.org, heikki.krogerus@linux.intel.com, stable@vger.kernel.org Cc: From: Date: Sun, 15 Dec 2019 12:06:01 +0100 Message-ID: <157640796159177@kroah.com> 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 The patch below does not apply to the 4.19-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to . thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 5c388abefda0d92355714010c0199055c57ab6c7 Mon Sep 17 00:00:00 2001 From: Wen Yang Date: Tue, 26 Nov 2019 22:04:52 +0800 Subject: [PATCH] usb: typec: fix use after free in typec_register_port() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We can't use "port->sw" and/or "port->mux" after it has been freed. Fixes: 23481121c81d ("usb: typec: class: Don't use port parent for getting mux handles") Signed-off-by: Wen Yang Cc: stable Cc: linux-usb@vger.kernel.org Cc: linux-kernel@vger.kernel.org Acked-by: Heikki Krogerus  Link: https://lore.kernel.org/r/20191126140452.14048-1-wenyang@linux.alibaba.com Signed-off-by: Greg Kroah-Hartman diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index 7ece6ca6e690..91d62276b56f 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -1612,14 +1612,16 @@ struct typec_port *typec_register_port(struct device *parent, port->sw = typec_switch_get(&port->dev); if (IS_ERR(port->sw)) { + ret = PTR_ERR(port->sw); put_device(&port->dev); - return ERR_CAST(port->sw); + return ERR_PTR(ret); } port->mux = typec_mux_get(&port->dev, NULL); if (IS_ERR(port->mux)) { + ret = PTR_ERR(port->mux); put_device(&port->dev); - return ERR_CAST(port->mux); + return ERR_PTR(ret); } ret = device_add(&port->dev);