public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Walker <dwalker@fifo99.com>
To: Luca Olivetti <luca@ventoso.org>
Cc: Ingo Molnar <mingo@elte.hu>, Greg KH <gregkh@suse.de>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	linux-kernel@vger.kernel.org, Hans Verkuil <hverkuil@xs4all.nl>,
	Janne Grunau <janne-dvb@grunau.be>
Subject: Re: [crash] af9005_usb_module_init(): BUG: unable to handle kernel paging request at ff100000
Date: Tue, 03 Feb 2009 17:14:40 -0800	[thread overview]
Message-ID: <1233710080.15119.37.camel@desktop> (raw)
In-Reply-To: <4988ABEE.6020703@ventoso.org>

On Tue, 2009-02-03 at 21:41 +0100, Luca Olivetti wrote:

> No, I don't have 2.6.28, but I guess that maybe once usb_register is
> called the dvb-usb subsystem asynchronously (is that an smp system?)
> starts polling the remote before the rc_decode function pointer has been
> initialized.
> Could you try to initialize it to NULL before calling usb_register?

What happens to the decode function when you have,

CONFIG_DVB_USB_AF9005=y
CONFIG_DVB_USB_AF9005_REMOTE=n

It seems that the decode function is defined inside,
drivers/media/dvb/dvb-usb/af9005-remote.c

but that doesn't get compiled in the case above. It looks like you end
up with af9005_rc_decode being a function local weak symbol
(uninitialized) which then gets assigned to rc_decode .. I think the
crash actually happens on rc_keys_size which get assigned another
uninitialized local, and it gets de-referenced .

Here's a patch I compile tested, and I think it would fix the issue.

--

The Afatech AF9005 uses some functions and variables from the optional
remote code. If the remote code is disabled it's possible the kernel
could crash while access the missing variables. This patch adds ifdefs
to remove any usage of the remote variables when the remote isn't
compiled.

Signed-off-by: Daniel Walker <dwalker@fifo99.com>

diff --git a/drivers/media/dvb/dvb-usb/af9005.c b/drivers/media/dvb/dvb-usb/af9005.c
index ca5a0a4..69b9b1b 100644
--- a/drivers/media/dvb/dvb-usb/af9005.c
+++ b/drivers/media/dvb/dvb-usb/af9005.c
@@ -41,11 +41,17 @@ MODULE_PARM_DESC(dump_eeprom, "dump contents of the eeprom.");
 
 DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
 
+#ifdef CONFIG_DVB_USB_AF9005_REMOTE
 /* remote control decoder */
 static int (*rc_decode) (struct dvb_usb_device *d, u8 *data, int len,
 		u32 *event, int *state);
 static void *rc_keys;
 static int *rc_keys_size;
+#else
+static inline int
+rc_decode(struct dvb_usb_device *d, u8 *data,
+	int len, u32 *event, int *state) { return 0; }
+#endif
 
 u8 regmask[8] = { 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff };
 
@@ -1108,6 +1114,7 @@ static int __init af9005_usb_module_init(void)
 		err("usb_register failed. (%d)", result);
 		return result;
 	}
+#ifdef CONFIG_DVB_USB_AF9005_REMOTE
 	rc_decode = symbol_request(af9005_rc_decode);
 	rc_keys = symbol_request(af9005_rc_keys);
 	rc_keys_size = symbol_request(af9005_rc_keys_size);
@@ -1118,12 +1125,15 @@ static int __init af9005_usb_module_init(void)
 		af9005_properties.rc_key_map = rc_keys;
 		af9005_properties.rc_key_map_size = *rc_keys_size;
 	}
-
+#else
+	af9005_properties.rc_query = NULL;
+#endif
 	return 0;
 }
 
 static void __exit af9005_usb_module_exit(void)
 {
+#ifdef CONFIG_DVB_USB_AF9005_REMOTE 
 	/* release rc decode symbols */
 	if (rc_decode != NULL)
 		symbol_put(af9005_rc_decode);
@@ -1131,6 +1141,7 @@ static void __exit af9005_usb_module_exit(void)
 		symbol_put(af9005_rc_keys);
 	if (rc_keys_size != NULL)
 		symbol_put(af9005_rc_keys_size);
+#endif
 	/* deregister this driver from the USB subsystem */
 	usb_deregister(&af9005_usb_driver);
 }





  parent reply	other threads:[~2009-02-04  1:14 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-03 17:28 [crash] af9005_usb_module_init(): BUG: unable to handle kernel paging request at ff100000 Ingo Molnar
2009-02-03 17:45 ` Arjan van de Ven
2009-02-03 18:22 ` Daniel Walker
2009-02-03 19:30   ` Ingo Molnar
2009-02-03 20:41     ` Luca Olivetti
2009-02-03 21:18       ` Luca Olivetti
2009-02-03 21:32       ` Ingo Molnar
2009-02-04  1:14       ` Daniel Walker [this message]
2009-02-04 14:52         ` Luca Olivetti
2009-02-04 15:16           ` Daniel Walker
2009-02-04 15:49             ` Luca Olivetti
2009-02-04 16:12               ` Daniel Walker
2009-02-04 18:12                 ` Luca Olivetti
2009-02-04 18:30 ` Daniel Walker
2009-02-04 18:41   ` Luca Olivetti
2009-02-04 19:27     ` Daniel Walker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1233710080.15119.37.camel@desktop \
    --to=dwalker@fifo99.com \
    --cc=gregkh@suse.de \
    --cc=hverkuil@xs4all.nl \
    --cc=janne-dvb@grunau.be \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luca@ventoso.org \
    --cc=mchehab@infradead.org \
    --cc=mingo@elte.hu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox