Linux Media Controller development
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: linux-media@vger.kernel.org
Cc: abraham.manu@gmail.com
Subject: bug report: null dereference in error handling in mantis_dvb_init()
Date: Thu, 17 May 2012 10:10:51 +0300	[thread overview]
Message-ID: <20120517071051.GF14660@elgon.mountain> (raw)

Hi,

I'm working on some new Smatch stuff and so I'm finding old bugs and
emailing bug reports.

----
This is a semi-automatic email about new static checker warnings.

The patch 68fe255cd15c: "V4L/DVB (13799): [Mantis] Unregister 
frontend" from Dec 4, 2009, leads to the following Smatch complaint:

drivers/media/dvb/mantis/mantis_dvb.c:251 mantis_dvb_init()
	 error: we previously assumed 'mantis->fe' could be null (see line 228)

drivers/media/dvb/mantis/mantis_dvb.c
   227			} else {
   228				if (mantis->fe == NULL) {
   229					dprintk(MANTIS_ERROR, 1, "FE <NULL>");
   230					goto err5;

"mantis->fe" is NULL on this path.

   231				}
   232	
   233				if (dvb_register_frontend(&mantis->dvb_adapter, mantis->fe)) {
   234					dprintk(MANTIS_ERROR, 1, "ERROR: Frontend registration failed");
   235	
   236					if (mantis->fe->ops.release)
   237						mantis->fe->ops.release(mantis->fe);
   238	
   239					mantis->fe = NULL;

And here.

   240					goto err5;
   241				}
   242			}
   243		}
   244	
   245		return 0;
   246	
   247		/* Error conditions ..	*/
   248	err5:
   249		tasklet_kill(&mantis->tasklet);
   250		dvb_net_release(&mantis->dvbnet);
   251		dvb_unregister_frontend(mantis->fe);
                ^^^^^^^^^^^^^^^^^^^^^^^
This new call to dvb_unregister_frontend() was added but it can't handle
NULL pointers.

   252		dvb_frontend_detach(mantis->fe);
   253	err4:

regards,
dan carpenter


                 reply	other threads:[~2012-05-17  7:10 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=20120517071051.GF14660@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=abraham.manu@gmail.com \
    --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