* [1/4] PARISC: led.c - fix potential stack overflow in led_proc_write()
2010-08-06 18:27 [0/4] 2.6.27.50-stable review Greg KH
@ 2010-08-06 17:54 ` Greg KH
2010-08-06 17:54 ` [2/4] xfs: prevent swapext from operating on write-only files Greg KH
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2010-08-06 17:54 UTC (permalink / raw)
To: linux-kernel, stable
Cc: stable-review, torvalds, akpm, alan, Helge Deller, Kyle McMartin,
James E.J. Bottomley
2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Helge Deller <deller@gmx.de>
commit 4b4fd27c0b5ec638a1f06ced9226fd95229dbbf0 upstream.
avoid potential stack overflow by correctly checking count parameter
Reported-by: Ilja <ilja@netric.org>
Signed-off-by: Helge Deller <deller@gmx.de>
Acked-by: Kyle McMartin <kyle@mcmartin.ca>
Cc: James E.J. Bottomley <jejb@parisc-linux.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/parisc/led.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- a/drivers/parisc/led.c
+++ b/drivers/parisc/led.c
@@ -182,16 +182,18 @@ static int led_proc_read(char *page, cha
static 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;
^ permalink raw reply [flat|nested] 5+ messages in thread
* [2/4] xfs: prevent swapext from operating on write-only files
2010-08-06 18:27 [0/4] 2.6.27.50-stable review Greg KH
2010-08-06 17:54 ` [1/4] PARISC: led.c - fix potential stack overflow in led_proc_write() Greg KH
@ 2010-08-06 17:54 ` Greg KH
2010-08-06 17:54 ` [3/4] SCSI: enclosure: fix error path - actually return ERR_PTR() on error Greg KH
2010-08-06 17:54 ` [4/4] GFS2: rename causes kernel Oops Greg KH
3 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2010-08-06 17:54 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: stable-review, torvalds, akpm, alan, Dan Rosenberg
2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Dan Rosenberg <dan.j.rosenberg@gmail.com>
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.
Signed-off-by: Dan Rosenberg <dan.j.rosenberg@gmail.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
fs/xfs/xfs_dfrag.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
--- a/fs/xfs/xfs_dfrag.c
+++ b/fs/xfs/xfs_dfrag.c
@@ -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;
^ permalink raw reply [flat|nested] 5+ messages in thread
* [3/4] SCSI: enclosure: fix error path - actually return ERR_PTR() on error
2010-08-06 18:27 [0/4] 2.6.27.50-stable review Greg KH
2010-08-06 17:54 ` [1/4] PARISC: led.c - fix potential stack overflow in led_proc_write() Greg KH
2010-08-06 17:54 ` [2/4] xfs: prevent swapext from operating on write-only files Greg KH
@ 2010-08-06 17:54 ` Greg KH
2010-08-06 17:54 ` [4/4] GFS2: rename causes kernel Oops Greg KH
3 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2010-08-06 17:54 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: stable-review, torvalds, akpm, alan, James Bottomley
2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: James Bottomley <James.Bottomley@suse.de>
commit a91c1be21704113b023919826c6d531da46656ef upstream.
we also need to clean up and free the cdev.
Reported-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
drivers/misc/enclosure.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
--- a/drivers/misc/enclosure.c
+++ b/drivers/misc/enclosure.c
@@ -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;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* [4/4] GFS2: rename causes kernel Oops
2010-08-06 18:27 [0/4] 2.6.27.50-stable review Greg KH
` (2 preceding siblings ...)
2010-08-06 17:54 ` [3/4] SCSI: enclosure: fix error path - actually return ERR_PTR() on error Greg KH
@ 2010-08-06 17:54 ` Greg KH
3 siblings, 0 replies; 5+ messages in thread
From: Greg KH @ 2010-08-06 17:54 UTC (permalink / raw)
To: linux-kernel, stable
Cc: stable-review, torvalds, akpm, alan, Bob Peterson,
Steven Whitehouse
2.6.27-stable review patch. If anyone has any objections, please let us know.
------------------
From: Bob Peterson <rpeterso@redhat.com>
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.
Signed-off-by: Bob Peterson <rpeterso@redhat.com>
Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
fs/gfs2/dir.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -393,7 +393,7 @@ static int gfs2_dirent_find_space(const
unsigned 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;
^ permalink raw reply [flat|nested] 5+ messages in thread
* [0/4] 2.6.27.50-stable review
@ 2010-08-06 18:27 Greg KH
2010-08-06 17:54 ` [1/4] PARISC: led.c - fix potential stack overflow in led_proc_write() Greg KH
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Greg KH @ 2010-08-06 18:27 UTC (permalink / raw)
To: linux-kernel, stable; +Cc: stable-review, torvalds, akpm, alan
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(-)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-08-06 18:28 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-06 18:27 [0/4] 2.6.27.50-stable review Greg KH
2010-08-06 17:54 ` [1/4] PARISC: led.c - fix potential stack overflow in led_proc_write() Greg KH
2010-08-06 17:54 ` [2/4] xfs: prevent swapext from operating on write-only files Greg KH
2010-08-06 17:54 ` [3/4] SCSI: enclosure: fix error path - actually return ERR_PTR() on error Greg KH
2010-08-06 17:54 ` [4/4] GFS2: rename causes kernel Oops Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox