* [PATCH] textfile: fix missing call to munmap in wite_key
@ 2012-05-10 13:43 Vishal Agarwal
2012-05-16 8:02 ` vishal agarwal
0 siblings, 1 reply; 3+ messages in thread
From: Vishal Agarwal @ 2012-05-10 13:43 UTC (permalink / raw)
To: linux-bluetooth; +Cc: naresh.gupta, Vishal Agarwal
In some cases it was possible that munmap is not called corresponding
to mmap, which might result in future read or writes to fail.
---
src/textfile.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/textfile.c b/src/textfile.c
index 2712cd8..9d88fbc 100644
--- a/src/textfile.c
+++ b/src/textfile.c
@@ -220,8 +220,8 @@ static int write_key(const char *pathname, const char *key, const char *value, i
len = strlen(key);
off = find_key(map, size, key, len, icase);
if (!off) {
+ munmap(map, size);
if (value) {
- munmap(map, size);
lseek(fd, size, SEEK_SET);
err = write_key_value(fd, key, value);
}
--
1.7.0.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] textfile: fix missing call to munmap in wite_key
2012-05-10 13:43 [PATCH] textfile: fix missing call to munmap in wite_key Vishal Agarwal
@ 2012-05-16 8:02 ` vishal agarwal
2012-05-16 8:14 ` Johan Hedberg
0 siblings, 1 reply; 3+ messages in thread
From: vishal agarwal @ 2012-05-16 8:02 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Vishal Agarwal
Hi Johan,
On 5/10/12, Vishal Agarwal <vishal.agarwal@stericsson.com> wrote:
> In some cases it was possible that munmap is not called corresponding
> to mmap, which might result in future read or writes to fail.
> ---
> src/textfile.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/src/textfile.c b/src/textfile.c
> index 2712cd8..9d88fbc 100644
> --- a/src/textfile.c
> +++ b/src/textfile.c
> @@ -220,8 +220,8 @@ static int write_key(const char *pathname, const char
> *key, const char *value, i
> len = strlen(key);
> off = find_key(map, size, key, len, icase);
> if (!off) {
> + munmap(map, size);
> if (value) {
> - munmap(map, size);
> lseek(fd, size, SEEK_SET);
> err = write_key_value(fd, key, value);
> }
> --
> 1.7.0.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
> in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Did you get a chance to look at it. Just to brief about the problem -
If we try to pair unpair device many times then in certain conditions
munmap is not called and after some times the mmap starts failing.
which will result in nsuccessful pairing or unpairing.
This patch fixes this issue.
Thanks
Vishal
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] textfile: fix missing call to munmap in wite_key
2012-05-16 8:02 ` vishal agarwal
@ 2012-05-16 8:14 ` Johan Hedberg
0 siblings, 0 replies; 3+ messages in thread
From: Johan Hedberg @ 2012-05-16 8:14 UTC (permalink / raw)
To: vishal agarwal; +Cc: linux-bluetooth, Vishal Agarwal
Hi Vishal,
On Wed, May 16, 2012, vishal agarwal wrote:
> On 5/10/12, Vishal Agarwal <vishal.agarwal@stericsson.com> wrote:
> > In some cases it was possible that munmap is not called corresponding
> > to mmap, which might result in future read or writes to fail.
> > ---
> > src/textfile.c | 2 +-
> > 1 files changed, 1 insertions(+), 1 deletions(-)
> >
> > diff --git a/src/textfile.c b/src/textfile.c
> > index 2712cd8..9d88fbc 100644
> > --- a/src/textfile.c
> > +++ b/src/textfile.c
> > @@ -220,8 +220,8 @@ static int write_key(const char *pathname, const char
> > *key, const char *value, i
> > len = strlen(key);
> > off = find_key(map, size, key, len, icase);
> > if (!off) {
> > + munmap(map, size);
> > if (value) {
> > - munmap(map, size);
> > lseek(fd, size, SEEK_SET);
> > err = write_key_value(fd, key, value);
> > }
> > --
> > 1.7.0.4
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe linux-bluetooth"
> > in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> >
>
> Did you get a chance to look at it. Just to brief about the problem -
> If we try to pair unpair device many times then in certain conditions
> munmap is not called and after some times the mmap starts failing.
> which will result in nsuccessful pairing or unpairing.
> This patch fixes this issue.
Sorry, I did actually take a look at it and concluded it was correct,
but I forgot to apply it. The patch has been pushed upstream now.
Thanks.
Johan
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-05-16 8:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-10 13:43 [PATCH] textfile: fix missing call to munmap in wite_key Vishal Agarwal
2012-05-16 8:02 ` vishal agarwal
2012-05-16 8:14 ` Johan Hedberg
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).