Search Linux Wireless

Re: [PATCH w-t] iwlwifi: rewrite iwl-scan.c to avoid race conditions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Some comments on the patch:

>  static int iwl_send_scan_abort(struct iwl_priv *priv)
>  {
> -	int ret = 0;
> +	int ret;
>  	struct iwl_rx_packet *pkt;
>  	struct iwl_host_cmd cmd = {
>  		.id = REPLY_SCAN_ABORT_CMD,
>  		.flags = CMD_WANT_SKB,
>  	};

Since you're going through, and probably know where what lock is needed,
could you annotate the places with, e.g.

	lockdep_assert_held(&priv->mutex)?

If you're not sure, that's fine, but if you know already that'd probably
make things easier in the future.

> +static inline void iwl_complete_scan(struct iwl_priv *priv, bool aborted)

These "inline" annotations seem wrong, either the function is used once,
then gcc will inline it, or it is used multiple times, then we shouldn't
inline it.

> +static void iwl_do_scan_abort(struct iwl_priv *priv)

> +	lockdep_assert_held(&priv->mutex);

:-)

> +/**
> + * iwl_scan_cancel_sleep - Cancel any currently executing HW scan,
> + *			   wait for hardware/firmware! completion
> + */
> +int iwl_scan_cancel_sleep(struct iwl_priv *priv)
> +{
> +	int ret;
> +	unsigned long timeout = jiffies + IWL_SCAN_ABORT_SLEEP;
> +
> +	IWL_DEBUG_SCAN(priv, "Scan cancel wait\n");
> +
> +	cancel_delayed_work(&priv->scan_timeout);
> +	iwl_do_scan_abort(priv);
> +
> +	while (time_before_eq(jiffies, timeout)) {
> +		if (!test_bit(STATUS_SCAN_HW, &priv->status))
> +			break;
> +		msleep(20);
> +	}

This, and

> +void iwl_wait_for_scan_end(struct iwl_priv *priv)
> +{
> +	unsigned long timeout = jiffies + IWL_SCAN_WAIT_END;
> +
> +	while (time_before_eq(jiffies, timeout)) {
> +		if (!test_bit(STATUS_SCANNING, &priv->status))
> +			break;
> +		msleep(20);
> +	}

this seems like it could use a completion?

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux