gpiolib: Fix invalid access of nullptr
PATCH 1/1 gpiolib: Fix invalid access of nullptr
Hi
There is a NULL pointer exception issue within the gpiolib of the CIP 4.4 kernel.
The CIP kernel output and a patch that fix the invalid null pointer access are attached.
The vanilla 4.4 kernel is not affected by this bug, because this regression affects only CIP 4.4.176-cip32 or newer kernels that contain back ported code for the gpiolib. The upstream vanilla kernel contains similar code beginning with version 4.17.
The following commits introduce the new functionality for the CIP 4.4.176-cip32 kernel:
gpiolib: Avoid calling chip->request() for unused gpios, ed4f40244354af7b19b3bae5c56cce2620877b7c
gpiolib: Support 'gpio-reserved-ranges' property, baff4777cdb80256cd24dede2a3d0af761356307
gpiolib: Extract mask allocation into subroutine, 171aad2d8519db9940d84e337da96aac8b1eb36c
Thank you.
Signature · 28 lines
Best regards Stefan Koch Siemens AG Digital Industries Process Automation Software House Nbg DI PA CI R&D 3 Gleiwitzer Str. 555 90475 Nuernberg, Germany stefan-koch at siemens.com <mailto:[email protected]> www.siemens.com/ingenuityforlife <https://siemens.com/ingenuityforlife> www.siemens.com/ingenuityforlife Siemens Aktiengesellschaft: Chairman of the Supervisory Board: Jim Hagemann Snabe; Managing Board: Joe Kaeser, Chairman, President and Chief Executive Officer; Roland Busch, Lisa Davis, Klaus Helmrich, Janina Kugel, Cedrik Neike, Michael Sen, Ralf P. Thomas; Registered offices: Berlin and Munich, Germany; Commercial registries: Berlin Charlottenburg, HRB 12300, Munich, HRB 6684; WEEE-Reg.-No. DE 23691322 -------------- next part -------------- A non-text attachment was scrubbed... Name: 0001-gpiolib-Fix-invalid-access-of-nullptr.patch Type: text/x-patch Size: 2053 bytes Desc: 0001-gpiolib-Fix-invalid-access-of-nullptr.patch URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191202/2420f473/attachment.bin> -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: kernel-panic.txt URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191202/2420f473/attachment.txt>
PATCH 1/1 gpiolib: Fix invalid access of nullptr
Hi Stefan,
That's a known problem, please have a look at:
https://patchwork.kernel.org/patch/11235267/
Pavel, Iwamatsu-san, could you please take patch:
https://patchwork.kernel.org/patch/11235267/
I think this is quite urgent as others will stumble across the problem and will try and fix it.
Thanks,
Fab
Quoted 50 lines
-----Original Message-----
From: Koch, Stefan <[email protected]>
Sent: 02 December 2019 15:37
To: cip-dev at lists.cip-project.org
Cc: Fabrizio Castro <[email protected]>; pavel at denx.de; nobuhiro1.iwamatsu at toshiba.co.jp
Subject: [PATCH 4.4.y-cip] gpiolib: Fix invalid access of nullptrHi
There is a NULL pointer exception issue within the gpiolib of the CIP 4.4 kernel.
The CIP kernel output and a patch that fix the invalid null pointer access are attached.The vanilla 4.4 kernel is not affected by this bug, because this regression affects only CIP 4.4.176-cip32 or newer kernels that contain back ported code for the gpiolib. The upstream vanilla kernel contains similar code beginning with version 4.17.
The following commits introduce the new functionality for the CIP 4.4.176-cip32 kernel:
gpiolib: Avoid callingchip->request()for unused gpios,ed4f40244354af7b19b3bae5c56cce2620877b7c
gpiolib: Support 'gpio-reserved-ranges' property,baff4777cdb80256cd24dede2a3d0af761356307
gpiolib: Extract mask allocation into subroutine,171aad2d8519db9940d84e337da96aac8b1eb36cThank you.
--
Best regards
Stefan KochSiemens AG
Digital Industries
Process Automation
Software House Nbg
DI PA CI R&D 3
Gleiwitzer Str. 555
90475 Nuernberg, Germany
stefan-koch at siemens.com <mailto:[email protected]>
www.siemens.com/ingenuityforlife <https://siemens.com/ingenuityforlife>
www.siemens.com/ingenuityforlife
Siemens Aktiengesellschaft: Chairman of the Supervisory Board: Jim Hagemann Snabe; Managing Board: Joe Kaeser, Chairman, President and Chief Executive Officer; Roland Busch, Lisa Davis, Klaus Helmrich, Janina Kugel, Cedrik Neike, Michael Sen, Ralf P. Thomas; Registered offices: Berlin and Munich, Germany; Commercial registries: Berlin Charlottenburg, HRB 12300, Munich, HRB 6684; WEEE-Reg.-No. DE 23691322
PATCH 1/1 gpiolib: Fix invalid access of nullptr
Hi Pavel and Iwamatsu-san,
Quoted 11 lines
From: cip-dev <[email protected]> On Behalf Of Fabrizio Castro
Sent: Monday, December 2, 2019 11:43 PM
To: Koch, Stefan <[email protected]>;
cip-dev at lists.cip-project.org
Cc: Biju Das <[email protected]>
Subject: Re: [cip-dev] [PATCH 4.4.y-cip] gpiolib: Fix invalid access of nullptrHi Stefan,
Quoted 8 lines
That's a known problem, please have a look at:
https://patchwork.kernel.org/patch/11235267/Pavel, Iwamatsu-san, could you please take patch:
https://patchwork.kernel.org/patch/11235267/I think this is quite urgent as others will stumble across the problem and will try and fix it.
For "fix" a backport issue, should we follow upstream first in CIP?
Quoted 3 lines
Thanks,
Fab
Best regards,
Johnson
<span class="sew4j6gfd2s3o7x"><br></span>> > -----Original Message-----
Quoted 58 lines
Quoted 35 lines
From: Koch, Stefan <[email protected]>
Sent: 02 December 2019 15:37
To: cip-dev at lists.cip-project.org
Cc: Fabrizio Castro <[email protected]>; pavel at denx.de; nobuhiro1.iwamatsu at toshiba.co.jp
Subject: [PATCH 4.4.y-cip] gpiolib: Fix invalid access of nullptrHi
There is a NULL pointer exception issue within the gpiolib of the CIP
4.4 kernel.
The CIP kernel output and a patch that fix the invalid null pointer access are attached.The vanilla 4.4 kernel is not affected by this bug, because this regression affects only CIP 4.4.176-cip32 or newer kernels that contain back ported code for the gpiolib. The upstream vanilla kernel contains similar code beginning with version 4.17.
The following commits introduce the new functionality for the CIP 4.4.176-cip32 kernel:
gpiolib: Avoid callingchip->request()for unused gpios,ed4f40244354af7b19b3bae5c56cce2620877b7c
gpiolib: Support 'gpio-reserved-ranges' property,baff4777cdb80256cd24dede2a3d0af761356307
gpiolib: Extract mask allocation into subroutine,171aad2d8519db9940d84e337da96aac8b1eb36cThank you.
--
Best regards
Stefan KochQuoted 18 lines
Siemens AG
Digital Industries
Process Automation
Software House Nbg
DI PA CI R&D 3
Gleiwitzer Str. 555
90475 Nuernberg, Germany
stefan-koch at siemens.com <mailto:[email protected]>
www.siemens.com/ingenuityforlife
<https://siemens.com/ingenuityforlife>
www.siemens.com/ingenuityforlife
Siemens Aktiengesellschaft: Chairman of the Supervisory Board: Jim
Hagemann Snabe; Managing Board: Joe Kaeser, Chairman, President and Chief Executive Officer; Roland Busch, Lisa Davis, Klaus Helmrich, Janina Kugel, Cedrik Neike, Michael Sen, Ralf P. Thomas; Registered offices: Berlin and Munich, Germany; Commercial
registries: Berlin Charlottenburg, HRB 12300, Munich, HRB 6684;
WEEE-Reg.-No. DE 23691322_______________________________________________
cip-dev mailing list
cip-dev at lists.cip-project.org
https://lists.cip-project.org/mailman/listinfo/cip-dev
PATCH 1/1 gpiolib: Fix invalid access of nullptr
In reply to Fabrizio CastroHi Fabrizio, Stefan,
Quoted 12 lines
-----Original Message-----
From: Fabrizio Castro [mailto:fabrizio.castro at bp.renesas.com]
Sent: Tuesday, December 3, 2019 12:43 AM
To: Koch, Stefan <[email protected]>;
cip-dev at lists.cip-project.org
Cc: pavel at denx.de; iwamatsu nobuhiro(?? ?? ????????) <[email protected]>; Chris Paterson <[email protected]>; Biju Das <[email protected]>
Subject: RE: [PATCH 4.4.y-cip] gpiolib: Fix invalid access of nullptrHi Stefan,
Quoted 8 lines
That's a known problem, please have a look at:
https://patchwork.kernel.org/patch/11235267/Pavel, Iwamatsu-san, could you please take patch:
https://patchwork.kernel.org/patch/11235267/I think this is quite urgent as others will stumble across the problem and will try and fix it.
OK, I will apply this with following comment if there is no other opinion.
NOTE: gpiochip_add_data()'s fixes is based on 6ff0497402ef7269ee6a72f62eb85adaa7a4768e.
Best regards,
Nobuhiro
PATCH 1/1 gpiolib: Fix invalid access of nullptr
Hi Iwamatsu-san,
Thank you for your feedback!
Quoted 24 lines
From: nobuhiro1.iwamatsu at toshiba.co.jp <[email protected]>
Sent: 04 December 2019 00:20
Subject: RE: [PATCH 4.4.y-cip] gpiolib: Fix invalid access of nullptrHi Fabrizio, Stefan,
Quoted 18 lines
-----Original Message-----
From: Fabrizio Castro [mailto:fabrizio.castro at bp.renesas.com]
Sent: Tuesday, December 3, 2019 12:43 AM
To: Koch, Stefan <[email protected]>;
cip-dev at lists.cip-project.org
Cc: pavel at denx.de; iwamatsu nobuhiro(?? ?? ????????) <[email protected]>; Chris Paterson <[email protected]>; Biju Das <[email protected]>
Subject: RE: [PATCH 4.4.y-cip] gpiolib: Fix invalid access of nullptrHi Stefan,
That's a known problem, please have a look at:
https://patchwork.kernel.org/patch/11235267/Pavel, Iwamatsu-san, could you please take patch:
https://patchwork.kernel.org/patch/11235267/
Quoted 6 lines
Quoted 2 lines
I think this is quite urgent as others will stumble across the problem and will try and fix it.
OK, I will apply this with following comment if there is no other opinion.
NOTE: gpiochip_add_data()'s fixes is based on
6ff0497402ef7269ee6a72f62eb85adaa7a4768e.
Great, thanks!
Fab
Quoted 4 lines
Best regards,
Nobuhiro
PATCH 1/1 gpiolib: Fix invalid access of nullptr
In reply to nobuhiro1.iwamatsu at toshiba.co.jpHi!
Quoted 6 lines
Quoted 6 lines
That's a known problem, please have a look at:
https://patchwork.kernel.org/patch/11235267/Pavel, Iwamatsu-san, could you please take patch:
https://patchwork.kernel.org/patch/11235267/
Quoted 6 lines
Quoted 2 lines
I think this is quite urgent as others will stumble across the problem and will try and fix it.
OK, I will apply this with following comment if there is no other opinion.
NOTE: gpiochip_add_data()'s fixes is based on
6ff0497402ef7269ee6a72f62eb85adaa7a4768e.
Sounds good to me.
Best regards,
Pavel
Signature · 9 lines
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 195 bytes Desc: not available URL: <http://lists.cip-project.org/pipermail/cip-dev/attachments/20191204/16963314/attachment.sig>
PATCH 1/1 gpiolib: Fix invalid access of nullptr
Quoted 21 lines
-----Original Message-----
From: Pavel Machek [mailto:pavel at denx.de]
Sent: Wednesday, December 4, 2019 9:37 PM
To: iwamatsu nobuhiro(?? ?? ????????) <[email protected]>
Cc: fabrizio.castro at bp.renesas.com; stefan-koch at siemens.com; cip-dev at lists.cip-project.org; pavel at denx.de; Chris.Paterson2 at renesas.com; biju.das at bp.renesas.com
Subject: Re: [PATCH 4.4.y-cip] gpiolib: Fix invalid access of nullptrHi!
Quoted 9 lines
Quoted 8 lines
That's a known problem, please have a look at:
https://patchwork.kernel.org/patch/11235267/Pavel, Iwamatsu-san, could you please take patch:
https://patchwork.kernel.org/patch/11235267/I think this is quite urgent as others will stumble across the problem and will try and fix it.
Quoted 6 lines
Quoted 3 lines
OK, I will apply this with following comment if there is no other opinion.
NOTE: gpiochip_add_data()'s fixes is based on
6ff0497402ef7269ee6a72f62eb85adaa7a4768e.Sounds good to me.
Applied.
Best regards,
Nobuhiro
PATCH 1/1 gpiolib: Fix invalid access of nullptr
Hello all,
Quoted 18 lines
From: nobuhiro1.iwamatsu at toshiba.co.jp
<[email protected]>
Sent: 04 December 2019 23:21Quoted 14 lines
From: Pavel Machek [mailto:pavel at denx.de]
Sent: Wednesday, December 4, 2019 9:37 PMHi!
Quoted 9 lines
Quoted 8 lines
That's a known problem, please have a look at:
https://patchwork.kernel.org/patch/11235267/Pavel, Iwamatsu-san, could you please take patch:
https://patchwork.kernel.org/patch/11235267/I think this is quite urgent as others will stumble across the problem and will try and fix it.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
OK, I will apply this with following comment if there is no other opinion.
NOTE: gpiochip_add_data()'s fixes is based on
6ff0497402ef7269ee6a72f62eb85adaa7a4768e.Sounds good to me.
Applied.
This patch seems to have broken builds for 2/16 of our v4.4.y-cip configurations.
Pipeline: https://gitlab.com/cip-project/cip-kernel/linux-cip/pipelines/100757773
1) x86_plathome_obsvx1.config: https://gitlab.com/cip-project/cip-kernel/linux-cip/-/jobs/369871332
Error log:
3274 drivers/gpio/gpiolib.c: In function 'gpiochip_add_data':
3275 drivers/gpio/gpiolib.c:363:12: error: 'struct gpio_chip' has no member named 'of_node'
3276 if ((!chip->of_node) && (chip->dev))
3277 ^~
3278 drivers/gpio/gpiolib.c:364:7: error: 'struct gpio_chip' has no member named 'of_node'
3279 chip->of_node = chip->dev->of_node;
3280 ^~
3281 CC drivers/dma/ioat/prep.o
3282 scripts/Makefile.build:277: recipe for target 'drivers/gpio/gpiolib.o' failed 3283 make[2]: *** [drivers/gpio/gpiolib.o] Error 1
3284 scripts/Makefile.build:484: recipe for target 'drivers/gpio' failed 3285 make[1]: *** [drivers/gpio] Error 2
3286 make[1]: *** Waiting for unfinished jobs....
2) x86_siemens_iot2000.config: https://gitlab.com/cip-project/cip-kernel/linux-cip/-/jobs/369871333
Error log:
2729 drivers/gpio/gpiolib.c: In function 'gpiochip_add_data':
2730 drivers/gpio/gpiolib.c:363:12: error: 'struct gpio_chip' has no member named 'of_node'
2731 if ((!chip->of_node) && (chip->dev))
2732 ^~
2733 drivers/gpio/gpiolib.c:364:7: error: 'struct gpio_chip' has no member named 'of_node'
2734 chip->of_node = chip->dev->of_node;
2735 ^~
2736 scripts/Makefile.build:277: recipe for target 'drivers/gpio/gpiolib.o' failed 2737 make[2]: *** [drivers/gpio/gpiolib.o] Error 1
2738 make[1]: *** [drivers/gpio] Error 2
2739 make[1]: *** Waiting for unfinished jobs....
2740 scripts/Makefile.build:484: recipe for target 'drivers/gpio' failed
Kind regards, Chris
Quoted 3 lines
Best regards,
Nobuhiro
PATCH 1/1 gpiolib: Fix invalid access of nullptr
Hi Chris,
Thank you for your feedback!
Quoted 59 lines
From: Chris Paterson <[email protected]>
Sent: 05 December 2019 09:44
To: nobuhiro1.iwamatsu at toshiba.co.jp; pavel at denx.de
Cc: Fabrizio Castro <[email protected]>; stefan-koch at siemens.com; cip-dev at lists.cip-project.org; Biju Das <[email protected]>
Subject: RE: [PATCH 4.4.y-cip] gpiolib: Fix invalid access of nullptrHello all,
Quoted 18 lines
From: nobuhiro1.iwamatsu at toshiba.co.jp
<[email protected]>
Sent: 04 December 2019 23:21Quoted 14 lines
From: Pavel Machek [mailto:pavel at denx.de]
Sent: Wednesday, December 4, 2019 9:37 PMHi!
Quoted 9 lines
Quoted 8 lines
That's a known problem, please have a look at:
https://patchwork.kernel.org/patch/11235267/Pavel, Iwamatsu-san, could you please take patch:
https://patchwork.kernel.org/patch/11235267/I think this is quite urgent as others will stumble across the problem and will try and fix it.
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
OK, I will apply this with following comment if there is no other opinion.
NOTE: gpiochip_add_data()'s fixes is based on
6ff0497402ef7269ee6a72f62eb85adaa7a4768e.Sounds good to me.
Applied.
This patch seems to have broken builds for 2/16 of our v4.4.y-cip configurations.
Pipeline: https://gitlab.com/cip-project/cip-kernel/linux-cip/pipelines/1007577731) x86_plathome_obsvx1.config: https://gitlab.com/cip-project/cip-kernel/linux-cip/-/jobs/369871332
Error log:
3274drivers/gpio/gpiolib.c: In function 'gpiochip_add_data':
3275drivers/gpio/gpiolib.c:363:12: error: 'structgpio_chip' has no member named 'of_node'
3276 if ((!chip->of_node) && (chip->dev))
3277 ^~
3278drivers/gpio/gpiolib.c:364:7: error: 'structgpio_chip' has no member named 'of_node'
3279chip->of_node=chip->dev->of_node;
3280 ^~
3281 CCdrivers/dma/ioat/prep.o
3282scripts/Makefile.build:277: recipe for target 'drivers/gpio/gpiolib.o' failed 3283 make[2]: *** [drivers/gpio/gpiolib.o] Error 1
3284scripts/Makefile.build:484: recipe for target 'drivers/gpio' failed 3285 make[1]: *** [drivers/gpio] Error 2
3286 make[1]: *** Waiting for unfinished jobs....2) x86_siemens_iot2000.config: https://gitlab.com/cip-project/cip-kernel/linux-cip/-/jobs/369871333
Quoted 13 lines
Error log:
2729drivers/gpio/gpiolib.c: In function 'gpiochip_add_data':
2730drivers/gpio/gpiolib.c:363:12: error: 'structgpio_chip' has no member named 'of_node'
2731 if ((!chip->of_node) && (chip->dev))
2732 ^~
2733drivers/gpio/gpiolib.c:364:7: error: 'structgpio_chip' has no member named 'of_node'
2734chip->of_node=chip->dev->of_node;
2735 ^~
2736scripts/Makefile.build:277: recipe for target 'drivers/gpio/gpiolib.o' failed 2737 make[2]: *** [drivers/gpio/gpiolib.o] Error 1
2738 make[1]: *** [drivers/gpio] Error 2
2739 make[1]: *** Waiting for unfinished jobs....
2740scripts/Makefile.build:484: recipe for target 'drivers/gpio' failed
This makes a lot of sense, Intel would not have CONFIG_OF_GPIO set! I'll send another version.
Thanks,
Fab
Quoted 7 lines
Kind regards, Chris
Quoted 3 lines
Best regards,
Nobuhiro