diff options
author | Pan Bian <bianpan2016@163.com> | 2017-04-23 17:09:11 +0800 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-04-28 13:09:55 -0400 |
commit | 9ef63f31ad0ba28c68c8367e5b1cbba720fec597 (patch) | |
tree | 24a845ec47fad4a696d527530d93e2fcb97102da /drivers/infiniband/hw/cxgb4 | |
parent | 27b0b83233ced9e6b7448875a40382f7384daccd (diff) | |
download | lwn-9ef63f31ad0ba28c68c8367e5b1cbba720fec597.tar.gz lwn-9ef63f31ad0ba28c68c8367e5b1cbba720fec597.zip |
iw_cxgb4: check return value of alloc_skb
Function alloc_skb() will return a NULL pointer when there is no enough
memory. However, the return value of alloc_skb() is directly used
without validation in function send_fw_pass_open_req(). This patches
checks the return value of alloc_skb() against NULL.
Signed-off-by: Pan Bian <bianpan2016@163.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/cxgb4')
-rw-r--r-- | drivers/infiniband/hw/cxgb4/cm.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c index 02faf1f125fd..b6fe45924c6e 100644 --- a/drivers/infiniband/hw/cxgb4/cm.c +++ b/drivers/infiniband/hw/cxgb4/cm.c @@ -3799,6 +3799,8 @@ static void send_fw_pass_open_req(struct c4iw_dev *dev, struct sk_buff *skb, int ret; req_skb = alloc_skb(sizeof(struct fw_ofld_connection_wr), GFP_KERNEL); + if (!req_skb) + return; req = (struct fw_ofld_connection_wr *)__skb_put(req_skb, sizeof(*req)); memset(req, 0, sizeof(*req)); req->op_compl = htonl(WR_OP_V(FW_OFLD_CONNECTION_WR) | FW_WR_COMPL_F); |