This is a note to let you know that I've just added the patch titled sfc: Avoid generating over-length MC_CMD_FLUSH_RX_QUEUES request to the 3.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: sfc-avoid-generating-over-length-mc_cmd_flush_rx_queues-request.patch and it can be found in the queue-3.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 7b669343a777076b3a6e7be7a602abdb15746701 Mon Sep 17 00:00:00 2001 From: Ben Hutchings <bhutchings@xxxxxxxxxxxxxx> Date: Wed, 19 Sep 2012 02:53:34 +0100 Subject: sfc: Avoid generating over-length MC_CMD_FLUSH_RX_QUEUES request From: Ben Hutchings <bhutchings@xxxxxxxxxxxxxx> [ Upstream commit 450783747f42dfa3883920acfad4acdd93ce69af ] MCDI supports requests up to 252 bytes long, which is only enough to pass 63 RX queue IDs to MC_CMD_FLUSH_RX_QUEUES. However a VF may have up to 64 RX queues, and if we try to flush them all we will generate an over-length request and BUG() in efx_mcdi_copyin(). Currently all VF drivers limit themselves to 32 RX queues, so reducing the limit to 63 does no harm. Also add a BUILD_BUG_ON in efx_mcdi_flush_rxqs() so we remember to deal with the same problem there if EFX_MAX_CHANNELS is increased. Signed-off-by: Ben Hutchings <bhutchings@xxxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/net/ethernet/sfc/mcdi.c | 3 +++ drivers/net/ethernet/sfc/siena_sriov.c | 7 +++++++ 2 files changed, 10 insertions(+) --- a/drivers/net/ethernet/sfc/mcdi.c +++ b/drivers/net/ethernet/sfc/mcdi.c @@ -1168,6 +1168,9 @@ int efx_mcdi_flush_rxqs(struct efx_nic * __le32 *qid; int rc, count; + BUILD_BUG_ON(EFX_MAX_CHANNELS > + MC_CMD_FLUSH_RX_QUEUES_IN_QID_OFST_MAXNUM); + qid = kmalloc(EFX_MAX_CHANNELS * sizeof(*qid), GFP_KERNEL); if (qid == NULL) return -ENOMEM; --- a/drivers/net/ethernet/sfc/siena_sriov.c +++ b/drivers/net/ethernet/sfc/siena_sriov.c @@ -21,6 +21,9 @@ /* Number of longs required to track all the VIs in a VF */ #define VI_MASK_LENGTH BITS_TO_LONGS(1 << EFX_VI_SCALE_MAX) +/* Maximum number of RX queues supported */ +#define VF_MAX_RX_QUEUES 63 + /** * enum efx_vf_tx_filter_mode - TX MAC filtering behaviour * @VF_TX_FILTER_OFF: Disabled @@ -578,6 +581,7 @@ static int efx_vfdi_init_rxq(struct efx_ efx_oword_t reg; if (bad_vf_index(efx, vf_evq) || bad_vf_index(efx, vf_rxq) || + vf_rxq >= VF_MAX_RX_QUEUES || bad_buf_count(buf_count, EFX_MAX_DMAQ_SIZE)) { if (net_ratelimit()) netif_err(efx, hw, efx->net_dev, @@ -683,6 +687,9 @@ static int efx_vfdi_fini_all_queues(stru __le32 *rxqs; int rc; + BUILD_BUG_ON(VF_MAX_RX_QUEUES > + MC_CMD_FLUSH_RX_QUEUES_IN_QID_OFST_MAXNUM); + rxqs = kmalloc(count * sizeof(*rxqs), GFP_KERNEL); if (rxqs == NULL) return VFDI_RC_ENOMEM; Patches currently in stable-queue which might be from bhutchings@xxxxxxxxxxxxxx are queue-3.4/sfc-really-disable-flow-control-while-flushing.patch queue-3.4/sfc-disable-vf-queues-during-register-self-test.patch queue-3.4/sfc-correctly-initialise-reset_method-in-siena_test_chip.patch queue-3.4/sfc-do-not-attempt-to-flush-queues-if-dma-is-disabled.patch queue-3.4/sfc-avoid-generating-over-length-mc_cmd_flush_rx_queues-request.patch queue-3.4/sfc-work-around-flush-timeout-when-flushes-have-completed.patch queue-3.4/sfc-add-parentheses-around-use-of-bitfield-macro-arguments.patch queue-3.4/sfc-fix-mcdi-structure-field-lookup.patch queue-3.4/sfc-properly-sync-rx-dma-buffer-when-it-is-not-the-last-in-the-page.patch queue-3.4/sfc-only-use-tx-push-if-a-single-descriptor-is-to-be-written.patch queue-3.4/sfc-fix-efx_rx_buf_offset-in-the-presence-of-swiotlb.patch queue-3.4/sfc-lock-tx-queues-when-calling-netif_device_detach.patch queue-3.4/sfc-convert-firmware-subtypes-to-native-byte-order-in-efx_mcdi_get_board_cfg.patch queue-3.4/sfc-fix-timekeeping-in-efx_mcdi_poll.patch queue-3.4/sfc-disable-soft-interrupt-handling-during-efx_device_detach_sync.patch queue-3.4/sfc-detach-net-device-when-stopping-queues-for-reconfiguration.patch -- To unsubscribe from this list: send the line "unsubscribe stable" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html