Message ID | 20221102161542.30669-1-sven@svenpeter.dev |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp9337wru; Wed, 2 Nov 2022 09:24:44 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4EEA/7zJYlqcnCUrxtlmKpdzp7qWscLGVgCJM66Ry8whkJs522RPuF5l57svBTtfLY5kwZ X-Received: by 2002:a17:90a:7301:b0:213:8a08:2f18 with SMTP id m1-20020a17090a730100b002138a082f18mr27090119pjk.50.1667406283875; Wed, 02 Nov 2022 09:24:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667406283; cv=none; d=google.com; s=arc-20160816; b=ccOHVxBqtjQHAspLc7s67enS7ctQuB7QQqhg2ExWGJNitf/jstqnOG740aehJxLr5P 4tb46gP7bLOgZ3BSPNl4eDiFZLSojhao6tT8uM6/bs5zLyxypCCecvL6SS4xgysSBFlL fl0o7dOEQywmuBUuZ/pC8bPvdEH4eKW8WYSACHqnveieucDJn0/PqwTSaBnHSKoeyoCS YV14A/Jjt5PcVs+W8zFBn0cIED9/IM7RsDAUSBk2iHvW7uUJO13Nu1swwXfKpNcLNPS2 VfsZuzcX5UqKyHgIX0dAkna+jnC8DKYqLmyK4A/i1OoZUlxg1OTzr8fnDcsUgnJlVXLr OpJQ== 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 :message-id:date:subject:cc:to:from:feedback-id:dkim-signature :dkim-signature; bh=vjsW9AucU88T88HijQ2DrXg0E5k9G26I+ZgoZYsnzAI=; b=d2BZmQATHoFi0bs542xxgpgmRC+zKjo+jvzMuhC39VaKvv8/gQuT9M3lWKFdES3hzG L0Q0SQCTH1/w9c6SNuanfX7SjxZuQARbhgmjWQ8bslGAVVVj910xfxK5W6lfvOsLkjcz vdQFXssQAu57mOLMvQEWmvAG9qtwcZbb4y8io2Bk19sXvW0kcO5XjY3QAOeUDVPndAyA LVBVZVN6LYl/TxL2IfkDNgerEqukXIQY//RV5dKN3huvPprkvSJLcrtnXXZNpW27O1yW 6K3UHMoG2XnxrfwGf45Y1I8b2epGUlunduEn2Ftt5/8ZTObjc8Wc0l38j1Fh4A8YleZ4 szjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm3 header.b=p7Be0evC; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=tJYHxDZW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a656687000000b0046b3d6b786asi16746171pgw.186.2022.11.02.09.24.24; Wed, 02 Nov 2022 09:24:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@svenpeter.dev header.s=fm3 header.b=p7Be0evC; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=tJYHxDZW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=svenpeter.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231668AbiKBQW6 (ORCPT <rfc822;yves.mi.zy@gmail.com> + 99 others); Wed, 2 Nov 2022 12:22:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232068AbiKBQWX (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 2 Nov 2022 12:22:23 -0400 Received: from wout1-smtp.messagingengine.com (wout1-smtp.messagingengine.com [64.147.123.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A8FC0326FA; Wed, 2 Nov 2022 09:16:06 -0700 (PDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id AEF2432005C1; Wed, 2 Nov 2022 12:16:03 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Wed, 02 Nov 2022 12:16:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=svenpeter.dev; h=cc:cc:content-transfer-encoding:date:date:from:from :in-reply-to:message-id:mime-version:reply-to:sender:subject :subject:to:to; s=fm3; t=1667405763; x=1667492163; bh=vjsW9AucU8 8T88HijQ2DrXg0E5k9G26I+ZgoZYsnzAI=; b=p7Be0evCxVzL9WsdOQE4XYZ+IN fE/97l2ihtQ1rXMk4iqSOBAq8BsukeckaHXigDSbz1F+xQ4OJ7M7BzRNJHOz4i1f Rg5pUXmQ0h+luQXk5iDZuwHt9OJkSE9tEEWf8pktnQ0oDTjsd219fJWQtwXOmfly VxUXn8GoEVjahMbW5xheoI8mKp8uSLr5SSDmmNFvjmN1OCvTUM6hqEoo8XG7V4AU TpkzIq4kRYvw641pcjFf/LFT94vpOcFPuex2rXseTYaP5FxcsjaVTxPDpf2EUffI CFzEEW4VnitwTwsDbn3ELwGo/n2CHSe+NgOJ3xfuHKQRk97ry3vzx+vAPUvg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:sender:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1667405763; x=1667492163; bh=vjsW9AucU88T88HijQ2DrXg0E5k9G26I+Zg oZYsnzAI=; b=tJYHxDZW6rW4pPnCLpsIta4NrRsfO1HsHdhpmYM7x39dx1b9V34 ube4P7qlGDjt3p3xx0FlTOamj8PoQ7GzpWEMiBe+Yy3Xdbb5Omb8mKZ20+3sjz8y XTHTFX9/wdwsTJn7jZHTd94PCGyvidlwa/YwVJQBItyFfqVNU6tqHHh8jL9YhLGa /hoAsCKKsEGhlyV1uO5nmLQGlph7I0/Co9d24rHaWSqhWa7G5Lx7964B24s8vdXO iw2V2n/fSt3ZQwafBaxq3hmAUZShG7tC68SlSeNWovBusHZutNAQvWNt3eTbYBG3 Rg6LscQAoyVvh2HO86Q/7q8Dm5mbOqDInVw== X-ME-Sender: <xms:wpdiY6HvLI4jQjbUwyrqCQc-xXX3gU4cKUZoWMsX1IaWtIXghsPIWQ> <xme:wpdiY7XJzrb7SjRTev8FnzZPqH6JOoPyJHHvP-BETWm2FR6O0OKQvmvpCfb5hSA4k LGDfII561qe29I0WFw> X-ME-Received: <xmr:wpdiY0LYgH9ZUU3TrefF0JiHfLxE90cLtdTq5wBRzM1tizIrKx9XO2a_3_uuMKqyhc9qNvDv0n5n9lmopl9A5h5cazK9bmL9oH3BHVqmMJ0PzyulkOD1QOnYn1Afig> X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvgedrudejgdekhecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfghnecu uegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenuc fjughrpefhvfevufffkffoggfgsedtkeertdertddtnecuhfhrohhmpefuvhgvnhcurfgv thgvrhcuoehsvhgvnhesshhvvghnphgvthgvrhdruggvvheqnecuggftrfgrthhtvghrnh epleduffeiheeuvedtffevtdeuleeljeduudfgtedtvefhfeffvdfghfejhefgleelnecu vehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepshhvvghnse hsvhgvnhhpvghtvghrrdguvghv X-ME-Proxy: <xmx:wpdiY0HM4ukHeVnwrAjU32g6S62a2t6rCnh4FpmkzLZoTPYESoni5w> <xmx:wpdiYwUiQz-oHg0vNUOEo5d0lxHmtjS0y5JM9AcJTzht7tpAAviybw> <xmx:wpdiY3OWqHNP_2qA_ksAARSYCiVVL6rrDMZ2Ed13NCsbr9pJlQXSdw> <xmx:w5diYyJ_qRPDhwydtkyvKeyfzAPFiDu3ixePL4pwB8_Cxv18jT3YRg> Feedback-ID: i51094778:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 2 Nov 2022 12:16:01 -0400 (EDT) From: Sven Peter <sven@svenpeter.dev> To: Heikki Krogerus <heikki.krogerus@linux.intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org> Cc: Sven Peter <sven@svenpeter.dev>, Hector Martin <marcan@marcan.st>, =?utf-8?q?Guido_G=C3=BCnther?= <agx@sigxcpu.org>, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, asahi@lists.linux.dev Subject: [PATCH] usb: typec: tipd: Prevent uninitialized event{1,2} in IRQ handler Date: Wed, 2 Nov 2022 17:15:42 +0100 Message-Id: <20221102161542.30669-1-sven@svenpeter.dev> X-Mailer: git-send-email 2.30.1 (Apple Git-130) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748402211778165185?= X-GMAIL-MSGID: =?utf-8?q?1748402211778165185?= |
Series |
usb: typec: tipd: Prevent uninitialized event{1,2} in IRQ handler
|
|
Commit Message
Sven Peter
Nov. 2, 2022, 4:15 p.m. UTC
If reading TPS_REG_INT_EVENT1/2 fails in the interrupt handler event1
and event2 may be uninitialized when they are used to determine
IRQ_HANDLED vs. IRQ_NONE in the error path.
Fixes: c7260e29dd20 ("usb: typec: tipd: Add short-circuit for no irqs")
Fixes: 45188f27b3d0 ("usb: typec: tipd: Add support for Apple CD321X")
Signed-off-by: Sven Peter <sven@svenpeter.dev>
---
drivers/usb/typec/tipd/core.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
Comments
On Wed, 2 Nov 2022 at 16:24, Sven Peter <sven@svenpeter.dev> wrote: > > If reading TPS_REG_INT_EVENT1/2 fails in the interrupt handler event1 > and event2 may be uninitialized when they are used to determine > IRQ_HANDLED vs. IRQ_NONE in the error path. > > Fixes: c7260e29dd20 ("usb: typec: tipd: Add short-circuit for no irqs") > Fixes: 45188f27b3d0 ("usb: typec: tipd: Add support for Apple CD321X") > Signed-off-by: Sven Peter <sven@svenpeter.dev> Reviewed-by: Eric Curtin <ecurtin@redhat.com> > --- > drivers/usb/typec/tipd/core.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c > index b637e8b378b3..2a77bab948f5 100644 > --- a/drivers/usb/typec/tipd/core.c > +++ b/drivers/usb/typec/tipd/core.c > @@ -474,7 +474,7 @@ static void tps6598x_handle_plug_event(struct tps6598x *tps, u32 status) > static irqreturn_t cd321x_interrupt(int irq, void *data) > { > struct tps6598x *tps = data; > - u64 event; > + u64 event = 0; > u32 status; > int ret; > > @@ -519,8 +519,8 @@ static irqreturn_t cd321x_interrupt(int irq, void *data) > static irqreturn_t tps6598x_interrupt(int irq, void *data) > { > struct tps6598x *tps = data; > - u64 event1; > - u64 event2; > + u64 event1 = 0; > + u64 event2 = 0; > u32 status; > int ret; > > -- > 2.25.1 > >
Hi, On Wed, Nov 02, 2022 at 05:15:42PM +0100, Sven Peter wrote: > If reading TPS_REG_INT_EVENT1/2 fails in the interrupt handler event1 > and event2 may be uninitialized when they are used to determine > IRQ_HANDLED vs. IRQ_NONE in the error path. > > Fixes: c7260e29dd20 ("usb: typec: tipd: Add short-circuit for no irqs") > Fixes: 45188f27b3d0 ("usb: typec: tipd: Add support for Apple CD321X") > Signed-off-by: Sven Peter <sven@svenpeter.dev> > --- > drivers/usb/typec/tipd/core.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c > index b637e8b378b3..2a77bab948f5 100644 > --- a/drivers/usb/typec/tipd/core.c > +++ b/drivers/usb/typec/tipd/core.c > @@ -474,7 +474,7 @@ static void tps6598x_handle_plug_event(struct tps6598x *tps, u32 status) > static irqreturn_t cd321x_interrupt(int irq, void *data) > { > struct tps6598x *tps = data; > - u64 event; > + u64 event = 0; > u32 status; > int ret; > > @@ -519,8 +519,8 @@ static irqreturn_t cd321x_interrupt(int irq, void *data) > static irqreturn_t tps6598x_interrupt(int irq, void *data) > { > struct tps6598x *tps = data; > - u64 event1; > - u64 event2; > + u64 event1 = 0; > + u64 event2 = 0; > u32 status; > int ret; Reviewed-by: Guido Günther <agx@sigxcpu.org> Cheers, -- Guido
On Wed, Nov 02, 2022 at 05:15:42PM +0100, Sven Peter wrote: > If reading TPS_REG_INT_EVENT1/2 fails in the interrupt handler event1 > and event2 may be uninitialized when they are used to determine > IRQ_HANDLED vs. IRQ_NONE in the error path. > > Fixes: c7260e29dd20 ("usb: typec: tipd: Add short-circuit for no irqs") > Fixes: 45188f27b3d0 ("usb: typec: tipd: Add support for Apple CD321X") > Signed-off-by: Sven Peter <sven@svenpeter.dev> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> > --- > drivers/usb/typec/tipd/core.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c > index b637e8b378b3..2a77bab948f5 100644 > --- a/drivers/usb/typec/tipd/core.c > +++ b/drivers/usb/typec/tipd/core.c > @@ -474,7 +474,7 @@ static void tps6598x_handle_plug_event(struct tps6598x *tps, u32 status) > static irqreturn_t cd321x_interrupt(int irq, void *data) > { > struct tps6598x *tps = data; > - u64 event; > + u64 event = 0; > u32 status; > int ret; > > @@ -519,8 +519,8 @@ static irqreturn_t cd321x_interrupt(int irq, void *data) > static irqreturn_t tps6598x_interrupt(int irq, void *data) > { > struct tps6598x *tps = data; > - u64 event1; > - u64 event2; > + u64 event1 = 0; > + u64 event2 = 0; > u32 status; > int ret; > thanks,
diff --git a/drivers/usb/typec/tipd/core.c b/drivers/usb/typec/tipd/core.c index b637e8b378b3..2a77bab948f5 100644 --- a/drivers/usb/typec/tipd/core.c +++ b/drivers/usb/typec/tipd/core.c @@ -474,7 +474,7 @@ static void tps6598x_handle_plug_event(struct tps6598x *tps, u32 status) static irqreturn_t cd321x_interrupt(int irq, void *data) { struct tps6598x *tps = data; - u64 event; + u64 event = 0; u32 status; int ret; @@ -519,8 +519,8 @@ static irqreturn_t cd321x_interrupt(int irq, void *data) static irqreturn_t tps6598x_interrupt(int irq, void *data) { struct tps6598x *tps = data; - u64 event1; - u64 event2; + u64 event1 = 0; + u64 event2 = 0; u32 status; int ret;