diff options
author | Ajit Khaparde <ajit.khaparde@emulex.com> | 2011-02-04 17:18:28 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-02-05 17:58:18 -0800 |
commit | e45ff01d3f79bc71e6f514302a776cc8815eaecc (patch) | |
tree | 47353b13f245a74f2d25fc40ecffe37e9314fe39 /drivers/net/benet/be_cmds.c | |
parent | 1e6d93e45b231b3ae87c01902ede2315aacfe976 (diff) |
benet: Avoid potential null deref in be_cmd_get_seeprom_data()
Found by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Ajit Khaparde <ajit.khaparde@emulex.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/benet/be_cmds.c')
-rw-r--r-- | drivers/net/benet/be_cmds.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c index 0c7811faf72..a179cc6d79f 100644 --- a/drivers/net/benet/be_cmds.c +++ b/drivers/net/benet/be_cmds.c @@ -1786,6 +1786,10 @@ int be_cmd_get_seeprom_data(struct be_adapter *adapter, spin_lock_bh(&adapter->mcc_lock); wrb = wrb_from_mccq(adapter); + if (!wrb) { + status = -EBUSY; + goto err; + } req = nonemb_cmd->va; sge = nonembedded_sgl(wrb); @@ -1801,6 +1805,7 @@ int be_cmd_get_seeprom_data(struct be_adapter *adapter, status = be_mcc_notify_wait(adapter); +err: spin_unlock_bh(&adapter->mcc_lock); return status; } |