RTDM: Fix potential NULL pointer dereference
The following changes since commit 6b3e8f2e5c69397814cb2f4029cdfbaff16e113e:
Gilles Chanteperdrix (1):
doc: regenerate
are available in the git repository at:
git://git.xenomai.org/xenomai-jki.git for-upstream
Unfortunately too late for 2.5.2, fortunately only relevant if something else went wrong in create_instance (ENOMEM or application error).
Wolfgang Mauerer (1):
RTDM: Fix potential NULL pointer dereference
ksrc/skins/rtdm/core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 8 lines · Jan Kiszka
The following changes since commit
6b3e8f2e5c69397814cb2f4029cdfbaff16e113e:
Gilles Chanteperdrix (1):
doc: regenerateare available in the git repository at:
git://git.xenomai.org/xenomai-jki.gitfor-upstream
Quoted 9 lines
Unfortunately too late for 2.5.2, fortunately only relevant if something else went wrong in
create_instance(ENOMEM or application error).Wolfgang Mauerer (1):
RTDM: Fix potential NULL pointer dereferenceksrc/skins/rtdm/core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Was not there any plan to remove this code and have a more "posix compliant" close? I thought this had been merged?
Signature · 1 line
Gilles.
Quoted 15 lines · Gilles Chanteperdrix
Quoted 14 lines · Jan Kiszka
The following changes since commit
6b3e8f2e5c69397814cb2f4029cdfbaff16e113e:
Gilles Chanteperdrix (1):
doc: regenerateare available in the git repository at:
git://git.xenomai.org/xenomai-jki.gitfor-upstreamUnfortunately too late for 2.5.2, fortunately only relevant if something else went wrong in
create_instance(ENOMEM or application error).Wolfgang Mauerer (1):
RTDM: Fix potential NULL pointer dereference
Quoted 6 lines
Quoted 3 lines
ksrc/skins/rtdm/core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)Was not there any plan to remove this code and have a more "posix compliant" close? I thought this had been merged?
Yes. But that requires more work than it would have been appropriate for 2.5.2.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 16 lines · Jan Kiszka
Quoted 15 lines · Gilles Chanteperdrix
Quoted 14 lines · Jan Kiszka
The following changes since commit
6b3e8f2e5c69397814cb2f4029cdfbaff16e113e:
Gilles Chanteperdrix (1):
doc: regenerateare available in the git repository at:
git://git.xenomai.org/xenomai-jki.gitfor-upstreamUnfortunately too late for 2.5.2, fortunately only relevant if something else went wrong in
create_instance(ENOMEM or application error).Wolfgang Mauerer (1):
RTDM: Fix potential NULL pointer dereference
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
ksrc/skins/rtdm/core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)Was not there any plan to remove this code and have a more "posix compliant" close? I thought this had been merged?
Yes. But that requires more work than it would have been appropriate for 2.5.2.
Ok, but could we have it for 2.5.3?
Signature · 1 line
Gilles.
Quoted 20 lines · Gilles Chanteperdrix
Quoted 19 lines · Jan Kiszka
Quoted 18 lines · Gilles Chanteperdrix
Quoted 17 lines · Jan Kiszka
The following changes since commit
6b3e8f2e5c69397814cb2f4029cdfbaff16e113e:
Gilles Chanteperdrix (1):
doc: regenerateare available in the git repository at:
git://git.xenomai.org/xenomai-jki.gitfor-upstreamUnfortunately too late for 2.5.2, fortunately only relevant if something else went wrong in
create_instance(ENOMEM or application error).Wolfgang Mauerer (1):
RTDM: Fix potential NULL pointer dereferenceksrc/skins/rtdm/core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
Was not there any plan to remove this code and have a more "posix compliant" close? I thought this had been merged?
Yes. But that requires more work than it would have been appropriate for 2.5.2.
Ok, but could we have it for 2.5.3?
Will see what I can do (no budget for this, so no promise).
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 21 lines · Jan Kiszka
Quoted 20 lines · Gilles Chanteperdrix
Quoted 19 lines · Jan Kiszka
Quoted 18 lines · Gilles Chanteperdrix
Quoted 17 lines · Jan Kiszka
The following changes since commit
6b3e8f2e5c69397814cb2f4029cdfbaff16e113e:
Gilles Chanteperdrix (1):
doc: regenerateare available in the git repository at:
git://git.xenomai.org/xenomai-jki.gitfor-upstreamUnfortunately too late for 2.5.2, fortunately only relevant if something else went wrong in
create_instance(ENOMEM or application error).Wolfgang Mauerer (1):
RTDM: Fix potential NULL pointer dereferenceksrc/skins/rtdm/core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Was not there any plan to remove this code and have a more "posix compliant" close? I thought this had been merged?
Yes. But that requires more work than it would have been appropriate for 2.5.2.
Ok, but could we have it for 2.5.3?
Will see what I can do (no budget for this, so no promise).
The patches are floating around for some time (I was in CC of the mail Philippe sent you about this some time ago), I guess some testing is needed, this is why you need some time? Could we help with this testing?
Quoted 3 lines
Jan
Signature · 1 line
Gilles.
Quoted 26 lines · Gilles Chanteperdrix
Quoted 25 lines · Jan Kiszka
Quoted 24 lines · Gilles Chanteperdrix
Quoted 23 lines · Jan Kiszka
Quoted 12 lines · Gilles Chanteperdrix
Quoted 11 lines · Jan Kiszka
The following changes since commit
6b3e8f2e5c69397814cb2f4029cdfbaff16e113e:
Gilles Chanteperdrix (1):
doc: regenerateare available in the git repository at:
git://git.xenomai.org/xenomai-jki.gitfor-upstreamUnfortunately too late for 2.5.2, fortunately only relevant if something else went wrong in
create_instance(ENOMEM or application error).Quoted 8 lines
Quoted 6 lines
Wolfgang Mauerer (1):
RTDM: Fix potential NULL pointer dereferenceksrc/skins/rtdm/core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)Was not there any plan to remove this code and have a more "posix compliant" close? I thought this had been merged?
Yes. But that requires more work than it would have been appropriate for 2.5.2.
Quoted 8 lines
Quoted 3 lines
Quoted 2 lines
Ok, but could we have it for 2.5.3?
Will see what I can do (no budget for this, so no promise).
The patches are floating around for some time (I was in CC of the mail Philippe sent you about this some time ago), I guess some testing is needed, this is why you need some time? Could we help with this testing?
Then I totally lost track of this. What series are you referring to?
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 29 lines · Jan Kiszka
Quoted 28 lines · Gilles Chanteperdrix
Quoted 27 lines · Jan Kiszka
Quoted 26 lines · Gilles Chanteperdrix
Quoted 16 lines · Jan Kiszka
Quoted 15 lines · Gilles Chanteperdrix
Quoted 14 lines · Jan Kiszka
The following changes since commit
6b3e8f2e5c69397814cb2f4029cdfbaff16e113e:
Gilles Chanteperdrix (1):
doc: regenerateare available in the git repository at:
git://git.xenomai.org/xenomai-jki.gitfor-upstreamUnfortunately too late for 2.5.2, fortunately only relevant if something else went wrong in
create_instance(ENOMEM or application error).Wolfgang Mauerer (1):
RTDM: Fix potential NULL pointer dereferenceQuoted 7 lines
Quoted 5 lines
Quoted 3 lines
ksrc/skins/rtdm/core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)Was not there any plan to remove this code and have a more "posix compliant" close? I thought this had been merged?
Yes. But that requires more work than it would have been appropriate for 2.5.2.
Ok, but could we have it for 2.5.3?
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Will see what I can do (no budget for this, so no promise).
The patches are floating around for some time (I was in CC of the mail Philippe sent you about this some time ago), I guess some testing is needed, this is why you need some time? Could we help with this testing?
Then I totally lost track of this. What series are you referring to?
A (private) mail entitled "Re: RTDM close() refactoring" from Philippe, with in fact, a unique patch.
Signature · 1 line
Gilles.
Quoted 31 lines · Gilles Chanteperdrix
Quoted 30 lines · Jan Kiszka
Quoted 29 lines · Gilles Chanteperdrix
Quoted 28 lines · Jan Kiszka
Quoted 17 lines · Gilles Chanteperdrix
Quoted 16 lines · Jan Kiszka
Quoted 15 lines · Gilles Chanteperdrix
Quoted 14 lines · Jan Kiszka
The following changes since commit
6b3e8f2e5c69397814cb2f4029cdfbaff16e113e:
Gilles Chanteperdrix (1):
doc: regenerateare available in the git repository at:
git://git.xenomai.org/xenomai-jki.gitfor-upstreamUnfortunately too late for 2.5.2, fortunately only relevant if something else went wrong in
create_instance(ENOMEM or application error).Wolfgang Mauerer (1):
RTDM: Fix potential NULL pointer dereferenceQuoted 9 lines
Quoted 7 lines
Quoted 5 lines
Quoted 3 lines
ksrc/skins/rtdm/core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)Was not there any plan to remove this code and have a more "posix compliant" close? I thought this had been merged?
Yes. But that requires more work than it would have been appropriate for 2.5.2.
Ok, but could we have it for 2.5.3?
Will see what I can do (no budget for this, so no promise).
Quoted 9 lines
Quoted 5 lines
Quoted 4 lines
The patches are floating around for some time (I was in CC of the mail Philippe sent you about this some time ago), I guess some testing is needed, this is why you need some time? Could we help with this testing?
Then I totally lost track of this. What series are you referring to?
A (private) mail entitled "Re: RTDM
close()refactoring" from Philippe, with in fact, a unique patch.
Ah, now I found it. That discussion ended last September with a "Don't bother yet" by Philippe as he said you pointed out some remaining issues /wrt POSIX compliance. So I stopped bothering.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux
Quoted 36 lines · Jan Kiszka
Quoted 35 lines · Gilles Chanteperdrix
Quoted 34 lines · Jan Kiszka
Quoted 33 lines · Gilles Chanteperdrix
Quoted 21 lines · Jan Kiszka
Quoted 20 lines · Gilles Chanteperdrix
Quoted 19 lines · Jan Kiszka
Quoted 18 lines · Gilles Chanteperdrix
Quoted 17 lines · Jan Kiszka
The following changes since commit
6b3e8f2e5c69397814cb2f4029cdfbaff16e113e:
Gilles Chanteperdrix (1):
doc: regenerateare available in the git repository at:
git://git.xenomai.org/xenomai-jki.gitfor-upstreamUnfortunately too late for 2.5.2, fortunately only relevant if something else went wrong in
create_instance(ENOMEM or application error).Wolfgang Mauerer (1):
RTDM: Fix potential NULL pointer dereferenceksrc/skins/rtdm/core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Was not there any plan to remove this code and have a more "posix compliant" close? I thought this had been merged?
Yes. But that requires more work than it would have been appropriate for 2.5.2.
Ok, but could we have it for 2.5.3?
Will see what I can do (no budget for this, so no promise).
The patches are floating around for some time (I was in CC of the mail Philippe sent you about this some time ago), I guess some testing is needed, this is why you need some time? Could we help with this testing?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Then I totally lost track of this. What series are you referring to?
A (private) mail entitled "Re: RTDM
close()refactoring" from Philippe, with in fact, a unique patch.Ah, now I found it. That discussion ended last September with a "Don't bother yet" by Philippe as he said you pointed out some remaining issues /wrt POSIX compliance. So I stopped bothering.
There was a reply "here it is", with a fixed version. Inlined here.
include/asm-generic/wrappers.h +5 -0
@@ -536,4 +536,9 @@ static inline void wrap_proc_dir_entry_owner(struct proc_dir_entry *entry)#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(2,6,30) */ #endif /* CONFIG_PROC_FS */ +#ifndef list_first_entry +#define list_first_entry (ptr, type, member) \ + list_entry((ptr)->next, type, member) +#endif +#endif /* _XENO_ASM_GENERIC_WRAPPERS_H */
include/rtdm/rtdm_driver.h +10 -1
@@ -368,6 +368,7 @@ struct rtdm_operations {struct rtdm_devctx_reserved {void *owner; +struct list_head cleanup; };/**
@@ -549,9 +550,17 @@ static inline void rtdm_context_lock(struct rtdm_dev_context *context)atomic_inc (&context->close_lock_count); } +void __rtdm_context_flush (struct rtdm_dev_context *context); +static inline void rtdm_context_unlock (struct rtdm_dev_context *context) { -atomic_dec (&context->close_lock_count); +if (atomic_dec_and_test (&context->close_lock_count)) +__rtdm_context_flush (context); +} + +static inline void rtdm_context_put (struct rtdm_dev_context *context) +{ +rtdm_context_unlock (context); }/* --- clock services --- */
ksrc/skins/rtdm/core.c +181 -67
354 lines not on this page · raw message
ksrc/skins/rtdm/device.c +18 -3
@@ -55,6 +55,7 @@ MODULE_PARM_DESC(protocol_hashtab_size,struct list_head *rtdm_named_devices;/* hash table */ struct list_head *rtdm_protocol_devices;/* hash table */ +int rtdm_apc;static int name_hashkey_mask;static int proto_hashkey_mask;
@@ -238,12 +239,12 @@ int rtdm_dev_register(struct rtdm_device *device)/* Sanity check: non-RT close handler? * (Always required for forced cleanup) */ -if (!device->ops.close_nrt) { +if (device->ops.close_nrt ==NULL ) {xnlogerr ("RTDM: missing non-RT close handler\n" );return -EINVAL ; } -if (!device->ops.close_rt) - device->ops.close_rt = (void *)rtdm_no_support; +if (device->ops.close_rt) +xnlogerr ("RTDM: RT close handler is deprecated - convert to NRT\n" );SET_DEFAULT_OP_IF_NULL (device->ops, ioctl);SET_DEFAULT_OP_IF_NULL (device->ops, read);
@@ -448,6 +449,10 @@ int __init rtdm_dev_init(void) {int i; + rtdm_apc =rthal_apc_alloc ("rtdm_handler" , rtdm_apc_handler,NULL ); +if (rtdm_apc <0 ) +return rtdm_apc; + name_hashkey_mask = devname_hashtab_size -1 ; proto_hashkey_mask = protocol_hashtab_size -1 ; if (((devname_hashtab_size & name_hashkey_mask) != 0) ||
@@ -477,4 +482,14 @@ int __init rtdm_dev_init(void)return 0 ; } +void __exit rtdm_dev_cleanup(void) +{ +rthal_apc_free (rtdm_apc); + rtdm_apc =-1 ; +xnarch_memory_barrier (); +flush_scheduled_work (); +kfree (rtdm_named_devices); +kfree (rtdm_protocol_devices); +} +/*@}*/
ksrc/skins/rtdm/internal.h +3 -6
@@ -58,6 +58,7 @@ extern unsigned int protocol_hashtab_size;extern struct list_head *rtdm_named_devices;extern struct list_head *rtdm_protocol_devices;extern struct proc_dir_entry *rtdm_proc_root; +extern int rtdm_apc;#ifdef MODULE #define rtdm_initialised 1
@@ -76,15 +77,11 @@ static inline void rtdm_dereference_device(struct rtdm_device *device) }int __init rtdm_dev_init (void ); - -static inline void rtdm_dev_cleanup (void ) -{ -kfree (rtdm_named_devices); -kfree (rtdm_protocol_devices); -} +void __exit rtdm_dev_cleanup(void);int rtdm_proc_register_device (struct rtdm_device *device);int __init rtdm_proc_init (void );void rtdm_proc_cleanup (void ); +void rtdm_apc_handler (void *cookie);#endif /* _RTDM_INTERNAL_H */
Signature · 1 line
Gilles.
Quoted 36 lines · Jan Kiszka
Quoted 35 lines · Gilles Chanteperdrix
Quoted 34 lines · Jan Kiszka
Quoted 33 lines · Gilles Chanteperdrix
Quoted 21 lines · Jan Kiszka
Quoted 20 lines · Gilles Chanteperdrix
Quoted 19 lines · Jan Kiszka
Quoted 18 lines · Gilles Chanteperdrix
Quoted 17 lines · Jan Kiszka
The following changes since commit
6b3e8f2e5c69397814cb2f4029cdfbaff16e113e:
Gilles Chanteperdrix (1):
doc: regenerateare available in the git repository at:
git://git.xenomai.org/xenomai-jki.gitfor-upstreamUnfortunately too late for 2.5.2, fortunately only relevant if something else went wrong in
create_instance(ENOMEM or application error).Wolfgang Mauerer (1):
RTDM: Fix potential NULL pointer dereferenceksrc/skins/rtdm/core.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)Quoted 7 lines
Quoted 6 lines
Quoted 4 lines
Quoted 2 lines
Was not there any plan to remove this code and have a more "posix compliant" close? I thought this had been merged?
Yes. But that requires more work than it would have been appropriate for 2.5.2.
Ok, but could we have it for 2.5.3?
Will see what I can do (no budget for this, so no promise).
The patches are floating around for some time (I was in CC of the mail Philippe sent you about this some time ago), I guess some testing is needed, this is why you need some time? Could we help with this testing?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
Then I totally lost track of this. What series are you referring to?
A (private) mail entitled "Re: RTDM
close()refactoring" from Philippe, with in fact, a unique patch.Ah, now I found it. That discussion ended last September with a "Don't bother yet" by Philippe as he said you pointed out some remaining issues /wrt POSIX compliance. So I stopped bothering.
Oh, no, it stopped with an update I wanted to look at. OK, that got lost on my side. (Better to have that on the list instead of my overfull inbox next time.)
Will see if it still applies.
Jan
Signature · 2 lines
Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux