From: James Morris <jmorris@namei.org>
To: Mimi Zohar <zohar@linux.vnet.ibm.com>,
Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, Al Viro <viro@zeniv.linux.org.uk>,
Roland Kletzing <devzero@web.de>,
"<David Safford" <safford@watson.ibm.com>,
stable@kernel.org, Mimi Zohar <zohar@us.ibm.com>
Subject: Re: [PATCH 2/2] ima: hashing large files bug fix
Date: Mon, 24 Aug 2009 14:57:57 +1000 (EST) [thread overview]
Message-ID: <alpine.LRH.2.00.0908241456390.22597@tundra.namei.org> (raw)
In-Reply-To: <3fa4204e315c0bc33ae378d4f01a53eab2e5e4bc.1250871856.git.zohar@linux.vnet.ibm.com>
On Fri, 21 Aug 2009, Mimi Zohar wrote:
> Hashing files larger than INT_MAX causes process to loop.
> Dependent on redefining kernel_read() offset type to loff_t.
>
> (http://bugzilla.kernel.org/show_bug.cgi?id=13909)
>
> Cc: stable@kernel.org
> Signed-off-by: Mimi Zohar <zohar@us.ibm.com>
> ---
> security/integrity/ima/ima_crypto.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
These look correct to me (I'll also push them to Linus via git).
Reviewed-by: James Morris <jmorris@namei.org>
>
> diff --git a/security/integrity/ima/ima_crypto.c b/security/integrity/ima/ima_crypto.c
> index 63003a6..46642a1 100644
> --- a/security/integrity/ima/ima_crypto.c
> +++ b/security/integrity/ima/ima_crypto.c
> @@ -45,9 +45,9 @@ int ima_calc_hash(struct file *file, char *digest)
> {
> struct hash_desc desc;
> struct scatterlist sg[1];
> - loff_t i_size;
> + loff_t i_size, offset = 0;
> char *rbuf;
> - int rc, offset = 0;
> + int rc;
>
> rc = init_desc(&desc);
> if (rc != 0)
> @@ -67,6 +67,8 @@ int ima_calc_hash(struct file *file, char *digest)
> rc = rbuf_len;
> break;
> }
> + if (rbuf_len == 0)
> + break;
> offset += rbuf_len;
> sg_init_one(sg, rbuf, rbuf_len);
>
> --
> 1.6.0.6
>
--
James Morris
<jmorris@namei.org>
next prev parent reply other threads:[~2009-08-24 4:59 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-08-21 18:32 [PATCH 1/2] kernel_read: redefine offset type Mimi Zohar
2009-08-21 18:32 ` [PATCH 2/2] ima: hashing large files bug fix Mimi Zohar
2009-08-24 4:57 ` James Morris [this message]
2009-08-24 4:58 ` [PATCH 1/2] kernel_read: redefine offset type James Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LRH.2.00.0908241456390.22597@tundra.namei.org \
--to=jmorris@namei.org \
--cc=devzero@web.de \
--cc=linux-kernel@vger.kernel.org \
--cc=safford@watson.ibm.com \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
--cc=zohar@linux.vnet.ibm.com \
--cc=zohar@us.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®