linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] iw: Change socket configuration to avoid buffer allocation error
@ 2016-05-18 11:22 Tribush, Gil
  2016-05-31  9:37 ` Johannes Berg
  0 siblings, 1 reply; 2+ messages in thread
From: Tribush, Gil @ 2016-05-18 11:22 UTC (permalink / raw)
  To: johannes@sipsolutions.net; +Cc: linux-wireless@vger.kernel.org

Move  nl_socket_set_buffer_size() to be called after genl_connect(),
otherwise nl_socket_set_buffer_size() always returns an NLE_BAD_SOCK
error because sk->s_fd is equal to -1 at that stage.

Signed-off-by: Gil Treibush <gil.tribush@intel.com>
---
iw.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)


diff --git a/iw.c b/iw.c
index 0f511d9..e3742cd 100644
--- a/iw.c
+++ b/iw.c
@@ -54,14 +54,14 @@ static int nl80211_init(struct nl80211_state *state)
 		return -ENOMEM;
 	}
 
-	nl_socket_set_buffer_size(state->nl_sock, 8192, 8192);
-
 	if (genl_connect(state->nl_sock)) {
 		fprintf(stderr, "Failed to connect to generic netlink.\n");
 		err = -ENOLINK;
 		goto out_handle_destroy;
 	}
 
+	nl_socket_set_buffer_size(state->nl_sock, 8192, 8192);
+
 	state->nl80211_id = genl_ctrl_resolve(state->nl_sock, "nl80211");
 	if (state->nl80211_id < 0) {
 		fprintf(stderr, "nl80211 not found.\n");
--
1.9.1
---------------------------------------------------------------------
A member of the Intel Corporation group of companies

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.


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

* Re: [PATCH] iw: Change socket configuration to avoid buffer allocation error
  2016-05-18 11:22 [PATCH] iw: Change socket configuration to avoid buffer allocation error Tribush, Gil
@ 2016-05-31  9:37 ` Johannes Berg
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Berg @ 2016-05-31  9:37 UTC (permalink / raw)
  To: Tribush, Gil; +Cc: linux-wireless@vger.kernel.org

On Wed, 2016-05-18 at 11:22 +0000, Tribush, Gil wrote:
> Move  nl_socket_set_buffer_size() to be called after genl_connect(),
> otherwise nl_socket_set_buffer_size() always returns an NLE_BAD_SOCK
> error because sk->s_fd is equal to -1 at that stage.
> 

Applied.

johannes

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

end of thread, other threads:[~2016-05-31  9:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-18 11:22 [PATCH] iw: Change socket configuration to avoid buffer allocation error Tribush, Gil
2016-05-31  9:37 ` Johannes Berg

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