Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp1605347rwb; Sun, 14 Aug 2022 07:46:04 -0700 (PDT) X-Google-Smtp-Source: AA6agR5OoE/1A0VuAhBwcfFxlrPzX9qx5uSUPe6ZWXWLe6PI5P532DTggmNBBSf0dNtUyTYQx7uj X-Received: by 2002:a17:907:3111:b0:730:6535:b3fb with SMTP id wl17-20020a170907311100b007306535b3fbmr7718157ejb.490.1660488364033; Sun, 14 Aug 2022 07:46:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660488364; cv=none; d=google.com; s=arc-20160816; b=OVh9nqyULs7mwO3e/zBSCbjipQoJ/nILjxm6lX96uBXIk5ush1VuRLcULWWWrK/mK9 5nRFPPYmT7NhZjS2sHqbxtgSewOzN9GDynMkc3KPwfQDht5J8cmcKNpFw4mZ58fwtZFx F2WTEAvbLED2acmmbEFflDSWTcIBpU+lcekiVVqEnM1LLgfGEbMDkZy2vuoGu9WZL8TX vyzXRQzvpcCEvyWhmfW7ajwKhAmGaEFQ3UVUjQHtmSi+SmU/FbVJM3rWT6zkW79oEYYh YFqmaFEwOW3AXgPu/81d6Ug1dEG32bvPkQRmtBq9sinYQcbrc2/a1kpGlUdZtNn0DT4f qaCg== 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:dkim-signature; bh=cmiC4GyXrivAdN89C1L8XiqqWpho7GqZlZeaKyCMglU=; b=YZlbxcx5ZsJxnXxyovKTYX1OVECZfA0qknIPkxNlDiXTJmmoWEfCX9cp8MJi/RMxov x573GCdlXORLJ9jMIxjyMQe4D+9KLALoaEpnM3xiiBnMXlpiq82xt5u98kR2SjUXJVN9 21WptkUuk+5ZjqaS4zSEHbxbA/UuFvTxTWBNiZ2e9CGU4zgO1orjzwuiPOAWFyXsLw0h sBd5oQM6KK4AhZG4VY/vM/xBhAHXESKmPICtJMoBJbFXkHcJOfUOkd1pyctxhU3O+cJU dGKNy8Zo6xY/aDI4alhWD85bi7rkMdw/d4sTaTYe8zwLN4OnkIyXl9f2FnkrJX7B9xm8 BmYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iW7PUTkW; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e19-20020a50a693000000b0043d6b26be36si5946467edc.595.2022.08.14.07.45.38; Sun, 14 Aug 2022 07:46:04 -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=@gmail.com header.s=20210112 header.b=iW7PUTkW; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239784AbiHNOZ4 (ORCPT + 99 others); Sun, 14 Aug 2022 10:25:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231576AbiHNOZx (ORCPT ); Sun, 14 Aug 2022 10:25:53 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94F2410545; Sun, 14 Aug 2022 07:25:52 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id k14so4861300pfh.0; Sun, 14 Aug 2022 07:25:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc; bh=cmiC4GyXrivAdN89C1L8XiqqWpho7GqZlZeaKyCMglU=; b=iW7PUTkWbQ4GdHHEteuCNQQ5Ss7ljIOtKksm4RzTJDCRMkFQ216uH9eyBZ2pMHgX9g PuNmNy51O5WWstLXa0FBpetTeHuSGSgl1VKN6FAvouYLBuiUerRTuHGUXVf2liVticay NmUUq3xL7EiuE6XJXJB5otVI+ST8+hjNF4J+gCF/8YjDvLGPcPLiZKC+7OfA19SLMBIv ddLNMlG1E3UDFQleHPX5KNluWSKFhQ7b7qCRVdJ8tHNHzlJGR090oBkuHIuUTD7E6i3z QWWa6wvoTrbbBFCWbxBVes1c7haTDs/qD2qZIlC2p5lTzK2RPl0HbtC2aCNZxUn0+yNP 2uYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc; bh=cmiC4GyXrivAdN89C1L8XiqqWpho7GqZlZeaKyCMglU=; b=wXJqUw2KVXkvVf7dyNAP8qzjIDcP2Tv3jua2MoMYPmhl3DDSCymCkumWIQIHC+YIqI HMPNb1sHRtrfgIN0HUwvv+FTdiToXTaqMCaz+ACgxKpGr9Jhar18VNDKzaHKjbP88QUr zQQzXGMCM0yO44FHYlYsQZeSQwpDqSiHmp7yIhYkrPF0MQ7Jv2vxQrBJYBNxv9g3xe9r AdAwhKkkqEYSR8zWc+Uo4kekngSIr0zv6+dypiYauXk8+CFwRSA3E3DvgkR0l+KuCpK3 TyQlJoK4QEDvlHl0sglk9L/9tJZzGouP+4o9jVzcaApKwtnRQCl8ikrajhSCy+WT3gwW 22dg== X-Gm-Message-State: ACgBeo16nMRgNE48FbrghtVpkTl6JYEQGPDYqx1rfSDe0KGHU95d2Sbv sTysqA6/yyLuKyGS/bnNnLw= X-Received: by 2002:a63:1208:0:b0:423:c60e:ed09 with SMTP id h8-20020a631208000000b00423c60eed09mr6082759pgl.385.1660487150954; Sun, 14 Aug 2022 07:25:50 -0700 (PDT) Received: from biggie.. ([103.230.148.189]) by smtp.gmail.com with ESMTPSA id s6-20020a170902ea0600b0016dc6279ab7sm5491340plg.149.2022.08.14.07.25.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Aug 2022 07:25:50 -0700 (PDT) From: Gautam Menghani To: sean@mess.org, mchehab@kernel.org Cc: Gautam Menghani , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, linux-kernel-mentees@lists.linuxfoundation.org, syzbot+0c3cb6dc05fbbdc3ad66@syzkaller.appspotmail.com, hdanton@sina.com Subject: [PATCH] drivers/media/rc: Ensure usb_submit_urb() is not called if write is in progress Date: Sun, 14 Aug 2022 19:55:42 +0530 Message-Id: <20220814142543.24910-1-gautammenghani201@gmail.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM,FREEMAIL_REPLY,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no 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: X-Mailing-List: linux-kernel@vger.kernel.org The warning "URB submitted while active" is reported if the function send_packet() in imon.c is called if a write is already is in progress. Add a check to return -EBUSY in case a write is already is in progress. Also, mark tx.busy as false after transmission is completed. Fixes: 21677cfc562a ("V4L/DVB: ir-core: add imon driver") Cc: hdanton@sina.com Suggested-by: hdanton@sina.com Link: https://syzkaller.appspot.com/bug?id=e378e6a51fbe6c5cc43e34f131cc9a315ef0337e Reported-by: syzbot+0c3cb6dc05fbbdc3ad66@syzkaller.appspotmail.com Signed-off-by: Gautam Menghani --- drivers/media/rc/imon.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/media/rc/imon.c b/drivers/media/rc/imon.c index 735b925da998..a5b997c2c7e2 100644 --- a/drivers/media/rc/imon.c +++ b/drivers/media/rc/imon.c @@ -598,6 +598,8 @@ static int send_packet(struct imon_context *ictx) int retval = 0; struct usb_ctrlrequest *control_req = NULL; + if (ictx->tx.busy) + return -EBUSY; /* Check if we need to use control or interrupt urb */ if (!ictx->tx_control) { pipe = usb_sndintpipe(ictx->usbdev_intf0, @@ -654,6 +656,7 @@ static int send_packet(struct imon_context *ictx) pr_err_ratelimited("task interrupted\n"); } mutex_lock(&ictx->lock); + ictx->tx.busy = false; retval = ictx->tx.status; if (retval) -- 2.34.1