* [pull 2.6.30 0/2] WiMAX fixes for 2.6.30
@ 2009-05-06 21:47 Inaky Perez-Gonzalez
2009-05-06 21:47 ` [pull 2.6.30 1/2] wimax: fix oops if netlink fails to add attribute Inaky Perez-Gonzalez
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Inaky Perez-Gonzalez @ 2009-05-06 21:47 UTC (permalink / raw)
To: wimax; +Cc: netdev
These fix a couple of oopsen found in the WiMAX stack. They are
available as a pull and patches are included for revieweing
convenience.
Thank you,
--
The following changes since commit 356d6c2d55b71303a17910ea2cce3eba8e44bd29:
David S. Miller (1):
Merge branch 'master' of git://git.kernel.org/.../kaber/nf-2.6
are available in the git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/inaky/wimax.git linux-2.6.30.y
Inaky Perez-Gonzalez (2):
wimax: fix oops if netlink fails to add attribute
wimax: oops: wimax_dev_add() is the only one that can initialize the state
net/wimax/op-msg.c | 11 ++++++-----
net/wimax/stack.c | 17 +++++++++++++++--
2 files changed, 21 insertions(+), 7 deletions(-)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pull 2.6.30 1/2] wimax: fix oops if netlink fails to add attribute
2009-05-06 21:47 [pull 2.6.30 0/2] WiMAX fixes for 2.6.30 Inaky Perez-Gonzalez
@ 2009-05-06 21:47 ` Inaky Perez-Gonzalez
2009-05-06 21:47 ` [pull 2.6.30 2/2] wimax: oops: wimax_dev_add() is the only one that can initialize the state Inaky Perez-Gonzalez
2009-05-06 23:42 ` [pull 2.6.30 0/2] WiMAX fixes for 2.6.30 David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Inaky Perez-Gonzalez @ 2009-05-06 21:47 UTC (permalink / raw)
To: wimax; +Cc: netdev
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>
---
net/wimax/op-msg.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/net/wimax/op-msg.c b/net/wimax/op-msg.c
index 5d149c1..9ad4d89 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);
--
1.6.2.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [pull 2.6.30 2/2] wimax: oops: wimax_dev_add() is the only one that can initialize the state
2009-05-06 21:47 [pull 2.6.30 0/2] WiMAX fixes for 2.6.30 Inaky Perez-Gonzalez
2009-05-06 21:47 ` [pull 2.6.30 1/2] wimax: fix oops if netlink fails to add attribute Inaky Perez-Gonzalez
@ 2009-05-06 21:47 ` Inaky Perez-Gonzalez
2009-05-06 23:42 ` [pull 2.6.30 0/2] WiMAX fixes for 2.6.30 David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Inaky Perez-Gonzalez @ 2009-05-06 21:47 UTC (permalink / raw)
To: wimax; +Cc: netdev
When a new wimax_dev is created, it's state has to be __WIMAX_ST_NULL
until wimax_dev_add() is succesfully called. This allows calls into
the stack that happen before said time to be rejected.
Until now, the state was being set (by mistake) to UNINITIALIZED,
which was allowing calls such as wimax_report_rfkill_hw() to go
through even when a call to wimax_dev_add() had failed; that was
causing an oops when touching uninitialized data.
This situation is normal when the device starts reporting state before
the whole initialization has been completed. It just has to be dealt
with.
Signed-off-by: Inaky Perez-Gonzalez <inaky@linux.intel.com>
---
net/wimax/stack.c | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/net/wimax/stack.c b/net/wimax/stack.c
index a0ee76b..933e142 100644
--- a/net/wimax/stack.c
+++ b/net/wimax/stack.c
@@ -338,8 +338,21 @@ out:
*/
void wimax_state_change(struct wimax_dev *wimax_dev, enum wimax_st new_state)
{
+ /*
+ * A driver cannot take the wimax_dev out of the
+ * __WIMAX_ST_NULL state unless by calling wimax_dev_add(). If
+ * the wimax_dev's state is still NULL, we ignore any request
+ * to change its state because it means it hasn't been yet
+ * registered.
+ *
+ * There is no need to complain about it, as routines that
+ * call this might be shared from different code paths that
+ * are called before or after wimax_dev_add() has done its
+ * job.
+ */
mutex_lock(&wimax_dev->mutex);
- __wimax_state_change(wimax_dev, new_state);
+ if (wimax_dev->state > __WIMAX_ST_NULL)
+ __wimax_state_change(wimax_dev, new_state);
mutex_unlock(&wimax_dev->mutex);
return;
}
@@ -376,7 +389,7 @@ EXPORT_SYMBOL_GPL(wimax_state_get);
void wimax_dev_init(struct wimax_dev *wimax_dev)
{
INIT_LIST_HEAD(&wimax_dev->id_table_node);
- __wimax_state_set(wimax_dev, WIMAX_ST_UNINITIALIZED);
+ __wimax_state_set(wimax_dev, __WIMAX_ST_NULL);
mutex_init(&wimax_dev->mutex);
mutex_init(&wimax_dev->mutex_reset);
}
--
1.6.2.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [pull 2.6.30 0/2] WiMAX fixes for 2.6.30
2009-05-06 21:47 [pull 2.6.30 0/2] WiMAX fixes for 2.6.30 Inaky Perez-Gonzalez
2009-05-06 21:47 ` [pull 2.6.30 1/2] wimax: fix oops if netlink fails to add attribute Inaky Perez-Gonzalez
2009-05-06 21:47 ` [pull 2.6.30 2/2] wimax: oops: wimax_dev_add() is the only one that can initialize the state Inaky Perez-Gonzalez
@ 2009-05-06 23:42 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2009-05-06 23:42 UTC (permalink / raw)
To: inaky; +Cc: wimax, netdev
From: Inaky Perez-Gonzalez <inaky@linux.intel.com>
Date: Wed, 6 May 2009 14:47:21 -0700
> These fix a couple of oopsen found in the WiMAX stack. They are
> available as a pull and patches are included for revieweing
> convenience.
...
> are available in the git repository at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/inaky/wimax.git linux-2.6.30.y
>
Pulled, thanks a lot!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-05-06 23:42 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-06 21:47 [pull 2.6.30 0/2] WiMAX fixes for 2.6.30 Inaky Perez-Gonzalez
2009-05-06 21:47 ` [pull 2.6.30 1/2] wimax: fix oops if netlink fails to add attribute Inaky Perez-Gonzalez
2009-05-06 21:47 ` [pull 2.6.30 2/2] wimax: oops: wimax_dev_add() is the only one that can initialize the state Inaky Perez-Gonzalez
2009-05-06 23:42 ` [pull 2.6.30 0/2] WiMAX fixes for 2.6.30 David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).