staging: ks7010: Add null pointer check for skb
PATCH 1/1 staging: ks7010: Add null pointer check for skb
Add a null pointer check for the socket buffer in ks_hostif.c to avoid a possible null pointer deference.
Signed-off-by Aymen Qader <[email protected]>
--- drivers/staging/ks7010/ks_hostif.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/staging/ks7010/ks_hostif.c +5 -0
@@ -1011,6 +1011,11 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb)size_t size;int ret; +if (!skb) { + ret = -ENOMEM ; + goto err_kfree; + } + skb_len = skb->len;if (skb_len >ETH_FRAME_LEN ) {netdev_err (priv->net_dev,"bad length skb_len=%d\n" , skb_len);
Signature · 1 line
2.17.1
PATCH v2 1/1 staging: ks7010: Add null pointer check for skb
Add a null pointer check for the socket buffer in ks_hostif.c to avoid a possible null pointer deference, and remove a later now-redundant null pointer check.
Signed-off-by Aymen Qader <[email protected]>
---
v2: Remove redundant pointer check
drivers/staging/ks7010/ks_hostif.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/staging/ks7010/ks_hostif.c +5 -1
@@ -1011,6 +1011,11 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb)size_t size;int ret; +if (!skb) { + ret = -ENOMEM ; + goto err_kfree; + } + skb_len = skb->len;if (skb_len >ETH_FRAME_LEN ) {netdev_err (priv->net_dev,"bad length skb_len=%d\n" , skb_len);
@@ -1023,7 +1028,6 @@ int hostif_data_request(struct ks_wlan_private *priv, struct sk_buff *skb) priv->wpa.mic_failure.stop) {if (netif_queue_stopped (priv->net_dev))netif_wake_queue (priv->net_dev); -if (skb)dev_kfree_skb (skb);return 0 ;
Signature · 1 line
2.17.1