* [PATCH] mtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions()
@ 2012-09-25 9:57 Sachin Kamat
2012-09-26 10:46 ` Sachin Kamat
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Sachin Kamat @ 2012-09-25 9:57 UTC (permalink / raw)
To: linux-mtd
Cc: patches, sachin.kamat, dedekind1, Dmitry Eremin-Solenikov,
Artem Bityutskiy, dwmw2
The pointer returned by kzalloc should be tested for NULL
to avoid potential NULL pointer dereference later. Incorrect
pointer was being tested for NULL. Bug introduced by commit fbcf62a3
(mtd: physmap_of: move parse_obsolete_partitions to become separate
parser).
This patch fixes this bug.
Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
Cc: Artem Bityutskiy <artem.bityutskiy@intel.com>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
drivers/mtd/ofpart.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
index 64be8f0..d9127e2 100644
--- a/drivers/mtd/ofpart.c
+++ b/drivers/mtd/ofpart.c
@@ -121,7 +121,7 @@ static int parse_ofoldpart_partitions(struct mtd_info *master,
nr_parts = plen / sizeof(part[0]);
*pparts = kzalloc(nr_parts * sizeof(*(*pparts)), GFP_KERNEL);
- if (!pparts)
+ if (!*pparts)
return -ENOMEM;
names = of_get_property(dp, "partition-names", &plen);
--
1.7.4.1
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions()
2012-09-25 9:57 [PATCH] mtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions() Sachin Kamat
@ 2012-09-26 10:46 ` Sachin Kamat
2012-09-26 11:11 ` Artem Bityutskiy
2012-10-01 18:11 ` Sachin Kamat
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Sachin Kamat @ 2012-09-26 10:46 UTC (permalink / raw)
To: linux-mtd; +Cc: Dmitry Eremin-Solenikov, Artem Bityutskiy, dwmw2, dedekind1
Hi Artem,
I was hoping if we can have this fix for the 3.6 release.
On 25 September 2012 15:27, Sachin Kamat <sachin.kamat@linaro.org> wrote:
> The pointer returned by kzalloc should be tested for NULL
> to avoid potential NULL pointer dereference later. Incorrect
> pointer was being tested for NULL. Bug introduced by commit fbcf62a3
> (mtd: physmap_of: move parse_obsolete_partitions to become separate
> parser).
> This patch fixes this bug.
>
> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> Cc: Artem Bityutskiy <artem.bityutskiy@intel.com>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
> drivers/mtd/ofpart.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
> index 64be8f0..d9127e2 100644
> --- a/drivers/mtd/ofpart.c
> +++ b/drivers/mtd/ofpart.c
> @@ -121,7 +121,7 @@ static int parse_ofoldpart_partitions(struct mtd_info *master,
> nr_parts = plen / sizeof(part[0]);
>
> *pparts = kzalloc(nr_parts * sizeof(*(*pparts)), GFP_KERNEL);
> - if (!pparts)
> + if (!*pparts)
> return -ENOMEM;
>
> names = of_get_property(dp, "partition-names", &plen);
> --
> 1.7.4.1
>
--
With warm regards,
Sachin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions()
2012-09-26 10:46 ` Sachin Kamat
@ 2012-09-26 11:11 ` Artem Bityutskiy
0 siblings, 0 replies; 6+ messages in thread
From: Artem Bityutskiy @ 2012-09-26 11:11 UTC (permalink / raw)
To: Sachin Kamat; +Cc: Dmitry Eremin-Solenikov, dwmw2, linux-mtd
[-- Attachment #1: Type: text/plain, Size: 196 bytes --]
On Wed, 2012-09-26 at 16:16 +0530, Sachin Kamat wrote:
> Hi Artem,
>
> I was hoping if we can have this fix for the 3.6 release.
Please, bug dwmw2.
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions()
2012-09-25 9:57 [PATCH] mtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions() Sachin Kamat
2012-09-26 10:46 ` Sachin Kamat
@ 2012-10-01 18:11 ` Sachin Kamat
2012-10-10 7:51 ` Sachin Kamat
2012-10-10 14:36 ` Artem Bityutskiy
3 siblings, 0 replies; 6+ messages in thread
From: Sachin Kamat @ 2012-10-01 18:11 UTC (permalink / raw)
To: linux-mtd
Cc: patches, sachin.kamat, dedekind1, Dmitry Eremin-Solenikov,
Artem Bityutskiy, dwmw2
ping...
On 25 September 2012 15:27, Sachin Kamat <sachin.kamat@linaro.org> wrote:
> The pointer returned by kzalloc should be tested for NULL
> to avoid potential NULL pointer dereference later. Incorrect
> pointer was being tested for NULL. Bug introduced by commit fbcf62a3
> (mtd: physmap_of: move parse_obsolete_partitions to become separate
> parser).
> This patch fixes this bug.
>
> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> Cc: Artem Bityutskiy <artem.bityutskiy@intel.com>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
> drivers/mtd/ofpart.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
> index 64be8f0..d9127e2 100644
> --- a/drivers/mtd/ofpart.c
> +++ b/drivers/mtd/ofpart.c
> @@ -121,7 +121,7 @@ static int parse_ofoldpart_partitions(struct mtd_info *master,
> nr_parts = plen / sizeof(part[0]);
>
> *pparts = kzalloc(nr_parts * sizeof(*(*pparts)), GFP_KERNEL);
> - if (!pparts)
> + if (!*pparts)
> return -ENOMEM;
>
> names = of_get_property(dp, "partition-names", &plen);
> --
> 1.7.4.1
>
--
With warm regards,
Sachin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions()
2012-09-25 9:57 [PATCH] mtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions() Sachin Kamat
2012-09-26 10:46 ` Sachin Kamat
2012-10-01 18:11 ` Sachin Kamat
@ 2012-10-10 7:51 ` Sachin Kamat
2012-10-10 14:36 ` Artem Bityutskiy
3 siblings, 0 replies; 6+ messages in thread
From: Sachin Kamat @ 2012-10-10 7:51 UTC (permalink / raw)
To: linux-mtd, David Woodhouse
Cc: sachin.kamat, Dmitry Eremin-Solenikov, patches, Artem Bityutskiy,
dedekind1
ping
On 25 September 2012 15:27, Sachin Kamat <sachin.kamat@linaro.org> wrote:
> The pointer returned by kzalloc should be tested for NULL
> to avoid potential NULL pointer dereference later. Incorrect
> pointer was being tested for NULL. Bug introduced by commit fbcf62a3
> (mtd: physmap_of: move parse_obsolete_partitions to become separate
> parser).
> This patch fixes this bug.
>
> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> Cc: Artem Bityutskiy <artem.bityutskiy@intel.com>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
> drivers/mtd/ofpart.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mtd/ofpart.c b/drivers/mtd/ofpart.c
> index 64be8f0..d9127e2 100644
> --- a/drivers/mtd/ofpart.c
> +++ b/drivers/mtd/ofpart.c
> @@ -121,7 +121,7 @@ static int parse_ofoldpart_partitions(struct mtd_info *master,
> nr_parts = plen / sizeof(part[0]);
>
> *pparts = kzalloc(nr_parts * sizeof(*(*pparts)), GFP_KERNEL);
> - if (!pparts)
> + if (!*pparts)
> return -ENOMEM;
>
> names = of_get_property(dp, "partition-names", &plen);
> --
> 1.7.4.1
>
--
With warm regards,
Sachin
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] mtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions()
2012-09-25 9:57 [PATCH] mtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions() Sachin Kamat
` (2 preceding siblings ...)
2012-10-10 7:51 ` Sachin Kamat
@ 2012-10-10 14:36 ` Artem Bityutskiy
3 siblings, 0 replies; 6+ messages in thread
From: Artem Bityutskiy @ 2012-10-10 14:36 UTC (permalink / raw)
To: Sachin Kamat; +Cc: Dmitry Eremin-Solenikov, dwmw2, linux-mtd, patches
[-- Attachment #1: Type: text/plain, Size: 657 bytes --]
On Tue, 2012-09-25 at 15:27 +0530, Sachin Kamat wrote:
> The pointer returned by kzalloc should be tested for NULL
> to avoid potential NULL pointer dereference later. Incorrect
> pointer was being tested for NULL. Bug introduced by commit fbcf62a3
> (mtd: physmap_of: move parse_obsolete_partitions to become separate
> parser).
> This patch fixes this bug.
>
> Cc: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
> Cc: Artem Bityutskiy <artem.bityutskiy@intel.com>
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Added
Cc: stable@vger.kernel.org [3.2+]
and pushed to l2-mtd.git, thanks!
--
Best Regards,
Artem Bityutskiy
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2012-10-10 14:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-25 9:57 [PATCH] mtd: ofpart: Fix incorrect NULL check in parse_ofoldpart_partitions() Sachin Kamat
2012-09-26 10:46 ` Sachin Kamat
2012-09-26 11:11 ` Artem Bityutskiy
2012-10-01 18:11 ` Sachin Kamat
2012-10-10 7:51 ` Sachin Kamat
2012-10-10 14:36 ` Artem Bityutskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox