summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAjit Khaparde <ajit.khaparde@emulex.com>2011-02-04 18:18:28 +0100
committerDavid S. Miller <davem@davemloft.net>2011-02-06 02:58:18 +0100
commite45ff01d3f79bc71e6f514302a776cc8815eaecc (patch)
tree47353b13f245a74f2d25fc40ecffe37e9314fe39 /drivers
parentnet: can: janz-ican3: world-writable sysfs termination file (diff)
downloadlinux-e45ff01d3f79bc71e6f514302a776cc8815eaecc.tar.xz
linux-e45ff01d3f79bc71e6f514302a776cc8815eaecc.zip
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')
-rw-r--r--drivers/net/benet/be_cmds.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/net/benet/be_cmds.c b/drivers/net/benet/be_cmds.c
index 0c7811faf72c..a179cc6d79f2 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;
}