Bug 16473 (mantis-oops)

Summary: mantis driver: Oops: BUG: unable to handle kernel NULL pointer dereference
Product: v4l-dvb Reporter: Ronny (bRainKiller_01)
Component: dvb-otherAssignee: Alan (alan)
Status: RESOLVED CODE_FIX    
Severity: high CC: alan, florian, idl0r
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 2.6.34.1 Subsystem:
Regression: No Bisected commit-id:
Attachments: complete trace log
check for null pointer before calling dvb_unregister_frontend or dvb_frontend_detach

Description Ronny 2010-07-27 19:21:24 UTC
Created attachment 27275 [details]
complete trace log

I tried to load the mantis module but I guess had some required frontend modules disabled. The mantis module could not be loaded and it failed with a null pointer exception.

Jun 30 21:33:24 [kernel] BUG: unable to handle kernel NULL pointer dereference at 0000000000000308
Jun 30 21:33:24 [kernel] IP: [<ffffffff81447ccf>] dvb_unregister_frontend+0xf/0x100
Jun 30 21:33:24 [kernel] PGD 22d13b067 PUD 22c938067 PMD 0
Comment 1 Ronny 2010-07-27 19:26:15 UTC
Created attachment 27276 [details]
check for null pointer before calling dvb_unregister_frontend or dvb_frontend_detach

well, a quick patch

IMHO, it would be much better if dvb_frontend_detach, dvb_unregister_frontend and so forth perform a NULL-check instead of blindly accessing a class member.
Comment 2 Christian Ruppert 2010-10-21 15:00:34 UTC
I can reproduce it here with 2.6.{34,35,36}.

CONFIG_MEDIA_SUPPORT=y
CONFIG_VIDEO_DEV=y
CONFIG_DVB_CORE=y
CONFIG_MEDIA_ATTACH=y

CONFIG_MANTIS_CORE=m
CONFIG_DVB_MANTIS=m
CONFIG_DVB_FE_CUSTOMISE=y
CONFIG_DVB_TDA10023=m
and CONFIG_DVB_PLL=y (Auto selected)

modprobe mantis and it will fail.
It doesn't fail if CONFIG_DVB_TDA10023=y.
Comment 3 Florian Mickler 2012-10-15 21:19:59 UTC
A patch referencing this bug report has been merged in Linux v3.7-rc1:

commit e1d45ae10aea8e8a403e5d96bf5902ee670007ff
Author: Alan Cox <alan@linux.intel.com>
Date:   Thu Aug 9 12:33:52 2012 -0300

    [media] mantis: fix silly crash case