* [PATCH 0/2] 3.1-git ipoib: fix NULL pointer dereference
@ 2011-08-16 10:56 Bernd Schubert
2011-08-16 10:56 ` [PATCH 1/2] Fix possible Null pointer dereference in ipoib_start_xmit() Bernd Schubert
2011-08-16 10:56 ` [PATCH 2/2] Rename 'n' into a longer variable name Bernd Schubert
0 siblings, 2 replies; 5+ messages in thread
From: Bernd Schubert @ 2011-08-16 10:56 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
The following series
- fixes a NULL pointer dereferences in ipoib_start_xmit()
- renames variable 'n' to 'dst_neigh' to make the code better readable
Question: I am unsure about the usage of likely() here, as I run into the else branch,
maybe it is not that unlikely and likely() should be removed?
---
Bernd Schubert (2):
Fix possible Null pointer dereference in ipoib_start_xmit()
Rename 'n' into a longer variable name.
drivers/infiniband/ulp/ipoib/ipoib_main.c | 17 ++++++++++-------
1 files changed, 10 insertions(+), 7 deletions(-)
--
Bernd Schubert
Fraunhofer ITWM / FhGFS
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] Fix possible Null pointer dereference in ipoib_start_xmit()
2011-08-16 10:56 [PATCH 0/2] 3.1-git ipoib: fix NULL pointer dereference Bernd Schubert
@ 2011-08-16 10:56 ` Bernd Schubert
2011-08-16 17:19 ` Roland Dreier
2011-08-16 10:56 ` [PATCH 2/2] Rename 'n' into a longer variable name Bernd Schubert
1 sibling, 1 reply; 5+ messages in thread
From: Bernd Schubert @ 2011-08-16 10:56 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
This will fix https://bugzilla.kernel.org/show_bug.cgi?id=41212
fslab2 login: [ 114.392408] EXT4-fs (sdc): barriers disabled
[ 114.449737] EXT4-fs (sdc): mounted filesystem with writeback data mode.
Opts: journal_async_commit,barrier=0,data=writeback
[ 240.944030] BUG: unable to handle kernel NULL pointer dereference at
0000000000000040
[ 240.948007] IP: [<ffffffffa0366ce9>] ipoib_start_xmit+0x39/0x280 [ib_ipoib]
[...]
[ 240.948007] Call Trace:
[ 240.948007] <IRQ>
[ 240.948007] [<ffffffff812cd5e0>] dev_hard_start_xmit+0x2a0/0x590
[ 240.948007] [<ffffffff8131f680>] ? arp_create+0x70/0x200
[ 240.948007] [<ffffffff812e8e1f>] sch_direct_xmit+0xef/0x1c0
Signed-off-by: Bernd Schubert <bernd.schubert-mPn0NPGs4xGatNDF+KUbs4QuADTiUCJX@public.gmane.org>
---
drivers/infiniband/ulp/ipoib/ipoib_main.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index 43f89ba..fe89c46 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -717,11 +717,13 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct ipoib_dev_priv *priv = netdev_priv(dev);
struct ipoib_neigh *neigh;
- struct neighbour *n;
+ struct neighbour *n = NULL;
unsigned long flags;
- n = dst_get_neighbour(skb_dst(skb));
- if (likely(skb_dst(skb) && n)) {
+ if (likely(skb_dst(skb)))
+ n = dst_get_neighbour(skb_dst(skb));
+
+ if (likely(n)) {
if (unlikely(!*to_ipoib_neigh(n))) {
ipoib_path_lookup(skb, dev);
return NETDEV_TX_OK;
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] Rename 'n' into a longer variable name.
2011-08-16 10:56 [PATCH 0/2] 3.1-git ipoib: fix NULL pointer dereference Bernd Schubert
2011-08-16 10:56 ` [PATCH 1/2] Fix possible Null pointer dereference in ipoib_start_xmit() Bernd Schubert
@ 2011-08-16 10:56 ` Bernd Schubert
2011-08-16 18:47 ` David Miller
1 sibling, 1 reply; 5+ messages in thread
From: Bernd Schubert @ 2011-08-16 10:56 UTC (permalink / raw)
To: netdev-u79uwXL29TY76Z2rM5mHXA; +Cc: linux-rdma-u79uwXL29TY76Z2rM5mHXA
When it comes to me variable names consisting of a single letter
should be forbidden by coding style guide lines, as it is rather
difficult to search for single letter, such as 'n'.
Rename struct neighbour *n to dst_neigh
Signed-off-by: Bernd Schubert <bernd.schubert-mPn0NPGs4xGatNDF+KUbs4QuADTiUCJX@public.gmane.org>
---
drivers/infiniband/ulp/ipoib/ipoib_main.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c
index fe89c46..189d4cb 100644
--- a/drivers/infiniband/ulp/ipoib/ipoib_main.c
+++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c
@@ -717,22 +717,22 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct ipoib_dev_priv *priv = netdev_priv(dev);
struct ipoib_neigh *neigh;
- struct neighbour *n = NULL;
+ struct neighbour *dst_neigh = NULL;
unsigned long flags;
if (likely(skb_dst(skb)))
- n = dst_get_neighbour(skb_dst(skb));
+ dst_neigh = dst_get_neighbour(skb_dst(skb));
- if (likely(n)) {
- if (unlikely(!*to_ipoib_neigh(n))) {
+ if (likely(dst_neigh)) {
+ if (unlikely(!*to_ipoib_neigh(dst_neigh))) {
ipoib_path_lookup(skb, dev);
return NETDEV_TX_OK;
}
- neigh = *to_ipoib_neigh(n);
+ neigh = *to_ipoib_neigh(dst_neigh);
if (unlikely((memcmp(&neigh->dgid.raw,
- n->ha + 4,
+ dst_neigh->ha + 4,
sizeof(union ib_gid))) ||
(neigh->dev != dev))) {
spin_lock_irqsave(&priv->lock, flags);
@@ -758,7 +758,8 @@ static int ipoib_start_xmit(struct sk_buff *skb, struct net_device *dev)
return NETDEV_TX_OK;
}
} else if (neigh->ah) {
- ipoib_send(dev, skb, neigh->ah, IPOIB_QPN(n->ha));
+ ipoib_send(dev, skb, neigh->ah,
+ IPOIB_QPN(dst_neigh->ha));
return NETDEV_TX_OK;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] Fix possible Null pointer dereference in ipoib_start_xmit()
2011-08-16 10:56 ` [PATCH 1/2] Fix possible Null pointer dereference in ipoib_start_xmit() Bernd Schubert
@ 2011-08-16 17:19 ` Roland Dreier
0 siblings, 0 replies; 5+ messages in thread
From: Roland Dreier @ 2011-08-16 17:19 UTC (permalink / raw)
To: Bernd Schubert
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA
Thanks, applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] Rename 'n' into a longer variable name.
2011-08-16 10:56 ` [PATCH 2/2] Rename 'n' into a longer variable name Bernd Schubert
@ 2011-08-16 18:47 ` David Miller
0 siblings, 0 replies; 5+ messages in thread
From: David Miller @ 2011-08-16 18:47 UTC (permalink / raw)
To: bernd.schubert-mPn0NPGs4xGatNDF+KUbs4QuADTiUCJX
Cc: netdev-u79uwXL29TY76Z2rM5mHXA, linux-rdma-u79uwXL29TY76Z2rM5mHXA
From: Bernd Schubert <bernd.schubert-mPn0NPGs4xGatNDF+KUbs4QuADTiUCJX@public.gmane.org>
Date: Tue, 16 Aug 2011 12:56:59 +0200
> When it comes to me variable names consisting of a single letter
> should be forbidden by coding style guide lines, as it is rather
> difficult to search for single letter, such as 'n'.
I totally disagree and use such things aggressively myself.
I am not applying this patch.
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-08-16 18:47 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-16 10:56 [PATCH 0/2] 3.1-git ipoib: fix NULL pointer dereference Bernd Schubert
2011-08-16 10:56 ` [PATCH 1/2] Fix possible Null pointer dereference in ipoib_start_xmit() Bernd Schubert
2011-08-16 17:19 ` Roland Dreier
2011-08-16 10:56 ` [PATCH 2/2] Rename 'n' into a longer variable name Bernd Schubert
2011-08-16 18:47 ` 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).