diff options
author | Christophe Ricard <christophe.ricard@gmail.com> | 2015-08-14 22:33:40 +0200 |
---|---|---|
committer | Samuel Ortiz <sameo@linux.intel.com> | 2015-08-17 01:36:17 +0200 |
commit | fe202fe95564023223ce1910c9e352f391abb1d5 (patch) | |
tree | 5ce126dcf515afe51b073be33cc450e360c25410 /net/nfc | |
parent | 94b85938ad21944afeff71d1cca68b094905e1b9 (diff) | |
download | linux-stable-fe202fe95564023223ce1910c9e352f391abb1d5.tar.gz linux-stable-fe202fe95564023223ce1910c9e352f391abb1d5.tar.bz2 linux-stable-fe202fe95564023223ce1910c9e352f391abb1d5.zip |
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: Christophe Ricard <christophe-h.ricard@st.com>
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'net/nfc')
-rw-r--r-- | net/nfc/netlink.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index f85f37ed19b2..81dfaaacfc4d 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c @@ -1518,8 +1518,8 @@ static int nfc_genl_vendor_cmd(struct sk_buff *skb, if (!dev || !dev->vendor_cmds || !dev->n_vendor_cmds) return -ENODEV; - data = nla_data(info->attrs[NFC_ATTR_VENDOR_DATA]); - if (data) { + if (info->attrs[NFC_ATTR_VENDOR_DATA]) { + data = nla_data(info->attrs[NFC_ATTR_VENDOR_DATA]); data_len = nla_len(info->attrs[NFC_ATTR_VENDOR_DATA]); if (data_len == 0) return -EINVAL; |