From: Andy Shevchenko Date: Wed, 7 Jan 2015 01:53:37 +0000 (-0300) Subject: [media] lirc_dev: avoid potential null-dereference X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3656cddd50018d562d2df87c4698783898732914;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git [media] lirc_dev: avoid potential null-dereference We have to check pointer for NULL and then dereference it. Signed-off-by: Andy Shevchenko Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c index 1e0545a67959..4de0e85af805 100644 --- a/drivers/media/rc/lirc_dev.c +++ b/drivers/media/rc/lirc_dev.c @@ -553,14 +553,14 @@ unsigned int lirc_dev_fop_poll(struct file *file, poll_table *wait) if (!ir->attached) return POLLERR; - poll_wait(file, &ir->buf->wait_poll, wait); + if (ir->buf) { + poll_wait(file, &ir->buf->wait_poll, wait); - if (ir->buf) if (lirc_buffer_empty(ir->buf)) ret = 0; else ret = POLLIN | POLLRDNORM; - else + } else ret = POLLERR; dev_dbg(ir->d.dev, LOGHEAD "poll result = %d\n",