From: Jean Delvare <khali@linux-fr.org>
To: Takashi Iwai <tiwai@suse.de>
Cc: linuxppc-dev@ozlabs.org,
Johannes Berg <johannes@sipsolutions.net>,
Tim Shepard <shep@alum.mit.edu>,
alsa-devel@alsa-project.org
Subject: Re: [PATCH] sound: Don't assume i2c device probing always succeeds
Date: Wed, 30 Sep 2009 17:00:06 +0200 [thread overview]
Message-ID: <20090930170006.76e145ca@hyperion.delvare> (raw)
In-Reply-To: <s5hbpksy0yq.wl%tiwai@suse.de>
Hi Takashi,
Thanks for the swift reply.
On Wed, 30 Sep 2009 16:13:49 +0200, Takashi Iwai wrote:
> At Wed, 30 Sep 2009 15:25:42 +0200,
> Jean Delvare wrote:
> >
> > If i2c device probing fails, then there is no driver to dereference
> > after calling i2c_new_device(). Stop assuming that probing will always
> > succeed, to avoid NULL pointer dereferences. We have an easier access
> > to the driver anyway.
> >
> > Reported-by: Tim Shepard <shep@alum.mit.edu>
> > Signed-off-by: Jean Delvare <khali@linux-fr.org>
> > Cc: Johannes Berg <johannes@sipsolutions.net>
> > ---
> > The code is similar to the one in therm_adt746x, for which Tim reported
> > a real-world oops, so it should be fixed ASAP.
>
> Jean, thanks for the patch.
>
> I'm just wondering whether the additional NULL check of client->driver
> would be enough? If yes, sound/aoa/onyx.c has it, at least, and we
> can add the similar checks to the rest, too.
The NULL check of client->driver, if followed by a call to
i2c_unregister_device(), would indeed be enough. But unlike the onyx
driver which we know we sometimes load erroneously, the other drivers
should never fail. I am reluctant to add code to handle error cases
which are not supposed to happen, which is why I prefer my proposed
fix: it does not add code.
That being said, I will be happy with any solution that fixes the
problem, so if you prefer client->driver NULL checks, I can send a
patch doing this.
Thanks,
--
Jean Delvare
WARNING: multiple messages have this Message-ID (diff)
From: Jean Delvare <khali@linux-fr.org>
To: Takashi Iwai <tiwai@suse.de>
Cc: linuxppc-dev@ozlabs.org,
Johannes Berg <johannes@sipsolutions.net>,
Tim Shepard <shep@alum.mit.edu>,
alsa-devel@alsa-project.org, Jaroslav Kysela <perex@perex.cz>
Subject: Re: [PATCH] sound: Don't assume i2c device probing always succeeds
Date: Wed, 30 Sep 2009 17:00:06 +0200 [thread overview]
Message-ID: <20090930170006.76e145ca@hyperion.delvare> (raw)
In-Reply-To: <s5hbpksy0yq.wl%tiwai@suse.de>
Hi Takashi,
Thanks for the swift reply.
On Wed, 30 Sep 2009 16:13:49 +0200, Takashi Iwai wrote:
> At Wed, 30 Sep 2009 15:25:42 +0200,
> Jean Delvare wrote:
> >
> > If i2c device probing fails, then there is no driver to dereference
> > after calling i2c_new_device(). Stop assuming that probing will always
> > succeed, to avoid NULL pointer dereferences. We have an easier access
> > to the driver anyway.
> >
> > Reported-by: Tim Shepard <shep@alum.mit.edu>
> > Signed-off-by: Jean Delvare <khali@linux-fr.org>
> > Cc: Johannes Berg <johannes@sipsolutions.net>
> > ---
> > The code is similar to the one in therm_adt746x, for which Tim reported
> > a real-world oops, so it should be fixed ASAP.
>
> Jean, thanks for the patch.
>
> I'm just wondering whether the additional NULL check of client->driver
> would be enough? If yes, sound/aoa/onyx.c has it, at least, and we
> can add the similar checks to the rest, too.
The NULL check of client->driver, if followed by a call to
i2c_unregister_device(), would indeed be enough. But unlike the onyx
driver which we know we sometimes load erroneously, the other drivers
should never fail. I am reluctant to add code to handle error cases
which are not supposed to happen, which is why I prefer my proposed
fix: it does not add code.
That being said, I will be happy with any solution that fixes the
problem, so if you prefer client->driver NULL checks, I can send a
patch doing this.
Thanks,
--
Jean Delvare
next prev parent reply other threads:[~2009-09-30 15:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-30 13:25 [PATCH] sound: Don't assume i2c device probing always succeeds Jean Delvare
2009-09-30 14:13 ` Takashi Iwai
2009-09-30 14:13 ` Takashi Iwai
2009-09-30 15:00 ` Jean Delvare [this message]
2009-09-30 15:00 ` Jean Delvare
2009-09-30 15:05 ` Johannes Berg
2009-09-30 15:05 ` Johannes Berg
2009-09-30 15:57 ` Jean Delvare
2009-09-30 15:57 ` Jean Delvare
2009-09-30 15:15 ` Takashi Iwai
2009-09-30 15:15 ` Takashi Iwai
2009-09-30 16:55 ` Jean Delvare
2009-09-30 16:55 ` Jean Delvare
2009-10-01 6:52 ` Takashi Iwai
2009-10-01 6:52 ` Takashi Iwai
2009-10-04 9:35 ` Jean Delvare
2009-10-05 5:30 ` Takashi Iwai
2009-10-05 5:30 ` Takashi Iwai
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=20090930170006.76e145ca@hyperion.delvare \
--to=khali@linux-fr.org \
--cc=alsa-devel@alsa-project.org \
--cc=johannes@sipsolutions.net \
--cc=linuxppc-dev@ozlabs.org \
--cc=shep@alum.mit.edu \
--cc=tiwai@suse.de \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.