Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp3344591pxv; Sun, 4 Jul 2021 16:07:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyYI2sgYdLroBN8TU1u07iDOdd7pK7uqvqrKzthjA0yv285eFLLowUwNIk8Ak2M/6HJ7FHo X-Received: by 2002:a17:907:868d:: with SMTP id qa13mr10492011ejc.173.1625440056418; Sun, 04 Jul 2021 16:07:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1625440056; cv=none; d=google.com; s=arc-20160816; b=SWNFPb165+i3XMyu9y3lk16G8ERwcoLortjXyAgic4X01mOLzCwslmCSAJparOdzgE XxSHlKWg5EVWgtTr9ZlbaR/ot0LCvfWcbizxJC8/ay9/D9+ZMZ69H56WFza9a1mFWbKh ImEyGxvt12gPrw6xYUPN0BiP1fRaL2g1CAK7c3pfHMPPjzh3kwJ1wF4UjZG0NHsLwKzV pIeu+ZdofPgn3ud+93pDWVSnVu+S+5EIF4QzJx0eAX6cpzQFQsnkj1CiulVdJlcG5ZsN HPEMHT7foOMAe8Mm7VPUq7Wp5/8hRPLB8rPJUKkiiH3JzM/HCkDEYShBOEKQyN5hnuTR RL9g== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ODHSTH7FCWkORPKIe01KjDNAeePByzIuDRlB5JRrCeQ=; b=eUa27fnMZJPwokh/dVwrLobfPJy3de1JZJ2CJsoiDjVco8kfF1HUGTNnPkG+q7AyYP I/6bb9/yAJB9YCQY3r6drO1NRajDVe2plg1fPoS4guaXecVuFlOLrKRWMNNh4CfeOVbD emOGd484jpyP8QtkvhIgsX0BnKe4HMt2JWrdWZ6w73ipcw5SRj7i/ylvNuop1+bV4DcT MYdyguujK8cIW5oWs4/a5to58GQ5ndUjMLagYjlxnVY6DmLEPJyp0q9G44Fo1RlTy6EB bkf7eA79gNp4tCbffY4TMpZeDIAr1p3vertQcnRoiTgj5EUr6mRUgv/oT9WD+W9tD7bA 9KZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WYzyJAlK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hc34si7549280ejc.435.2021.07.04.16.07.13; Sun, 04 Jul 2021 16:07:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WYzyJAlK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S229910AbhGDXIU (ORCPT + 99 others); Sun, 4 Jul 2021 19:08:20 -0400 Received: from mail.kernel.org ([198.145.29.99]:46450 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230244AbhGDXHw (ORCPT ); Sun, 4 Jul 2021 19:07:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 79D59613E9; Sun, 4 Jul 2021 23:05:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1625439916; bh=RMOrC1frwt1UylxJ7TKcgEozTKZQbIES9glVwdgUp2U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WYzyJAlKOLXrDSruS8JBQYvUTl62K/YJ3VS1tLy4tnnIqYlSo3Jm7jzBJla9263a3 Rk63t2hEpmAsIHXlUYS+ePKCe9wTcTy6TaFdWOQwK8fwsOZ6Gq7z5LgqMUqkSNoJ0G npOXmFKlqIaHQpaMR2xunF/k89vW1JV5U+uJoL8n8OHE8FiMQVOhqB5BgCPdmWtp/4 KO+XHdhZVWlEGYpLpS/POt8JzlF1YjTVkhcIK0ByKTXtE3fhuBeNi8R3X157wkyxz7 TQvQntYG5vSS6Ruvo1f3Mdc9fbCprbOiVD7ndhc7YrrpQlvvVXhgqZV+u1LJW5XO0e N9wbn3wGKRoaQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Tong Zhang , Hans Verkuil , Mauro Carvalho Chehab , Sasha Levin , linux-media@vger.kernel.org Subject: [PATCH AUTOSEL 5.13 40/85] media: bt878: do not schedule tasklet when it is not setup Date: Sun, 4 Jul 2021 19:03:35 -0400 Message-Id: <20210704230420.1488358-40-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210704230420.1488358-1-sashal@kernel.org> References: <20210704230420.1488358-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Tong Zhang [ Upstream commit a3a54bf4bddaecda8b5767209cfc703f0be2841d ] There is a problem with the tasklet in bt878. bt->tasklet is set by dvb-bt8xx.ko, and bt878.ko can be loaded independently. In this case if interrupt comes it may cause null-ptr-dereference. To solve this issue, we check if the tasklet is actually set before calling tasklet_schedule. [ 1.750438] bt878(0): irq FDSR FBUS risc_pc= [ 1.750728] BUG: kernel NULL pointer dereference, address: 0000000000000000 [ 1.752969] RIP: 0010:0x0 [ 1.757526] Call Trace: [ 1.757659] [ 1.757770] tasklet_action_common.isra.0+0x107/0x110 [ 1.758041] tasklet_action+0x22/0x30 [ 1.758237] __do_softirq+0xe0/0x29b [ 1.758430] irq_exit_rcu+0xa4/0xb0 [ 1.758618] common_interrupt+0x8d/0xa0 [ 1.758824] Signed-off-by: Tong Zhang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab Signed-off-by: Sasha Levin --- drivers/media/pci/bt8xx/bt878.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/media/pci/bt8xx/bt878.c b/drivers/media/pci/bt8xx/bt878.c index 78dd35c9b65d..7ca309121fb5 100644 --- a/drivers/media/pci/bt8xx/bt878.c +++ b/drivers/media/pci/bt8xx/bt878.c @@ -300,7 +300,8 @@ static irqreturn_t bt878_irq(int irq, void *dev_id) } if (astat & BT878_ARISCI) { bt->finished_block = (stat & BT878_ARISCS) >> 28; - tasklet_schedule(&bt->tasklet); + if (bt->tasklet.callback) + tasklet_schedule(&bt->tasklet); break; } count++; -- 2.30.2