From patchwork Tue Oct 27 13:54:27 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 312941 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=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT 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 14B90C388F9 for ; Tue, 27 Oct 2020 14:27:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D42A5207C3 for ; Tue, 27 Oct 2020 14:27:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808856; bh=uShSwgWGEs5x0bqB2yLBn4qSmflObXXmwLUKWYkG47k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=pp8URIqpcdw4sYEbFYhvyWmlD8QJyrIHFNVZSAvoEDj+8qmc8Msu/jnDOkb6BBbrW aMwyySKS4lEI7k3ZQfuaZSHqVNuK2XDjkpq88icO0J/2ZBtDGEj5ntN76kUR1R8ieE QmNZRrV0ebBfN/gBuMOgmlwIL8MU0JLb/HHHspaA= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759069AbgJ0O1f (ORCPT ); Tue, 27 Oct 2020 10:27:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:53824 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759065AbgJ0O1f (ORCPT ); Tue, 27 Oct 2020 10:27:35 -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 210C1206DC; Tue, 27 Oct 2020 14:27:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1603808854; bh=uShSwgWGEs5x0bqB2yLBn4qSmflObXXmwLUKWYkG47k=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JqtXpo9dHGXiC/kE/EGlc+VnXDCb3HXC7SZFR13XR8CqWCSfMPA+1m/t/fJtSAjxN foL1hQzPiXpRYmbVDuXSY1xcwDT887te1MDwp21r2kyhuqkfr0vysrEmpKgl+v+MNS fZIGE22lMQ6ikXILMI+fmL9TEtNYrTmS2KvYF4ps= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, syzbot+998261c2ae5932458f6c@syzkaller.appspotmail.com, Oliver Neukum , Sean Young , Mauro Carvalho Chehab , Sasha Levin Subject: [PATCH 4.19 209/264] media: ati_remote: sanity check for both endpoints Date: Tue, 27 Oct 2020 14:54:27 +0100 Message-Id: <20201027135440.495678574@linuxfoundation.org> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201027135430.632029009@linuxfoundation.org> References: <20201027135430.632029009@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Oliver Neukum [ Upstream commit a8be80053ea74bd9c3f9a3810e93b802236d6498 ] If you do sanity checks, you should do them for both endpoints. Hence introduce checking for endpoint type for the output endpoint, too. Reported-by: syzbot+998261c2ae5932458f6c@syzkaller.appspotmail.com Signed-off-by: Oliver Neukum Signed-off-by: Sean Young Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/rc/ati_remote.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c index 8e82610ffaad5..01c82da8e9aa2 100644 --- a/drivers/media/rc/ati_remote.c +++ b/drivers/media/rc/ati_remote.c @@ -845,6 +845,10 @@ static int ati_remote_probe(struct usb_interface *interface, err("%s: endpoint_in message size==0? \n", __func__); return -ENODEV; } + if (!usb_endpoint_is_int_out(endpoint_out)) { + err("%s: Unexpected endpoint_out\n", __func__); + return -ENODEV; + } ati_remote = kzalloc(sizeof (struct ati_remote), GFP_KERNEL); rc_dev = rc_allocate_device(RC_DRIVER_SCANCODE);