The patch titled ipc: make shm_get_stat() more robust has been added to the -mm tree. Its filename is make-shm_get_stat-more-robust.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/SubmitChecklist when testing your code *** See http://userweb.kernel.org/~akpm/stuff/added-to-mm.txt to find out what to do about this The current -mm tree may be found at http://userweb.kernel.org/~akpm/mmotm/ ------------------------------------------------------ Subject: ipc: make shm_get_stat() more robust From: Tony Battersby <tonyb@xxxxxxxxxxxxxxx> shm_get_stat() assumes idr_find(&shm_ids(ns).ipcs_idr) returns "struct shmid_kernel *"; all other callers assume that it returns "struct kern_ipc_perm *". This works because "struct kern_ipc_perm" is currently the first member of "struct shmid_kernel", but it would be better to use container_of() to prevent future breakage. Signed-off-by: Tony Battersby <tonyb@xxxxxxxxxxxxxxx> Cc: Jiri Olsa <olsajiri@xxxxxxxxx> Cc: Jiri Kosina <jkosina@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- ipc/shm.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff -puN ipc/shm.c~make-shm_get_stat-more-robust ipc/shm.c --- a/ipc/shm.c~make-shm_get_stat-more-robust +++ a/ipc/shm.c @@ -551,12 +551,14 @@ static void shm_get_stat(struct ipc_name in_use = shm_ids(ns).in_use; for (total = 0, next_id = 0; total < in_use; next_id++) { + struct kern_ipc_perm *ipc; struct shmid_kernel *shp; struct inode *inode; - shp = idr_find(&shm_ids(ns).ipcs_idr, next_id); - if (shp == NULL) + ipc = idr_find(&shm_ids(ns).ipcs_idr, next_id); + if (ipc == NULL) continue; + shp = container_of(ipc, struct shmid_kernel, shm_perm); inode = shp->shm_file->f_path.dentry->d_inode; diff -puN /dev/null /dev/null _ Patches currently in -mm which might be from tonyb@xxxxxxxxxxxxxxx are linux-next.patch dmar-fix-endless-unknown-dmar-structure-type-loop.patch shm-fix-shmctlshm_info-lockup-with-config_shmem.patch make-shm_get_stat-more-robust.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html