netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [patch] irda: precedence bug in irlmp_seq_hb_idx()
       [not found] <----An------QYmAn$4202951b-482d-4d92-98c2-3466de737b40@alibaba-inc.com>
@ 2015-10-19 10:16 ` Dan Carpenter
  2015-10-21 14:48   ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2015-10-19 10:16 UTC (permalink / raw)
  To: Samuel Ortiz
  Cc: David S. Miller, netdev, security, throber3,
	程君(成淼)

This is decrementing the pointer, instead of the value stored in the
pointer.  KASan detects it as an out of bounds reference.

Reported-by: "Berry Cheng 程君(成淼)" <chengmiao.cj@alibaba-inc.com>
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
This bug predates the start of git.  You would think it would have been
reported earlier since it looks like a serious bug.  I cannot test this
so please review carefully.

diff --git a/net/irda/irlmp.c b/net/irda/irlmp.c
index a26c401..4396459 100644
--- a/net/irda/irlmp.c
+++ b/net/irda/irlmp.c
@@ -1839,7 +1839,7 @@ static void *irlmp_seq_hb_idx(struct irlmp_iter_state *iter, loff_t *off)
 	for (element = hashbin_get_first(iter->hashbin);
 	     element != NULL;
 	     element = hashbin_get_next(iter->hashbin)) {
-		if (!off || *off-- == 0) {
+		if (!off || (*off)-- == 0) {
 			/* NB: hashbin left locked */
 			return element;
 		}

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] irda: precedence bug in irlmp_seq_hb_idx()
  2015-10-19 10:16 ` [patch] irda: precedence bug in irlmp_seq_hb_idx() Dan Carpenter
@ 2015-10-21 14:48   ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-10-21 14:48 UTC (permalink / raw)
  To: dan.carpenter; +Cc: samuel, netdev, security, throber3, chengmiao.cj

From: Dan Carpenter <dan.carpenter@oracle.com>
Date: Mon, 19 Oct 2015 13:16:49 +0300

> This is decrementing the pointer, instead of the value stored in the
> pointer.  KASan detects it as an out of bounds reference.
> 
> Reported-by: "Berry Cheng 程君(成淼)" <chengmiao.cj@alibaba-inc.com>
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied and queued up for -stable, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-21 14:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <----An------QYmAn$4202951b-482d-4d92-98c2-3466de737b40@alibaba-inc.com>
2015-10-19 10:16 ` [patch] irda: precedence bug in irlmp_seq_hb_idx() Dan Carpenter
2015-10-21 14:48   ` 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).