Commit fe202fe9 authored by Christophe Ricard's avatar Christophe Ricard Committed by Samuel Ortiz

nfc: netlink: Add check on NFC_ATTR_VENDOR_DATA

NFC_ATTR_VENDOR_DATA is an optional vendor_cmd argument.
The current code was potentially using a non existing argument
leading to potential catastrophic results.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarChristophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 94b85938
...@@ -1518,8 +1518,8 @@ static int nfc_genl_vendor_cmd(struct sk_buff *skb, ...@@ -1518,8 +1518,8 @@ static int nfc_genl_vendor_cmd(struct sk_buff *skb,
if (!dev || !dev->vendor_cmds || !dev->n_vendor_cmds) if (!dev || !dev->vendor_cmds || !dev->n_vendor_cmds)
return -ENODEV; return -ENODEV;
if (info->attrs[NFC_ATTR_VENDOR_DATA]) {
data = nla_data(info->attrs[NFC_ATTR_VENDOR_DATA]); data = nla_data(info->attrs[NFC_ATTR_VENDOR_DATA]);
if (data) {
data_len = nla_len(info->attrs[NFC_ATTR_VENDOR_DATA]); data_len = nla_len(info->attrs[NFC_ATTR_VENDOR_DATA]);
if (data_len == 0) if (data_len == 0)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment