diff mbox

net: drop write-only stack variable

Message ID 1454433474-8888-1-git-send-email-dh.herrmann@gmail.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

David Herrmann Feb. 2, 2016, 5:17 p.m. UTC
Remove a write-only stack variable from unix_attach_fds(). This is a
left-over from the security fix in:

    commit 712f4aad406bb1ed67f3f98d04c044191f0ff593
    Author: willy tarreau <w@1wt.eu>
    Date:   Sun Jan 10 07:54:56 2016 +0100

        unix: properly account for FDs passed over unix sockets

Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
---
 net/unix/af_unix.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Sergei Shtylyov Feb. 2, 2016, 5:53 p.m. UTC | #1
Hello.

On 02/02/2016 08:17 PM, David Herrmann wrote:

> Remove a write-only stack variable from unix_attach_fds(). This is a
> left-over from the security fix in:
>
>      commit 712f4aad406bb1ed67f3f98d04c044191f0ff593
>      Author: willy tarreau <w@1wt.eu>
>      Date:   Sun Jan 10 07:54:56 2016 +0100
>
>          unix: properly account for FDs passed over unix sockets

    scripts/checkpatch.pl now enforces a ceratin commit citing style (not so 
verbose :-)).

> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
[...]

MBR, Sergei
Hannes Frederic Sowa Feb. 2, 2016, 8:50 p.m. UTC | #2
On 02.02.2016 18:17, David Herrmann wrote:
> Remove a write-only stack variable from unix_attach_fds(). This is a
> left-over from the security fix in:
>
>      commit 712f4aad406bb1ed67f3f98d04c044191f0ff593
>      Author: willy tarreau <w@1wt.eu>
>      Date:   Sun Jan 10 07:54:56 2016 +0100
>
>          unix: properly account for FDs passed over unix sockets
>
> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>

I don't think this specifically needs a Fixes tag. Seems more like a 
clean-up.

Anyway, I also noticed this during review and it can be removed safely.

Acked-by: Hannes Frederic Sowa <hannes@stressinduktion.org>

Thanks,
Hannes
David Miller Feb. 7, 2016, 7:07 p.m. UTC | #3
From: David Herrmann <dh.herrmann@gmail.com>
Date: Tue,  2 Feb 2016 18:17:54 +0100

> Remove a write-only stack variable from unix_attach_fds(). This is a
> left-over from the security fix in:
> 
>     commit 712f4aad406bb1ed67f3f98d04c044191f0ff593
>     Author: willy tarreau <w@1wt.eu>
>     Date:   Sun Jan 10 07:54:56 2016 +0100
> 
>         unix: properly account for FDs passed over unix sockets
> 
> Signed-off-by: David Herrmann <dh.herrmann@gmail.com>

Applied, thanks.
diff mbox

Patch

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index c5bf5ef..9f88193 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -1534,7 +1534,6 @@  static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
 {
 	int i;
 	unsigned char max_level = 0;
-	int unix_sock_count = 0;
 
 	if (too_many_unix_fds(current))
 		return -ETOOMANYREFS;
@@ -1542,11 +1541,9 @@  static int unix_attach_fds(struct scm_cookie *scm, struct sk_buff *skb)
 	for (i = scm->fp->count - 1; i >= 0; i--) {
 		struct sock *sk = unix_get_socket(scm->fp->fp[i]);
 
-		if (sk) {
-			unix_sock_count++;
+		if (sk)
 			max_level = max(max_level,
 					unix_sk(sk)->recursion_level);
-		}
 	}
 	if (unlikely(max_level > MAX_RECURSION_LEVEL))
 		return -ETOOMANYREFS;