From: Greg KH <gregkh@linuxfoundation.org>
To: Mathieu Poirier <mathieu.poirier@linaro.org>
Cc: linux-arm-kernel <linux-arm-kernel@lists.infradead.org>
Subject: Re: [PATCH 26/28] coresight: tmc: Smatch: Fix potential NULL pointer dereference
Date: Fri, 21 Jun 2019 08:59:22 +0200 [thread overview]
Message-ID: <20190621065922.GB14945@kroah.com> (raw)
In-Reply-To: <CANLsYkysqjzkBWRUeWrBmves2D-H3Sb=PoYr1VD3B9i7kXO8tg@mail.gmail.com>
On Thu, Jun 20, 2019 at 03:42:18PM -0600, Mathieu Poirier wrote:
> On Thu, 20 Jun 2019 at 00:05, Greg KH <gregkh@linuxfoundation.org> wrote:
> >
> > On Wed, Jun 19, 2019 at 01:53:16PM -0600, Mathieu Poirier wrote:
> > > From: Suzuki K Poulose <suzuki.poulose@arm.com>
> > >
> > > Based on the following report from Smatch, fix the potential
> > > NULL pointer dereference check.
> > >
> > > The patch 743256e214e8: "coresight: tmc: Clean up device specific
> > > data" from May 22, 2019, leads to the following Smatch complaint:
> > >
> > > drivers/hwtracing/coresight/coresight-tmc-etr.c:625 tmc_etr_free_flat_buf()
> > > warn: variable dereferenced before check 'flat_buf' (see line 623)
> > >
> > > drivers/hwtracing/coresight/coresight-tmc-etr.c
> > > 622 struct etr_flat_buf *flat_buf = etr_buf->private;
> > > 623 struct device *real_dev = flat_buf->dev->parent;
> > > ^^^^^^^^^^
> > > The patch introduces a new NULL check
> > >
> > > 624
> > > 625 if (flat_buf && flat_buf->daddr)
> > > ^^^^^^^^
> > > but the existing code assumed it can be NULL.
> > >
> > > 626 dma_free_coherent(real_dev, flat_buf->size,
> > > 627 flat_buf->vaddr, flat_buf->daddr);
> > >
> > > Cc: Dan Carpenter <dan.carpenter@oracle.com>
> > > Cc: Mathieu Poirier <mathieu.poirier@linaro.org>
> > > Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> > > Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
> > > ---
> > > drivers/hwtracing/coresight/coresight-tmc-etr.c | 6 ++++--
> > > 1 file changed, 4 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/drivers/hwtracing/coresight/coresight-tmc-etr.c b/drivers/hwtracing/coresight/coresight-tmc-etr.c
> > > index 5d2bf6d18961..17006705287a 100644
> > > --- a/drivers/hwtracing/coresight/coresight-tmc-etr.c
> > > +++ b/drivers/hwtracing/coresight/coresight-tmc-etr.c
> > > @@ -620,11 +620,13 @@ static int tmc_etr_alloc_flat_buf(struct tmc_drvdata *drvdata,
> > > static void tmc_etr_free_flat_buf(struct etr_buf *etr_buf)
> > > {
> > > struct etr_flat_buf *flat_buf = etr_buf->private;
> > > - struct device *real_dev = flat_buf->dev->parent;
> > >
> > > - if (flat_buf && flat_buf->daddr)
> > > + if (flat_buf && flat_buf->daddr) {
> > > + struct device *real_dev = flat_buf->dev->parent;
> > > +
> > > dma_free_coherent(real_dev, flat_buf->size,
> > > flat_buf->vaddr, flat_buf->daddr);
> > > + }
> > > kfree(flat_buf);
> > > }
> > >
> > > --
> > > 2.17.1
> > >
> >
> > Again, 5.2-final and stable...
>
> So is this one, if addresses a deficiency introduced in patch 8/45
> [1]. I have a new set ready for the other ones you flagged.
Ok, can you please resend?
thanks,
greg k-h
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-06-21 7:00 UTC|newest]
Thread overview: 41+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-19 19:52 [PATCH 00/28] coresight: next v5.2-rc5 (V2) Mathieu Poirier
2019-06-19 19:52 ` [PATCH 01/28] coresight: Rename of_coresight to coresight-platform Mathieu Poirier
2019-06-19 19:52 ` [PATCH 02/28] coresight: platform: Make memory allocation helper generic Mathieu Poirier
2019-06-19 19:52 ` [PATCH 03/28] coresight: Make sure device uses DT for obsolete compatible check Mathieu Poirier
2019-06-19 19:52 ` [PATCH 04/28] coresight: Introduce generic platform data helper Mathieu Poirier
2019-06-19 19:52 ` [PATCH 05/28] coresight: Make device to CPU mapping generic Mathieu Poirier
2019-06-19 19:52 ` [PATCH 06/28] coresight: Remove cpu field from platform data Mathieu Poirier
2019-06-19 19:52 ` [PATCH 07/28] coresight: Remove name from platform description Mathieu Poirier
2019-06-19 19:52 ` [PATCH 08/28] coresight: Cleanup coresight_remove_conns Mathieu Poirier
2019-06-19 19:52 ` [PATCH 09/28] coresight: Reuse platform data structure for connection tracking Mathieu Poirier
2019-06-19 19:53 ` [PATCH 10/28] coresight: Rearrange platform data probing Mathieu Poirier
2019-06-19 19:53 ` [PATCH 11/28] coresight: Add support for releasing platform specific data Mathieu Poirier
2019-06-19 19:53 ` [PATCH 12/28] coresight: platform: Use fwnode handle for device search Mathieu Poirier
2019-06-19 19:53 ` [PATCH 13/28] coresight: Use fwnode handle instead of device names Mathieu Poirier
2019-06-19 19:53 ` [PATCH 14/28] coresight: Use platform agnostic names Mathieu Poirier
2019-06-19 19:53 ` [PATCH 15/28] coresight: stm: ACPI support for parsing stimulus base Mathieu Poirier
2019-06-19 19:53 ` [PATCH 16/28] coresight: Support for ACPI bindings Mathieu Poirier
2019-06-19 19:53 ` [PATCH 17/28] coresight: acpi: Support for AMBA components Mathieu Poirier
2019-06-19 19:53 ` [PATCH 18/28] coresight: acpi: Support for platform devices Mathieu Poirier
2019-06-19 19:53 ` [PATCH 19/28] coresight: Add dummy definition for of_coresight_get_cpu() Mathieu Poirier
2019-06-19 19:53 ` [PATCH 20/28] coresight: tmc-etr: Do not call smp_processor_id() from preemptible Mathieu Poirier
2019-06-20 6:02 ` Greg KH
2019-06-19 19:53 ` [PATCH 21/28] coresight: tmc-etr: alloc_perf_buf: Do not call smp_processor_id " Mathieu Poirier
2019-06-20 6:03 ` Greg KH
2019-06-19 19:53 ` [PATCH 22/28] coresight: tmc-etf: " Mathieu Poirier
2019-06-20 6:03 ` Greg KH
2019-06-19 19:53 ` [PATCH 23/28] coresight: etb10: " Mathieu Poirier
2019-06-20 6:04 ` Greg KH
2019-06-19 19:53 ` [PATCH 24/28] coresight: Potential uninitialized variable in probe() Mathieu Poirier
2019-06-20 6:04 ` Greg KH
2019-06-19 19:53 ` [PATCH 25/28] coresight: etm3x: Smatch: Fix potential NULL pointer dereference Mathieu Poirier
2019-06-20 6:04 ` Greg KH
2019-06-20 21:38 ` Mathieu Poirier
2019-06-21 6:59 ` Greg KH
2019-06-19 19:53 ` [PATCH 26/28] coresight: tmc: " Mathieu Poirier
2019-06-20 6:05 ` Greg KH
2019-06-20 21:42 ` Mathieu Poirier
2019-06-21 6:59 ` Greg KH [this message]
2019-06-19 19:53 ` [PATCH 27/28] coresight: platform: add OF/APCI dependency Mathieu Poirier
2019-06-19 19:53 ` [PATCH 28/28] coresight: replicator: Add terminate entry for acpi_device_id tables Mathieu Poirier
2019-06-20 6:08 ` [PATCH 00/28] coresight: next v5.2-rc5 (V2) Greg KH
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=20190621065922.GB14945@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mathieu.poirier@linaro.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).