netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* pull-request: can 2012-08-24
@ 2012-08-24  9:30 Marc Kleine-Budde
  2012-08-24  9:30 ` [PATCH 1/2] can: softing: Fix potential memory leak in softing_load_fw() Marc Kleine-Budde
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2012-08-24  9:30 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-can

Hello David,

here are two fixes for the v3.6 release cycle. Alexey Khoroshilov submitted a
fix for a memory leak in the softing driver (in softing_load_fw()) in case a
krealloc() fails. Sven Schmitt fixed the misuse of the IRQF_SHARED flag in the
irq resouce of the sja1000 platform driver, now the correct flag is used. There
are no mainline users of this feature which need to be converted.

regards, Marc


The following changes since commit a0dfb2634e5671770f598cda08002d8cda66ac77:

  af_packet: match_fanout_group() can be static (2012-08-23 09:27:12 -0700)

are available in the git repository at:

  git://gitorious.org/linux-can/linux-can.git fixes-for-3.6

for you to fetch changes up to da3d50ef308d53f216f1f92f4971f245c13e9f65:

  can: sja1000_platform: fix wrong flag IRQF_SHARED for interrupt sharing (2012-08-24 10:54:05 +0200)

----------------------------------------------------------------
Alexey Khoroshilov (1):
      can: softing: Fix potential memory leak in softing_load_fw()

Sven Schmitt (1):
      can: sja1000_platform: fix wrong flag IRQF_SHARED for interrupt sharing

 drivers/net/can/sja1000/sja1000_platform.c |    4 +++-
 drivers/net/can/softing/softing_fw.c       |    7 ++++---
 2 files changed, 7 insertions(+), 4 deletions(-)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] can: softing: Fix potential memory leak in softing_load_fw()
  2012-08-24  9:30 pull-request: can 2012-08-24 Marc Kleine-Budde
@ 2012-08-24  9:30 ` Marc Kleine-Budde
  2012-08-24  9:30 ` [PATCH 2/2] can: sja1000_platform: fix wrong flag IRQF_SHARED for interrupt sharing Marc Kleine-Budde
  2012-08-24 19:21 ` pull-request: can 2012-08-24 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2012-08-24  9:30 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-can, Alexey Khoroshilov, Marc Kleine-Budde

From: Alexey Khoroshilov <khoroshilov@ispras.ru>

Do not leak memory by updating pointer with potentially NULL realloc return value.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/softing/softing_fw.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/can/softing/softing_fw.c b/drivers/net/can/softing/softing_fw.c
index 3105961..b595d34 100644
--- a/drivers/net/can/softing/softing_fw.c
+++ b/drivers/net/can/softing/softing_fw.c
@@ -150,7 +150,7 @@ int softing_load_fw(const char *file, struct softing *card,
 	const uint8_t *mem, *end, *dat;
 	uint16_t type, len;
 	uint32_t addr;
-	uint8_t *buf = NULL;
+	uint8_t *buf = NULL, *new_buf;
 	int buflen = 0;
 	int8_t type_end = 0;
 
@@ -199,11 +199,12 @@ int softing_load_fw(const char *file, struct softing *card,
 		if (len > buflen) {
 			/* align buflen */
 			buflen = (len + (1024-1)) & ~(1024-1);
-			buf = krealloc(buf, buflen, GFP_KERNEL);
-			if (!buf) {
+			new_buf = krealloc(buf, buflen, GFP_KERNEL);
+			if (!new_buf) {
 				ret = -ENOMEM;
 				goto failed;
 			}
+			buf = new_buf;
 		}
 		/* verify record data */
 		memcpy_fromio(buf, &dpram[addr + offset], len);
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] can: sja1000_platform: fix wrong flag IRQF_SHARED for interrupt sharing
  2012-08-24  9:30 pull-request: can 2012-08-24 Marc Kleine-Budde
  2012-08-24  9:30 ` [PATCH 1/2] can: softing: Fix potential memory leak in softing_load_fw() Marc Kleine-Budde
@ 2012-08-24  9:30 ` Marc Kleine-Budde
  2012-08-24 19:21 ` pull-request: can 2012-08-24 David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: Marc Kleine-Budde @ 2012-08-24  9:30 UTC (permalink / raw)
  To: davem; +Cc: netdev, linux-can, Sven Schmitt, Marc Kleine-Budde

From: Sven Schmitt <sven.schmitt@volkswagen.de>

The sja1000 platform driver wrongly assumes that a shared IRQ is indicated
with the IRQF_SHARED flag in irq resource flags. This patch changes the
driver to handle the correct flag IORESOURCE_IRQ_SHAREABLE instead.

There are no mainline users of the platform driver which wrongly make use
of IRQF_SHARED.

Signed-off-by: Sven Schmitt <sven.schmitt@volkswagen.de>
Acked-by: Yegor Yefremov <yegorslists@googlemail.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/sja1000/sja1000_platform.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/can/sja1000/sja1000_platform.c b/drivers/net/can/sja1000/sja1000_platform.c
index 4f50145..662c5f7 100644
--- a/drivers/net/can/sja1000/sja1000_platform.c
+++ b/drivers/net/can/sja1000/sja1000_platform.c
@@ -109,7 +109,9 @@ static int sp_probe(struct platform_device *pdev)
 	priv = netdev_priv(dev);
 
 	dev->irq = res_irq->start;
-	priv->irq_flags = res_irq->flags & (IRQF_TRIGGER_MASK | IRQF_SHARED);
+	priv->irq_flags = res_irq->flags & IRQF_TRIGGER_MASK;
+	if (res_irq->flags & IORESOURCE_IRQ_SHAREABLE)
+		priv->irq_flags |= IRQF_SHARED;
 	priv->reg_base = addr;
 	/* The CAN clock frequency is half the oscillator clock frequency */
 	priv->can.clock.freq = pdata->osc_freq / 2;
-- 
1.7.10


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: pull-request: can 2012-08-24
  2012-08-24  9:30 pull-request: can 2012-08-24 Marc Kleine-Budde
  2012-08-24  9:30 ` [PATCH 1/2] can: softing: Fix potential memory leak in softing_load_fw() Marc Kleine-Budde
  2012-08-24  9:30 ` [PATCH 2/2] can: sja1000_platform: fix wrong flag IRQF_SHARED for interrupt sharing Marc Kleine-Budde
@ 2012-08-24 19:21 ` David Miller
  2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2012-08-24 19:21 UTC (permalink / raw)
  To: mkl; +Cc: netdev, linux-can

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: Fri, 24 Aug 2012 11:30:41 +0200

> here are two fixes for the v3.6 release cycle. Alexey Khoroshilov submitted a
> fix for a memory leak in the softing driver (in softing_load_fw()) in case a
> krealloc() fails. Sven Schmitt fixed the misuse of the IRQF_SHARED flag in the
> irq resouce of the sja1000 platform driver, now the correct flag is used. There
> are no mainline users of this feature which need to be converted.

Pulled, thanks Marc.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-08-24 19:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-24  9:30 pull-request: can 2012-08-24 Marc Kleine-Budde
2012-08-24  9:30 ` [PATCH 1/2] can: softing: Fix potential memory leak in softing_load_fw() Marc Kleine-Budde
2012-08-24  9:30 ` [PATCH 2/2] can: sja1000_platform: fix wrong flag IRQF_SHARED for interrupt sharing Marc Kleine-Budde
2012-08-24 19:21 ` pull-request: can 2012-08-24 David Miller

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).