Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp959729ybi; Fri, 2 Aug 2019 07:07:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqwrq+QNwRzTjmWMrAqXgwE8B/aCYIsiCn0efZFVkH6BApk6mHM9oPfHMc9d/ChJ4blFF2TS X-Received: by 2002:a63:9e54:: with SMTP id r20mr91109554pgo.64.1564754868750; Fri, 02 Aug 2019 07:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564754868; cv=none; d=google.com; s=arc-20160816; b=FbMES1rMnIVkaqSmG22/nrDGjX2tekkvdAbfagayRn1+yPg1TMtlCwHfLWIyUOMO4+ +HERJUCU8JcjqALNiGD3Vd4AVokliiRtKb4NT66Pz8662MlHaHD0Y+PgCKmUqQakcdMN rDSuqcQhcRN/BB4jElwKYorRSYMybvZS7+Dc50T3CGxXxzymifiFeJZ7/UUR+rqC96BG s8MQXAGbOumFIykQX0z56owooGHIEmhcpcmjUa1XSBPKoeRLzrk7mfd3E/6Dyas9xAr5 UpgoTyAxpy1a1K85Rk3CsO67QZVxadGg6WW3Bszc7gDJ7rfaJy6Eoh07eUR1GpRSapVF BCLw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=h4QFkP3WShOmlvUjiV369W5mRtOntkcbq62JGc0lwBM=; b=A49owmKaVnnZLtGWIzOv1/Lir+D1iFtnY3KhSE3Crcw0mUn28DN2FjiG2frVbO0pow W6OR03Icp5mLvjQbA54nZ1toZOK7KMr8rojFYitAt7iDfpcfqgaTrv/SpawJHhBwvYLU Waaj4pE1GQ1I6wz5oYa7SoauG6qZPp841FNtWZyq1qpKG3iiyN+KyVFHBXtKl6s1yJuA eBrc6AKC+YlWtm+FR3ScoXSG47LsB2Vd+TYstKBTHnxf7goh4MpCjMHykB7BB6Mwruf0 D9WE+D2F6o3xue2RjVFJPzEkWMhsqlsdtWPlpUq/VoCocoSxprmWfXtGCVCyicLEmLaJ WcQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=lC7CdGY5; 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 m3si23708529pld.385.2019.08.02.07.07.32; Fri, 02 Aug 2019 07:07:48 -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=lC7CdGY5; 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 S2390615AbfHBLmx (ORCPT + 99 others); Fri, 2 Aug 2019 07:42:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:49758 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732584AbfHBLmx (ORCPT ); Fri, 2 Aug 2019 07:42:53 -0400 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 393E4206A3; Fri, 2 Aug 2019 11:42:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564746172; bh=Xan5DZzaMXhHwR3HpDUVQjKov78JoUNnq/m/XEFCYls=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=lC7CdGY5ef9KTz8k2VdyznVeoNv3FsQgPz7+h725TrJnTWJyNJWj20UxkJjRdYdqe SByxkIzMHWMou1Y3AFn0emKcmOkBgqAMvUKXgM+17jwtALjeg3DxsRHPFBdA3ZE1Y2 fBjoRQN1QCa54hEWbM3lJGl5AIscKNLA1gxpWwA8= Date: Fri, 2 Aug 2019 13:42:50 +0200 From: Greg Kroah-Hartman To: Guenter Roeck Cc: Heikki Krogerus , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Douglas Gilbert Subject: Re: [RFC PATCH] usb: typec: tcpm: Ignore unsupported/unknown alternate mode requests Message-ID: <20190802114250.GA4721@kroah.com> References: <1564029037-22929-1-git-send-email-linux@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1564029037-22929-1-git-send-email-linux@roeck-us.net> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 24, 2019 at 09:30:37PM -0700, Guenter Roeck wrote: > TCPM may receive PD messages associated with unknown or unsupported > alternate modes. If that happens, calls to typec_match_altmode() > will return NULL. The tcpm code does not currently take this into > account. This results in crashes. > > Unable to handle kernel NULL pointer dereference at virtual address 000001f0 > pgd = 41dad9a1 > [000001f0] *pgd=00000000 > Internal error: Oops: 5 [#1] THUMB2 > Modules linked in: tcpci tcpm > CPU: 0 PID: 2338 Comm: kworker/u2:0 Not tainted 5.1.18-sama5-armv7-r2 #6 > Hardware name: Atmel SAMA5 > Workqueue: 2-0050 tcpm_pd_rx_handler [tcpm] > PC is at typec_altmode_attention+0x0/0x14 > LR is at tcpm_pd_rx_handler+0xa3b/0xda0 [tcpm] > ... > [] (typec_altmode_attention) from [] > (tcpm_pd_rx_handler+0xa3b/0xda0 [tcpm]) > [] (tcpm_pd_rx_handler [tcpm]) from [] > (process_one_work+0x123/0x2a8) > [] (process_one_work) from [] > (worker_thread+0xbd/0x3b0) > [] (worker_thread) from [] (kthread+0xcf/0xf4) > [] (kthread) from [] (ret_from_fork+0x11/0x38) > > Ignore PD messages if the asociated alternate mode is not supported. > > Reported-by: Douglas Gilbert > Cc: Douglas Gilbert > Fixes: e9576fe8e605c ("usb: typec: tcpm: Support for Alternate Modes") > Signed-off-by: Guenter Roeck > --- > Taking a stab at the problem. I don't really know if this is the correct > fix, or even if my understanding of the problem is correct, thus marking > the patch as RFC. Now that I think everyone agrees this is a "real" fix, can you resend it in a format that I can apply it in, with the various acks added? thanks, greg k-h