mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-23 02:54:32 +08:00
bnx2x: fix crash on big-endian when adding VLAN
bnx2x crashes during the initialization of the 8021q module on ppc64. The bug is a missing conversion from le32 in bnx2x_handle_classification_eqe() when obtaining the cid value from struct eth_event_data. The fields in struct eth_event_data should all be declared as little-endian and conversions added where missing. Signed-off-by: Michal Schmidt <mschmidt@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
735c1e2511
commit
9cd753a1f4
@ -5207,9 +5207,9 @@ struct e2_integ_data {
|
||||
* set mac event data
|
||||
*/
|
||||
struct eth_event_data {
|
||||
u32 echo;
|
||||
u32 reserved0;
|
||||
u32 reserved1;
|
||||
__le32 echo;
|
||||
__le32 reserved0;
|
||||
__le32 reserved1;
|
||||
};
|
||||
|
||||
|
||||
|
@ -5280,14 +5280,14 @@ static void bnx2x_handle_classification_eqe(struct bnx2x *bp,
|
||||
{
|
||||
unsigned long ramrod_flags = 0;
|
||||
int rc = 0;
|
||||
u32 cid = elem->message.data.eth_event.echo & BNX2X_SWCID_MASK;
|
||||
u32 echo = le32_to_cpu(elem->message.data.eth_event.echo);
|
||||
u32 cid = echo & BNX2X_SWCID_MASK;
|
||||
struct bnx2x_vlan_mac_obj *vlan_mac_obj;
|
||||
|
||||
/* Always push next commands out, don't wait here */
|
||||
__set_bit(RAMROD_CONT, &ramrod_flags);
|
||||
|
||||
switch (le32_to_cpu((__force __le32)elem->message.data.eth_event.echo)
|
||||
>> BNX2X_SWCID_SHIFT) {
|
||||
switch (echo >> BNX2X_SWCID_SHIFT) {
|
||||
case BNX2X_FILTER_MAC_PENDING:
|
||||
DP(BNX2X_MSG_SP, "Got SETUP_MAC completions\n");
|
||||
if (CNIC_LOADED(bp) && (cid == BNX2X_ISCSI_ETH_CID(bp)))
|
||||
@ -5308,8 +5308,7 @@ static void bnx2x_handle_classification_eqe(struct bnx2x *bp,
|
||||
bnx2x_handle_mcast_eqe(bp);
|
||||
return;
|
||||
default:
|
||||
BNX2X_ERR("Unsupported classification command: %d\n",
|
||||
elem->message.data.eth_event.echo);
|
||||
BNX2X_ERR("Unsupported classification command: 0x%x\n", echo);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5596,10 +5595,8 @@ static void bnx2x_eq_int(struct bnx2x *bp)
|
||||
BNX2X_STATE_OPENING_WAIT4_PORT):
|
||||
case (EVENT_RING_OPCODE_RSS_UPDATE_RULES |
|
||||
BNX2X_STATE_CLOSING_WAIT4_HALT):
|
||||
cid = elem->message.data.eth_event.echo &
|
||||
BNX2X_SWCID_MASK;
|
||||
DP(BNX2X_MSG_SP, "got RSS_UPDATE ramrod. CID %d\n",
|
||||
cid);
|
||||
SW_CID(elem->message.data.eth_event.echo));
|
||||
rss_raw->clear_pending(rss_raw);
|
||||
break;
|
||||
|
||||
|
@ -1672,11 +1672,12 @@ void bnx2x_vf_handle_classification_eqe(struct bnx2x *bp,
|
||||
{
|
||||
unsigned long ramrod_flags = 0;
|
||||
int rc = 0;
|
||||
u32 echo = le32_to_cpu(elem->message.data.eth_event.echo);
|
||||
|
||||
/* Always push next commands out, don't wait here */
|
||||
set_bit(RAMROD_CONT, &ramrod_flags);
|
||||
|
||||
switch (elem->message.data.eth_event.echo >> BNX2X_SWCID_SHIFT) {
|
||||
switch (echo >> BNX2X_SWCID_SHIFT) {
|
||||
case BNX2X_FILTER_MAC_PENDING:
|
||||
rc = vfq->mac_obj.complete(bp, &vfq->mac_obj, elem,
|
||||
&ramrod_flags);
|
||||
@ -1686,8 +1687,7 @@ void bnx2x_vf_handle_classification_eqe(struct bnx2x *bp,
|
||||
&ramrod_flags);
|
||||
break;
|
||||
default:
|
||||
BNX2X_ERR("Unsupported classification command: %d\n",
|
||||
elem->message.data.eth_event.echo);
|
||||
BNX2X_ERR("Unsupported classification command: 0x%x\n", echo);
|
||||
return;
|
||||
}
|
||||
if (rc < 0)
|
||||
@ -1755,8 +1755,7 @@ int bnx2x_iov_eq_sp_event(struct bnx2x *bp, union event_ring_elem *elem)
|
||||
case EVENT_RING_OPCODE_MULTICAST_RULES:
|
||||
case EVENT_RING_OPCODE_FILTERS_RULES:
|
||||
case EVENT_RING_OPCODE_RSS_UPDATE_RULES:
|
||||
cid = (elem->message.data.eth_event.echo &
|
||||
BNX2X_SWCID_MASK);
|
||||
cid = SW_CID(elem->message.data.eth_event.echo);
|
||||
DP(BNX2X_MSG_IOV, "checking filtering comp cid=%d\n", cid);
|
||||
break;
|
||||
case EVENT_RING_OPCODE_VF_FLR:
|
||||
|
Loading…
Reference in New Issue
Block a user