|
@@ -3927,7 +3927,8 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
|
|
|
* Pick one of the social channels randomly as the listen
|
|
|
* channel.
|
|
|
*/
|
|
|
- os_get_random((u8 *) &r, sizeof(r));
|
|
|
+ if (os_get_random((u8 *) &r, sizeof(r)) < 0)
|
|
|
+ return -1;
|
|
|
p2p.channel = 1 + (r % 3) * 5;
|
|
|
p2p.channel_forced = 0;
|
|
|
}
|
|
@@ -3947,7 +3948,8 @@ int wpas_p2p_init(struct wpa_global *global, struct wpa_supplicant *wpa_s)
|
|
|
* Use random operation channel from (1, 6, 11) if no other
|
|
|
* preference is indicated.
|
|
|
*/
|
|
|
- os_get_random((u8 *) &r, sizeof(r));
|
|
|
+ if (os_get_random((u8 *) &r, sizeof(r)) < 0)
|
|
|
+ return -1;
|
|
|
p2p.op_channel = 1 + (r % 3) * 5;
|
|
|
p2p.cfg_op_channel = 0;
|
|
|
wpa_printf(MSG_DEBUG, "P2P: Random operating channel: "
|
|
@@ -5030,7 +5032,8 @@ static int wpas_p2p_select_go_freq(struct wpa_supplicant *wpa_s, int freq)
|
|
|
wpa_printf(MSG_DEBUG, "P2P: Use best 2.4 GHz band "
|
|
|
"channel: %d MHz", freq);
|
|
|
} else {
|
|
|
- os_get_random((u8 *) &r, sizeof(r));
|
|
|
+ if (os_get_random((u8 *) &r, sizeof(r)) < 0)
|
|
|
+ return -1;
|
|
|
freq = 2412 + (r % 3) * 25;
|
|
|
wpa_printf(MSG_DEBUG, "P2P: Use random 2.4 GHz band "
|
|
|
"channel: %d MHz", freq);
|
|
@@ -5047,7 +5050,8 @@ static int wpas_p2p_select_go_freq(struct wpa_supplicant *wpa_s, int freq)
|
|
|
wpa_printf(MSG_DEBUG, "P2P: Use best 5 GHz band "
|
|
|
"channel: %d MHz", freq);
|
|
|
} else {
|
|
|
- os_get_random((u8 *) &r, sizeof(r));
|
|
|
+ if (os_get_random((u8 *) &r, sizeof(r)) < 0)
|
|
|
+ return -1;
|
|
|
freq = 5180 + (r % 4) * 20;
|
|
|
if (!p2p_supported_freq_go(wpa_s->global->p2p, freq)) {
|
|
|
wpa_printf(MSG_DEBUG, "P2P: Could not select "
|
|
@@ -6329,8 +6333,10 @@ void wpas_p2p_update_config(struct wpa_supplicant *wpa_s)
|
|
|
* Pick one of the social channels randomly as the
|
|
|
* listen channel.
|
|
|
*/
|
|
|
- os_get_random((u8 *) &r, sizeof(r));
|
|
|
- channel = 1 + (r % 3) * 5;
|
|
|
+ if (os_get_random((u8 *) &r, sizeof(r)) < 0)
|
|
|
+ channel = 1;
|
|
|
+ else
|
|
|
+ channel = 1 + (r % 3) * 5;
|
|
|
channel_forced = 0;
|
|
|
}
|
|
|
ret = p2p_set_listen_channel(p2p, reg_class, channel,
|
|
@@ -6354,8 +6360,10 @@ void wpas_p2p_update_config(struct wpa_supplicant *wpa_s)
|
|
|
* Use random operation channel from (1, 6, 11)
|
|
|
*if no other preference is indicated.
|
|
|
*/
|
|
|
- os_get_random((u8 *) &r, sizeof(r));
|
|
|
- op_channel = 1 + (r % 3) * 5;
|
|
|
+ if (os_get_random((u8 *) &r, sizeof(r)) < 0)
|
|
|
+ op_channel = 1;
|
|
|
+ else
|
|
|
+ op_channel = 1 + (r % 3) * 5;
|
|
|
cfg_op_channel = 0;
|
|
|
}
|
|
|
ret = p2p_set_oper_channel(p2p, op_reg_class, op_channel,
|