Skip to content

Commit

Permalink
[SCSI] libfc, fcoe: ignore rx frame with wrong xid info
Browse files Browse the repository at this point in the history
Drop the rx frame having xid with wrong cpu info
or received with xid  not matching to our xid.

Not dropping such frame is causing panic as
that causes accessing data struct beyond their
bounds.

Signed-off-by: Vasu Dev <vasu.dev@intel.com>
Tested-by: Ross Brattain <ross.b.brattain@intel.com>
Signed-off-by: Robert Love <robert.w.love@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
  • Loading branch information
Vasu Dev authored and James Bottomley committed Jul 28, 2011
1 parent 6f06e3a commit 324f667
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 4 additions & 0 deletions drivers/scsi/fcoe/fcoe.c
Original file line number Diff line number Diff line change
Expand Up @@ -1373,6 +1373,10 @@ int fcoe_rcv(struct sk_buff *skb, struct net_device *netdev,
} else
cpu = smp_processor_id();
}

if (cpu >= nr_cpu_ids)
goto err;

fps = &per_cpu(fcoe_percpu, cpu);
spin_lock_bh(&fps->fcoe_rx_list.lock);
if (unlikely(!fps->thread)) {
Expand Down
4 changes: 1 addition & 3 deletions drivers/scsi/libfc/fc_exch.c
Original file line number Diff line number Diff line change
Expand Up @@ -802,10 +802,8 @@ static struct fc_exch *fc_exch_find(struct fc_exch_mgr *mp, u16 xid)
pool = per_cpu_ptr(mp->pool, xid & fc_cpu_mask);
spin_lock_bh(&pool->lock);
ep = fc_exch_ptr_get(pool, (xid - mp->min_xid) >> fc_cpu_order);
if (ep) {
if (ep && ep->xid == xid)
fc_exch_hold(ep);
WARN_ON(ep->xid != xid);
}
spin_unlock_bh(&pool->lock);
}
return ep;
Expand Down

0 comments on commit 324f667

Please sign in to comment.