linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/5] BLOCK: rbd, return proper error from rbd_dev_probe_update_spec
@ 2013-04-04 20:32 Jiri Slaby
  2013-04-04 20:32 ` [PATCH 2/5] MEDIA: ttusbir, fix double free Jiri Slaby
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Jiri Slaby @ 2013-04-04 20:32 UTC (permalink / raw)
  To: jirislaby; +Cc: linux-kernel

ret might be uninitialized and is returned that way when kstrdup of
rbd_dev->spec->snap_name fails. Fix it by returning ENOMEM from that
place.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/block/rbd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index 6b2b039..3417f34 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -3113,8 +3113,10 @@ static int rbd_dev_probe_update_spec(struct rbd_device *rbd_dev)
 		goto out_err;
 	}
 	rbd_dev->spec->snap_name = kstrdup(name, GFP_KERNEL);
-	if(!rbd_dev->spec->snap_name)
+	if(!rbd_dev->spec->snap_name) {
+		ret = -ENOMEM;
 		goto out_err;
+	}
 
 	return 0;
 out_err:
-- 
1.8.2



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

* [PATCH 2/5] MEDIA: ttusbir, fix double free
  2013-04-04 20:32 [PATCH 1/5] BLOCK: rbd, return proper error from rbd_dev_probe_update_spec Jiri Slaby
@ 2013-04-04 20:32 ` Jiri Slaby
  2013-04-09 10:36   ` Sean Young
  2013-04-04 20:32 ` [PATCH 3/5] SOUND: hda_generic, fix uninitialized variable Jiri Slaby
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Jiri Slaby @ 2013-04-04 20:32 UTC (permalink / raw)
  To: jirislaby; +Cc: linux-kernel, Sean Young, Mauro Carvalho Chehab, linux-media

rc_unregister_device already calls rc_free_device to free the passed
device. But in one of ttusbir's probe fail paths, we call
rc_unregister_device _and_ rc_free_device. This is wrong and results
in a double free.

Instead, set rc to NULL resulting in rc_free_device being a noop.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Sean Young <sean@mess.org>
Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
Cc: linux-media@vger.kernel.org
---
 drivers/media/rc/ttusbir.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c
index cf0d47f..891762d 100644
--- a/drivers/media/rc/ttusbir.c
+++ b/drivers/media/rc/ttusbir.c
@@ -347,6 +347,7 @@ static int ttusbir_probe(struct usb_interface *intf,
 	return 0;
 out3:
 	rc_unregister_device(rc);
+	rc = NULL;
 out2:
 	led_classdev_unregister(&tt->led);
 out:
-- 
1.8.2



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

* [PATCH 3/5] SOUND: hda_generic, fix uninitialized variable
  2013-04-04 20:32 [PATCH 1/5] BLOCK: rbd, return proper error from rbd_dev_probe_update_spec Jiri Slaby
  2013-04-04 20:32 ` [PATCH 2/5] MEDIA: ttusbir, fix double free Jiri Slaby
@ 2013-04-04 20:32 ` Jiri Slaby
  2013-04-05  5:20   ` Takashi Iwai
  2013-04-04 20:32 ` [PATCH 4/5] X86: boot, close opened descriptor Jiri Slaby
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Jiri Slaby @ 2013-04-04 20:32 UTC (permalink / raw)
  To: jirislaby; +Cc: linux-kernel, Jaroslav Kysela, Takashi Iwai

changed is not initialized in path_power_down_sync, but it is expected
to be false in case no change happened in the loop. So set it to
false.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/hda_generic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index f0a422f..8299e40 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -751,7 +751,7 @@ EXPORT_SYMBOL_HDA(snd_hda_activate_path);
 static void path_power_down_sync(struct hda_codec *codec, struct nid_path *path)
 {
 	struct hda_gen_spec *spec = codec->spec;
-	bool changed;
+	bool changed = false;
 	int i;
 
 	if (!spec->power_down_unused || path->active)
-- 
1.8.2



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

* [PATCH 4/5] X86: boot, close opened descriptor
  2013-04-04 20:32 [PATCH 1/5] BLOCK: rbd, return proper error from rbd_dev_probe_update_spec Jiri Slaby
  2013-04-04 20:32 ` [PATCH 2/5] MEDIA: ttusbir, fix double free Jiri Slaby
  2013-04-04 20:32 ` [PATCH 3/5] SOUND: hda_generic, fix uninitialized variable Jiri Slaby
@ 2013-04-04 20:32 ` Jiri Slaby
  2013-04-04 20:32 ` [PATCH 5/5] HID: hid-lenovo-tpkbd, remove doubled hid_get_drvdata Jiri Slaby
  2013-04-04 22:53 ` [PATCH 1/5] BLOCK: rbd, return proper error from rbd_dev_probe_update_spec Nikola Pajkovsky
  4 siblings, 0 replies; 10+ messages in thread
From: Jiri Slaby @ 2013-04-04 20:32 UTC (permalink / raw)
  To: jirislaby; +Cc: linux-kernel, H. Peter Anvin, Thomas Gleixner, Ingo Molnar, x86

In build, we open a file, read that but do not close it. Fix that by
sticking fclose at the right place.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: x86@kernel.org
---
 arch/x86/boot/tools/build.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/boot/tools/build.c b/arch/x86/boot/tools/build.c
index 94c5446..c941d6a 100644
--- a/arch/x86/boot/tools/build.c
+++ b/arch/x86/boot/tools/build.c
@@ -243,6 +243,7 @@ static void parse_zoffset(char *fname)
 	c = fread(buf, 1, sizeof(buf) - 1, file);
 	if (ferror(file))
 		die("read-error on `zoffset.h'");
+	fclose(file);
 	buf[c] = 0;
 
 	p = (char *)buf;
-- 
1.8.2



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

* [PATCH 5/5] HID: hid-lenovo-tpkbd, remove doubled hid_get_drvdata
  2013-04-04 20:32 [PATCH 1/5] BLOCK: rbd, return proper error from rbd_dev_probe_update_spec Jiri Slaby
                   ` (2 preceding siblings ...)
  2013-04-04 20:32 ` [PATCH 4/5] X86: boot, close opened descriptor Jiri Slaby
@ 2013-04-04 20:32 ` Jiri Slaby
  2013-04-04 22:37   ` Jiri Kosina
  2013-04-04 23:05   ` Nikola Pajkovsky
  2013-04-04 22:53 ` [PATCH 1/5] BLOCK: rbd, return proper error from rbd_dev_probe_update_spec Nikola Pajkovsky
  4 siblings, 2 replies; 10+ messages in thread
From: Jiri Slaby @ 2013-04-04 20:32 UTC (permalink / raw)
  To: jirislaby; +Cc: linux-kernel, Jiri Kosina, linux-input

In pointer_press_speed_show, we do
    data_pointer = hid_get_drvdata(hdev);
twice in a row. Remove one of those.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Jiri Kosina <jkosina@suse.cz>
Cc: linux-input@vger.kernel.org
---
 drivers/hid/hid-lenovo-tpkbd.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/hid/hid-lenovo-tpkbd.c b/drivers/hid/hid-lenovo-tpkbd.c
index a0535fd..07837f5 100644
--- a/drivers/hid/hid-lenovo-tpkbd.c
+++ b/drivers/hid/hid-lenovo-tpkbd.c
@@ -228,8 +228,6 @@ static ssize_t pointer_press_speed_show(struct device *dev,
 	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
 	struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev);
 
-	data_pointer = hid_get_drvdata(hdev);
-
 	return snprintf(buf, PAGE_SIZE, "%u\n",
 		data_pointer->press_speed);
 }
-- 
1.8.2



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

* Re: [PATCH 5/5] HID: hid-lenovo-tpkbd, remove doubled hid_get_drvdata
  2013-04-04 20:32 ` [PATCH 5/5] HID: hid-lenovo-tpkbd, remove doubled hid_get_drvdata Jiri Slaby
@ 2013-04-04 22:37   ` Jiri Kosina
  2013-04-04 23:05   ` Nikola Pajkovsky
  1 sibling, 0 replies; 10+ messages in thread
From: Jiri Kosina @ 2013-04-04 22:37 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: jirislaby, linux-kernel, linux-input

On Thu, 4 Apr 2013, Jiri Slaby wrote:

> In pointer_press_speed_show, we do
>     data_pointer = hid_get_drvdata(hdev);
> twice in a row. Remove one of those.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Jiri Kosina <jkosina@suse.cz>
> Cc: linux-input@vger.kernel.org
> ---
>  drivers/hid/hid-lenovo-tpkbd.c | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/drivers/hid/hid-lenovo-tpkbd.c b/drivers/hid/hid-lenovo-tpkbd.c
> index a0535fd..07837f5 100644
> --- a/drivers/hid/hid-lenovo-tpkbd.c
> +++ b/drivers/hid/hid-lenovo-tpkbd.c
> @@ -228,8 +228,6 @@ static ssize_t pointer_press_speed_show(struct device *dev,
>  	struct hid_device *hdev = container_of(dev, struct hid_device, dev);
>  	struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev);
>  
> -	data_pointer = hid_get_drvdata(hdev);
> -

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs

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

* Re: [PATCH 1/5] BLOCK: rbd, return proper error from rbd_dev_probe_update_spec
  2013-04-04 20:32 [PATCH 1/5] BLOCK: rbd, return proper error from rbd_dev_probe_update_spec Jiri Slaby
                   ` (3 preceding siblings ...)
  2013-04-04 20:32 ` [PATCH 5/5] HID: hid-lenovo-tpkbd, remove doubled hid_get_drvdata Jiri Slaby
@ 2013-04-04 22:53 ` Nikola Pajkovsky
  4 siblings, 0 replies; 10+ messages in thread
From: Nikola Pajkovsky @ 2013-04-04 22:53 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: jirislaby, linux-kernel

Jiri Slaby <jslaby@suse.cz> writes:

> ret might be uninitialized and is returned that way when kstrdup of
> rbd_dev->spec->snap_name fails. Fix it by returning ENOMEM from that
> place.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> ---
>  drivers/block/rbd.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)

Acked-by: Nikola Pajkovsky <npajkovs@redhat.com>

-- 
Nikola

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

* Re: [PATCH 5/5] HID: hid-lenovo-tpkbd, remove doubled hid_get_drvdata
  2013-04-04 20:32 ` [PATCH 5/5] HID: hid-lenovo-tpkbd, remove doubled hid_get_drvdata Jiri Slaby
  2013-04-04 22:37   ` Jiri Kosina
@ 2013-04-04 23:05   ` Nikola Pajkovsky
  1 sibling, 0 replies; 10+ messages in thread
From: Nikola Pajkovsky @ 2013-04-04 23:05 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: jirislaby, linux-kernel, Jiri Kosina, linux-input

Jiri Slaby <jslaby@suse.cz> writes:

> In pointer_press_speed_show, we do
>     data_pointer = hid_get_drvdata(hdev);
> twice in a row. Remove one of those.
>
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Jiri Kosina <jkosina@suse.cz>
> Cc: linux-input@vger.kernel.org
> ---
>  drivers/hid/hid-lenovo-tpkbd.c | 2 --
>  1 file changed, 2 deletions(-)

Acked-by: Nikola Pajkovsky <npajkovs@redhat.com>

-- 
Nikola

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

* Re: [PATCH 3/5] SOUND: hda_generic, fix uninitialized variable
  2013-04-04 20:32 ` [PATCH 3/5] SOUND: hda_generic, fix uninitialized variable Jiri Slaby
@ 2013-04-05  5:20   ` Takashi Iwai
  0 siblings, 0 replies; 10+ messages in thread
From: Takashi Iwai @ 2013-04-05  5:20 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: jirislaby, linux-kernel, Jaroslav Kysela

At Thu,  4 Apr 2013 22:32:10 +0200,
Jiri Slaby wrote:
> 
> changed is not initialized in path_power_down_sync, but it is expected
> to be false in case no change happened in the loop. So set it to
> false.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Jaroslav Kysela <perex@perex.cz>
> Cc: Takashi Iwai <tiwai@suse.de>

Thanks, applied.


Takashi

> ---
>  sound/pci/hda/hda_generic.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
> index f0a422f..8299e40 100644
> --- a/sound/pci/hda/hda_generic.c
> +++ b/sound/pci/hda/hda_generic.c
> @@ -751,7 +751,7 @@ EXPORT_SYMBOL_HDA(snd_hda_activate_path);
>  static void path_power_down_sync(struct hda_codec *codec, struct nid_path *path)
>  {
>  	struct hda_gen_spec *spec = codec->spec;
> -	bool changed;
> +	bool changed = false;
>  	int i;
>  
>  	if (!spec->power_down_unused || path->active)
> -- 
> 1.8.2
> 
> 

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

* Re: [PATCH 2/5] MEDIA: ttusbir, fix double free
  2013-04-04 20:32 ` [PATCH 2/5] MEDIA: ttusbir, fix double free Jiri Slaby
@ 2013-04-09 10:36   ` Sean Young
  0 siblings, 0 replies; 10+ messages in thread
From: Sean Young @ 2013-04-09 10:36 UTC (permalink / raw)
  To: Jiri Slaby; +Cc: jirislaby, linux-kernel, Mauro Carvalho Chehab, linux-media

On Thu, Apr 04, 2013 at 10:32:09PM +0200, Jiri Slaby wrote:
> rc_unregister_device already calls rc_free_device to free the passed
> device. But in one of ttusbir's probe fail paths, we call
> rc_unregister_device _and_ rc_free_device. This is wrong and results
> in a double free.
> 
> Instead, set rc to NULL resulting in rc_free_device being a noop.
> 
> Signed-off-by: Jiri Slaby <jslaby@suse.cz>
> Cc: Sean Young <sean@mess.org>
> Cc: Mauro Carvalho Chehab <mchehab@redhat.com>
> Cc: linux-media@vger.kernel.org
> ---
>  drivers/media/rc/ttusbir.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/media/rc/ttusbir.c b/drivers/media/rc/ttusbir.c
> index cf0d47f..891762d 100644
> --- a/drivers/media/rc/ttusbir.c
> +++ b/drivers/media/rc/ttusbir.c
> @@ -347,6 +347,7 @@ static int ttusbir_probe(struct usb_interface *intf,
>  	return 0;
>  out3:
>  	rc_unregister_device(rc);
> +	rc = NULL;
>  out2:
>  	led_classdev_unregister(&tt->led);
>  out:
> -- 

Acked-by: Sean Young <sean@mess.org>


Sean

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

end of thread, other threads:[~2013-04-09 10:36 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-04 20:32 [PATCH 1/5] BLOCK: rbd, return proper error from rbd_dev_probe_update_spec Jiri Slaby
2013-04-04 20:32 ` [PATCH 2/5] MEDIA: ttusbir, fix double free Jiri Slaby
2013-04-09 10:36   ` Sean Young
2013-04-04 20:32 ` [PATCH 3/5] SOUND: hda_generic, fix uninitialized variable Jiri Slaby
2013-04-05  5:20   ` Takashi Iwai
2013-04-04 20:32 ` [PATCH 4/5] X86: boot, close opened descriptor Jiri Slaby
2013-04-04 20:32 ` [PATCH 5/5] HID: hid-lenovo-tpkbd, remove doubled hid_get_drvdata Jiri Slaby
2013-04-04 22:37   ` Jiri Kosina
2013-04-04 23:05   ` Nikola Pajkovsky
2013-04-04 22:53 ` [PATCH 1/5] BLOCK: rbd, return proper error from rbd_dev_probe_update_spec Nikola Pajkovsky

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