lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 28 Sep 2008 17:15:52 +0200
From:	"Leon Woestenberg" <leon.woestenberg@...il.com>
To:	"FUJITA Tomonori" <fujita.tomonori@....ntt.co.jp>,
	linux-kernel@...r.kernel.org,
	James.Bottomley@...senpartnership.com, jens.axboe@...cle.com
Subject: scatterlist.c: bug in sg_next()?

Hello,

I was code-inspecting 2.6.27-r7 through git web, when I came across this:

In sg_next(), after following a chain_ptr, a few more checks should be
performed.
The rare case exists that the first entry in the chained list is a
last marker, in case NULL must be returned.

Can someone confirm and cook a patch?

struct scatterlist *sg_next(struct scatterlist *sg)
{
  if (sg_is_last(sg))
    return NULL;
  sg++;
  if (unlikely(sg_is_chain(sg))) {
     sg = sg_chain_ptr(sg);
+#ifdef CONFIG_DEBUG_SG
+ BUG_ON(sg->sg_magic != SG_MAGIC);
+#endif
+   if (sg_is_last(sg))
+     return NULL;
  }
  return sg;
}

Signed-off-by: Leon Woestenberg <leon@...ebranch.com>

Regards,
-- 
Leon
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ