2.6.27.50-stable review
cover 2.6.27.50-stable review
This is the start of the stable review cycle for the 2.6.27.50 release. There are 4 patches in this series, all will be posted as a response to this one. If anyone has any issues with these being applied, please let us know. If anyone is a maintainer of the proper subsystem, and wants to add a Signed-off-by: line to the patch, please respond with it.
Responses should be made by August 8, 2010, 18:00:00 UTC. Anything received after that time might be too late.
The whole patch series can be found in one patch at:
kernel.org/pub/linux/kernel/v2.6/stable-review/patch-2.6.27.50-rc1.gz
and the diffstat can be found below.
thanks,
greg k-h
Makefile | 2 +- drivers/misc/enclosure.c | 7 +++++-- drivers/parisc/led.c | 6 ++++-- fs/gfs2/dir.c | 2 +- fs/xfs/xfs_dfrag.c | 5 ++++- 5 files changed, 15 insertions(+), 7 deletions(-)
PATCH 1/4 PARISC: led.c - fix potential stack overflow in led_proc_write()
2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Helge Deller <[email protected]>
commit 4b4fd27c0b5ec638a1f06ced9226fd95229dbbf0 upstream.
avoid potential stack overflow by correctly checking count parameter
--- drivers/parisc/led.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
drivers/parisc/led.c +4 -2
@@ -182,16 +182,18 @@ static int led_proc_read(char *page, chastatic int led_proc_write (struct file *file,const char *buf,unsigned long count,void *data) { -char *cur, lbuf[count +1 ]; +char *cur, lbuf[32 ];int d;if (!capable (CAP_SYS_ADMIN ))return -EACCES ; -memset (lbuf,0 , count +1 ); +if (count >=sizeof (lbuf)) + count =sizeof (lbuf)-1 ;if (copy_from_user (lbuf, buf, count))return -EFAULT ; + lbuf[count] =0 ; cur = lbuf;
PATCH 2/4 xfs: prevent swapext from operating on write-only files
In reply to Greg KH2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Rosenberg <[email protected]>
commit 1817176a86352f65210139d4c794ad2d19fc6b63 upstream.
This patch prevents user "foo" from using the SWAPEXT ioctl to swap a write-only file owned by user "bar" into a file owned by "foo" and subsequently reading it. It does so by checking that the file descriptors passed to the ioctl are also opened for reading.
--- fs/xfs/xfs_dfrag.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
fs/xfs/xfs_dfrag.c +4 -1
@@ -74,7 +74,9 @@ xfs_swapext( goto out_free_sxp; } -if (!(file->f_mode &FMODE_WRITE ) || (file->f_flags &O_APPEND )) { +if (!(file->f_mode &FMODE_WRITE ) || + !(file->f_mode &FMODE_READ ) || + (file->f_flags &O_APPEND )) { error =XFS_ERROR (EBADF ); goto out_put_file; }
@@ -86,6 +88,7 @@ xfs_swapext( }if (!(target_file->f_mode &FMODE_WRITE ) || + !(target_file->f_mode &FMODE_READ ) || (target_file->f_flags &O_APPEND )) { error =XFS_ERROR (EBADF ); goto out_put_target_file;
PATCH 3/4 SCSI: enclosure: fix error path - actually return ERR_PTR() on error
In reply to Greg KH2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: James Bottomley <[email protected]>
commit a91c1be21704113b023919826c6d531da46656ef upstream.
we also need to clean up and free the cdev.
--- drivers/misc/enclosure.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-)
drivers/misc/enclosure.c +5 -2
@@ -264,8 +264,11 @@ enclosure_component_register(struct encl cdev->groups = enclosure_groups; err =device_register (cdev); -if (err) -ERR_PTR (err); +if (err) { + ecomp->number =-1 ; +put_device (cdev); +return ERR_PTR (err); + }return ecomp; }
PATCH 4/4 GFS2: rename causes kernel Oops
In reply to Greg KH2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Bob Peterson <[email protected]>
commit 728a756b8fcd22d80e2dbba8117a8a3aafd3f203 upstream.
This patch fixes a kernel Oops in the GFS2 rename code.
The problem was in the way the gfs2 directory code was trying to re-use sentinel directory entries.
In the failing case, gfs2's rename function was renaming a file to another name that had the same non-trivial length. The file being renamed happened to be the first directory entry on the leaf block.
First, the rename code (gfs2_rename in ops_inode.c) found the original directory entry and decided it could do its job by simply replacing the directory entry with another. Therefore it determined correctly that no block allocations were needed.
Next, the rename code deleted the old directory entry prior to replacing it with the new name. Therefore, the soon-to-be replaced directory entry was temporarily made into a directory entry "sentinel" or a place holder at the start of a leaf block.
Lastly, it went to re-add the replacement directory entry in that leaf block. However, when gfs2_dirent_find_space was looking for space in the leaf block, it used the wrong value for the sentinel. That threw off its calculations so later it decides it can't really re-use the sentinel and therefore must allocate a new leaf block. But because it previously decided to re-use the directory entry, it didn't waste the time to grab a new block allocation for the inode. Therefore, the inode's i_alloc pointer was still NULL and it crashes trying to reference it.
In the case of sentinel directory entries, the entire dirent is reused, not just the "free space" portion of it, and therefore the function gfs2_dirent_find_space should use the value 0 rather than GFS2_DIRENT_SIZE(0) for the actual dirent size.
Fixing this calculation enables the reproducer programs to work properly.
--- fs/gfs2/dir.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/gfs2/dir.c +1 -1
@@ -393,7 +393,7 @@ static int gfs2_dirent_find_space(constunsigned totlen =be16_to_cpu (dent->de_rec_len);if (gfs2_dirent_sentinel (dent)) - actual =GFS2_DIRENT_SIZE (0 ); + actual =0 ;if (totlen - actual >= required)return 1 ;return 0 ;