Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
FFS Gluon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
firmware
FFS Gluon
Commits
c3ddb221
Commit
c3ddb221
authored
11 years ago
by
Matthias Schiffer
Browse files
Options
Downloads
Patches
Plain Diff
packages/routing: alfred: fix socket fd leak
parent
92138a60
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
patches/packages/routing/0002-alfred-fix-socket-fd-leak.patch
+49
-0
49 additions, 0 deletions
...hes/packages/routing/0002-alfred-fix-socket-fd-leak.patch
with
49 additions
and
0 deletions
patches/packages/routing/0002-alfred-fix-socket-fd-leak.patch
0 → 100644
+
49
−
0
View file @
c3ddb221
From: Matthias Schiffer <mschiffer@universe-factory.net>
Date: Sat, 18 Jan 2014 21:15:16 +0100
Subject: alfred: fix socket fd leak
diff --git a/alfred/patches/0002-batadv-vis-don-t-leak-socket-fd-in-get_if_mac.patch b/alfred/patches/0002-batadv-vis-don-t-leak-socket-fd-in-get_if_mac.patch
new file mode 100644
index 0000000..2374e25
--- /dev/null
+++ b/alfred/patches/0002-batadv-vis-don-t-leak-socket-fd-in-get_if_mac.patch
@@ -0,0 +1,39 @@
+From 449b94ee85a42fbabec550d920002ad07738e733 Mon Sep 17 00:00:00 2001
+Message-Id: <449b94ee85a42fbabec550d920002ad07738e733.1390075976.git.mschiffer@universe-factory.net>
+From: Matthias Schiffer <mschiffer@universe-factory.net>
+Date: Sat, 18 Jan 2014 21:04:05 +0100
+Subject: [PATCH] batadv-vis: don't leak socket fd in get_if_mac()
+
+Leaking an fd every time get_if_mac() is called causes a batadv-vis server
+process to hit the open file limit in a matter of hours when there are many
+active interfaces and the limit is as low as 1024 (which it is on OpenWRT).
+
+Reported-by: Jan-Philipp Litza <janphilipp@litza.de>
+Signed-off-by: Matthias Schiffer <mschiffer@universe-factory.net>
+---
+ vis/vis.c | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+--- a/vis/vis.c
++++ b/vis/vis.c
+@@ -97,6 +97,7 @@ static int get_if_mac(char *ifname, uint
+ {
+ struct ifreq ifr;
+ int sock;
++ int ret;
+
+ strncpy(ifr.ifr_name, ifname, IFNAMSIZ);
+
+@@ -105,7 +106,11 @@ static int get_if_mac(char *ifname, uint
+ return -1;
+ }
+
+- if (ioctl(sock, SIOCGIFHWADDR, &ifr) == -1) {
++ ret = ioctl(sock, SIOCGIFHWADDR, &ifr);
++
++ close(sock);
++
++ if (ret == -1) {
+ fprintf(stderr, "can't get MAC address: %s\n", strerror(errno));
+ return -1;
+ }
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment