Message ID | a882b5f523e5063b6c111d5d7c70fb3569eb4e54.1684000646.git.mchehab@kernel.org |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp5902457vqo; Sat, 13 May 2023 10:59:10 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6nsDOKs6PEdfBiaaLmm0kXL1EDdwJIk8dZ+n5KtTkUODTqiLl8Eu7yayTi7DspJC+wufJI X-Received: by 2002:a05:6a00:2289:b0:625:fe95:f120 with SMTP id f9-20020a056a00228900b00625fe95f120mr39823998pfe.8.1684000750156; Sat, 13 May 2023 10:59:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684000750; cv=none; d=google.com; s=arc-20160816; b=EijFcvWfydLr5X1t+DLJEyA/W0VDK+9WTW9B6hAYtpmifLXQeO1/YLx2NcXs8c3pjr NNvyPGKl7KiH0u2bxf3KFnEsgnrV8MM7loPE7T1cF2T6l9/0fjarW803CwRToRVrSf3u Sp8XKsi8FX6YdFYxHR5KJs9qvWJQgPZnYWj1Lm1y4rQ2cXQvNZQR34lsWlkJgwpa6QEf C6xAbYypkx9g2Lp75vN7T/QGtG7n0KPjjzbBXd1vdRI0ell4UC1o1B9W7ERCa5c68ctm ZkgcoyB1aLk3lir39ax5RW4K4m9r4KhYo+7sCKGl4SY8Cohs+zzlZgnULnERLEiqAEbv Vt6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:from :dkim-signature; bh=7fb86gEXkfYASvCronjqw0INLcd4Rsnb6dy8aAx3tPM=; b=HdK6UFNBbHjEMoAQaUJ7T/etRZOey/4WxFidaHi6UZvVz6w5k+JTWNjSuG0ttHKi7H n2/t1ppt0GhoVEtNew7c9KzOh3IjccFatfzNRlRanH3oFjxCsiMhPXJGjOYbfk8kajka vvBLDzca42G1Y5kpxOggbrRG2Ad8TvwjKHgumR9iDUUiKLFNGR+MWsnu/PiFdcOJKG91 NmiSLam6B6XHxg29S0YT1w3xGjKxzNORD4DPbSWrvOkFtD6Mej//NI1TOHS5uXkQGSR2 5Kz0LiZO1PUb5u2Zd5yI3FUK2evomP3ZcIOfoQNTKLuy4s4StyL0lOTOmfBgWQZacNFO f9cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=o6TQx+Ct; 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=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y16-20020aa79430000000b006436002d796si13369028pfo.1.2023.05.13.10.58.52; Sat, 13 May 2023 10:59:10 -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=fail header.i=@kernel.org header.s=k20201202 header.b=o6TQx+Ct; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233931AbjEMR5y (ORCPT <rfc822;peekingduck44@gmail.com> + 99 others); Sat, 13 May 2023 13:57:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229482AbjEMR5s (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Sat, 13 May 2023 13:57:48 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 431591727; Sat, 13 May 2023 10:57:47 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id C821A61BC5; Sat, 13 May 2023 17:57:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 0F940C4339B; Sat, 13 May 2023 17:57:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1684000666; bh=CMDkEplk7SwUbCVMsf6DA2exjxBJ4jdP0rE7gAI0KQE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o6TQx+CtcfUS5lhy76YLTxbGgBg1XLqLr7mHpR+r1daC0tqTcCRDuIHR5Wec1n8XE pW4zncwIT0yFjUNyLqklxkSUU327YpKQ4VR/vKIfwdf7N+HMf4m3koUUJOc7nKjGWr 1EabB5SZvLDktSRZq19KHKybvyHypT8zvAbsWpvgPmpucTwiq5esjkiWAVD9AgN5PA vPzQ31XzDo9DeBGbKNFsPXUrhgTMAHL1otGxT5YEQ1cFSDN+cZ2PKLk18uVazwQ96t cnavQROP72STzUrgHRc6sDuMP8H5KGUmzZvBLiRtkbWTrnVdZs5/6jJ/3Sc2W7AOIw 1pF9YYx5Ub5ZQ== Received: from mchehab by mail.kernel.org with local (Exim 4.96) (envelope-from <mchehab@kernel.org>) id 1pxtV1-001txn-1G; Sat, 13 May 2023 18:57:43 +0100 From: Mauro Carvalho Chehab <mchehab@kernel.org> Cc: Wei Chen <harperchen1110@gmail.com>, Mauro Carvalho Chehab <mchehab@kernel.org>, linux-kernel@vger.kernel.org, linux-media@vger.kernel.org Subject: [PATCH 08/24] media: dvb-usb: digitv: fix null-ptr-deref in digitv_i2c_xfer() Date: Sat, 13 May 2023 18:57:25 +0100 Message-Id: <a882b5f523e5063b6c111d5d7c70fb3569eb4e54.1684000646.git.mchehab@kernel.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <53558de2b5c4f4ee6bfcfbe34e27071c2d0073d5.1684000646.git.mchehab@kernel.org> References: <53558de2b5c4f4ee6bfcfbe34e27071c2d0073d5.1684000646.git.mchehab@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net To: unlisted-recipients:; (no To-header on input) 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?1765802770775606285?= X-GMAIL-MSGID: =?utf-8?q?1765802770775606285?= |
Series |
[01/24] media: pvrusb2: fix DVB_CORE dependency
|
|
Commit Message
Mauro Carvalho Chehab
May 13, 2023, 5:57 p.m. UTC
From: Wei Chen <harperchen1110@gmail.com> In digitv_i2c_xfer, msg is controlled by user. When msg[i].buf is null and msg[i].len is zero, former checks on msg[i].buf would be passed. Malicious data finally reach digitv_i2c_xfer. If accessing msg[i].buf[0] without sanity check, null ptr deref would happen. We add check on msg[i].len to prevent crash. Similar commit: commit 0ed554fd769a ("media: dvb-usb: az6027: fix null-ptr-deref in az6027_i2c_xfer()") Link: https://lore.kernel.org/linux-media/20230313095008.1039689-1-harperchen1110@gmail.com Signed-off-by: Wei Chen <harperchen1110@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org> --- drivers/media/usb/dvb-usb/digitv.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/drivers/media/usb/dvb-usb/digitv.c b/drivers/media/usb/dvb-usb/digitv.c index 2756815a780b..32134be16914 100644 --- a/drivers/media/usb/dvb-usb/digitv.c +++ b/drivers/media/usb/dvb-usb/digitv.c @@ -63,6 +63,10 @@ static int digitv_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num warn("more than 2 i2c messages at a time is not handled yet. TODO."); for (i = 0; i < num; i++) { + if (msg[i].len < 1) { + i = -EOPNOTSUPP; + break; + } /* write/read request */ if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { if (digitv_ctrl_msg(d, USB_READ_COFDM, msg[i].buf[0], NULL, 0,