linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Nibble Max" <nibble.max@gmail.com>
To: "Antti Palosaari" <crope@iki.fi>
Cc: "linux-media" <linux-media@vger.kernel.org>
Subject: [PATCH 1/1] m88ts2022: return the err code in its probe function when error occurs.
Date: Thu, 23 Oct 2014 21:36:49 +0800	[thread overview]
Message-ID: <201410232136466253099@gmail.com> (raw)

if "chip_id" is wrong or "dev->cfg.clock_out" is invalid, the i2c model is still loaded.
It will cause "kernel NULL pointer dereference" oops when the i2c model remove.
returning the err code will prevent the i2c model load. 

Signed-off-by: Nibble Max <nibble.max@gmail.com>
---
 drivers/media/tuners/m88ts2022.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/tuners/m88ts2022.c b/drivers/media/tuners/m88ts2022.c
index caa5423..066e543 100644
--- a/drivers/media/tuners/m88ts2022.c
+++ b/drivers/media/tuners/m88ts2022.c
@@ -488,6 +488,7 @@ static int m88ts2022_probe(struct i2c_client *client,
 	case 0x83:
 		break;
 	default:
+		ret = -ENODEV;
 		goto err;
 	}
 
@@ -505,6 +506,7 @@ static int m88ts2022_probe(struct i2c_client *client,
 		u8tmp = 0x6c;
 		break;
 	default:
+		ret = -EINVAL;
 		goto err;
 	}
 
-- 
1.9.1


                 reply	other threads:[~2014-10-23 13:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=201410232136466253099@gmail.com \
    --to=nibble.max@gmail.com \
    --cc=crope@iki.fi \
    --cc=linux-media@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).