mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Please merge two small bug fix patches from linux-next
@ 2012-01-08 19:51 Jesper Juhl
  2012-01-08 21:26 ` Linus Torvalds
  0 siblings, 1 reply; 8+ messages in thread
From: Jesper Juhl @ 2012-01-08 19:51 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Linux Kernel Mailing List, Andrew Morton, James Bottomley,
	Al Viro, Eric Paris

Hi Linus

Below are two patches that have been in linux-next for ages (via akpm's 
tree). They are prette simple, straight-up, bug fixes. They have been 
submitted to maintainers multiple times over (IIRC at least the past 
year), but for some reason the maintainers seem uninterested in picking 
them up (or even responding to them).
There has been no negative comments at all to them while they have been in 
-next.
I'd really appreciate it if they could get merged.

I've just pulled them out of the current linux-next and applied them on 
top of your tree - that's what is below.



From: Jesper Juhl <jj@chaosbits.net>
Date: Thu, 22 Dec 2011 16:03:46 +1100
Subject: drivers/scsi/aacraid/commctrl.c: fix mem leak in aac_send_raw_srb()

We leak in drivers/scsi/aacraid/commctrl.c::aac_send_raw_srb() :

We allocate memory:
        ...
                        struct user_sgmap* usg;
                        usg = kmalloc(actual_fibsize - sizeof(struct aac_srb)
                          + sizeof(struct sgmap), GFP_KERNEL);
and then neglect to free it:
        ...
                        for (i = 0; i < usg->count; i++) {
                                u64 addr;
                                void* p;
                                if (usg->sg[i].count >
                                    ((dev->adapter_info.options &
                                     AAC_OPT_NEW_COMM) ?
                                      (dev->scsi_host_ptr->max_sectors << 9) :
                                      65536)) {
                                        rcode = -EINVAL;
                                        goto cleanup;
        ... this 'goto' makes 'usg' go out of scope and leak the memory we
            allocated.
            Other exits properly kfree(usg), it's just here it is neglected.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
 drivers/scsi/aacraid/commctrl.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index 8a0b330..0bd38da 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -650,6 +650,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
 				     AAC_OPT_NEW_COMM) ?
 				      (dev->scsi_host_ptr->max_sectors << 9) :
 				      65536)) {
+					kfree(usg);
 					rcode = -EINVAL;
 					goto cleanup;
 				}
-- 
1.7.8.1



From: Jesper Juhl <jj@chaosbits.net>
Date: Thu, 22 Dec 2011 16:04:13 +1100
Subject: audit: always follow va_copy() with va_end()

A call to va_copy() should always be followed by a call to va_end() in the
same function.  In kernel/autit.c::audit_log_vformat() this is not always
done.  This patch makes sure va_end() is always called.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Eric Paris <eparis@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Jesper Juhl <jj@codesealer.com>
---
 kernel/audit.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index 09fae26..2c1d6ab 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1260,12 +1260,13 @@ static void audit_log_vformat(struct audit_buffer *ab, const char *fmt,
 		avail = audit_expand(ab,
 			max_t(unsigned, AUDIT_BUFSIZ, 1+len-avail));
 		if (!avail)
-			goto out;
+			goto out_va_end;
 		len = vsnprintf(skb_tail_pointer(skb), avail, fmt, args2);
 	}
-	va_end(args2);
 	if (len > 0)
 		skb_put(skb, len);
+out_va_end:
+	va_end(args2);
 out:
 	return;
 }
-- 
1.7.8.1



-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


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

* Re: Please merge two small bug fix patches from linux-next
  2012-01-08 19:51 Please merge two small bug fix patches from linux-next Jesper Juhl
@ 2012-01-08 21:26 ` Linus Torvalds
  2012-01-08 21:35   ` Jesper Juhl
  2012-01-08 21:42   ` Please merge two small bug fix patches from linux-next Joe Perches
  0 siblings, 2 replies; 8+ messages in thread
From: Linus Torvalds @ 2012-01-08 21:26 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: Linux Kernel Mailing List, Andrew Morton, James Bottomley,
	Al Viro, Eric Paris

On Sun, Jan 8, 2012 at 11:51 AM, Jesper Juhl <jj@chaosbits.net> wrote:
>
> Below are two patches that have been in linux-next for ages (via akpm's
> tree). They are prette simple, straight-up, bug fixes. They have been
> submitted to maintainers multiple times over (IIRC at least the past
> year), but for some reason the maintainers seem uninterested in picking
> them up (or even responding to them).
> There has been no negative comments at all to them while they have been in
> -next.
> I'd really appreciate it if they could get merged.
>
> I've just pulled them out of the current linux-next and applied them on
> top of your tree - that's what is below.

So where are they? Git tree or what?

And if you want me to apply them as patches, please send them as
proper individual patches instead of askng me to "merge" them.

And they seem to have Andrew's sign-off, so I'd have expected them to
come through Andew. What's up?

                      Linus

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

* Re: Please merge two small bug fix patches from linux-next
  2012-01-08 21:26 ` Linus Torvalds
@ 2012-01-08 21:35   ` Jesper Juhl
  2012-01-08 21:44     ` [PATCH] drivers/scsi/aacraid/commctrl.c: fix mem leak in aac_send_raw_srb() Jesper Juhl
  2012-01-08 21:44     ` [PATCH] audit: always follow va_copy() with va_end() Jesper Juhl
  2012-01-08 21:42   ` Please merge two small bug fix patches from linux-next Joe Perches
  1 sibling, 2 replies; 8+ messages in thread
From: Jesper Juhl @ 2012-01-08 21:35 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Linux Kernel Mailing List, Andrew Morton, James Bottomley,
	Al Viro, Eric Paris

On Sun, 8 Jan 2012, Linus Torvalds wrote:

> On Sun, Jan 8, 2012 at 11:51 AM, Jesper Juhl <jj@chaosbits.net> wrote:
> >
> > Below are two patches that have been in linux-next for ages (via akpm's
> > tree). They are prette simple, straight-up, bug fixes. They have been
> > submitted to maintainers multiple times over (IIRC at least the past
> > year), but for some reason the maintainers seem uninterested in picking
> > them up (or even responding to them).
> > There has been no negative comments at all to them while they have been in
> > -next.
> > I'd really appreciate it if they could get merged.
> >
> > I've just pulled them out of the current linux-next and applied them on
> > top of your tree - that's what is below.
> 
> So where are they? Git tree or what?
> 
> And if you want me to apply them as patches, please send them as
> proper individual patches instead of askng me to "merge" them.
> 
> And they seem to have Andrew's sign-off, so I'd have expected them to
> come through Andew. What's up?
> 

What's up is this: I'd submitted them a few times to the mailing list and 
maintainers in the distant past. Andrew ended up picking them up when 
maintainers didn't. Through him they made it into the linux-next tree and 
have been living in Andrews queue and -next ever since. 

I simply got fed up with seeing them in -next and getting nowhere, and 
thought that if the maintainers won't pick them up maybe you would just 
take them directly now since it's been ages and they have not gotten any 
negative feedback and a merge window is open.

Andrew added his signed-off-by when he took them into his queue, I 
retained that when I grabbed the patches into a mainline git clone from 
-next, but I can just drop those if that's inappropriate.

I should not have said "merge" in the subject - my bad.

I'll send them as two individual patches by mail (unless you prefer a git 
tree, then I can easily set that up as well).


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


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

* Re: Please merge two small bug fix patches from linux-next
  2012-01-08 21:26 ` Linus Torvalds
  2012-01-08 21:35   ` Jesper Juhl
@ 2012-01-08 21:42   ` Joe Perches
  2012-01-08 22:21     ` Jesper Juhl
  1 sibling, 1 reply; 8+ messages in thread
From: Joe Perches @ 2012-01-08 21:42 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Jesper Juhl, Linux Kernel Mailing List, Andrew Morton,
	James Bottomley, Al Viro, Eric Paris

On Sun, 2012-01-08 at 13:26 -0800, Linus Torvalds wrote:
> On Sun, Jan 8, 2012 at 11:51 AM, Jesper Juhl <jj@chaosbits.net> wrote:
> > Below are two patches that have been in linux-next for ages (via akpm's
> > tree). They are prette simple, straight-up, bug fixes. They have been
> > submitted to maintainers multiple times over (IIRC at least the past
> > year), but for some reason the maintainers seem uninterested in picking
> > them up (or even responding to them).
[]
> they seem to have Andrew's sign-off, so I'd have expected them to
> come through Andew. What's up?

>From my perspective, the issue lies with James'
apparent desire to keep scsi tree changes as close
to zero as possible.

Many obvious corrections to scsi defects have gone
unapplied.


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

* [PATCH] drivers/scsi/aacraid/commctrl.c: fix mem leak in aac_send_raw_srb()
  2012-01-08 21:35   ` Jesper Juhl
@ 2012-01-08 21:44     ` Jesper Juhl
  2012-01-08 21:44     ` [PATCH] audit: always follow va_copy() with va_end() Jesper Juhl
  1 sibling, 0 replies; 8+ messages in thread
From: Jesper Juhl @ 2012-01-08 21:44 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: Linux Kernel Mailing List, Andrew Morton, James Bottomley

We leak in drivers/scsi/aacraid/commctrl.c::aac_send_raw_srb() :

We allocate memory:
        ...
                        struct user_sgmap* usg;
                        usg = kmalloc(actual_fibsize - sizeof(struct aac_srb)
                          + sizeof(struct sgmap), GFP_KERNEL);
and then neglect to free it:
        ...
                        for (i = 0; i < usg->count; i++) {
                                u64 addr;
                                void* p;
                                if (usg->sg[i].count >
                                    ((dev->adapter_info.options &
                                     AAC_OPT_NEW_COMM) ?
                                      (dev->scsi_host_ptr->max_sectors << 9) :
                                      65536)) {
                                        rcode = -EINVAL;
                                        goto cleanup;
        ... this 'goto' makes 'usg' go out of scope and leak the memory we
            allocated.
            Other exits properly kfree(usg), it's just here it is neglected.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Cc: James Bottomley <James.Bottomley@HansenPartnership.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 drivers/scsi/aacraid/commctrl.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index 8a0b330..0bd38da 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -650,6 +650,7 @@ static int aac_send_raw_srb(struct aac_dev* dev, void __user * arg)
 				     AAC_OPT_NEW_COMM) ?
 				      (dev->scsi_host_ptr->max_sectors << 9) :
 				      65536)) {
+					kfree(usg);
 					rcode = -EINVAL;
 					goto cleanup;
 				}
-- 
1.7.8.1


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


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

* [PATCH] audit: always follow va_copy() with va_end()
  2012-01-08 21:35   ` Jesper Juhl
  2012-01-08 21:44     ` [PATCH] drivers/scsi/aacraid/commctrl.c: fix mem leak in aac_send_raw_srb() Jesper Juhl
@ 2012-01-08 21:44     ` Jesper Juhl
  1 sibling, 0 replies; 8+ messages in thread
From: Jesper Juhl @ 2012-01-08 21:44 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Linux Kernel Mailing List, Andrew Morton, Al Viro, Eric Paris

A call to va_copy() should always be followed by a call to va_end() in the
same function.  In kernel/autit.c::audit_log_vformat() this is not always
done.  This patch makes sure va_end() is always called.

Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Eric Paris <eparis@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
---
 kernel/audit.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/kernel/audit.c b/kernel/audit.c
index 09fae26..2c1d6ab 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -1260,12 +1260,13 @@ static void audit_log_vformat(struct audit_buffer *ab, const char *fmt,
 		avail = audit_expand(ab,
 			max_t(unsigned, AUDIT_BUFSIZ, 1+len-avail));
 		if (!avail)
-			goto out;
+			goto out_va_end;
 		len = vsnprintf(skb_tail_pointer(skb), avail, fmt, args2);
 	}
-	va_end(args2);
 	if (len > 0)
 		skb_put(skb, len);
+out_va_end:
+	va_end(args2);
 out:
 	return;
 }
-- 
1.7.8.1


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


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

* Re: Please merge two small bug fix patches from linux-next
  2012-01-08 21:42   ` Please merge two small bug fix patches from linux-next Joe Perches
@ 2012-01-08 22:21     ` Jesper Juhl
  2012-01-08 23:14       ` Harvey Harrison
  0 siblings, 1 reply; 8+ messages in thread
From: Jesper Juhl @ 2012-01-08 22:21 UTC (permalink / raw)
  To: Joe Perches
  Cc: Linus Torvalds, Linux Kernel Mailing List, Andrew Morton,
	James Bottomley, Al Viro, Eric Paris

On Sun, 8 Jan 2012, Joe Perches wrote:

> On Sun, 2012-01-08 at 13:26 -0800, Linus Torvalds wrote:
> > On Sun, Jan 8, 2012 at 11:51 AM, Jesper Juhl <jj@chaosbits.net> wrote:
> > > Below are two patches that have been in linux-next for ages (via akpm's
> > > tree). They are prette simple, straight-up, bug fixes. They have been
> > > submitted to maintainers multiple times over (IIRC at least the past
> > > year), but for some reason the maintainers seem uninterested in picking
> > > them up (or even responding to them).
> []
> > they seem to have Andrew's sign-off, so I'd have expected them to
> > come through Andew. What's up?
> 
> >From my perspective, the issue lies with James'
> apparent desire to keep scsi tree changes as close
> to zero as possible.
> 
> Many obvious corrections to scsi defects have gone
> unapplied.
> 

I have to agree. It's actually gotten to the point that I personally 
completely avoid/ignore scsi code when looking for stuff to fix/improve 
since I don't expect to be able to get the patches merged anyway..


-- 
Jesper Juhl <jj@chaosbits.net>       http://www.chaosbits.net/
Don't top-post http://www.catb.org/jargon/html/T/top-post.html
Plain text mails only, please.


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

* Re: Please merge two small bug fix patches from linux-next
  2012-01-08 22:21     ` Jesper Juhl
@ 2012-01-08 23:14       ` Harvey Harrison
  0 siblings, 0 replies; 8+ messages in thread
From: Harvey Harrison @ 2012-01-08 23:14 UTC (permalink / raw)
  To: Jesper Juhl
  Cc: Joe Perches, Linus Torvalds, Linux Kernel Mailing List,
	Andrew Morton, James Bottomley, Al Viro, Eric Paris

On Sun, Jan 8, 2012 at 2:21 PM, Jesper Juhl <jj@chaosbits.net> wrote:
> On Sun, 8 Jan 2012, Joe Perches wrote:
>
>> On Sun, 2012-01-08 at 13:26 -0800, Linus Torvalds wrote:
>> > On Sun, Jan 8, 2012 at 11:51 AM, Jesper Juhl <jj@chaosbits.net> wrote:
>> > > Below are two patches that have been in linux-next for ages (via akpm's
>> > > tree). They are prette simple, straight-up, bug fixes. They have been
>> > > submitted to maintainers multiple times over (IIRC at least the past
>> > > year), but for some reason the maintainers seem uninterested in picking
>> > > them up (or even responding to them).
>> []
>> > they seem to have Andrew's sign-off, so I'd have expected them to
>> > come through Andew. What's up?
>>
>> >From my perspective, the issue lies with James'
>> apparent desire to keep scsi tree changes as close
>> to zero as possible.
>>
>> Many obvious corrections to scsi defects have gone
>> unapplied.
>>
>
> I have to agree. It's actually gotten to the point that I personally
> completely avoid/ignore scsi code when looking for stuff to fix/improve
> since I don't expect to be able to get the patches merged anyway..
>

Basically the same experience here trying to submit sparse annotations
or patched using the get_unaligned_*
functions instead of explicit byte-shifting.

Harvey

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

end of thread, other threads:[~2012-01-08 23:14 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-08 19:51 Please merge two small bug fix patches from linux-next Jesper Juhl
2012-01-08 21:26 ` Linus Torvalds
2012-01-08 21:35   ` Jesper Juhl
2012-01-08 21:44     ` [PATCH] drivers/scsi/aacraid/commctrl.c: fix mem leak in aac_send_raw_srb() Jesper Juhl
2012-01-08 21:44     ` [PATCH] audit: always follow va_copy() with va_end() Jesper Juhl
2012-01-08 21:42   ` Please merge two small bug fix patches from linux-next Joe Perches
2012-01-08 22:21     ` Jesper Juhl
2012-01-08 23:14       ` Harvey Harrison

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®