mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-04 09:59:32 +00:00
[GFS2] Fix incorrect error path in prepare_write()
The error path in prepare_write() was incorrect in the (very rare) event that the transaction fails to start. The following prevents a NULL pointer dereference, Signed-off-by: Steven Whitehouse <swhiteho@redhat.com>
This commit is contained in:
parent
6eefaf61f6
commit
a867bb28c1
1 changed files with 2 additions and 1 deletions
|
@ -416,7 +416,7 @@ static int gfs2_prepare_write(struct file *file, struct page *page,
|
||||||
|
|
||||||
error = gfs2_trans_begin(sdp, rblocks, 0);
|
error = gfs2_trans_begin(sdp, rblocks, 0);
|
||||||
if (error)
|
if (error)
|
||||||
goto out;
|
goto out_trans_fail;
|
||||||
|
|
||||||
if (gfs2_is_stuffed(ip)) {
|
if (gfs2_is_stuffed(ip)) {
|
||||||
if (end > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)) {
|
if (end > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)) {
|
||||||
|
@ -434,6 +434,7 @@ static int gfs2_prepare_write(struct file *file, struct page *page,
|
||||||
out:
|
out:
|
||||||
if (error) {
|
if (error) {
|
||||||
gfs2_trans_end(sdp);
|
gfs2_trans_end(sdp);
|
||||||
|
out_trans_fail:
|
||||||
if (alloc_required) {
|
if (alloc_required) {
|
||||||
gfs2_inplace_release(ip);
|
gfs2_inplace_release(ip);
|
||||||
out_qunlock:
|
out_qunlock:
|
||||||
|
|
Loading…
Reference in a new issue