summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorInaky Perez-Gonzalez <inaky@linux.intel.com>2009-03-30 17:50:17 -0700
committerInaky Perez-Gonzalez <inaky@linux.intel.com>2009-05-06 13:48:36 -0700
commitd1a2627a29667fe7c4a9d06e1579a2d65bd39bba (patch)
tree903881c40ed4d5c6f8c9664bc6f189baedcdef5b /net
parent356d6c2d55b71303a17910ea2cce3eba8e44bd29 (diff)
downloadblackbird-op-linux-d1a2627a29667fe7c4a9d06e1579a2d65bd39bba.tar.gz
blackbird-op-linux-d1a2627a29667fe7c4a9d06e1579a2d65bd39bba.zip
wimax: fix oops if netlink fails to add attribute
When sending a message to user space using wimax_msg(), if nla_put() fails, correctly interpret the return code from wimax_msg_alloc() as an err ptr and return the error code instead of crashing (as it is assuming than non-NULL means the pointer is ok). Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/wimax/op-msg.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/net/wimax/op-msg.c b/net/wimax/op-msg.c
index 5d149c1b5f0d..9ad4d893a566 100644
--- a/net/wimax/op-msg.c
+++ b/net/wimax/op-msg.c
@@ -149,7 +149,8 @@ struct sk_buff *wimax_msg_alloc(struct wimax_dev *wimax_dev,
}
result = nla_put(skb, WIMAX_GNL_MSG_DATA, size, msg);
if (result < 0) {
- dev_err(dev, "no memory to add payload in attribute\n");
+ dev_err(dev, "no memory to add payload (msg %p size %zu) in "
+ "attribute: %d\n", msg, size, result);
goto error_nla_put;
}
genlmsg_end(skb, genl_msg);
@@ -299,10 +300,10 @@ int wimax_msg(struct wimax_dev *wimax_dev, const char *pipe_name,
struct sk_buff *skb;
skb = wimax_msg_alloc(wimax_dev, pipe_name, buf, size, gfp_flags);
- if (skb == NULL)
- goto error_msg_new;
- result = wimax_msg_send(wimax_dev, skb);
-error_msg_new:
+ if (IS_ERR(skb))
+ result = PTR_ERR(skb);
+ else
+ result = wimax_msg_send(wimax_dev, skb);
return result;
}
EXPORT_SYMBOL_GPL(wimax_msg);
OpenPOWER on IntegriCloud