Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp2958335lqo; Tue, 21 May 2024 02:29:23 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVrqcEFh0elKiGbhGbwg8xKqrsO5ACGS+HOcgqIzq8LrTcmyqRB5/EKWlOZmMrY1cF58/67fbeKtLmRem3KdBjaUB3LANYDJvT7zgKpTg== X-Google-Smtp-Source: AGHT+IG0Lq/h51OULmef+hC0pdRL9xBUbRkXHYw47q5zJeATOJ9KkKTRZ2F7GGxgrGkM8sJ0kyKO X-Received: by 2002:a17:906:a2d3:b0:a59:bbea:14e8 with SMTP id a640c23a62f3a-a5d5b018e3dmr756996766b.17.1716283763114; Tue, 21 May 2024 02:29:23 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716283763; cv=pass; d=google.com; s=arc-20160816; b=lKagbBYwPL0u86EunH3GJFr9Ngda33M+W1VPlPEU/OTCULvMU/MxSBnVwJ2HJ3DBYe BkA5RUmFxLKu6QGzUYv3QyxE3kPcfHkmVxqgrPwUIODAEXwFTo1i6tqoJ4UJ48Mnz+Fm 4sXjre67QORqccM0uCRLqz8pcCL27P7E3uVGUrOSUnKm7XmHccAGtSfKilS47Z0BF7/i 6I9ESTe8akFpDOYIMsAA4wr0egOxe0ravmrbGZ3YhYoF+DBHUQi80JDNzLvhP/IFfqva pMeRvmLKPeDJBIsyzH15DHAacHDujj8OKkc8a4Oa6pPYAKmXKJ5tXKMvywdNx0s81rIw 4tHQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from; bh=fVvpfw+qKzW+FoSkZlR/h7uj1KVwR6ipl3+G9lvAyzA=; fh=LbfO6v6GQxh7YGx33CrIrSFo0Q9UOY5yoVJzF8Yl4rA=; b=byp1sPe6pS7QGgi9YMVyvFsHIfkTlhmfeueZDVjjCoYyU5lcxzwVbuuu9crtSZ9oYq GNSjzJEyr1QSihVSuUK6zxePKKr79/OD4Z01IbEKGS5C5N6PH3VwmMER/XdU6FF4x5MS kl+Cjzc6iblTf63L9iUXB9cD+Tm0bHKssdocET1hF+fDFgpfp8MoOr+bRK6Su7hv+Ttj jejfBLVt97mbl/cBGcuk85yq3rTEjXz6iIKMPDG2bb8WEl3GG3NPxmnW0RTWsGokI028 v2SjePL2nuBp0cT7MvcOP2TDh7GuBHLeZRH0x+5PWdD5gJO9gEQtYPnGW/y2sndAxFSW DrQQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=iscas.ac.cn); spf=pass (google.com: domain of linux-kernel+bounces-184706-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184706-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id a640c23a62f3a-a5a17945ef6si1443505166b.162.2024.05.21.02.29.23 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 May 2024 02:29:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-184706-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=iscas.ac.cn); spf=pass (google.com: domain of linux-kernel+bounces-184706-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-184706-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id D1F5C1F212E4 for ; Tue, 21 May 2024 09:29:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E616C5FBBA; Tue, 21 May 2024 09:29:14 +0000 (UTC) Received: from cstnet.cn (smtp84.cstnet.cn [159.226.251.84]) (using TLSv1.2 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4F7585E22C; Tue, 21 May 2024 09:29:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.226.251.84 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716283754; cv=none; b=f7OrPfgEApq0BbTzPdgYP4Ktf8l3dyDEdRNP1NyXmXsy5MzGXRKIuuTIzk/uMmSH3zUBARgmwc3ha9OfrmqYCTQ7mM++KCk5m0zVk2OijTzMRjLkZpZS2CP6Gm2hXT7WWK5hs75r2Gzb9K3dAX+8iLsXODlp3Qt1wwAxVbSzEdY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716283754; c=relaxed/simple; bh=9YxAc6ONjbFHEyGLzLUnZ+Cukg7tPjLFv7nBPqy1sDo=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=ox2KpT7KiVjeGyMg6lQm7tFEoXl2PSmEqwWHIzcOw2fANP/NvTEziehjBgUiZfZQZmFkxtCkmi44Y09vqZQtpuo8dAtuXZ5AIfXw0hr72oEY4EZcgkbKRSV1lYe1YzNgrZX6dzSdxmLOKsFXKB/T10r8asZAYv83eBpuHczzAjg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn; spf=pass smtp.mailfrom=iscas.ac.cn; arc=none smtp.client-ip=159.226.251.84 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=iscas.ac.cn Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=iscas.ac.cn Received: from localhost (unknown [124.16.138.129]) by APP-05 (Coremail) with SMTP id zQCowABnbQFZaUxmKAaIDA--.16476S2; Tue, 21 May 2024 17:28:58 +0800 (CST) From: Chen Ni To: tvboxspy@gmail.com, mchehab@kernel.org Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Chen Ni Subject: [PATCH] media: lmedm04: Handle errors for lme2510_int_read Date: Tue, 21 May 2024 17:10:42 +0800 Message-Id: <20240521091042.1769684-1-nichen@iscas.ac.cn> X-Mailer: git-send-email 2.25.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-CM-TRANSID:zQCowABnbQFZaUxmKAaIDA--.16476S2 X-Coremail-Antispam: 1UD129KBjvJXoW7tw45tFyfGF4fCr1xtr45Awb_yoW8Wr4Upa y5GFWjkFWUJrZrursrJrs8Ar4fuw4rCay3KFWa9a4fXF1fJw1DAa4FkF15tr4rCr95Ja42 qa90qay3Kr15CFDanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUkS14x267AKxVWUJVW8JwAFc2x0x2IEx4CE42xK8VAvwI8IcIk0 rVWrJVCq3wAFIxvE14AKwVWUJVWUGwA2ocxC64kIII0Yj41l84x0c7CEw4AK67xGY2AK02 1l84ACjcxK6xIIjxv20xvE14v26r4j6ryUM28EF7xvwVC0I7IYx2IY6xkF7I0E14v26r4j 6F4UM28EF7xvwVC2z280aVAFwI0_Cr1j6rxdM28EF7xvwVC2z280aVCY1x0267AKxVW0oV Cq3wAS0I0E0xvYzxvE52x082IY62kv0487Mc02F40EFcxC0VAKzVAqx4xG6I80ewAv7VC0 I7IYx2IY67AKxVWUJVWUGwAv7VC2z280aVAFwI0_Jr0_Gr1lOx8S6xCaFVCjc4AY6r1j6r 4UM4x0Y48IcxkI7VAKI48JM4x0x7Aq67IIx4CEVc8vx2IErcIFxwCY02Avz4vE14v_GFWl 42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJV WUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY17CE14v26r126r1DMIIYrxkI7VAK I48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcVC0I7IYx2IY6xkF7I0E14v26r1j6r 4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY6I8E87Iv67AKxVWUJVW8JwCI42IY 6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa73UjIFyTuYvjfU0VyxDUUUU X-CM-SenderInfo: xqlfxv3q6l2u1dvotugofq/ Add check for the return value of usb_pipe_endpoint() and usb_submit_urb() in order to catch the errors. Fixes: 15e1ce33182d ("[media] lmedm04: Fix usb_submit_urb BOGUS urb xfer, pipe 1 != type 3 in interrupt urb") Signed-off-by: Chen Ni --- drivers/media/usb/dvb-usb-v2/lmedm04.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/media/usb/dvb-usb-v2/lmedm04.c b/drivers/media/usb/dvb-usb-v2/lmedm04.c index 8a34e6c0d6a6..f0537b741d13 100644 --- a/drivers/media/usb/dvb-usb-v2/lmedm04.c +++ b/drivers/media/usb/dvb-usb-v2/lmedm04.c @@ -373,6 +373,7 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) struct dvb_usb_device *d = adap_to_d(adap); struct lme2510_state *lme_int = adap_to_priv(adap); struct usb_host_endpoint *ep; + int ret; lme_int->lme_urb = usb_alloc_urb(0, GFP_KERNEL); @@ -390,11 +391,20 @@ static int lme2510_int_read(struct dvb_usb_adapter *adap) /* Quirk of pipe reporting PIPE_BULK but behaves as interrupt */ ep = usb_pipe_endpoint(d->udev, lme_int->lme_urb->pipe); + if (!ep) { + usb_free_urb(lme_int->lme_urb); + return -ENODEV; + } if (usb_endpoint_type(&ep->desc) == USB_ENDPOINT_XFER_BULK) lme_int->lme_urb->pipe = usb_rcvbulkpipe(d->udev, 0xa); - usb_submit_urb(lme_int->lme_urb, GFP_KERNEL); + ret = usb_submit_urb(lme_int->lme_urb, GFP_KERNEL); + if (ret) { + usb_free_urb(lme_int->lme_urb); + return ret; + } + info("INT Interrupt Service Started"); return 0; -- 2.25.1